#
86348d21 |
| 12-May-2024 |
Erick Archer <erick.archer@outlook.com> |
net: prestera: Add flex arrays to some structs
The "struct prestera_msg_vtcam_rule_add_req" uses a dynamically sized set of trailing elements. Specifically, it uses an array of structures of type "p
net: prestera: Add flex arrays to some structs
The "struct prestera_msg_vtcam_rule_add_req" uses a dynamically sized set of trailing elements. Specifically, it uses an array of structures of type "prestera_msg_acl_action actions_msg".
The "struct prestera_msg_flood_domain_ports_set_req" also uses a dynamically sized set of trailing elements. Specifically, it uses an array of structures of type "prestera_msg_acl_action actions_msg".
So, use the preferred way in the kernel declaring flexible arrays [1].
At the same time, prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). In this case, it is important to note that the attribute used is specifically __counted_by_le since the counters are of type __le32.
The logic does not need to change since the counters for the flexible arrays are asigned before any access to the arrays.
The order in which the structure prestera_msg_vtcam_rule_add_req and the structure prestera_msg_flood_domain_ports_set_req are defined must be changed to avoid incomplete type errors.
Also, avoid the open-coded arithmetic in memory allocator functions [2] using the "struct_size" macro.
Moreover, the new structure members also allow us to avoid the open- coded arithmetic on pointers. So, take advantage of this refactoring accordingly.
This code was detected with the help of Coccinelle, and audited and modified manually.
Link: https://www.kernel.org/doc/html/next/process/deprecated.html#zero-length-and-one-element-arrays [1] Link: https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments [2] Signed-off-by: Erick Archer <erick.archer@outlook.com> Reviewed-by: Simon Horman <horms@kernel.org> Reviewed-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/AS8PR02MB7237E8469568A59795F1F0408BE12@AS8PR02MB7237.eurprd02.prod.outlook.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
#
0a23ae23 |
| 01-Oct-2022 |
Yevhen Orlov <yevhen.orlov@plvision.eu> |
net: marvell: prestera: Add router nexthops ABI
- Add functions to allocate/delete/set nexthop group - NOTE: non-ECMP nexthop is nexthop group with allocated size = 1 - Add function to read state
net: marvell: prestera: Add router nexthops ABI
- Add functions to allocate/delete/set nexthop group - NOTE: non-ECMP nexthop is nexthop group with allocated size = 1 - Add function to read state of HW nh (if packets going through it)
Co-developed-by: Taras Chornyi <tchornyi@marvell.com> Signed-off-by: Taras Chornyi <tchornyi@marvell.com> Co-developed-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu> Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu> Signed-off-by: Yevhen Orlov <yevhen.orlov@plvision.eu> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
#
8c448c2b |
| 23-Aug-2022 |
Serhiy Boiko <serhiy.boiko@plvision.eu> |
net: prestera: add support for egress traffic mirroring
This enables adding matchall rules for egress:
tc filter add .. egress .. matchall skip_sw \ action mirred egress mirror dev ..
Signed
net: prestera: add support for egress traffic mirroring
This enables adding matchall rules for egress:
tc filter add .. egress .. matchall skip_sw \ action mirred egress mirror dev ..
Signed-off-by: Serhiy Boiko <serhiy.boiko@plvision.eu> Signed-off-by: Maksym Glubokiy <maksym.glubokiy@plvision.eu> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
#
73ef239c |
| 22-Aug-2022 |
Oleksandr Mazur <oleksandr.mazur@plvision.eu> |
net: marvell: prestera: implement br_port_locked flag offloading
Both <port> br_port_locked and <lag> interfaces's flag offloading is supported. No new ABI is being added, rather existing (port_para
net: marvell: prestera: implement br_port_locked flag offloading
Both <port> br_port_locked and <lag> interfaces's flag offloading is supported. No new ABI is being added, rather existing (port_param_set) API call gets extended.
Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu>
V2: add missing receipents (linux-kernel, netdev) Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
#
917edfb9 |
| 18-Aug-2022 |
Maksym Glubokiy <maksym.glubokiy@plvision.eu> |
net: prestera: add missing ABI compatibility check
Size-check a type used for FW communication is packed as expected.
Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu> Signed-off-by: Mak
net: prestera: add missing ABI compatibility check
Size-check a type used for FW communication is packed as expected.
Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu> Signed-off-by: Maksym Glubokiy <maksym.glubokiy@plvision.eu> Link: https://lore.kernel.org/r/20220818111419.414877-1-maksym.glubokiy@plvision.eu Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
#
fec7c9c7 |
| 11-Jul-2022 |
Oleksandr Mazur <oleksandr.mazur@plvision.eu> |
net: marvell: prestera: define MDB/flood domain entries and HW API to offload them to the HW
Define MDB entry that can be offloaded: - FDB entry, that defines an multicast group to which traffic c
net: marvell: prestera: define MDB/flood domain entries and HW API to offload them to the HW
Define MDB entry that can be offloaded: - FDB entry, that defines an multicast group to which traffic can be replicated to; Define flood domain: - Arrangement of ports (list), that have joined multicast group, which would receive and replicate to multicast traffic of specified group; Define flood domain port: - single flood domain list entry, that is associated with any given bridge port interface (could be LAG interface or physical port-member). Applicable to both Q and D bridges;
Co-developed-by: Yevhen Orlov <yevhen.orlov@plvision.eu> Signed-off-by: Yevhen Orlov <yevhen.orlov@plvision.eu> Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
#
116f5af7 |
| 11-Jul-2022 |
Oleksandr Mazur <oleksandr.mazur@plvision.eu> |
net: marvell: prestera: rework bridge flags setting
Separate flags to make it possible to alter them separately; Move bridge flags setting logic from HW API level to prestera_main where it belongs
net: marvell: prestera: rework bridge flags setting
Separate flags to make it possible to alter them separately; Move bridge flags setting logic from HW API level to prestera_main where it belongs; Move bridge flags parsing (and setting using prestera API) to prestera_switchdev.c - module responsible for bridge operations handling;
Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
#
dde2daa0 |
| 27-Apr-2022 |
Volodymyr Mytnyk <volodymyr.mytnyk@plvision.eu> |
net: prestera: add police action support
- Add HW api to configure policer: - SR TCM policer mode is only supported for now. - Policer ingress/egress direction support. - Add police action suppo
net: prestera: add police action support
- Add HW api to configure policer: - SR TCM policer mode is only supported for now. - Policer ingress/egress direction support. - Add police action support into flower
Signed-off-by: Volodymyr Mytnyk <volodymyr.mytnyk@plvision.eu> Link: https://lore.kernel.org/r/1651061148-21321-1-git-send-email-volodymyr.mytnyk@plvision.eu Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
#
19787b93 |
| 16-Feb-2022 |
Yevhen Orlov <yevhen.orlov@plvision.eu> |
net: marvell: prestera: Add router LPM ABI
Add functions to create/delete lpm entry in hw. prestera_hw_lpm_add() take index of allocated virtual router. Also it takes grp_id, which is index of alloc
net: marvell: prestera: Add router LPM ABI
Add functions to create/delete lpm entry in hw. prestera_hw_lpm_add() take index of allocated virtual router. Also it takes grp_id, which is index of allocated nexthop group. ABI to create nexthop group will be added soon.
Co-developed-by: Taras Chornyi <tchornyi@marvell.com> Signed-off-by: Taras Chornyi <tchornyi@marvell.com> Co-developed-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu> Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu> Signed-off-by: Yevhen Orlov <yevhen.orlov@plvision.eu> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
#
fa5d824c |
| 14-Feb-2022 |
Volodymyr Mytnyk <vmytnyk@marvell.com> |
net: prestera: acl: add multi-chain support offload
Add support of rule offloading added to the non-zero index chain, which was previously forbidden. Also, goto action is offloaded allowing to jump
net: prestera: acl: add multi-chain support offload
Add support of rule offloading added to the non-zero index chain, which was previously forbidden. Also, goto action is offloaded allowing to jump for processing of desired chain.
Note that only implicit chain 0 is bound to the device port(s) for processing. The rest of chains have to be jumped by actions.
Signed-off-by: Volodymyr Mytnyk <vmytnyk@marvell.com> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
#
32d098bb |
| 11-Jan-2022 |
Yevhen Orlov <yevhen.orlov@plvision.eu> |
net: marvell: prestera: Refactor router functions
* Reverse xmas tree variables order * User friendly messages on error paths * Refactor __prestera_inetaddr_event to use early return
Signed-off-by:
net: marvell: prestera: Refactor router functions
* Reverse xmas tree variables order * User friendly messages on error paths * Refactor __prestera_inetaddr_event to use early return
Signed-off-by: Yevhen Orlov <yevhen.orlov@plvision.eu> Link: https://lore.kernel.org/r/20220111011051.4941-1-yevhen.orlov@plvision.eu Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
#
0f07bd6b |
| 27-Dec-2021 |
Yevhen Orlov <yevhen.orlov@plvision.eu> |
net: marvell: prestera: Add router interface ABI
Add functions to enable routing on port, which is not in vlan. Also we can enable routing on vlan. prestera_hw_rif_create() take index of allocated v
net: marvell: prestera: Add router interface ABI
Add functions to enable routing on port, which is not in vlan. Also we can enable routing on vlan. prestera_hw_rif_create() take index of allocated virtual router.
Co-developed-by: Taras Chornyi <tchornyi@marvell.com> Signed-off-by: Taras Chornyi <tchornyi@marvell.com> Co-developed-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu> Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu> Signed-off-by: Yevhen Orlov <yevhen.orlov@plvision.eu> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
#
6d1b3eb5 |
| 27-Dec-2021 |
Yevhen Orlov <yevhen.orlov@plvision.eu> |
net: marvell: prestera: add virtual router ABI
Add functions and structures to allocate virtual router. prestera_hw_vr_create() return index of allocated VR so that we can move forward and also add
net: marvell: prestera: add virtual router ABI
Add functions and structures to allocate virtual router. prestera_hw_vr_create() return index of allocated VR so that we can move forward and also add another objects (e.g. router interface), which has link to VR.
Co-developed-by: Taras Chornyi <tchornyi@marvell.com> Signed-off-by: Taras Chornyi <tchornyi@marvell.com> Co-developed-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu> Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu> Signed-off-by: Yevhen Orlov <yevhen.orlov@plvision.eu> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
#
01081be1 |
| 04-Dec-2021 |
José Expósito <jose.exposito89@gmail.com> |
net: prestera: replace zero-length array with flexible-array member
One-element and zero-length arrays are deprecated and should be replaced with flexible-array members: https://www.kernel.org/doc/h
net: prestera: replace zero-length array with flexible-array member
One-element and zero-length arrays are deprecated and should be replaced with flexible-array members: https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays
Replace zero-length array with flexible-array member and make use of the struct_size() helper.
Link: https://github.com/KSPP/linux/issues/78 Signed-off-by: José Expósito <jose.exposito89@gmail.com> Reviewed-by: Volodymyr Mytnyk <vmytnyk@marvell.com> Tested-by: Volodymyr Mytnyk <vmytnyk@marvell.com> Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org> Link: https://lore.kernel.org/r/20211204171349.22776-1-jose.exposito89@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
#
6e36c7bc |
| 30-Nov-2021 |
Volodymyr Mytnyk <vmytnyk@marvell.com> |
net: prestera: add counter HW API
Add counter API for getting HW statistics.
- HW statistics gathered by this API are deleyed. - Batch of conters is supported. - acl stat is supported.
Co-develope
net: prestera: add counter HW API
Add counter API for getting HW statistics.
- HW statistics gathered by this API are deleyed. - Batch of conters is supported. - acl stat is supported.
Co-developed-by: Serhiy Boiko <serhiy.boiko@marvell.com> Signed-off-by: Serhiy Boiko <serhiy.boiko@marvell.com> Signed-off-by: Volodymyr Mytnyk <vmytnyk@marvell.com> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
#
47327e19 |
| 30-Nov-2021 |
Volodymyr Mytnyk <vmytnyk@marvell.com> |
net: prestera: acl: migrate to new vTCAM api
- Add new vTCAM HW API to configure HW ACLs. - Migrate acl to use new vTCAM HW API. - No counter support in this patch-set.
Co-developed-by: Yevhen Orlo
net: prestera: acl: migrate to new vTCAM api
- Add new vTCAM HW API to configure HW ACLs. - Migrate acl to use new vTCAM HW API. - No counter support in this patch-set.
Co-developed-by: Yevhen Orlov <yevhen.orlov@plvision.eu> Signed-off-by: Yevhen Orlov <yevhen.orlov@plvision.eu> Signed-off-by: Volodymyr Mytnyk <vmytnyk@marvell.com> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
#
e1464db5 |
| 05-Nov-2021 |
Volodymyr Mytnyk <vmytnyk@marvell.com> |
net: marvell: prestera: fix hw structure laid out
The prestera FW v4.0 support commit has been merged accidentally w/o review comments addressed and waiting for the final patch set to be uploaded. S
net: marvell: prestera: fix hw structure laid out
The prestera FW v4.0 support commit has been merged accidentally w/o review comments addressed and waiting for the final patch set to be uploaded. So, fix the remaining comments related to structure laid out and build issues.
Reported-by: kernel test robot <lkp@intel.com> Fixes: bb5dbf2cc64d ("net: marvell: prestera: add firmware v4.0 support") Signed-off-by: Volodymyr Mytnyk <vmytnyk@marvell.com> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
#
a46a5036 |
| 04-Nov-2021 |
Volodymyr Mytnyk <vmytnyk@marvell.com> |
net: marvell: prestera: fix patchwork build problems
fix the remaining build issues reported by patchwork in firmware v4.0 support commit which has been already merged.
Fix patchwork issues: - sou
net: marvell: prestera: fix patchwork build problems
fix the remaining build issues reported by patchwork in firmware v4.0 support commit which has been already merged.
Fix patchwork issues: - source inline - checkpatch
Fixes: bb5dbf2cc64d ("net: marvell: prestera: add firmware v4.0 support") Signed-off-by: Volodymyr Mytnyk <vmytnyk@marvell.com> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
#
236f57fe |
| 02-Nov-2021 |
Geert Uytterhoeven <geert@linux-m68k.org> |
net: marvell: prestera: Add explicit padding
On m68k:
In function ‘prestera_hw_build_tests’, inlined from ‘prestera_hw_switch_init’ at drivers/net/ethernet/marvell/prestera/prestera_hw.c:788:2
net: marvell: prestera: Add explicit padding
On m68k:
In function ‘prestera_hw_build_tests’, inlined from ‘prestera_hw_switch_init’ at drivers/net/ethernet/marvell/prestera/prestera_hw.c:788:2: ././include/linux/compiler_types.h:335:38: error: call to ‘__compiletime_assert_345’ declared with attribute error: BUILD_BUG_ON failed: sizeof(struct prestera_msg_switch_attr_req) != 16 ...
The driver assumes structure members are naturally aligned, but does not add explicit padding, thus breaking architectures where integral values are not always naturally aligned (e.g. on m68k, __alignof(int) is 2, not 4).
Fixes: bb5dbf2cc64d5cfa ("net: marvell: prestera: add firmware v4.0 support") Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/r/20211102082433.3820514-1-geert@linux-m68k.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
|
#
bb5dbf2c |
| 29-Oct-2021 |
Volodymyr Mytnyk <vmytnyk@marvell.com> |
net: marvell: prestera: add firmware v4.0 support
Add firmware (FW) version 4.0 support for Marvell Prestera driver.
Major changes have been made to new v4.0 FW ABI to add support of new features,
net: marvell: prestera: add firmware v4.0 support
Add firmware (FW) version 4.0 support for Marvell Prestera driver.
Major changes have been made to new v4.0 FW ABI to add support of new features, introduce the stability of the FW ABI and ensure better forward compatibility for the future driver vesrions.
Current v4.0 FW feature set support does not expect any changes to ABI, as it was defined and tested through long period of time. The ABI may be extended in case of new features, but it will not break the backward compatibility.
ABI major changes done in v4.0: - L1 ABI, where MAC and PHY API configuration are split. - ACL has been split to low-level TCAM and Counters ABI to provide more HW ACL capabilities for future driver versions.
To support backward support, the addition compatibility layer is required in the driver which will have two different codebase under "if FW-VER elif FW-VER else" conditions that will be removed in the future anyway, So, the idea was to break backward support and focus on more stable FW instead of supporting old version with very minimal and limited set of features/capabilities.
Improve FW msg validation: * Use __le64, __le32, __le16 types in msg to/from FW to catch endian mismatch by sparse. * Use BUILD_BUG_ON for structures sent/recv to/from FW.
Co-developed-by: Vadym Kochan <vkochan@marvell.com> Signed-off-by: Vadym Kochan <vkochan@marvell.com> Signed-off-by: Yevhen Orlov <yevhen.orlov@plvision.eu> Signed-off-by: Taras Chornyi <tchornyi@marvell.com> Signed-off-by: Volodymyr Mytnyk <vmytnyk@marvell.com> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
#
13defa27 |
| 16-Jun-2021 |
Serhiy Boiko <serhiy.boiko@plvision.eu> |
net: marvell: prestera: Add matchall support
- Introduce matchall filter support - Add SPAN API to configure port mirroring. - Add tc mirror action.
At this moment, only mirror (egress) action is s
net: marvell: prestera: Add matchall support
- Introduce matchall filter support - Add SPAN API to configure port mirroring. - Add tc mirror action.
At this moment, only mirror (egress) action is supported.
Example: tc filter ... action mirred egress mirror dev DEV
Co-developed-by: Volodymyr Mytnyk <vmytnyk@marvell.com> Signed-off-by: Volodymyr Mytnyk <vmytnyk@marvell.com> Signed-off-by: Serhiy Boiko <serhiy.boiko@plvision.eu> Signed-off-by: Vadym Kochan <vkochan@marvell.com> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
#
8b474a9f |
| 16-Jun-2021 |
Serhiy Boiko <serhiy.boiko@plvision.eu> |
net: marvell: Implement TC flower offload
Add ACL infrastructure for Prestera Switch ASICs family devices to offload cls_flower rules to be processed in the HW.
ACL implementation is based on tc fi
net: marvell: Implement TC flower offload
Add ACL infrastructure for Prestera Switch ASICs family devices to offload cls_flower rules to be processed in the HW.
ACL implementation is based on tc filter api. The flower classifier is supported to configure ACL rules/matches/action.
Supported actions:
- drop - trap - pass
Supported dissector keys:
- indev - src_mac - dst_mac - src_ip - dst_ip - ip_proto - src_port - dst_port - vlan_id - vlan_ethtype - icmp type/code
Co-developed-by: Volodymyr Mytnyk <vmytnyk@marvell.com> Signed-off-by: Volodymyr Mytnyk <vmytnyk@marvell.com> Signed-off-by: Serhiy Boiko <serhiy.boiko@plvision.eu> Signed-off-by: Vadym Kochan <vkochan@marvell.com> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
#
a80cf955 |
| 14-Jun-2021 |
Oleksandr Mazur <oleksandr.mazur@plvision.eu> |
net: marvell: prestera: devlink: add traps with DROP action
Add traps that have init_action being set to DROP. Add 'trap_drop_counter_get' (devlink API) callback implementation, that is used to get
net: marvell: prestera: devlink: add traps with DROP action
Add traps that have init_action being set to DROP. Add 'trap_drop_counter_get' (devlink API) callback implementation, that is used to get number of packets that have been dropped by the HW (traps with action 'DROP'). Add new FW command CPU_CODE_COUNTERS_GET.
Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
#
255213ca |
| 10-Jun-2021 |
Serhiy Boiko <serhiy.boiko@plvision.eu> |
net: marvell: prestera: add LAG support
The following features are supported:
- LAG basic operations - create/delete LAG - add/remove a member to LAG - enable/disable me
net: marvell: prestera: add LAG support
The following features are supported:
- LAG basic operations - create/delete LAG - add/remove a member to LAG - enable/disable member in LAG - LAG Bridge support - LAG VLAN support - LAG FDB support
Limitations:
- Only HASH lag tx type is supported - The Hash parameters are not configurable. They are applied during the LAG creation stage. - Enslaving a port to the LAG device that already has an upper device is not supported.
Co-developed-by: Andrii Savka <andrii.savka@plvision.eu> Signed-off-by: Andrii Savka <andrii.savka@plvision.eu> Signed-off-by: Serhiy Boiko <serhiy.boiko@plvision.eu> Co-developed-by: Vadym Kochan <vkochan@marvell.com> Signed-off-by: Vadym Kochan <vkochan@marvell.com> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|
#
c00e8a69 |
| 31-May-2021 |
Vadym Kochan <vkochan@marvell.com> |
net: marvell: prestera: align flood setting according to latest firmware version
Latest FW IPC flood message format was changed to configure uc/mc flooding separately, so change code according to th
net: marvell: prestera: align flood setting according to latest firmware version
Latest FW IPC flood message format was changed to configure uc/mc flooding separately, so change code according to this.
Signed-off-by: Vadym Kochan <vkochan@marvell.com> Signed-off-by: David S. Miller <davem@davemloft.net>
show more ...
|