workflow: auto close non-english issues

This commit is contained in:
Sean Khan 2025-07-31 18:16:30 -04:00 committed by ZqinKing
commit 959e15c8fb
259 changed files with 82506 additions and 0 deletions

74
.github/ISSUE_TEMPLATE/bug-report.yml vendored Normal file
View File

@ -0,0 +1,74 @@
---
name: NSS Build Support Request
description: Use this template to report issues or request support for building NSS
packages.
body:
- type: markdown
attributes:
value: |
### What is the issue?
Please provide a clear and concise description of the issue or the problem you are encountering.
- type: textarea
id: issue_description
attributes:
label: Issue Description
description: Briefly describe the issue or the problem you are trying to solve.
placeholder: e.g., Error encountered during build, missing package, etc.
validations:
required: true
- type: dropdown
id: openwrt_fork
attributes:
label: 1. Which OpenWrt NSS fork are you using?
description: Select the OpenWrt NSS fork you are building from.
options:
- qosmio/openwrt-ipq
- other
validations:
required: true
- type: dropdown
id: branch
attributes:
label: 2. If you selected 'qosmio/openwrt-ipq', what branch are you building
from?
description: If you selected 'other', you can skip this.
options:
- main-nss
- 24.10-nss
- type: input
id: custom_repo
attributes:
label: 3. If you selected 'other', what is the full repository?
description: Enter the full repository in the format `user/repo`. If you selected
'qosmio/openwrt-ipq', you can skip this.
placeholder: user/repo
- type: input
id: device_name
attributes:
label: 4. What is the exact device you are building for?
description: Provide the specific device name according to CONFIG_TARGET_PROFILE.
placeholder: e.g., DEVICE_linksys_mr7500
validations:
required: true
- type: markdown
attributes:
value: |-
### 5. Attach your `.config` output:
Run the following command and attach the output below
```bash
grep -Pi 'NSS_(?!DRV)|^(?!#)CONFIG_TARGET_(SUBTARGET|PROFILE|qualcommax)|^(?!#)CONFIG_(PACKAGE_kmod-qca-)|MEM_PROFILE' .config
```
- type: textarea
id: config_output
attributes:
label: .config
render: ini
validations:
required: true

2
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@ -0,0 +1,2 @@
blank_issues_enabled: false
contact_links: []

View File

@ -0,0 +1,94 @@
---
name: Auto Close Non-English Issues
on:
issues:
types:
- opened
- edited
workflow_dispatch:
jobs:
detect-language:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install dependencies
run: npm install franc-min
- name: Detect language and close if not English
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |-
# Create a script to detect language that NEVER exits with non-zero
echo "const franc = require('franc-min').franc || require('franc-min');
const text = process.argv[2] || '';
try {
const lang = franc(text, { minLength: 10 });
if (lang !== 'eng') {
console.log(\`Text: \${text}\`);
console.log(\`Language detected: \${lang}. This is not English.\`);
console.log('NON_ENGLISH');
} else {
console.log('Language detected: English.');
console.log('ENGLISH');
}
} catch (error) {
console.error('Error detecting language:', error.message);
console.log('ERROR');
}" > detect.js
# Parse issue title, body, and number
ISSUE_TITLE=$(jq -r '.issue.title' "$GITHUB_EVENT_PATH")
ISSUE_BODY=$(jq -r '.issue.body' "$GITHUB_EVENT_PATH")
ISSUE_NUMBER=${{ github.event.issue.number }}
# Debug title, body, and number
echo "Debug: ISSUE_TITLE='$ISSUE_TITLE'"
echo "Debug: ISSUE_BODY='$ISSUE_BODY'"
echo "Debug: ISSUE_NUMBER='$ISSUE_NUMBER'"
# Function to check language and close issue if needed
check_and_close() {
local text="$1"
local field_name="$2"
if [ -n "$text" ] && [ "$text" != "null" ]; then
echo "Checking $field_name..."
# Run detection and capture the output
result=$(node detect.js "$text" | tail -1)
if [ "$result" = "NON_ENGLISH" ]; then
echo "$field_name is not in English. Closing issue..."
gh issue comment "$ISSUE_NUMBER" --body "Sorry, please open issues in English only. The $field_name was detected as non-English. This issue will be closed automatically."
gh issue close "$ISSUE_NUMBER"
echo "Issue closed successfully due to non-English content."
fi
else
echo "$field_name is empty or null, skipping..."
fi
}
# Check title first
check_and_close "$ISSUE_TITLE" "title"
# Check body second
check_and_close "$ISSUE_BODY" "body"
echo "Workflow completed successfully."

339
LICENSE Normal file
View File

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

10
README.md Normal file
View File

@ -0,0 +1,10 @@
# nss-packages
Qualcomm networking packages feed for OpenWrt
These packages provide drivers for wired networking and offloading features for the following SoC-s:
* IPQ807x
* IPQ60xx (Untested)
* IPQ50xx (Untested)
Note that these require kernel patches which are part of the main OpenWrt tree, this is only the package
feed.

View File

@ -0,0 +1,26 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=aq-fw-download
PKG_RELEASE:=$(AUTORELEASE)
PKG_FLAGS:=nonshared
include $(INCLUDE_DIR)/package.mk
define Package/aq-fw-download
SECTION:=firmware
CATEGORY:=Firmware
DEPENDS:=@TARGET_qualcommax
TITLE:=Aquantia FW downloader utitlity
endef
define Package/aq-fw-download/description
Aquantia FW downloader utitlity
endef
define Package/aq-fw-download/install
$(INSTALL_DIR) $(1)/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/aq-fw-download $(1)/sbin/aq-fw-download
endef
$(eval $(call BuildPackage,aq-fw-download))

View File

@ -0,0 +1,14 @@
ifndef CFLAGS
CFLAGS = -O2 -g
endif
INCLUDES=-Iinclude -Iinclude/registerMap \
-Iinclude/registerMap/APPIA \
-Iinclude/registerMap/HHD
all: aq-fw-download
%.o: %.c
$(CC) $(INCLUDES) $(CFLAGS) -c -o $@ $^
aq-fw-download: mdioBootLoadCLD.o src/AQ_PhyInterface.o src/AQ_API.o
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)

View File

@ -0,0 +1,246 @@
/*
* Copyright (c) 2015, Aquantia
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*! \file
This file contains the AQ_API function and datatype declarations. */
#ifndef AQ_API_TOKEN
#define AQ_API_TOKEN
#include <stdint.h>
#include "AQ_User.h"
#include "AQ_ReturnCodes.h"
/*******************************************************************
General
*******************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
/*! This typedef defines the bool datatype which takes the values
true and false.*/
typedef enum {False = 0, True = 1} AQ_boolean;
/*@}*/
/*******************************************************************
Device Identity
*******************************************************************/
/*! \defgroup deviceIdentity Device Identity
All AQ_API functions accept a parameter identifying the target PHY that
should be acted upon. */
/*@{*/
/*! This enumeration is used to describe the different types of
Aquantia PHY.*/
typedef enum
{
/*! 1/2/4-port package, 40nm architechture.*/
AQ_DEVICE_APPIA,
/*! 1/2/4-port package, 28nm architechture.*/
AQ_DEVICE_HHD
} AQ_API_Device;
/*! This structure is used to specify a particular Aquantia PHY port
within the system.*/
typedef struct
{
/*! The type of Aquantia PHY*/
AQ_API_Device device;
/*! Uniquely identifies the port within the system. AQ_Port must be
defined to whatever data type is suitable for the platform.
AQ_API functions will never do anything with PHY_ID other than
pass it down to the platform's PHY register read/write
functions.*/
AQ_Port PHY_ID;
} AQ_API_Port;
/*@}*/
/*! This function boot-loads the instruction and data memory (IRAM and
DRAM) of a set of Aquantia PHYs from a .cld format image file (the
same image file used to burn the FLASH). During boot-load of each
Aquantia PHY, the processor is halted, and after programming is
complete the processor is released. Note that calling this
function leaves the daisy-chain disabled to prevent RAM over-
write. To exit MDIO boot-load mode, use the function
AQ_API_EnableDaisyChain.
Unlike most of the other functions in this API, this function can
operate on a group of PHYs simultaneously. This is referred to as
gang-loading. To facilitate this, this function takes as
parameters 3 parallel arrays: PHY_IDs, provisioningAddresses, and
resultCodes. The length of these arrays must be identical, and is
specified by the num_PHY_IDs parameter.
In order to check the integrity of the boot-load operation, a
CRC-16 value is calculated over the IRAM and DRAM. After the image
has been loaded, this value is directly compared against each
PHY's Mailbox CRC-16 in 1E.0201.
The value of register 1E.C441 must be the same for all the boot-
loaded PHYs. This will be checked before the boot-load is
performed, and if a non-uniform value is read from any of the
PHYs, the function will fail before any writes are performed.
A separate result code is returned for each of the boot-loaded
PHYs, in the OUT parameter, resultCodes.
Individual Port Return codes:
AQ_RET_BOOTLOAD_PROVADDR_OOR: The specified provisioning address
was outside of the permitted range.
AQ_RET_BOOTLOAD_NONUNIFORM_REGVALS: The values of the register(s)
that must be uniform across the ports being bootloaded were not
uniform.
AQ_RET_BOOTLOAD_CRC_MISMATCH: The image was completely loaded into
memory, but the after the port exited bootload the running
checksum that was read from the uP memory mailbox was not the
expected value. This indicates that the memory has potentially
been corrupted, and the PHY should be reset before trying the
bootload again.
Overall Return codes (the return value from the function call):
AQ_RET_OK: all ports were successfully bootloaded.
AQ_RET_ERROR: One or more ports were not successfully bootloaded.
*/
AQ_Retcode AQ_API_WriteBootLoadImage
(
/*! An array identifying the target PHY ports.*/
AQ_API_Port** ports,
/*! The length of the arrays ports, provisioningAddresses, and
resultCodes. These are parallel arrays, and must all be of the
same length.*/
unsigned int numPorts,
/*! The provisioning addresses of each of the PHYs specified in
ports. This can range from 0 through 47, and is also known as
the daisy-chain address or the hop-count. If the PHYs are
connected to a FLASH using the daisy-chain, this is the distance
from the PHY to the FLASH, and is used to identify customized
provisioning for each PHY from the provisioning data within the
image. Otherwise, it is an arbitrary number. The length of this
array must match the length of ports.*/
unsigned int* provisioningAddresses,
/*! OUT: The result code indicating success or failure of boot-
loading each of the PHYs specified in ports.*/
AQ_Retcode* resultCodes,
/*! A pointer to the size of the image (in bytes) that is being
loaded into the Aquantia PHY.*/
uint32_t* imageSizePointer,
/*! The image being loaded into the Aquantia PHY. This is the same
regardless of whether the target is internal RAM or FLASH.*/
uint8_t* image,
/*! The 5-bit address to be used during the gang-loading operation.
During the boot-loading process, each of the PHYs specified in
ports will be changed such that they are addressed on the MDIO
bus at gangloadAddress. This allows all the PHYs to be loaded
simultaneously. Before returning, each PHY will be moved back to
its original MDIO address. If ports contains only a single
element, callers will probably want to use the PHY's original
MDIO address for this parameter.*/
uint8_t gangload_MDIO_address,
/*! The address of the PHYs while in gangload mode. This is
ultimately some combination of the system address and the
gangload MDIO address, specified by gangload_MDIO_address. For
most platforms, gangload_MDIO_address and gangload_PHY_ID should
have the same value.*/
AQ_API_Port* gangloadPort
);
/*! This function boot-loads the instruction and data memory (IRAM and
DRAM) of a set of Aquantia PHYs from a .cld format image file (the
same image file used to burn the FLASH), as well as a separately
provided provisioning table image file.The provisioning table
image allows additional provisioning to be provided, beyond what
is built in to the .cld image. If provTableSizePointer or
provTableImage are NULL, this function behaves like
AQ_API_WriteBootLoadImage.
Aside from the additional provisioing table, this function behaves
exactly the same as AQ_API_WriteBootLoadImage. For additional
documentation and information on return codes, refer to
AQ_API_WriteBootLoadImage.
Individual Port Return codes (same as AQ_API_WriteBootLoadImage,
plus):
AQ_RET_BOOTLOAD_PROVTABLE_TOO_LARGE: The supplied provisioning
table image does not fit within the alloted space.*/
AQ_Retcode AQ_API_WriteBootLoadImageWithProvTable
(
/*! An array identifying the target PHY ports.*/
AQ_API_Port** ports,
/*! The length of the arrays ports, provisioningAddresses, and
resultCodes. These are parallel arrays, and must all be of the
same length.*/
unsigned int numPorts,
/*! The provisioning addresses of each of the PHYs specified in
ports. This can range from 0 through 47, and is also known as
the daisy-chain address or the hop-count. If the PHYs are
connected to a FLASH using the daisy-chain, this is the distance
from the PHY to the FLASH, and is used to identify customized
provisioning for each PHY from the provisioning data within the
image. Otherwise, it is an arbitrary number. The length of this
array must match the length of ports.*/
unsigned int* provisioningAddresses,
/*! OUT: The result code indicating success or failure of boot-
loading each of the PHYs specified in ports.*/
AQ_Retcode* resultCodes,
/*! A pointer to the size of the image (in bytes) that is being
loaded into the Aquantia PHY.*/
uint32_t* imageSizePointer,
/*! The image being loaded into the Aquantia PHY. This is the same
regardless of whether the target is internal RAM or FLASH.*/
uint8_t* image,
/*! The 5-bit address to be used during the gang-loading operation.
During the boot-loading process, each of the PHYs specified in
ports will be changed such that they are addressed on the MDIO
bus at gangloadAddress. This allows all the PHYs to be loaded
simultaneously. Before returning, each PHY will be moved back to
its original MDIO address. If ports contains only a single
element, callers will probably want to use the PHY's original
MDIO address for this parameter.*/
uint8_t gangload_MDIO_address,
/*! The address of the PHYs while in gangload mode. This is
ultimately some combination of the system address and the
gangload MDIO address, specified by gangload_MDIO_address. For
most platforms, gangload_MDIO_address and gangload_PHY_ID should
have the same value.*/
AQ_API_Port* gangloadPort,
/*! A pointer to the size of the provTableImage (in bytes) that is
being loaded into the Aquantia PHY.*/
uint32_t* provTableSizePointer,
/*! The additional provisioning table image being loaded into the
Aquantia PHY.*/
uint8_t* provTableImage
);
/*! Calling this function disables boot-loading and enables the daisy-
chain. This would typically be called after using MDIO boot-
loading on a daisy-chain enabled PHY. Re-enabling the daisy-chain
after performing an MDIO bootload will cause the PHY to reboot
from FLASH.*/
AQ_Retcode AQ_API_EnableDaisyChain
(
/*! The target PHY port.*/
AQ_API_Port* port
);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,171 @@
/* AQ_PhyInterface.h */
/***********************************************************************
* Copyright (c) 2015, Aquantia
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Description:
*
* Declares the base PHY register read and write functions that are
* called by the API functions. The platform integrator must provide
* the implementation of these routines.
*
***********************************************************************/
/*! \file
* Declares the base PHY register read and write functions that are
* called by the API functions. The platform integrator must provide
* the implementation of these routines. */
#ifndef AQ_PHY_INTERFACE_TOKEN
#define AQ_PHY_INTERFACE_TOKEN
#include "AQ_API.h"
#include "AQ_User.h"
#ifdef __cplusplus
extern "C" {
#endif
/*******************************************************************
MDIO Access Functions
*******************************************************************/
/*! \defgroup mdioAccessFunctions MDIO Access Functions
The MDIO access functions are required by the API to access the register space
of each Aquantia PHY deployed in a system. The body of these functions needs to
be written by the system designer, as the method of accessing the PHY will
be unique to the target system. They are designed to be generic read and
write access functions, as the MDIO addressing scheme relies on each
MMD to maintain a 16 bit address pointer that determines the register where
the next read or write is coming from. Consequently, various levels of
optimization of the MDIO interface are possible: from re-writing the MMD
address pointer on every transaction, to storing shadow copies of the MMD
address pointers and only updating the MMD address pointer as necessary.
Thus these functions leave the MDIO optimization to the system engineer.
*/
/*@{*/
/*! Provides generic synchronous PHY register write functionality. It is the
* responsibility of the system designer to provide the specific MDIO address
* pointer updates, etc. in order to accomplish this write operation.
* It will be assumed that the write has been completed by the time this
* function returns.*/
void AQ_API_MDIO_Write
(
/*! Uniquely identifies the port within the system. AQ_Port must be
* defined to a whatever data type is suitable for the platform.*/
AQ_Port PHY_ID,
/*! The address of the MMD within the target PHY. */
unsigned int MMD,
/*! The 16-bit address of the PHY register being written. */
unsigned int address,
/*! The 16-bits of data to write to the specified PHY register. */
unsigned int data
);
/*! Provides generic synchronous PHY register read functionality. It is the
* responsibility of the system designer to provide the specific MDIO address
* pointer updates, etc. in order to accomplish this read operation.*/
unsigned int AQ_API_MDIO_Read
(
/*! Uniquely identifies the port within the system. AQ_Port must be
* defined to a whatever data type is suitable for the platform.*/
AQ_Port PHY_ID,
/*! The address of the MMD within the target PHY. */
unsigned int MMD,
/*! The 16-bit address of the PHY register being read. */
unsigned int address
);
#ifdef AQ_PHY_SUPPORTS_BLOCK_READ_WRITE
/*! Provides generic asynchronous/buffered PHY register write functionality.
* It is the responsibility of the system designer to provide the specific
* MDIO address pointer updates, etc. in order to accomplish this write
* operation. The write need not necessarily have been completed by the time
* this function returns. All register reads and writes to a particular PHY_ID
* that are requested by calling AQ_API_MDIO_BlockWrite or AQ_API_MDIO_BlockRead
* MUST be performed in the order that the calls are made. */
void AQ_API_MDIO_BlockWrite
(
/*! Uniquely identifies the port within the system. AQ_Port must be
* defined to a whatever data type is suitable for the platform.*/
AQ_Port PHY_ID,
/*! The address of the MMD within the target PHY. */
unsigned int MMD,
/*! The 16-bit address of the PHY register being written. */
unsigned int address,
/*! The 16-bits of data to write to the specified PHY register. */
unsigned int data
);
/*! Provides generic asynchronous/buffered PHY register read functionality.
* It is the responsibility of the system designer to provide the specific
* MDIO address pointer updates, etc. in order to accomplish this read
* operation. All register reads and writes to a particular PHY_ID that
* are requested by calling AQ_API_MDIO_BlockWrite or AQ_API_MDIO_BlockRead
* MUST be performed in the order that the calls are made. The register value
* may subsequently be fetched by calling AQ_API_MDIO_BlockOperationExecute.*/
void AQ_API_MDIO_BlockRead
(
/*! Uniquely identifies the port within the system. AQ_Port must be
* defined to a whatever data type is suitable for the platform.*/
AQ_Port PHY_ID,
/*! The address of the MMD within the target PHY. */
unsigned int MMD,
/*! The 16-bit address of the PHY register being read. */
unsigned int address
);
/* Retrieve the results of all PHY register reads to PHY_ID previously
* requested via calls to AQ_API_MDIO_BlockRead. The read and write
* operations previously performed by calls to AQ_API_MDIO_BlockRead and
* AQ_API_MDIO_BlockRead must have all been completed by the time this
* function returns, in the order that the calls were performed. The
* return value is an array representing the fetched results of all
* pending calls to AQ_API_MDIO_BlockRead, in the order that the calls
* were performed. Callers should track the number of pending block
* reads to determine the size of the returned array. */
unsigned int * AQ_API_MDIO_BlockOperationExecute
(
/*! Uniquely identifies the port within the system. AQ_Port must be
* defined to a whatever data type is suitable for the platform.*/
AQ_Port PHY_ID
);
/* Returns the maximum number of asynchronous/buffered PHY register
* read/write operations. Callers will call AQ_API_MDIO_BlockOperationExecute
* before issuing additional calls to AQ_API_MDIO_BlockWrite or
* AQ_API_MDIO_BlockRead to avoid a buffer overflow. */
unsigned int AQ_API_MDIO_MaxBlockOperations
(
);
#endif
/*@}*/
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,71 @@
/*AQ_PlatformRoutines.h*/
/************************************************************************************
* Copyright (c) 2015, Aquantia
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Description:
*
* Declares the platform interface functions that will be called by AQ_API
* functions. The platform integrator must provide the implementation of
* these functions.
*
************************************************************************************/
/*! \file
* Declares the platform interface functions that will be called by AQ_API
* functions. The platform integrator must provide the implementation of
* these functions. */
#ifndef AQ_PHY_PLATFORMROUTINES_TOKEN
#define AQ_PHY_PLATFORMROUTINES_TOKEN
#include <stdint.h>
#include "AQ_API.h"
#include "AQ_User.h"
#include "AQ_ReturnCodes.h"
#ifdef __cplusplus
extern "C" {
#endif
/*******************************************************************
Time Delay
*******************************************************************/
/*! \defgroup delay Time Delay
@{
*/
/*! Returns after at least milliseconds have elapsed. This must be implemented
* in a platform-approriate way. AQ_API functions will call this function to
* block for the specified period of time. If necessary, PHY register reads
* may be performed on port to busy-wait. */
void AQ_API_Wait
(
uint32_t milliseconds, /*!< The delay in milliseconds */
AQ_API_Port* port /*!< The PHY to use if delay reads are necessary*/
);
/*@}*/
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,323 @@
/* Copyright (c) 2015, Aquantia
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*! \file
This file contains macros for accessing the AQ PHYs' registers
using the device-specific register map data structures and definitions.
*/
#ifndef AQ_REG_MACRO_TOKEN
#define AQ_REG_MACRO_TOKEN
#include "AQ_PhyInterface.h"
#define AQ_API_ReadRegister(id,reg,wd) AQ_API_ReadRegister_DeviceRestricted(APPIA_HHD,id,reg,wd)
#define AQ_API_ReadRegister_DeviceRestricted(devices,id,reg,wd) AQ_API_ReadRegister_Devs_ ## devices(id,reg,wd)
#define AQ_API_ReadRegister_Devs_APPIA(id,reg,wd) \
((port->device == AQ_DEVICE_APPIA) ? AQ_API_MDIO_Read (id,reg ## _APPIA_mmdAddress,(reg ## _APPIA_baseRegisterAddress + wd)) : \
(0))
#define AQ_API_ReadRegister_Devs_HHD(id,reg,wd) \
((port->device == AQ_DEVICE_HHD) ? AQ_API_MDIO_Read (id,reg ## _HHD_mmdAddress,(reg ## _HHD_baseRegisterAddress + wd)) : \
(0))
#define AQ_API_ReadRegister_Devs_APPIA_HHD(id,reg,wd) \
((port->device == AQ_DEVICE_HHD) ? AQ_API_MDIO_Read (id,reg ## _HHD_mmdAddress,(reg ## _HHD_baseRegisterAddress + wd)) : \
((port->device == AQ_DEVICE_APPIA) ? AQ_API_MDIO_Read (id,reg ## _APPIA_mmdAddress,(reg ## _APPIA_baseRegisterAddress + wd)) : \
(0)))
#define AQ_API_ReadRegister_Devs_HHD_APPIA(id,reg,wd) AQ_API_ReadRegister_Devs_APPIA_HHD(id,reg,wd)
#define AQ_API_WriteRegister(id,reg,wd,value) AQ_API_WriteRegister_DeviceRestricted(APPIA_HHD,id,reg,wd,value)
#define AQ_API_WriteRegister_DeviceRestricted(devices,id,reg,wd,value) AQ_API_WriteRegister_Devs_ ## devices(id,reg,wd,value)
#define AQ_API_WriteRegister_Devs_APPIA(id,reg,wd,value) \
((port->device == AQ_DEVICE_APPIA) ? AQ_API_MDIO_Write (id,reg ## _APPIA_mmdAddress,(reg ## _APPIA_baseRegisterAddress + wd),value) : \
((void)0))
#define AQ_API_WriteRegister_Devs_HHD(id,reg,wd,value) \
((port->device == AQ_DEVICE_HHD) ? AQ_API_MDIO_Write (id,reg ## _HHD_mmdAddress,(reg ## _HHD_baseRegisterAddress + wd),value) : \
((void)0))
#define AQ_API_WriteRegister_Devs_APPIA_HHD(id,reg,wd,value) \
((port->device == AQ_DEVICE_HHD) ? AQ_API_MDIO_Write (id,reg ## _HHD_mmdAddress,(reg ## _HHD_baseRegisterAddress + wd),value) : \
((port->device == AQ_DEVICE_APPIA) ? AQ_API_MDIO_Write (id,reg ## _APPIA_mmdAddress,(reg ## _APPIA_baseRegisterAddress + wd),value) : \
((void)0)))
#define AQ_API_WriteRegister_Devs_HHD_APPIA(id,reg,wd,value) AQ_API_WriteRegister_Devs_APPIA_HHD(id,reg,wd,value)
#ifdef AQ_PHY_SUPPORTS_BLOCK_READ_WRITE
#define AQ_API_BlockReadRegister(id,reg,wd) AQ_API_BlockReadRegister_DeviceRestricted(APPIA_HHD,id,reg,wd)
#define AQ_API_BlockReadRegister_DeviceRestricted(devices,id,reg,wd) AQ_API_BlockReadRegister_Devs_ ## devices(id,reg,wd)
#define AQ_API_BlockReadRegister_Devs_APPIA(id,reg,wd) \
((port->device == AQ_DEVICE_APPIA) ? AQ_API_MDIO_BlockRead (id,reg ## _APPIA_mmdAddress,(reg ## _APPIA_baseRegisterAddress + wd)) : \
((void)0))
#define AQ_API_BlockReadRegister_Devs_HHD(id,reg,wd) \
((port->device == AQ_DEVICE_HHD) ? AQ_API_MDIO_BlockRead (id,reg ## _HHD_mmdAddress,(reg ## _HHD_baseRegisterAddress + wd)) : \
((void)0))
#define AQ_API_BlockReadRegister_Devs_APPIA_HHD(id,reg,wd) \
((port->device == AQ_DEVICE_HHD) ? AQ_API_MDIO_BlockRead (id,reg ## _HHD_mmdAddress,(reg ## _HHD_baseRegisterAddress + wd)) : \
((port->device == AQ_DEVICE_APPIA) ? AQ_API_MDIO_BlockRead (id,reg ## _APPIA_mmdAddress,(reg ## _APPIA_baseRegisterAddress + wd)) : \
((void)0)))
#define AQ_API_BlockReadRegister_Devs_HHD_APPIA(id,reg,wd) AQ_API_BlockReadRegister_Devs_APPIA_HHD(id,reg,wd)
#define AQ_API_BlockWriteRegister(id,reg,wd,value) AQ_API_BlockWriteRegister_DeviceRestricted(APPIA_HHD,id,reg,wd,value)
#define AQ_API_BlockWriteRegister_DeviceRestricted(devices,id,reg,wd,value) AQ_API_BlockWriteRegister_Devs_ ## devices(id,reg,wd,value)
#define AQ_API_BlockWriteRegister_Devs_APPIA(id,reg,wd,value) \
((port->device == AQ_DEVICE_APPIA) ? AQ_API_MDIO_BlockWrite (id,reg ## _APPIA_mmdAddress,(reg ## _APPIA_baseRegisterAddress + wd),value) : \
((void)0))
#define AQ_API_BlockWriteRegister_Devs_HHD(id,reg,wd,value) \
((port->device == AQ_DEVICE_HHD) ? AQ_API_MDIO_BlockWrite (id,reg ## _HHD_mmdAddress,(reg ## _HHD_baseRegisterAddress + wd),value) : \
((void)0))
#define AQ_API_BlockWriteRegister_Devs_APPIA_HHD(id,reg,wd,value) \
((port->device == AQ_DEVICE_HHD) ? AQ_API_MDIO_BlockWrite (id,reg ## _HHD_mmdAddress,(reg ## _HHD_baseRegisterAddress + wd),value) : \
((port->device == AQ_DEVICE_APPIA) ? AQ_API_MDIO_BlockWrite (id,reg ## _APPIA_mmdAddress,(reg ## _APPIA_baseRegisterAddress + wd),value) : \
((void)0)))
#define AQ_API_BlockWriteRegister_Devs_HHD_APPIA(id,reg,wd,value) AQ_API_BlockWriteRegister_Devs_APPIA_HHD(id,reg,wd,value)
#endif
#define AQ_API_Variable(reg) AQ_API_Variable_DeviceRestricted(APPIA_HHD,reg)
#define AQ_API_Variable_DeviceRestricted(devices,reg) AQ_API_Variable_Devs_ ## devices(reg)
#define AQ_API_Variable_Devs_APPIA(reg) uint8_t _local ## reg ## _space[ sizeof(reg ## _BiggestVersion) ];\
reg ## _APPIA* _local ## reg ## _APPIA = (reg ## _APPIA*) _local ## reg ## _space; \
#define AQ_API_Variable_Devs_HHD(reg) uint8_t _local ## reg ## _space[ sizeof(reg ## _BiggestVersion) ];\
reg ## _HHD* _local ## reg ## _HHD = (reg ## _HHD*) _local ## reg ## _space; \
#define AQ_API_Variable_Devs_APPIA_HHD(reg) uint8_t _local ## reg ## _space[ sizeof(reg ## _BiggestVersion) ];\
reg ## _APPIA* _local ## reg ## _APPIA = (reg ## _APPIA*) _local ## reg ## _space; \
reg ## _HHD* _local ## reg ## _HHD = (reg ## _HHD*) _local ## reg ## _space; \
#define AQ_API_Variable_Devs_HHD_APPIA(reg) AQ_API_Variable_Devs_APPIA_HHD(reg)
#define AQ_API_DeclareLocalStruct(reg,localvar) AQ_API_DeclareLocalStruct_DeviceRestricted(APPIA_HHD,reg,localvar)
#define AQ_API_DeclareLocalStruct_DeviceRestricted(devices,reg,localvar) AQ_API_DeclareLocalStruct_Devs_ ## devices(reg,localvar)
#define AQ_API_DeclareLocalStruct_Devs_APPIA(reg,localvar) uint8_t localvar ## _space[ sizeof(reg ## _BiggestVersion) ];\
reg ## _APPIA* localvar ## _APPIA = (reg ## _APPIA*) localvar ## _space; \
#define AQ_API_DeclareLocalStruct_Devs_HHD(reg,localvar) uint8_t localvar ## _space[ sizeof(reg ## _BiggestVersion) ];\
reg ## _HHD* localvar ## _HHD = (reg ## _HHD*) localvar ## _space; \
#define AQ_API_DeclareLocalStruct_Devs_APPIA_HHD(reg,localvar) uint8_t localvar ## _space[ sizeof(reg ## _BiggestVersion) ];\
reg ## _APPIA* localvar ## _APPIA = (reg ## _APPIA*) localvar ## _space; \
reg ## _HHD* localvar ## _HHD = (reg ## _HHD*) localvar ## _space; \
#define AQ_API_DeclareLocalStruct_Devs_HHD_APPIA(reg,localvar) AQ_API_DeclareLocalStruct_Devs_APPIA_HHD(reg,localvar)
#define AQ_API_Set(id,reg,field,value) AQ_API_Set_DeviceRestricted(APPIA_HHD,id,reg,field,value)
#define AQ_API_Set_DeviceRestricted(devices,id,reg,field,value) AQ_API_Set_Devs_ ## devices(id,reg,field,value)
#define AQ_API_Set_Devs_APPIA(id,reg,field,value) { \
switch (port->device) { \
case AQ_DEVICE_APPIA: \
_local ## reg ## _APPIA->word_ ## reg ## _APPIA_ ## field = AQ_API_ReadRegister_Devs_APPIA(id,reg,reg ## _APPIA_ ## field); \
if (_local ## reg ## _APPIA->bits_ ## reg ## _APPIA_ ## field.field != value) \
{ \
_local ## reg ## _APPIA->bits_ ## reg ## _APPIA_ ## field.field = value; \
AQ_API_WriteRegister_Devs_APPIA(id,reg,reg ## _APPIA_ ## field,_local ## reg ## _APPIA->word_ ## reg ## _APPIA_ ## field); \
} \
break; \
default: break; \
} \
}
#define AQ_API_Set_Devs_HHD(id,reg,field,value) { \
switch (port->device) { \
case AQ_DEVICE_HHD: \
_local ## reg ## _HHD->word_ ## reg ## _HHD_ ## field = AQ_API_ReadRegister_Devs_HHD(id,reg,reg ## _HHD_ ## field); \
if (_local ## reg ## _HHD->bits_ ## reg ## _HHD_ ## field.field != value) \
{ \
_local ## reg ## _HHD->bits_ ## reg ## _HHD_ ## field.field = value; \
AQ_API_WriteRegister_Devs_HHD(id,reg,reg ## _HHD_ ## field,_local ## reg ## _HHD->word_ ## reg ## _HHD_ ## field); \
} \
break; \
default: break; \
} \
}
#define AQ_API_Set_Devs_APPIA_HHD(id,reg,field,value) { \
switch (port->device) { \
case AQ_DEVICE_APPIA: \
_local ## reg ## _APPIA->word_ ## reg ## _APPIA_ ## field = AQ_API_ReadRegister_Devs_APPIA_HHD(id,reg,reg ## _APPIA_ ## field); \
if (_local ## reg ## _APPIA->bits_ ## reg ## _APPIA_ ## field.field != value) \
{ \
_local ## reg ## _APPIA->bits_ ## reg ## _APPIA_ ## field.field = value; \
AQ_API_WriteRegister_Devs_APPIA_HHD(id,reg,reg ## _APPIA_ ## field,_local ## reg ## _APPIA->word_ ## reg ## _APPIA_ ## field); \
} \
break; \
case AQ_DEVICE_HHD: \
_local ## reg ## _HHD->word_ ## reg ## _HHD_ ## field = AQ_API_ReadRegister_Devs_APPIA_HHD(id,reg,reg ## _HHD_ ## field); \
if (_local ## reg ## _HHD->bits_ ## reg ## _HHD_ ## field.field != value) \
{ \
_local ## reg ## _HHD->bits_ ## reg ## _HHD_ ## field.field = value; \
AQ_API_WriteRegister_Devs_APPIA_HHD(id,reg,reg ## _HHD_ ## field,_local ## reg ## _HHD->word_ ## reg ## _HHD_ ## field); \
} \
break; \
default: break; \
} \
}
#define AQ_API_Set_Devs_HHD_APPIA(id,reg,field,value) AQ_API_Set_Devs_APPIA_HHD(id,reg,field,value)
#define AQ_API_Get(id,reg,field,value) AQ_API_Get_DeviceRestricted(APPIA_HHD,id,reg,field,value)
#define AQ_API_Get_DeviceRestricted(devices,id,reg,field,value) AQ_API_Get_Devs_ ## devices(id,reg,field,value)
#define AQ_API_Get_Devs_APPIA(id,reg,field,value) { \
switch (port->device) { \
case AQ_DEVICE_APPIA: \
_local ## reg ## _APPIA->word_ ## reg ## _APPIA_ ## field = AQ_API_ReadRegister_Devs_APPIA(id,reg,reg ## _APPIA_ ## field); \
value = _local ## reg ## _APPIA->bits_ ## reg ## _APPIA_ ## field.field; \
break; \
default: value = 0; break; \
} \
}
#define AQ_API_Get_Devs_HHD(id,reg,field,value) { \
switch (port->device) { \
case AQ_DEVICE_HHD: \
_local ## reg ## _HHD->word_ ## reg ## _HHD_ ## field = AQ_API_ReadRegister_Devs_HHD(id,reg,reg ## _HHD_ ## field); \
value = _local ## reg ## _HHD->bits_ ## reg ## _HHD_ ## field.field; \
break; \
default: value = 0; break; \
} \
}
#define AQ_API_Get_Devs_APPIA_HHD(id,reg,field,value) { \
switch (port->device) { \
case AQ_DEVICE_APPIA: \
_local ## reg ## _APPIA->word_ ## reg ## _APPIA_ ## field = AQ_API_ReadRegister_Devs_APPIA_HHD(id,reg,reg ## _APPIA_ ## field); \
value = _local ## reg ## _APPIA->bits_ ## reg ## _APPIA_ ## field.field; \
break; \
case AQ_DEVICE_HHD: \
_local ## reg ## _HHD->word_ ## reg ## _HHD_ ## field = AQ_API_ReadRegister_Devs_APPIA_HHD(id,reg,reg ## _HHD_ ## field); \
value = _local ## reg ## _HHD->bits_ ## reg ## _HHD_ ## field.field; \
break; \
default: value = 0; break; \
} \
}
#define AQ_API_Get_Devs_HHD_APPIA(id,reg,field,value) AQ_API_Get_Devs_APPIA_HHD(id,reg,field,value)
#define AQ_API_BitfieldOfLocalStruct(reg,localvar,field) AQ_API_BitfieldOfLocalStruct_DeviceRestricted(APPIA_HHD,reg,localvar,field)
#define AQ_API_BitfieldOfLocalStruct_DeviceRestricted(devices,reg,localvar,field) AQ_API_BitfieldOfLocalStruct_Devs_ ## devices(reg,localvar,field)
#define AQ_API_BitfieldOfLocalStruct_Devs_APPIA(reg,localvar,field) \
((port->device == AQ_DEVICE_APPIA) ? ((localvar ## _APPIA)->bits_ ## reg ## _APPIA ## _ ## field.field) : \
(0))
#define AQ_API_BitfieldOfLocalStruct_Devs_HHD(reg,localvar,field) \
((port->device == AQ_DEVICE_HHD) ? ((localvar ## _HHD)->bits_ ## reg ## _HHD ## _ ## field.field) : \
(0))
#define AQ_API_BitfieldOfLocalStruct_Devs_APPIA_HHD(reg,localvar,field) \
((port->device == AQ_DEVICE_HHD) ? ((localvar ## _HHD)->bits_ ## reg ## _HHD ## _ ## field.field) : \
((port->device == AQ_DEVICE_APPIA) ? ((localvar ## _APPIA)->bits_ ## reg ## _APPIA ## _ ## field.field) : \
(0)))
#define AQ_API_BitfieldOfLocalStruct_Devs_HHD_APPIA(reg,localvar,field) AQ_API_BitfieldOfLocalStruct_Devs_APPIA_HHD(reg,localvar,field)
#define AQ_API_AssignBitfieldOfLocalStruct(reg,localvar,field,value) AQ_API_AssignBitfieldOfLocalStruct_DeviceRestricted(APPIA_HHD,reg,localvar,field,value)
#define AQ_API_AssignBitfieldOfLocalStruct_DeviceRestricted(devices,reg,localvar,field,value) AQ_API_AssignBitfieldOfLocalStruct_Devs_ ## devices(reg,localvar,field,value)
#define AQ_API_AssignBitfieldOfLocalStruct_Devs_APPIA(reg,localvar,field,value) \
((port->device == AQ_DEVICE_APPIA) ? ((localvar ## _APPIA)->bits_ ## reg ## _APPIA ## _ ## field.field = value) : \
(0))
#define AQ_API_AssignBitfieldOfLocalStruct_Devs_HHD(reg,localvar,field,value) \
((port->device == AQ_DEVICE_HHD) ? ((localvar ## _HHD)->bits_ ## reg ## _HHD ## _ ## field.field = value) : \
(0))
#define AQ_API_AssignBitfieldOfLocalStruct_Devs_APPIA_HHD(reg,localvar,field,value) \
((port->device == AQ_DEVICE_HHD) ? ((localvar ## _HHD)->bits_ ## reg ## _HHD ## _ ## field.field = value) : \
((port->device == AQ_DEVICE_APPIA) ? ((localvar ## _APPIA)->bits_ ## reg ## _APPIA ## _ ## field.field = value) : \
(0)))
#define AQ_API_AssignBitfieldOfLocalStruct_Devs_HHD_APPIA(reg,localvar,field,value) AQ_API_AssignBitfieldOfLocalStruct_Devs_APPIA_HHD(reg,localvar,field,value)
#define AQ_API_WordOfLocalStruct(localvar,wd) AQ_API_WordOfLocalStruct_DeviceRestricted(APPIA_HHD,localvar,wd)
#define AQ_API_WordOfLocalStruct_DeviceRestricted(devices,localvar,wd) AQ_API_WordOfLocalStruct_Devs_ ## devices(localvar,wd)
#define AQ_API_WordOfLocalStruct_Devs_APPIA(localvar,wd) \
((port->device == AQ_DEVICE_APPIA) ? ((localvar ## _APPIA)->u ## wd.word_ ## wd) : \
(0))
#define AQ_API_WordOfLocalStruct_Devs_HHD(localvar,wd) \
((port->device == AQ_DEVICE_HHD) ? ((localvar ## _HHD)->u ## wd.word_ ## wd) : \
(0))
#define AQ_API_WordOfLocalStruct_Devs_APPIA_HHD(localvar,wd) \
((port->device == AQ_DEVICE_HHD) ? ((localvar ## _HHD)->u ## wd.word_ ## wd) : \
((port->device == AQ_DEVICE_APPIA) ? ((localvar ## _APPIA)->u ## wd.word_ ## wd) : \
(0)))
#define AQ_API_WordOfLocalStruct_Devs_HHD_APPIA(localvar,wd) AQ_API_WordOfLocalStruct_Devs_APPIA_HHD(localvar,wd)
#define AQ_API_AssignWordOfLocalStruct(localvar,wd,value) AQ_API_AssignWordOfLocalStruct_DeviceRestricted(APPIA_HHD,localvar,wd,value)
#define AQ_API_AssignWordOfLocalStruct_DeviceRestricted(devices,localvar,wd,value) AQ_API_AssignWordOfLocalStruct_Devs_ ## devices(localvar,wd,value)
#define AQ_API_AssignWordOfLocalStruct_Devs_APPIA(localvar,wd,value) \
((port->device == AQ_DEVICE_APPIA) ? ((localvar ## _APPIA)->u ## wd.word_ ## wd = value) : \
(0))
#define AQ_API_AssignWordOfLocalStruct_Devs_HHD(localvar,wd,value) \
((port->device == AQ_DEVICE_HHD) ? ((localvar ## _HHD)->u ## wd.word_ ## wd = value) : \
(0))
#define AQ_API_AssignWordOfLocalStruct_Devs_APPIA_HHD(localvar,wd,value) \
((port->device == AQ_DEVICE_HHD) ? ((localvar ## _HHD)->u ## wd.word_ ## wd = value) : \
((port->device == AQ_DEVICE_APPIA) ? ((localvar ## _APPIA)->u ## wd.word_ ## wd = value) : \
(0)))
#define AQ_API_AssignWordOfLocalStruct_Devs_HHD_APPIA(localvar,wd,value) AQ_API_AssignWordOfLocalStruct_Devs_APPIA_HHD(localvar,wd,value)
#endif

View File

@ -0,0 +1,113 @@
/* AQ_ReturnCodes.h */
/************************************************************************************
* Copyright (c) 2015, Aquantia
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Description:
*
* This file defines the AQ_API functions' integral return codes.
*
*
************************************************************************************/
/*! \file
This file defines the AQ_API functions' integral return codes.
*/
#ifndef AQ_RETURNCODES_TOKEN
#define AQ_RETURNCODES_TOKEN
/*! \defgroup ReturnCodes
@{
*/
/*! Most AQ_API functions return AQ_Retcode to report success or failure.
* The values used are defined as preprocessor symbols in AQ_ReturnCodes.h.
* Callers should prefer to test the return values by equivalence to these
* symbols, rather than using the integer values directly, as these may
* not be stable across releases. The set of possible return codes that may
* be returned by a particular API function can be found in the function's
* documentation, as well as information on how to interpret each of the
* possible return codes. */
typedef unsigned int AQ_Retcode;
/*! \defgroup Success
@{ */
#define AQ_RET_OK 0
/*@}*/
/*! \defgroup GeneralErrors
@{ */
#define AQ_RET_ERROR 100
#define AQ_RET_UP_BUSY_TIMEOUT 101
/*@}*/
/*! \defgroup FunctionSpecificResults
@{ */
#define AQ_RET_FLASH_READY 200
#define AQ_RET_FLASH_READINESS_TIMEOUT 204
#define AQ_RET_FLASHINTF_READY 201
#define AQ_RET_FLASHINTF_NOTREADY 202
#define AQ_RET_FLASHINTF_READINESS_TIMEOUT 203
#define AQ_RET_FLASH_TYPE_UNKNOWN 205
#define AQ_RET_FLASH_TYPE_BAD 206
#define AQ_RET_FLASH_IMAGE_CORRUPT 207
#define AQ_RET_FLASH_IMAGE_TOO_LARGE 208
#define AQ_RET_FLASH_IMAGE_MISMATCH 209
#define AQ_RET_FLASH_PAGE_SIZE_CHANGED 210
#define AQ_RET_BOOTLOAD_PROVADDR_OOR 211
#define AQ_RET_BOOTLOAD_NONUNIFORM_REGVALS 212
#define AQ_RET_BOOTLOAD_CRC_MISMATCH 213
#define AQ_RET_BOOTLOAD_PROVTABLE_TOO_LARGE 228
#define AQ_RET_LOOPBACK_BAD_ENTRY_STATE 214
#define AQ_RET_DEBUGTRACE_FREEZE_TIMEOUT 215
#define AQ_RET_DEBUGTRACE_UNFREEZE_TIMEOUT 216
#define AQ_RET_CABLEDIAG_ALREADY_RUNNING 217
#define AQ_RET_CABLEDIAG_STILL_RUNNING 218
#define AQ_RET_CABLEDIAG_BAD_PAIRSTATUS 219
#define AQ_RET_CABLEDIAG_RESULTS_ALREDY_COLLECTED 220
#define AQ_RET_CABLEDIAG_BAD_NUM_SAMPLES 221
#define AQ_RET_CABLEDIAG_REPORTEDPAIR_MISMATCH 222
#define AQ_RET_CABLEDIAG_REPORTEDPAIR_OOR 223
#define AQ_RET_CABLEDIAG_STARTED_PAIR_B 224
#define AQ_RET_CABLEDIAG_STARTED_PAIR_C 225
#define AQ_RET_CABLEDIAG_STARTED_PAIR_D 226
#define AQ_RET_CABLEDIAG_TXENABLE_MISMATCH 227
#define AQ_RET_SERDESEYE_BAD_SERDES_MODE 229
#define AQ_RET_SERDESEYE_BAD_MEAS_COUNT 230
#define AQ_RET_SERDESEYE_MEAS_TIMEOUT 231
#define AQ_RET_SERDESEYE_LANE_OOR 232
#define AQ_RET_SERDESEYE_COORD_OOR 233
#define AQ_RET_PIFMAILBOX_ERROR 234
#define AQ_RET_PIFMAILBOX_TIMEOUT 235
#define AQ_RET_SEC_TABLE_INDEX_OOR 236
/*@}*/
/*@}*/
#endif

View File

@ -0,0 +1,97 @@
/*AQ_User.h*/
/************************************************************************************
* Copyright (c) 2015, Aquantia
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Description:
*
* This file contains preprocessor symbol definitions and type definitions
* for the platform-integrator controlled compile-time AQ_API options.
*
************************************************************************************/
/*! \file
This file contains preprocessor symbol definitions and type definitions
for the platform-integrator controlled compile-time AQ_API options.
*/
#ifndef AQ_USER_TOKEN
#define AQ_USER_TOKEN
/*! \defgroup User User Definitions
This module contains the definitions used to configure AQ_API behavior as desired. */
/*@{*/
/*! Specify the proper data type for AQ_Port. This will depend on the
* platform-specific implementation of the PHY register read/write functions.*/
typedef unsigned int AQ_Port;
/*! If defined, AQ_API functions will print various error and info messages
* to stdout. If not, nothing will be printed and AQ_API.c will NOT include
* stdio.h. */
#define AQ_VERBOSE
/*! If defined, the PHY interface supports block (asynchronous) read/write
* operation. If AQ_PHY_SUPPORTS_BLOCK_READ_WRITE is defined, then
* the API will call the block-operation functions and so implementations
* for each must be provided. If AQ_PHY_SUPPORTS_BLOCK_READ_WRITE is not
* defined, they will not be called, and need not be implemented. */
#undef AQ_PHY_SUPPORTS_BLOCK_READ_WRITE
/*! If defined, time.h exists, and so the associated functions wil be used to
* compute the elapsed time spent in a polling loop, to ensure that the
* maximum time-out period will not be exceeded. If not defined, then
* AQ_MDIO_READS_PER_SECOND will be used to calculate the minimum possible
* elapsed time. */
#define AQ_TIME_T_EXISTS
/*! The maximum number of synchronous PHY register reads that can be performed
* per second. A worst case number can be derived as follows:
*
* AQ_MDIO_READS_PER_SECOND = MDIO Clock Frequency / 64
*
* If using MDIO preamble suppression, multiply this number by 2
*
* For instance, if a 5MHz MDIO clock is being used without preamble supression
* AQ_MDIO_READS_PER_SECOND = 78125
*
* If AQ_TIME_T_EXISTS is defined, this will be ignored and need not be
* defined. If AQ_TIME_T_EXISTS is not defined, this must be defined. */
#define AQ_MDIO_READS_PER_SECOND 78125
/*! If defined, after writing to one of the registers that can trigger a
* processor-intensive MDIO operation, AQ_API functions will poll the
* the "processor intensive MDIO operation in progress" bit and wait for it
* to be zero before proceeding. */
#define AQ_ENABLE_UP_BUSY_CHECKS
/*! If defined, the register map header files containing reverse-packed
* structs will be included. If not, the register map header files containing
* non-reverse-packed structs will be included. The proper choice is typically
* a function of the endianness of the platform; on big-endian systems the
* reverse-packed structs should be used, and on little-endian systems the
* non-reverse-packed structs should be used. */
/*#define AQ_REVERSED_BITFIELD_ORDERING*/
/*@}*/
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,387 @@
/* Copyright (c) 2015, Aquantia
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef AQ_REG_GROUP_MAX_SIZES
#define AQ_REG_GROUP_MAX_SIZES
#define AQ_Autonegotiation10GBaseT_ControlRegister_BiggestVersion AQ_Autonegotiation10GBaseT_ControlRegister_HHD
#define AQ_Autonegotiation10GBaseT_StatusRegister_BiggestVersion AQ_Autonegotiation10GBaseT_StatusRegister_HHD
#define AQ_AutonegotiationAdvertisementRegister_BiggestVersion AQ_AutonegotiationAdvertisementRegister_HHD
#define AQ_AutonegotiationEeeAdvertisementRegister_BiggestVersion AQ_AutonegotiationEeeAdvertisementRegister_HHD
#define AQ_AutonegotiationEeeLinkPartnerAbilityRegister_BiggestVersion AQ_AutonegotiationEeeLinkPartnerAbilityRegister_HHD
#define AQ_AutonegotiationExtendedNextPageTransmitRegister_BiggestVersion AQ_AutonegotiationExtendedNextPageTransmitRegister_HHD
#define AQ_AutonegotiationExtendedNextPageUnformattedCodeRegister_BiggestVersion AQ_AutonegotiationExtendedNextPageUnformattedCodeRegister_HHD
#define AQ_AutonegotiationLinkPartnerBasePageAbilityRegister_BiggestVersion AQ_AutonegotiationLinkPartnerBasePageAbilityRegister_HHD
#define AQ_AutonegotiationLinkPartnerExtendedNextPageAbilityRegister_BiggestVersion AQ_AutonegotiationLinkPartnerExtendedNextPageAbilityRegister_HHD
#define AQ_AutonegotiationLinkPartnerExtendedNextPageUnformattedCodeRegister_BiggestVersion AQ_AutonegotiationLinkPartnerExtendedNextPageUnformattedCodeRegister_HHD
#define AQ_AutonegotiationReceiveLinkPartnerStatus_BiggestVersion AQ_AutonegotiationReceiveLinkPartnerStatus_HHD
#define AQ_AutonegotiationReceiveReservedVendorProvisioning_BiggestVersion AQ_AutonegotiationReceiveReservedVendorProvisioning_APPIA
#define AQ_AutonegotiationReceiveReservedVendorStatus_BiggestVersion AQ_AutonegotiationReceiveReservedVendorStatus_HHD
#define AQ_AutonegotiationReceiveVendorAlarms_BiggestVersion AQ_AutonegotiationReceiveVendorAlarms_HHD
#define AQ_AutonegotiationReceiveVendorInterruptMask_BiggestVersion AQ_AutonegotiationReceiveVendorInterruptMask_HHD
#define AQ_AutonegotiationReservedVendorProvisioning_BiggestVersion AQ_AutonegotiationReservedVendorProvisioning_HHD
#define AQ_AutonegotiationReservedVendorStatus_BiggestVersion AQ_AutonegotiationReservedVendorStatus_HHD
#define AQ_AutonegotiationStandardControl_1_BiggestVersion AQ_AutonegotiationStandardControl_1_HHD
#define AQ_AutonegotiationStandardDeviceIdentifier_BiggestVersion AQ_AutonegotiationStandardDeviceIdentifier_HHD
#define AQ_AutonegotiationStandardDevicesInPackage_BiggestVersion AQ_AutonegotiationStandardDevicesInPackage_HHD
#define AQ_AutonegotiationStandardInterruptMask_BiggestVersion AQ_AutonegotiationStandardInterruptMask_HHD
#define AQ_AutonegotiationStandardPackageIdentifier_BiggestVersion AQ_AutonegotiationStandardPackageIdentifier_HHD
#define AQ_AutonegotiationStandardStatus_1_BiggestVersion AQ_AutonegotiationStandardStatus_1_HHD
#define AQ_AutonegotiationStandardStatus_2_BiggestVersion AQ_AutonegotiationStandardStatus_2_HHD
#define AQ_AutonegotiationTransmitVendorAlarms_BiggestVersion AQ_AutonegotiationTransmitVendorAlarms_APPIA
#define AQ_AutonegotiationTransmitVendorInterruptMask_BiggestVersion AQ_AutonegotiationTransmitVendorInterruptMask_HHD
#define AQ_AutonegotiationVendorGlobalInterruptFlags_BiggestVersion AQ_AutonegotiationVendorGlobalInterruptFlags_HHD
#define AQ_AutonegotiationVendorProvisioning_BiggestVersion AQ_AutonegotiationVendorProvisioning_HHD
#define AQ_AutonegotiationVendorStatus_BiggestVersion AQ_AutonegotiationVendorStatus_HHD
#define AQ_GbePhyExtendedWolControl_BiggestVersion AQ_GbePhyExtendedWolControl_HHD
#define AQ_GbePhySgmii0RxStatus_BiggestVersion AQ_GbePhySgmii0RxStatus_HHD
#define AQ_GbePhySgmii0TxStatus_BiggestVersion AQ_GbePhySgmii0TxStatus_HHD
#define AQ_GbePhySgmii1RxStatus_BiggestVersion AQ_GbePhySgmii1RxStatus_HHD
#define AQ_GbePhySgmii1TxStatus_BiggestVersion AQ_GbePhySgmii1TxStatus_HHD
#define AQ_GbePhySgmii1WolStatus_BiggestVersion AQ_GbePhySgmii1WolStatus_HHD
#define AQ_GbePhySgmiiRxAlarms_BiggestVersion AQ_GbePhySgmiiRxAlarms_HHD
#define AQ_GbePhySgmiiRxInterruptMask_BiggestVersion AQ_GbePhySgmiiRxInterruptMask_HHD
#define AQ_GbePhySgmiiTestControl_BiggestVersion AQ_GbePhySgmiiTestControl_HHD
#define AQ_GbePhySgmiiTxAlarms_BiggestVersion AQ_GbePhySgmiiTxAlarms_HHD
#define AQ_GbePhySgmiiTxInterruptMask_BiggestVersion AQ_GbePhySgmiiTxInterruptMask_HHD
#define AQ_GbePhySgmiiWolStatus_BiggestVersion AQ_GbePhySgmiiWolStatus_HHD
#define AQ_GbePhyVendorGlobalInterruptFlags_BiggestVersion AQ_GbePhyVendorGlobalInterruptFlags_HHD
#define AQ_GbePhyWolControl_BiggestVersion AQ_GbePhyWolControl_HHD
#define AQ_GbePhysgmii1WolStatus_BiggestVersion AQ_GbePhysgmii1WolStatus_APPIA
#define AQ_GbeReservedProvisioning_BiggestVersion AQ_GbeReservedProvisioning_HHD
#define AQ_GbeStandardDeviceIdentifier_BiggestVersion AQ_GbeStandardDeviceIdentifier_HHD
#define AQ_GbeStandardDevicesInPackage_BiggestVersion AQ_GbeStandardDevicesInPackage_HHD
#define AQ_GbeStandardPackageIdentifier_BiggestVersion AQ_GbeStandardPackageIdentifier_HHD
#define AQ_GbeStandardStatus_2_BiggestVersion AQ_GbeStandardStatus_2_HHD
#define AQ_GbeStandardVendorDevicesInPackage_BiggestVersion AQ_GbeStandardVendorDevicesInPackage_HHD
#define AQ_GlobalAlarms_BiggestVersion AQ_GlobalAlarms_HHD
#define AQ_GlobalCableDiagnosticImpedance_BiggestVersion AQ_GlobalCableDiagnosticImpedance_HHD
#define AQ_GlobalCableDiagnosticStatus_BiggestVersion AQ_GlobalCableDiagnosticStatus_APPIA
#define AQ_GlobalChipIdentification_BiggestVersion AQ_GlobalChipIdentification_APPIA
#define AQ_GlobalChipRevision_BiggestVersion AQ_GlobalChipRevision_APPIA
#define AQ_GlobalChip_wideStandardInterruptFlags_BiggestVersion AQ_GlobalChip_wideStandardInterruptFlags_HHD
#define AQ_GlobalChip_wideVendorInterruptFlags_BiggestVersion AQ_GlobalChip_wideVendorInterruptFlags_HHD
#define AQ_GlobalControl_BiggestVersion AQ_GlobalControl_HHD
#define AQ_GlobalDaisyChainStatus_BiggestVersion AQ_GlobalDaisyChainStatus_HHD
#define AQ_GlobalDiagnosticProvisioning_BiggestVersion AQ_GlobalDiagnosticProvisioning_HHD
#define AQ_GlobalEeeProvisioning_BiggestVersion AQ_GlobalEeeProvisioning_HHD
#define AQ_GlobalFaultMessage_BiggestVersion AQ_GlobalFaultMessage_HHD
#define AQ_GlobalFirmwareID_BiggestVersion AQ_GlobalFirmwareID_HHD
#define AQ_GlobalGeneralProvisioning_BiggestVersion AQ_GlobalGeneralProvisioning_HHD
#define AQ_GlobalGeneralStatus_BiggestVersion AQ_GlobalGeneralStatus_HHD
#define AQ_GlobalInterruptChip_wideStandardMask_BiggestVersion AQ_GlobalInterruptChip_wideStandardMask_HHD
#define AQ_GlobalInterruptChip_wideVendorMask_BiggestVersion AQ_GlobalInterruptChip_wideVendorMask_HHD
#define AQ_GlobalInterruptMask_BiggestVersion AQ_GlobalInterruptMask_HHD
#define AQ_GlobalLedProvisioning_BiggestVersion AQ_GlobalLedProvisioning_HHD
#define AQ_GlobalMailboxInterface_BiggestVersion AQ_GlobalMailboxInterface_HHD
#define AQ_GlobalMicroprocessorScratchPad_BiggestVersion AQ_GlobalMicroprocessorScratchPad_HHD
#define AQ_GlobalNvrInterface_BiggestVersion AQ_GlobalNvrInterface_HHD
#define AQ_GlobalNvrProvisioning_BiggestVersion AQ_GlobalNvrProvisioning_HHD
#define AQ_GlobalPinStatus_BiggestVersion AQ_GlobalPinStatus_HHD
#define AQ_GlobalPrimaryStatus_BiggestVersion AQ_GlobalPrimaryStatus_APPIA
#define AQ_GlobalReservedProvisioning_BiggestVersion AQ_GlobalReservedProvisioning_HHD
#define AQ_GlobalReservedStatus_BiggestVersion AQ_GlobalReservedStatus_HHD
#define AQ_GlobalResetControl_BiggestVersion AQ_GlobalResetControl_HHD
#define AQ_GlobalSmbus_0Provisioning_BiggestVersion AQ_GlobalSmbus_0Provisioning_HHD
#define AQ_GlobalSmbus_1Provisioning_BiggestVersion AQ_GlobalSmbus_1Provisioning_HHD
#define AQ_GlobalStandardControl_1_BiggestVersion AQ_GlobalStandardControl_1_HHD
#define AQ_GlobalStandardDeviceIdentifier_BiggestVersion AQ_GlobalStandardDeviceIdentifier_HHD
#define AQ_GlobalStandardDevicesInPackage_BiggestVersion AQ_GlobalStandardDevicesInPackage_HHD
#define AQ_GlobalStandardPackageIdentifier_BiggestVersion AQ_GlobalStandardPackageIdentifier_HHD
#define AQ_GlobalStandardStatus_2_BiggestVersion AQ_GlobalStandardStatus_2_HHD
#define AQ_GlobalStandardVendorDevicesInPackage_BiggestVersion AQ_GlobalStandardVendorDevicesInPackage_HHD
#define AQ_GlobalStatus_BiggestVersion AQ_GlobalStatus_HHD
#define AQ_GlobalThermalProvisioning_BiggestVersion AQ_GlobalThermalProvisioning_HHD
#define AQ_GlobalThermalStatus_BiggestVersion AQ_GlobalThermalStatus_HHD
#define AQ_Kr0AutonegotiationAdvertisementWord_BiggestVersion AQ_Kr0AutonegotiationAdvertisementWord_HHD
#define AQ_Kr0AutonegotiationControl_BiggestVersion AQ_Kr0AutonegotiationControl_HHD
#define AQ_Kr0AutonegotiationExtendedNextPageAdvertisementWord_BiggestVersion AQ_Kr0AutonegotiationExtendedNextPageAdvertisementWord_HHD
#define AQ_Kr0AutonegotiationStatus_BiggestVersion AQ_Kr0AutonegotiationStatus_HHD
#define AQ_Kr0LinkPartnerAutonegotiationAdvertisementWord_BiggestVersion AQ_Kr0LinkPartnerAutonegotiationAdvertisementWord_HHD
#define AQ_Kr0LinkPartnerAutonegotiationExtendedNextPageAdvertisementWord_BiggestVersion AQ_Kr0LinkPartnerAutonegotiationExtendedNextPageAdvertisementWord_HHD
#define AQ_Kr1AutonegotiationAdvertisementWord_BiggestVersion AQ_Kr1AutonegotiationAdvertisementWord_HHD
#define AQ_Kr1AutonegotiationControl_BiggestVersion AQ_Kr1AutonegotiationControl_HHD
#define AQ_Kr1AutonegotiationExtendedNextPageAdvertisementWord_BiggestVersion AQ_Kr1AutonegotiationExtendedNextPageAdvertisementWord_HHD
#define AQ_Kr1AutonegotiationStatus_BiggestVersion AQ_Kr1AutonegotiationStatus_HHD
#define AQ_Kr1LinkPartnerAutonegotiationAdvertisementWord_BiggestVersion AQ_Kr1LinkPartnerAutonegotiationAdvertisementWord_HHD
#define AQ_Kr1LinkPartnerAutonegotiationExtendedNextPageAdvertisementWord_BiggestVersion AQ_Kr1LinkPartnerAutonegotiationExtendedNextPageAdvertisementWord_HHD
#define AQ_MsmLineFifoControlRegister_BiggestVersion AQ_MsmLineFifoControlRegister_HHD
#define AQ_MsmLineGeneralControlRegister_BiggestVersion AQ_MsmLineGeneralControlRegister_HHD
#define AQ_MsmLineGeneralStatusRegister_BiggestVersion AQ_MsmLineGeneralStatusRegister_HHD
#define AQ_MsmLineRxAlignmentErrorsCounterRegister_BiggestVersion AQ_MsmLineRxAlignmentErrorsCounterRegister_HHD
#define AQ_MsmLineRxBroadcastFramesCounterRegister_BiggestVersion AQ_MsmLineRxBroadcastFramesCounterRegister_HHD
#define AQ_MsmLineRxErrorsCounterRegister_BiggestVersion AQ_MsmLineRxErrorsCounterRegister_HHD
#define AQ_MsmLineRxFcsErrorsCounterRegister_BiggestVersion AQ_MsmLineRxFcsErrorsCounterRegister_HHD
#define AQ_MsmLineRxGoodFramesCounterRegister_BiggestVersion AQ_MsmLineRxGoodFramesCounterRegister_HHD
#define AQ_MsmLineRxInRangeLengthErrorsCounterRegister_BiggestVersion AQ_MsmLineRxInRangeLengthErrorsCounterRegister_HHD
#define AQ_MsmLineRxMulticastFramesCounterRegister_BiggestVersion AQ_MsmLineRxMulticastFramesCounterRegister_HHD
#define AQ_MsmLineRxOctetsCounterRegister_BiggestVersion AQ_MsmLineRxOctetsCounterRegister_HHD
#define AQ_MsmLineRxPauseFramesCounterRegister_BiggestVersion AQ_MsmLineRxPauseFramesCounterRegister_HHD
#define AQ_MsmLineRxTooLongErrorsCounterRegister_BiggestVersion AQ_MsmLineRxTooLongErrorsCounterRegister_HHD
#define AQ_MsmLineRxUnicastFramesCounterRegister_BiggestVersion AQ_MsmLineRxUnicastFramesCounterRegister_HHD
#define AQ_MsmLineRxVlanFramesCounterRegister_BiggestVersion AQ_MsmLineRxVlanFramesCounterRegister_HHD
#define AQ_MsmLineTxBroadcastFramesCounterRegister_BiggestVersion AQ_MsmLineTxBroadcastFramesCounterRegister_HHD
#define AQ_MsmLineTxErrorsCounterRegister_BiggestVersion AQ_MsmLineTxErrorsCounterRegister_HHD
#define AQ_MsmLineTxGoodFramesCounterRegister_BiggestVersion AQ_MsmLineTxGoodFramesCounterRegister_HHD
#define AQ_MsmLineTxIpgControlRegister_BiggestVersion AQ_MsmLineTxIpgControlRegister_HHD
#define AQ_MsmLineTxMulticastFramesCounterRegister_BiggestVersion AQ_MsmLineTxMulticastFramesCounterRegister_HHD
#define AQ_MsmLineTxOctetsCounterRegister_BiggestVersion AQ_MsmLineTxOctetsCounterRegister_HHD
#define AQ_MsmLineTxPauseFramesCounterRegister_BiggestVersion AQ_MsmLineTxPauseFramesCounterRegister_HHD
#define AQ_MsmLineTxUnicastFramesCounterRegister_BiggestVersion AQ_MsmLineTxUnicastFramesCounterRegister_HHD
#define AQ_MsmLineTxVlanFramesCounterRegister_BiggestVersion AQ_MsmLineTxVlanFramesCounterRegister_HHD
#define AQ_MsmSystemFifoControlRegister_BiggestVersion AQ_MsmSystemFifoControlRegister_HHD
#define AQ_MsmSystemGeneralControlRegister_BiggestVersion AQ_MsmSystemGeneralControlRegister_HHD
#define AQ_MsmSystemGeneralStatusRegister_BiggestVersion AQ_MsmSystemGeneralStatusRegister_HHD
#define AQ_MsmSystemRxAlignmentErrorsCounterRegister_BiggestVersion AQ_MsmSystemRxAlignmentErrorsCounterRegister_HHD
#define AQ_MsmSystemRxBroadcastFramesCounterRegister_BiggestVersion AQ_MsmSystemRxBroadcastFramesCounterRegister_HHD
#define AQ_MsmSystemRxErrorsCounterRegister_BiggestVersion AQ_MsmSystemRxErrorsCounterRegister_HHD
#define AQ_MsmSystemRxFcsErrorsCounterRegister_BiggestVersion AQ_MsmSystemRxFcsErrorsCounterRegister_HHD
#define AQ_MsmSystemRxGoodFramesCounterRegister_BiggestVersion AQ_MsmSystemRxGoodFramesCounterRegister_HHD
#define AQ_MsmSystemRxInRangeLengthErrorsCounterRegister_BiggestVersion AQ_MsmSystemRxInRangeLengthErrorsCounterRegister_HHD
#define AQ_MsmSystemRxMulticastFramesCounterRegister_BiggestVersion AQ_MsmSystemRxMulticastFramesCounterRegister_HHD
#define AQ_MsmSystemRxOctetsCounterRegister_BiggestVersion AQ_MsmSystemRxOctetsCounterRegister_HHD
#define AQ_MsmSystemRxPauseFramesCounterRegister_BiggestVersion AQ_MsmSystemRxPauseFramesCounterRegister_HHD
#define AQ_MsmSystemRxTooLongErrorsCounterRegister_BiggestVersion AQ_MsmSystemRxTooLongErrorsCounterRegister_HHD
#define AQ_MsmSystemRxUnicastFramesCounterRegister_BiggestVersion AQ_MsmSystemRxUnicastFramesCounterRegister_HHD
#define AQ_MsmSystemRxVlanFramesCounterRegister_BiggestVersion AQ_MsmSystemRxVlanFramesCounterRegister_HHD
#define AQ_MsmSystemTxBroadcastFramesCounterRegister_BiggestVersion AQ_MsmSystemTxBroadcastFramesCounterRegister_HHD
#define AQ_MsmSystemTxErrorsCounterRegister_BiggestVersion AQ_MsmSystemTxErrorsCounterRegister_HHD
#define AQ_MsmSystemTxGoodFramesCounterRegister_BiggestVersion AQ_MsmSystemTxGoodFramesCounterRegister_HHD
#define AQ_MsmSystemTxIpgControlRegister_BiggestVersion AQ_MsmSystemTxIpgControlRegister_HHD
#define AQ_MsmSystemTxMulticastFramesCounterRegister_BiggestVersion AQ_MsmSystemTxMulticastFramesCounterRegister_HHD
#define AQ_MsmSystemTxOctetsCounterRegister_BiggestVersion AQ_MsmSystemTxOctetsCounterRegister_HHD
#define AQ_MsmSystemTxPauseFramesCounterRegister_BiggestVersion AQ_MsmSystemTxPauseFramesCounterRegister_HHD
#define AQ_MsmSystemTxUnicastFramesCounterRegister_BiggestVersion AQ_MsmSystemTxUnicastFramesCounterRegister_HHD
#define AQ_MsmSystemTxVlanFramesCounterRegister_BiggestVersion AQ_MsmSystemTxVlanFramesCounterRegister_HHD
#define AQ_MssEgressControlRegister_BiggestVersion AQ_MssEgressControlRegister_HHD
#define AQ_MssEgressEccInterruptStatusRegister_BiggestVersion AQ_MssEgressEccInterruptStatusRegister_HHD
#define AQ_MssEgressInterruptMaskRegister_BiggestVersion AQ_MssEgressInterruptMaskRegister_HHD
#define AQ_MssEgressInterruptStatusRegister_BiggestVersion AQ_MssEgressInterruptStatusRegister_HHD
#define AQ_MssEgressLutAddressControlRegister_BiggestVersion AQ_MssEgressLutAddressControlRegister_HHD
#define AQ_MssEgressLutControlRegister_BiggestVersion AQ_MssEgressLutControlRegister_HHD
#define AQ_MssEgressLutDataControlRegister_BiggestVersion AQ_MssEgressLutDataControlRegister_HHD
#define AQ_MssEgressMtuSizeControlRegister_BiggestVersion AQ_MssEgressMtuSizeControlRegister_HHD
#define AQ_MssEgressPnControlRegister_BiggestVersion AQ_MssEgressPnControlRegister_HHD
#define AQ_MssEgressSaExpiredStatusRegister_BiggestVersion AQ_MssEgressSaExpiredStatusRegister_HHD
#define AQ_MssEgressSaThresholdExpiredStatusRegister_BiggestVersion AQ_MssEgressSaThresholdExpiredStatusRegister_HHD
#define AQ_MssEgressVlanControlRegister_BiggestVersion AQ_MssEgressVlanControlRegister_HHD
#define AQ_MssEgressVlanTpid_0Register_BiggestVersion AQ_MssEgressVlanTpid_0Register_HHD
#define AQ_MssEgressVlanTpid_1Register_BiggestVersion AQ_MssEgressVlanTpid_1Register_HHD
#define AQ_MssIngressControlRegister_BiggestVersion AQ_MssIngressControlRegister_HHD
#define AQ_MssIngressEccInterruptStatusRegister_BiggestVersion AQ_MssIngressEccInterruptStatusRegister_HHD
#define AQ_MssIngressInterruptMaskRegister_BiggestVersion AQ_MssIngressInterruptMaskRegister_HHD
#define AQ_MssIngressInterruptStatusRegister_BiggestVersion AQ_MssIngressInterruptStatusRegister_HHD
#define AQ_MssIngressLutAddressControlRegister_BiggestVersion AQ_MssIngressLutAddressControlRegister_HHD
#define AQ_MssIngressLutControlRegister_BiggestVersion AQ_MssIngressLutControlRegister_HHD
#define AQ_MssIngressLutDataControlRegister_BiggestVersion AQ_MssIngressLutDataControlRegister_HHD
#define AQ_MssIngressMtuSizeControlRegister_BiggestVersion AQ_MssIngressMtuSizeControlRegister_HHD
#define AQ_MssIngressSaControlRegister_BiggestVersion AQ_MssIngressSaControlRegister_HHD
#define AQ_MssIngressSaExpiredStatusRegister_BiggestVersion AQ_MssIngressSaExpiredStatusRegister_HHD
#define AQ_MssIngressSaIcvErrorStatusRegister_BiggestVersion AQ_MssIngressSaIcvErrorStatusRegister_HHD
#define AQ_MssIngressSaReplayErrorStatusRegister_BiggestVersion AQ_MssIngressSaReplayErrorStatusRegister_HHD
#define AQ_MssIngressSaThresholdExpiredStatusRegister_BiggestVersion AQ_MssIngressSaThresholdExpiredStatusRegister_HHD
#define AQ_MssIngressVlanControlRegister_BiggestVersion AQ_MssIngressVlanControlRegister_HHD
#define AQ_MssIngressVlanTpid_0Register_BiggestVersion AQ_MssIngressVlanTpid_0Register_HHD
#define AQ_MssIngressVlanTpid_1Register_BiggestVersion AQ_MssIngressVlanTpid_1Register_HHD
#define AQ_Pcs10GBaseT_Status_BiggestVersion AQ_Pcs10GBaseT_Status_APPIA
#define AQ_Pcs10G_Status_BiggestVersion AQ_Pcs10G_Status_HHD
#define AQ_Pcs10G_base_rPcsTest_patternControl_BiggestVersion AQ_Pcs10G_base_rPcsTest_patternControl_HHD
#define AQ_Pcs10G_base_rPcsTest_patternErrorCounter_BiggestVersion AQ_Pcs10G_base_rPcsTest_patternErrorCounter_HHD
#define AQ_Pcs10G_base_rTestPatternSeedA_BiggestVersion AQ_Pcs10G_base_rTestPatternSeedA_HHD
#define AQ_Pcs10G_base_rTestPatternSeedB_BiggestVersion AQ_Pcs10G_base_rTestPatternSeedB_HHD
#define AQ_PcsEeeCapabilityRegister_BiggestVersion AQ_PcsEeeCapabilityRegister_HHD
#define AQ_PcsEeeWakeErrorCounter_BiggestVersion AQ_PcsEeeWakeErrorCounter_HHD
#define AQ_PcsReceiveStandardInterruptMask_BiggestVersion AQ_PcsReceiveStandardInterruptMask_APPIA
#define AQ_PcsReceiveVendorAlarms_BiggestVersion AQ_PcsReceiveVendorAlarms_HHD
#define AQ_PcsReceiveVendorCorrectedFrame_1IterationCounter_BiggestVersion AQ_PcsReceiveVendorCorrectedFrame_1IterationCounter_HHD
#define AQ_PcsReceiveVendorCorrectedFrame_2IterationCounter_BiggestVersion AQ_PcsReceiveVendorCorrectedFrame_2IterationCounter_HHD
#define AQ_PcsReceiveVendorCorrectedFrame_3IterationCounter_BiggestVersion AQ_PcsReceiveVendorCorrectedFrame_3IterationCounter_HHD
#define AQ_PcsReceiveVendorCorrectedFrame_4IterationCounter_BiggestVersion AQ_PcsReceiveVendorCorrectedFrame_4IterationCounter_HHD
#define AQ_PcsReceiveVendorCorrectedFrame_5IterationCounter_BiggestVersion AQ_PcsReceiveVendorCorrectedFrame_5IterationCounter_HHD
#define AQ_PcsReceiveVendorCorrectedFrame_6IterationCounter_BiggestVersion AQ_PcsReceiveVendorCorrectedFrame_6IterationCounter_HHD
#define AQ_PcsReceiveVendorCorrectedFrame_7IterationCounter_BiggestVersion AQ_PcsReceiveVendorCorrectedFrame_7IterationCounter_HHD
#define AQ_PcsReceiveVendorCorrectedFrame_8IterationCounter_BiggestVersion AQ_PcsReceiveVendorCorrectedFrame_8IterationCounter_HHD
#define AQ_PcsReceiveVendorCrc_8ErrorCounter_BiggestVersion AQ_PcsReceiveVendorCrc_8ErrorCounter_HHD
#define AQ_PcsReceiveVendorDebug_BiggestVersion AQ_PcsReceiveVendorDebug_HHD
#define AQ_PcsReceiveVendorFcsErrorFrameCounter_BiggestVersion AQ_PcsReceiveVendorFcsErrorFrameCounter_HHD
#define AQ_PcsReceiveVendorFcsNoErrorFrameCounter_BiggestVersion AQ_PcsReceiveVendorFcsNoErrorFrameCounter_HHD
#define AQ_PcsReceiveVendorInterruptMask_BiggestVersion AQ_PcsReceiveVendorInterruptMask_HHD
#define AQ_PcsReceiveVendorProvisioning_BiggestVersion AQ_PcsReceiveVendorProvisioning_HHD
#define AQ_PcsReceiveVendorState_BiggestVersion AQ_PcsReceiveVendorState_HHD
#define AQ_PcsReceiveVendorUncorrectedFrameCounter_BiggestVersion AQ_PcsReceiveVendorUncorrectedFrameCounter_HHD
#define AQ_PcsReceiveXfi0Provisioning_BiggestVersion AQ_PcsReceiveXfi0Provisioning_HHD
#define AQ_PcsReceiveXfi0VendorState_BiggestVersion AQ_PcsReceiveXfi0VendorState_HHD
#define AQ_PcsReceiveXfi1Provisioning_BiggestVersion AQ_PcsReceiveXfi1Provisioning_HHD
#define AQ_PcsReceiveXfi1VendorState_BiggestVersion AQ_PcsReceiveXfi1VendorState_HHD
#define AQ_PcsSerdesMuxSwapTxrxRegister_BiggestVersion AQ_PcsSerdesMuxSwapTxrxRegister_HHD
#define AQ_PcsStandardControl_1_BiggestVersion AQ_PcsStandardControl_1_HHD
#define AQ_PcsStandardControl_2_BiggestVersion AQ_PcsStandardControl_2_HHD
#define AQ_PcsStandardDeviceIdentifier_BiggestVersion AQ_PcsStandardDeviceIdentifier_HHD
#define AQ_PcsStandardDevicesInPackage_BiggestVersion AQ_PcsStandardDevicesInPackage_HHD
#define AQ_PcsStandardInterruptMask_BiggestVersion AQ_PcsStandardInterruptMask_HHD
#define AQ_PcsStandardPackageIdentifier_BiggestVersion AQ_PcsStandardPackageIdentifier_HHD
#define AQ_PcsStandardSpeedAbility_BiggestVersion AQ_PcsStandardSpeedAbility_HHD
#define AQ_PcsStandardStatus_1_BiggestVersion AQ_PcsStandardStatus_1_HHD
#define AQ_PcsStandardStatus_2_BiggestVersion AQ_PcsStandardStatus_2_HHD
#define AQ_PcsTransmitReservedVendorProvisioning_BiggestVersion AQ_PcsTransmitReservedVendorProvisioning_HHD
#define AQ_PcsTransmitVendorAlarms_BiggestVersion AQ_PcsTransmitVendorAlarms_APPIA
#define AQ_PcsTransmitVendorDebug_BiggestVersion AQ_PcsTransmitVendorDebug_HHD
#define AQ_PcsTransmitVendorFcsErrorFrameCounter_BiggestVersion AQ_PcsTransmitVendorFcsErrorFrameCounter_HHD
#define AQ_PcsTransmitVendorFcsNoErrorFrameCounter_BiggestVersion AQ_PcsTransmitVendorFcsNoErrorFrameCounter_HHD
#define AQ_PcsTransmitVendorInterruptMask_BiggestVersion AQ_PcsTransmitVendorInterruptMask_APPIA
#define AQ_PcsTransmitVendorProvisioning_BiggestVersion AQ_PcsTransmitVendorProvisioning_HHD
#define AQ_PcsTransmitXfi0VendorProvisioning_BiggestVersion AQ_PcsTransmitXfi0VendorProvisioning_HHD
#define AQ_PcsTransmitXfi0VendorState_BiggestVersion AQ_PcsTransmitXfi0VendorState_HHD
#define AQ_PcsTransmitXfi1VendorProvisioning_BiggestVersion AQ_PcsTransmitXfi1VendorProvisioning_HHD
#define AQ_PcsTransmitXfi1VendorState_BiggestVersion AQ_PcsTransmitXfi1VendorState_HHD
#define AQ_PcsTransmitXfiVendorProvisioning_BiggestVersion AQ_PcsTransmitXfiVendorProvisioning_HHD
#define AQ_PcsTransmitXgsVendorState_BiggestVersion AQ_PcsTransmitXgsVendorState_HHD
#define AQ_PcsVendorGlobalInterruptFlags_BiggestVersion AQ_PcsVendorGlobalInterruptFlags_HHD
#define AQ_PhyXS_EeeCapabilityRegister_BiggestVersion AQ_PhyXS_EeeCapabilityRegister_HHD
#define AQ_PhyXS_EeeWakeErrorCounter_BiggestVersion AQ_PhyXS_EeeWakeErrorCounter_HHD
#define AQ_PhyXS_Receive_xauiTx_PcsStatus_BiggestVersion AQ_PhyXS_Receive_xauiTx_PcsStatus_HHD
#define AQ_PhyXS_Receive_xauiTx_ReservedVendorProvisioning_BiggestVersion AQ_PhyXS_Receive_xauiTx_ReservedVendorProvisioning_HHD
#define AQ_PhyXS_Receive_xauiTx_VendorAlarms_BiggestVersion AQ_PhyXS_Receive_xauiTx_VendorAlarms_HHD
#define AQ_PhyXS_Receive_xauiTx_VendorDebug_BiggestVersion AQ_PhyXS_Receive_xauiTx_VendorDebug_HHD
#define AQ_PhyXS_Receive_xauiTx_VendorInterruptMask_BiggestVersion AQ_PhyXS_Receive_xauiTx_VendorInterruptMask_HHD
#define AQ_PhyXS_SerdesConfiguration_BiggestVersion AQ_PhyXS_SerdesConfiguration_HHD
#define AQ_PhyXS_SerdesLane_0Configuration_BiggestVersion AQ_PhyXS_SerdesLane_0Configuration_HHD
#define AQ_PhyXS_SerdesLane_1Configuration_BiggestVersion AQ_PhyXS_SerdesLane_1Configuration_HHD
#define AQ_PhyXS_SerdesLane_2Configuration_BiggestVersion AQ_PhyXS_SerdesLane_2Configuration_HHD
#define AQ_PhyXS_SerdesLane_3Configuration_BiggestVersion AQ_PhyXS_SerdesLane_3Configuration_HHD
#define AQ_PhyXS_SerdesLut_BiggestVersion AQ_PhyXS_SerdesLut_HHD
#define AQ_PhyXS_StandardControl_1_BiggestVersion AQ_PhyXS_StandardControl_1_HHD
#define AQ_PhyXS_StandardDeviceIdentifier_BiggestVersion AQ_PhyXS_StandardDeviceIdentifier_HHD
#define AQ_PhyXS_StandardDevicesInPackage_BiggestVersion AQ_PhyXS_StandardDevicesInPackage_HHD
#define AQ_PhyXS_StandardPackageIdentifier_BiggestVersion AQ_PhyXS_StandardPackageIdentifier_HHD
#define AQ_PhyXS_StandardSpeedAbility_BiggestVersion AQ_PhyXS_StandardSpeedAbility_HHD
#define AQ_PhyXS_StandardStatus_1_BiggestVersion AQ_PhyXS_StandardStatus_1_HHD
#define AQ_PhyXS_StandardStatus_2_BiggestVersion AQ_PhyXS_StandardStatus_2_HHD
#define AQ_PhyXS_StandardXGXS_LaneStatus_BiggestVersion AQ_PhyXS_StandardXGXS_LaneStatus_HHD
#define AQ_PhyXS_StandardXGXS_TestControl_BiggestVersion AQ_PhyXS_StandardXGXS_TestControl_HHD
#define AQ_PhyXS_SystemInterfaceConnectionStatus_BiggestVersion AQ_PhyXS_SystemInterfaceConnectionStatus_HHD
#define AQ_PhyXS_Transmit_xauiRx_PcsStatus_BiggestVersion AQ_PhyXS_Transmit_xauiRx_PcsStatus_HHD
#define AQ_PhyXS_Transmit_xauiRx_ReservedVendorProvisioning_BiggestVersion AQ_PhyXS_Transmit_xauiRx_ReservedVendorProvisioning_HHD
#define AQ_PhyXS_Transmit_xauiRx_ReservedVendorState_BiggestVersion AQ_PhyXS_Transmit_xauiRx_ReservedVendorState_HHD
#define AQ_PhyXS_Transmit_xauiRx_StandardInterruptMask_BiggestVersion AQ_PhyXS_Transmit_xauiRx_StandardInterruptMask_HHD
#define AQ_PhyXS_Transmit_xauiRx_TestPatternErrorCounter_BiggestVersion AQ_PhyXS_Transmit_xauiRx_TestPatternErrorCounter_HHD
#define AQ_PhyXS_Transmit_xauiRx_VendorAlarms_BiggestVersion AQ_PhyXS_Transmit_xauiRx_VendorAlarms_HHD
#define AQ_PhyXS_Transmit_xauiRx_VendorDebug_BiggestVersion AQ_PhyXS_Transmit_xauiRx_VendorDebug_HHD
#define AQ_PhyXS_Transmit_xauiRx_VendorInterruptMask_BiggestVersion AQ_PhyXS_Transmit_xauiRx_VendorInterruptMask_HHD
#define AQ_PhyXS_VendorGlobalInterruptFlags_BiggestVersion AQ_PhyXS_VendorGlobalInterruptFlags_HHD
#define AQ_PifMailboxControl_BiggestVersion AQ_PifMailboxControl_HHD
#define AQ_Pma10GBaseT_FastRetrainStatusAndControl_BiggestVersion AQ_Pma10GBaseT_FastRetrainStatusAndControl_HHD
#define AQ_Pma10GBaseT_PairSwapAndPolarityStatus_BiggestVersion AQ_Pma10GBaseT_PairSwapAndPolarityStatus_HHD
#define AQ_Pma10GBaseT_ReceiveSignalPowerChannelA_BiggestVersion AQ_Pma10GBaseT_ReceiveSignalPowerChannelA_HHD
#define AQ_Pma10GBaseT_ReceiveSignalPowerChannelB_BiggestVersion AQ_Pma10GBaseT_ReceiveSignalPowerChannelB_HHD
#define AQ_Pma10GBaseT_ReceiveSignalPowerChannelC_BiggestVersion AQ_Pma10GBaseT_ReceiveSignalPowerChannelC_HHD
#define AQ_Pma10GBaseT_ReceiveSignalPowerChannelD_BiggestVersion AQ_Pma10GBaseT_ReceiveSignalPowerChannelD_HHD
#define AQ_Pma10GBaseT_SNR_MinimumOperatingMarginChannelA_BiggestVersion AQ_Pma10GBaseT_SNR_MinimumOperatingMarginChannelA_HHD
#define AQ_Pma10GBaseT_SNR_MinimumOperatingMarginChannelB_BiggestVersion AQ_Pma10GBaseT_SNR_MinimumOperatingMarginChannelB_HHD
#define AQ_Pma10GBaseT_SNR_MinimumOperatingMarginChannelC_BiggestVersion AQ_Pma10GBaseT_SNR_MinimumOperatingMarginChannelC_HHD
#define AQ_Pma10GBaseT_SNR_MinimumOperatingMarginChannelD_BiggestVersion AQ_Pma10GBaseT_SNR_MinimumOperatingMarginChannelD_HHD
#define AQ_Pma10GBaseT_SNR_OperatingMarginChannelA_BiggestVersion AQ_Pma10GBaseT_SNR_OperatingMarginChannelA_HHD
#define AQ_Pma10GBaseT_SNR_OperatingMarginChannelB_BiggestVersion AQ_Pma10GBaseT_SNR_OperatingMarginChannelB_HHD
#define AQ_Pma10GBaseT_SNR_OperatingMarginChannelC_BiggestVersion AQ_Pma10GBaseT_SNR_OperatingMarginChannelC_HHD
#define AQ_Pma10GBaseT_SNR_OperatingMarginChannelD_BiggestVersion AQ_Pma10GBaseT_SNR_OperatingMarginChannelD_HHD
#define AQ_Pma10GBaseT_SkewDelay_BiggestVersion AQ_Pma10GBaseT_SkewDelay_HHD
#define AQ_Pma10GBaseT_Status_BiggestVersion AQ_Pma10GBaseT_Status_HHD
#define AQ_Pma10GBaseT_TestModes_BiggestVersion AQ_Pma10GBaseT_TestModes_HHD
#define AQ_Pma10GBaseT_TxPowerBackoffAndShortReachSetting_BiggestVersion AQ_Pma10GBaseT_TxPowerBackoffAndShortReachSetting_HHD
#define AQ_PmaReceiveReservedVendorProvisioning_BiggestVersion AQ_PmaReceiveReservedVendorProvisioning_HHD
#define AQ_PmaReceiveReservedVendorState_BiggestVersion AQ_PmaReceiveReservedVendorState_HHD
#define AQ_PmaReceiveVendorState_BiggestVersion AQ_PmaReceiveVendorState_HHD
#define AQ_PmaStandardControl_1_BiggestVersion AQ_PmaStandardControl_1_HHD
#define AQ_PmaStandardControl_2_BiggestVersion AQ_PmaStandardControl_2_HHD
#define AQ_PmaStandardDeviceIdentifier_BiggestVersion AQ_PmaStandardDeviceIdentifier_HHD
#define AQ_PmaStandardDevicesInPackage_BiggestVersion AQ_PmaStandardDevicesInPackage_HHD
#define AQ_PmaStandardPackageIdentifier_BiggestVersion AQ_PmaStandardPackageIdentifier_HHD
#define AQ_PmaStandardSpeedAbility_BiggestVersion AQ_PmaStandardSpeedAbility_HHD
#define AQ_PmaStandardStatus_1_BiggestVersion AQ_PmaStandardStatus_1_HHD
#define AQ_PmaStandardStatus_2_BiggestVersion AQ_PmaStandardStatus_2_HHD
#define AQ_PmaTransmitReservedVendorProvisioning_BiggestVersion AQ_PmaTransmitReservedVendorProvisioning_HHD
#define AQ_PmaTransmitStandardInterruptMask_BiggestVersion AQ_PmaTransmitStandardInterruptMask_HHD
#define AQ_PmaTransmitVendorAlarms_BiggestVersion AQ_PmaTransmitVendorAlarms_HHD
#define AQ_PmaTransmitVendorDebug_BiggestVersion AQ_PmaTransmitVendorDebug_HHD
#define AQ_PmaTransmitVendorLASI_InterruptMask_BiggestVersion AQ_PmaTransmitVendorLASI_InterruptMask_HHD
#define AQ_PmaVendorGlobalInterruptFlags_BiggestVersion AQ_PmaVendorGlobalInterruptFlags_HHD
#define AQ_PmdStandard10G_ExtendedAbilityRegister_BiggestVersion AQ_PmdStandard10G_ExtendedAbilityRegister_HHD
#define AQ_PmdStandardSignalDetect_BiggestVersion AQ_PmdStandardSignalDetect_HHD
#define AQ_PmdStandardTransmitDisableControl_BiggestVersion AQ_PmdStandardTransmitDisableControl_HHD
#define AQ_Sgmii0WolStatus_BiggestVersion AQ_Sgmii0WolStatus_HHD
#define AQ_TimesyncPcsCapability_BiggestVersion AQ_TimesyncPcsCapability_HHD
#define AQ_TimesyncPcsReceivePathDataDelay_BiggestVersion AQ_TimesyncPcsReceivePathDataDelay_HHD
#define AQ_TimesyncPcsTransmitPathDataDelay_BiggestVersion AQ_TimesyncPcsTransmitPathDataDelay_HHD
#define AQ_TimesyncPhyXsCapability_BiggestVersion AQ_TimesyncPhyXsCapability_HHD
#define AQ_TimesyncPhyXsReceivePathDataDelay_BiggestVersion AQ_TimesyncPhyXsReceivePathDataDelay_HHD
#define AQ_TimesyncPhyXsTransmitPathDataDelay_BiggestVersion AQ_TimesyncPhyXsTransmitPathDataDelay_HHD
#define AQ_TimesyncPmaCapability_BiggestVersion AQ_TimesyncPmaCapability_HHD
#define AQ_TimesyncPmaReceivePathDataDelay_BiggestVersion AQ_TimesyncPmaReceivePathDataDelay_HHD
#define AQ_TimesyncPmaTransmitPathDataDelay_BiggestVersion AQ_TimesyncPmaTransmitPathDataDelay_HHD
#define AQ_XenpakBasic_ApsLoading_BiggestVersion AQ_XenpakBasic_ApsLoading_HHD
#define AQ_XenpakBasic_ApsVoltage_BiggestVersion AQ_XenpakBasic_ApsVoltage_HHD
#define AQ_XenpakBasic_BitRate_BiggestVersion AQ_XenpakBasic_BitRate_HHD
#define AQ_XenpakBasic_Checksum_BiggestVersion AQ_XenpakBasic_Checksum_HHD
#define AQ_XenpakBasic_ConnectorType_BiggestVersion AQ_XenpakBasic_ConnectorType_HHD
#define AQ_XenpakBasic_DomCapability_BiggestVersion AQ_XenpakBasic_DomCapability_HHD
#define AQ_XenpakBasic_Encoding_BiggestVersion AQ_XenpakBasic_Encoding_HHD
#define AQ_XenpakBasic_Low_powerStartupCapability_BiggestVersion AQ_XenpakBasic_Low_powerStartupCapability_HHD
#define AQ_XenpakBasic_PackageIdentifier_BiggestVersion AQ_XenpakBasic_PackageIdentifier_HHD
#define AQ_XenpakBasic_Protocol_BiggestVersion AQ_XenpakBasic_Protocol_HHD
#define AQ_XenpakBasic_Reserved_0x11_BiggestVersion AQ_XenpakBasic_Reserved_0x11_HHD
#define AQ_XenpakBasic_Reserved_0x19_BiggestVersion AQ_XenpakBasic_Reserved_0x19_HHD
#define AQ_XenpakBasic_Reserved_0x7c_BiggestVersion AQ_XenpakBasic_Reserved_0x7c_HHD
#define AQ_XenpakBasic_StandardsComplianceCodes_BiggestVersion AQ_XenpakBasic_StandardsComplianceCodes_HHD
#define AQ_XenpakBasic_TransceiverType_BiggestVersion AQ_XenpakBasic_TransceiverType_HHD
#define AQ_XenpakBasic_VendorDateCode_BiggestVersion AQ_XenpakBasic_VendorDateCode_HHD
#define AQ_XenpakBasic_VendorIdentifier_BiggestVersion AQ_XenpakBasic_VendorIdentifier_HHD
#define AQ_XenpakBasic_VendorName_BiggestVersion AQ_XenpakBasic_VendorName_HHD
#define AQ_XenpakBasic_VendorPartNumber_BiggestVersion AQ_XenpakBasic_VendorPartNumber_HHD
#define AQ_XenpakBasic_VendorPartRevisionNumber_BiggestVersion AQ_XenpakBasic_VendorPartRevisionNumber_HHD
#define AQ_XenpakBasic_VendorSerialNumber_BiggestVersion AQ_XenpakBasic_VendorSerialNumber_HHD
#define AQ_XenpakBasic__3_3vLoading_BiggestVersion AQ_XenpakBasic__3_3vLoading_HHD
#define AQ_XenpakBasic__5vLoading_BiggestVersion AQ_XenpakBasic__5vLoading_HHD
#define AQ_XenpakControl_BiggestVersion AQ_XenpakControl_HHD
#define AQ_XenpakCustomer_Reserved_0x7e_BiggestVersion AQ_XenpakCustomer_Reserved_0x7e_HHD
#define AQ_XenpakDom_Alarms_BiggestVersion AQ_XenpakDom_Alarms_HHD
#define AQ_XenpakDom_Capability_BiggestVersion AQ_XenpakDom_Capability_HHD
#define AQ_XenpakDom_ControlAndStatus_BiggestVersion AQ_XenpakDom_ControlAndStatus_HHD
#define AQ_XenpakDom_HighTemperatureAlarmThresholdLSW_BiggestVersion AQ_XenpakDom_HighTemperatureAlarmThresholdLSW_HHD
#define AQ_XenpakDom_HighTemperatureAlarmThresholdMSW_BiggestVersion AQ_XenpakDom_HighTemperatureAlarmThresholdMSW_HHD
#define AQ_XenpakDom_HighTemperatureWarningThresholdLSW_BiggestVersion AQ_XenpakDom_HighTemperatureWarningThresholdLSW_HHD
#define AQ_XenpakDom_HighTemperatureWarningThresholdMSW_BiggestVersion AQ_XenpakDom_HighTemperatureWarningThresholdMSW_HHD
#define AQ_XenpakDom_LowTemperatureAlarmThresholdLSW_BiggestVersion AQ_XenpakDom_LowTemperatureAlarmThresholdLSW_HHD
#define AQ_XenpakDom_LowTemperatureAlarmThresholdMSW_BiggestVersion AQ_XenpakDom_LowTemperatureAlarmThresholdMSW_HHD
#define AQ_XenpakDom_LowTemperatureWarningThresholdLSW_BiggestVersion AQ_XenpakDom_LowTemperatureWarningThresholdLSW_HHD
#define AQ_XenpakDom_LowTemperatureWarningThresholdMSW_BiggestVersion AQ_XenpakDom_LowTemperatureWarningThresholdMSW_HHD
#define AQ_XenpakDom_Status_BiggestVersion AQ_XenpakDom_Status_HHD
#define AQ_XenpakDom_TemperatureLSW_BiggestVersion AQ_XenpakDom_TemperatureLSW_HHD
#define AQ_XenpakDom_TemperatureMSW_BiggestVersion AQ_XenpakDom_TemperatureMSW_HHD
#define AQ_XenpakDom_TxControl_BiggestVersion AQ_XenpakDom_TxControl_HHD
#define AQ_XenpakHeader_BasicMemoryStartAddress_BiggestVersion AQ_XenpakHeader_BasicMemoryStartAddress_HHD
#define AQ_XenpakHeader_CustomerMemoryOffset_BiggestVersion AQ_XenpakHeader_CustomerMemoryOffset_HHD
#define AQ_XenpakHeader_ExtendedVendorMemoryOffset_BiggestVersion AQ_XenpakHeader_ExtendedVendorMemoryOffset_HHD
#define AQ_XenpakHeader_MemoryUsed_BiggestVersion AQ_XenpakHeader_MemoryUsed_HHD
#define AQ_XenpakHeader_NvrSize_BiggestVersion AQ_XenpakHeader_NvrSize_HHD
#define AQ_XenpakHeader_VendorMemoryStartAddress_BiggestVersion AQ_XenpakHeader_VendorMemoryStartAddress_HHD
#define AQ_XenpakHeader_XenpakMsaVersionSupported_BiggestVersion AQ_XenpakHeader_XenpakMsaVersionSupported_HHD
#define AQ_XenpakLASI__Control_BiggestVersion AQ_XenpakLASI__Control_HHD
#define AQ_XenpakLASI__Status_BiggestVersion AQ_XenpakLASI__Status_HHD
#define AQ_XenpakRxAlarm_Control_BiggestVersion AQ_XenpakRxAlarm_Control_HHD
#define AQ_XenpakRxAlarm_Status_BiggestVersion AQ_XenpakRxAlarm_Status_HHD
#define AQ_XenpakTxAlarm_Control_BiggestVersion AQ_XenpakTxAlarm_Control_HHD
#define AQ_XenpakTxAlarm_Status_BiggestVersion AQ_XenpakTxAlarm_Status_HHD
#define AQ_XenpakVendor_Reserved_0xae_BiggestVersion AQ_XenpakVendor_Reserved_0xae_HHD
#endif

View File

@ -0,0 +1,69 @@
/*AQ_RegMaps.h*/
/************************************************************************************
* Copyright (c) 2015, Aquantia
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Description:
*
* This file contains includes all appropriate Aquantia PHY device-specific
* register map headers.
*
************************************************************************************/
/*! \file
* This file contains includes all appropriate Aquantia PHY device-specific
* register map headers.
*/
#ifndef AQ_REGISTERMAPS_HEADER
#define AQ_REGISTERMAPS_HEADER
#include "AQ_User.h"
#include "AQ_RegGroupMaxSizes.h"
#ifndef AQ_REVERSED_BITFIELD_ORDERING
/*
* Include non-reversed header files (bitfields ordered from LSbit to MSbit)
*/
/* APPIA */
#include "AQ_APPIA_Global_registers.h"
#include "AQ_APPIA_Global_registers_Defines.h"
/* HHD */
#include "AQ_HHD_Global_registers.h"
#include "AQ_HHD_Global_registers_Defines.h"
#else
/*
* Include reversed header files (bitfields ordered from MSbit to LSbit)
*/
/* APPIA */
#include "AQ_APPIA_Global_registers_reversed.h"
#include "AQ_APPIA_Global_registers_Defines.h"
/* HHD */
#include "AQ_HHD_Global_registers_reversed.h"
#include "AQ_HHD_Global_registers_Defines.h"
#endif
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,193 @@
/* mdioBootLoadCLD.c */
/************************************************************************************
* Copyright (c) 2015 Aquantia
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $File: //depot/icm/proj/Dena/rev1.0/c/Systems/tools/windows/flashUtilities/src/mdioBootLoadCLD.c $
*
* $Revision: #12 $
*
* $DateTime: 2014/05/19 15:34:49 $
*
* $Author: joshd $
*
* $Label: $
*
************************************************************************************/
/*! \file
This file contains the main (int, char**) file for the mdioBootLoadCLD program, which burns a flash image into a target
Aquantia PHY using the AQ_API. This program calls the API function: <BR><BR>
uint8_t AQ_API_WriteBootLoadImage (uint8_t PHY_ID, uint8_t *image, uint16_t *crc16) <BR><BR>
to boot load a cld flash image into an Aquantia PHY */
/*! \addtogroup mdioBootLoad
@{
*/
/*! \def DEBUG
Uncomment this to compile in debug mode. This sets the source to an arbitrary file, defined by DEBUG_FILENAME,
and an arbitrary PHY_ID, defined by DEBUG_PHY_ID. */
/* #define DEBUG */
/*! The debug source file name */
#define DEBUG_FILENAME "HelloWorld.cld"
/*! The debug PHY ID */
#define DEBUG_PHY_ID 0
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
#include "AQ_API.h"
#include "AQ_PhyInterface.h"
int sock;
char devname[7];
int sock_init()
{
if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
fprintf(stderr, "Error creating socket: %s\n", strerror(errno));
return -1;
}
return 0;
}
int main ( int argc, char **argp)
{
/* declare local variables */
FILE *pFile;
uint8_t* image;
uint8_t byte;
unsigned int PHY_ID;
AQ_Retcode resultCode;
AQ_Retcode resultCodes[4];
uint32_t i;
uint32_t imageSize;
char sourceFileName[1000];
AQ_API_Port targetPort0;
AQ_API_Port* targetPorts[1];
AQ_API_Port broadcastPort;
unsigned int provisioningAddresses[1] = {0};
uint32_t reg1, reg2;
targetPorts[0] = &targetPort0;
if(argc < 4) {
fprintf (stderr, "enter file name/netdev name/phy address\n");
return (101);
}
/*Copy the file name from command line arg*/
if (strlcpy (sourceFileName, argp[1], sizeof(sourceFileName)) >= sizeof(sourceFileName)) {
fprintf (stderr, "Filename: %s too long \n", argp[1]);
return (101);
}
/*Copy the interface name from command line arg*/
strlcpy (devname, argp[2], sizeof(devname));
/*Get PHY Address from command line arg*/
PHY_ID = (unsigned int)strtoul(argp[3], NULL, 0);
/* FIXME: set port and device type */
targetPort0.device = AQ_DEVICE_HHD;
targetPort0.PHY_ID = PHY_ID;
broadcastPort.device = AQ_DEVICE_HHD;
broadcastPort.PHY_ID = PHY_ID;
/* open the source in binary read mode */
pFile = fopen(sourceFileName, "rb");
if (pFile == NULL)
{
fprintf (stderr, "Unable to open source file %s\n", sourceFileName);
return (101);
}
fseek (pFile, 0, SEEK_END);
imageSize = ftell (pFile);
image = (uint8_t*) malloc (imageSize * sizeof(uint8_t));
fseek (pFile, 0, SEEK_SET);
/* load the file */
for (i = 0; i < imageSize; i++)
{
byte = (uint8_t) fgetc (pFile);
image[i] = byte;
}
fclose(pFile);
if (sock_init() < 0)
{
fprintf (stderr, "Unable to initialize interface\n");
return (200);
}
/* Write in the Auantia phy scratch pad register,
* read back the same reg and match the values written.
*/
AQ_API_MDIO_Write(PHY_ID, 0x1e, 0x300, 0xdead);
AQ_API_MDIO_Write(PHY_ID, 0x1e, 0x301, 0xbeaf);
reg1 = AQ_API_MDIO_Read(PHY_ID, 0x1e, 0x300);
reg2 = AQ_API_MDIO_Read(PHY_ID, 0x1e, 0x301);
if(reg1 != 0xdead && reg2 != 0xbeaf) {
fprintf (stderr, "Scratchpad Read/Write test fail\n");
return (101);
}
/* call the boot-load function */
resultCode = AQ_API_WriteBootLoadImage(targetPorts, 1, provisioningAddresses, resultCodes, &imageSize, image, PHY_ID, &broadcastPort);
switch (resultCode)
{
case 0:
printf("Image load good - mailbox CRC-16 matches\n");
free (image);
close(sock);
return 0;
case 1:
fprintf (stderr, "CRC-16 on file is bad\n");
free (image);
close(sock);
return 1;
case 2:
fprintf (stderr, "CRC-16 check on image load failed (mailbox CRC-16 check)\n");
free (image);
close(sock);
return 2;
default:
fprintf (stderr, "Invalid return code\n");
free (image);
close(sock);
}
return 12;
}
/*@}*/

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,141 @@
/* AQ_PhyInterface.c */
/************************************************************************************
* Copyright (c) 2015, Aquantia
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $Revision: #12 $
*
* $DateTime: 2015/02/25 15:34:49 $
*
* $Label: $
*
************************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <sys/ioctl.h>
#include <string.h>
#include <unistd.h>
#include <time.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <net/if.h>
#include <linux/sockios.h>
#include <linux/mii.h>
#include <linux/ethtool.h>
#include "AQ_PhyInterface.h"
#include "AQ_PlatformRoutines.h"
#define MII_ADDR_C45 (0x8000)
extern int sock;
extern char devname[7];
static struct ifreq ifr;
/*! Provides generic synchronous PHY register write functionality. It is the
* responsibility of the system designer to provide the specific MDIO address
* pointer updates, etc. in order to accomplish this write operation.
* It will be assumed that the write has been completed by the time this
* function returns.*/
void AQ_API_MDIO_Write(
/*! Uniquely identifies the port within the system. AQ_Port must be
* defined to a whatever data type is suitable for the platform.*/
AQ_Port PHY_ID,
/*! The address of the MMD within the target PHY. */
unsigned int MMD,
/*! The 16-bit address of the PHY register being written. */
unsigned int address,
/*! The 16-bits of data to write to the specified PHY register. */
unsigned int data)
{
struct mii_ioctl_data mii;
/*
* Frame the control structures
* and send the ioctl to kernel.
*/
memset(&ifr, 0, sizeof(ifr));
strlcpy(ifr.ifr_name, devname, sizeof(ifr.ifr_name));
memset(&mii, 0, sizeof(mii));
memcpy(&mii, &ifr.ifr_data, sizeof(mii));
mii.phy_id = MII_ADDR_C45 | PHY_ID << 5 | MMD;
mii.reg_num = address;
mii.val_in = data;
memcpy(&ifr.ifr_data, &mii, sizeof(mii));
if (ioctl(sock, SIOCSMIIREG, &ifr) < 0) {
fprintf(stderr, "SIOCSMIIREG on %s failed: %s\n", ifr.ifr_name,
strerror(errno));
}
return;
}
/*! Provides generic synchronous PHY register read functionality. It is the
* responsibility of the system designer to provide the specific MDIO address
* pointer updates, etc. in order to accomplish this read operation.*/
unsigned int AQ_API_MDIO_Read
(
/*! Uniquely identifies the port within the system. AQ_Port must be
* defined to a whatever data type is suitable for the platform.*/
AQ_Port PHY_ID,
/*! The address of the MMD within the target PHY. */
unsigned int MMD,
/*! The 16-bit address of the PHY register being read. */
unsigned int address)
{
struct mii_ioctl_data mii;
/*
* Frame the control structures
* and send the ioctl to kernel.
*/
memset(&ifr, 0, sizeof(ifr));
strlcpy(ifr.ifr_name, devname, sizeof(ifr.ifr_name));
memset(&mii, 0, sizeof(mii));
memcpy(&mii, &ifr.ifr_data, sizeof(mii));
mii.phy_id = MII_ADDR_C45 | PHY_ID << 5 | MMD;
mii.reg_num = address;
memcpy(&ifr.ifr_data, &mii, sizeof(mii));
if (ioctl(sock, SIOCGMIIREG, &ifr) < 0) {
fprintf(stderr, "SIOCGMIIREG on %s failed: %s\n", ifr.ifr_name,
strerror(errno));
return -1;
} else {
memcpy(&mii, &ifr.ifr_data, sizeof(mii));
}
return mii.val_out;
}
/*! Returns after at least milliseconds have elapsed. This must be implemented
* * in a platform-approriate way. AQ_API functions will call this function to
* * block for the specified period of time. If necessary, PHY register reads
* * may be performed on port to busy-wait. */
void AQ_API_Wait(
uint32_t milliseconds, /*!< The delay in milliseconds */
AQ_API_Port* port /*!< The PHY to use if delay reads are necessary*/ )
{
unsigned long long mirco = milliseconds *1000;
usleep(mirco);
}

View File

@ -0,0 +1,34 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=nss-eip-firmware
PKG_VERSION=2.5.7
PKG_RELEASE:=$(AUTORELEASE)
PKG_MAINTAINER:=Robert Marko <robimarko@gmail.com>
include $(INCLUDE_DIR)/package.mk
define Package/nss-eip-firmware
SECTION:=firmware
CATEGORY:=Firmware
TITLE:=NSS EIP-197 firmware
DEPENDS:=@(TARGET_qualcommax_ipq807x||TARGET_qualcommax_ipq60xx)
endef
define Build/Compile
endef
define Package/nss-eip-firmware/install
$(INSTALL_DIR) $(1)/lib/firmware/
$(INSTALL_DATA) \
$(PKG_BUILD_DIR)/ifpp.bin $(1)/lib/firmware/ifpp.bin
$(INSTALL_DATA) \
$(PKG_BUILD_DIR)/ipue.bin $(1)/lib/firmware/ipue.bin
$(INSTALL_DATA) \
$(PKG_BUILD_DIR)/ofpp.bin $(1)/lib/firmware/ofpp.bin
$(INSTALL_DATA) \
$(PKG_BUILD_DIR)/opue.bin $(1)/lib/firmware/opue.bin
endef
$(eval $(call BuildPackage,nss-eip-firmware))

View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,169 @@
#
# Copyright (C) 2022 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=nss-firmware
PKG_SOURCE_DATE:=2025-05-01
PKG_SOURCE_VERSION:=e4726900138b3e77fbbeaa32e58aa40a66d6b01a
PKG_MIRROR_HASH:=3ec87f221e8905d4b6b8b3d207b7f7c4666c3bc8db7c1f06d4ae2e78f863b8f4
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/qosmio/qca-sdk-nss-fw.git
PKG_LICENSE_FILES:=LICENSE.md
PKG_MAINTAINER:=Sean K <datapronix@protonmail.com>
PKG_CONFIG_DEPENDS:= \
CONFIG_NSS_FIRMWARE_VERSION_11_4 \
CONFIG_NSS_FIRMWARE_VERSION_12_1 \
CONFIG_NSS_FIRMWARE_VERSION_12_2 \
CONFIG_NSS_FIRMWARE_VERSION_12_5
include $(INCLUDE_DIR)/package.mk
RSTRIP:=:
STRIP:=:
NSS_PROFILE:=R
define Package/nss-firmware-common
TITLE:=NSS firmware
SECTION:=firmware
CATEGORY:=Firmware
URL:=$(PKG_SOURCE_URL)
DEPENDS:=@TARGET_qualcommax
endef
define Package/nss-firmware
$(call Package/nss-firmware-common,$(1))
DEPENDS+= +TARGET_qualcommax_ipq807x:nss-firmware-ipq807x \
+TARGET_qualcommax_ipq60xx:nss-firmware-ipq60xx \
+TARGET_qualcommax_ipq50xx:nss-firmware-ipq50xx
endef
define Package/nss-firmware-ipq807x
$(call Package/nss-firmware-common,$(1))
IPQ_PLATFORM=IPQ8074
NSS_SOC:=HK
endef
define Package/nss-firmware-ipq60xx
$(call Package/nss-firmware-common,$(1))
IPQ_PLATFORM=IPQ6018
CONFLICTS=nss-firmware-ipq807x
NSS_SOC:=CP
endef
define Package/nss-firmware-ipq50xx
$(call Package/nss-firmware-common,$(1))
IPQ_PLATFORM=IPQ5018
CONFLICTS=nss-firmware-ipq807x nss-firmware-ipq60xx
NSS_SOC:=MP
endef
define Package/nss-firmware/config
menu "NSS Firmware Version"
comment "Select NSS firmware version"
choice
prompt "Version"
default NSS_FIRMWARE_VERSION_11_4
config NSS_FIRMWARE_VERSION_12_5
bool "NSS Firmware 12.5 Release 210"
help
This version does NOT work with NSS MESH (802.11s)
config NSS_FIRMWARE_VERSION_12_2
bool "NSS Firmware 12.2 Release 161"
help
This version does NOT work with NSS MESH (802.11s)
config NSS_FIRMWARE_VERSION_12_1
bool "NSS Firmware 12.1 Release 003"
help
This version does NOT work with NSS MESH (802.11s)
config NSS_FIRMWARE_VERSION_11_4
bool "NSS Firmware 11.4.0.5 Release 6"
help
This version WORKS with NSS MESH (802.11s)
endchoice
endmenu
endef
define nss-firmware-version
ifneq ($(CONFIG_NSS_FIRMWARE_VERSION_11_4),)
override NSS_MAJOR=11
override NSS_MINOR=4
override NSS_REL=6
override VERSION_PATH=$(PKG_BUILD_DIR)/QCA_Networking_2021.SPF_11.4/CS
else ifneq ($(CONFIG_NSS_FIRMWARE_VERSION_12_1),)
override NSS_MAJOR=12
override NSS_MINOR=1
override NSS_REL=003
override VERSION_PATH=$(PKG_BUILD_DIR)/QCA_Networking_2022.SPF_12.1/ED1
else ifneq ($(CONFIG_NSS_FIRMWARE_VERSION_12_2),)
override NSS_MAJOR=12
override NSS_MINOR=2
ifeq ($(1),IPQ5018)
override NSS_REL=156
else
override NSS_REL=161
endif
override VERSION_PATH=$(PKG_BUILD_DIR)/QCA_Networking_2022.SPF_12.2/ED1
else
override NSS_MAJOR=12
override NSS_MINOR=5
override NSS_REL=210
override VERSION_PATH=$(PKG_BUILD_DIR)/QCA_Networking_2024.SPF_12.5/ED1
endif
endef
define Build/Compile
endef
define Package/nss-firmware-common/install
$(eval $(call nss-firmware-version,$(IPQ_PLATFORM)))
$(INSTALL_DIR) $(PKG_BUILD_DIR)/$(IPQ_PLATFORM)
$(TAR) --strip-components=1 -C $(PKG_BUILD_DIR)/$(IPQ_PLATFORM) -xf \
$(VERSION_PATH)/$(IPQ_PLATFORM).ATH.$(NSS_MAJOR).$(NSS_MINOR)/BIN-NSS*.$(NSS_MAJOR).$(NSS_MINOR)*-$(NSS_REL)*$(NSS_PROFILE).tar.bz2
$(INSTALL_DIR) $(1)/lib/firmware/
$(INSTALL_DATA) \
$(PKG_BUILD_DIR)/$(IPQ_PLATFORM)/retail_router0.bin \
$(1)/lib/firmware/qca-nss0-retail.bin
ifeq ($(NSS_SOC),HK)
$(INSTALL_DATA) \
$(PKG_BUILD_DIR)/$(IPQ_PLATFORM)/retail_router1.bin \
$(1)/lib/firmware/qca-nss1-retail.bin
endif
endef
define Package/nss-firmware-ipq807x/install
$(call Package/nss-firmware-common/install,$(1))
endef
define Package/nss-firmware-ipq60xx/install
$(call Package/nss-firmware-common/install,$(1))
endef
define Package/nss-firmware-ipq50xx/install
$(call Package/nss-firmware-common/install,$(1))
endef
define Package/nss-firmware/install
true
endef
$(eval $(call BuildPackage,nss-firmware-ipq807x))
$(eval $(call BuildPackage,nss-firmware-ipq60xx))
$(eval $(call BuildPackage,nss-firmware-ipq50xx))
$(eval $(call BuildPackage,nss-firmware))

48
nss-ifb/Makefile Normal file
View File

@ -0,0 +1,48 @@
#
# Copyright (C) 2008-2012 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=nss-ifb
PKG_RELEASE:=1
include $(INCLUDE_DIR)/package.mk
define KernelPackage/nss-ifb
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Devices
TITLE:=NSS IFB Interface
DEPENDS:=@TARGET_qualcommax +kmod-qca-nss-drv
FILES:=$(PKG_BUILD_DIR)/nss-ifb.ko
KCONFIG:=
endef
define KernelPackage/nss-ifb/description
Kernel module to register a NSS aware IFB interface.
endef
EXTRA_KCONFIG:= \
CONFIG_NET_CLS=y
EXTRA_CFLAGS:= \
-I$(STAGING_DIR)/usr/include/qca-nss-drv
MAKE_OPTS:= \
$(KERNEL_MAKE_FLAGS) \
M="$(PKG_BUILD_DIR)" \
EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \
$(EXTRA_KCONFIG)
define Build/Compile
$(MAKE) -C "$(LINUX_DIR)" \
$(MAKE_OPTS) \
modules
endef
$(eval $(call KernelPackage,nss-ifb))

45
nss-ifb/README.md Normal file
View File

@ -0,0 +1,45 @@
NSS Physical Interface Ingress Driver
=====================================
This driver redirect NSS physical interface (namely GMACs) ingress traffic to itself
and sends it back to the Linux network stack (as the source GMACs packets) as it's
egress traffic.
This allows the NSS QDISC drivers to manage the egress traffic of this driver's
NSS virtual interface.
This driver will create a single network interface named 'nssifb'. The default
source interface is defined as 'eth0'. It can be changed using the following module
parameter path:
/sys/module/nss-ifb/parameter/nss_src_dev
To change the source NSS physical interface to 'eth1', use the following command:
printf eth1 > /sys/module/nss-ifb/parameter/nss_src_dev
You need to change the source interface first before bringing up the 'nssifb'
interface. Changing it after the interface is up will have no effect. You need
to bring down the interface and bring it back up to have the changes take effect.
CPU load imposed on the Krait CPUs appears negligible with this driver intercepting
the physical interface's ingress traffic. Full line speed of the GMAC interface
could still be achieved.
The commands below shows an example to shape ingress traffic to 500 Mbps and egress
to 200 Mbps for the 'eth0' interface.
# Load the module if it's not loaded
modprobe nss-ifb
# Bring up the nssifb interface to active ingress redirect
ip link set up nssifb
# Shape ingress traffic to 500 Mbit with chained NSSFQ_CODEL
tc qdisc add dev nssifb root handle 1: nsstbl rate 500Mbit burst 1Mb
tc qdisc add dev nssifb parent 1: handle 10: nssfq_codel limit 10240 flows 1024 quantum 1514 target 5ms interval 100ms set_default
# Shape egress traffic to 200 Mbit with chained NSSFQ_CODEL
tc qdisc add dev eth0 root handle 1: nsstbl rate 200Mbit burst 1Mb
tc qdisc add dev eth0 parent 1: handle 10: nssfq_codel limit 10240 flows 1024 quantum 1514 target 5ms interval 100ms set_default

3
nss-ifb/src/Makefile Normal file
View File

@ -0,0 +1,3 @@
obj-m += nss-ifb.o
nss-ifb-objs := nss_ifb.o

304
nss-ifb/src/nss_ifb.c Normal file
View File

@ -0,0 +1,304 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* This driver is adapted from the Linux /drivers/net/ifb.c file.
*
* Redirect QCA NSS physical interface ingress traffic to this driver's
* virtual interface. This will allow ingress traffic shaping using the
* QCA NSS shaper.
*/
#include <nss_api_if.h>
#define TX_Q_LIMIT 32
struct nss_ifb_dev_private {
struct nss_virt_if_handle *nssctx;
struct net_device *nss_src_dev;
uint32_t nss_src_if_num;
char nss_src_dev_name[32];
};
char nss_dev_name_array[32] = "eth0";
char *nss_dev_name = nss_dev_name_array;
module_param(nss_dev_name, charp, 0644);
MODULE_PARM_DESC(nss_dev_name, "NSS physical interface source device name");
/*
* Virtual interface egress packet callback.
*
* We send it back to the Linux network stack.
*/
static void nss_ifb_data_cb(struct net_device *netdev, struct sk_buff *skb, struct napi_struct *napi)
{
struct nss_ifb_dev_private *dp = netdev_priv(netdev);
skb->protocol = eth_type_trans(skb, dp->nss_src_dev);
skb->ip_summed = CHECKSUM_UNNECESSARY;
napi_gro_receive(napi, skb);
}
/*
* Virtual interface ingress packet callback.
*
* We just send it back to the NSS firmware to let the shaper work on it.
*/
static void nss_ifb_xmit_cb(struct net_device *netdev, struct sk_buff *skb)
{
struct nss_ifb_dev_private *dp = netdev_priv(netdev);
int ret;
ret = nss_virt_if_tx_buf(dp->nssctx, skb);
if (unlikely(ret)) {
pr_warn("Failed [%d] to send skb [len: %d, protocol: 0x%X] to NSS!\n",
ret, skb->len, ntohs(skb->protocol));
}
}
static void nss_ifb_stats64(struct net_device *dev,
struct rtnl_link_stats64 *stats)
{
}
static int nss_ifb_dev_init(struct net_device *dev)
{
struct nss_ifb_dev_private *dp = netdev_priv(dev);
dp->nssctx = nss_virt_if_create_sync_nexthop(dev, NSS_ETH_RX_INTERFACE, NSS_ETH_RX_INTERFACE);
if (!dp->nssctx) {
dp->nssctx = NULL;
pr_warn("Could not create a NSS virtual interface for dev [%s]\n",
dev->name);
return -ENODEV;
}
pr_info("Created a NSS virtual interface for dev [%s]\n", dev->name);
nss_virt_if_register(dp->nssctx, nss_ifb_data_cb, dev);
pr_info("NSS IFB data callback registered\n");
nss_virt_if_xmit_callback_register(dp->nssctx, nss_ifb_xmit_cb);
pr_info("NSS IFB transmit callback registered\n");
return 0;
}
static void nss_ifb_dev_uninit(struct net_device *dev)
{
struct nss_ifb_dev_private *dp = netdev_priv(dev);
int ret;
nss_virt_if_xmit_callback_unregister(dp->nssctx);
pr_info("NSS IFB transmit callback unregistered\n");
ret = nss_virt_if_destroy_sync(dp->nssctx);
if (ret == NSS_TX_SUCCESS) {
pr_info("NSS virtual interface destroyed for dev [%s]\n", dev->name);
}
else {
pr_warn("Unable to destroy NSS virtual interface for dev [%s], error[%d]\n",
dev->name, ret);
}
dp->nssctx = NULL;
}
static netdev_tx_t nss_ifb_xmit(struct sk_buff *skb, struct net_device *dev)
{
return NETDEV_TX_OK;
}
static int nss_ifb_close(struct net_device *dev)
{
struct nss_ifb_dev_private *dp = netdev_priv(dev);
struct nss_ctx_instance *nss_ctx;
struct net_device *src_dev;
uint32_t src_if_num;
int ret;
nss_ctx = dp->nssctx->nss_ctx;
src_dev = dp->nss_src_dev;
src_if_num = dp->nss_src_if_num;
ret = nss_phys_if_set_nexthop(nss_ctx, src_if_num, NSS_ETH_RX_INTERFACE);
if (ret != NSS_TX_SUCCESS) {
pr_warn("%p: Failed to reset next hop for net device [%s].\n",
nss_ctx, src_dev->name);
}
else {
pr_info("%p: Reset nexthop successful for net device [%s].\n",
nss_ctx, src_dev->name);
}
dev_put(src_dev);
dp->nss_src_dev = NULL;
dp->nss_src_if_num = -1;
return 0;
}
static int nss_ifb_open(struct net_device *dev)
{
struct nss_ifb_dev_private *dp = netdev_priv(dev);
struct net_device *src_dev;
uint32_t src_if_num;
uint32_t nh_if_num;
nss_tx_status_t nss_tx_status;
struct nss_ctx_instance *nss_ctx;
nss_ctx = dp->nssctx->nss_ctx;
nh_if_num = dp->nssctx->if_num_n2h;
strcpy(dp->nss_src_dev_name, nss_dev_name);
src_dev = dev_get_by_name(&init_net, dp->nss_src_dev_name);
if (!src_dev) {
pr_warn("%p: Cannot find the net device [%s]\n",
nss_ctx, dp->nss_src_dev_name);
return -ENODEV;
}
pr_info("%p: Found net device [%s]\n", nss_ctx, dp->nss_src_dev_name);
src_if_num = nss_cmn_get_interface_number_by_dev(src_dev);
if (src_if_num < 0) {
pr_warn("%p: Invalid interface number:%d\n", nss_ctx, src_if_num);
dev_put(src_dev);
return -ENODEV;
}
pr_info("%p: Net device [%s] has NSS intf_num [%d]\n",
nss_ctx, dp->nss_src_dev_name, src_if_num);
nss_tx_status = nss_phys_if_set_nexthop(nss_ctx, src_if_num, nh_if_num);
if (nss_tx_status != NSS_TX_SUCCESS) {
pr_warn("%p: Sending message failed, cannot change nexthop for [%s]\n",
nss_ctx, dp->nss_src_dev_name);
}
else {
pr_info("Nexthop successfully set for [%s] to [%s]\n",
dp->nss_src_dev_name, dev->name);
}
dp->nss_src_dev = src_dev;
dp->nss_src_if_num = src_if_num;
return 0;
}
static const struct net_device_ops nss_ifb_netdev_ops = {
.ndo_open = nss_ifb_open,
.ndo_stop = nss_ifb_close,
.ndo_get_stats64 = nss_ifb_stats64,
.ndo_start_xmit = nss_ifb_xmit,
.ndo_validate_addr = eth_validate_addr,
.ndo_init = nss_ifb_dev_init,
.ndo_uninit = nss_ifb_dev_uninit,
};
#define IFB_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | NETIF_F_FRAGLIST | \
NETIF_F_TSO_ECN | NETIF_F_TSO | NETIF_F_TSO6 | \
NETIF_F_GSO_ENCAP_ALL | \
NETIF_F_HIGHDMA | NETIF_F_HW_VLAN_CTAG_TX | \
NETIF_F_HW_VLAN_STAG_TX)
static void nss_ifb_dev_free(struct net_device *dev)
{
}
static void nss_ifb_setup(struct net_device *dev)
{
/* Initialize the device structure. */
dev->netdev_ops = &nss_ifb_netdev_ops;
/* Fill in device structure with ethernet-generic values. */
ether_setup(dev);
dev->tx_queue_len = TX_Q_LIMIT;
dev->features |= IFB_FEATURES;
dev->hw_features |= dev->features;
dev->hw_enc_features |= dev->features;
dev->vlan_features |= IFB_FEATURES & ~(NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_STAG_TX);
dev->flags |= IFF_NOARP;
dev->flags &= ~IFF_MULTICAST;
dev->priv_flags &= ~IFF_TX_SKB_SHARING;
netif_keep_dst(dev);
eth_hw_addr_random(dev);
dev->needs_free_netdev = true;
dev->priv_destructor = nss_ifb_dev_free;
dev->min_mtu = 0;
dev->max_mtu = 0;
}
static int nss_ifb_validate(struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{
if (tb[IFLA_ADDRESS]) {
if (nla_len(tb[IFLA_ADDRESS]) != ETH_ALEN)
return -EINVAL;
if (!is_valid_ether_addr(nla_data(tb[IFLA_ADDRESS])))
return -EADDRNOTAVAIL;
}
return 0;
}
static struct rtnl_link_ops nss_ifb_link_ops __read_mostly = {
.kind = "nss_ifb",
.priv_size = sizeof(struct nss_ifb_dev_private),
.setup = nss_ifb_setup,
.validate = nss_ifb_validate,
};
static int __init nss_ifb_init_module(void)
{
struct net_device *dev;
int err;
down_write(&pernet_ops_rwsem);
rtnl_lock();
err = __rtnl_link_register(&nss_ifb_link_ops);
if (err < 0)
goto out;
dev = alloc_netdev(sizeof(struct nss_ifb_dev_private), "nssifb",
NET_NAME_UNKNOWN, nss_ifb_setup);
if (dev) {
dev->rtnl_link_ops = &nss_ifb_link_ops;
err = register_netdevice(dev);
}
else {
err = -ENOMEM;
}
if (err)
__rtnl_link_unregister(&nss_ifb_link_ops);
out:
rtnl_unlock();
up_write(&pernet_ops_rwsem);
if (!err)
pr_info("NSS IFB module loaded.\n");
else
pr_warn("Failed to load NSS IFB module.\n");
return err;
}
static void __exit nss_ifb_cleanup_module(void)
{
rtnl_link_unregister(&nss_ifb_link_ops);
pr_info("NSS IFB module unloaded.\n");
}
module_init(nss_ifb_init_module);
module_exit(nss_ifb_cleanup_module);
MODULE_LICENSE("GPL");
MODULE_ALIAS_RTNL_LINK("nss_ifb");

112
nss-userspace-oss/Makefile Normal file
View File

@ -0,0 +1,112 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=nss-userspace-oss
PKG_RELEASE:=2
PKG_SOURCE_URL:=https://git.codelinaro.org/clo/qsdk/oss/nss-userspace.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_DATE:=2024-11-27
PKG_SOURCE_VERSION:=7233e22
PKG_MIRROR_HASH:=03dea072feb18916f32798f7bfd8c8811733e0681c4e9e1d77dd895f121de734
QSDK_VERSION:=13.0
PKG_VERSION:=$(QSDK_VERSION).$(subst -,.,$(PKG_SOURCE_DATE))~$(PKG_SOURCE_VERSION)
PKG_BUILD_PARALLEL:=1
PKG_FLAGS:=nonshared
PKG_BUILD_FLAGS:=gc-sections lto
PKG_CONFIG_DEPENDS:= \
CONFIG_NSS_NLCAPWAP_ENABLE \
CONFIG_NSS_NLDTLS_ENABLE \
CONFIG_NSS_NLGRE_REDIR_ENABLE \
CONFIG_NSS_NLIPSEC_ENABLE \
CONFIG_NSS_NLQRFS_ENABLE \
CONFIG_NSS_NLUDP_ST_ENABLE
include $(INCLUDE_DIR)/package.mk
define Package/nss-userspace
TITLE:=Userspace utilities for NSS
endef
define Package/libnl-nss
$(call Package/nss-userspace)
SECTION:=Libs
CATEGORY:=Libraries
TITLE += (libnl-nss)
DEPENDS:=+libpthread +libnl-tiny +kmod-qca-nss-drv-netlink
endef
define Package/libnl-nss/description
A framework in the userspace that establishes communication between userspace applications and the kernel.
endef
define Package/nssinfo
$(call Package/nss-userspace)
SECTION:=Utils
CATEGORY:=Utilities
TITLE += (nssinfo)
DEPENDS:=+libncurses +libnl-nss
endef
define Package/nssinfo/description
A userspace utility for fetching stats from NSS.
endef
TARGET_CFLAGS += $(FPIC) -D_GNU_SOURCE=1
TARGET_CPPFLAGS:= \
-I$(STAGING_DIR)/usr/include/qca-nss-clients \
-I$(STAGING_DIR)/usr/include/qca-nss-drv \
-I$(STAGING_DIR)/usr/include/libnl-tiny \
-I$(STAGING_DIR)/usr/include/libnl-nss
ifneq ($(CONFIG_PACKAGE_libnl-nss),)
MAKE_FLAGS+=BUILD_LIBNSS=y
ifdef CONFIG_NSS_NLUDP_ST_ENABLE
MAKE_FLAGS+=udp_st=y
endif
ifdef CONFIG_NSS_NLQRFS_ENABLE
MAKE_FLAGS+=qrfs=y
endif
ifdef CONFIG_NSS_NLGRE_REDIR_ENABLE
MAKE_FLAGS+=gre_redir=y
endif
ifdef CONFIG_NSS_NLIPSEC_ENABLE
MAKE_FLAGS+=ipsec=y
endif
ifdef CONFIG_NSS_NLDTLS_ENABLE
MAKE_FLAGS+=dtls=y
endif
ifdef CONFIG_NSS_NLCAPWAP_ENABLE
MAKE_FLAGS+=capwap=y
endif
endif
ifneq ($(CONFIG_PACKAGE_nssinfo),)
MAKE_FLAGS+=BUILD_NSSINFO=y
endif
define Build/libnl-nss/InstallDev
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/libnl-nss
$(CP) $(PKG_BUILD_DIR)/lib/include/* $(STAGING_DIR)/usr/include/libnl-nss
endef
define Package/libnl-nss/install
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DATA) $(PKG_BUILD_DIR)/lib/obj/libnl-nss.so $(1)/usr/lib
endef
define Package/nssinfo/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/nssinfo/obj/nssinfo $(1)/usr/sbin/
endef
$(eval $(call BuildPackage,nssinfo))
$(eval $(call BuildPackage,libnl-nss))

View File

@ -0,0 +1,46 @@
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=libnl-nss
PKG_RELEASE:=1
PKG_BUILD_DEPENDS:=libnl
include $(INCLUDE_DIR)/package.mk
define Package/libnl-nss
SECTION:=Libs
CATEGORY:=Libraries
TITLE:=Framework to communicate between userspace applications and the kernel.
DEPENDS:=+libpthread +libnl +@NSS_DRV_CRYPTO_ENABLE +kmod-qca-nss-drv-netlink
endef
define Package/libnl-nss/description
A framework in the userspace that establishes communication between userspace applications and the kernel.
endef
TOOL_CFLAGS:= -I$(STAGING_DIR)/usr/include/qca-nss-clients \
-I$(STAGING_DIR)/usr/include/qca-nss-drv \
-I$(STAGING_DIR)/usr/include/libnl3
TOOL_LDFLAGS:= -L$(STAGING_DIR)/lib
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) \
CC="$(TARGET_CC)" \
AR="$(TARGET_AR) " \
CFLAGS="$(TOOL_CFLAGS)" \
LD_LIBRARY_PATH="$(TOOL_LDFLAGS)"
endef
define Build/InstallDev
$(INSTALL_DIR) $(STAGING_DIR)/usr/include/libnl-nss
$(CP) $(PKG_BUILD_DIR)/obj/libnl-nss.so $(STAGING_DIR)/usr/lib
$(CP) $(PKG_BUILD_DIR)/include/* $(STAGING_DIR)/usr/include/libnl-nss
endef
define Package/libnl-nss/install
$(INSTALL_DIR) $(1)/lib
$(INSTALL_DATA) $(PKG_BUILD_DIR)/obj/libnl-nss.so $(1)/lib
endef
# $(eval $(call BuildPackage,libnl-nss))

View File

@ -0,0 +1,35 @@
MKDIR = @mkdir -p $(@D)
SRCPATH = ./
OBJPATH = obj
BINARY = $(OBJPATH)/libnl-nss.so
SOURCES = $(wildcard $(SRCPATH)/*.c)
OBJECTS = $(SOURCES:$(SRCPATH)/%.c=$(OBJPATH)/%.o)
HEADERS = $(wildcard $(SRCPATH)/*.h)
INCLUDE += -I./include
LDFLAGS = -lnl-3 -lnl-genl-3
EXTRA_CFLAGS = -Wall -Werror -fPIC -Wl,-z,relro -Wl,-z,now
EXTRA_LDFLAGS = -pie -Wl,-z,relro -Wl,-z,now
all: release
release: $(BINARY)
$(OBJPATH)/%.o: $(SRCPATH)/%.c $(HEADERS)
$(MKDIR)
@echo [CC] $@
@$(CC) -c $(CFLAGS) $(INCLUDE) $(EXTRA_CFLAGS) -o $@ $<
$(BINARY): $(OBJECTS)
@echo $(BINARY)
@echo [LD] $@
@$(CC) -shared -o $@ $^ $(LDFLAGS) $(LDLIBS)
clean:
@echo [Clean]
@rm -f $(OBJECTS)
@rm -f $(BINARY)
@rm -rf $(OBJPATH)
.PHONY: clean

View File

@ -0,0 +1,71 @@
/*
**************************************************************************
* Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**************************************************************************
*/
#ifndef __NSS_NLBASE_H__
#define __NSS_NLBASE_H__
/*
* TODO: Remove inter-dependencies between the header files.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <errno.h>
#include <assert.h>
#include <fcntl.h>
#include <getopt.h>
#include <limits.h>
#include <linux/socket.h>
#include <net/if.h>
#include <pthread.h>
#include <stdbool.h>
#include <stdint.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <linux/if_ether.h>
/* Generic Netlink header */
#include <netlink/genl/ctrl.h>
#include <netlink/genl/family.h>
#include <netlink/genl/genl.h>
#if !defined (likely) || !defined (unlikely)
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#endif
/* NSS headers */
#include <nss_arch.h>
#include <nss_def.h>
#include <nss_cmn.h>
#include <nss_ipv4.h>
#include <nss_ipv6.h>
#include <nss_nlcmn_if.h>
#include <nss_dtls_cmn.h>
#include <nss_dtlsmgr.h>
#include <nss_nl_if.h>
#include <nss_nlsock_api.h>
#include <nss_nldtls_if.h>
#include <nss_nldtls_api.h>
#include <nss_nlist_api.h>
#include <nss_nlipv4_if.h>
#include <nss_nlipv4_api.h>
#include <nss_nlipv6_if.h>
#include <nss_nlipv6_api.h>
#include <nss_nlmcast_api.h>
#endif /* __NSS_NLBASE_H__ */

View File

@ -0,0 +1,119 @@
/*
**************************************************************************
* Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**************************************************************************
*/
#ifndef __NSS_NLDTLS_API_H__
#define __NSS_NLDTLS_API_H__
/** @addtogroup chapter_nldtls
This chapter describes Data Transport Layer Security (DTLS) APIs in the user space.
These APIs are wrapper functions for DTLS family specific operations.
*/
/** @addtogroup nss_nldtls_datatypes @{ */
/**
* Response callback for DTLS.
*
* @param[in] user_ctx User context (provided at socket open).
* @param[in] rule DTLS rule.
* @param[in] resp_ctx User data per callback.
*
* @return
* None.
*/
typedef void (*nss_nldtls_resp_t)(void *user_ctx, struct nss_nldtls_rule *rule, void *resp_ctx);
/**
* Event callback for DTLS.
*
* @param[in] user_ctx User context (provided at socket open).
* @param[in] rule DTLS rule.
*
* @return
* None.
*/
typedef void (*nss_nldtls_event_t)(void *user_ctx, struct nss_nldtls_rule *rule);
/**
* NSS NL DTLS response.
*/
struct nss_nldtls_resp {
void *data; /**< Response context. */
nss_nldtls_resp_t cb; /**< Response callback. */
};
/**
* NSS NL DTLS context.
*/
struct nss_nldtls_ctx {
struct nss_nlsock_ctx sock; /**< NSS socket context. */
nss_nldtls_event_t event; /**< NSS event callback function. */
};
/** @} *//* end_addtogroup nss_nldtls_datatypes */
/** @addtogroup nss_nldtls_functions @{ */
/**
* Opens NSS NL DTLS socket.
*
* @param[in] ctx NSS NL socket context allocated by the caller.
* @param[in] user_ctx User context stored per socket.
* @param[in] event_cb Event callback handler.
*
* @return
* Status of the open call.
*/
int nss_nldtls_sock_open(struct nss_nldtls_ctx *ctx, void *user_ctx, nss_nldtls_event_t event_cb);
/**
* Closes NSS NL DTLS socket.
*
* @param[in] ctx NSS NL context.
*
* @return
* None.
*/
void nss_nldtls_sock_close(struct nss_nldtls_ctx *ctx);
/**
* Send a DTLS rule synchronously to NSS NL NETLINK.
*
* @param[in] ctx NSS DTLS NL context.
* @param[in] rule DTLS rule.
* @param[in] cb Response callback handler.
* @param[in] data Data received from sender.
*
* @return
* Send status:
* - 0 -- Success.
* - Negative version error (-ve) -- Failure.
*/
int nss_nldtls_sock_send(struct nss_nldtls_ctx *ctx, struct nss_nldtls_rule *rule, nss_nldtls_resp_t cb, void *data);
/**
* Initializes create rule message.
*
* @param[in] rule DTLS rule.
* @param[in] type Type of command.
*
* @return
* None.
*/
void nss_nldtls_init_rule(struct nss_nldtls_rule *rule, enum nss_nldtls_cmd_type type);
/** @} *//* end_addtogroup nss_nldtls_functions */
#endif /* __NSS_NLDTLS_API_H__ */

View File

@ -0,0 +1,253 @@
/*
**************************************************************************
* Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**************************************************************************
*/
#ifndef __NSS_NLIPV4_API_H__
#define __NSS_NLIPV4_API_H__
#define NSS_IPV4_RULE_CREATE_IDENTIFIER_VALID 0x1000 /**< Identifier is valid. */
/** @addtogroup chapter_nlipv4
This chapter describes IPv4 APIs in the user space.
These APIs are wrapper functions for IPv4 family specific operations.
*/
/** @addtogroup nss_nlipv4_datatypes @{ */
/**
* Response callback for IPv4.
*
* @param[in] user_ctx User context (provided at socket open).
* @param[in] rule IPv4 rule.
* @param[in] resp_ctx User data per callback.
*
* @return
* None.
*/
typedef void (*nss_nlipv4_resp_t)(void *user_ctx, struct nss_nlipv4_rule *rule, void *resp_ctx);
/**
* Event callback for IPv4.
*
* @param[in] user_ctx User context (provided at socket open).
* @param[in] rule IPv4 rule.
*
* @return
* None.
*/
typedef void (*nss_nlipv4_event_t)(void *user_ctx, struct nss_nlipv4_rule *rule);
/**
* NSS NL IPv4 response.
*/
struct nss_nlipv4_resp {
void *data; /**< Response context. */
nss_nlipv4_resp_t cb; /**< Response callback. */
};
/**
* NSS NL IPv4 context.
*/
struct nss_nlipv4_ctx {
struct nss_nlsock_ctx sock; /**< NSS socket context. */
nss_nlipv4_event_t event; /**< NSS event callback function. */
};
/** @} *//* end_addtogroup nss_nlipv4_datatypes */
/** @addtogroup nss_nlipv4_functions @{ */
/**
* Opens NSS NL IPv4 socket.
*
* @param[in] ctx NSS NL socket context allocated by the caller.
* @param[in] user_ctx User context stored per socket.
* @param[in] event_cb Event callback handler.
*
* @return
* Status of the open call.
*/
int nss_nlipv4_sock_open(struct nss_nlipv4_ctx *ctx, void *user_ctx, nss_nlipv4_event_t event_cb);
/**
* Closes NSS NL IPv4 socket.
*
* @param[in] ctx NSS NL context.
*
* @return
* None.
*/
void nss_nlipv4_sock_close(struct nss_nlipv4_ctx *ctx);
/**
* Sends an IPv4 rule synchronously to NSS NETLINK.
*
* @param[in] ctx NSS NL IPv4 context.
* @param[in] rule IPv4 rule.
* @param[in] cb Response callback handler.
* @param[in] data Response data per callback.
*
* @return
* Send status:
* - 0 -- Success.
* - Negative version error (-ve) -- Failure.
*/
int nss_nlipv4_sock_send(struct nss_nlipv4_ctx *ctx, struct nss_nlipv4_rule *rule, nss_nlipv4_resp_t cb, void *data);
/**
* Initializes IPv4 rule message.
*
* @param[in] rule IPv4 rule.
* @param[in] type Command type.
*
* @return
* None.
*/
void nss_nlipv4_init_rule(struct nss_nlipv4_rule *rule, enum nss_ipv4_message_types type);
/**
* Initializes connection rule for create message.
*
* @param[in] create Creates message.
*
* @return
* None.
*/
static inline void nss_nlipv4_init_conn_rule(struct nss_ipv4_rule_create_msg *create)
{
create->valid_flags |= NSS_IPV4_RULE_CREATE_CONN_VALID;
}
/**
* Enables route flow.
*
* @param[in] create Creates message.
*
* @return
* None.
*/
static inline void nss_nlipv4_init_route_flow_rule(struct nss_ipv4_rule_create_msg *create)
{
create->rule_flags |= NSS_IPV4_RULE_CREATE_FLAG_ROUTED;
}
/**
* Enables bridge flow.
*
* @param[in] create Creates message.
*
* @return
* None.
*/
static inline void nss_nlipv4_init_bridge_flow_rule(struct nss_ipv4_rule_create_msg *create)
{
create->rule_flags |= NSS_IPV4_RULE_CREATE_FLAG_BRIDGE_FLOW;
}
/**
* Initializes TCP protocol rule for create message.
*
* @param[in] create Creates message.
*
* @return
* None.
*/
static inline void nss_nlipv4_init_tcp_rule(struct nss_ipv4_rule_create_msg *create)
{
create->valid_flags |= NSS_IPV4_RULE_CREATE_TCP_VALID;
}
/**
* Initializes PPPoE rule for create message.
*
* @param[in] create Creates message.
*
* @return
* None.
*/
static inline void nss_nlipv4_init_pppoe_rule(struct nss_ipv4_rule_create_msg *create)
{
create->valid_flags |= NSS_IPV4_RULE_CREATE_PPPOE_VALID;
}
/**
* Initializes QoS rule for create message.
*
* @param[in] create Creates message.
*
* @return
* None.
*/
static inline void nss_nlipv4_init_qos_rule(struct nss_ipv4_rule_create_msg *create)
{
create->valid_flags |= NSS_IPV4_RULE_CREATE_QOS_VALID;
}
/**
* Initializes DSCP rule for create message.
*
* @param[in] create Creates message.
*
* @return
* None.
*/
static inline void nss_nlipv4_init_dscp_rule(struct nss_ipv4_rule_create_msg *create)
{
create->valid_flags |= NSS_IPV4_RULE_CREATE_DSCP_MARKING_VALID;
}
/**
* Initializes VLAN rule for create message.
*
* @param[in] create Creates message.
*
* @return
* None.
*/
static inline void nss_nlipv4_init_vlan_rule(struct nss_ipv4_rule_create_msg *create)
{
struct nss_ipv4_vlan_rule *primary;
struct nss_ipv4_vlan_rule *secondary;
primary = &create->vlan_primary_rule;
secondary = &create->vlan_secondary_rule;
create->valid_flags |= NSS_IPV4_RULE_CREATE_VLAN_VALID;
/*
* set the tags to default values
*/
primary->ingress_vlan_tag = NSS_NLIPV4_VLAN_ID_NOT_CONFIGURED;
primary->egress_vlan_tag = NSS_NLIPV4_VLAN_ID_NOT_CONFIGURED;
secondary->ingress_vlan_tag = NSS_NLIPV4_VLAN_ID_NOT_CONFIGURED;
secondary->egress_vlan_tag = NSS_NLIPV4_VLAN_ID_NOT_CONFIGURED;
}
/**
* Initializes Identifier rule for create message.
*
* @param[in] create Creates message.
*
* @return
* None.
*/
static inline void nss_nlipv4_init_identifier_rule(struct nss_ipv4_rule_create_msg *create)
{
create->valid_flags |= NSS_IPV4_RULE_CREATE_IDENTIFIER_VALID;
}
/** @} *//* end_addtogroup nss_nlipv4_functions */
#endif /* __NSS_NLIPV4_API_H__ */

View File

@ -0,0 +1,253 @@
/*
**************************************************************************
* Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**************************************************************************
*/
#ifndef __NSS_NLIPV6_API_H__
#define __NSS_NLIPV6_API_H__
#define NSS_IPV6_RULE_CREATE_IDENTIFIER_VALID 0x1000 /**< Identifier is valid. */
/** @addtogroup chapter_nlipv6
This chapter describes IPv6 APIs in the user space.
These APIs are wrapper functions for IPv6 family specific operations.
*/
/** @addtogroup nss_nlipv6_datatypes @{ */
/**
* Response callback for IPv6.
*
* @param[in] user_ctx User context (provided at socket open).
* @param[in] rule IPv6 rule.
* @param[in] resp_ctx user data per callback.
*
* @return
* None.
*/
typedef void (*nss_nlipv6_resp_t)(void *user_ctx, struct nss_nlipv6_rule *rule, void *resp_ctx);
/**
* Event callback for IPv6.
*
* @param[in] user_ctx User context (provided at socket open).
* @param[in] rule IPv6 Rule.
*
* @return
* None.
*/
typedef void (*nss_nlipv6_event_t)(void *user_ctx, struct nss_nlipv6_rule *rule);
/**
* NSS NL IPv6 response.
*/
struct nss_nlipv6_resp {
void *data; /**< Response context. */
nss_nlipv6_resp_t cb; /**< Response callback. */
};
/**
* NSS NL IPv6 context.
*/
struct nss_nlipv6_ctx {
struct nss_nlsock_ctx sock; /**< NSS socket context. */
nss_nlipv6_event_t event; /**< NSS event callback function. */
};
/** @} *//* end_addtogroup nss_nlipv6_datatypes */
/** @addtogroup nss_nlipv6_functions @{ */
/**
* Opens NSS NL IPv6 socket.
*
* @param[in] ctx NSS NL socket context allocated by the caller.
* @param[in] user_ctx User context stored per socket.
* @param[in] event_cb Event callback handler.
*
* @return
* Status of the open call.
*/
int nss_nlipv6_sock_open(struct nss_nlipv6_ctx *ctx, void *user_ctx, nss_nlipv6_event_t event_cb);
/**
* Closes NSS NL IPv6 socket.
*
* @param[in] ctx NSS NL context.
*
* @return
* None.
*/
void nss_nlipv6_sock_close(struct nss_nlipv6_ctx *ctx);
/**
* Sends an IPv6 rule synchronously to NSS NETLINK.
*
* @param[in] ctx NSS IPv6 NL context.
* @param[in] rule IPv6 rule.
* @param[in] cb Response callback handler.
* @param[in] data Response data per callback.
*
* @return
* Send status:
* - 0 -- Success.
* - Negative version error (-ve) -- Failure.
*/
int nss_nlipv6_sock_send(struct nss_nlipv6_ctx *ctx, struct nss_nlipv6_rule *rule, nss_nlipv6_resp_t cb, void *data);
/**
* Initializes rule message.
*
* @param[in] rule IPv6 rule.
* @param[in] type Command type.
*
* @return
* None.
*/
void nss_nlipv6_init_rule(struct nss_nlipv6_rule *rule, enum nss_ipv6_message_types type);
/**
* Initializes connection rule for create message.
*
* @param[in] create Creates message.
*
* @return
* None.
*/
static inline void nss_nlipv6_init_conn_rule(struct nss_ipv6_rule_create_msg *create)
{
create->valid_flags |= NSS_IPV6_RULE_CREATE_CONN_VALID;
}
/**
* Enables route flow.
*
* @param[in] create Creates message.
*
* @return
* None.
*/
static inline void nss_nlipv6_init_route_flow_rule(struct nss_ipv6_rule_create_msg *create)
{
create->rule_flags |= NSS_IPV6_RULE_CREATE_FLAG_ROUTED;
}
/**
* Enables bridge flow.
*
* @param[in] create create message.
*
* @return
* None.
*/
static inline void nss_nlipv6_init_bridge_flow_rule(struct nss_ipv6_rule_create_msg *create)
{
create->rule_flags |= NSS_IPV6_RULE_CREATE_FLAG_BRIDGE_FLOW;
}
/**
* Initializes TCP protocol rule for create message.
*
* @param[in] create Creates message.
*
* @return
* None.
*/
static inline void nss_nlipv6_init_tcp_rule(struct nss_ipv6_rule_create_msg *create)
{
create->valid_flags |= NSS_IPV6_RULE_CREATE_TCP_VALID;
}
/**
* Initializes PPPoE rule for create message.
*
* @param[in] create Creates message.
*
* @return
* None.
*/
static inline void nss_nlipv6_init_pppoe_rule(struct nss_ipv6_rule_create_msg *create)
{
create->valid_flags |= NSS_IPV6_RULE_CREATE_PPPOE_VALID;
}
/**
* Initializes QoS rule for create message.
*
* @param[in] create Creates message.
*
* @return
* None.
*/
static inline void nss_nlipv6_init_qos_rule(struct nss_ipv6_rule_create_msg *create)
{
create->valid_flags |= NSS_IPV6_RULE_CREATE_QOS_VALID;
}
/**
* Initializes DSCP rule for create message.
*
* @param[in] create Creates message.
*
* @return
* None.
*/
static inline void nss_nlipv6_init_dscp_rule(struct nss_ipv6_rule_create_msg *create)
{
create->valid_flags |= NSS_IPV6_RULE_CREATE_DSCP_MARKING_VALID;
}
/**
* Initializes VLAN rule for create message.
*
* @param[in] create Creates message.
*
* @return
* None.
*/
static inline void nss_nlipv6_init_vlan_rule(struct nss_ipv6_rule_create_msg *create)
{
struct nss_ipv6_vlan_rule *primary;
struct nss_ipv6_vlan_rule *secondary;
primary = &create->vlan_primary_rule;
secondary = &create->vlan_secondary_rule;
create->valid_flags |= NSS_IPV6_RULE_CREATE_VLAN_VALID;
/*
* set the tags to default values
*/
primary->ingress_vlan_tag = NSS_NLIPV6_VLAN_ID_NOT_CONFIGURED;
primary->egress_vlan_tag = NSS_NLIPV6_VLAN_ID_NOT_CONFIGURED;
secondary->ingress_vlan_tag = NSS_NLIPV6_VLAN_ID_NOT_CONFIGURED;
secondary->egress_vlan_tag = NSS_NLIPV6_VLAN_ID_NOT_CONFIGURED;
}
/**
* Initializes Identifier rule for create message.
*
* @param[in] create Creates message.
*
* @return
* None.
*/
static inline void nss_nlipv6_init_identifier_rule(struct nss_ipv6_rule_create_msg *create)
{
create->valid_flags |= NSS_IPV6_RULE_CREATE_IDENTIFIER_VALID;
}
/** @} *//* end_addtogroup nss_nlipv6_functions */
#endif /* __NSS_NLIPV6_API_H__ */

View File

@ -0,0 +1,220 @@
/*
**************************************************************************
* Copyright (c) 2019,2021 The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**************************************************************************
*/
#ifndef __NSS_NLIST_H__
#define __NSS_NLIST_H__
/** @addtogroup chapter_nlist
This chapter describes Netlink list APIs in the user space.
*/
/** @ingroup nss_nlist_datatypes
* List node
*/
struct nss_nlist {
struct nss_nlist *next; /**< Next node. */
struct nss_nlist *prev; /**< Previous node. */
};
/** @addtogroup nss_nlist_functions @{ */
/**
* Initializes the list node.
*
* @param[in] node List node.
*
* @return
* None.
*/
static inline void nss_nlist_init(struct nss_nlist *node)
{
node->next = node->prev = node;
}
/**
* Gets the previous node.
*
* @param[in] node Previous node.
*
* @return
* Previous node or head node.
*/
static inline struct nss_nlist *nss_nlist_prev(struct nss_nlist *node)
{
return node->prev;
}
/**
* Gets the next node.
*
* @param[in] node Next node.
*
* @return
* Next node or head node.
*/
static inline struct nss_nlist *nss_nlist_next(struct nss_nlist *node)
{
return node->next;
}
/**
* Initializes the head node.
*
* @param[in] head Head of list.
*
* @return
* None.
*/
static inline void nss_nlist_init_head(struct nss_nlist *head)
{
nss_nlist_init(head);
}
/**
* Returns first node in the list.
*
* @param[in] head List head.
*
* @return
* First node.
*/
static inline struct nss_nlist *nss_nlist_first(struct nss_nlist *head)
{
return nss_nlist_next(head);
}
/**
* Returns last node in the list.
*
* @param[in] head List head.
*
* @return
* Last node.
*/
static inline struct nss_nlist *nss_nlist_last(struct nss_nlist *head)
{
return nss_nlist_prev(head);
}
/**
* Checks if list is empty.
*
* @param[in] head List head.
*
* @return
* TRUE if empty.
*/
static inline bool nss_nlist_isempty(struct nss_nlist *head)
{
struct nss_nlist *first = nss_nlist_first(head);
return first == head;
}
/**
* Checks if corresponding node is the last node.
*
* @param[in] head Head node.
* @param[in] node Node to check.
*
* @return
* TRUE if it is the last node.
*/
static inline bool nss_nlist_islast(struct nss_nlist *head, struct nss_nlist *node)
{
struct nss_nlist *last = nss_nlist_last(head);
return last == node;
}
/**
* Adds node to head of the list.
*
* @param[in] head List head.
* @param[in] node Node to add.
*
* @return
* None.
*/
static inline void nss_nlist_add_head(struct nss_nlist *head, struct nss_nlist *node)
{
struct nss_nlist *first = nss_nlist_first(head);
node->prev = head;
node->next = first;
first->prev = node;
head->next = node;
}
/**
* Adds node to tail of the list.
*
* @param[in] head List head.
* @param[in] node Node to add.
*
* @return
* None.
*/
static inline void nss_nlist_add_tail(struct nss_nlist *head, struct nss_nlist *node)
{
struct nss_nlist *last = nss_nlist_last(head);
node->next = head;
node->prev = last;
last->next = node;
head->prev = node;
}
/**
* Unlinks node from the list.
*
* @param[in] node Node to unlink.
*
* @return
* None.
*/
static inline void nss_nlist_unlink(struct nss_nlist *node)
{
struct nss_nlist *prev = nss_nlist_prev(node);
struct nss_nlist *next = nss_nlist_next(node);
prev->next = next;
next->prev = prev;
nss_nlist_init(node);
}
/** @} *//* end_addtogroup nss_nlist_functions */
/** @ingroup nss_nlist_macros
* Lists node iterator.
*
* @hideinitializer
* @param[in] _tmp Temporary node for assignment.
* @param[in] _head Head node to start.
*
* @return
* None.
*/
#define nss_nlist_iterate(_tmp, _head) \
for ((_tmp) = nss_nlist_first((_head)); \
!nss_nlist_islast((_head), (_tmp)); \
(_tmp) = nss_nlist_next((_tmp))
#endif /* __NSS_NLIST_H__ */

View File

@ -0,0 +1,102 @@
/*
**************************************************************************
* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**************************************************************************
*/
#ifndef __NSS_NLMCAST_API_H__
#define __NSS_NLMCAST_API_H__
/** @addtogroup chapter_nlmcast
This chapter describes multicast APIs in the user space.
These APIs are wrapper functions for multicast specific operations.
*/
/** @addtogroup nss_nlmcast_datatypes @{ */
/**
* Event callback for multicast.
*
* @param[in] cmd Command received in generic Netlink header.
* @param[in] data Data received in Netlink message.
*/
typedef void (*nss_nlmcast_event_t)(int cmd, void *data);
/**
* NSS multicast context.
*/
struct nss_nlmcast_ctx {
struct nss_nlsock_ctx sock; /**< NSS socket context. */
nss_nlmcast_event_t event; /**< NSS event callback function. */
};
/** @} *//* end_addtogroup nss_nlmcast_datatypes */
/** @addtogroup nss_nlmcast_functions @{ */
/**
* Listens to NSS NL multicast event data.
*
* @param[in] ctx Multicast context.
*
* @return
* Listen status.
*/
int nss_nlmcast_sock_listen(struct nss_nlmcast_ctx *ctx);
/**
* Subscribe the multicast group to receive responses.
*
* @param[in] ctx Multicast context.
* @param[in] grp_name NSS NL group name.
*
* @return
* Subscription status.
*/
int nss_nlmcast_sock_join_grp(struct nss_nlmcast_ctx *ctx, char *grp_name);
/**
* Unsubscribe the multicast group to stop receiving responses.
*
* @param[in] ctx Multicast context.
* @param[in] grp_name NSS NL group name.
*
* @return
* Status of the operation.
*/
int nss_nlmcast_sock_leave_grp(struct nss_nlmcast_ctx *ctx, char *grp_name);
/**
* Opens a socket for listening to NSS NL event data.
*
* @param[in] ctx Multicast context.
* @param[in] cb Callback function.
* @param[in] family_name NSS NL family name.
*
* @return
* Status of the operation.
*/
int nss_nlmcast_sock_open(struct nss_nlmcast_ctx *ctx, nss_nlmcast_event_t cb, const char *family_name);
/**
* Closes socket.
*
* @param[in] ctx Multicast context.
*
* @return
* None.
*/
void nss_nlmcast_sock_close(struct nss_nlmcast_ctx *ctx);
/** @} *//* end_addtogroup nss_nlmcast_functions */
#endif /* __NSS_NLMCAST_API_H__ */

View File

@ -0,0 +1,197 @@
/*
**************************************************************************
* Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**************************************************************************
*/
#ifndef __NSS_NLSOCK_API_H__
#define __NSS_NLSOCK_API_H__
/** @addtogroup chapter_nlsocket
This chapter describes socket APIs for direct use.
@note1hang
Use these APIs(s) only if there are no available helpers for the specific family.
*/
/**
* @ingroup nss_nlsocket_datatypes
* NSS NL socket context.
*/
struct nss_nlsock_ctx {
/* Public, caller must populate using helpers */
const char *family_name; /**< Family name. */
void *user_ctx; /**< Socket user context. */
/* Private, maintained by the library */
pthread_t thread; /**< Response sync. */
pthread_spinlock_t lock; /**< Context lock. */
int ref_cnt; /**< References to the socket. */
struct nl_sock *nl_sk; /**< Linux NL socket. */
struct nl_cb *nl_cb; /**< NSS NL callback context. */
pid_t pid; /**< Process ID associated with the socket. */
int family_id; /**< Family identifier. */
int grp_id; /**< Group indentifier. */
bool is_avail; /**< Indicates if the socket is available to send or listen. */
};
/** @addtogroup nss_nlsocket_macros @{ */
/**
* Prints error log.
*
* @param[in] arg Argument to be printed
*/
#define nss_nlsock_log_error(arg, ...) printf("NSS_NLERROR(%s[%d]):"arg, __func__, __LINE__, ##__VA_ARGS__)
/**
* Prints arguments
*
* @param[in] arg Argument to be printed
*/
#define nss_nlsock_log_info(arg, ...) printf("NSS_NLINFO(%s[%d]):"arg, __func__, __LINE__, ##__VA_ARGS__)
/** @} *//* end_addtogroup nss_nlsocket_macros */
/** @addtogroup nss_nlsocket_functions @{ */
/**
* Sets family name.
*
* @param[in] sock Socket context.
* @param[in] name Family name.
*
* @return
* None.
*/
static inline void nss_nlsock_set_family(struct nss_nlsock_ctx *sock, const char *name)
{
sock->family_name = name;
}
/**
* Sets user context.
*
* @param[in] sock Socket context.
* @param[in] user User context.
*
* @return
* None.
*/
static inline void nss_nlsock_set_user_ctx(struct nss_nlsock_ctx *sock, void *user)
{
sock->user_ctx = user;
}
/**
* Extracts NSS NL message data.
*
* @param[in] msg NL message.
*
* @return
* Pointer to start of NSS NL message.
*/
static inline void *nss_nlsock_get_data(struct nl_msg *msg)
{
struct genlmsghdr *genl_hdr = nlmsg_data((nlmsg_hdr(msg)));
return genlmsg_data(genl_hdr);
}
/**
* Opens NSS NL family socket.
*
* @param[in] sock Socket context to be allocated by the caller.
* @param[in] cb Callback function for response.
*
* @return
* Status of the operation.
*
* @note The underlying entity should set the sock->family name for the socket to open.
*/
int nss_nlsock_open(struct nss_nlsock_ctx *sock, nl_recvmsg_msg_cb_t cb);
/**
* Closes NSS NL family socket.
*
* @param[in] sock Socket context.
*
* @return
* None.
*/
void nss_nlsock_close(struct nss_nlsock_ctx *sock);
/**
* Sends NSS NL message synchronously.
*
* @param[in] sock Socket context.
* @param[in] cm Common message header.
* @param[in] data Message data.
* @param[in] has_resp Determines if response is needed from kernel.
*
* @detdesc The function blocks until ack/error is received from the kernel
* and also blocks for the message response from the kernel if is_resp is TRUE
* @return
* Status of the send operation.
*/
int nss_nlsock_send(struct nss_nlsock_ctx *sock, struct nss_nlcmn *cm, void *data, bool has_resp);
/**
* Listens to asynchronous events from kernel.
*
* @param[in] sock Socket context.
*
* @return
* Listen status.
*/
int nss_nlsock_listen(struct nss_nlsock_ctx *sock);
/**
* Subscribes to multicast group.
*
* @param[in] sock Socket context.
* @param[in] grp_name NSS NL group name.
*
* @return
* Subscription status.
*/
int nss_nlsock_join_grp(struct nss_nlsock_ctx *sock, char *grp_name);
/**
* Unsubscribes from multicast group.
*
* @param[in] sock Socket context.
* @param[in] grp_name NSS NL group name.
*
* @return
* Status of the operation.
*/
int nss_nlsock_leave_grp(struct nss_nlsock_ctx *sock, char *grp_name);
/**
* Opens a socket for listening to NSS NL event data.
*
* @param[in] sock Socket context.
* @param[in] cb Callback function.
*
* @return
* Status of the operation.
*/
int nss_nlsock_open_mcast(struct nss_nlsock_ctx *sock, nl_recvmsg_msg_cb_t cb);
/** @} *//* end_addtogroup nss_nlsocket_functions */
#endif /* __NSS_NLSOCK_API_H__ */

View File

@ -0,0 +1,138 @@
/*
**************************************************************************
* Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**************************************************************************
*/
#include <nss_nlbase.h>
#include <nss_nlsock_api.h>
#include <nss_nldtls_api.h>
/*
* nss_nldtls_sock_cb()
* Callback func for dtls netlink socket
*/
int nss_nldtls_sock_cb(struct nl_msg *msg, void *arg)
{
pid_t pid = getpid();
struct nss_nldtls_rule *rule = nss_nlsock_get_data(msg);
if (!rule) {
nss_nlsock_log_error("%d:failed to get NSS NL dtls header\n", pid);
return NL_SKIP;
}
uint8_t cmd = nss_nlcmn_get_cmd(&rule->cm);
switch (cmd) {
case NSS_NLDTLS_CMD_TYPE_CREATE_TUN:
case NSS_NLDTLS_CMD_TYPE_DESTROY_TUN:
case NSS_NLDTLS_CMD_TYPE_UPDATE_CONFIG:
case NSS_NLDTLS_CMD_TYPE_TX_PKTS:
return NL_OK;
default:
nss_nlsock_log_error("%d:unsupported message cmd type(%d)\n", pid, cmd);
return NL_SKIP;
}
}
/*
* nss_nldtls_sock_open()
* Opens the NSS dtls NL socket for usage
*/
int nss_nldtls_sock_open(struct nss_nldtls_ctx *ctx, void *user_ctx, nss_nldtls_event_t event_cb)
{
pid_t pid = getpid();
int error;
if (!ctx) {
nss_nlsock_log_error("%d: invalid parameters passed\n", pid);
return -EINVAL;
}
memset(ctx, 0, sizeof(*ctx));
nss_nlsock_set_family(&ctx->sock, NSS_NLDTLS_FAMILY);
nss_nlsock_set_user_ctx(&ctx->sock, user_ctx);
/*
* try opening the socket with Linux
*/
error = nss_nlsock_open(&ctx->sock, nss_nldtls_sock_cb);
if (error) {
nss_nlsock_log_error("%d:unable to open NSS dtls socket, error(%d)\n", pid, error);
goto fail;
}
return 0;
fail:
memset(ctx, 0, sizeof(*ctx));
return error;
}
/*
* nss_nldtls_sock_close()
* Close the NSS dtls NL socket
*/
void nss_nldtls_sock_close(struct nss_nldtls_ctx *ctx)
{
nss_nlsock_close(&ctx->sock);
memset(ctx, 0, sizeof(struct nss_nldtls_ctx));
}
/*
* nss_nldtls_sock_send()
* Send the dtls message synchronously through the socket
*/
int nss_nldtls_sock_send(struct nss_nldtls_ctx *ctx, struct nss_nldtls_rule *rule, nss_nldtls_resp_t cb, void *data)
{
int32_t family_id = ctx->sock.family_id;
struct nss_nldtls_resp *resp;
pid_t pid = getpid();
bool has_resp = false;
int error = 0;
if (!rule) {
nss_nlsock_log_error("%d:invalid NSS dtls rule\n", pid);
return -EINVAL;
}
if (cb) {
nss_nlcmn_set_cb_owner(&rule->cm, family_id);
resp = nss_nlcmn_get_cb_data(&rule->cm, family_id);
assert(resp);
resp->data = data;
resp->cb = cb;
has_resp = true;
}
error = nss_nlsock_send(&ctx->sock, &rule->cm, rule, has_resp);
if (error) {
nss_nlsock_log_error("%d:failed to send NSS dtls rule, error(%d)\n", pid, error);
}
return error;
}
/*
* nss_nldtls_init_rule()
* Initialize the dtls rule
*/
void nss_nldtls_init_rule(struct nss_nldtls_rule *rule, enum nss_nldtls_cmd_type type)
{
nss_nldtls_rule_init(rule, type);
}

View File

@ -0,0 +1,176 @@
/*
**************************************************************************
* Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**************************************************************************
*/
#include <nss_nlbase.h>
#include <nss_nlsock_api.h>
#include <nss_nlipv4_api.h>
/*
* nss_nlipv4_sock_cb()
* NSS NL IPv4 callback
*/
int nss_nlipv4_sock_cb(struct nl_msg *msg, void *arg)
{
pid_t pid = getpid();
struct nss_nlipv4_ctx *ctx = (struct nss_nlipv4_ctx *)arg;
struct nss_nlsock_ctx *sock = &ctx->sock;
struct nss_nlipv4_rule *rule = nss_nlsock_get_data(msg);
if (!rule) {
nss_nlsock_log_error("%d:failed to get NSS NL IPv4 header\n", pid);
return NL_SKIP;
}
uint8_t cmd = nss_nlcmn_get_cmd(&rule->cm);
switch (cmd) {
case NSS_IPV4_TX_CREATE_RULE_MSG:
case NSS_IPV4_TX_DESTROY_RULE_MSG:
{
void *cb_data = nss_nlcmn_get_cb_data(&rule->cm, sock->family_id);
if (!cb_data) {
return NL_SKIP;
}
/*
* Note: The callback user can modify the CB content so it
* needs to locally save the response data for further use
* after the callback is completed
*/
struct nss_nlipv4_resp resp;
memcpy(&resp, cb_data, sizeof(struct nss_nlipv4_resp));
/*
* clear the ownership of the CB so that callback user can
* use it if needed
*/
nss_nlcmn_clr_cb_owner(&rule->cm);
if (!resp.cb) {
nss_nlsock_log_info("%d:no IPv4 response callback for cmd(%d)\n", pid, cmd);
return NL_SKIP;
}
resp.cb(sock->user_ctx, rule, resp.data);
return NL_OK;
}
case NSS_IPV4_RX_CONN_STATS_SYNC_MSG:
{
nss_nlipv4_event_t event = ctx->event;
assert(event);
event(sock->user_ctx, rule);
return NL_OK;
}
default:
nss_nlsock_log_error("%d:unsupported message cmd type(%d)\n", pid, cmd);
return NL_SKIP;
}
}
/*
* nss_nlipv4_sock_open()
* this opens the NSS IPv4 NL socket for usage
*/
int nss_nlipv4_sock_open(struct nss_nlipv4_ctx *ctx, void *user_ctx, nss_nlipv4_event_t event_cb)
{
pid_t pid = getpid();
int error;
if (!ctx) {
nss_nlsock_log_error("%d: invalid parameters passed\n", pid);
return -EINVAL;
}
memset(ctx, 0, sizeof(*ctx));
nss_nlsock_set_family(&ctx->sock, NSS_NLIPV4_FAMILY);
nss_nlsock_set_user_ctx(&ctx->sock, user_ctx);
/*
* try opening the socket with Linux
*/
error = nss_nlsock_open(&ctx->sock, nss_nlipv4_sock_cb);
if (error) {
nss_nlsock_log_error("%d:unable to open NSS IPv4 socket, error(%d)\n", pid, error);
goto fail;
}
return 0;
fail:
memset(ctx, 0, sizeof(*ctx));
return error;
}
/*
* nss_nlipv4_sock_close()
* close the NSS IPv4 NL socket
*/
void nss_nlipv4_sock_close(struct nss_nlipv4_ctx *ctx)
{
nss_nlsock_close(&ctx->sock);
}
/*
* nss_nlipv4_sock_send()
* register callback and send the IPv4 message synchronously through the socket
*/
int nss_nlipv4_sock_send(struct nss_nlipv4_ctx *ctx, struct nss_nlipv4_rule *rule, nss_nlipv4_resp_t cb, void *data)
{
int32_t family_id = ctx->sock.family_id;
struct nss_nlipv4_resp *resp;
pid_t pid = getpid();
bool has_resp = false;
int error;
if (!rule) {
nss_nlsock_log_error("%d:invalid NSS IPv4 rule\n", pid);
return -ENOMEM;
}
if (cb) {
nss_nlcmn_set_cb_owner(&rule->cm, family_id);
resp = nss_nlcmn_get_cb_data(&rule->cm, family_id);
assert(resp);
resp->data = data;
resp->cb = cb;
has_resp = true;
}
error = nss_nlsock_send(&ctx->sock, &rule->cm, rule, has_resp);
if (error) {
nss_nlsock_log_error("%d:failed to send NSS IPv4 rule, error(%d)\n", pid, error);
return error;
}
return 0;
}
/*
* nss_nlipv4_init_rule()
* init the rule message
*/
void nss_nlipv4_init_rule(struct nss_nlipv4_rule *rule, enum nss_ipv4_message_types type)
{
nss_nlipv4_rule_init(rule, type);
}

View File

@ -0,0 +1,176 @@
/*
**************************************************************************
* Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**************************************************************************
*/
#include <nss_nlbase.h>
#include <nss_nlsock_api.h>
#include <nss_nlipv6_api.h>
/*
* nss_nlipv6_sock_cb()
* NSS NL IPv6 callback
*/
int nss_nlipv6_sock_cb(struct nl_msg *msg, void *arg)
{
pid_t pid = getpid();
struct nss_nlipv6_ctx *ctx = (struct nss_nlipv6_ctx *)arg;
struct nss_nlsock_ctx *sock = &ctx->sock;
struct nss_nlipv6_rule *rule = nss_nlsock_get_data(msg);
if (!rule) {
nss_nlsock_log_error("%d:failed to get NSS NL IPv6 header\n", pid);
return NL_SKIP;
}
uint8_t cmd = nss_nlcmn_get_cmd(&rule->cm);
switch (cmd) {
case NSS_IPV6_TX_CREATE_RULE_MSG:
case NSS_IPV6_TX_DESTROY_RULE_MSG:
{
void *cb_data = nss_nlcmn_get_cb_data(&rule->cm, sock->family_id);
if (!cb_data) {
return NL_SKIP;
}
/*
* Note: The callback user can modify the CB content so it
* needs to locally save the response data for further use
* after the callback is completed
*/
struct nss_nlipv6_resp resp;
memcpy(&resp, cb_data, sizeof(struct nss_nlipv6_resp));
/*
* clear the ownership of the CB so that callback user can
* use it if needed
*/
nss_nlcmn_clr_cb_owner(&rule->cm);
if (!resp.cb) {
nss_nlsock_log_info("%d:no IPv6 response callback for cmd(%d)\n", pid, cmd);
return NL_SKIP;
}
resp.cb(sock->user_ctx, rule, resp.data);
return NL_OK;
}
case NSS_IPV6_RX_CONN_STATS_SYNC_MSG:
{
nss_nlipv6_event_t event = ctx->event;
assert(event);
event(sock->user_ctx, rule);
return NL_OK;
}
default:
nss_nlsock_log_error("%d:unsupported message cmd type(%d)\n", pid, cmd);
return NL_SKIP;
}
}
/*
* nss_nlipv6_sock_open()
* this opens the NSS IPv6 NL socket for usage
*/
int nss_nlipv6_sock_open(struct nss_nlipv6_ctx *ctx, void *user_ctx, nss_nlipv6_event_t event_cb)
{
pid_t pid = getpid();
int error;
if (!ctx) {
nss_nlsock_log_error("%d: invalid parameters passed\n", pid);
return -EINVAL;
}
memset(ctx, 0, sizeof(*ctx));
nss_nlsock_set_family(&ctx->sock, NSS_NLIPV6_FAMILY);
nss_nlsock_set_user_ctx(&ctx->sock, user_ctx);
/*
* try opening the socket with Linux
*/
error = nss_nlsock_open(&ctx->sock, nss_nlipv6_sock_cb);
if (error) {
nss_nlsock_log_error("%d:unable to open NSS IPv6 socket, error(%d)\n", pid, error);
goto fail;
}
return 0;
fail:
memset(ctx, 0, sizeof(*ctx));
return error;
}
/*
* nss_nlipv6_sock_close()
* close the NSS IPv6 NL socket
*/
void nss_nlipv6_sock_close(struct nss_nlipv6_ctx *ctx)
{
nss_nlsock_close(&ctx->sock);
}
/*
* nss_nlipv6_sock_send()
* register callback and send the IPv6 message synchronously through the socket
*/
int nss_nlipv6_sock_send(struct nss_nlipv6_ctx *ctx, struct nss_nlipv6_rule *rule, nss_nlipv6_resp_t cb, void *data)
{
int32_t family_id = ctx->sock.family_id;
struct nss_nlipv6_resp *resp;
pid_t pid = getpid();
bool has_resp = false;
int error;
if (!rule) {
nss_nlsock_log_error("%d:invalid NSS IPv6 rule\n", pid);
return -ENOMEM;
}
if (cb) {
nss_nlcmn_set_cb_owner(&rule->cm, family_id);
resp = nss_nlcmn_get_cb_data(&rule->cm, family_id);
assert(resp);
resp->data = data;
resp->cb = cb;
has_resp = true;
}
error = nss_nlsock_send(&ctx->sock, &rule->cm, rule, has_resp);
if (error) {
nss_nlsock_log_error("%d:failed to send NSS IPv6 rule, error(%d)\n", pid, error);
return error;
}
return 0;
}
/*
* nss_nlipv6_init_rule()
* init the rule message
*/
void nss_nlipv6_init_rule(struct nss_nlipv6_rule *rule, enum nss_ipv6_message_types type)
{
nss_nlipv6_rule_init(rule, type);
}

View File

@ -0,0 +1,146 @@
/*
**************************************************************************
* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**************************************************************************
*/
#include <nss_nlbase.h>
#include <nss_nlsock_api.h>
#include <nss_nlmcast_api.h>
/*
* nss_nlmcast_sock_cb()
* NSS NL mcast callback.
*/
static int nss_nlmcast_sock_cb(struct nl_msg *msg, void *arg)
{
struct nss_nlmcast_ctx *ctx = (struct nss_nlmcast_ctx *)arg;
struct genlmsghdr *genl_hdr = nlmsg_data((nlmsg_hdr(msg)));
uint8_t cmd = genl_hdr->cmd;
void *data = nss_nlsock_get_data(msg);
if (!data) {
nss_nlsock_log_error("%d:failed to get NSS NL msg header\n", getpid());
return NL_SKIP;
}
nss_nlmcast_event_t event = ctx->event;
assert(event);
event(cmd, data);
return NL_OK;
}
/*
* nss_nlmcast_sock_open()
* Open the NL socket for listening to MCAST events from kernel.
*/
int nss_nlmcast_sock_open(struct nss_nlmcast_ctx *ctx, nss_nlmcast_event_t event_cb, const char *family_name)
{
int error;
if (!ctx || !event_cb) {
nss_nlsock_log_error("Invalid parameters passed\n");
return -EINVAL;
}
memset(ctx, 0, sizeof(*ctx));
nss_nlsock_set_family(&ctx->sock, family_name);
/*
* Subscribe to the NSS NL Multicast group.
*/
error = nss_nlsock_open_mcast(&ctx->sock, nss_nlmcast_sock_cb);
if (error) {
nss_nlsock_log_error("Unable to create socket, error(%d)\n", error);
return error;
}
ctx->event = event_cb;
return 0;
}
/*
* nss_nlmcast_sock_close()
* Close the NL socket.
*/
void nss_nlmcast_sock_close(struct nss_nlmcast_ctx *ctx)
{
nss_nlsock_close(&ctx->sock);
}
/*
* nss_nlmcast_sock_join_grp()
* Subscribe for MCAST group from kernel.
*/
int nss_nlmcast_sock_join_grp(struct nss_nlmcast_ctx *ctx, char *grp_name)
{
int error;
if (!ctx || !grp_name) {
nss_nlsock_log_error("Invalid parameters passed\n");
return -EINVAL;
}
error = nss_nlsock_join_grp(&ctx->sock, grp_name);
if (error) {
nss_nlsock_log_error("Unable to subscribe for mcast group, error(%d)\n", error);
return error;
}
return 0;
}
/*
* nss_nlmcast_sock_leave_grp()
* Unsubscribe for MCAST group from kernel.
*/
int nss_nlmcast_sock_leave_grp(struct nss_nlmcast_ctx *ctx, char *grp_name)
{
int error;
if (!ctx || !grp_name) {
nss_nlsock_log_error("Invalid parameters passed\n");
return -EINVAL;
}
error = nss_nlsock_leave_grp(&ctx->sock, grp_name);
if (error) {
nss_nlsock_log_error("Unable to unsubscribe for mcast group, error(%d)\n", error);
return error;
}
return 0;
}
/*
* nss_nlmcast_sock_listen()
* Listen for MCAST events from kernel
*/
int nss_nlmcast_sock_listen(struct nss_nlmcast_ctx *ctx)
{
int error;
if (!ctx) {
nss_nlsock_log_error("Invalid parameters passed\n");
return -EINVAL;
}
error = nss_nlsock_listen(&ctx->sock);
if (error) {
nss_nlsock_log_error("Unable to listen to mcast events, error(%d)\n", error);
return error;
}
return 0;
}

View File

@ -0,0 +1,498 @@
/*
**************************************************************************
* Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**************************************************************************
*/
/*
* @file netlink socket handler
*/
#include <nss_nlbase.h>
#include <nss_nlsock_api.h>
/*
* nss_nlsock_deinit()
* de-initialize the socket
*/
static void nss_nlsock_deinit(struct nss_nlsock_ctx *sock)
{
assert(sock);
nl_cb_put(sock->nl_cb);
sock->nl_cb = NULL;
nl_socket_free(sock->nl_sk);
sock->nl_sk = NULL;
}
/*
* nss_nlsock_init()
* initialize the socket and callback
*/
static int nss_nlsock_init(struct nss_nlsock_ctx *sock, nl_recvmsg_msg_cb_t cb)
{
int error;
assert(sock);
/*
* Initialize spinlock
*/
error = pthread_spin_init(&sock->lock, PTHREAD_PROCESS_PRIVATE);
if (error) {
nss_nlsock_log_error("Failed to init spinlock for family(%s), error %d\n", sock->family_name, error);
return error;
}
sock->pid = getpid();
/*
* create callback
*/
sock->nl_cb = nl_cb_alloc(NL_CB_CUSTOM);
if (!sock->nl_cb) {
nss_nlsock_log_error("%d:failed to alloc callback for family(%s)\n",sock->pid, sock->family_name);
goto fail1;
}
/*
* register callback
*/
nl_cb_set(sock->nl_cb, NL_CB_VALID, NL_CB_CUSTOM, cb, sock);
/*
* Create netlink socket
*/
sock->nl_sk = nl_socket_alloc_cb(sock->nl_cb);
if (!sock->nl_sk) {
nss_nlsock_log_error("%d:failed to alloc socket for family(%s)\n", sock->pid, sock->family_name);
goto fail2;
}
sock->ref_cnt = 1;
/*
* is_avail is set to indicate the socket is available for send/listen
*/
sock->is_avail = true;
return 0;
fail2:
nl_cb_put(sock->nl_cb);
sock->nl_cb = NULL;
fail1:
pthread_spin_destroy(&sock->lock);
sock->lock = (pthread_spinlock_t)0;
return -ENOMEM;
}
/*
* nss_nlsock_deref()
* decrement the reference count and free socket resources if '0'
*/
static inline void nss_nlsock_deref(struct nss_nlsock_ctx *sock)
{
assert(sock->ref_cnt > 0);
pthread_spin_lock(&sock->lock);
if (--sock->ref_cnt) {
pthread_spin_unlock(&sock->lock);
return;
}
/*
* When there are no more references on the socket,
* deinitialize the socket and destroy the spin lock
* created during nss_nlsock_init
*/
nss_nlsock_deinit(sock);
pthread_spin_unlock(&sock->lock);
pthread_spin_destroy(&sock->lock);
sock->lock = (pthread_spinlock_t)0;
}
/*
* nss_nlsock_ref()
* Increment the reference count.
*
* if ref_cnt == 0, return false
* if ref_cnt != 0, increment the socket reference count and return true
*/
static inline bool nss_nlsock_ref(struct nss_nlsock_ctx *sock)
{
/*
* if ref count is 0, it means there are no references
* on the socket and so return false. Socket will eventually be
* freed by nss_nlsock_deinit else increment the ref count
*/
pthread_spin_lock(&sock->lock);
if (sock->ref_cnt == 0) {
pthread_spin_unlock(&sock->lock);
return false;
}
sock->ref_cnt++;
pthread_spin_unlock(&sock->lock);
return true;
}
/*
* nss_nlsock_listen_callback()
* listen to responses from the netlink socket
*
* The API keeps listening for the responses on the netlink socket
* until socket close is initiated and there are no more
* responses on the socket
*/
static void *nss_nlsock_listen_callback(void *arg)
{
struct nss_nlsock_ctx *sock = (struct nss_nlsock_ctx *)arg;
assert(sock);
/*
* drain responses on the socket
*/
for (;;) {
/*
* if, socket is freed then break out
*/
if (!nss_nlsock_ref(sock)) {
break;
}
/*
* get or block for pending messages
*/
nl_recvmsgs(sock->nl_sk, sock->nl_cb);
nss_nlsock_deref(sock);
}
return NULL;
}
/*
* nss_nlsock_msg_init()
* Initialize parameters to send message down the socket
*/
static int nss_nlsock_msg_init(struct nss_nlsock_ctx *sock, struct nss_nlcmn *cm, void *data, struct nl_msg *msg)
{
int pid = sock->pid;
void *user_hdr;
uint32_t ver;
uint8_t cmd;
int len;
ver = nss_nlcmn_get_ver(cm);
len = nss_nlcmn_get_len(cm);
cmd = nss_nlcmn_get_cmd(cm);
/*
* create space for user header
*/
user_hdr = genlmsg_put(msg, pid, NL_AUTO_SEQ, sock->family_id, len, 0, cmd, ver);
if (!user_hdr) {
nss_nlsock_log_error("%d:failed to put message header of len(%d)\n", pid, len);
return -ENOMEM;
}
memcpy(user_hdr, data, len);
return 0;
}
/*
* nss_nlsock_leave_grp()
* nl socket unsubscribe for the multicast group
*/
int nss_nlsock_leave_grp(struct nss_nlsock_ctx *sock, char *grp_name)
{
int error;
assert(sock->ref_cnt > 0);
/*
* Resolve the group
*/
sock->grp_id = genl_ctrl_resolve_grp(sock->nl_sk, sock->family_name, grp_name);
if (sock->grp_id < 0) {
nss_nlsock_log_error("failed to resolve group(%s)\n", grp_name);
return -EINVAL;
}
/*
* Unsubscribe for the mcast async events
*/
error = nl_socket_drop_memberships(sock->nl_sk, sock->grp_id, 0);
if (error < 0) {
nss_nlsock_log_error("failed to deregister grp(%s)\n", grp_name);
return error;
}
return 0;
}
/*
* nss_nlsock_join_grp()
* nl socket subscribe for the multicast group
*/
int nss_nlsock_join_grp(struct nss_nlsock_ctx *sock, char *grp_name)
{
int error;
assert(sock->ref_cnt > 0);
/*
* Resolve the group
*/
sock->grp_id = genl_ctrl_resolve_grp(sock->nl_sk, sock->family_name, grp_name);
if (sock->grp_id < 0) {
nss_nlsock_log_error("failed to resolve group(%s)\n", grp_name);
return -EINVAL;
}
/*
* Subscribe for the mcast async events
*/
error = nl_socket_add_memberships(sock->nl_sk, sock->grp_id, 0);
if (error < 0) {
nss_nlsock_log_error("failed to register grp(%s)\n", grp_name);
return error;
}
return 0;
}
/*
* nss_nlsock_open_mcast()
* Open the socket for async events
*/
int nss_nlsock_open_mcast(struct nss_nlsock_ctx *sock, nl_recvmsg_msg_cb_t cb)
{
int error;
assert(sock);
error = nss_nlsock_init(sock, cb);
if (error) {
nss_nlsock_log_error("%d:failed to initialize socket(%s)\n", sock->pid, sock->family_name);
return error;
}
/*
* Disable seq number and auto ack checks for sockets listening for mcast events
*/
nl_socket_disable_seq_check(sock->nl_sk);
nl_socket_disable_auto_ack(sock->nl_sk);
/*
* Connect the socket with the netlink bus
*/
if (genl_connect(sock->nl_sk)) {
nss_nlsock_log_error("%d:failed to connect socket for family(%s)\n", sock->pid, sock->family_name);
error = -EBUSY;
goto free_sock;
}
return 0;
free_sock:
nss_nlsock_deref(sock);
return error;
}
/*
* nss_nlsock_send()
* send a message synchronously through the socket
*/
int nss_nlsock_send(struct nss_nlsock_ctx *sock, struct nss_nlcmn *cm, void *data, bool has_resp)
{
int pid = sock->pid;
struct nl_msg *msg;
int error;
/*
* return -EBUSY if the socket is currently unavailable for sending message
*/
pthread_spin_lock(&sock->lock);
if (!sock->is_avail) {
pthread_spin_unlock(&sock->lock);
return -EBUSY;
}
/*
* To indicate the socket is unavailable until the current thread completes the send/listen.
* This is to prevent other threads from simultaneous send/listen.
*/
sock->is_avail = false;
pthread_spin_unlock(&sock->lock);
/*
* allocate new message buffer
*/
msg = nlmsg_alloc();
if (!msg) {
nss_nlsock_log_error("%d:failed to allocate message buffer\n", pid);
sock->is_avail = true;
return -ENOMEM;
}
/*
* Holds a reference on the socket until msg is sent down to the kernel
*/
if (!nss_nlsock_ref(sock)) {
nss_nlsock_log_error("%d:failed to get NL socket\n", pid);
nlmsg_free(msg);
sock->is_avail = true;
return -EINVAL;
}
/*
* Initialize message parameters
*/
error = nss_nlsock_msg_init(sock, cm, data, msg);
if (error) {
nss_nlsock_log_error("%d:failed to initialize message structure (family:%s, error:%d)\n",
pid, sock->family_name, error);
nss_nlsock_deref(sock);
nlmsg_free(msg);
sock->is_avail = true;
return error;
}
/*
* If has_resp is true and msg is sent to FW, then there will be two
* netlink messages coming from kernel - FW response and ACK
* If msg fails in netlink, then error will be returned from kernel.
* If has_resp is false, then there is only one netlink message
* coming from kernel: either ACK or error
* In case firmware response is sent before nl_recvmsgs is invoked,
* the response will be queued until the listener is available.
*/
error = nl_send_sync(sock->nl_sk, msg);
if (error < 0) {
nss_nlsock_log_error("%d:failed to send (family:%s, error:%d)\n", pid, sock->family_name, error);
nss_nlsock_deref(sock);
sock->is_avail = true;
return error;
}
if (has_resp) {
nl_recvmsgs(sock->nl_sk, sock->nl_cb);
}
nss_nlsock_deref(sock);
sock->is_avail = true;
return 0;
}
/*
* nss_nlsock_listen()
* listen for async events on the socket
*/
int nss_nlsock_listen(struct nss_nlsock_ctx *sock)
{
int error;
assert(sock->ref_cnt > 0);
/*
* return -EBUSY if the socket is currently unavailable for listening
*/
if (!sock->is_avail) {
return -EBUSY;
}
/*
* To indicate the socket is unavailable until the current thread completes the send/listen.
* This is to prevent other threads from simultaneous send/listen.
*/
sock->is_avail = false;
/*
* Create an async thread for clearing the pending resp on the socket asynchronously
*/
error = pthread_create(&sock->thread, NULL, nss_nlsock_listen_callback, sock);
if (error) {
nss_nlsock_log_error("%d:failed to create sync thread for family(%s)\n", sock->pid, sock->family_name);
return error;
}
return 0;
}
/*
* nss_nlsock_close()
* close the allocated socket and all associated memory
*/
void nss_nlsock_close(struct nss_nlsock_ctx *sock)
{
assert(sock);
assert(sock->nl_sk);
assert(sock->ref_cnt > 0);
/*
* put the reference down for the socket
*/
nss_nlsock_deref(sock);
/*
* wait for the async thread to complete
*/
if (sock->thread) {
pthread_join(sock->thread, NULL);
sock->thread = NULL;
}
}
/*
* nss_nlsock_open()
* open a socket for unicast communication with the generic netlink framework
*/
int nss_nlsock_open(struct nss_nlsock_ctx *sock, nl_recvmsg_msg_cb_t cb)
{
int error = 0;
assert(sock);
error = nss_nlsock_init(sock, cb);
if (error) {
nss_nlsock_log_error("%d:failed to initialize socket(%s)\n", sock->pid, sock->family_name);
return error;
}
/*
* Connect the socket with the netlink bus
*/
if (genl_connect(sock->nl_sk)) {
nss_nlsock_log_error("%d:failed to connect socket for family(%s)\n", sock->pid, sock->family_name);
error = -EBUSY;
goto free_sock;
}
/*
* resolve the family
*/
sock->family_id = genl_ctrl_resolve(sock->nl_sk, sock->family_name);
if (sock->family_id <= 0) {
nss_nlsock_log_error("%d:failed to resolve family(%s)\n", sock->pid, sock->family_name);
error = -EINVAL;
goto free_sock;
}
return 0;
free_sock:
nss_nlsock_deref(sock);
return error;
}

View File

@ -0,0 +1,35 @@
--- a/src/nssinfo.c
+++ b/src/nssinfo.c
@@ -160,7 +160,7 @@ void nssinfo_print_all(char *node, char
break;
}
- nssinfo_stats_print("%s_%-*s = %-20llu %-s\n",
+ nssinfo_stats_print("%s_%-*s = %-20lu %-s\n",
node, maxlen, stats_info[i].stats_name, stats_val[i], type);
}
}
@@ -277,12 +277,12 @@ void nssinfo_node_stats_destroy(pthread_
static char* nssinfo_add_comma(uint64_t num)
{
if (num < 1000) {
- snprintf(buf, sizeof(buf), "%llu", num);
+ snprintf(buf, sizeof(buf), "%lu", num);
return buf;
}
nssinfo_add_comma(num/1000);
- snprintf(buf + strlen(buf), sizeof(buf[NSSINFO_STR_LEN] + strlen(buf)), ",%03llu", num % 1000);
+ snprintf(buf + strlen(buf), sizeof(buf[NSSINFO_STR_LEN] + strlen(buf)), ",%03lu", num % 1000);
return buf;
}
@@ -293,7 +293,7 @@ static char* nssinfo_add_comma(uint64_t
static char* nssinfo_add_suffix(uint64_t num)
{
if (num < 1000) {
- snprintf(buf, sizeof(buf), "%llu", num);
+ snprintf(buf, sizeof(buf), "%lu", num);
return buf;
}

View File

@ -0,0 +1,32 @@
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,28 @@
+# Define the build directories based on flags
+DIRS-y :=
+DIRS-$(BUILD_LIBNSS) += lib
+DIRS-$(BUILD_NSSINFO) += nssinfo
+DIRS-$(BUILD_NETFN) += netfn
+DIRS-$(BUILD_LIBPPE) += ppe/ppenl_lib
+DIRS-$(BUILD_PPECFG) += ppe/ppecfg
+
+# Main targets
+all: $(DIRS-y)
+ @echo "Build complete"
+
+# Pattern rule to build each directory
+$(DIRS-y):
+ $(MAKE) -C $@
+
+nssinfo: lib
+
+ppe/ppecfg: ppe/ppenl_lib
+
+clean:
+ @for dir in $(DIRS-y); do \
+ if [ -d $$dir ]; then \
+ $(MAKE) -C $$dir clean; \
+ fi \
+ done
+
+.PHONY: all clean $(DIRS-y)
\ No newline at end of file

View File

@ -0,0 +1,24 @@
--- a/lib/nss_nludp_st_api.c
+++ b/lib/nss_nludp_st_api.c
@@ -1,12 +1,9 @@
/*
**************************************************************************
* Copyright (c) 2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
- *
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
- *
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
@@ -52,8 +49,6 @@ int nss_nludp_st_sock_cb(struct nl_msg *
case NSS_UDP_ST_STOP_MSG:
case NSS_UDP_ST_TX_CREATE_MSG:
case NSS_UDP_ST_TX_DESTROY_MSG:
- case NSS_UDP_ST_TX_UPDATE_RATE_MSG:
- case NSS_UDP_ST_RX_MODE_SET_MSG:
case NSS_UDP_ST_RESET_STATS_MSG:
{
void *cb_data = nss_nlcmn_get_cb_data(&rule->cm, sock->family_id);

View File

@ -0,0 +1,29 @@
--- a/nssinfo/src/nssinfo.c
+++ b/nssinfo/src/nssinfo.c
@@ -176,8 +176,6 @@ void nssinfo_print_all(char *node, char
}
}
nssinfo_stats_print("\n");
-
- return;
}
/*
@@ -278,7 +276,6 @@ void nssinfo_node_stats_destroy(pthread_
p = next;
}
- return;
}
/*
@@ -293,7 +290,8 @@ static char* nssinfo_add_comma(uint64_t
}
nssinfo_add_comma(num/1000);
- snprintf(buf + strlen(buf), sizeof(buf + strlen(buf)), ",%03lu", num % 1000);
+ snprintf(buf + strlen(buf), sizeof(buf[NSSINFO_STR_LEN] + strlen(buf)), ",%03lu",
+ num % 1000);
return buf;
}

View File

@ -0,0 +1,48 @@
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -4,13 +4,44 @@ OBJPATH = obj
BINARY = $(OBJPATH)/libnl-nss.so
SOURCES = $(wildcard $(SRCPATH)/*.c)
-OBJECTS = $(SOURCES:$(SRCPATH)/%.c=$(OBJPATH)/%.o)
HEADERS = $(wildcard $(SRCPATH)/*.h)
INCLUDE += -I./include
EXTRA_CFLAGS = -Wall -Werror -fPIC -Wl,-z,relro -Wl,-z,now
EXTRA_LDFLAGS = -pie -Wl,-z,relro -Wl,-z,now
+# Base objects that are always needed
+BASE_OBJS = ipv4_api ipv6_api mcast_api sock
+
+# Feature objects that depend on flags
+FEATURE_OBJS =
+
+ifeq ($(capwap),y)
+ FEATURE_OBJS += capwap_api
+endif
+ifeq ($(dtls),y)
+ FEATURE_OBJS += dtls_api
+endif
+ifeq ($(gre_redir),y)
+ FEATURE_OBJS += gre_redir_api
+endif
+ifeq ($(ipsec),y)
+ FEATURE_OBJS += ipsec_api
+endif
+ifeq ($(qrfs),y)
+ FEATURE_OBJS += qrfs_api
+endif
+ifeq ($(udp_st),y)
+ FEATURE_OBJS += udp_st_api
+endif
+
+# All objects to build
+OBJS = $(BASE_OBJS) $(FEATURE_OBJS)
+
+# Convert to actual object file paths
+OBJECTS = $(patsubst %,$(OBJPATH)/nss_nl%.o,$(OBJS))
+HEADERS = $(wildcard $(SRCPATH)/*.h)
+
all: release
release: $(BINARY)

View File

@ -0,0 +1,40 @@
--- a/lib/nss_nlsock.c
+++ b/lib/nss_nlsock.c
@@ -379,7 +379,7 @@ int nss_nlsock_send(struct nss_nlsock_ct
* In case firmware response is sent before nl_recvmsgs is invoked,
* the response will be queued until the listener is available.
*/
- error = nl_send_sync(sock->nl_sk, msg);
+ error = nl_send_auto_complete(sock->nl_sk, msg);
if (error < 0) {
nss_nlsock_log_error("%d:failed to send (family:%s, error:%d)\n", pid, sock->family_name, error);
nss_nlsock_deref(sock);
@@ -387,6 +387,17 @@ int nss_nlsock_send(struct nss_nlsock_ct
return error;
}
+ /*
+ * Wait for ACK response from netlink
+ */
+ /* error = nl_wait_for_ack(sock->nl_sk); */
+ /* if (error < 0) { */
+ /* nss_nlsock_log_error("%d:failed to get ACK (family:%s, error:%d)\n", pid, sock->family_name, error); */
+ /* nss_nlsock_deref(sock); */
+ /* sock->is_avail = true; */
+ /* return error; */
+ /* } */
+
if (has_resp) {
nl_recvmsgs(sock->nl_sk, sock->nl_cb);
}
--- a/nssinfo/Makefile
+++ b/nssinfo/Makefile
@@ -10,7 +10,7 @@ OBJECTS = $(SOURCES:$(SRCDIR)/src/%.c=$(
INCLUDE += -I../lib/include
EXTRA_CFLAGS = -Wall -Werror -UENABLE_DEBUG
-LDFLAGS = -lnl-genl-3 -lnl-nss -lncurses -lglib-2.0
+LDFLAGS = -lnl-nss -lnl-tiny -lncurses
LDLIBS = -L../lib/obj
all: release

View File

@ -0,0 +1,303 @@
--- a/lib/nss_nlmcast_api.c
+++ b/lib/nss_nlmcast_api.c
@@ -94,7 +94,7 @@ int nss_nlmcast_sock_join_grp(struct nss
error = nss_nlsock_join_grp(&ctx->sock, grp_name);
if (error) {
- nss_nlsock_log_error("Unable to subscribe for mcast group, error(%d)\n", error);
+ /* nss_nlsock_log_error("Unable to subscribe for mcast group, error(%d)\n", error); */
return error;
}
--- a/lib/nss_nlsock.c
+++ b/lib/nss_nlsock.c
@@ -221,15 +221,23 @@ int nss_nlsock_leave_grp(struct nss_nlso
{
int error;
- assert(sock->ref_cnt > 0);
+ /* Skip if socket is invalid */
+ if (!sock || !sock->nl_sk) {
+ return 0;
+ }
+
+ /* Safety check: Don't assert on ref_cnt */
+ if (sock->ref_cnt <= 0) {
+ return 0;
+ }
/*
* Resolve the group
*/
sock->grp_id = genl_ctrl_resolve_grp(sock->nl_sk, sock->family_name, grp_name);
if (sock->grp_id < 0) {
- nss_nlsock_log_error("failed to resolve group(%s)\n", grp_name);
- return -EINVAL;
+ /* Don't report error, just return success since we can't leave a group that doesn't exist */
+ return 0;
}
/*
@@ -259,7 +267,7 @@ int nss_nlsock_join_grp(struct nss_nlsoc
*/
sock->grp_id = genl_ctrl_resolve_grp(sock->nl_sk, sock->family_name, grp_name);
if (sock->grp_id < 0) {
- nss_nlsock_log_error("failed to resolve group(%s)\n", grp_name);
+ /* nss_nlsock_log_error("failed to resolve group(%s)\n", grp_name); */
return -EINVAL;
}
--- a/nssinfo/src/nssinfo.c
+++ b/nssinfo/src/nssinfo.c
@@ -20,12 +20,25 @@
#include <signal.h>
#include "nssinfo.h"
+/* Keyboard control definitions */
+#define KEY_QUIT 'q'
+// stop fucking using KEY_HELP as it conflicts with the help key in ncurses
+#define KEY_HELP_ 'h'
+#define KEY_VERBOSE 'v'
+#define KEY_LIST_STATS '?'
+
static pthread_t nssinfo_display_thread; /* Display statistics thread */
static char buf[NSSINFO_STR_LEN]; /* Formatted stats buffer */
bool display_all_stats; /* Display all stats per sub-system */
int invalid_input; /* Identify invalid input */
FILE *output_file; /* Output file pointer */
FILE *flow_file; /* Flow file pointer */
+static volatile bool quit_requested = false; /* Flag to indicate quit request */
+
+/* Forward declarations for new functions */
+static void nssinfo_display_help(void);
+static void nssinfo_list_available_stats(void);
+static void nssinfo_handle_keyboard_input(void);
/* Array of pointers to node stats */
struct node *nodes[NSS_MAX_CORES][NSS_MAX_NET_INTERFACES];
@@ -350,6 +363,16 @@ static void *nssinfo_stats_display(void
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
for (;;) {
+ /* Check for keyboard input */
+ if (!output_file) {
+ nssinfo_handle_keyboard_input();
+
+ /* Check if quit was requested */
+ if (quit_requested) {
+ break;
+ }
+ }
+
nssinfo_stats_print("\t\t\t%s\n", mesg);
/*
@@ -505,6 +528,8 @@ done:
invalid_input = 0;
sleep(arguments.rate);
}
+
+ return NULL;
}
/*
@@ -607,11 +632,16 @@ static void nssinfo_notify_callback(int
if (cmd < NSS_NLCMN_SUBSYS_MAX && nssinfo_subsystem_array[cmd].is_inited) {
nssinfo_subsystem_array[cmd].notify(data);
} else {
- nssinfo_error("Unknown message type %d\n", cmd);
+ /* Silently ignore unknown message types */
+ if (arguments.verbose) {
+ nssinfo_warn("Ignoring unknown message type %d\n", cmd);
+ }
}
}
/*
+ * nssinfo_deinit()
+ * Release all resources
*/
static void nssinfo_deinit(struct nss_nlmcast_ctx *ctx)
{
@@ -639,10 +669,11 @@ static void nssinfo_deinit(struct nss_nl
/*
* Release resources used by each subsystem
+ * Only deinitialize subsystems that were successfully initialized
*/
for (i = 0; i < NSS_NLCMN_SUBSYS_MAX; i++) {
- deinit = nssinfo_subsystem_array[i].deinit;
- if (deinit) {
+ if (nssinfo_subsystem_array[i].is_inited && nssinfo_subsystem_array[i].deinit) {
+ deinit = nssinfo_subsystem_array[i].deinit;
deinit(ctx);
}
}
@@ -671,16 +702,25 @@ int nssinfo_init(void)
/*
* Initialize all the subsystems and subscribe for mcast groups.
+ * Don't exit on subsystem initialization failures - these are expected
+ * if certain kernel modules aren't loaded.
*/
for (i = 0; i < NSS_NLCMN_SUBSYS_MAX; i++) {
init = nssinfo_subsystem_array[i].init;
if (init) {
error = init(&ctx);
if (error) {
- nssinfo_error("%s init failed, error(%d)\n", nssinfo_subsystem_array[i].subsystem_name, error);
+ /* Mark as not initialized so we won't try to use it later */
+ nssinfo_subsystem_array[i].is_inited = 0;
+
+ /* Only log warnings in verbose mode */
+ if (arguments.verbose) {
+ nssinfo_warn("%s init failed, error(%d) - subsystem may not be available\n",
+ nssinfo_subsystem_array[i].subsystem_name, error);
+ }
+ }
}
}
- }
/*
* Listen for MCAST events from kernel.
@@ -700,7 +740,7 @@ int nssinfo_init(void)
}
/*
- * Install CTRL-C handler
+ * Install CTRL-C handler and other signal handlers
*/
struct sigaction new_action;
new_action.sa_handler = nssinfo_termination_handler;
@@ -721,3 +761,91 @@ end:
nssinfo_deinit(&ctx);
return error;
}
+
+/*
+ * nssinfo_display_help()
+ * Display help information for keyboard controls
+ */
+static void nssinfo_display_help(void)
+{
+ clear();
+ mvprintw(0, 0, "NSSINFO Keyboard Controls Help");
+ mvprintw(2, 0, "q - Quit the application");
+ mvprintw(3, 0, "h - Display this help screen");
+ mvprintw(4, 0, "v - Toggle verbose mode");
+ mvprintw(5, 0, "? - List available statistics");
+ mvprintw(7, 0, "Press any key to return to stats display...");
+ refresh();
+
+ /* Wait for key press before returning to stats display */
+ nodelay(stdscr, FALSE);
+ getch();
+ nodelay(stdscr, TRUE);
+ clear();
+}
+
+/*
+ * nssinfo_list_available_stats()
+ * Display list of available statistics modules
+ */
+static void nssinfo_list_available_stats(void)
+{
+ int i, row = 0;
+
+ clear();
+ mvprintw(row++, 0, "Available Statistics Modules:");
+ row++;
+
+ for (i = 0; i < NSS_NLCMN_SUBSYS_MAX; i++) {
+ if (nssinfo_subsystem_array[i].is_inited) {
+ mvprintw(row++, 2, "- %s", nssinfo_subsystem_array[i].subsystem_name);
+ }
+ }
+
+ mvprintw(row + 2, 0, "Press any key to return to stats display...");
+ refresh();
+
+ /* Wait for key press before returning to stats display */
+ nodelay(stdscr, FALSE);
+ getch();
+ nodelay(stdscr, TRUE);
+ clear();
+}
+
+/*
+ * nssinfo_handle_keyboard_input()
+ * Process keyboard input for interactive controls
+ */
+static void nssinfo_handle_keyboard_input(void)
+{
+ int ch = getch();
+
+ if (ch == ERR) {
+ /* No input available */
+ return;
+ }
+
+ switch (ch) {
+ case KEY_QUIT:
+ /* Set quit flag to exit application gracefully */
+ quit_requested = true;
+ raise(SIGINT); /* Signal to terminate */
+ break;
+
+ case KEY_HELP_:
+ nssinfo_display_help();
+ break;
+
+ case KEY_VERBOSE:
+ /* Toggle verbose mode */
+ arguments.verbose = !arguments.verbose;
+ break;
+
+ case KEY_LIST_STATS:
+ nssinfo_list_available_stats();
+ break;
+
+ default:
+ break;
+ }
+}
--- a/nssinfo/src/nssinfo_lso_rx.c
+++ b/nssinfo/src/nssinfo_lso_rx.c
@@ -43,7 +43,7 @@ static void nssinfo_lso_rx_stats_display
lso_rx_node = nodes[core][NSS_LSO_RX_INTERFACE];
if (!lso_rx_node) {
pthread_mutex_unlock(&lso_rx_lock);
- nssinfo_error("%s is not running on the NPU\n", input);
+ /* nssinfo_error("%s is not running on the NPU\n", input); */
return;
}
--- a/nssinfo/Makefile
+++ b/nssinfo/Makefile
@@ -10,8 +10,8 @@ OBJECTS = $(SOURCES:$(SRCDIR)/src/%.c=$(
INCLUDE += -I../lib/include
EXTRA_CFLAGS = -Wall -Werror -UENABLE_DEBUG
-LDFLAGS = -lnl-nss -lnl-tiny -lncurses
-LDLIBS = -L../lib/obj
+LDFLAGS = -lnl-tiny -lncurses
+LDLIBS = -L../lib/obj -Wl,-rpath,\$$ORIGIN/../lib:\$$ORIGIN/../../lib/obj -lnl-nss
all: release
@@ -20,12 +20,12 @@ release: $(BINARY)
$(OBJPATH)/%.o: $(SRCPATH)/%.c $(HEADERS)
$(MKDIR)
@echo [CC] $@
- @$(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -o $@ $<
+ $(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -o $@ $<
$(BINARY): $(OBJECTS)
@echo $(BINARY)
@echo [LD] $@
- @$(CC) -o $@ $^ $(LDFLAGS) $(LDLIBS)
+ $(CC) -o $@ $^ $(LDFLAGS) $(LDLIBS)
clean:
@echo [Clean]
@rm -f $(OBJECTS)

68
qca-mcs/Makefile Normal file
View File

@ -0,0 +1,68 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=qca-mcs
PKG_RELEASE:=2
PKG_SOURCE_URL:=https://git.codelinaro.org/clo/qsdk/oss/lklm/qca-mcs.git
PKG_SOURCE_DATE:=2024-09-04
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=e1c59f7
PKG_MIRROR_HASH:=a88bc7747f5564acc574f252b63fdf0b401254bf6584e0cbbac44e171dcddcb6
QSDK_VERSION:=12.5
PKG_VERSION:=$(QSDK_VERSION).$(subst -,.,$(PKG_SOURCE_DATE))~$(PKG_SOURCE_VERSION)
PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/package.mk
define KernelPackage/qca-mcs
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Support
URL:=http://www.qca.qualcomm.com
MAINTAINER:=Qualcomm Atheros, Inc.
TITLE:=QCA Multicast Snooping Support
DEPENDS:=+@KERNEL_IPV6_MROUTE +@KERNEL_IP_MROUTE
KCONFIG:=CONFIG_NETFILTER=y
FILES:=$(PKG_BUILD_DIR)/qca-mcs.ko
AUTOLOAD:=$(call AutoLoad,41,qca-mcs)
endef
define KernelPackage/qca-mcs/Description
This package installs the IGMP/MLD Snooping Module
endef
QCA_MC_SNOOPING_HEADERS= \
$(PKG_BUILD_DIR)/mc_api.h \
$(PKG_BUILD_DIR)/mc_ecm.h \
define Build/InstallDev
mkdir -p $(1)/usr/include/qca-mcs
$(foreach header_file,$(QCA_MC_SNOOPING_HEADERS), $(CP) $(header_file) $(1)/usr/include/qca-mcs;)
$(foreach header_file,$(QCA_MC_SNOOPING_HEADERS), $(CP) $(header_file) $(1)/usr/include/;)
endef
EXTRA_CFLAGS+=-Wno-implicit-fallthrough
QCA_MC_SNOOPING_MAKE_OPTS:= \
$(KERNEL_MAKE_FLAGS) \
CONFIG_SUPPORT_MLD=y \
MDIR=$(PKG_BUILD_DIR) \
KBUILDPATH=$(LINUX_DIR) \
KERNELPATH=$(LINUX_SRC_DIR) \
KERNELRELEASE=$(LINUX_RELEASE)
define Build/Compile
+$(MAKE) -C $(LINUX_DIR) \
$(KERNEL_MAKE_FLAGS) \
$(PKG_JOBS) \
KBUILDPATH=$(LINUX_DIR) \
$(PKG_MAKE_FLAGS) \
M=$(PKG_BUILD_DIR) \
EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \
$(strip $(QCA_MC_SNOOPING_MAKE_OPTS)) \
modules
endef
$(eval $(call KernelPackage,qca-mcs))

View File

@ -0,0 +1,18 @@
--- a/mc_snooping.c
+++ b/mc_snooping.c
@@ -3105,7 +3105,6 @@ static void mc_mdb_cleanup(unsigned long
os_hlist_for_each_entry_rcu(mdb, mdbh, &mc->hash[i], hlist) {
struct mc_port_group *pg;
struct hlist_node *pgh;
- struct net_device *port;
unsigned long expire_time = mc->membership_interval;
if (hlist_empty(&mdb->pslist)) {
@@ -3140,7 +3139,6 @@ static void mc_mdb_cleanup(unsigned long
else if (time_before(this_timer, next_timer))
next_timer = this_timer;
}
- port = pg->port;
}
}
}

View File

@ -0,0 +1,14 @@
--- a/mc_osdep.h
+++ b/mc_osdep.h
@@ -24,7 +24,11 @@
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0))
static inline int os_br_pass_frame_up(struct sk_buff *skb)
{
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 29))
+ return br_pass_frame_up(skb, false);
+#else
return br_pass_frame_up(skb);
+#endif
}
#else
static inline int os_br_pass_frame_up(struct sk_buff *skb)

View File

@ -0,0 +1,11 @@
--- a/mc_ovs.h
+++ b/mc_ovs.h
@@ -14,7 +14,7 @@
*/
#ifndef _MC_OVS_H_
-#define _MC_OVS_H
+#define _MC_OVS_H_
int mc_ovs_init(void);
void mc_ovs_exit(void);

View File

@ -0,0 +1,120 @@
--- a/mc_forward.c
+++ b/mc_forward.c
@@ -29,6 +29,9 @@
#include "mc_snooping.h"
#include "mc_osdep.h"
+int mc_forward_init(void) __maybe_unused;
+void mc_forward_exit(void) __maybe_unused;
+
static void mc_retag(void *iph, __be16 etype, __be32 dscp)
{
__be32 _dscp = MC_DSCP(dscp);
--- a/mc_netfilter.c
+++ b/mc_netfilter.c
@@ -26,6 +26,7 @@
#include "mc_private.h"
#include "mc_api.h"
#include "mc_osdep.h"
+#include "mc_netfilter.h"
/* mc_br_port_get
* get bridge port by ifindex
@@ -49,15 +50,15 @@ static struct net_bridge_port *mc_br_por
/* mc_pre_routing_hook
* prerouting hook
*/
-static unsigned int mc_pre_routing_hook(void *priv,
+unsigned int mc_pre_routing_hook(void *priv,
struct sk_buff *skb,
const struct nf_hook_state *state)
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0))
-static unsigned int mc_pre_routing_hook(const struct nf_hook_ops *ops, struct sk_buff *skb,
+unsigned int mc_pre_routing_hook(const struct nf_hook_ops *ops, struct sk_buff *skb,
const struct net_device *in, const struct net_device *out,
int(*okfn)(struct sk_buff *))
#else
-static unsigned int mc_pre_routing_hook(unsigned int hooknum, struct sk_buff *skb,
+unsigned int mc_pre_routing_hook(unsigned int hooknum, struct sk_buff *skb,
const struct net_device *in, const struct net_device *out,
int(*okfn)(struct sk_buff *))
#endif
@@ -233,15 +234,15 @@ static bool mc_is_report_or_leave(struct
/* mc_forward_hook
* forward hook to the linux kernel
*/
-static unsigned int mc_forward_hook(void *priv,
+unsigned int mc_forward_hook(void *priv,
struct sk_buff *skb,
const struct nf_hook_state *state)
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0))
-static unsigned int mc_forward_hook(const struct nf_hook_ops *ops, struct sk_buff *skb,
+unsigned int mc_forward_hook(const struct nf_hook_ops *ops, struct sk_buff *skb,
const struct net_device *in, const struct net_device *out,
int(*okfn)(struct sk_buff *))
#else
-static unsigned int mc_forward_hook(unsigned int hooknum, struct sk_buff *skb,
+unsigned int mc_forward_hook(unsigned int hooknum, struct sk_buff *skb,
const struct net_device *in, const struct net_device *out,
int(*okfn)(struct sk_buff *))
#endif
--- a/mc_netfilter.h
+++ b/mc_netfilter.h
@@ -23,7 +23,15 @@ void mc_netfilter_exit(void);
#include <linux/netfilter.h>
#include <linux/netdevice.h>
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0))
+unsigned int mc_pre_routing_hook(void *priv,
+ struct sk_buff *skb,
+ const struct nf_hook_state *state);
+
+unsigned int mc_forward_hook(void *priv,
+ struct sk_buff *skb,
+ const struct nf_hook_state *state);
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0))
unsigned int mc_pre_routing_hook(const struct nf_hook_ops *ops, struct sk_buff *skb,
const struct net_device *in, const struct net_device *out,
int(*okfn)(struct sk_buff *));
--- a/mc_snooping.c
+++ b/mc_snooping.c
@@ -15,6 +15,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <linux/version.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/spinlock.h>
@@ -28,7 +29,11 @@
#include <linux/etherdevice.h>
#include <linux/rculist.h>
#include <linux/timer.h>
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 12, 0))
+#include <linux/unaligned.h>
+#else
#include <asm/unaligned.h>
+#endif
#include <asm/atomic.h>
#include <linux/random.h>
#include <net/ip.h>
@@ -3240,7 +3245,6 @@ static void mc_acl_table_init(struct mc_
mc->mld_acl.pattern_count = 4;
#endif
- return;
}
/* mc_event_delay
--- a/mc_snooping.h
+++ b/mc_snooping.h
@@ -44,6 +44,8 @@ void mc_detach(struct net_device *dev);
int mc_has_more_instance(void);
+int mc_proc_create_snooper_entry(void);
+
extern void mc_nbp_change(struct mc_struct *mc, struct net_device *dev, int event);
extern void mc_fdb_change(__u8 *mac, int change);

100
qca-nss-cfi/Makefile Normal file
View File

@ -0,0 +1,100 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=qca-nss-cfi
PKG_RELEASE:=3
PKG_SOURCE_URL:=https://git.codelinaro.org/clo/qsdk/oss/lklm/nss-cfi.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_DATE:=2025-04-04
PKG_SOURCE_VERSION:=ff11dae
PKG_MIRROR_HASH:=050a9c7f4177099bd60168b68ddc9eff5d62b62992858c89d514b428da93cba2
QSDK_VERSION:=12.5
PKG_VERSION:=$(QSDK_VERSION).$(subst -,.,$(PKG_SOURCE_DATE))~$(PKG_SOURCE_VERSION)
PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/package.mk
ifneq (, $(findstring $(CONFIG_TARGET_SUBTARGET), "ipq807x" "ipq60xx" "ipq50xx"))
# 4.4/5.4 + ipq807x/ipq60xx/ipq50xx
CFI_OCF_DIR:=ocf/v2.0
CFI_CRYPTOAPI_DIR:=cryptoapi/v2.0
else
# 4.4 Kernel + ipq806x
CFI_CRYPTOAPI_DIR:=cryptoapi/v1.1
CFI_OCF_DIR:=ocf/v1.0
CFI_IPSEC_DIR:=ipsec/v1.0
endif
define KernelPackage/qca-nss-cfi-cryptoapi
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Cryptographic API modules
DEPENDS:=@TARGET_qualcommax +kmod-qca-nss-crypto +kmod-crypto-authenc @BROKEN
TITLE:=Kernel driver for NSS cfi
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-cfi-cryptoapi),)
FILES:=$(PKG_BUILD_DIR)/$(CFI_CRYPTOAPI_DIR)/qca-nss-cfi-cryptoapi.ko
AUTOLOAD:=$(call AutoLoad,59,qca-nss-cfi-cryptoapi)
endif
endef
define KernelPackage/qca-nss-cfi-cryptoapi/Description
This package contains a NSS cfi driver for QCA chipset
endef
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-cfi-cryptoapi),)
ifeq ($(CONFIG_TARGET_BOARD), "qualcommax")
SOC:=$(CONFIG_TARGET_SUBTARGET)
endif
EXTRA_CFLAGS+= \
-DCONFIG_NSS_DEBUG_LEVEL=4 \
-I$(LINUX_DIR)/crypto/ocf \
-I$(STAGING_DIR)/usr/include/qca-nss-crypto \
-I$(STAGING_DIR)/usr/include/crypto \
-I$(STAGING_DIR)/usr/include/qca-nss-drv
ifneq (, $(findstring $(CONFIG_TARGET_SUBTARGET), "ipq807x" "ipq60xx" "ipq50xx"))
EXTRA_CFLAGS+= -I$(STAGING_DIR)/usr/include/qca-nss-clients
endif
MAKE_OPTS+= \
cryptoapi=y \
NSS_CRYPTOAPI_ABLK=n \
NSS_CRYPTOAPI_SKCIPHER=y
MAKE_OPTS+= \
CFI_CRYPTOAPI_DIR=$(CFI_CRYPTOAPI_DIR) \
CFI_IPSEC_DIR=$(CFI_IPSEC_DIR) \
SoC=$(SOC)
define Build/Compile
+$(KERNEL_MAKE) \
M="$(PKG_BUILD_DIR)" \
EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \
$(strip $(MAKE_OPTS)) \
$(PKG_JOBS) \
modules
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include/qca-nss-cfi
$(CP) $(PKG_BUILD_DIR)/$(CFI_CRYPTOAPI_DIR)/../exports/* $(1)/usr/include/qca-nss-cfi
$(CP) $(PKG_BUILD_DIR)/include/* $(1)/usr/include/qca-nss-cfi
endef
else
define Build/Compile
:
endef
define Build/Install
:
endef
endif
$(eval $(call KernelPackage,qca-nss-cfi-cryptoapi))

View File

@ -0,0 +1,28 @@
From 8db77add1a794bdee8eef0a351e40bf1cdf6dfa9 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Sun, 22 Jan 2023 22:09:51 +0100
Subject: [PATCH 4/5] cryptoapi: v2.0: aead: add downstream
crypto_tfm_alg_flags
crypto_tfm_alg_flags newer made it upstream, but as a temporary stopgap
until a better solution is figured out lets add it.
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
cryptoapi/v2.0/nss_cryptoapi_aead.c | 5 +++++
1 file changed, 5 insertions(+)
--- a/cryptoapi/v2.0/nss_cryptoapi_aead.c
+++ b/cryptoapi/v2.0/nss_cryptoapi_aead.c
@@ -61,6 +61,11 @@
#include <nss_cryptoapi.h>
#include "nss_cryptoapi_private.h"
+static inline u32 crypto_tfm_alg_flags(struct crypto_tfm *tfm)
+{
+ return tfm->__crt_alg->cra_flags & ~CRYPTO_ALG_TYPE_MASK;
+}
+
/*
* nss_cryptoapi_aead_ctx2session()
* Cryptoapi function to get the session ID for an AEAD

View File

@ -0,0 +1,26 @@
--- a/cryptoapi/v2.0/nss_cryptoapi_aead.c
+++ b/cryptoapi/v2.0/nss_cryptoapi_aead.c
@@ -97,9 +97,9 @@ int nss_cryptoapi_aead_init(struct crypt
bool need_fallback;
BUG_ON(!ctx);
- NSS_CRYPTOAPI_SET_MAGIC(ctx);
memset(ctx, 0, sizeof(struct nss_cryptoapi_ctx));
+ NSS_CRYPTOAPI_SET_MAGIC(ctx);
ctx->user = g_cryptoapi.user;
ctx->stats.init++;
--- a/cryptoapi/v2.0/nss_cryptoapi_skcipher.c
+++ b/cryptoapi/v2.0/nss_cryptoapi_skcipher.c
@@ -74,9 +74,9 @@ int nss_cryptoapi_skcipher_init(struct c
struct nss_cryptoapi_ctx *ctx = crypto_tfm_ctx(base);
BUG_ON(!ctx);
- NSS_CRYPTOAPI_SET_MAGIC(ctx);
memset(ctx, 0, sizeof(struct nss_cryptoapi_ctx));
+ NSS_CRYPTOAPI_SET_MAGIC(ctx);
ctx->user = g_cryptoapi.user;
ctx->stats.init++;

View File

@ -0,0 +1,134 @@
--- a/cryptoapi/v2.0/nss_cryptoapi.c
+++ b/cryptoapi/v2.0/nss_cryptoapi.c
@@ -38,6 +38,9 @@
#include <linux/completion.h>
#include <linux/of.h>
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 10, 0))
+#include <linux/vmalloc.h>
+#endif
#include <crypto/aes.h>
#include <crypto/des.h>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0))
@@ -1849,6 +1852,12 @@ static struct ahash_alg cryptoapi_ahash_
},
};
+/*-------------------------------------------------------------
+ * Prototypes
+ *-------------------------------------------------------------
+ */
+bool nss_cryptoapi_is_registered(void);
+
/*
* nss_cryptoapi_copy_reverse()
* Reverse copy
@@ -1946,7 +1955,7 @@ struct nss_cryptoapi_algo_info *nss_cryp
* nss_cryptoapi_cra_name_lookup()
* Lookup the associated algorithm in NSS for the given transformation by name
*/
-struct nss_cryptoapi_algo_info *nss_cryptoapi_cra_name_lookup(const char *cra_name)
+static struct nss_cryptoapi_algo_info *nss_cryptoapi_cra_name_lookup(const char *cra_name)
{
struct nss_cryptoapi_algo_info *info = g_algo_info;
int i;
@@ -2117,7 +2126,7 @@ skip_iv:
* nss_cryptoapi_ctx_stats_read()
* CryptoAPI context statistics read function
*/
-ssize_t nss_cryptoapi_ctx_stats_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos)
+static ssize_t nss_cryptoapi_ctx_stats_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos)
{
struct nss_cryptoapi_ctx *ctx = fp->private_data;
struct nss_cryptoapi_stats *stats = &ctx->stats;
@@ -2169,7 +2178,7 @@ ssize_t nss_cryptoapi_ctx_stats_read(str
* nss_cryptoapi_ctx_info_read()
* CryptoAPI context info read function
*/
-ssize_t nss_cryptoapi_ctx_info_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos)
+static ssize_t nss_cryptoapi_ctx_info_read(struct file *fp, char __user *ubuf, size_t sz, loff_t *ppos)
{
struct nss_cryptoapi_ctx *ctx = fp->private_data;
ssize_t max_buf_len;
@@ -2244,7 +2253,7 @@ void nss_cryptoapi_add_ctx2debugfs(struc
* nss_cryptoapi_attach_user()
* register crypto core with the cryptoapi CFI
*/
-void nss_cryptoapi_attach_user(void *app_data, struct nss_crypto_user *user)
+static void nss_cryptoapi_attach_user(void *app_data, struct nss_crypto_user *user)
{
struct skcipher_alg *skcipher = cryptoapi_skcipher_algs;
struct aead_alg *aead = cryptoapi_aead_algs;
@@ -2312,7 +2321,7 @@ void nss_cryptoapi_attach_user(void *app
* nss_cryptoapi_detach_user()
* Unregister crypto core with cryptoapi CFI layer
*/
-void nss_cryptoapi_detach_user(void *app_data, struct nss_crypto_user *user)
+static void nss_cryptoapi_detach_user(void *app_data, struct nss_crypto_user *user)
{
struct skcipher_alg *skcipher = cryptoapi_skcipher_algs;
struct aead_alg *aead = cryptoapi_aead_algs;
@@ -2378,7 +2387,7 @@ EXPORT_SYMBOL(nss_cryptoapi_is_registere
* nss_cryptoapi_init()
* Initializing crypto core layer
*/
-int nss_cryptoapi_init(void)
+static int nss_cryptoapi_init(void)
{
nss_cfi_info("module loaded %s\n", NSS_CFI_BUILD_ID);
@@ -2408,7 +2417,7 @@ int nss_cryptoapi_init(void)
* nss_cryptoapi_exit()
* De-Initialize cryptoapi CFI layer
*/
-void nss_cryptoapi_exit(void)
+static void nss_cryptoapi_exit(void)
{
if (g_cryptoapi.user)
nss_crypto_unregister_user(g_cryptoapi.user);
--- a/cryptoapi/v2.0/nss_cryptoapi_aead.c
+++ b/cryptoapi/v2.0/nss_cryptoapi_aead.c
@@ -386,7 +386,7 @@ int nss_cryptoapi_aead_setauthsize(struc
* nss_cryptoapi_aead_done()
* Cipher/Auth encrypt request completion callback function
*/
-void nss_cryptoapi_aead_done(void *app_data, struct nss_crypto_hdr *ch, uint8_t status)
+static void nss_cryptoapi_aead_done(void *app_data, struct nss_crypto_hdr *ch, uint8_t status)
{
struct aead_request *req = (struct aead_request *)app_data;
struct crypto_aead *aead = crypto_aead_reqtfm(req);
--- a/cryptoapi/v2.0/nss_cryptoapi_ahash.c
+++ b/cryptoapi/v2.0/nss_cryptoapi_ahash.c
@@ -87,6 +87,12 @@ extern struct nss_cryptoapi g_cryptoapi;
#endif /* NSS_CFI_DEBUG */
+/*-------------------------------------------------------------
+ * Prototype
+ *-------------------------------------------------------------
+ */
+int nss_cryptoapi_ahash_ctx2session(struct crypto_ahash *ahash, uint32_t *sid);
+
/*
* nss_cryptoapi_ahash_ctx2session()
* Cryptoapi function to get the session ID for an AHASH
@@ -234,7 +240,7 @@ int nss_cryptoapi_ahash_setkey(struct cr
* nss_cryptoapi_ahash_done()
* Hash request completion callback function
*/
-void nss_cryptoapi_ahash_done(void *app_data, struct nss_crypto_hdr *ch, uint8_t status)
+static void nss_cryptoapi_ahash_done(void *app_data, struct nss_crypto_hdr *ch, uint8_t status)
{
struct ahash_request *req = app_data;
struct nss_cryptoapi_ctx *ctx = crypto_tfm_ctx(req->base.tfm);
--- a/cryptoapi/v2.0/nss_cryptoapi_skcipher.c
+++ b/cryptoapi/v2.0/nss_cryptoapi_skcipher.c
@@ -201,7 +201,7 @@ int nss_cryptoapi_skcipher_setkey(struct
* nss_cryptoapi_skcipher_done()
* Cipher operation completion callback function
*/
-void nss_cryptoapi_skcipher_done(void *app_data, struct nss_crypto_hdr *ch, uint8_t status)
+static void nss_cryptoapi_skcipher_done(void *app_data, struct nss_crypto_hdr *ch, uint8_t status)
{
struct skcipher_request *req = app_data;
struct nss_cryptoapi_ctx *ctx = crypto_tfm_ctx(req->base.tfm);

55
qca-nss-clients/Config.in Normal file
View File

@ -0,0 +1,55 @@
config NSS_NLCAPWAP_ENABLE
bool
depends on PACKAGE_kmod-qca-nss-drv-netlink
default y if NSS_DRV_CAPWAP_ENABLE
help
NSS Netlink CAPWAP support. This is automatically
selected when NSS CAPWAP driver is enabled.
config NSS_NLDTLS_ENABLE
bool
depends on PACKAGE_kmod-qca-nss-drv-netlink
default y if NSS_DRV_DTLS_ENABLE
help
NSS Netlink DTLS support. This is automatically
selected when NSS DTLS driver is enabled.
config NSS_NLGRE_REDIR_ENABLE
bool
depends on PACKAGE_kmod-qca-nss-drv-netlink
default y if NSS_DRV_GRE_REDIR_ENABLE
help
NSS Netlink GRE Redirect support. This is automatically
selected when NSS GRE Redirect driver is enabled.
config NSS_NLIPSEC_ENABLE
bool
depends on PACKAGE_kmod-qca-nss-drv-netlink
default y if NSS_DRV_IPSEC_ENABLE
help
NSS Netlink IPsec support. This is automatically
selected when NSS IPsec driver is enabled.
config NSS_NLQRFS_ENABLE
bool
depends on PACKAGE_kmod-qca-nss-drv-netlink
default y if NSS_DRV_QRFS_ENABLE
help
NSS Netlink QRFS support. This is automatically
selected when NSS QRFS driver is enabled.
config NSS_NLUDP_ST_ENABLE
bool
depends on PACKAGE_kmod-qca-nss-drv-netlink
default y if NSS_DRV_UDP_ST_ENABLE
help
NSS Netlink UDP Speed Test support. This is automatically
selected when NSS UDP Speed Test driver is enabled.
config NSS_NLLSO_RX
bool
depends on PACKAGE_kmod-qca-nss-drv-netlink
default y if NSS_DRV_LSO_RX_ENABLE
help
NSS Netlink IP LSO RX support. This is automatically
selected when NSS IP LSO RX driver is enabled.

895
qca-nss-clients/Makefile Normal file
View File

@ -0,0 +1,895 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=qca-nss-clients
PKG_RELEASE:=8
PKG_SOURCE_URL:=https://git.codelinaro.org/clo/qsdk/oss/lklm/nss-clients.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_DATE:=2024-09-11
PKG_SOURCE_VERSION:=51be82d
PKG_MIRROR_HASH:=876c3898cb4723fccd4a1c870324724dd7c4061ac89ec88db2226fd749c18b38
QSDK_VERSION:=12.5
PKG_VERSION:=$(QSDK_VERSION).$(subst -,.,$(PKG_SOURCE_DATE))~$(PKG_SOURCE_VERSION)
PKG_BUILD_PARALLEL:=1
PKG_CONFIG_DEPENDS:=\
CONFIG_NSS_DRV_BRIDGE_ENABLE \
CONFIG_NSS_DRV_C2C_ENABLE \
CONFIG_NSS_DRV_CAPWAP_ENABLE \
CONFIG_NSS_DRV_CLMAP_ENABLE \
CONFIG_NSS_DRV_DTLS_ENABLE \
CONFIG_NSS_DRV_GRE_ENABLE \
CONFIG_NSS_DRV_GRE_REDIR_ENABLE \
CONFIG_NSS_DRV_IGS_ENABLE \
CONFIG_NSS_DRV_IPSEC_ENABLE \
CONFIG_NSS_DRV_IPV4_REASM_ENABLE \
CONFIG_NSS_DRV_IPV6_ENABLE \
CONFIG_NSS_DRV_IPV6_REASM_ENABLE \
CONFIG_NSS_DRV_L2TP_ENABLE \
CONFIG_NSS_DRV_LAG_ENABLE \
CONFIG_NSS_DRV_LSO_RX_ENABLE \
CONFIG_NSS_DRV_MAPT_ENABLE \
CONFIG_NSS_DRV_MATCH_ENABLE \
CONFIG_NSS_DRV_MIRROR_ENABLE \
CONFIG_NSS_DRV_OAM_ENABLE \
CONFIG_NSS_DRV_QVPN_ENABLE \
CONFIG_NSS_DRV_PPPOE_ENABLE \
CONFIG_NSS_DRV_PPTP_ENABLE \
CONFIG_NSS_DRV_PVXLAN_ENABLE \
CONFIG_NSS_DRV_QRFS_ENABLE \
CONFIG_NSS_DRV_RMNET_ENABLE \
CONFIG_NSS_DRV_SHAPER_ENABLE \
CONFIG_NSS_DRV_TLS_ENABLE \
CONFIG_NSS_DRV_TSTAMP_ENABLE \
CONFIG_NSS_DRV_TUN6RD_ENABLE \
CONFIG_NSS_DRV_TUNIPIP6_ENABLE \
CONFIG_NSS_DRV_VLAN_ENABLE \
CONFIG_NSS_DRV_VXLAN_ENABLE \
CONFIG_NSS_DRV_WIFIOFFLOAD_ENABLE \
CONFIG_NSS_DRV_WIFI_MESH_ENABLE \
CONFIG_NSS_DRV_WIFI_LEGACY_ENABLE \
CONFIG_NSS_FIRMWARE_VERSION_11_4
ifeq ($(CONFIG_NSS_FIRMWARE_VERSION_11_4),y)
PKG_SOURCE_DATE:=2021-08-17
PKG_SOURCE_VERSION:=c4049d1
PKG_MIRROR_HASH:=5346ff2a8a89f6d671543f22e13594343b27bf81e709f07af46ade03a7614900
PATCH_DIR:=$(CURDIR)/patches-11.4
QSDK_VERSION:=11.4.0.5
PKG_VERSION:=$(QSDK_VERSION).$(subst -,.,$(PKG_SOURCE_DATE))~$(PKG_SOURCE_VERSION)
endif
include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/package.mk
ifeq ($(CONFIG_TARGET_SUBTARGET), "ipq807x")
SOC="ipq807x_64"
subtarget:=$(CONFIG_TARGET_SUBTARGET)
else ifeq ($(CONFIG_TARGET_SUBTARGET), "ipq60xx")
SOC="ipq60xx_64"
subtarget:=$(CONFIG_TARGET_SUBTARGET)
else ifeq ($(CONFIG_TARGET_SUBTARGET), "ipq50xx")
SOC="ipq50xx_64"
subtarget:=$(CONFIG_TARGET_SUBTARGET)
else
SOC=$(CONFIG_TARGET_BOARD)
endif
ifneq (, $(findstring $(subtarget), "ipq807x" "ipq807x_64" "ipq60xx" "ipq60xx_64" "ipq50xx" "ipq50xx_64"))
# DTLS Manager v2.0 for Hawkeye/Cypress
DTLSMGR_DIR:=v2.0
# IPsec Manager v2.0 for Hawkeye/Cypress
IPSECMGR_DIR:=v2.0
# KLIPS plugin
# IPSECMGR_KLIPS:= $(PKG_BUILD_DIR)/ipsecmgr/$(IPSECMGR_DIR)/plugins/klips/qca-nss-ipsec-klips.ko
endif
define KernelPackage/qca-nss-drv-tun6rd
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Devices
TITLE:=NSS connection manager for 6rd tunnels
DEPENDS:=@(TARGET_qualcommax||TARGET_ipq806x) \
+kmod-qca-nss-drv \
+@NSS_DRV_TUN6RD_ENABLE \
+6rd \
+kmod-sit
FILES:=$(PKG_BUILD_DIR)/qca-nss-tun6rd.ko
AUTOLOAD:=$(call AutoLoad,60,qca-nss-tun6rd)
endef
define KernelPackage/qca-nss-drv-tun6rd/description
Kernel modules for NSS connection manager - Support for 6rd tunnel
endef
define KernelPackage/qca-nss-drv-dtlsmgr
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Devices
TITLE:=NSS connection manager for DTLS sessions
DEPENDS:=@(TARGET_qualcommax_ipq807x||TARGET_qualcommax_ipq60xx) \
+kmod-qca-nss-drv \
+@NSS_DRV_DTLS_ENABLE \
+kmod-qca-nss-cfi-cryptoapi \
@BROKEN
FILES:=$(PKG_BUILD_DIR)/dtls/$(DTLSMGR_DIR)/qca-nss-dtlsmgr.ko
endef
define KernelPackage/qca-nss-drv-dtls/description
Kernel modules for NSS connection manager - Support for DTLS sessions
endef
define KernelPackage/qca-nss-drv-tlsmgr
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Devices
TITLE:=NSS connection manager for TLS sessions
DEPENDS:=@(TARGET_qualcommax_ipq807x||TARGET_qualcommax_ipq60xx) \
+kmod-qca-nss-drv \
+@NSS_DRV_TLS_ENABLE \
+kmod-qca-nss-cfi-cryptoapi \
@BROKEN
FILES:=$(PKG_BUILD_DIR)/tls/qca-nss-tlsmgr.ko
endef
define KernelPackage/qca-nss-drv-tls/description
Kernel modules for NSS connection manager - Support for TLS sessions
endef
define KernelPackage/qca-nss-drv-l2tpv2
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Devices
TITLE:=NSS connection manager for L2TPv2 protocol
DEPENDS:=@(TARGET_qualcommax||TARGET_ipq806x) \
+kmod-qca-nss-drv \
+@NSS_DRV_L2TP_ENABLE \
+kmod-l2tp \
+kmod-ppp
FILES:=$(PKG_BUILD_DIR)/l2tp/l2tpv2/qca-nss-l2tpv2.ko
KCONFIG:=CONFIG_L2TP=y
AUTOLOAD:=$(call AutoLoad,51,qca-nss-l2tpv2)
endef
define KernelPackage/qca-nss-drv-l2tp/description
Kernel modules for NSS connection manager - Support for l2tp tunnel
endef
define KernelPackage/qca-nss-drv-pptp
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Devices
TITLE:=NSS connection manager for PPTP protocol
DEPENDS:=@(TARGET_qualcommax||TARGET_ipq806x) \
+kmod-qca-nss-drv \
+@NSS_DRV_PPTP_ENABLE \
+kmod-pptp
FILES:=$(PKG_BUILD_DIR)/pptp/qca-nss-pptp.ko
AUTOLOAD:=$(call AutoLoad,51,qca-nss-pptp)
endef
define KernelPackage/qca-nss-drv-pptp/description
Kernel modules for NSS connection manager - Support for PPTP tunnel
endef
define KernelPackage/qca-nss-drv-pppoe
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Devices
TITLE:=NSS connection manager for PPPoE protocol
DEPENDS:=@(TARGET_qualcommax||TARGET_ipq806x) \
+kmod-qca-nss-drv \
+@NSS_DRV_PPPOE_ENABLE \
+kmod-bonding \
+kmod-ppp \
+kmod-pppoe
FILES:=$(PKG_BUILD_DIR)/pppoe/qca-nss-pppoe.ko
AUTOLOAD:=$(call AutoLoad,51,qca-nss-pppoe)
endef
define KernelPackage/qca-nss-drv-pppoe/Description
Kernel modules for NSS connection manager - Support for PPPoE
endef
define KernelPackage/qca-nss-drv-map-t
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Devices
TITLE:=NSS connection manager for MAP-T protocol
DEPENDS:=@TARGET_qualcommax \
+kmod-qca-nss-drv \
+@NSS_DRV_MAPT_ENABLE \
+kmod-nat46
FILES:=$(PKG_BUILD_DIR)/map/map-t/qca-nss-map-t.ko
AUTOLOAD:=$(call AutoLoad,51,qca-nss-map-t)
endef
define KernelPackage/qca-nss-drv-map-t/description
Kernel modules for NSS connection manager - Support for MAP-T
endef
define KernelPackage/qca-nss-drv-gre
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Devices
TITLE:=NSS connection manager for GRE protocol
DEPENDS:=@(TARGET_qualcommax||TARGET_ipq806x) \
+kmod-qca-nss-drv \
+@NSS_DRV_GRE_ENABLE \
+kmod-gre6
FILES:=$(PKG_BUILD_DIR)/gre/qca-nss-gre.ko $(PKG_BUILD_DIR)/gre/test/qca-nss-gre-test.ko
AUTOLOAD:=$(call AutoLoad,51,qca-nss-gre)
endef
define KernelPackage/qca-nss-drv-gre/description
Kernel modules for NSS connection manager - Support for GRE
endef
define KernelPackage/qca-nss-drv-tunipip6
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Devices
TITLE:=NSS connection manager for IPIP6 tunnels
DEPENDS:=@(TARGET_qualcommax||TARGET_ipq806x) \
+kmod-qca-nss-drv \
+@NSS_DRV_TUNIPIP6_ENABLE \
+kmod-ip6-tunnel \
+kmod-iptunnel6
FILES:=$(PKG_BUILD_DIR)/tunipip6/qca-nss-tunipip6.ko
AUTOLOAD:=$(call AutoLoad,60,qca-nss-tunipip6)
endef
define KernelPackage/qca-nss-drv-tunipip6/description
Kernel modules for NSS connection manager
Add support for DS-lite and ipip6 tunnel
endef
define KernelPackage/qca-nss-drv-profile
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Devices
TITLE:=Profiler for QCA NSS driver (IPQ806x)
DEPENDS:=@TARGET_ipq806x \
+kmod-qca-nss-drv
FILES:=$(PKG_BUILD_DIR)/profiler/qca-nss-profile-drv.ko
endef
define KernelPackage/qca-nss-drv-profile/Description
This package contains a NSS driver profiler for QCA chipset
endef
define KernelPackage/qca-nss-drv-ipsecmgr
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Devices
TITLE:=NSS connection manager for IPSEC protocol
DEPENDS:=@(TARGET_qualcommax_ipq807x||TARGET_qualcommax_ipq60xx) \
+kmod-qca-nss-drv \
+@NSS_DRV_IPSEC_ENABLE \
+kmod-qca-nss-cfi-cryptoapi \
+PACKAGE_kmod-qca-nss-drv-l2tpv2:kmod-qca-nss-drv-l2tpv2 \
@BROKEN
FILES:=$(PKG_BUILD_DIR)/ipsecmgr/$(IPSECMGR_DIR)/qca-nss-ipsecmgr.ko
AUTOLOAD:=$(call AutoLoad,60,qca-nss-ipsecmgr)
endef
define KernelPackage/qca-nss-drv-ipsecmgr/Description
Kernel module for NSS IPsec offload manager
endef
define KernelPackage/qca-nss-drv-ipsecmgr-klips
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Devices
TITLE:=Kernel driver for NSS (ipsec klips)
DEPENDS:=@(TARGET_qualcommax_ipq807x||TARGET_qualcommax_ipq60xx) \
@LINUX_5_4 \
+kmod-qca-nss-drv-ipsecmgr \
+kmod-qca-nss-cfi-cryptoapi \
+PACKAGE_kmod-qca-nss-drv-vxlanmgr:kmod-qca-nss-drv-vxlanmgr \
@BROKEN
FILES:=$(PKG_BUILD_DIR)/ipsecmgr/$(IPSECMGR_DIR)/plugins/klips/qca-nss-ipsec-klips.ko
endef
define KernelPackage/qca-nss-drv-ipsecmgr-klips/Description
NSS Kernel module for IPsec klips offload
endef
define KernelPackage/qca-nss-drv-ipsecmgr-xfrm
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Devices
TITLE:=Kernel driver for NSS (ipsec xfrm)
DEPENDS:=@(TARGET_qualcommax_ipq807x||TARGET_qualcommax_ipq60xx) \
+kmod-qca-nss-drv-ipsecmgr \
+kmod-qca-nss-ecm \
+PACKAGE_kmod-qca-nss-drv-vxlanmgr:kmod-qca-nss-drv-vxlanmgr \
+kmod-ipsec \
@BROKEN
FILES:=$(PKG_BUILD_DIR)/ipsecmgr/$(IPSECMGR_DIR)/plugins/xfrm/qca-nss-ipsec-xfrm.ko
endef
define KernelPackage/qca-nss-drv-ipsecmgr-xfrm/Description
NSS Kernel module for IPsec xfrm offload
endef
define KernelPackage/qca-nss-drv-capwapmgr
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Devices
TITLE:=NSS CAPWAP manager for QCA NSS
DEPENDS:=@(TARGET_qualcommax_ipq807x||TARGET_qualcommax_ipq60xx) \
+kmod-qca-nss-drv \
+kmod-qca-nss-drv-dtlsmgr \
+@NSS_DRV_TRUSTSEC_ENABLE \
+@NSS_DRV_CAPWAP_ENABLE \
@BROKEN
FILES:=$(PKG_BUILD_DIR)/capwapmgr/qca-nss-capwapmgr.ko
endef
define KernelPackage/qca-nss-drv-capwapmgr/Description
This package contains a NSS CAPWAP manager
endef
define KernelPackage/qca-nss-drv-bridge-mgr
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Devices
TITLE:=Kernel driver for NSS bridge manager
DEPENDS:=@(TARGET_qualcommax_ipq807x||TARGET_qualcommax_ipq60xx) \
+kmod-qca-nss-drv \
+@NSS_DRV_BRIDGE_ENABLE \
+kmod-qca-nss-drv-vlan-mgr \
+kmod-bonding
ifneq ($(CONFIG_PACKAGE_kmod-qca-ovsmgr),)
DEPENDS+=kmod-qca-ovsmgr
endif
FILES:=$(PKG_BUILD_DIR)/bridge/qca-nss-bridge-mgr.ko
AUTOLOAD:=$(call AutoLoad,51,qca-nss-bridge-mgr)
endef
define KernelPackage/qca-nss-drv-bridge-mgr/Description
Kernel modules for NSS bridge manager
endef
define KernelPackage/qca-nss-drv-vlan-mgr
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Devices
TITLE:=Kernel driver for NSS vlan manager
DEPENDS:=@(TARGET_qualcommax_ipq807x||TARGET_qualcommax_ipq60xx) \
+kmod-qca-nss-drv \
+@NSS_DRV_VLAN_ENABLE \
+kmod-bonding
FILES:=$(PKG_BUILD_DIR)/vlan/qca-nss-vlan.ko
AUTOLOAD:=$(call AutoLoad,51,qca-nss-vlan)
endef
define KernelPackage/qca-nss-drv-vlan-mgr/Description
Kernel modules for NSS vlan manager
endef
define KernelPackage/qca-nss-drv-qdisc
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Devices
TITLE:=Qdisc for configuring shapers in NSS
DEPENDS:=@(TARGET_qualcommax||TARGET_ipq806x) \
+kmod-qca-nss-drv \
+@NSS_DRV_SHAPER_ENABLE \
+@NSS_DRV_IGS_ENABLE \
+!TARGET_qualcommax_ipq50xx:kmod-qca-nss-drv-bridge-mgr
FILES:=$(PKG_BUILD_DIR)/nss_qdisc/qca-nss-qdisc.ko
KCONFIG:=CONFIG_NET_CLS_ACT=y
endef
define KernelPackage/qca-nss-drv-qdisc/Description
Linux qdisc that aids in configuring shapers in the NSS
endef
define KernelPackage/qca-nss-drv-igs
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Devices
TITLE:=NSS connection manager to perform ingress shaping
DEPENDS:=@(TARGET_qualcommax||TARGET_ipq806x) \
+kmod-qca-nss-drv \
+@NSS_DRV_IGS_ENABLE \
+kmod-qca-nss-drv-qdisc \
+kmod-ifb \
+kmod-nf-conntrack \
+kmod-sched-core
FILES:=$(PKG_BUILD_DIR)/nss_qdisc/igs/act_nssmirred.ko
endef
define KernelPackage/qca-nss-drv-igs/description
Linux action that helps in offloading traffic to an IFB interface to perform ingress shaping.
endef
define KernelPackage/qca-nss-drv-lag-mgr
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Devices
TITLE:=NSS LAG (link aggregation) manager
DEPENDS:=@(TARGET_qualcommax_ipq807x||TARGET_qualcommax_ipq60xx) \
+kmod-qca-nss-drv \
+@NSS_DRV_LAG_ENABLE \
+kmod-qca-nss-drv-vlan-mgr \
+kmod-bonding
FILES:=$(PKG_BUILD_DIR)/lag/qca-nss-lag-mgr.ko
AUTOLOAD:=$(call AutoLoad,51,qca-nss-lag-mgr)
endef
define KernelPackage/qca-nss-drv-lag-mgr/description
Kernel modules for NSS LAG manager
endef
define KernelPackage/qca-nss-drv-netlink
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Devices
TITLE:=NSS NETLINK manager for QCA NSS driver
DEPENDS:=@TARGET_qualcommax \
+kmod-qca-nss-drv \
+@NSS_DRV_IPV6_ENABLE \
+@NSS_DRV_WIFIOFFLOAD_ENABLE \
+@NSS_DRV_UDP_ST_ENABLE:NSS_DRV_RMNET_ENABLE \
+@NSS_DRV_C2C_ENABLE:NSS_DRV_C2C_ENABLE \
+PACKAGE_kmod-qca-nss-drv-capwapmgr:kmod-qca-nss-drv-capwapmgr \
+PACKAGE_kmod-qca-nss-drv-dtlsmgr:kmod-qca-nss-drv-dtlsmgr \
+PACKAGE_kmod-qca-nss-drv-gre:kmod-qca-nss-drv-gre \
+PACKAGE_kmod-qca-nss-drv-ipsecmgr-xfrm:kmod-qca-nss-drv-ipsecmgr \
+PACKAGE_kmod-qca-nss-drv-igs:kmod-qca-nss-drv-igs \
+PACKAGE_kmod-qca-nss-drv-l2tpv2:kmod-qca-nss-drv-l2tpv2 \
+PACKAGE_kmod-qca-nss-drv-lag-mgr:kmod-qca-nss-drv-lag-mgr \
+PACKAGE_kmod-qca-nss-drv-map-t:kmod-qca-nss-drv-map-t \
+PACKAGE_kmod-qca-nss-drv-match:kmod-qca-nss-drv-match \
+PACKAGE_kmod-qca-nss-drv-mirror:kmod-qca-nss-drv-mirror \
+PACKAGE_kmod-qca-nss-drv-pppoe:kmod-qca-nss-drv-pppoe \
+PACKAGE_kmod-qca-nss-drv-pptp:kmod-qca-nss-drv-pptp \
+PACKAGE_kmod-qca-nss-drv-qdisc:kmod-qca-nss-drv-qdisc \
+PACKAGE_kmod-qca-nss-drv-tun6rd:kmod-qca-nss-drv-tun6rd \
+PACKAGE_kmod-qca-nss-drv-tunipip6:kmod-qca-nss-drv-tunipip6 \
+PACKAGE_kmod-qca-nss-drv-vxlanmgr:kmod-qca-nss-drv-vxlanmgr \
+@(PACKAGE_kmod-qca-nss-drv-gre):NSS_DRV_GRE_REDIR_ENABLE
FILES:=$(PKG_BUILD_DIR)/netlink/qca-nss-netlink.ko
endef
define KernelPackage/qca-nss-drv-netlink/Description
Kernel module for NSS netlink manager
endef
define KernelPackage/qca-nss-drv-netlink/config
source "$(SOURCE)/Config.in"
endef
define KernelPackage/qca-nss-drv-ovpn-mgr
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Devices
TITLE:=Kernel driver for NSS OpenVPN manager
DEPENDS:=@(TARGET_qualcommax_ipq807x||TARGET_qualcommax_ipq60xx) \
+kmod-qca-nss-drv \
+@NSS_DRV_QVPN_ENABLE \
+kmod-qca-nss-cfi-cryptoapi \
+kmod-nf-conntrack \
+kmod-tun \
@BROKEN
FILES:=$(PKG_BUILD_DIR)/openvpn/src/qca-nss-ovpn-mgr.ko
endef
define KernelPackage/qca-nss-drv-ovpn-mgr/description
Kernel module for NSS OpenVPN manager
endef
define KernelPackage/qca-nss-drv-ovpn-link
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Devices
TITLE:=Kernel driver for interfacing NSS OpenVPN manager with ECM
DEPENDS:=@(TARGET_qualcommax_ipq807x||TARGET_qualcommax_ipq60xx) \
+kmod-qca-nss-drv-ovpn-mgr \
+kmod-qca-nss-ecm \
@BROKEN
FILES:=$(PKG_BUILD_DIR)/openvpn/plugins/qca-nss-ovpn-link.ko
endef
define KernelPackage/qca-nss-drv-ovpn-link/description
This module registers with ECM and communicates with NSS OpenVPN manager for supporting OpenVPN offload.
endef
define KernelPackage/qca-nss-drv-pvxlanmgr
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Devices
TITLE:=NSS connection manager for PVxLANs
DEPENDS:=@TARGET_qualcommax \
+kmod-qca-nss-drv \
+@NSS_DRV_PVXLAN_ENABLE \
+kmod-vxlan \
@BROKEN
FILES:=$(PKG_BUILD_DIR)/pvxlanmgr/qca-nss-pvxlanmgr.ko
endef
define KernelPackage/qca-nss-drv-pvxlanmgr/description
NSS kernel module for managing Paravirtualized Extensible LAN (PVxLAN) connections
endef
define KernelPackage/qca-nss-drv-eogremgr
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Devices
TITLE:=NSS EOGRE manager for QCA NSS driver
DEPENDS:=@TARGET_qualcommax \
+kmod-qca-nss-drv \
+kmod-qca-nss-drv-gre
FILES:=$(PKG_BUILD_DIR)/eogremgr/qca-nss-eogremgr.ko
endef
define KernelPackage/qca-nss-drv-eogremgr/description
Kernel module for managing NSS EoGRE
endef
define KernelPackage/qca-nss-drv-clmapmgr
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Devices
TITLE:=NSS clmap manager for QCA NSS driver
DEPENDS:=@TARGET_qualcommax \
+kmod-qca-nss-drv \
+@NSS_DRV_CLMAP_ENABLE \
+kmod-qca-nss-drv-eogremgr \
@BROKEN
FILES:=$(PKG_BUILD_DIR)/clmapmgr/qca-nss-clmapmgr.ko
endef
define KernelPackage/qca-nss-drv-clmapmgr/description
Kernel module for managing NSS clmap
endef
define KernelPackage/qca-nss-drv-vxlanmgr
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Devices
TITLE:=NSS VxLAN manager for QCA NSS driver
DEPENDS:=@TARGET_qualcommax \
+kmod-qca-nss-drv \
+@NSS_DRV_VXLAN_ENABLE \
+kmod-vxlan
FILES:=$(PKG_BUILD_DIR)/vxlanmgr/qca-nss-vxlanmgr.ko
AUTOLOAD:=$(call AutoLoad,51,qca-nss-vxlanmgr)
endef
define KernelPackage/qca-nss-drv-vxlanmgr/description
Kernel module for managing NSS VxLAN
endef
define KernelPackage/qca-nss-drv-match
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Devices
TITLE:=NSS Match for QCA NSS driver
DEPENDS:=@TARGET_qualcommax \
+kmod-qca-nss-drv \
+@NSS_DRV_MATCH_ENABLE \
+@NSS_DRV_WIFIOFFLOAD_ENABLE
FILES:=$(PKG_BUILD_DIR)/match/qca-nss-match.ko
endef
define KernelPackage/qca-nss-drv-match/description
Kernel module for managing NSS Match
endef
define KernelPackage/qca-nss-drv-mirror
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Devices
TITLE:=Module for mirroring packets from NSS to host
DEPENDS:=@TARGET_qualcommax \
+kmod-qca-nss-drv \
+@NSS_DRV_MIRROR_ENABLE
FILES:=$(PKG_BUILD_DIR)/mirror/qca-nss-mirror.ko
endef
define KernelPackage/qca-nss-drv-mirror/Description
Kernel module for managing NSS Mirror
endef
define KernelPackage/qca-nss-drv-mscs
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Devices
TITLE:=Module to interface wlan host driver and ECM MSCS classifier.
DEPENDS:=@TARGET_qualcommbe \
+kmod-qca-nss-drv \
+@NSS_DRV_WIFIOFFLOAD_ENABLE
FILES:=$(PKG_BUILD_DIR)/mscs/qca-nss-mscs.ko
endef
define KernelPackage/qca-nss-drv-mscs/Description
Kernel module for Mirrored Stream Classification Signalling(MSCS) NSS client
endef
define KernelPackage/qca-nss-drv-wifi-meshmgr
SECTION:=kernel
CATEGORY:=Kernel modules
SUBMENU:=Network Devices
TITLE:=NSS WiFi-Mesh manager for QCA NSS driver
DEPENDS:=@TARGET_qualcommax \
+kmod-qca-nss-drv \
+@NSS_DRV_WIFI_MESH_ENABLE
FILES:=$(PKG_BUILD_DIR)/wifi_meshmgr/qca-nss-wifi-meshmgr.ko
AUTOLOAD:=$(call AutoLoad,51,qca-nss-wifi-meshmgr)
endef
define KernelPackage/qca-nss-drv-wifi-meshmgr/Description
Kernel module for WiFi Mesh manager
endef
define Build/InstallDev/qca-nss-clients
$(INSTALL_DIR) $(1)/usr/include/qca-nss-clients
$(CP) $(PKG_BUILD_DIR)/netlink/include/* $(1)/usr/include/qca-nss-clients/
$(CP) $(PKG_BUILD_DIR)/exports/* $(1)/usr/include/qca-nss-clients/
endef
define Build/InstallDev
$(call Build/InstallDev/qca-nss-clients,$(1))
endef
define KernelPackage/qca-nss-drv-ovpn-mgr/install
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/qca-nss-ovpn.init $(1)/etc/init.d/qca-nss-ovpn
endef
define KernelPackage/qca-nss-drv-ipsecmgr-klips/install
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/qca-nss-ipsec $(1)/etc/init.d/qca-nss-ipsec
endef
define KernelPackage/qca-nss-drv-ipsecmgr-xfrm/install
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/qca-nss-ipsec $(1)/etc/init.d/qca-nss-ipsec
endef
define KernelPackage/qca-nss-drv-netlink/install
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/qca-nss-netlink.init $(1)/etc/init.d/qca-nss-netlink
endef
EXTRA_CFLAGS+= \
-I$(STAGING_DIR)/usr/include/qca-nss-drv \
-I$(STAGING_DIR)/usr/include/qca-nss-crypto \
-I$(STAGING_DIR)/usr/include/qca-nss-cfi \
-I$(STAGING_DIR)/usr/include/qca-nss-ecm \
-I$(STAGING_DIR)/usr/include/qca-ssdk \
-I$(STAGING_DIR)/usr/include/qca-ssdk/fal \
-I$(STAGING_DIR)/usr/include/nat46
# Build individual packages if selected
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-profile),)
NSS_CLIENTS_MAKE_OPTS+=profile=y
endif
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-capwapmgr),)
NSS_CLIENTS_MAKE_OPTS+=capwapmgr=y
EXTRA_CFLAGS += -DNSS_CAPWAPMGR_ONE_NETDEV
endif
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-tun6rd),)
NSS_CLIENTS_MAKE_OPTS+=tun6rd=m
endif
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-dtlsmgr),)
NSS_CLIENTS_MAKE_OPTS+=dtlsmgr=y
endif
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-tlsmgr),)
EXTRA_CFLAGS+= -I$(PKG_BUILD_DIR)/exports
NSS_CLIENTS_MAKE_OPTS+=tlsmgr=m
endif
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-l2tpv2),)
NSS_CLIENTS_MAKE_OPTS+=l2tpv2=y
EXTRA_CFLAGS += -DNSS_L2TPV2_ENABLED
endif
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-pptp),)
NSS_CLIENTS_MAKE_OPTS+=pptp=y
endif
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-map-t),)
NSS_CLIENTS_MAKE_OPTS+=map-t=y
endif
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-tunipip6),)
NSS_CLIENTS_MAKE_OPTS+=tunipip6=y
endif
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-qdisc),)
NSS_CLIENTS_MAKE_OPTS+=qdisc=y
endif
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-igs),)
NSS_CLIENTS_MAKE_OPTS+=igs=y
endif
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-ipsecmgr),)
EXTRA_CFLAGS+= -I$(PKG_BUILD_DIR)/exports
NSS_CLIENTS_MAKE_OPTS+=ipsecmgr=y
endif
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-ipsecmgr-klips),)
EXTRA_CFLAGS+= -I$(STAGING_DIR)/usr/include/qca-nss-ecm
NSS_CLIENTS_MAKE_OPTS+=ipsecmgr-klips=m
# Enable netdev based binding from L2TP to IPsec if KLIPS is enabled
EXTRA_CFLAGS+= -DNSS_L2TP_IPSEC_BIND_BY_NETDEV
endif
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-ipsecmgr-xfrm),)
EXTRA_CFLAGS+= -I$(STAGING_DIR)/usr/include/qca-nss-ecm
NSS_CLIENTS_MAKE_OPTS+=ipsecmgr-xfrm=m
endif
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-bridge-mgr),)
NSS_CLIENTS_MAKE_OPTS+=bridge-mgr=y
#enable OVS bridge if ovsmgr is enabled
ifneq ($(CONFIG_PACKAGE_kmod-qca-ovsmgr),)
NSS_CLIENTS_MAKE_OPTS+= NSS_BRIDGE_MGR_OVS_ENABLE=y
EXTRA_CFLAGS+= -I$(STAGING_DIR)/usr/include/qca-ovsmgr
endif
endif
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-vlan-mgr),)
NSS_CLIENTS_MAKE_OPTS+=vlan-mgr=y
endif
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-lag-mgr),)
NSS_CLIENTS_MAKE_OPTS+=lag-mgr=y
endif
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-gre),)
EXTRA_CFLAGS+= -I$(PKG_BUILD_DIR)/exports
NSS_CLIENTS_MAKE_OPTS+=gre=y
endif
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-pppoe),)
NSS_CLIENTS_MAKE_OPTS+=pppoe=y
endif
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-netlink),)
NSS_CLIENTS_MAKE_OPTS+=netlink=y
ifdef CONFIG_NSS_DRV_C2C_ENABLE
NSS_CLIENTS_MAKE_OPTS+=CONFIG_NSS_NLC2C=y
endif
ifdef CONFIG_NSS_DRV_UDP_ST_ENABLE
NSS_CLIENTS_MAKE_OPTS+=CONFIG_NSS_NLUDP_ST=y
endif
ifdef CONFIG_NSS_DRV_QRFS_ENABLE
NSS_CLIENTS_MAKE_OPTS+=CONFIG_NSS_NLQRFS=y
endif
ifdef CONFIG_NSS_DRV_GRE_REDIR_ENABLE
NSS_CLIENTS_MAKE_OPTS+=CONFIG_NSS_NLGRE_REDIR_FAMILY=y
endif
ifdef CONFIG_NSS_DRV_IPV4_REASM_ENABLE
NSS_CLIENTS_MAKE_OPTS+=CONFIG_NSS_NLIPV4_REASM=y
endif
ifdef CONFIG_NSS_DRV_IPV6_REASM_ENABLE
NSS_CLIENTS_MAKE_OPTS+=CONFIG_NSS_NLIPV6_REASM=y
endif
ifdef CONFIG_NSS_DRV_LSO_RX_ENABLE
NSS_CLIENTS_MAKE_OPTS+=CONFIG_NSS_NLLSO_RX=y
endif
ifeq ($(CONFIG_KERNEL_IPQ_MEM_PROFILE),256)
EXTRA_CFLAGS+= -DNSS_NETLINK_UDP_ST_NO_RMNET_SUPPORT
else ifeq ($(CONFIG_LOWMEM_FLASH),y)
EXTRA_CFLAGS+= -DNSS_NETLINK_UDP_ST_NO_RMNET_SUPPORT
endif
endif
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-ovpn-mgr),)
NSS_CLIENTS_MAKE_OPTS+=ovpn-mgr=y
endif
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-ovpn-link),)
NSS_CLIENTS_MAKE_OPTS+=ovpn-link=y
endif
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-pvxlanmgr),)
# The memset() call in nss_pvxlanmgr_get_tunnel_stats
# triggers a compilation error with GCC 13, most likely
# it is a false positive, disable the warning for now.
EXTRA_CFLAGS+= -Wno-stringop-overread
NSS_CLIENTS_MAKE_OPTS+=pvxlanmgr=y
endif
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-eogremgr),)
NSS_CLIENTS_MAKE_OPTS+=eogremgr=y
endif
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-clmapmgr),)
NSS_CLIENTS_MAKE_OPTS+=clmapmgr=y
endif
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-vxlanmgr),)
NSS_CLIENTS_MAKE_OPTS+=vxlanmgr=y
EXTRA_CFLAGS += -DNSS_VXLAN_ENABLED
endif
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-match),)
NSS_CLIENTS_MAKE_OPTS+=match=y
endif
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-mirror),)
NSS_CLIENTS_MAKE_OPTS+=mirror=y
endif
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-mscs),)
EXTRA_CFLAGS+= \
-I$(STAGING_DIR)/usr/include/qca-wifi \
-I$(STAGING_DIR)/usr/include/qca-nss-ecm
NSS_CLIENTS_MAKE_OPTS+=mscs=y
endif
ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-wifi-meshmgr),)
NSS_CLIENTS_MAKE_OPTS+=wifi-meshmgr=y
endif
EXTRA_CFLAGS+= \
-Wno-missing-prototypes \
-Wno-missing-declarations \
-Wno-empty-body
define Build/Compile
+$(MAKE) -C "$(LINUX_DIR)" $(strip $(NSS_CLIENTS_MAKE_OPTS)) \
CROSS_COMPILE="$(TARGET_CROSS)" \
ARCH="$(LINUX_KARCH)" \
M="$(PKG_BUILD_DIR)" \
EXTRA_CFLAGS="$(EXTRA_CFLAGS) -include $(PKG_BUILD_DIR)/compat.h" \
DTLSMGR_DIR="$(DTLSMGR_DIR)" \
IPSECMGR_DIR="$(IPSECMGR_DIR)" \
SoC=$(SOC) \
$(KERNEL_MAKE_FLAGS) \
$(PKG_JOBS) \
modules
endef
$(eval $(call KernelPackage,qca-nss-drv-profile))
$(eval $(call KernelPackage,qca-nss-drv-capwapmgr))
$(eval $(call KernelPackage,qca-nss-drv-tun6rd))
$(eval $(call KernelPackage,qca-nss-drv-dtlsmgr))
$(eval $(call KernelPackage,qca-nss-drv-l2tpv2))
$(eval $(call KernelPackage,qca-nss-drv-pptp))
$(eval $(call KernelPackage,qca-nss-drv-pppoe))
$(eval $(call KernelPackage,qca-nss-drv-map-t))
$(eval $(call KernelPackage,qca-nss-drv-tunipip6))
$(eval $(call KernelPackage,qca-nss-drv-qdisc))
$(eval $(call KernelPackage,qca-nss-drv-igs))
$(eval $(call KernelPackage,qca-nss-drv-netlink))
$(eval $(call KernelPackage,qca-nss-drv-ipsecmgr))
$(eval $(call KernelPackage,qca-nss-drv-ipsecmgr-klips))
$(eval $(call KernelPackage,qca-nss-drv-ipsecmgr-xfrm))
$(eval $(call KernelPackage,qca-nss-drv-bridge-mgr))
$(eval $(call KernelPackage,qca-nss-drv-vlan-mgr))
$(eval $(call KernelPackage,qca-nss-drv-lag-mgr))
$(eval $(call KernelPackage,qca-nss-drv-gre))
# $(eval $(call KernelPackage,qca-nss-drv-ovpn-mgr))
# $(eval $(call KernelPackage,qca-nss-drv-ovpn-link))
$(eval $(call KernelPackage,qca-nss-drv-pvxlanmgr))
$(eval $(call KernelPackage,qca-nss-drv-eogremgr))
$(eval $(call KernelPackage,qca-nss-drv-clmapmgr))
$(eval $(call KernelPackage,qca-nss-drv-vxlanmgr))
$(eval $(call KernelPackage,qca-nss-drv-match))
$(eval $(call KernelPackage,qca-nss-drv-tlsmgr))
$(eval $(call KernelPackage,qca-nss-drv-mirror))
$(eval $(call KernelPackage,qca-nss-drv-mscs))
$(eval $(call KernelPackage,qca-nss-drv-wifi-meshmgr))

View File

@ -0,0 +1,231 @@
#!/bin/sh /etc/rc.common
#
# Copyright (c) 2018-2019, 2021 The Linux Foundation. All rights reserved.
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
NSS_IPSEC_LOG_FILE=/tmp/.nss_ipsec_log
NSS_IPSEC_LOG_STR_ECM="ECM_Loaded"
NSS_IPSEC_OL_FILE=/tmp/qca_nss_ipsec_ol
ecm_load () {
if [ ! -d /sys/module/ecm ]; then
/etc/init.d/qca-nss-ecm start
if [ -d /sys/module/ecm ]; then
echo ${NSS_IPSEC_LOG_STR_ECM} >> ${NSS_IPSEC_LOG_FILE}
fi
fi
}
ecm_unload () {
if [ -f /tmp/.nss_ipsec_log ]; then
str=`grep ${NSS_IPSEC_LOG_STR_ECM} ${NSS_IPSEC_LOG_FILE}`
if [[ $str == ${NSS_IPSEC_LOG_STR_ECM} ]]; then
/etc/init.d/qca-nss-ecm stop
`sed 's/${NSS_IPSEC_LOG_STR_ECM}/ /g' $NSS_IPSEC_LOG_FILE > $NSS_IPSEC_LOG_FILE`
fi
fi
}
ecm_disable() {
if [ ! -d /sys/module/ecm ]; then
return;
fi
echo 1 > /sys/kernel/debug/ecm/front_end_ipv4_stop
echo 1 > /sys/kernel/debug/ecm/front_end_ipv6_stop
echo 1 > /sys/kernel/debug/ecm/ecm_db/defunct_all
sleep 2
}
ecm_enable() {
if [ ! -d /sys/module/ecm ]; then
return;
fi
echo 0 > /sys/kernel/debug/ecm/ecm_db/defunct_all
echo 0 > /sys/kernel/debug/ecm/front_end_ipv4_stop
echo 0 > /sys/kernel/debug/ecm/front_end_ipv6_stop
}
kernel_version_check_5_4() {
major_ver=$(uname -r | awk -F '.' '{print $1}')
minor_ver=$(uname -r | awk -F '.' '{print $2}')
if [ $major_ver -lt 5 ] || ([ $major_ver -eq 5 ] && [ $minor_ver -lt 4 ] ); then
return 1
else
return 0
fi
}
kernel_version_check_5_15() {
major_ver=$(uname -r | awk -F '.' '{print $1}')
minor_ver=$(uname -r | awk -F '.' '{print $2}')
if [ $major_ver -lt 5 ] || ([ $major_ver -eq 5 ] && [ $minor_ver -lt 15 ] ); then
return 1
else
return 0
fi
}
start_klips() {
if kernel_version_check_5_4; then
echo "Kernel 5.4 doesn't support klips stack."
return $?
fi
if kernel_version_check_5_15; then
echo "Kernel 5.15 doesn't support klips stack."
return $?
fi
touch $NSS_IPSEC_OL_FILE
ecm_load
local kernel_version=$(uname -r)
insmod /lib/modules/${kernel_version}/qca-nss-ipsec-klips.ko
if [ "$?" -gt 0 ]; then
echo "Failed to load plugin. Please start ecm if not done already"
ecm_enable
rm $NSS_IPSEC_OL_FILE
return
fi
/etc/init.d/ipsec start
sleep 2
ipsec eroute
ecm_enable
}
stop_klips() {
if kernel_version_check_5_4; then
echo "Kernel 5.4 doesn't support klips stack."
return $?
fi
if kernel_version_check_5_15; then
echo "Kernel 5.15 doesn't support klips stack."
return $?
fi
ecm_disable
/etc/init.d/ipsec stop
rmmod qca-nss-ipsec-klips
rm $NSS_IPSEC_OL_FILE
ecm_unload
}
start_xfrm() {
touch $NSS_IPSEC_OL_FILE
ecm_load
local kernel_version=$(uname -r)
# load all NETKEY modules first.
for mod in xfrm_ipcomp ipcomp xfrm6_tunnel ipcomp6 xfrm6_mode_tunnel xfrm6_mode_beet xfrm6_mode_ro \
xfrm6_mode_transport xfrm4_mode_transport xfrm4_mode_tunnel \
xfrm4_tunnel xfrm4_mode_beet esp4 esp6 ah4 ah6 af_key
do
insmod $mod 2> /dev/null
done
# Now load the xfrm plugin
insmod /lib/modules/${kernel_version}/qca-nss-ipsec-xfrm.ko
if [ "$?" -gt 0 ]; then
echo "Failed to load plugin. Please start ecm if not done already"
ecm_enable
rm $NSS_IPSEC_OL_FILE
return
fi
/etc/init.d/ipsec start
sleep 2
ecm_enable
}
stop_xfrm() {
ecm_disable
#Shutdown Pluto first. Then only plugin can be removed.
plutopid=/var/run/pluto/pluto.pid
if [ -f $plutopid ]; then
pid=`cat $plutopid`
if [ ! -z "$pid" ]; then
ipsec whack --shutdown | grep -v "002";
if [ -s $plutopid ]; then
echo "Attempt to shut Pluto down failed! Trying kill:"
kill $pid;
sleep 5;
fi
fi
rm -rf $plutopid
fi
ip xfrm state flush;
ip xfrm policy flush;
sleep 2
#Now we can remove the plugin
retries=5
while [ -d /sys/module/qca_nss_ipsec_xfrm ]
do
rmmod qca-nss-ipsec-xfrm
if [ "$?" -eq 0 ]; then
rm $NSS_IPSEC_OL_FILE
break
fi
if [ ${retries} -eq 0 ]; then
echo "Failed to unload qca-nss-ipsec-xfrm plugin!"
exit
fi
echo "XFRM plugin unload failed; retrying ${retries} times"
sleep 1
retries=`expr ${retries} - 1`
done
/etc/init.d/ipsec stop
ecm_unload
}
start() {
local protostack=`uci -q get ipsec.setup.protostack`
if [ "$protostack" = "klips" ]; then
start_klips
return $?
fi
start_xfrm
return $?
}
stop() {
local protostack=`uci -q get ipsec.setup.protostack`
if [ "$protostack" = "klips" ]; then
stop_klips
return $?
fi
stop_xfrm
return $?
}
restart() {
stop
start
}

View File

@ -0,0 +1,28 @@
#!/bin/sh /etc/rc.common
###########################################################################
# Copyright (c) 2019, The Linux Foundation. All rights reserved.
# Permission to use, copy, modify, and/or distribute this software for
# any purpose with or without fee is hereby granted, provided that the
# above copyright notice and this permission notice appear in all copies.
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
###########################################################################
start() {
insmod act_nssmirred.ko
}
stop() {
rmmod act_nssmirred.ko
}
restart() {
stop
start
}

View File

@ -0,0 +1,31 @@
#!/bin/sh /etc/rc.common
#
# Copyright (c) 2023, The Linux Foundation. All rights reserved.
#
# Permission to use, copy, modify, and/or distribute this software for
# any purpose with or without fee is hereby granted, provided that the
# above copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
start() {
modprobe qca-nss-netlink
echo 2048 > /proc/sys/dev/nss/n2hcfg/n2h_queue_limit_core0
echo 2048 > /proc/sys/dev/nss/n2hcfg/n2h_queue_limit_core1
}
stop() {
rmmod qca-nss-netlink.ko
}
restart() {
stop
start
}

View File

@ -0,0 +1,104 @@
#!/bin/sh /etc/rc.common
# shellcheck disable=3043,2034,2166
###########################################################################
# Copyright (c) 2019, The Linux Foundation. All rights reserved.
# Permission to use, copy, modify, and/or distribute this software for
# any purpose with or without fee is hereby granted, provided that the
# above copyright notice and this permission notice appear in all copies.
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
###########################################################################
# START=26
USE_PROCD=1
ecm_disable() {
if [ ! -d /sys/module/ecm ]; then
return
fi
echo 1 > /sys/kernel/debug/ecm/front_end_ipv4_stop
echo 1 > /sys/kernel/debug/ecm/front_end_ipv6_stop
echo 1 > /sys/kernel/debug/ecm/ecm_db/defunct_all
}
ecm_enable() {
if [ ! -d /sys/module/ecm ]; then
return
fi
echo 0 > /sys/kernel/debug/ecm/ecm_db/defunct_all
echo 0 > /sys/kernel/debug/ecm/front_end_ipv4_stop
echo 0 > /sys/kernel/debug/ecm/front_end_ipv6_stop
}
check_enabled() {
local enabled
total_enabled=${total_enabled:-0}
config_get_bool enabled "$1" enabled 0
[ "$enabled" = "1" ] && total_enabled=$((total_enabled + 1))
}
mod_action() {
local action="$1"
if [ "$action" != "load" -a "$action" != "unload" ]; then
echo "Invalid action: $action, must be load or unload"
return
fi
shift
local modules="$*"
[ -z "$modules" ] && {
echo "No modules specified"
return
}
for i in $modules; do
[ -n "$i" ] && {
if [ "$action" = "unload" ]; then
grep -q -w "$i" /proc/modules && {
rmmod "$i" || echo "Failed to unload $i"
}
else
modprobe "$i" 2> /dev/null || {
echo "Failed to load $i"
return
}
fi
}
done
}
start_service() {
config_load openvpn
config_foreach check_enabled openvpn
[ "$total_enabled" = "0" ] && return
ecm_disable
/etc/init.d/openvpn stop 2> /dev/null
mod_action unload qca_nss_ovpn_link qca_nss_ovpn_mgr
mod_action load qca_nss_ovpn_link qca_nss_ovpn_mgr ovpn_dco_v2
ecm_enable
/etc/init.d/openvpn start 2> /dev/null
}
stop_service() {
ecm_disable
/etc/init.d/openvpn stop 2> /dev/null
mod_action unload qca_nss_ovpn_link qca_nss_ovpn_mgr
ecm_enable
}

View File

@ -0,0 +1,153 @@
--- a/nss_qdisc/igs/nss_mirred.c
+++ b/nss_qdisc/igs/nss_mirred.c
@@ -82,20 +82,24 @@ static const struct nla_policy nss_mirre
* nss_mirred_init()
* Initialize the nss mirred action.
*/
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0))
static int nss_mirred_init(struct net *net, struct nlattr *nla,
- struct nlattr *est, struct tc_action *tc_act, int ovr,
- int bind)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0))
+ struct nlattr *est, struct tc_action *tc_act, int ovr,
+ int bind)
+{
+#elif (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
+ struct nlattr *est, struct tc_action **tc_act, int ovr,
+ int bind, bool rtnl_held, struct tcf_proto *tp,
+ u32 flags, struct netlink_ext_ack *extack)
{
#else
-static int nss_mirred_init(struct net *net, struct nlattr *nla,
- struct nlattr *est, struct tc_action **tc_act, int ovr,
- int bind, bool rtnl_held, struct tcf_proto *tp,
- struct netlink_ext_ack *extack)
+ struct nlattr *est, struct tc_action **tc_act,
+ struct tcf_proto *tp, u32 flags, struct netlink_ext_ack *extack)
{
+ bool bind = flags & TCA_ACT_FLAGS_BIND;
+#endif
struct tc_action_net *tn = net_generic(net, nss_mirred_net_id);
u32 index;
-#endif
struct nlattr *arr[TC_NSS_MIRRED_MAX + 1];
struct tc_nss_mirred *parm;
struct nss_mirred_tcf *act;
@@ -239,8 +243,13 @@ static int nss_mirred_init(struct net *n
}
if (!ret) {
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0))
ret = tcf_idr_create(tn, index, est, tc_act, &nss_mirred_act_ops,
bind, true);
+#else
+ ret = tcf_idr_create(tn, index, est, tc_act, &nss_mirred_act_ops,
+ bind, true, 0);
+#endif
if (ret) {
tcf_idr_cleanup(tn, index);
return ret;
--- a/nss_qdisc/nss_bf.c
+++ b/nss_qdisc/nss_bf.c
@@ -70,7 +70,7 @@ static inline struct nss_bf_class_data *
*/
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0))
static int nss_bf_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
- struct nlattr **tca, unsigned long *arg)
+ struct nlattr **tca, unsigned long *arg, struct netlink_ext_ack *extack)
{
struct netlink_ext_ack *extack = NULL;
#else
@@ -296,7 +296,11 @@ static void nss_bf_destroy_class(struct
* nss_bf_delete_class()
* Detaches a class from operation, but does not destroy it.
*/
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0))
+static int nss_bf_delete_class(struct Qdisc *sch, unsigned long arg, struct netlink_ext_ack *extack)
+#else
static int nss_bf_delete_class(struct Qdisc *sch, unsigned long arg)
+#endif
{
struct nss_bf_sched_data *q = qdisc_priv(sch);
struct nss_bf_class_data *cl = (struct nss_bf_class_data *)arg;
--- a/nss_qdisc/nss_htb.c
+++ b/nss_qdisc/nss_htb.c
@@ -278,7 +278,7 @@ static int nss_htb_ppe_change_class(stru
*/
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0))
static int nss_htb_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
- struct nlattr **tca, unsigned long *arg)
+ struct nlattr **tca, unsigned long *arg, struct netlink_ext_ack *extack)
{
struct netlink_ext_ack *extack = NULL;
#else
@@ -522,7 +522,11 @@ static void nss_htb_destroy_class(struct
* nss_htb_delete_class()
* Detaches a class from operation, but does not destroy it.
*/
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0))
+static int nss_htb_delete_class(struct Qdisc *sch, unsigned long arg, struct netlink_ext_ack *extack)
+#else
static int nss_htb_delete_class(struct Qdisc *sch, unsigned long arg)
+#endif
{
struct nss_htb_sched_data *q = qdisc_priv(sch);
struct nss_htb_class_data *cl = (struct nss_htb_class_data *)arg;
--- a/nss_qdisc/nss_qdisc.c
+++ b/nss_qdisc/nss_qdisc.c
@@ -1144,15 +1144,16 @@ unsigned int nss_qdisc_drop(struct Qdisc
{
struct nss_qdisc *nq = qdisc_priv(sch);
unsigned int ret;
+ struct sk_buff *to_free = qdisc_peek_head(sch);
if (!nq->is_virtual) {
- ret = __qdisc_queue_drop_head(sch, &sch->q);
+ ret = __qdisc_queue_drop_head(sch, &sch->q, &to_free);
} else {
spin_lock_bh(&nq->bounce_protection_lock);
/*
* This function is safe to call within locks
*/
- ret = __qdisc_queue_drop_head(sch, &sch->q);
+ ret = __qdisc_queue_drop_head(sch, &sch->q, &to_free);
spin_unlock_bh(&nq->bounce_protection_lock);
}
@@ -1206,10 +1207,10 @@ static bool nss_qdisc_iterate_fl(struct
return 0;
}
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0))
- status = tc_classify(skb, tcf, &res, false);
-#else
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
status = tcf_classify(skb, tcf, &res, false);
+#else
+ status = tcf_classify(skb, NULL, tcf, &res, false);
#endif
if ((status == TC_ACT_STOLEN) || (status == TC_ACT_QUEUED)) {
return 1;
--- a/nss_qdisc/nss_wrr.c
+++ b/nss_qdisc/nss_wrr.c
@@ -230,7 +230,7 @@ static int nss_wrr_ppe_change_class(stru
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0))
static int nss_wrr_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
- struct nlattr **tca, unsigned long *arg)
+ struct nlattr **tca, unsigned long *arg, struct netlink_ext_ack *extack)
{
struct netlink_ext_ack *extack = NULL;
#else
@@ -406,7 +406,11 @@ failure:
return -EINVAL;
}
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0))
+static int nss_wrr_delete_class(struct Qdisc *sch, unsigned long arg, struct netlink_ext_ack *extack)
+#else
static int nss_wrr_delete_class(struct Qdisc *sch, unsigned long arg)
+#endif
{
struct nss_wrr_sched_data *q = qdisc_priv(sch);
struct nss_wrr_class_data *cl = (struct nss_wrr_class_data *)arg;

View File

@ -0,0 +1,31 @@
--- a/gre/nss_connmgr_gre_v6.c
+++ b/gre/nss_connmgr_gre_v6.c
@@ -95,7 +95,8 @@ static int nss_connmgr_gre_v6_get_mac_ad
/*
* Find src MAC address
*/
- local_dev = (struct net_device *)ipv6_dev_find(&init_net, &src_addr, 1);
+ local_dev = NULL;
+ local_dev = (struct net_device *)ipv6_dev_find(&init_net, &src_addr, local_dev);
if (!local_dev) {
nss_connmgr_gre_warning("Unable to find local dev for %pI6", src_ip);
return GRE_ERR_NO_LOCAL_NETDEV;
--- a/gre/test/nss_connmgr_gre_test.c
+++ b/gre/test/nss_connmgr_gre_test.c
@@ -229,10 +229,12 @@ static int nss_connmgr_gre_test_open_pro
/*
* Proc ops
*/
-static const struct file_operations nss_connmgr_gre_test_proc_ops = {
- .open = nss_connmgr_gre_test_open_proc,
- .write = nss_connmgr_gre_test_write_proc,
- .read = seq_read,
+static const struct proc_ops nss_connmgr_gre_test_proc_ops = {
+ .proc_open = nss_connmgr_gre_test_open_proc,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = single_release,
+ .proc_write = nss_connmgr_gre_test_write_proc,
};
/*

View File

@ -0,0 +1,29 @@
--- a/ipsecmgr/v1.0/nss_ipsecmgr.c
+++ b/ipsecmgr/v1.0/nss_ipsecmgr.c
@@ -377,7 +377,7 @@ free:
* nss_ipsecmgr_tunnel_stats()
* get tunnel statistics
*/
-static struct rtnl_link_stats64 *nss_ipsecmgr_tunnel_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
+void nss_ipsecmgr_tunnel_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
{
struct nss_ipsecmgr_priv *priv = netdev_priv(dev);
@@ -389,8 +389,6 @@ static struct rtnl_link_stats64 *nss_ips
read_lock_bh(&ipsecmgr_ctx->lock);
memcpy(stats, &priv->stats, sizeof(struct rtnl_link_stats64));
read_unlock_bh(&ipsecmgr_ctx->lock);
-
- return stats;
}
/*
@@ -442,7 +440,7 @@ static void nss_ipsecmgr_tunnel_setup(st
dev->header_ops = NULL;
dev->netdev_ops = &nss_ipsecmgr_tunnel_ops;
- dev->destructor = nss_ipsecmgr_tunnel_free;
+ dev->priv_destructor = nss_ipsecmgr_tunnel_free;
/*
* get the MAC address from the ethernet device

View File

@ -0,0 +1,11 @@
--- a/dtls/v1.0/nss_connmgr_dtls_netdev.c
+++ b/dtls/v1.0/nss_connmgr_dtls_netdev.c
@@ -160,7 +160,7 @@ static void nss_dtlsmgr_dev_setup(struct
dev->ethtool_ops = NULL;
dev->header_ops = NULL;
dev->netdev_ops = &nss_dtlsmgr_session_ops;
- dev->destructor = NULL;
+ dev->priv_destructor = NULL;
memcpy(dev->dev_addr, "\xaa\xbb\xcc\xdd\xee\xff", dev->addr_len);
memset(dev->broadcast, 0xff, dev->addr_len);

View File

@ -0,0 +1,59 @@
--- a/vlan/nss_vlan_mgr.c
+++ b/vlan/nss_vlan_mgr.c
@@ -821,8 +821,10 @@ static struct nss_vlan_pvt *nss_vlan_mgr
*/
static void nss_vlan_mgr_instance_free(struct nss_vlan_pvt *v)
{
+#ifdef NSS_VLAN_MGR_PPE_SUPPORT
int32_t i;
int ret = 0;
+#endif
spin_lock(&vlan_mgr_ctx.lock);
BUG_ON(--v->refs);
@@ -980,8 +982,11 @@ static int nss_vlan_mgr_register_event(s
int ret;
#endif
uint32_t vlan_tag;
+#ifdef NSS_VLAN_MGR_PPE_SUPPORT
struct net_device *slave;
- int32_t port, port_if;
+ int32_t port;
+#endif
+ int32_t port_if;
struct vlan_dev_priv *vlan;
struct net_device *real_dev;
bool is_bond_master = false;
@@ -1355,8 +1360,10 @@ return_with_error:
int nss_vlan_mgr_join_bridge(struct net_device *dev, uint32_t bridge_vsi)
{
struct nss_vlan_pvt *v = nss_vlan_mgr_instance_find_and_ref(dev);
+#ifdef NSS_VLAN_MGR_PPE_SUPPORT
struct net_device *real_dev;
int ret;
+#endif
if (!v)
return 0;
@@ -1416,8 +1423,10 @@ EXPORT_SYMBOL(nss_vlan_mgr_join_bridge);
int nss_vlan_mgr_leave_bridge(struct net_device *dev, uint32_t bridge_vsi)
{
struct nss_vlan_pvt *v = nss_vlan_mgr_instance_find_and_ref(dev);
+#ifdef NSS_VLAN_MGR_PPE_SUPPORT
struct net_device *real_dev;
int ret;
+#endif
if (!v)
return 0;
--- a/vlan/Makefile
+++ b/vlan/Makefile
@@ -8,7 +8,7 @@ ifeq ($(SoC),$(filter $(SoC),ipq807x ipq
ccflags-y += -DNSS_VLAN_MGR_PPE_SUPPORT
endif
-ccflags-y += -DNSS_VLAN_MGR_DEBUG_LEVEL=0
+ccflags-y += -DNSS_VLAN_MGR_DEBUG_LEVEL=4
ccflags-y += -Wall -Werror
ifneq (,$(filter $(CONFIG_BONDING),y m))

View File

@ -0,0 +1,25 @@
--- a/match/nss_match_priv.h
+++ b/match/nss_match_priv.h
@@ -29,19 +29,19 @@
/*
* Statically compile messages at different levels
*/
-#if (NSS_match_DEBUG_LEVEL < 2)
+#if (NSS_MATCH_DEBUG_LEVEL < 2)
#define nss_match_warn(s, ...)
#else
#define nss_match_warn(s, ...) pr_warn("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__)
#endif
-#if (NSS_match_DEBUG_LEVEL < 3)
+#if (NSS_MATCH_DEBUG_LEVEL < 3)
#define nss_match_info(s, ...)
#else
#define nss_match_info(s, ...) pr_notice("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__)
#endif
-#if (NSS_match_DEBUG_LEVEL < 4)
+#if (NSS_MATCH_DEBUG_LEVEL < 4)
#define nss_match_trace(s, ...)
#else
#define nss_match_trace(s, ...) pr_info("%s[%d]:" s, __FUNCTION__, __LINE__, ##__VA_ARGS__)

View File

@ -0,0 +1,29 @@
--- a/bridge/nss_bridge_mgr.c
+++ b/bridge/nss_bridge_mgr.c
@@ -1062,8 +1062,10 @@ int nss_bridge_mgr_register_br(struct ne
*/
b_pvt->ifnum = ifnum;
b_pvt->mtu = dev->mtu;
+#if defined(NSS_BRIDGE_MGR_PPE_SUPPORT)
b_pvt->wan_if_num = -1;
b_pvt->wan_if_enabled = false;
+#endif
ether_addr_copy(b_pvt->dev_addr, dev->dev_addr);
spin_lock(&br_mgr_ctx.lock);
list_add(&b_pvt->list, &br_mgr_ctx.list);
@@ -1125,6 +1127,7 @@ static int nss_bridge_mgr_bond_slave_cha
return NOTIFY_DONE;
}
+#if defined(NSS_BRIDGE_MGR_PPE_SUPPORT)
/*
* Add or remove the slave based based on linking event
*/
@@ -1139,6 +1142,7 @@ static int nss_bridge_mgr_bond_slave_cha
cu_info->upper_dev->name, master->name);
}
}
+#endif
return NOTIFY_DONE;
}

View File

@ -0,0 +1,61 @@
--- a/profiler/profile.c
+++ b/profiler/profile.c
@@ -31,6 +31,7 @@
#include <linux/fs.h>
#include <linux/page-flags.h>
#include <linux/sched.h>
+#include <linux/version.h>
#include <asm/uaccess.h>
#include <asm/page.h>
#include <asm/thread_info.h>
@@ -937,12 +938,26 @@ static ssize_t debug_if(struct file *fil
return count;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)
+#define HAVE_PROC_OPS
+#endif
+
+#ifdef HAVE_PROC_OPS
+static const struct proc_ops profile_fops = {
+ .proc_open = profile_open,
+ .proc_read = profile_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = profile_release,
+ .proc_write = debug_if,
+};
+#else
static const struct file_operations profile_fops = {
.open = profile_open,
.read = profile_read,
.release = profile_release,
.write = debug_if,
};
+#endif
/*
* showing sample status on Linux console
@@ -971,6 +986,15 @@ static ssize_t profile_rate_write(struct
return 0;
}
+#ifdef HAVE_PROC_OPS
+static const struct proc_ops profile_rate_fops = {
+ .proc_open = profile_rate_open,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = single_release,
+ .proc_write = profile_rate_write,
+};
+#else
static const struct file_operations profile_rate_fops = {
.open = profile_rate_open,
.read = seq_read,
@@ -978,6 +1002,7 @@ static const struct file_operations prof
.release = single_release,
.write = profile_rate_write,
};
+#endif
/*
* hexdump

View File

@ -0,0 +1,17 @@
--- a/gre/nss_connmgr_gre_v4.c
+++ b/gre/nss_connmgr_gre_v4.c
@@ -172,14 +172,6 @@ int nss_connmgr_gre_v4_set_config(struct
}
}
- /*
- * IP address validate
- */
- if ((cfg->src_ip == 0) || (cfg->dest_ip == 0)) {
- nss_connmgr_gre_warning("Source ip/Destination IP is invalid");
- return GRE_ERR_INVALID_IP;
- }
-
memset(t, 0, sizeof(struct ip_tunnel));
priv->pad_len = (cfg->add_padding) ? GRE_HDR_PAD_LEN : 0;

View File

@ -0,0 +1,35 @@
--- a/portifmgr/nss_portifmgr.c
+++ b/portifmgr/nss_portifmgr.c
@@ -187,16 +187,20 @@ drop:
}
/*
- * nss_portifmgr_get_stats()
+ * nss_portifmgr_get_stats64()
* Netdev get stats function to get port stats
*/
-static struct rtnl_link_stats64 *nss_portifmgr_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats)
+/*
+ * nss_nlgre_redir_cmn_dev_stats64
+ * Report packet statistics to linux
+ */
+static void nss_portifmgr_get_stats64(struct net_device *dev,
+ struct rtnl_link_stats64 *stats)
{
struct nss_portifmgr_priv *priv = (struct nss_portifmgr_priv *)netdev_priv(dev);
BUG_ON(priv == NULL);
nss_portid_get_stats(priv->if_num, stats);
- return stats;
}
/*
@@ -225,7 +229,7 @@ static const struct net_device_ops nss_p
.ndo_start_xmit = nss_portifmgr_start_xmit,
.ndo_set_mac_address = eth_mac_addr,
.ndo_change_mtu = nss_portifmgr_change_mtu,
- .ndo_get_stats64 = nss_portifmgr_get_stats,
+ .ndo_get_stats64 = nss_portifmgr_get_stats64,
};
/*

View File

@ -0,0 +1,48 @@
--- a/dtls/v2.0/nss_dtlsmgr.c
+++ b/dtls/v2.0/nss_dtlsmgr.c
@@ -38,7 +38,13 @@
#include <crypto/aes.h>
#include <crypto/authenc.h>
#include <crypto/des.h>
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)
#include <crypto/sha.h>
+#else
+#include <crypto/sha1.h>
+#include <crypto/sha2.h>
+#endif
#include <crypto/skcipher.h>
#include <crypto/hash.h>
--- a/dtls/v2.0/nss_dtlsmgr_ctx.c
+++ b/dtls/v2.0/nss_dtlsmgr_ctx.c
@@ -40,7 +40,13 @@
#include <crypto/aes.h>
#include <crypto/authenc.h>
#include <crypto/des.h>
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)
#include <crypto/sha.h>
+#else
+#include <crypto/sha1.h>
+#include <crypto/sha2.h>
+#endif
#include <crypto/skcipher.h>
#include <crypto/hash.h>
--- a/dtls/v2.0/nss_dtlsmgr_ctx_dev.c
+++ b/dtls/v2.0/nss_dtlsmgr_ctx_dev.c
@@ -36,7 +36,13 @@
#include <net/protocol.h>
#include <net/route.h>
#include <crypto/aes.h>
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)
#include <crypto/sha.h>
+#else
+#include <crypto/sha1.h>
+#include <crypto/sha2.h>
+#endif
#include <nss_api_if.h>
#include <nss_dynamic_interface.h>

View File

@ -0,0 +1,36 @@
--- a/dtls/v2.0/nss_dtlsmgr_private.h
+++ b/dtls/v2.0/nss_dtlsmgr_private.h
@@ -36,9 +36,9 @@
/*
* Compile messages for dynamic enable/disable
*/
-#define nss_dtlsmgr_warn(s, ...) pr_debug("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__)
-#define nss_dtlsmgr_info(s, ...) pr_debug("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__)
-#define nss_dtlsmgr_trace(s, ...) pr_debug("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__)
+#define nss_dtlsmgr_warn(s, ...) pr_debug("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__);
+#define nss_dtlsmgr_info(s, ...) pr_debug("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__);
+#define nss_dtlsmgr_trace(s, ...) pr_debug("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__);
#else
/*
@@ -46,17 +46,17 @@
*/
#define nss_dtlsmgr_warn(s, ...) { \
if (NSS_DTLSMGR_DEBUG_LEVEL > NSS_DTLSMGR_DEBUG_LEVEL_ERROR) \
- pr_warn("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__) \
+ pr_warn("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__); \
}
#define nss_dtlsmgr_info(s, ...) { \
if (NSS_DTLSMGR_DEBUG_LEVEL > NSS_DTLSMGR_DEBUG_LEVEL_WARN) \
- pr_notice("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__) \
+ pr_notice("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__); \
}
#define nss_dtlsmgr_trace(s, ...) { \
if (NSS_DTLSMGR_DEBUG_LEVEL > NSS_DTLSMGR_DEBUG_LEVEL_INFO) \
- pr_info("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__) \
+ pr_info("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__); \
}
#endif /* CONFIG_DYNAMIC_DEBUG */

View File

@ -0,0 +1,32 @@
--- a/tls/nss_tlsmgr_crypto.c
+++ b/tls/nss_tlsmgr_crypto.c
@@ -41,7 +41,13 @@
#include <crypto/aes.h>
#include <crypto/authenc.h>
#include <crypto/des.h>
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)
#include <crypto/sha.h>
+#else
+#include <crypto/sha1.h>
+#include <crypto/sha2.h>
+#endif
#include <crypto/skcipher.h>
#include <crypto/hash.h>
#include <crypto/internal/hash.h>
--- a/tls/nss_tlsmgr_tun.c
+++ b/tls/nss_tlsmgr_tun.c
@@ -35,7 +35,13 @@
#include <linux/atomic.h>
#include <linux/tlshdr.h>
#include <crypto/aes.h>
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)
#include <crypto/sha.h>
+#else
+#include <crypto/sha1.h>
+#include <crypto/sha2.h>
+#endif
#include <nss_api_if.h>
#include <nss_dynamic_interface.h>

View File

@ -0,0 +1,32 @@
--- a/openvpn/src/nss_ovpnmgr_crypto.c
+++ b/openvpn/src/nss_ovpnmgr_crypto.c
@@ -28,7 +28,13 @@
#include <crypto/aes.h>
#include <crypto/authenc.h>
#include <crypto/des.h>
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)
#include <crypto/sha.h>
+#else
+#include <crypto/sha1.h>
+#include <crypto/sha2.h>
+#endif
#include <crypto/hash.h>
#include <nss_api_if.h>
--- a/openvpn/src/nss_ovpnmgr_route.c
+++ b/openvpn/src/nss_ovpnmgr_route.c
@@ -34,7 +34,13 @@
#include <crypto/aes.h>
#include <crypto/authenc.h>
#include <crypto/des.h>
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)
#include <crypto/sha.h>
+#else
+#include <crypto/sha1.h>
+#include <crypto/sha2.h>
+#endif
#include <crypto/hash.h>
#include <nss_api_if.h>

View File

@ -0,0 +1,11 @@
--- a/tunipip6/nss_connmgr_tunipip6.c
+++ b/tunipip6/nss_connmgr_tunipip6.c
@@ -257,7 +257,7 @@ static void nss_tunipip6_decap_exception
struct iphdr *iph;
struct rtable *rt;
int cpu;
- int8_t ver = skb->data[0] >> 4;
+ __attribute__((unused)) int8_t ver = skb->data[0] >> 4;
nss_tunipip6_trace("%px: received - %d bytes name %s ver %x\n",
dev, skb->len, dev->name, ver);

View File

@ -0,0 +1,34 @@
--- a/tls/nss_tlsmgr_priv.h
+++ b/tls/nss_tlsmgr_priv.h
@@ -28,7 +28,7 @@
#define NSS_TLSMGR_DEBUG_LEVEL_INFO 3
#define NSS_TLSMGR_DEBUG_LEVEL_TRACE 4
-#define nss_tlsmgr_info_always(s, ...) pr_info("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__)
+#define nss_tlsmgr_info_always(s, ...) pr_info("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__);
#define nss_tlsmgr_error(s, ...) do { \
if (net_ratelimit()) { \
@@ -43,18 +43,18 @@
} while (0)
#if defined(CONFIG_DYNAMIC_DEBUG)
-#define nss_tlsmgr_info(s, ...) pr_debug("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__)
-#define nss_tlsmgr_trace(s, ...) pr_debug("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__)
+#define nss_tlsmgr_info(s, ...) pr_debug("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__);
+#define nss_tlsmgr_trace(s, ...) pr_debug("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__);
#else
#define nss_tlsmgr_info(s, ...) { \
if (NSS_TLSMGR_DEBUG_LEVEL > NSS_TLSMGR_DEBUG_LEVEL_WARN) \
- pr_notice("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__) \
+ pr_notice("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__); \
}
#define nss_tlsmgr_trace(s, ...) { \
if (NSS_TLSMGR_DEBUG_LEVEL > NSS_TLSMGR_DEBUG_LEVEL_INFO) \
- pr_info("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__) \
+ pr_info("%s[%d]:" s "\n", __func__, __LINE__, ##__VA_ARGS__); \
}
#endif /* CONFIG_DYNAMIC_DEBUG */

View File

@ -0,0 +1,300 @@
--- a/gre/test/nss_connmgr_gre_test.c
+++ b/gre/test/nss_connmgr_gre_test.c
@@ -223,7 +223,7 @@ static int nss_connmgr_gre_test_show_pro
*/
static int nss_connmgr_gre_test_open_proc(struct inode *inode, struct file *filp)
{
- return single_open(filp, nss_connmgr_gre_test_show_proc, PDE_DATA(inode));
+ return single_open(filp, nss_connmgr_gre_test_show_proc, pde_data(inode));
}
/*
--- a/gre/nss_connmgr_gre.c
+++ b/gre/nss_connmgr_gre.c
@@ -279,10 +279,10 @@ static struct rtnl_link_stats64 *nss_con
#else
start = u64_stats_fetch_begin_irq(&tstats->syncp);
#endif
- rx_packets = tstats->rx_packets;
- tx_packets = tstats->tx_packets;
- rx_bytes = tstats->rx_bytes;
- tx_bytes = tstats->tx_bytes;
+ rx_packets = u64_stats_read(&tstats->rx_packets);
+ tx_packets = u64_stats_read(&tstats->tx_packets);
+ rx_bytes = u64_stats_read(&tstats->rx_bytes);
+ tx_bytes = u64_stats_read(&tstats->tx_bytes);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0))
} while (u64_stats_fetch_retry_bh(&tstats->syncp, start));
#else
@@ -697,11 +697,11 @@ static void nss_connmgr_gre_event_receiv
tstats = this_cpu_ptr(dev->tstats);
u64_stats_update_begin(&tstats->syncp);
if (interface_type == NSS_DYNAMIC_INTERFACE_TYPE_GRE_INNER) {
- tstats->tx_packets += stats->tx_packets;
- tstats->tx_bytes += stats->tx_bytes;
+ u64_stats_add(&tstats->tx_packets, stats->tx_packets);
+ u64_stats_add(&tstats->tx_bytes, stats->tx_bytes);
} else if (interface_type == NSS_DYNAMIC_INTERFACE_TYPE_GRE_OUTER) {
- tstats->rx_packets += stats->rx_packets;
- tstats->rx_bytes += stats->rx_bytes;
+ u64_stats_add(&tstats->rx_packets, stats->rx_packets);
+ u64_stats_add(&tstats->rx_bytes, stats->rx_bytes);
}
u64_stats_update_end(&tstats->syncp);
dev->stats.rx_dropped += nss_cmn_rx_dropped_sum(stats);
--- a/tunipip6/nss_connmgr_tunipip6.c
+++ b/tunipip6/nss_connmgr_tunipip6.c
@@ -353,11 +353,11 @@ static void nss_tunipip6_update_dev_stat
memset(&stats, 0, sizeof(stats));
if (interface_type == NSS_DYNAMIC_INTERFACE_TYPE_TUNIPIP6_INNER) {
- stats.tx_packets = sync_stats->node_stats.tx_packets;
- stats.tx_bytes = sync_stats->node_stats.tx_bytes;
+ u64_stats_set(&stats.tx_packets, sync_stats->node_stats.tx_packets);
+ u64_stats_set(&stats.tx_bytes, sync_stats->node_stats.tx_bytes);
} else if (interface_type == NSS_DYNAMIC_INTERFACE_TYPE_TUNIPIP6_OUTER) {
- stats.rx_packets = sync_stats->node_stats.rx_packets;
- stats.rx_bytes = sync_stats->node_stats.rx_bytes;
+ u64_stats_set(&stats.rx_packets, sync_stats->node_stats.rx_packets);
+ u64_stats_set(&stats.rx_bytes, sync_stats->node_stats.rx_bytes);
} else {
nss_tunipip6_warning("%px: Invalid interface type received from NSS\n", dev);
return;
--- a/nss_qdisc/igs/nss_mirred.c
+++ b/nss_qdisc/igs/nss_mirred.c
@@ -317,7 +317,7 @@ static int nss_mirred_act(struct sk_buff
* Update the last use of action.
*/
tcf_lastuse_update(&act->tcf_tm);
- bstats_cpu_update(this_cpu_ptr(act->common.cpu_bstats), skb);
+ bstats_update(this_cpu_ptr(act->common.cpu_bstats), skb);
rcu_read_lock();
retval = READ_ONCE(act->tcf_action);
--- a/nss_qdisc/nss_qdisc.h
+++ b/nss_qdisc/nss_qdisc.h
@@ -188,7 +188,7 @@ struct nss_qdisc {
/* Shaper configure callback for reading shaper specific
* responses (e.g. memory size).
*/
- struct gnet_stats_basic_packed bstats; /* Basic class statistics */
+ struct gnet_stats_basic_sync bstats; /* Basic class statistics */
struct gnet_stats_queue qstats; /* Qstats for use by classes */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0))
atomic_t refcnt; /* Reference count for class use */
@@ -445,7 +445,7 @@ extern void nss_qdisc_stop_basic_stats_p
* Wrapper around gnet_stats_copy_basic()
*/
extern int nss_qdisc_gnet_stats_copy_basic(struct Qdisc *sch,
- struct gnet_dump *d, struct gnet_stats_basic_packed *b);
+ struct gnet_dump *d, struct gnet_stats_basic_sync *b);
/*
* nss_qdisc_gnet_stats_copy_queue()
--- a/nss_qdisc/igs/nss_ifb.c
+++ b/nss_qdisc/igs/nss_ifb.c
@@ -544,8 +544,10 @@ static void nss_ifb_update_dev_stats(str
* post shaping. Therefore IFB interface's stats should be updated
* with NSS firmware's IFB TX stats only.
*/
- stats.rx_packets = stats.tx_packets = node_stats->tx_packets;
- stats.rx_bytes = stats.tx_bytes = node_stats->tx_bytes;
+ u64_stats_set(&stats.rx_packets, node_stats->tx_packets);
+ u64_stats_set(&stats.tx_packets, node_stats->tx_packets);
+ u64_stats_set(&stats.rx_bytes, node_stats->tx_bytes);
+ u64_stats_set(&stats.tx_bytes, node_stats->tx_bytes);
dev->stats.rx_dropped = dev->stats.tx_dropped += sync_stats->igs_stats.tx_dropped;
u64_stats_update_end(&stats.syncp);
--- a/nss_qdisc/nss_qdisc.c
+++ b/nss_qdisc/nss_qdisc.c
@@ -14,6 +14,7 @@
**************************************************************************
*/
+#include "net/gen_stats.h"
#include <nss_api_if.h>
#include "nss_qdisc.h"
#include "nss_fifo.h"
@@ -2173,7 +2174,7 @@ int __nss_qdisc_init(struct Qdisc *sch,
* This is to prevent mixing NSS and PPE qdisc with linux qdisc.
*/
if ((parent != TC_H_ROOT) && (root->ops->owner != THIS_MODULE)) {
- nss_qdisc_warning("NSS qdisc %px (type %d) used along with non-nss qdiscs,"
+ nss_qdisc_info("NSS qdisc %px (type %d) used along with non-nss qdiscs,"
" or the interface is currently down", nq->qdisc, nq->type);
}
@@ -2562,7 +2563,7 @@ static void nss_qdisc_basic_stats_callba
{
struct nss_qdisc *nq = (struct nss_qdisc *)app_data;
struct Qdisc *qdisc = nq->qdisc;
- struct gnet_stats_basic_packed *bstats;
+ struct gnet_stats_basic_sync *bstats;
struct gnet_stats_queue *qstats;
struct nss_shaper_node_stats_response *response;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0))
@@ -2601,8 +2602,8 @@ static void nss_qdisc_basic_stats_callba
* Update qdisc->bstats
*/
spin_lock_bh(&nq->lock);
- bstats->bytes += (__u64)response->sn_stats.delta.dequeued_bytes;
- bstats->packets += response->sn_stats.delta.dequeued_packets;
+ u64_stats_add(&bstats->bytes, (__u64)response->sn_stats.delta.dequeued_bytes);
+ u64_stats_add(&bstats->packets, response->sn_stats.delta.dequeued_packets);
/*
* Update qdisc->qstats
@@ -2762,12 +2763,14 @@ void nss_qdisc_stop_basic_stats_polling(
* Wrapper around gnet_stats_copy_basic()
*/
int nss_qdisc_gnet_stats_copy_basic(struct Qdisc *sch, struct gnet_dump *d,
- struct gnet_stats_basic_packed *b)
+ struct gnet_stats_basic_sync *b)
{
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(3, 18, 0))
return gnet_stats_copy_basic(d, b);
#elif (LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0))
return gnet_stats_copy_basic(d, NULL, b);
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0))
+ return gnet_stats_copy_basic(d, NULL, b, true);
#else
return gnet_stats_copy_basic(qdisc_root_sleeping_running(sch), d, NULL, b);
#endif
@@ -2798,7 +2801,6 @@ static int nss_qdisc_if_event_cb(struct
struct net_device *br;
struct Qdisc *br_qdisc;
int if_num, br_num;
- struct nss_qdisc *nq;
dev = nss_qdisc_get_dev(ptr);
if (!dev) {
@@ -2841,8 +2843,6 @@ static int nss_qdisc_if_event_cb(struct
break;
}
- nq = (struct nss_qdisc *)qdisc_priv(br_qdisc);
-
/*
* Call attach or detach according as per event type.
*/
--- a/vxlanmgr/nss_vxlanmgr_tunnel.c
+++ b/vxlanmgr/nss_vxlanmgr_tunnel.c
@@ -465,8 +465,8 @@ static void nss_vxlanmgr_tunnel_inner_st
tstats = this_cpu_ptr(dev->tstats);
u64_stats_update_begin(&tstats->syncp);
- tstats->tx_packets += stats->node_stats.tx_packets;
- tstats->tx_bytes += stats->node_stats.tx_bytes;
+ u64_stats_add(&tstats->tx_packets, stats->node_stats.tx_packets);
+ u64_stats_add(&tstats->tx_bytes, stats->node_stats.tx_bytes);
u64_stats_update_end(&tstats->syncp);
netdev_stats->tx_dropped += dropped;
dev_put(dev);
@@ -503,8 +503,8 @@ static void nss_vxlanmgr_tunnel_outer_st
tstats = this_cpu_ptr(dev->tstats);
u64_stats_update_begin(&tstats->syncp);
- tstats->rx_packets += stats->node_stats.tx_packets;
- tstats->rx_bytes += stats->node_stats.tx_bytes;
+ u64_stats_add(&tstats->rx_packets, stats->node_stats.tx_packets);
+ u64_stats_add(&tstats->rx_bytes, stats->node_stats.tx_bytes);
u64_stats_update_end(&tstats->syncp);
netdev_stats->rx_dropped += dropped;
dev_put(dev);
--- a/pvxlanmgr/nss_pvxlanmgr.c
+++ b/pvxlanmgr/nss_pvxlanmgr.c
@@ -177,7 +177,7 @@ static struct rtnl_link_stats64 *nss_pvx
* Netdev seems to be incrementing rx_dropped because we don't give IP header.
* So reset it as it's of no use for us.
*/
- atomic_long_set(&dev->rx_dropped, 0);
+ atomic_long_set(&(dev)->stats.__rx_dropped, 0);
priv = netdev_priv(dev);
memset(stats, 0, sizeof(struct rtnl_link_stats64));
memcpy(stats, &priv->stats, sizeof(struct rtnl_link_stats64));
@@ -305,9 +305,9 @@ static void nss_pvxlanmgr_dummy_netdev_s
dev->priv_destructor = NULL;
#endif
- memcpy(dev->dev_addr, "\x00\x00\x00\x00\x00\x00", dev->addr_len);
- memset(dev->broadcast, 0xff, dev->addr_len);
- memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
+ const uint8_t mac_addr[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+ eth_hw_addr_set(dev, mac_addr);
+ eth_broadcast_addr(dev->broadcast);
}
/*
--- a/clmapmgr/nss_clmapmgr.c
+++ b/clmapmgr/nss_clmapmgr.c
@@ -103,7 +103,7 @@ static struct rtnl_link_stats64 *nss_clm
* Netdev seems to be incrementing rx_dropped because we don't give IP header.
* So reset it as it's of no use for us.
*/
- atomic_long_set(&dev->rx_dropped, 0);
+ atomic_long_set(&(dev)->stats.__rx_dropped, 0);
priv = netdev_priv(dev);
memset(stats, 0, sizeof(struct rtnl_link_stats64));
memcpy(stats, &priv->stats, sizeof(struct rtnl_link_stats64));
--- a/tls/nss_tlsmgr_tun.c
+++ b/tls/nss_tlsmgr_tun.c
@@ -185,7 +185,7 @@ static void nss_tlsmgr_tun_setup(struct
/*
* Get the MAC address from the ethernet device
*/
- random_ether_addr(dev->dev_addr);
+ eth_random_addr((u8 *) dev->dev_addr);
memset(dev->broadcast, 0xff, dev->addr_len);
memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
--- a/netlink/nss_nlgre_redir_cmn.c
+++ b/netlink/nss_nlgre_redir_cmn.c
@@ -384,7 +384,7 @@ static int nss_nlgre_redir_cmn_set_mac_a
return -EINVAL;
}
- memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
+ memcpy((void *) dev->dev_addr, addr->sa_data, ETH_ALEN);
return 0;
}
--- a/nss_connmgr_tun6rd.c
+++ b/nss_connmgr_tun6rd.c
@@ -101,10 +101,10 @@ static void nss_tun6rd_update_dev_stats(
u64_stats_init(&stats.syncp);
u64_stats_update_begin(&stats.syncp);
- stats.rx_packets = sync_stats->node_stats.rx_packets;
- stats.rx_bytes = sync_stats->node_stats.rx_bytes;
- stats.tx_packets = sync_stats->node_stats.tx_packets;
- stats.tx_bytes = sync_stats->node_stats.tx_bytes;
+ u64_stats_set(&stats.rx_packets, sync_stats->node_stats.rx_packets);
+ u64_stats_set(&stats.rx_bytes, sync_stats->node_stats.rx_bytes);
+ u64_stats_set(&stats.tx_packets, sync_stats->node_stats.tx_packets);
+ u64_stats_set(&stats.tx_bytes, sync_stats->node_stats.tx_bytes);
u64_stats_update_end(&stats.syncp);
#else
struct nss_tun6rd_stats stats;
--- a/ipsecmgr/v1.0/nss_ipsecmgr.c
+++ b/ipsecmgr/v1.0/nss_ipsecmgr.c
@@ -445,7 +445,7 @@ static void nss_ipsecmgr_tunnel_setup(st
/*
* get the MAC address from the ethernet device
*/
- random_ether_addr(dev->dev_addr);
+ eth_random_addr((u8 *) dev->dev_addr);
memset(dev->broadcast, 0xff, dev->addr_len);
memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
--- a/ipsecmgr/v2.0/nss_ipsecmgr_tunnel.c
+++ b/ipsecmgr/v2.0/nss_ipsecmgr_tunnel.c
@@ -445,7 +445,7 @@ static void nss_ipsecmgr_tunnel_setup(st
/*
* Get the MAC address from the ethernet device
*/
- random_ether_addr(dev->dev_addr);
+ eth_random_addr((u8 *) dev->dev_addr);
memset(dev->broadcast, 0xff, dev->addr_len);
memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);

View File

@ -0,0 +1,225 @@
--- a/wifi_meshmgr/nss_wifi_meshmgr.c
+++ b/wifi_meshmgr/nss_wifi_meshmgr.c
@@ -49,7 +49,7 @@ static bool nss_wifi_meshmgr_verify_if_n
*/
static nss_wifi_meshmgr_status_t nss_wifi_meshmgr_tx_msg(struct nss_wifi_mesh_msg *msg)
{
- return nss_wifi_mesh_tx_msg(wmgr_ctx.nss_ctx, msg);
+ return (nss_wifi_meshmgr_status_t)nss_wifi_mesh_tx_msg(wmgr_ctx.nss_ctx, msg);
}
/*
@@ -126,7 +126,7 @@ static void nss_wifi_meshmgr_cleanup(str
* Unregister and dealloc decap DI.
*/
nss_unregister_wifi_mesh_if(decap_ifnum);
- nss_status = nss_dynamic_interface_dealloc_node(decap_ifnum, NSS_DYNAMIC_INTERFACE_TYPE_WIFI_MESH_OUTER);
+ nss_status = (nss_wifi_meshmgr_status_t)nss_dynamic_interface_dealloc_node(decap_ifnum, NSS_DYNAMIC_INTERFACE_TYPE_WIFI_MESH_OUTER);
if (nss_status != NSS_WIFI_MESHMGR_SUCCESS) {
nss_wifi_meshmgr_warn("%px: Failed to dealloc decap: %d\n", &wmgr_ctx, nss_status);
}
@@ -135,7 +135,7 @@ static void nss_wifi_meshmgr_cleanup(str
* Unregister and dealloc encap DI.
*/
nss_unregister_wifi_mesh_if(encap_ifnum);
- nss_status = nss_dynamic_interface_dealloc_node(encap_ifnum, NSS_DYNAMIC_INTERFACE_TYPE_WIFI_MESH_INNER);
+ nss_status = (nss_wifi_meshmgr_status_t)nss_dynamic_interface_dealloc_node(encap_ifnum, NSS_DYNAMIC_INTERFACE_TYPE_WIFI_MESH_INNER);
if (nss_status != NSS_WIFI_MESHMGR_SUCCESS) {
nss_wifi_meshmgr_warn("%px: Failed to dealloc encap: %d\n", &wmgr_ctx, nss_status);
}
@@ -257,10 +257,10 @@ static void nss_wifi_meshmgr_tx_msg_cb(v
/*
* FIXME: The wmesh_ctx can be invalid if the memory goes away with the caller being timedout.
*/
- wmesh_ctx->response = NSS_WIFI_MESHMGR_SUCCESS;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_SUCCESS;
if (ncm->response != NSS_CMN_RESPONSE_ACK) {
nss_wifi_meshmgr_warn("%px: WiFi-Mesh error response %d error_code: %u\n", &wmgr_ctx, ncm->response, error_code);
- wmesh_ctx->response = nss_wifi_meshmgr_remap_error(error_code);
+ wmesh_ctx->response = (nss_tx_status_t)nss_wifi_meshmgr_remap_error(error_code);
}
complete(&wmesh_ctx->complete);
@@ -289,10 +289,10 @@ static nss_wifi_meshmgr_status_t nss_wif
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- status = wmesh_ctx->response;
+ status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
return status;
}
@@ -324,7 +324,7 @@ nss_wifi_meshmgr_status_t nss_wifi_meshm
return NSS_WIFI_MESHMGR_FAILURE;
}
- nss_status = nss_wifi_mesh_tx_buf(wmgr_ctx.nss_ctx, os_buf, encap_ifnum);
+ nss_status = (nss_wifi_meshmgr_status_t)nss_wifi_mesh_tx_buf(wmgr_ctx.nss_ctx, os_buf, encap_ifnum);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
return nss_status;
}
@@ -548,10 +548,10 @@ nss_wifi_meshmgr_dump_mesh_path_sync(nss
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- nss_status = wmesh_ctx->response;
+ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
@@ -643,10 +643,10 @@ nss_wifi_meshmgr_dump_mesh_proxy_path_sy
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- nss_status = wmesh_ctx->response;
+ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
@@ -715,7 +715,7 @@ nss_wifi_meshmgr_assoc_link_vap(nss_wifi
/*
* Send the link vap mesage to the NSS synchronously.
*/
- nss_status = nss_wifi_vdev_tx_msg(wmgr_ctx.nss_ctx, wifivdevmsg);
+ nss_status = (nss_wifi_meshmgr_status_t)nss_wifi_vdev_tx_msg(wmgr_ctx.nss_ctx, wifivdevmsg);
if (nss_status != NSS_WIFI_MESHMGR_SUCCESS) {
nss_wifi_meshmgr_warn("%px: Mesh link vap association failed: %d.\n", &wmgr_ctx, nss_status);
}
@@ -761,10 +761,10 @@ nss_wifi_meshmgr_assoc_link_vap_sync(nss
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- nss_status = wmesh_ctx->response;
+ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
@@ -886,10 +886,10 @@ nss_wifi_meshmgr_mesh_config_update_sync
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- nss_status = wmesh_ctx->response;
+ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
@@ -985,10 +985,10 @@ nss_wifi_meshmgr_mesh_proxy_path_delete_
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- nss_status = wmesh_ctx->response;
+ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
@@ -1084,10 +1084,10 @@ nss_wifi_meshmgr_mesh_proxy_path_update_
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- nss_status = wmesh_ctx->response;
+ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
@@ -1183,10 +1183,10 @@ nss_wifi_meshmgr_mesh_proxy_path_add_syn
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- nss_status = wmesh_ctx->response;
+ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
@@ -1282,10 +1282,10 @@ nss_wifi_meshmgr_mesh_path_delete_sync(n
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- nss_status = wmesh_ctx->response;
+ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
@@ -1381,10 +1381,10 @@ nss_wifi_meshmgr_mesh_path_add_sync(nss_
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- nss_status = wmesh_ctx->response;
+ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
return nss_status;
@@ -1479,10 +1479,10 @@ nss_wifi_meshmgr_mesh_path_update_sync(n
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- nss_status = wmesh_ctx->response;
+ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
@@ -1578,10 +1578,10 @@ nss_wifi_meshmgr_mesh_path_exception_syn
ret = wait_for_completion_timeout(&wmesh_ctx->complete, msecs_to_jiffies(NSS_WIFI_MESH_TX_TIMEOUT));
if (!ret) {
nss_wifi_meshmgr_warn("%px: WiFi mesh msg tx failed due to timeout\n", &wmgr_ctx);
- wmesh_ctx->response = NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
+ wmesh_ctx->response = (nss_tx_status_t)NSS_WIFI_MESHMGR_FAILURE_SYNC_TIMEOUT;
}
- nss_status = wmesh_ctx->response;
+ nss_status = (nss_wifi_meshmgr_status_t)wmesh_ctx->response;
up(&wmesh_ctx->sem);
nss_wifi_meshmgr_ref_dec(wmesh_ctx);
@@ -1795,7 +1795,7 @@ nss_wifi_mesh_handle_t nss_wifi_meshmgr_
int32_t encap_ifnum, decap_ifnum;
uint32_t features = 0;
nss_wifi_mesh_handle_t mesh_handle;
- nss_wifi_meshmgr_status_t nss_status;
+ nss_wifi_meshmgr_status_t nss_status = NSS_WIFI_MESHMGR_SUCCESS;
struct nss_wifi_meshmgr_mesh_ctx *wmesh_ctx;
spin_lock_bh(&wmgr_ctx.ref_lock);

View File

@ -0,0 +1,169 @@
--- a/capwapmgr/nss_capwapmgr.c
+++ b/capwapmgr/nss_capwapmgr.c
@@ -331,7 +331,7 @@ static struct rtnl_link_stats64 *nss_cap
* Netdev seems to be incrementing rx_dropped because we don't give IP header.
* So reset it as it's of no use for us.
*/
- atomic_long_set(&dev->rx_dropped, 0);
+ dev->stats.rx_dropped = 0;
memset(stats, 0, sizeof (struct rtnl_link_stats64));
nss_capwapmgr_fill_up_stats(stats, &global.tunneld);
@@ -376,7 +376,6 @@ static const struct net_device_ops nss_c
.ndo_stop = nss_capwapmgr_close,
.ndo_start_xmit = nss_capwapmgr_start_xmit,
.ndo_set_mac_address = eth_mac_addr,
- .ndo_change_mtu = eth_change_mtu,
.ndo_get_stats64 = nss_capwapmgr_dev_tunnel_stats,
};
@@ -400,7 +399,7 @@ static void nss_capwapmgr_dummpy_netdev_
#else
dev->priv_destructor = NULL;
#endif
- memcpy(dev->dev_addr, "\x00\x00\x00\x00\x00\x00", dev->addr_len);
+ memcpy((u8 *)dev->dev_addr, "\x00\x00\x00\x00\x00\x00", dev->addr_len);
memset(dev->broadcast, 0xff, dev->addr_len);
memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
}
@@ -569,7 +568,7 @@ static struct nss_capwapmgr_tunnel *nss_
* nss_capwapmgr_netdev_create()
* API to create a CAPWAP netdev
*/
-struct net_device *nss_capwapmgr_netdev_create()
+struct net_device *nss_capwapmgr_netdev_create(void)
{
struct nss_capwapmgr_priv *priv;
struct nss_capwapmgr_response *r;
@@ -1168,7 +1167,7 @@ static nss_capwapmgr_status_t nss_capwap
/*
* Call NSS driver
*/
- status = nss_capwap_tx_msg(ctx, msg);
+ status = (nss_capwapmgr_status_t)nss_capwap_tx_msg(ctx, msg);
if (status != NSS_CAPWAPMGR_SUCCESS) {
up(&r->sem);
dev_put(dev);
@@ -1209,7 +1208,7 @@ static nss_capwapmgr_status_t nss_capwap
struct nss_ctx_instance *ctx = nss_capwap_get_ctx();
struct nss_capwap_msg capwapmsg;
struct nss_capwap_rule_msg *capwapcfg;
- nss_tx_status_t status;
+ nss_capwapmgr_status_t status;
nss_capwapmgr_info("%px: ctx: CAPWAP Rule src_port: 0x%d dest_port:0x%d\n", ctx,
ntohl(msg->encap.src_port), ntohl(msg->encap.dest_port));
@@ -1274,7 +1273,7 @@ static nss_capwapmgr_status_t nss_capwap
nss_capwapmgr_msg_event_receive, dev);
status = nss_capwapmgr_tx_msg_sync(ctx, dev, &capwapmsg);
- if (status != NSS_TX_SUCCESS) {
+ if (status != NSS_CAPWAPMGR_SUCCESS) {
nss_capwapmgr_warn("%px: ctx: create encap data tunnel error %d \n", ctx, status);
return status;
}
@@ -1286,10 +1285,10 @@ static nss_capwapmgr_status_t nss_capwap
* nss_capwapmgr_tx_msg_enable_tunnel()
* Common function to send CAPWAP tunnel enable msg
*/
-static nss_tx_status_t nss_capwapmgr_tx_msg_enable_tunnel(struct nss_ctx_instance *ctx, struct net_device *dev, uint32_t if_num, uint32_t sibling_if_num)
+static nss_capwapmgr_status_t nss_capwapmgr_tx_msg_enable_tunnel(struct nss_ctx_instance *ctx, struct net_device *dev, uint32_t if_num, uint32_t sibling_if_num)
{
struct nss_capwap_msg capwapmsg;
- nss_tx_status_t status;
+ nss_capwapmgr_status_t status;
/*
* Prepare the tunnel configuration parameter to send to NSS FW
@@ -1303,7 +1302,7 @@ static nss_tx_status_t nss_capwapmgr_tx_
nss_capwap_msg_init(&capwapmsg, if_num, NSS_CAPWAP_MSG_TYPE_ENABLE_TUNNEL, sizeof(struct nss_capwap_enable_tunnel_msg), nss_capwapmgr_msg_event_receive, dev);
status = nss_capwapmgr_tx_msg_sync(ctx, dev, &capwapmsg);
- if (status != NSS_TX_SUCCESS) {
+ if (status != NSS_CAPWAPMGR_SUCCESS) {
nss_capwapmgr_warn("%px: ctx: CMD: %d Tunnel error : %d \n", ctx, NSS_CAPWAP_MSG_TYPE_ENABLE_TUNNEL, status);
}
@@ -1315,7 +1314,7 @@ static nss_tx_status_t nss_capwapmgr_tx_
* Common function for CAPWAP tunnel operation messages without
* any message data structures.
*/
-static nss_tx_status_t nss_capwapmgr_tunnel_action(struct nss_ctx_instance *ctx, struct net_device *dev, uint32_t if_num, nss_capwap_msg_type_t cmd)
+static nss_capwapmgr_status_t nss_capwapmgr_tunnel_action(struct nss_ctx_instance *ctx, struct net_device *dev, uint32_t if_num, nss_capwap_msg_type_t cmd)
{
struct nss_capwap_msg capwapmsg;
nss_tx_status_t status;
@@ -1330,12 +1329,12 @@ static nss_tx_status_t nss_capwapmgr_tun
*/
nss_capwap_msg_init(&capwapmsg, if_num, cmd, 0, nss_capwapmgr_msg_event_receive, dev);
- status = nss_capwapmgr_tx_msg_sync(ctx, dev, &capwapmsg);
+ status = (nss_tx_status_t)nss_capwapmgr_tx_msg_sync(ctx, dev, &capwapmsg);
if (status != NSS_TX_SUCCESS) {
nss_capwapmgr_warn("%px: ctx: CMD: %d Tunnel error : %d \n", ctx, cmd, status);
}
- return status;
+ return (nss_capwapmgr_status_t)status;
}
/*
@@ -1460,7 +1459,6 @@ EXPORT_SYMBOL(nss_capwapmgr_update_path_
*/
nss_capwapmgr_status_t nss_capwapmgr_update_dest_mac_addr(struct net_device *dev, uint8_t tunnel_id, uint8_t *mac_addr)
{
- struct nss_capwapmgr_priv *priv;
struct nss_capwapmgr_tunnel *t;
nss_tx_status_t nss_status;
nss_capwapmgr_status_t status = NSS_CAPWAPMGR_SUCCESS;
@@ -1476,7 +1474,6 @@ nss_capwapmgr_status_t nss_capwapmgr_upd
}
- priv = netdev_priv(dev);
nss_capwapmgr_info("%px: %d: tunnel update mac Addr is being called\n", dev, tunnel_id);
/*
@@ -1523,7 +1520,6 @@ EXPORT_SYMBOL(nss_capwapmgr_update_dest_
*/
nss_capwapmgr_status_t nss_capwapmgr_update_src_interface(struct net_device *dev, uint8_t tunnel_id, uint32_t src_interface_num)
{
- struct nss_capwapmgr_priv *priv;
struct nss_capwapmgr_tunnel *t;
nss_tx_status_t nss_status;
uint32_t outer_trustsec_enabled, dtls_enabled, forward_if_num, src_interface_num_temp;
@@ -1537,7 +1533,6 @@ nss_capwapmgr_status_t nss_capwapmgr_upd
}
- priv = netdev_priv(dev);
nss_capwapmgr_info("%px: %d: tunnel update source interface is being called\n", dev, tunnel_id);
outer_trustsec_enabled = t->capwap_rule.enabled_features & NSS_CAPWAPMGR_FEATURE_OUTER_TRUSTSEC_ENABLED;
dtls_enabled = t->capwap_rule.enabled_features & NSS_CAPWAPMGR_FEATURE_DTLS_ENABLED;
@@ -1576,7 +1571,7 @@ nss_capwapmgr_status_t nss_capwapmgr_upd
/*
* Destroy the IP rule only if it already exist.
*/
- if (t->tunnel_state & NSS_CAPWAPMGR_TUNNEL_STATE_IPRULE_CONFIGURED) {
+ if (NSS_CAPWAPMGR_TUNNEL_STATE_IPRULE_CONFIGURED) {
struct nss_ipv4_destroy v4_destroy;
v4_destroy.protocol = IPPROTO_UDP;
v4_destroy.src_ip = t->ip_rule.v4.src_ip;
@@ -1606,7 +1601,7 @@ nss_capwapmgr_status_t nss_capwapmgr_upd
/*
* Destroy the IP rule only if it already exist.
*/
- if (t->tunnel_state & NSS_CAPWAPMGR_TUNNEL_STATE_IPRULE_CONFIGURED) {
+ if (NSS_CAPWAPMGR_TUNNEL_STATE_IPRULE_CONFIGURED) {
struct nss_ipv6_destroy v6_destroy;
if (t->capwap_rule.which_udp == NSS_CAPWAP_TUNNEL_UDP) {
@@ -1750,7 +1745,7 @@ nss_capwapmgr_status_t nss_capwapmgr_dsc
uint8_t rule_nr = NSS_CAPWAPMGR_RULE_NR;
uint8_t list_id, v4_rule_id, v6_rule_id;
uint8_t lid, rid, i, j;
- int8_t err, fail_dscp;
+ uint8_t err, fail_dscp;
int8_t uid = -1;
nss_capwapmgr_info("Setting priority %u for dscp %u mask %u\n", pri, dscp_value, dscp_mask);

View File

@ -0,0 +1,447 @@
--- a/netlink/Makefile
+++ b/netlink/Makefile
@@ -10,45 +10,78 @@ ccflags-y += -DNSS_CLIENT_BUILD_ID="$(BU
ccflags-y += -DCONFIG_NSS_NLIPV4=1
ccflags-y += -DCONFIG_NSS_NLIPV6=1
-ccflags-y += -DCONFIG_NSS_NLOAM=1
-ccflags-y += -DCONFIG_NSS_NLGRE_REDIR_FAMILY=1
+ccflags-y += -DCONFIG_NSS_NLOAM=$(strip $(if $(filter $(oam), y), 1 , 0))
+ccflags-y += -DCONFIG_NSS_NLGRE_REDIR_FAMILY=$(strip $(if $(filter $(CONFIG_NSS_NLGRE_REDIR_FAMILY), y), 1 , 0))
ccflags-y += -DCONFIG_NSS_NLETHRX=1
ccflags-y += -DCONFIG_NSS_NLDYNAMIC_INTERFACE=1
ccflags-y += -DCONFIG_NSS_NLN2H=1
-ccflags-y += -DCONFIG_NSS_NLIPV4_REASM=1
-ccflags-y += -DCONFIG_NSS_NLIPV6_REASM=1
+ccflags-y += -DCONFIG_NSS_NLIPV4_REASM=$(strip $(if $(filter $(CONFIG_NSS_NLIPV4_REASM), y), 1 , 0))
+ccflags-y += -DCONFIG_NSS_NLIPV6_REASM=$(strip $(if $(filter $(CONFIG_NSS_NLIPV6_REASM), y), 1 , 0))
ccflags-y += -DCONFIG_NSS_NLWIFILI=1
-ccflags-y += -DCONFIG_NSS_NLLSO_RX=1
-ccflags-y += -DCONFIG_NSS_NLMAP_T=1
-ccflags-y += -DCONFIG_NSS_NLPPPOE=1
-ccflags-y += -DCONFIG_NSS_NLL2TPV2=1
-ccflags-y += -DCONFIG_NSS_NLPPTP=1
+ccflags-y += -DCONFIG_NSS_NLLSO_RX=$(strip $(if $(filter $(CONFIG_NSS_NLLSO_RX), y), 1 , 0))
+ccflags-y += -DCONFIG_NSS_NLMAP_T=$(strip $(if $(filter $(map-t), y), 1 , 0))
+ccflags-y += -DCONFIG_NSS_NLPPPOE=$(strip $(if $(filter $(pppoe), y), 1 , 0))
+ccflags-y += -DCONFIG_NSS_NLL2TPV2=$(strip $(if $(filter $(l2tp), y), 1 , 0))
+ccflags-y += -DCONFIG_NSS_NLPPTP=$(strip $(if $(filter $(pptp), y), 1 , 0))
ccflags-y += -DCONFIG_NSS_NLCAPWAP=${CAPWAP_ENABLED}
ccflags-y += -DCONFIG_NSS_NLIPSEC=${IPSEC_ENABLED}
ccflags-y += -DCONFIG_NSS_NLDTLS=${DTLS_ENABLED}
-ccflags-y += -DCONFIG_NSS_NLUDP_ST=1
+ccflags-y += -DCONFIG_NSS_NLUDP_ST=$(strip $(if $(filter $(CONFIG_NSS_NLUDP_ST), y), 1 , 0))
qca-nss-netlink-objs := nss_nl.o
+
+ifneq (,$(filter $(gre), y))
qca-nss-netlink-objs += nss_nlgre_redir_family.o
qca-nss-netlink-objs += nss_nlgre_redir_cmd.o
qca-nss-netlink-objs += nss_nlgre_redir_cmn.o
qca-nss-netlink-objs += nss_nlgre_redir.o
qca-nss-netlink-objs += nss_nlgre_redir_lag.o
+endif
+
qca-nss-netlink-objs += nss_nlipv4.o
qca-nss-netlink-objs += nss_nlipv6.o
+
+ifneq (,$(filter $(oam), y))
qca-nss-netlink-objs += nss_nloam.o
+endif
+
qca-nss-netlink-objs += nss_nlethrx.o
qca-nss-netlink-objs += nss_nldynamic_interface.o
qca-nss-netlink-objs += nss_nln2h.o
+
+ifneq (,$(filter $(CONFIG_NSS_NLIPV4_REASM), y))
qca-nss-netlink-objs += nss_nlipv4_reasm.o
+endif
+ifneq (,$(filter $(CONFIG_NSS_NLIPV6_REASM), y))
qca-nss-netlink-objs += nss_nlipv6_reasm.o
+endif
+
qca-nss-netlink-objs += nss_nlwifili.o
+
+ifneq (,$(filter $(CONFIG_NSS_NLLSO_RX), y))
qca-nss-netlink-objs += nss_nllso_rx.o
+endif
+
+ifneq (,$(filter $(map-t), y))
qca-nss-netlink-objs += nss_nlmap_t.o
+endif
+ifneq (,$(filter $(pppoe), y))
qca-nss-netlink-objs += nss_nlpppoe.o
+endif
+
+ifneq (,$(filter $(l2tp), y))
qca-nss-netlink-objs += nss_nll2tpv2.o
+endif
+
+ifneq (,$(filter $(pptp), y))
qca-nss-netlink-objs += nss_nlpptp.o
+endif
+
+ifeq ($(SoC),$(filter $(SoC),ipq95xx ipq50xx ipq807x_64))
+ifneq (,$(filter $(CONFIG_NSS_NLUDP_ST), y))
qca-nss-netlink-objs += nss_nludp_st.o
+endif
+endif
ifneq (,$(filter $(capwapmgr), y))
qca-nss-netlink-objs += nss_nlcapwap.o
@@ -62,14 +95,11 @@ ifneq (,$(filter $(ipsecmgr), y))
qca-nss-netlink-objs += nss_nlipsec.o
endif
+ccflags-y += -DCONFIG_NSS_NLC2C_TX=$(strip $(if $(filter $(CONFIG_NSS_NLC2C), y), 1 , 0))
+ccflags-y += -DCONFIG_NSS_NLC2C_RX=$(strip $(if $(filter $(CONFIG_NSS_NLC2C), y), 1 , 0))
ifeq ($(SoC),$(filter $(SoC),ipq807x ipq807x_64))
-ccflags-y += -DCONFIG_NSS_NLC2C_TX=1
-ccflags-y += -DCONFIG_NSS_NLC2C_RX=1
-qca-nss-netlink-objs += nss_nlc2c_tx.o
-qca-nss-netlink-objs += nss_nlc2c_rx.o
-else
-ccflags-y += -DCONFIG_NSS_NLC2C_TX=0
-ccflags-y += -DCONFIG_NSS_NLC2C_RX=0
+qca-nss-netlink-objs += $(strip $(if $(filter $(CONFIG_NSS_NLC2C), y), nss_nlc2c_tx.o,))
+qca-nss-netlink-objs += $(strip $(if $(filter $(CONFIG_NSS_NLC2C), y), nss_nlc2c_rx.o,))
endif
ifeq ($(SoC),$(filter $(SoC),ipq60xx ipq60xx_64 ipq807x ipq807x_64))
--- a/netlink/nss_nludp_st.h
+++ b/netlink/nss_nludp_st.h
@@ -23,10 +23,9 @@
#ifndef __NSS_NLUDP_ST_H
#define __NSS_NLUDP_ST_H
+#if defined(CONFIG_NSS_NLUDP_ST) && CONFIG_NSS_NLUDP_ST > 0
bool nss_nludp_st_init(void);
bool nss_nludp_st_exit(void);
-
-#if defined(CONFIG_NSS_NLUDP_ST)
#define NSS_NLUDP_ST_INIT nss_nludp_st_init
#define NSS_NLUDP_ST_EXIT nss_nludp_st_exit
#else
--- a/netlink/nss_nldynamic_interface.h
+++ b/netlink/nss_nldynamic_interface.h
@@ -26,7 +26,7 @@
bool nss_nldynamic_interface_init(void);
bool nss_nldynamic_interface_exit(void);
-#if defined(CONFIG_NSS_NLDYNAMIC_INTERFACE)
+#if defined(CONFIG_NSS_NLDYNAMIC_INTERFACE) && CONFIG_NSS_NLDYNAMIC_INTERFACE > 0
#define NSS_NLDYNAMIC_INTERFACE_INIT nss_nldynamic_interface_init
#define NSS_NLDYNAMIC_INTERFACE_EXIT nss_nldynamic_interface_exit
#else
--- a/netlink/nss_nlethrx.h
+++ b/netlink/nss_nlethrx.h
@@ -26,7 +26,7 @@
bool nss_nlethrx_init(void);
bool nss_nlethrx_exit(void);
-#if defined(CONFIG_NSS_NLETHRX)
+#if defined(CONFIG_NSS_NLETHRX) && CONFIG_NSS_NLETHRX > 0
#define NSS_NLETHRX_INIT nss_nlethrx_init
#define NSS_NLETHRX_EXIT nss_nlethrx_exit
#else
--- a/netlink/nss_nlgre_redir_family.h
+++ b/netlink/nss_nlgre_redir_family.h
@@ -33,7 +33,7 @@ bool nss_nlgre_redir_family_init(void);
*/
bool nss_nlgre_redir_family_exit(void);
-#if defined(CONFIG_NSS_NLGRE_REDIR_FAMILY)
+#if defined(CONFIG_NSS_NLGRE_REDIR_FAMILY) && CONFIG_NSS_NLGRE_REDIR_FAMILY > 0
#define NSS_NLGRE_REDIR_FAMILY_INIT nss_nlgre_redir_family_init
#define NSS_NLGRE_REDIR_FAMILY_EXIT nss_nlgre_redir_family_exit
#else
--- a/netlink/nss_nlipv4.c
+++ b/netlink/nss_nlipv4.c
@@ -336,6 +336,7 @@ static int nss_nlipv4_verify_conn_rule(s
tuple->return_ident, tuple->flow_ident);
break;
+#if defined(CONFIG_NSS_NLGRE_REDIR_FAMILY) && CONFIG_NSS_NLGRE_REDIR_FAMILY > 0
case NSS_NL_IFTYPE_TUNNEL_GRE:
/*
* Currently this implementation is only for gre_redir
@@ -349,6 +350,7 @@ static int nss_nlipv4_verify_conn_rule(s
conn->flow_mtu = nss_nlgre_redir_cmd_get_mtu(flow_dev, NSS_GRE_REDIR_IP_HDR_TYPE_IPV4, conn->flow_interface_num);
break;
+#endif /*!CONFIG_NSS_NLGRE_REDIR_FAMILY */
case NSS_NL_IFTYPE_VLAN:
conn->flow_interface_num = nss_cmn_get_interface_number_by_dev(vlan_dev_real_dev(flow_dev));
@@ -396,6 +398,7 @@ static int nss_nlipv4_verify_conn_rule(s
tuple->return_ident, tuple->flow_ident);
break;
+#if defined(CONFIG_NSS_NLGRE_REDIR_FAMILY) && CONFIG_NSS_NLGRE_REDIR_FAMILY > 0
case NSS_NL_IFTYPE_TUNNEL_GRE:
conn->return_interface_num = nss_nlgre_redir_cmd_get_ifnum(return_dev, tuple->protocol);
if (conn->return_interface_num < 0 ) {
@@ -406,6 +409,7 @@ static int nss_nlipv4_verify_conn_rule(s
conn->return_mtu = nss_nlgre_redir_cmd_get_mtu(return_dev, NSS_GRE_REDIR_IP_HDR_TYPE_IPV4, conn->return_interface_num);
break;
+#endif /*!CONFIG_NSS_NLGRE_REDIR_FAMILY */
case NSS_NL_IFTYPE_VLAN:
conn->return_interface_num = nss_cmn_get_interface_number_by_dev(vlan_dev_real_dev(return_dev));
@@ -480,6 +484,7 @@ static int nss_nlipv4_verify_tcp_rule(st
return 0;
}
+#if defined(CONFIG_NSS_NLPPPOE) && CONFIG_NSS_NLPPPOE > 0
/*
* nss_nlipv4_verify_pppoe_rule()
* verify and override pppoe rule entries
@@ -505,6 +510,7 @@ static int nss_nlipv4_verify_pppoe_rule(
*/
return 0;
}
+#endif
/*
* nss_nlipv4_verify_qos_rule()
@@ -777,6 +783,7 @@ static int nss_nlipv4_ops_create_rule(st
goto done;
}
+#if defined(CONFIG_NSS_NLPPPOE) && CONFIG_NSS_NLPPPOE > 0
/*
* check pppoe rule
*/
@@ -785,6 +792,7 @@ static int nss_nlipv4_ops_create_rule(st
nss_nl_error("%d:invalid pppoe rule information passed\n", pid);
goto done;
}
+#endif
/*
* check qos rule
--- a/netlink/nss_nlipv4.h
+++ b/netlink/nss_nlipv4.h
@@ -24,7 +24,7 @@
bool nss_nlipv4_init(void);
bool nss_nlipv4_exit(void);
-#if defined(CONFIG_NSS_NLIPV4)
+#if defined(CONFIG_NSS_NLIPV4) && CONFIG_NSS_NLIPV4 > 0
#define NSS_NLIPV4_INIT nss_nlipv4_init
#define NSS_NLIPV4_EXIT nss_nlipv4_exit
#else
--- a/netlink/nss_nlipv4_reasm.h
+++ b/netlink/nss_nlipv4_reasm.h
@@ -26,7 +26,7 @@
bool nss_nlipv4_reasm_init(void);
bool nss_nlipv4_reasm_exit(void);
-#if defined(CONFIG_NSS_NLIPV4_REASM)
+#if defined(CONFIG_NSS_NLIPV4_REASM) && CONFIG_NSS_NLIPV4_REASM > 0
#define NSS_NLIPV4_REASM_INIT nss_nlipv4_reasm_init
#define NSS_NLIPV4_REASM_EXIT nss_nlipv4_reasm_exit
#else
--- a/netlink/nss_nlipv6.c
+++ b/netlink/nss_nlipv6.c
@@ -353,6 +353,7 @@ static int nss_nlipv6_verify_conn_rule(s
tuple->return_ident, tuple->flow_ident);
break;
+#if defined(CONFIG_NSS_NLGRE_REDIR_FAMILY) && CONFIG_NSS_NLGRE_REDIR_FAMILY > 0
case NSS_NL_IFTYPE_TUNNEL_GRE:
conn->flow_interface_num = nss_nlgre_redir_cmd_get_ifnum(flow_dev, tuple->protocol);
if (conn->flow_interface_num < 0 ) {
@@ -363,6 +364,7 @@ static int nss_nlipv6_verify_conn_rule(s
conn->flow_mtu = nss_nlgre_redir_cmd_get_mtu(flow_dev, NSS_GRE_REDIR_IP_HDR_TYPE_IPV6, conn->flow_interface_num);
break;
+#endif /* !CONFIG_NSS_NLGRE_REDIR_FAMILY */
case NSS_NL_IFTYPE_VLAN:
conn->flow_interface_num = nss_cmn_get_interface_number_by_dev(vlan_dev_real_dev(flow_dev));
@@ -411,6 +413,7 @@ static int nss_nlipv6_verify_conn_rule(s
tuple->return_ident, tuple->flow_ident);
break;
+#if defined(CONFIG_NSS_NLGRE_REDIR_FAMILY) && CONFIG_NSS_NLGRE_REDIR_FAMILY > 0
case NSS_NL_IFTYPE_TUNNEL_GRE:
conn->return_interface_num = nss_nlgre_redir_cmd_get_ifnum(return_dev, tuple->protocol);
if (conn->return_interface_num < 0 ) {
@@ -421,6 +424,7 @@ static int nss_nlipv6_verify_conn_rule(s
conn->return_mtu = nss_nlgre_redir_cmd_get_mtu(return_dev, NSS_GRE_REDIR_IP_HDR_TYPE_IPV6, conn->return_interface_num);
break;
+#endif /* !CONFIG_NSS_NLGRE_REDIR_FAMILY */
case NSS_NL_IFTYPE_VLAN:
conn->return_interface_num = nss_cmn_get_interface_number_by_dev(vlan_dev_real_dev(return_dev));
@@ -486,6 +490,7 @@ static int nss_nlipv6_verify_tcp_rule(st
return 0;
}
+#if defined(CONFIG_NSS_NLPPPOE) && CONFIG_NSS_NLPPPOE > 0
/*
* nss_nlipv6_verify_pppoe_rule()
* verify and override pppoe rule entries
@@ -510,6 +515,7 @@ static int nss_nlipv6_verify_pppoe_rule(
*/
return 0;
}
+#endif
/*
* nss_nlipv6_verify_igs_rule()
@@ -771,6 +777,7 @@ static int nss_nlipv6_ops_create_rule(st
goto done;
}
+#if defined(CONFIG_NSS_NLPPPOE) && CONFIG_NSS_NLPPPOE > 0
/*
* check pppoe rule
*/
@@ -779,6 +786,7 @@ static int nss_nlipv6_ops_create_rule(st
nss_nl_error("%d:invalid pppoe rule information passed\n", pid);
goto done;
}
+#endif
/*
* check qos rule
--- a/netlink/nss_nlipv6.h
+++ b/netlink/nss_nlipv6.h
@@ -26,7 +26,7 @@
bool nss_nlipv6_init(void);
bool nss_nlipv6_exit(void);
-#if defined(CONFIG_NSS_NLIPV6)
+#if defined(CONFIG_NSS_NLIPV6) && CONFIG_NSS_NLIPV6 > 0
#define NSS_NLIPV6_INIT nss_nlipv6_init
#define NSS_NLIPV6_EXIT nss_nlipv6_exit
#else
--- a/netlink/nss_nlipv6_reasm.h
+++ b/netlink/nss_nlipv6_reasm.h
@@ -26,7 +26,7 @@
bool nss_nlipv6_reasm_init(void);
bool nss_nlipv6_reasm_exit(void);
-#if defined(CONFIG_NSS_NLIPV6_REASM)
+#if defined(CONFIG_NSS_NLIPV6_REASM) && CONFIG_NSS_NLIPV6_REASM > 0
#define NSS_NLIPV6_REASM_INIT nss_nlipv6_reasm_init
#define NSS_NLIPV6_REASM_EXIT nss_nlipv6_reasm_exit
#else
--- a/netlink/nss_nll2tpv2.h
+++ b/netlink/nss_nll2tpv2.h
@@ -26,7 +26,7 @@
bool nss_nll2tpv2_init(void);
bool nss_nll2tpv2_exit(void);
-#if defined(CONFIG_NSS_NLL2TPV2)
+#if defined(CONFIG_NSS_NLL2TPV2) && CONFIG_NSS_NLL2TPV2 > 0
#define NSS_NLL2TPV2_INIT nss_nll2tpv2_init
#define NSS_NLL2TPV2_EXIT nss_nll2tpv2_exit
#else
--- a/netlink/nss_nllso_rx.h
+++ b/netlink/nss_nllso_rx.h
@@ -26,7 +26,7 @@
bool nss_nllso_rx_init(void);
bool nss_nllso_rx_exit(void);
-#if defined(CONFIG_NSS_NLLSO_RX)
+#if defined(CONFIG_NSS_NLLSO_RX) && CONFIG_NSS_NLLSO_RX > 0
#define NSS_NLLSO_RX_INIT nss_nllso_rx_init
#define NSS_NLLSO_RX_EXIT nss_nllso_rx_exit
#else
--- a/netlink/nss_nlmap_t.h
+++ b/netlink/nss_nlmap_t.h
@@ -26,7 +26,7 @@
bool nss_nlmap_t_init(void);
bool nss_nlmap_t_exit(void);
-#if defined(CONFIG_NSS_NLMAP_T)
+#if defined(CONFIG_NSS_NLMAP_T) && CONFIG_NSS_NLMAP_T > 0
#define NSS_NLMAP_T_INIT nss_nlmap_t_init
#define NSS_NLMAP_T_EXIT nss_nlmap_t_exit
#else
--- a/netlink/nss_nln2h.h
+++ b/netlink/nss_nln2h.h
@@ -26,7 +26,7 @@
bool nss_nln2h_init(void);
bool nss_nln2h_exit(void);
-#if defined(CONFIG_NSS_NLN2H)
+#if defined(CONFIG_NSS_NLN2H) && CONFIG_NSS_NLN2H > 0
#define NSS_NLN2H_INIT nss_nln2h_init
#define NSS_NLN2H_EXIT nss_nln2h_exit
#else
--- a/netlink/nss_nloam.h
+++ b/netlink/nss_nloam.h
@@ -25,7 +25,7 @@
bool nss_nloam_init(void);
bool nss_nloam_exit(void);
-#if defined(CONFIG_NSS_NLOAM)
+#if defined(CONFIG_NSS_NLOAM) && CONFIG_NSS_NLOAM > 0
#define NSS_NLOAM_INIT nss_nloam_init
#define NSS_NLOAM_EXIT nss_nloam_exit
#else
--- a/netlink/nss_nlpppoe.h
+++ b/netlink/nss_nlpppoe.h
@@ -26,7 +26,7 @@
bool nss_nlpppoe_init(void);
bool nss_nlpppoe_exit(void);
-#if defined(CONFIG_NSS_NLPPPOE)
+#if defined(CONFIG_NSS_NLPPPOE) && CONFIG_NSS_NLPPPOE > 0
#define NSS_NLPPPOE_INIT nss_nlpppoe_init
#define NSS_NLPPPOE_EXIT nss_nlpppoe_exit
#else
--- a/netlink/nss_nlpptp.h
+++ b/netlink/nss_nlpptp.h
@@ -26,7 +26,7 @@
bool nss_nlpptp_init(void);
bool nss_nlpptp_exit(void);
-#if defined(CONFIG_NSS_NLPPTP)
+#if defined(CONFIG_NSS_NLPPTP) && CONFIG_NSS_NLPPTP > 0
#define NSS_NLPPTP_INIT nss_nlpptp_init
#define NSS_NLPPTP_EXIT nss_nlpptp_exit
#else
--- a/netlink/nss_nlwifili.h
+++ b/netlink/nss_nlwifili.h
@@ -26,7 +26,7 @@
bool nss_nlwifili_init(void);
bool nss_nlwifili_exit(void);
-#if defined(CONFIG_NSS_NLWIFILI)
+#if defined(CONFIG_NSS_NLWIFILI) && CONFIG_NSS_NLWIFILI > 0
#define NSS_NLWIFILI_INIT nss_nlwifili_init
#define NSS_NLWIFILI_EXIT nss_nlwifili_exit
#else
--- a/netlink/nss_nl.c
+++ b/netlink/nss_nl.c
@@ -287,15 +287,14 @@ static struct nss_nl_family family_handl
.valid = CONFIG_NSS_NLPPTP /* 1 or 0 */
},
{
- /*
- * NSS_NLUDP_ST
- */
- .name = NSS_NLUDP_ST_FAMILY, /* udp_st */
- .entry = NSS_NLUDP_ST_INIT, /* init */
- .exit = NSS_NLUDP_ST_EXIT, /* exit */
- .valid = CONFIG_NSS_NLUDP_ST /* 1 or 0 */
- },
-
+ /*
+ * NSS_NLUDP_ST
+ */
+ .name = NSS_NLUDP_ST_FAMILY, /* udp_st */
+ .entry = NSS_NLUDP_ST_INIT, /* init */
+ .exit = NSS_NLUDP_ST_EXIT, /* exit */
+ .valid = CONFIG_NSS_NLUDP_ST /* 1 or 0 */
+ }
};
#define NSS_NL_FAMILY_HANDLER_SZ ARRAY_SIZE(family_handlers)

View File

@ -0,0 +1,10 @@
--- a/mirror/Makefile
+++ b/mirror/Makefile
@@ -1,6 +1,6 @@
# Makefile for NSS MIRROR
-ccflags-y += $(NSS_CCFLAGS) -I$(obj)/../../exports
+ccflags-y += $(NSS_CCFLAGS) -I$(obj)/../exports
ccflags-y += -DNSS_MIRROR_DEBUG_LEVEL=2
ccflags-y += -Wall -Werror

View File

@ -0,0 +1,93 @@
--- a/match/nss_match_cmd.c
+++ b/match/nss_match_cmd.c
@@ -460,10 +460,10 @@ static int nss_match_cmd_procfs_reset_ne
char *cmd_buf = nss_match_data;
nss_tx_status_t nss_tx_status;
struct nss_ctx_instance *nss_ctx = nss_match_get_context();
- struct nss_ctx_instance *wifi_nss_ctx = nss_wifi_get_context();
+ struct nss_ctx_instance *wifili_nss_ctx = nss_wifili_get_context();
- if (!nss_ctx || !wifi_nss_ctx) {
- pr_warn("%px: NSS Context not found. wifi_nss_ctx: %px. Reset nexthop failed", nss_ctx, wifi_nss_ctx);
+ if (!nss_ctx || !wifili_nss_ctx) {
+ pr_warn("%px: NSS Context not found. wifili_nss_ctx: %px. Reset nexthop failed", nss_ctx, wifili_nss_ctx);
return -ENOMEM;
}
@@ -495,9 +495,9 @@ static int nss_match_cmd_procfs_reset_ne
* nss_phys_if_reset_nexthop: Used for physical interfaces.
* nss_if_reset_nexthop: used for VAP interfaces.
*/
- type = nss_dynamic_interface_get_type(wifi_nss_ctx, if_num);
+ type = nss_dynamic_interface_get_type(wifili_nss_ctx, if_num);
if (type == NSS_DYNAMIC_INTERFACE_TYPE_VAP) {
- nss_tx_status = nss_if_reset_nexthop(wifi_nss_ctx, if_num);
+ nss_tx_status = nss_if_reset_nexthop(wifili_nss_ctx, if_num);
} else if (if_num < NSS_MAX_PHYSICAL_INTERFACES) {
nss_tx_status = nss_phys_if_reset_nexthop(nss_ctx, if_num);
} else {
@@ -528,7 +528,7 @@ static int nss_match_cmd_procfs_set_if_n
uint32_t nh_if_num;
int table_id;
struct nss_ctx_instance *nss_ctx = nss_match_get_context();
- struct nss_ctx_instance *wifi_nss_ctx = nss_wifi_get_context();
+ struct nss_ctx_instance *wifili_nss_ctx = nss_wifili_get_context();
char *dev_name, *nexthop_msg;
char *cmd_buf = NULL;
size_t count = *lenp;
@@ -539,8 +539,8 @@ static int nss_match_cmd_procfs_set_if_n
return ret;
}
- if (!nss_ctx || !wifi_nss_ctx) {
- pr_warn("%px: NSS Context not found. wifi_nss_ctx: %px. Set nexthop failed", nss_ctx, wifi_nss_ctx);
+ if (!nss_ctx || !wifili_nss_ctx) {
+ pr_warn("%px: NSS Context not found. wifili_nss_ctx: %px. Set nexthop failed", nss_ctx, wifili_nss_ctx);
return -ENOMEM;
}
@@ -607,9 +607,9 @@ static int nss_match_cmd_procfs_set_if_n
* nss_phys_if_set_nexthop: Used for physical interfaces.
* nss_if_set_nexthop: used for VAP interfaces.
*/
- type = nss_dynamic_interface_get_type(wifi_nss_ctx, if_num);
+ type = nss_dynamic_interface_get_type(wifili_nss_ctx, if_num);
if (type == NSS_DYNAMIC_INTERFACE_TYPE_VAP) {
- nss_tx_status = nss_if_set_nexthop(wifi_nss_ctx, if_num, nh_if_num);
+ nss_tx_status = nss_if_set_nexthop(wifili_nss_ctx, if_num, nh_if_num);
} else if (if_num < NSS_MAX_PHYSICAL_INTERFACES) {
nss_tx_status = nss_phys_if_set_nexthop(nss_ctx, if_num, nh_if_num);
} else {
--- a/gre/nss_connmgr_gre.c
+++ b/gre/nss_connmgr_gre.c
@@ -1672,7 +1672,7 @@ int nss_connmgr_gre_set_wifi_next_hop(st
return GRE_ERR_NEXT_NODE_UNREG_IN_AE;
}
- ctx = nss_wifi_get_context();
+ ctx = nss_wifili_get_context();
status = nss_wifi_vdev_set_next_hop(ctx, ifnumber, NSS_GRE_INTERFACE);
if (status != NSS_TX_SUCCESS) {
nss_connmgr_gre_info("%px: wifi drv api failed to set next hop\n", wifi_vdev);
--- a/mirror/nss_mirror_ctl.c
+++ b/mirror/nss_mirror_ctl.c
@@ -480,7 +480,7 @@ static int nss_mirror_ctl_parse_enable_i
type = nss_dynamic_interface_get_type(nss_ctx, if_num);
if (type == NSS_DYNAMIC_INTERFACE_TYPE_VAP) {
- status = nss_wifi_vdev_set_next_hop(nss_wifi_get_context(), if_num, mirror_if_num);
+ status = nss_wifi_vdev_set_next_hop(nss_wifili_get_context(), if_num, mirror_if_num);
} else if (if_num < NSS_MAX_PHYSICAL_INTERFACES) {
status = nss_phys_if_set_nexthop(nss_ctx, if_num, mirror_if_num);
} else {
--- a/netlink/nss_nlgre_redir_cmn.c
+++ b/netlink/nss_nlgre_redir_cmn.c
@@ -905,7 +905,7 @@ int nss_nlgre_redir_cmn_set_next_hop(uin
}
nss_nl_info("%px: next hop interface number is %d\n", nss_ctx, next_dev_ifnum);
- ctx = nss_wifi_get_context();
+ ctx = nss_wifili_get_context();
ret = nss_wifi_vdev_set_next_hop(ctx, ifnumber, next_dev_ifnum);
if (ret != NSS_TX_SUCCESS) {

View File

@ -0,0 +1,274 @@
--- a/bridge/nss_bridge_mgr.c
+++ b/bridge/nss_bridge_mgr.c
@@ -1329,7 +1329,6 @@ static struct notifier_block nss_bridge_
.notifier_call = nss_bridge_mgr_netdevice_event,
};
-#if defined(NSS_BRIDGE_MGR_PPE_SUPPORT)
/*
* nss_bridge_mgr_is_physical_dev()
* Check if the device is on physical device.
@@ -1558,25 +1557,6 @@ static struct ctl_table nss_bridge_mgr_t
{ }
};
-static struct ctl_table nss_bridge_mgr_dir[] = {
- {
- .procname = "bridge_mgr",
- .mode = 0555,
- .child = nss_bridge_mgr_table,
- },
- { }
-};
-
-static struct ctl_table nss_bridge_mgr_root_dir[] = {
- {
- .procname = "nss",
- .mode = 0555,
- .child = nss_bridge_mgr_dir,
- },
- { }
-};
-#endif
-
/*
* nss_bridge_mgr_init_module()
* bridge_mgr module init function
@@ -1596,7 +1576,7 @@ int __init nss_bridge_mgr_init_module(vo
#if defined(NSS_BRIDGE_MGR_PPE_SUPPORT)
br_mgr_ctx.wan_if_num = -1;
br_fdb_update_register_notify(&nss_bridge_mgr_fdb_update_notifier);
- br_mgr_ctx.nss_bridge_mgr_header = register_sysctl_table(nss_bridge_mgr_root_dir);
+ br_mgr_ctx.nss_bridge_mgr_header = register_sysctl("nss/bridge_mgr", nss_bridge_mgr_table);
/*
* Enable ACL rule to enable L2 exception. This is needed if PPE Virtual ports is added to bridge.
--- a/gre/nss_connmgr_gre.c
+++ b/gre/nss_connmgr_gre.c
@@ -277,7 +277,7 @@ static struct rtnl_link_stats64 *nss_con
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0))
start = u64_stats_fetch_begin_bh(&tstats->syncp);
#else
- start = u64_stats_fetch_begin_irq(&tstats->syncp);
+ start = u64_stats_fetch_begin(&tstats->syncp);
#endif
rx_packets = u64_stats_read(&tstats->rx_packets);
tx_packets = u64_stats_read(&tstats->tx_packets);
@@ -286,7 +286,7 @@ static struct rtnl_link_stats64 *nss_con
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0))
} while (u64_stats_fetch_retry_bh(&tstats->syncp, start));
#else
- } while (u64_stats_fetch_retry_irq(&tstats->syncp, start));
+ } while (u64_stats_fetch_retry(&tstats->syncp, start));
#endif
tot->rx_packets += rx_packets;
--- a/vlan/nss_vlan_mgr.c
+++ b/vlan/nss_vlan_mgr.c
@@ -1544,30 +1544,6 @@ static struct ctl_table nss_vlan_table[]
};
/*
- * nss_vlan sysctl dir
- */
-static struct ctl_table nss_vlan_dir[] = {
- {
- .procname = "vlan_client",
- .mode = 0555,
- .child = nss_vlan_table,
- },
- { }
-};
-
-/*
- * nss_vlan systel root dir
- */
-static struct ctl_table nss_vlan_root_dir[] = {
- {
- .procname = "nss",
- .mode = 0555,
- .child = nss_vlan_dir,
- },
- { }
-};
-
-/*
* nss_vlan_mgr_add_bond_slave()
* Add new slave port to bond_vlan
*/
@@ -1906,7 +1882,7 @@ int __init nss_vlan_mgr_init_module(void
vlan_mgr_ctx.stpid = ETH_P_8021Q;
#ifdef NSS_VLAN_MGR_PPE_SUPPORT
- vlan_mgr_ctx.sys_hdr = register_sysctl_table(nss_vlan_root_dir);
+ vlan_mgr_ctx.sys_hdr = register_sysctl("nss/vlan_client", nss_vlan_table);
if (!vlan_mgr_ctx.sys_hdr) {
nss_vlan_mgr_warn("Unabled to register sysctl table for vlan manager\n");
return -EFAULT;
--- a/match/nss_match_cmd.c
+++ b/match/nss_match_cmd.c
@@ -692,33 +692,6 @@ static struct ctl_table nss_match_table[
{ }
};
-static struct ctl_table nss_match_root_dir[] = {
- {
- .procname = "match",
- .mode = 0555,
- .child = nss_match_table,
- },
- { }
-};
-
-static struct ctl_table nss_match_nss_root_dir[] = {
- {
- .procname = "nss",
- .mode = 0555,
- .child = nss_match_root_dir,
- },
- { }
-};
-
-static struct ctl_table nss_match_root[] = {
- {
- .procname = "dev",
- .mode = 0555,
- .child = nss_match_nss_root_dir,
- },
- { }
-};
-
static struct ctl_table_header *nss_match_ctl_header;
/*
@@ -726,7 +699,7 @@ static struct ctl_table_header *nss_matc
* Register command line interface for match.
*/
bool nss_match_ctl_register(void) {
- nss_match_ctl_header = register_sysctl_table(nss_match_root);
+ nss_match_ctl_header = register_sysctl("dev/nss/match", nss_match_table);
if (!nss_match_ctl_header) {
nss_match_warn("Unable to register command line interface.\n");
return false;
--- a/tunipip6/nss_connmgr_tunipip6_sysctl.c
+++ b/tunipip6/nss_connmgr_tunipip6_sysctl.c
@@ -449,33 +449,6 @@ static struct ctl_table nss_tunipip6_tab
{ }
};
-static struct ctl_table nss_tunipip6_root_dir[] = {
- {
- .procname = "ipip6",
- .mode = 0555,
- .child = nss_tunipip6_table,
- },
- { }
-};
-
-static struct ctl_table nss_tunipip6_nss_root_dir[] = {
- {
- .procname = "nss",
- .mode = 0555,
- .child = nss_tunipip6_root_dir,
- },
- { }
-};
-
-static struct ctl_table nss_tunipip6_root[] = {
- {
- .procname = "dev",
- .mode = 0555,
- .child = nss_tunipip6_nss_root_dir,
- },
- { }
-};
-
static struct ctl_table_header *nss_tunipip6_ctl_header;
/*
@@ -483,7 +456,7 @@ static struct ctl_table_header *nss_tuni
* Register command line interface for tunipip6.
*/
bool nss_tunipip6_sysctl_register(void) {
- nss_tunipip6_ctl_header = register_sysctl_table(nss_tunipip6_root);
+ nss_tunipip6_ctl_header = register_sysctl("drv/nss/ipip6", nss_tunipip6_table);
if (!nss_tunipip6_ctl_header) {
return false;
}
--- a/mirror/nss_mirror_ctl.c
+++ b/mirror/nss_mirror_ctl.c
@@ -919,48 +919,12 @@ static struct ctl_table nss_mirror_table
};
/*
- * nss mirror dir
- */
-static struct ctl_table nss_mirror_root_dir[] = {
- {
- .procname = "mirror",
- .mode = 0555,
- .child = nss_mirror_table,
- },
- { }
-};
-
-/*
- * nss mirror sysctl nss root dir
- */
-static struct ctl_table nss_mirror_nss_root_dir[] = {
- {
- .procname = "nss",
- .mode = 0555,
- .child = nss_mirror_root_dir,
- },
- { }
-};
-
-/*
- * nss mirror sysctl root dir
- */
-static struct ctl_table nss_mirror_root[] = {
- {
- .procname = "dev",
- .mode = 0555,
- .child = nss_mirror_nss_root_dir,
- },
- { }
-};
-
-/*
* nss_mirror_ctl_register()
* Register command line interface for mirror.
*/
int nss_mirror_ctl_register(void)
{
- nss_mirror_ctl_header = register_sysctl_table(nss_mirror_root);
+ nss_mirror_ctl_header = register_sysctl("dev/nss/mirror", nss_mirror_table);
if (!nss_mirror_ctl_header) {
nss_mirror_warn("Creating sysctl directory table header for mirror failed\n");
return -1;
--- a/l2tp/l2tpv2/nss_connmgr_l2tpv2.c
+++ b/l2tp/l2tpv2/nss_connmgr_l2tpv2.c
@@ -1036,7 +1036,7 @@ int __init nss_connmgr_l2tpv2_init_modul
}
#endif
#if defined(NSS_L2TP_IPSEC_BIND_BY_NETDEV)
- ctl_tbl_hdr = register_sysctl_table(nss_connmgr_l2tpv2_sysroot);
+ ctl_tbl_hdr = register_sysctl("dev/nss/l2tpv2", nss_connmgr_l2tpv2_table);
if (!ctl_tbl_hdr) {
nss_connmgr_l2tpv2_info("Unable to register sysctl table for L2TP conn mgr\n");
return -EFAULT;
--- a/netlink/nss_nl.c
+++ b/netlink/nss_nl.c
@@ -462,7 +462,11 @@ struct nss_nlcmn *nss_nl_get_msg(struct
/*
* validate the common message header version & magic
*/
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0))
cm = info->userhdr;
+#else
+ cm = genl_info_userhdr(info);
+#endif
if (nss_nlcmn_chk_ver(cm, family->version) == false) {
nss_nl_error("%d, %s: version mismatch (%d)\n", pid, family->name, cm->version);
return NULL;

View File

@ -0,0 +1,330 @@
--- a/nss_qdisc/nss_bf.c
+++ b/nss_qdisc/nss_bf.c
@@ -331,10 +331,19 @@ static int nss_bf_delete_class(struct Qd
qdisc_class_hash_remove(&q->clhash, &cl->cl_common);
refcnt = nss_qdisc_atomic_sub_return(&cl->nq);
sch_tree_unlock(sch);
+
+ /*
+ * For 5.4 and above kernels, calling nss_htb_destroy_class
+ * explicitly as there is no put_class which would have called
+ * nss_bf_destroy_class when refcnt becomes zero.
+ */
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0))
+ nss_bf_destroy_class(sch, cl);
+#else
if (!refcnt) {
nss_qdisc_error("Reference count should not be zero for class %px\n", cl);
}
-
+#endif
return 0;
}
@@ -634,6 +643,11 @@ static int nss_bf_change_qdisc(struct Qd
*/
static void nss_bf_reset_class(struct nss_bf_class_data *cl)
{
+ if (cl->qdisc == &noop_qdisc) {
+ nss_qdisc_trace("Class %x has no child qdisc to reset\n", cl->nq.qos_tag);
+ return;
+ }
+
nss_qdisc_reset(cl->qdisc);
nss_qdisc_info("Nssbf class resetted %px\n", cl->qdisc);
}
--- a/nss_qdisc/nss_htb.c
+++ b/nss_qdisc/nss_htb.c
@@ -1,6 +1,6 @@
/*
**************************************************************************
- * Copyright (c) 2014-2017, 2019-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2017, 2019-2021, The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
@@ -574,10 +574,16 @@ static int nss_htb_delete_class(struct Q
/*
* If we are root class, we dont have to update our parent.
* We simply deduct refcnt and return.
+ * For 5.4 and above kernels, calling nss_htb_destroy_class
+ * explicitly as there is no put_class which would have called
+ * nss_htb_destroy_class when refcnt becomes zero.
*/
if (!cl->parent) {
refcnt = nss_qdisc_atomic_sub_return(&cl->nq);
sch_tree_unlock(sch);
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0))
+ nss_htb_destroy_class(sch, cl);
+#endif
return 0;
}
@@ -596,6 +602,14 @@ static int nss_htb_delete_class(struct Q
refcnt = nss_qdisc_atomic_sub_return(&cl->nq);
sch_tree_unlock(sch);
+ /*
+ * For 5.4 and above kernels, calling nss_htb_destroy_class
+ * explicitly as there is no put_class which would have called
+ * nss_htb_destroy_class when refcnt becomes zero.
+ */
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0))
+ nss_htb_destroy_class(sch, cl);
+#endif
return 0;
}
@@ -898,6 +912,11 @@ static int nss_htb_change_qdisc(struct Q
*/
static void nss_htb_reset_class(struct nss_htb_class_data *cl)
{
+ if (cl->qdisc == &noop_qdisc) {
+ nss_qdisc_trace("Class %x has no child qdisc to reset\n", cl->nq.qos_tag);
+ return;
+ }
+
nss_qdisc_reset(cl->qdisc);
nss_qdisc_trace("htb class %x reset\n", cl->nq.qos_tag);
}
--- a/nss_qdisc/nss_qdisc.c
+++ b/nss_qdisc/nss_qdisc.c
@@ -30,9 +30,6 @@
void *nss_qdisc_ctx; /* Shaping context for nss_qdisc */
-#define NSS_QDISC_COMMAND_TIMEOUT (10*HZ) /* We set 10sec to be the command */
- /* timeout value for messages */
-
/*
* Defines related to root hash maintenance
*/
@@ -40,6 +37,53 @@ void *nss_qdisc_ctx; /* Shaping contex
#define NSS_QDISC_ROOT_HASH_MASK (NSS_QDISC_ROOT_HASH_SIZE - 1)
/*
+ * nss_qdisc_get_interface_msg()
+ * Returns the correct message that needs to be sent down to the NSS interface.
+ */
+int nss_qdisc_get_interface_msg(bool is_bridge, uint32_t msg_type)
+{
+ /*
+ * We re-assign the message based on whether this is for the I shaper
+ * or the B shaper. The is_bridge flag tells if we are on a bridge interface.
+ */
+ if (is_bridge) {
+ switch (msg_type) {
+ case NSS_QDISC_IF_SHAPER_ASSIGN:
+ return NSS_IF_BSHAPER_ASSIGN;
+ case NSS_QDISC_IF_SHAPER_UNASSIGN:
+ return NSS_IF_BSHAPER_UNASSIGN;
+ case NSS_QDISC_IF_SHAPER_CONFIG:
+ return NSS_IF_BSHAPER_CONFIG;
+ default:
+ nss_qdisc_info("Unknown message type for a bridge - type %d", msg_type);
+ return -1;
+ }
+ } else {
+ switch (msg_type) {
+ case NSS_QDISC_IF_SHAPER_ASSIGN:
+ return NSS_IF_ISHAPER_ASSIGN;
+ case NSS_QDISC_IF_SHAPER_UNASSIGN:
+ return NSS_IF_ISHAPER_UNASSIGN;
+ case NSS_QDISC_IF_SHAPER_CONFIG:
+ return NSS_IF_ISHAPER_CONFIG;
+ default:
+ nss_qdisc_info("Unknown message type for an interface - type %d", msg_type);
+ return -1;
+ }
+ }
+}
+
+/*
+ * nss_qdisc_msg_init()
+ * Initialize the qdisc specific message
+ */
+void nss_qdisc_msg_init(struct nss_if_msg *nim, uint16_t if_num, uint32_t msg_type, uint32_t len,
+ nss_if_msg_callback_t cb, void *app_data)
+{
+ nss_cmn_msg_init(&nim->cm, if_num, msg_type, len, (void *)cb, app_data);
+}
+
+/*
* nss_qdisc_interface_is_virtual()
* Return true if it is redirect or bridge interface.
*/
@@ -122,53 +166,6 @@ static int nss_qdisc_ppe_init(struct Qdi
#endif
/*
- * nss_qdisc_msg_init()
- * Initialize the qdisc specific message
- */
-static void nss_qdisc_msg_init(struct nss_if_msg *nim, uint16_t if_num, uint32_t msg_type, uint32_t len,
- nss_if_msg_callback_t cb, void *app_data)
-{
- nss_cmn_msg_init(&nim->cm, if_num, msg_type, len, (void*)cb, app_data);
-}
-
-/*
- * nss_qdisc_get_interface_msg()
- * Returns the correct message that needs to be sent down to the NSS interface.
- */
-static inline int nss_qdisc_get_interface_msg(bool is_bridge, uint32_t msg_type)
-{
- /*
- * We re-assign the message based on whether this is for the I shaper
- * or the B shaper. The is_bridge flag tells if we are on a bridge interface.
- */
- if (is_bridge) {
- switch(msg_type) {
- case NSS_QDISC_IF_SHAPER_ASSIGN:
- return NSS_IF_BSHAPER_ASSIGN;
- case NSS_QDISC_IF_SHAPER_UNASSIGN:
- return NSS_IF_BSHAPER_UNASSIGN;
- case NSS_QDISC_IF_SHAPER_CONFIG:
- return NSS_IF_BSHAPER_CONFIG;
- default:
- nss_qdisc_info("Unknown message type for a bridge - type %d", msg_type);
- return -1;
- }
- } else {
- switch(msg_type) {
- case NSS_QDISC_IF_SHAPER_ASSIGN:
- return NSS_IF_ISHAPER_ASSIGN;
- case NSS_QDISC_IF_SHAPER_UNASSIGN:
- return NSS_IF_ISHAPER_UNASSIGN;
- case NSS_QDISC_IF_SHAPER_CONFIG:
- return NSS_IF_ISHAPER_CONFIG;
- default:
- nss_qdisc_info("Unknown message type for an interface - type %d", msg_type);
- return -1;
- }
- }
-}
-
-/*
* nss_qdisc_attach_bshaper_callback()
* Call back funtion for bridge shaper attach to an interface.
*/
@@ -613,7 +610,6 @@ static void nss_qdisc_root_cleanup_free_
nss_qdisc_info("Root qdisc %px (type %d) free SUCCESS - response "
"type: %d\n", nq->qdisc, nq->type,
nim->msg.shaper_configure.config.response_type);
-
nss_qdisc_root_cleanup_shaper_unassign(nq);
}
@@ -1168,8 +1164,15 @@ unsigned int nss_qdisc_drop(struct Qdisc
*/
void nss_qdisc_reset(struct Qdisc *sch)
{
- struct nss_qdisc *nq = qdisc_priv(sch);
+ struct nss_qdisc *nq;
+ if(!(sch->flags & TCQ_F_NSS)) {
+ qdisc_reset_queue(sch);
+ nss_qdisc_info("Qdisc %px resetting non NSS qdisc\n", sch);
+ return;
+ }
+
+ nq = qdisc_priv(sch);
nss_qdisc_info("Qdisc %px (type %d) resetting\n",
sch, nq->type);
@@ -1891,6 +1894,7 @@ int nss_qdisc_configure(struct nss_qdisc
return 0;
}
+
/*
* nss_qdisc_register_configure_callback()
* Register shaper configure callback, which gets invoked on receiving a response.
@@ -2117,6 +2121,8 @@ int __nss_qdisc_init(struct Qdisc *sch,
*/
if ((sch->parent == TC_H_ROOT) && (!nq->is_class)) {
nss_qdisc_info("Qdisc %px (type %d) is root\n", nq->qdisc, nq->type);
+ nss_qdisc_info("Qdisc %px dev-name %s qdisc_dev(sch)->qdisc %px, qdisc_dev(sch)->qdisc->handle %x\n", qdisc_dev(sch), qdisc_dev(sch)->name, qdisc_dev(sch)->qdisc, qdisc_dev(sch)->qdisc->handle);
+ nss_qdisc_info("Qdisc %px (sch %px) is root, sch->handle %x\n", nq->qdisc, sch, sch->handle);
nq->is_root = true;
root = sch;
} else {
--- a/nss_qdisc/nss_qdisc.h
+++ b/nss_qdisc/nss_qdisc.h
@@ -1,6 +1,6 @@
/*
**************************************************************************
- * Copyright (c) 2014-2018, 2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2018, 2020-2021 The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
@@ -41,6 +41,9 @@
#define NSS_QDISC_DEBUG_LEVEL_INFO 3
#define NSS_QDISC_DEBUG_LEVEL_TRACE 4
+#define NSS_QDISC_COMMAND_TIMEOUT (10*HZ) /* We set 10sec to be the command */
+ /* timeout value for messages */
+
/*
* Debug message for module init and exit
*/
@@ -486,3 +489,15 @@ extern unsigned long nss_qdisc_tcf_bind(
* Unbind the filter from the qdisc.
*/
extern void nss_qdisc_tcf_unbind(struct Qdisc *sch, unsigned long arg);
+
+/*
+ * nss_qdisc_get_interface_msg()
+ * Returns the correct message that needs to be sent down to the NSS interface.
+ */
+extern int nss_qdisc_get_interface_msg(bool is_bridge, uint32_t msg_type);
+
+/*
+ * nss_qdisc_msg_init()
+ * Initialize the qdisc specific message
+ */
+extern void nss_qdisc_msg_init(struct nss_if_msg *nim, uint16_t if_num, uint32_t msg_type, uint32_t len, nss_if_msg_callback_t cb, void *app_data);
--- a/nss_qdisc/nss_wrr.c
+++ b/nss_qdisc/nss_wrr.c
@@ -1,6 +1,6 @@
/*
**************************************************************************
- * Copyright (c) 2014-2017, 2019-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2017, 2019-2021, The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
@@ -442,10 +442,19 @@ static int nss_wrr_delete_class(struct Q
refcnt = nss_qdisc_atomic_sub_return(&cl->nq);
sch_tree_unlock(sch);
+
+ /*
+ * For 5.4 and above kernels, calling nss_htb_destroy_class
+ * explicitly as there is no put_class which would have called
+ * nss_wrr_destroy_class when refcnt becomes zero.
+ */
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0))
+ nss_wrr_destroy_class(sch, cl);
+#else
if (!refcnt) {
nss_qdisc_error("Reference count should not be zero for class %px\n", cl);
}
-
+#endif
return 0;
}
@@ -764,6 +773,11 @@ static int nss_wrr_change_qdisc(struct Q
static void nss_wrr_reset_class(struct nss_wrr_class_data *cl)
{
+ if (cl->qdisc == &noop_qdisc) {
+ nss_qdisc_trace("Class %x has no child qdisc to reset\n", cl->nq.qos_tag);
+ return;
+ }
+
nss_qdisc_reset(cl->qdisc);
nss_qdisc_info("Nsswrr class resetted %px\n", cl->qdisc);
}

View File

@ -0,0 +1,303 @@
--- a/bridge/nss_bridge_mgr.c
+++ b/bridge/nss_bridge_mgr.c
@@ -1,9 +1,12 @@
/*
**************************************************************************
* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ *
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
+ *
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
@@ -49,6 +52,11 @@ static bool ovs_enabled = false;
static struct nss_bridge_mgr_context br_mgr_ctx;
/*
+ * Module parameter to enable/disable FDB learning.
+ */
+static bool fdb_disabled = false;
+
+/*
* nss_bridge_mgr_create_instance()
* Create a bridge instance.
*/
@@ -415,6 +423,37 @@ static int nss_bridge_mgr_del_bond_slave
}
/*
+ * nss_bridge_mgr_bond_fdb_join()
+ * Update FDB state when a bond interface joining bridge.
+ */
+static int nss_bridge_mgr_bond_fdb_join(struct nss_bridge_pvt *b_pvt)
+{
+ /*
+ * If already other bond devices are attached to bridge,
+ * only increment bond_slave_num,
+ */
+ spin_lock(&br_mgr_ctx.lock);
+ if (b_pvt->bond_slave_num) {
+ b_pvt->bond_slave_num++;
+ spin_unlock(&br_mgr_ctx.lock);
+ return NOTIFY_DONE;
+ }
+ b_pvt->bond_slave_num = 1;
+ spin_unlock(&br_mgr_ctx.lock);
+
+ /*
+ * This is the first bond device being attached to bridge. In order to enforce Linux
+ * bond slave selection in bridge flows involving bond interfaces, we need to disable
+ * fdb learning on this bridge master to allow flow based bridging.
+ */
+ if (nss_bridge_mgr_disable_fdb_learning(b_pvt) < 0) {
+ return NOTIFY_BAD;
+ }
+
+ return NOTIFY_DONE;
+}
+
+/*
* nss_bridge_mgr_bond_master_join()
* Add a bond interface to bridge
*/
@@ -447,28 +486,7 @@ static int nss_bridge_mgr_bond_master_jo
}
}
- /*
- * If already other bond devices are attached to bridge,
- * only increment bond_slave_num,
- */
- spin_lock(&br_mgr_ctx.lock);
- if (b_pvt->bond_slave_num) {
- b_pvt->bond_slave_num++;
- spin_unlock(&br_mgr_ctx.lock);
- return NOTIFY_DONE;
- }
- spin_unlock(&br_mgr_ctx.lock);
-
- /*
- * This is the first bond device being attached to bridge. In order to enforce Linux
- * bond slave selection in bridge flows involving bond interfaces, we need to disable
- * fdb learning on this bridge master to allow flow based bridging.
- */
- if (!nss_bridge_mgr_disable_fdb_learning(b_pvt)) {
- spin_lock(&br_mgr_ctx.lock);
- b_pvt->bond_slave_num = 1;
- spin_unlock(&br_mgr_ctx.lock);
-
+ if (nss_bridge_mgr_bond_fdb_join(b_pvt) == NOTIFY_DONE) {
return NOTIFY_DONE;
}
@@ -488,6 +506,41 @@ cleanup:
}
/*
+ * nss_bridge_mgr_bond_fdb_leave()
+ * Update FDB state when a bond interface leaving bridge.
+ */
+static int nss_bridge_mgr_bond_fdb_leave(struct nss_bridge_pvt *b_pvt)
+{
+
+ nss_bridge_mgr_assert(b_pvt->bond_slave_num == 0);
+
+ /*
+ * If more than one bond devices are attached to bridge,
+ * only decrement the bond_slave_num
+ */
+ spin_lock(&br_mgr_ctx.lock);
+ if (b_pvt->bond_slave_num > 1) {
+ b_pvt->bond_slave_num--;
+ spin_unlock(&br_mgr_ctx.lock);
+ return NOTIFY_DONE;
+ }
+ b_pvt->bond_slave_num = 0;
+ spin_unlock(&br_mgr_ctx.lock);
+
+ /*
+ * The last bond interface is removed from bridge, we can switch back to FDB
+ * learning mode.
+ */
+ if (!fdb_disabled && (nss_bridge_mgr_enable_fdb_learning(b_pvt) < 0)) {
+ nss_bridge_mgr_warn("%px: Failed to enable fdb learning. fdb_disabled: %d\n", b_pvt, fdb_disabled);
+ return NOTIFY_BAD;
+ }
+
+ return NOTIFY_DONE;
+}
+
+
+/*
* nss_bridge_mgr_bond_master_leave()
* Remove a bond interface from bridge
*/
@@ -516,27 +569,7 @@ static int nss_bridge_mgr_bond_master_le
}
}
- /*
- * If more than one bond devices are attached to bridge,
- * only decrement the bond_slave_num
- */
- spin_lock(&br_mgr_ctx.lock);
- if (b_pvt->bond_slave_num > 1) {
- b_pvt->bond_slave_num--;
- spin_unlock(&br_mgr_ctx.lock);
- return NOTIFY_DONE;
- }
- spin_unlock(&br_mgr_ctx.lock);
-
- /*
- * The last bond interface is removed from bridge, we can switch back to FDB
- * learning mode.
- */
- if (!nss_bridge_mgr_enable_fdb_learning(b_pvt)) {
- spin_lock(&br_mgr_ctx.lock);
- b_pvt->bond_slave_num = 0;
- spin_unlock(&br_mgr_ctx.lock);
-
+ if (nss_bridge_mgr_bond_fdb_leave(b_pvt) == NOTIFY_DONE) {
return NOTIFY_DONE;
}
@@ -803,9 +836,10 @@ int nss_bridge_mgr_join_bridge(struct ne
}
/*
- * Add the bond_master to bridge.
+ * Update FDB state of the bridge. No need to add individual interfaces of bond to the bridge.
+ * VLAN interface verifies that all interfaces are physical so, no need to verify again.
*/
- if (nss_bridge_mgr_bond_master_join(real_dev, br) != NOTIFY_DONE) {
+ if (nss_bridge_mgr_bond_fdb_join(br) != NOTIFY_DONE) {
nss_bridge_mgr_warn("%px: Slaves of bond interface %s join bridge failed\n", br, real_dev->name);
nss_bridge_tx_leave_msg(br->ifnum, dev);
nss_vlan_mgr_leave_bridge(dev, br->vsi);
@@ -905,9 +939,10 @@ int nss_bridge_mgr_leave_bridge(struct n
}
/*
- * Remove the bond_master from bridge.
+ * Update FDB state of the bridge. No need to add individual interfaces of bond to the bridge.
+ * VLAN interface verifies that all interfaces are physical so, no need to verify again.
*/
- if (nss_bridge_mgr_bond_master_leave(real_dev, br) != NOTIFY_DONE) {
+ if (nss_bridge_mgr_bond_fdb_leave(br) != NOTIFY_DONE) {
nss_bridge_mgr_warn("%px: Slaves of bond interface %s leave bridge failed\n", br, real_dev->name);
nss_vlan_mgr_join_bridge(dev, br->vsi);
nss_bridge_tx_join_msg(br->ifnum, dev);
@@ -1017,44 +1052,45 @@ int nss_bridge_mgr_register_br(struct ne
b_pvt->dev = dev;
+#if defined(NSS_BRIDGE_MGR_PPE_SUPPORT)
+ err = ppe_vsi_alloc(NSS_BRIDGE_MGR_SWITCH_ID, &vsi_id);
+ if (err) {
+ nss_bridge_mgr_warn("%px: failed to alloc bridge vsi, error = %d\n", b_pvt, err);
+ goto fail;
+ }
+
+ b_pvt->vsi = vsi_id;
+#endif
+
ifnum = nss_dynamic_interface_alloc_node(NSS_DYNAMIC_INTERFACE_TYPE_BRIDGE);
if (ifnum < 0) {
nss_bridge_mgr_warn("%px: failed to alloc bridge di\n", b_pvt);
- nss_bridge_mgr_delete_instance(b_pvt);
- return -EFAULT;
+ goto fail_1;
}
if (!nss_bridge_register(ifnum, dev, NULL, NULL, 0, b_pvt)) {
nss_bridge_mgr_warn("%px: failed to register bridge di to NSS\n", b_pvt);
- goto fail;
+ goto fail_2;
}
#if defined(NSS_BRIDGE_MGR_PPE_SUPPORT)
- err = ppe_vsi_alloc(NSS_BRIDGE_MGR_SWITCH_ID, &vsi_id);
- if (err) {
- nss_bridge_mgr_warn("%px: failed to alloc bridge vsi, error = %d\n", b_pvt, err);
- goto fail_1;
- }
-
- b_pvt->vsi = vsi_id;
-
err = nss_bridge_tx_vsi_assign_msg(ifnum, vsi_id);
if (err != NSS_TX_SUCCESS) {
nss_bridge_mgr_warn("%px: failed to assign vsi msg, error = %d\n", b_pvt, err);
- goto fail_2;
+ goto fail_3;
}
#endif
err = nss_bridge_tx_set_mac_addr_msg(ifnum, dev->dev_addr);
if (err != NSS_TX_SUCCESS) {
nss_bridge_mgr_warn("%px: failed to set mac_addr msg, error = %d\n", b_pvt, err);
- goto fail_3;
+ goto fail_4;
}
err = nss_bridge_tx_set_mtu_msg(ifnum, dev->mtu);
if (err != NSS_TX_SUCCESS) {
nss_bridge_mgr_warn("%px: failed to set mtu msg, error = %d\n", b_pvt, err);
- goto fail_3;
+ goto fail_4;
}
/*
@@ -1076,31 +1112,35 @@ int nss_bridge_mgr_register_br(struct ne
* Disable FDB learning if OVS is enabled for
* all bridges (including Linux bridge).
*/
- if (ovs_enabled) {
+ if (ovs_enabled || fdb_disabled) {
nss_bridge_mgr_disable_fdb_learning(b_pvt);
}
#endif
return 0;
-fail_3:
+fail_4:
#if defined(NSS_BRIDGE_MGR_PPE_SUPPORT)
if (nss_bridge_tx_vsi_unassign_msg(ifnum, vsi_id) != NSS_TX_SUCCESS) {
nss_bridge_mgr_warn("%px: failed to unassign vsi\n", b_pvt);
}
-
-fail_2:
- ppe_vsi_free(NSS_BRIDGE_MGR_SWITCH_ID, vsi_id);
-
-fail_1:
+fail_3:
#endif
+
nss_bridge_unregister(ifnum);
-fail:
+fail_2:
if (nss_dynamic_interface_dealloc_node(ifnum, NSS_DYNAMIC_INTERFACE_TYPE_BRIDGE) != NSS_TX_SUCCESS) {
nss_bridge_mgr_warn("%px: failed to dealloc bridge di\n", b_pvt);
}
+fail_1:
+#if defined(NSS_BRIDGE_MGR_PPE_SUPPORT)
+ ppe_vsi_free(NSS_BRIDGE_MGR_SWITCH_ID, vsi_id);
+fail:
+#endif
+
nss_bridge_mgr_delete_instance(b_pvt);
+
return -EFAULT;
}
@@ -1626,3 +1666,6 @@ MODULE_DESCRIPTION("NSS bridge manager")
module_param(ovs_enabled, bool, 0644);
MODULE_PARM_DESC(ovs_enabled, "OVS bridge is enabled");
+
+module_param(fdb_disabled, bool, 0644);
+MODULE_PARM_DESC(fdb_disabled, "fdb learning is disabled");

View File

@ -0,0 +1,51 @@
commit 2396944e41307a90e9159107fd225e44980a5b2f
Author: Cemil Coskun <quic_ccoskun@quicinc.com>
AuthorDate: Tue Aug 9 21:25:13 2022 -0700
Commit: Cemil Coskun <quic_ccoskun@quicinc.com>
CommitDate: Tue Aug 9 21:27:58 2022 -0700
[qca-nss-clients] In capwapmgr use source MAC address
Currently, interface MAC address is used while sending packets in capwapmgr.
Update that to use the MAC address in the rule.
Change-Id: I2ba9df7beab39a9584a1159db3a3f3c337c219aa
Signed-off-by: Cemil Coskun <quic_ccoskun@quicinc.com>
--- a/capwapmgr/nss_capwapmgr.c
+++ b/capwapmgr/nss_capwapmgr.c
@@ -1,9 +1,12 @@
/*
**************************************************************************
* Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
+ *
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
+ *
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
@@ -866,6 +869,10 @@ static nss_tx_status_t nss_capwapmgr_cre
memcpy(nircm->conn_rule.return_mac, unic->dest_mac, 6);
}
+ nircm->valid_flags |= NSS_IPV4_RULE_CREATE_SRC_MAC_VALID;
+ nircm->src_mac_rule.mac_valid_flags |=NSS_IPV4_SRC_MAC_FLOW_VALID;
+ memcpy(nircm->src_mac_rule.flow_src_mac, nircm->conn_rule.return_mac, 6);
+
/*
* Copy over the DSCP rule parameters
*/
@@ -1001,6 +1008,10 @@ static nss_tx_status_t nss_capwapmgr_cre
memcpy(nircm->conn_rule.return_mac, unic->dest_mac, 6);
nircm->valid_flags |= NSS_IPV6_RULE_CREATE_CONN_VALID;
+ nircm->valid_flags |= NSS_IPV6_RULE_CREATE_SRC_MAC_VALID;
+ nircm->src_mac_rule.mac_valid_flags |=NSS_IPV6_SRC_MAC_FLOW_VALID;
+ memcpy(nircm->src_mac_rule.flow_src_mac, nircm->conn_rule.return_mac, 6);
+
/*
* Copy over the DSCP rule parameters
*/

View File

@ -0,0 +1,169 @@
--- a/map/map-t/nss_connmgr_map_t.c
+++ b/map/map-t/nss_connmgr_map_t.c
@@ -531,7 +531,7 @@ static void nss_connmgr_map_t_decap_exce
/*
* nss_connmgr_map_t_encap_exception()
* Exception handler registered to NSS for handling map_t ipv4 pkts
- * Translates ipv4 packet back to ipv6 and send to nat46 device directly.
+ * Send the translated ipv4 packets to the stack directly.
*/
static void nss_connmgr_map_t_encap_exception(struct net_device *dev,
struct sk_buff *skb,
@@ -539,23 +539,7 @@ static void nss_connmgr_map_t_encap_exce
{
struct iphdr *ip4_hdr;
- struct ipv6hdr *ip6_hdr;
- uint8_t v6saddr[16], v6daddr[16];
- struct tcphdr *tcph = NULL;
- struct udphdr *udph = NULL;
- struct iphdr ip4_hdr_r;
- __be16 sport, dport;
- uint8_t nexthdr, hop_limit, tos;
- int payload_len;
- bool df_bit = false;
- uint16_t append_hdr_sz = 0;
- uint16_t identifier;
- uint32_t l4_csum, orig_csum;
- uint16_t csum;
- /*
- * Discard L2 header.
- */
skb_pull(skb, sizeof(struct ethhdr));
skb_reset_mac_header(skb);
skb_reset_network_header(skb);
@@ -563,123 +547,24 @@ static void nss_connmgr_map_t_encap_exce
ip4_hdr = ip_hdr(skb);
skb_set_transport_header(skb, ip4_hdr->ihl * 4);
- if (ip4_hdr->protocol == IPPROTO_TCP) {
- tcph = tcp_hdr(skb);
- l4_csum = tcph->check;
- sport = tcph->source;
- dport = tcph->dest;
- } else if (ip4_hdr->protocol == IPPROTO_UDP) {
- udph = udp_hdr(skb);
- orig_csum = l4_csum = udph->check;
- sport = udph->source;
- dport = udph->dest;
- } else {
- nss_connmgr_map_t_warning("%px: Unsupported protocol, free it up\n", dev);
- dev_kfree_skb_any(skb);
- return;
- }
-
- /*
- * Undo the checksum of the IPv4 source and destinationIPv4 address.
- */
- csum = ip_compute_csum(&ip4_hdr->saddr, 2 * sizeof(ip4_hdr->saddr));
- l4_csum += ((~csum) & 0xFFFF);
-
- /*`
- * IPv6 packet is xlated to ipv4 packet by acceleration engine. But there is no ipv4 rule.
- * Call xlate_4_to_6() [ which is exported by nat46.ko ] to find original ipv6 src and ipv6 dest address.
- * These functions is designed for packets from lan to wan. Since this packet is from wan, need to call
- * this function with parameters reversed. ipv4_hdr_r is used for reversing ip addresses.
- */
- ip4_hdr_r.daddr = ip4_hdr->saddr;
- ip4_hdr_r.saddr = ip4_hdr->daddr;
-
- if (unlikely(!xlate_4_to_6(dev, &ip4_hdr_r, dport, sport, v6saddr, v6daddr))) { /* exception happened after packet got xlated */
- nss_connmgr_map_t_warning("%px: Martian ipv4 packet !!..free it. (saddr = 0x%x daddr = 0x%x sport = %d dport = %d)\n", dev,\
- ip4_hdr->saddr, ip4_hdr->daddr, sport, dport);
- dev_kfree_skb_any(skb);
- return;
- }
-
- nexthdr = ip4_hdr->protocol;
- payload_len = ntohs(ip4_hdr->tot_len) - sizeof(struct iphdr);
- hop_limit = ip4_hdr->ttl;
- tos = ip4_hdr->tos;
- identifier = ntohs(ip4_hdr->id);
-
- if (ip4_hdr->frag_off & htons(IP_DF)) {
- df_bit = true;
- } else if (map_t_flags & MAPT_FLAG_ADD_DUMMY_HDR) {
- append_hdr_sz = sizeof(struct frag_hdr);
- }
-
- if (!pskb_may_pull(skb, sizeof(struct ipv6hdr) + append_hdr_sz - sizeof(struct iphdr))) {
- nss_connmgr_map_t_warning("%px: Not enough headroom for ipv6 packet...Freeing the packet\n", dev);
- dev_kfree_skb_any(skb);
- return;
- }
-
- skb_push(skb, sizeof(struct ipv6hdr) + append_hdr_sz - sizeof(struct iphdr));
- skb_reset_network_header(skb);
- skb_reset_mac_header(skb);
-
- skb->protocol = htons(ETH_P_IPV6);
-
- ip6_hdr = ipv6_hdr(skb);
- memset(ip6_hdr, 0, sizeof(struct ipv6hdr));
-
- ip6_hdr->version = 6;
- ip6_hdr->payload_len = htons(payload_len + append_hdr_sz);
- ip6_hdr->hop_limit = hop_limit;
-
- nss_connmgr_map_t_ipv6_set_tclass(ip6_hdr, tos);
- memcpy(&ip6_hdr->daddr, v6saddr, sizeof(struct in6_addr));
- memcpy(&ip6_hdr->saddr, v6daddr, sizeof(struct in6_addr));
-
- if (unlikely(df_bit) || !(map_t_flags & MAPT_FLAG_ADD_DUMMY_HDR)) {
- ip6_hdr->nexthdr = nexthdr;
- } else {
- struct frag_hdr tmp_fh, *fh;
- const __be32 *fh_addr = skb_header_pointer(skb, sizeof(struct ipv6hdr), sizeof(struct frag_hdr), &tmp_fh);
- if (!fh_addr) {
- nss_connmgr_map_t_warning("%px: Not able to offset to frag header\n", dev);
- dev_kfree_skb_any(skb);
- return;
- }
- fh = (struct frag_hdr *)fh_addr;
- memset(fh, 0, sizeof(struct frag_hdr));
- fh->identification = htonl(identifier);
- fh->nexthdr = nexthdr;
- ip6_hdr->nexthdr = NEXTHDR_FRAGMENT;
- }
-
- skb_set_transport_header(skb, sizeof(struct ipv6hdr) + append_hdr_sz);
-
/*
- * Add the checksum of the IPv6 source and destination address.
+ * IP Header checksum is not generated yet, calculate it now.
*/
- l4_csum += ip_compute_csum(ip6_hdr->saddr.s6_addr16, 2 * sizeof(ip6_hdr->saddr));
- /*
- * Fold the 32 bits checksum to 16 bits
- */
- l4_csum = (l4_csum & 0x0000FFFF) + (l4_csum >> 16);
- l4_csum = (l4_csum & 0x0000FFFF) + (l4_csum >> 16);
-
- if (nexthdr == IPPROTO_TCP) {
- tcph->check = (uint16_t)l4_csum;
- } else {
- udph->check = (orig_csum == 0)? 0:(uint16_t)l4_csum;
- }
+ ip4_hdr->check = 0;
+ ip4_hdr->check = ip_fast_csum((unsigned char *)ip4_hdr, ip4_hdr->ihl);
+ skb->protocol = htons(ETH_P_IP);
skb->pkt_type = PACKET_HOST;
skb->skb_iif = dev->ifindex;
skb->ip_summed = CHECKSUM_NONE;
skb->dev = dev;
- nss_connmgr_map_t_trace("%p: ipv4 packet exceptioned after v6 ---> v4 xlate, created original ipv6 packet\n", dev);
- nss_connmgr_map_t_trace("%p: Calculted ipv6 params: src_addr=%pI6, dest_addr=%pI6, payload_len=%d, checksum=%x\n", dev, v6saddr, v6daddr, payload_len, l4_csum);
-
- dev_queue_xmit(skb);
+ nss_connmgr_map_t_trace("%px: ipv4 packet exceptioned after v6/v4xlat src=%pI4 dest=%pI4 proto=%d\n",
+ dev, &ip4_hdr->saddr, &ip4_hdr->daddr, ip4_hdr->protocol);
+ /*
+ * Go through Linux network stack.
+ */
+ netif_receive_skb(skb);
return;
}

View File

@ -0,0 +1,92 @@
--- a/match/nss_match_l2.c
+++ b/match/nss_match_l2.c
@@ -1,6 +1,7 @@
/*
*******************************************************************************
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -133,7 +134,7 @@ static int nss_match_l2_cmd_parse(char *
struct nss_ctx_instance *nss_ctx = nss_match_get_context();
int ret = 0;
uint32_t mask_val[4] = {0};
- uint32_t actions = 0, if_num = 0, setprio = 0, nexthop = 0;
+ uint32_t actions = 0, if_num = 0, setprio = NSS_MAX_NUM_PRI, nexthop = 0;
uint16_t smac[3] = {0}, dmac[3] = {0}, mask_id = 0, ethertype = 0;
uint8_t mac_addr_tmp[6];
char tmp[4];
@@ -340,22 +341,22 @@ static int nss_match_l2_cmd_parse(char *
switch(actions) {
case NSS_MATCH_ACTION_SETPRIO:
- if (nexthop || !setprio || setprio >= NSS_MAX_NUM_PRI) {
+ if (nexthop || setprio >= NSS_MAX_NUM_PRI) {
goto fail;
}
break;
case NSS_MATCH_ACTION_FORWARD:
- if (setprio || !nexthop) {
+ if (!(setprio == NSS_MAX_NUM_PRI) || !nexthop) {
goto fail;
}
break;
case NSS_MATCH_ACTION_SETPRIO | NSS_MATCH_ACTION_FORWARD:
- if (!setprio || !nexthop || setprio >= NSS_MAX_NUM_PRI) {
+ if (!nexthop || setprio >= NSS_MAX_NUM_PRI) {
goto fail;
}
break;
case NSS_MATCH_ACTION_DROP:
- if (setprio || nexthop) {
+ if (!(setprio == NSS_MAX_NUM_PRI) || nexthop) {
goto fail;
}
break;
--- a/match/nss_match_vow.c
+++ b/match/nss_match_vow.c
@@ -1,6 +1,6 @@
/*
*******************************************************************************
- * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -122,7 +122,7 @@ static int nss_match_vow_cmd_parse(char
char *token, *param, *value;
struct nss_ctx_instance *nss_ctx = nss_match_get_context();
int ret = 0;
- uint32_t actions = 0, if_num = 0, dscp = 0, outer_prio = 0, inner_prio = 0, setprio = 0, nexthop = 0;
+ uint32_t actions = 0, if_num = 0, dscp = 0, outer_prio = 0, inner_prio = 0, setprio = NSS_MAX_NUM_PRI, nexthop = 0;
uint16_t mask_id = 0;
uint32_t mask_val = 0;
@@ -301,22 +301,22 @@ static int nss_match_vow_cmd_parse(char
switch(actions) {
case NSS_MATCH_ACTION_SETPRIO:
- if (nexthop || !setprio || setprio >= NSS_MAX_NUM_PRI) {
+ if (nexthop || setprio >= NSS_MAX_NUM_PRI) {
goto fail;
}
break;
case NSS_MATCH_ACTION_FORWARD:
- if (setprio || !nexthop) {
+ if (!(setprio == NSS_MAX_NUM_PRI) || !nexthop) {
goto fail;
}
break;
case NSS_MATCH_ACTION_SETPRIO | NSS_MATCH_ACTION_FORWARD:
- if (!setprio || !nexthop || setprio >= NSS_MAX_NUM_PRI) {
+ if (!nexthop || setprio >= NSS_MAX_NUM_PRI) {
goto fail;
}
break;
case NSS_MATCH_ACTION_DROP:
- if (setprio || nexthop) {
+ if (!(setprio == NSS_MAX_NUM_PRI) || nexthop) {
goto fail;
}
break;

Some files were not shown because too many files have changed in this diff Show More