summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/marvell/prestera
AgeCommit message (Collapse)AuthorFilesLines
2022-09-01net: ethernet: move from strlcpy with unused retval to strscpyWolfram Sang1-2/+2
Follow the advice of the below link and prefer 'strscpy' in this subsystem. Conversion is 1:1 because the return value is not used. Generated by a coccinelle script. Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/ Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Petr Machata <petrm@nvidia.com> # For drivers/net/ethernet/mellanox/mlxsw Acked-by: Geoff Levand <geoff@infradead.org> # For ps3_gelic_net and spider_net_ethtool Acked-by: Tom Lendacky <thomas.lendacky@amd.com> # For drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c Acked-by: Marcin Wojtas <mw@semihalf.com> # For drivers/net/ethernet/marvell/mvpp2 Reviewed-by: Leon Romanovsky <leonro@nvidia.com> # For drivers/net/ethernet/mellanox/mlx{4|5} Reviewed-by: Shay Agroskin <shayagr@amazon.com> # For drivers/net/ethernet/amazon/ena Acked-by: Krzysztof Hałasa <khalasa@piap.pl> # For IXP4xx Ethernet Link: https://lore.kernel.org/r/20220830201457.7984-3-wsa+renesas@sang-engineering.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-08-26net: prestera: manage matchall and flower prioritiesMaksym Glubokiy8-0/+163
matchall rules can be added only to chain 0 and their priorities have limitations: - new matchall ingress rule's priority must be higher (lower value) than any existing flower rule; - new matchall egress rule's priority must be lower (higher value) than any existing flower rule. The opposite works for flower rule adding: - new flower ingress rule's priority must be lower (higher value) than any existing matchall rule; - new flower egress rule's priority must be higher (lower value) than any existing matchall rule. This is a hardware limitation and thus must be properly handled in driver by reporting errors to the user when newly added rule has such a priority that cannot be installed into the hardware. To achieve this, the driver must maintain both min/max matchall priorities for every flower block when user adds/deletes a matchall rule, as well as both min/max flower priorities for chain 0 for every adding/deletion of flower rules for chain 0. Cc: Serhiy Boiko <serhiy.boiko@plvision.eu> Signed-off-by: Maksym Glubokiy <maksym.glubokiy@plvision.eu> Signed-off-by: David S. Miller <davem@davemloft.net>
2022-08-26net: prestera: add support for egress traffic mirroringSerhiy Boiko5-19/+39
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>
2022-08-26net: prestera: acl: extract matchall logic into a separate fileSerhiy Boiko6-66/+96
This commit adds more clarity to handling of TC_CLSMATCHALL_REPLACE and TC_CLSMATCHALL_DESTROY events by calling newly added *_mall_*() handlers instead of directly calling SPAN API. This also extracts matchall rules management out of SPAN API since SPAN is a hardware module which is used to implement 'matchall egress mirred' action only. Signed-off-by: Taras Chornyi <tchornyi@marvell.com> 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>
2022-08-24net: marvell: prestera: implement br_port_locked flag offloadingOleksandr Mazur5-1/+34
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>
2022-08-22net: prestera: cache port state for non-phylink ports tooMaksym Glubokiy1-19/+17
Port event data must stored to port-state cache regardless of whether the port uses phylink or not since this data is used by ethtool. Fixes: 52323ef75414 ("net: marvell: prestera: add phylink support") Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu> Signed-off-by: Maksym Glubokiy <maksym.glubokiy@plvision.eu> Signed-off-by: David S. Miller <davem@davemloft.net>
2022-08-20net: prestera: add missing ABI compatibility checkMaksym Glubokiy1-0/+1
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>
2022-08-02net: marvell: prestera: remove reduntant codeSebin Sebastian1-1/+1
Fixes the coverity warning 'EVALUATION_ORDER' violation. port is written twice with the same value. Signed-off-by: Sebin Sebastian <mailmesebin00@gmail.com> Link: https://lore.kernel.org/r/20220801040731.34741-1-mailmesebin00@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-07-30net: marvell: prestera: uninitialized variable bugDan Carpenter1-1/+1
The "ret" variable needs to be initialized at the start. Fixes: 52323ef75414 ("net: marvell: prestera: add phylink support") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/YuKeBBuGtsmd7QdT@kili Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-07-22net: marvell: prestera: use netif_is_any_bridge_port instead of open codeJuhee Kang1-2/+2
The open code which is netif_is_bridge_port() || netif_is_ovs_port() is defined as a new helper function on netdev.h like netif_is_any_bridge_port that can check both IFF flags in 1 go. So use netif_is_any_bridge_port() function instead of open code. This patch doesn't change logic. Signed-off-by: Juhee Kang <claudiajkang@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2022-07-21Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netJakub Kicinski1-3/+3
No conflicts. Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-07-20net: marvell: prestera: add phylink supportOleksandr Mazur5-62/+334
For SFP port prestera driver will use kernel phylink infrastucture to configure port mode based on the module that has beed inserted Co-developed-by: Yevhen Orlov <yevhen.orlov@plvision.eu> Signed-off-by: Yevhen Orlov <yevhen.orlov@plvision.eu> Co-developed-by: Taras Chornyi <taras.chornyi@plvision.eu> Signed-off-by: Taras Chornyi <taras.chornyi@plvision.eu> Signed-off-by: Oleksandr Mazur <oleksandr.mazur@plvision.eu> Signed-off-by: David S. Miller <davem@davemloft.net>
2022-07-19net: prestera: acl: add support for 'police' action on egressMaksym Glubokiy1-1/+1
Propagate ingress/egress direction for 'police' action down to hardware. Co-developed-by: Volodymyr Mytnyk <volodymyr.mytnyk@plvision.eu> Signed-off-by: Volodymyr Mytnyk <volodymyr.mytnyk@plvision.eu> Signed-off-by: Maksym Glubokiy <maksym.glubokiy@plvision.eu> Link: https://lore.kernel.org/r/20220714083541.1973919-1-maksym.glubokiy@plvision.eu Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2022-07-19net: prestera: acl: fix code formattingMaksym Glubokiy1-4/+4
Make the code look better. Signed-off-by: Maksym Glubokiy <maksym.glubokiy@plvision.eu> Link: https://lore.kernel.org/r/20220715103806.7108-1-maksym.glubokiy@plvision.eu Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-07-18net: prestera: acl: use proper mask for port selectorMaksym Glubokiy1-3/+3
Adjusted as per packet processor documentation. This allows to properly match 'indev' for clsact rules. Fixes: 47327e198d42 ("net: prestera: acl: migrate to new vTCAM api") Signed-off-by: Maksym Glubokiy <maksym.glubokiy@plvision.eu> Signed-off-by: David S. Miller <davem@davemloft.net>
2022-07-15Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netJakub Kicinski1-0/+1
include/net/sock.h 310731e2f161 ("net: Fix data-races around sysctl_mem.") e70f3c701276 ("Revert "net: set SK_MEM_QUANTUM to 4096"") https://lore.kernel.org/all/20220711120211.7c8b7cba@canb.auug.org.au/ net/ipv4/fib_semantics.c 747c14307214 ("ip: fix dflt addr selection for connected nexthop") d62607c3fe45 ("net: rename reference+tracking helpers") net/tls/tls.h include/net/tls.h 3d8c51b25a23 ("net/tls: Check for errors in tls_device_init") 587903142308 ("tls: create an internal header") Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-07-13net: prestera: add support for port range filtersMaksym Glubokiy1-0/+24
This adds support for port-range rules: $ tc qdisc add ... clsact $ tc filter add ... flower ... src_port <PMIN>-<PMAX> ... Co-developed-by: Volodymyr Mytnyk <volodymyr.mytnyk@plvision.eu> Signed-off-by: Volodymyr Mytnyk <volodymyr.mytnyk@plvision.eu> Signed-off-by: Maksym Glubokiy <maksym.glubokiy@plvision.eu> Signed-off-by: David S. Miller <davem@davemloft.net>
2022-07-13net: marvell: prestera: implement software MDB entries allocationOleksandr Mazur3-2/+635
Define bridge MDB entry (software entry): - entry that get's created upon receiving MDB management events (create/delete), that inherently defines a software entry, which can be enabled (offloaded to the HW) or disabled (removed from HW). This separation is done to achieve a better highlevel management of HW resources - software MDB entry could exist, while it's not necessarily should be configured on the HW. For example: by default, the Linux behavior would not replicate multicast traffic to multicast group members if there's no active multicast router and thus - no actual multicast traffic can be received/sent. So, until multicast router appears on the system no HW configuration should be applied, although SW MDB entries should be tracked. Another example would be altering state of 'multicast enabled' on the bridge: MC_DISABLED should invoke disabling / clearing multicast groups of specified bridge on the HW, yet upon receiving 'multicast enabled' event, driver should reconfigure any existing software MDB groups on the HW. Keeping track of software MDB entries in such way makes it possible to properly react on such events. Define bridge MDB port entry (software entry): - entry that helps keeping track (on software - driver - level) of which bridge mebemer interface joined any give MDB group; 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>
2022-07-13net: marvell: prestera: define and implement MDB / flood domain API for ↵Oleksandr Mazur2-0/+163
entries creation and deletion Define and implement prestera API calls for managing MDB and flood domain (ports) entries (create / delete / find calls). 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>
2022-07-13net: marvell: prestera: define MDB/flood domain entries and HW API to ↵Oleksandr Mazur4-0/+259
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>
2022-07-13net: marvell: prestera: rework bridge flags settingOleksandr Mazur5-89/+67
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>
2022-07-12net: marvell: prestera: fix missed deinit sequenceYevhen Orlov1-0/+1
Add unregister_fib_notifier as rollback of register_fib_notifier. Fixes: 4394fbcb78cf ("net: marvell: prestera: handle fib notifications") Signed-off-by: Yevhen Orlov <yevhen.orlov@plvision.eu> Link: https://lore.kernel.org/r/20220710122021.7642-1-yevhen.orlov@plvision.eu Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2022-06-29net: prestera: acl: add support for 'egress' rulesMaksym Glubokiy7-34/+82
The following is now supported: $ tc qdisc add PORT clsact $ tc filter add dev PORT egress ... Signed-off-by: Maksym Glubokiy <maksym.glubokiy@plvision.eu> Signed-off-by: David S. Miller <davem@davemloft.net>
2022-05-22net: marvell: prestera: fix typo in commentJulia Lawall1-1/+1
Spelling mistake (triple letters) in comment. Detected with the help of Coccinelle. Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr> Signed-off-by: David S. Miller <davem@davemloft.net>
2022-04-29net: prestera: add police action supportVolodymyr Mytnyk5-2/+149
- 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>
2022-04-12net: marvell: prestera: Use dscp_t in struct prestera_kern_fib_cacheGuillaume Nault1-3/+3
Use the new dscp_t type to replace the kern_tos field of struct prestera_kern_fib_cache. This ensures ECN bits are ignored and makes it compatible with the dscp fields of struct fib_entry_notifier_info and struct fib_rt_info. This also allows sparse to flag potential incorrect uses of DSCP and ECN bits. Signed-off-by: Guillaume Nault <gnault@redhat.com> Reviewed-by: Yevhen Orlov <yevhen.orlov@plvision.eu> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-04-12ipv4: Use dscp_t in struct fib_entry_notifier_infoGuillaume Nault1-3/+3
Use the new dscp_t type to replace the tos field of struct fib_entry_notifier_info. This ensures ECN bits are ignored and makes it compatible with the dscp field of struct fib_rt_info. This also allows sparse to flag potential incorrect uses of DSCP and ECN bits. Signed-off-by: Guillaume Nault <gnault@redhat.com> Reviewed-by: Ido Schimmel <idosch@nvidia.com> Reviewed-by: David Ahern <dsahern@kernel.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-04-12ipv4: Use dscp_t in struct fib_rt_infoGuillaume Nault1-1/+2
Use the new dscp_t type to replace the tos field of struct fib_rt_info. This ensures ECN bits are ignored and makes it compatible with the fa_dscp field of struct fib_alias. This also allows sparse to flag potential incorrect uses of DSCP and ECN bits. Signed-off-by: Guillaume Nault <gnault@redhat.com> Reviewed-by: Ido Schimmel <idosch@nvidia.com> Reviewed-by: David Ahern <dsahern@kernel.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-04-07prestera: acl: add action hw_stats supportVolodymyr Mytnyk2-7/+18
Currently, when user adds a tc action and the action gets offloaded, the user expects the HW stats to be counted also. This limits the amount of supported offloaded filters, as HW counter resources may be quite limited. Without counter assigned, the HW is capable to carry much more filters. To resolve the issue above, the following types of HW stats are offloaded and supported by the driver: any - current default, user does not care about the type. delayed - polled from HW periodically. disabled - no HW stats needed. immediate - not supported. Example: tc filter add dev PORT ingress proto ip flower skip_sw ip_proto 0x11 \ action drop tc filter add dev PORT ingress proto ip flower skip_sw ip_proto 0x12 \ action drop hw_stats disabled tc filter add dev sw1p1 ingress proto ip flower skip_sw ip_proto 0x14 \ action drop hw_stats delayed Signed-off-by: Volodymyr Mytnyk <vmytnyk@marvell.com> Link: https://lore.kernel.org/r/1649164814-18731-1-git-send-email-volodymyr.mytnyk@plvision.eu Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-03-23net: marvell: prestera: add missing destroy_workqueue() in ↵Yang Yingliang1-1/+3
prestera_module_init() Add the missing destroy_workqueue() before return from prestera_module_init() in the error handling case. Fixes: 4394fbcb78cf ("net: marvell: prestera: handle fib notifications") Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20220322090236.1439649-1-yangyingliang@huawei.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-03-11Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netJakub Kicinski1-0/+1
net/dsa/dsa2.c commit afb3cc1a397d ("net: dsa: unlock the rtnl_mutex when dsa_master_setup() fails") commit e83d56537859 ("net: dsa: replay master state events in dsa_tree_{setup,teardown}_master") https://lore.kernel.org/all/20220307101436.7ae87da0@canb.auug.org.au/ drivers/net/ethernet/intel/ice/ice.h commit 97b0129146b1 ("ice: Fix error with handling of bonding MTU") commit 43113ff73453 ("ice: add TTY for GNSS module for E810T device") https://lore.kernel.org/all/20220310112843.3233bcf1@canb.auug.org.au/ drivers/staging/gdm724x/gdm_lte.c commit fc7f750dc9d1 ("staging: gdm724x: fix use after free in gdm_lte_rx()") commit 4bcc4249b4cf ("staging: Use netif_rx().") https://lore.kernel.org/all/20220308111043.1018a59d@canb.auug.org.au/ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-03-09net: marvell: prestera: Add missing of_node_put() in ↵Miaoqian Lin1-0/+1
prestera_switch_set_base_mac_addr This node pointer is returned by of_find_compatible_node() with refcount incremented. Calling of_node_put() to aovid the refcount leak. Fixes: 501ef3066c89 ("net: marvell: prestera: Add driver for Prestera family ASIC devices") Signed-off-by: Miaoqian Lin <linmq006@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2022-03-09net: prestera: acl: make read-only array client_map static constColin Ian King1-1/+1
Don't populate the read-only array client_map on the stack but instead make it static const. Also makes the object code a little smaller. Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Link: https://lore.kernel.org/r/20220307221349.164585-1-colin.i.king@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-02-25net: marvell: prestera: Fix return value check in prestera_kern_fib_cache_find()Yang Yingliang1-1/+1
rhashtable_lookup_fast() returns NULL pointer not ERR_PTR(), so it can return fib_node directly in prestera_kern_fib_cache_find(). Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20220223084954.1771075-2-yangyingliang@huawei.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-02-25net: marvell: prestera: Fix return value check in prestera_fib_node_find()Yang Yingliang1-1/+1
rhashtable_lookup_fast() returns NULL pointer not ERR_PTR(), so it can return fib_node directly in prestera_fib_node_find(). Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20220223084954.1771075-1-yangyingliang@huawei.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-02-19net: prestera: acl: fix 'client_map' buff overflowVolodymyr Mytnyk1-1/+1
smatch warnings: drivers/net/ethernet/marvell/prestera/prestera_acl.c:103 prestera_acl_chain_to_client() error: buffer overflow 'client_map' 3 <= 3 prestera_acl_chain_to_client(u32 chain_index, ...) ... u32 client_map[] = { PRESTERA_HW_COUNTER_CLIENT_LOOKUP_0, PRESTERA_HW_COUNTER_CLIENT_LOOKUP_1, PRESTERA_HW_COUNTER_CLIENT_LOOKUP_2 }; if (chain_index > ARRAY_SIZE(client_map)) ... Fixes: fa5d824ce5dd ("net: prestera: acl: add multi-chain support offload") Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Volodymyr Mytnyk <vmytnyk@marvell.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2022-02-19net: prestera: flower: fix destroy tmpl in chainVolodymyr Mytnyk1-9/+19
Fix flower destroy template callback to release template only for specific tc chain instead of all chain tempaltes. The issue was intruduced by previous commit that introduced multi-chain support. Fixes: fa5d824ce5dd ("net: prestera: acl: add multi-chain support offload") Signed-off-by: Volodymyr Mytnyk <vmytnyk@marvell.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2022-02-17net: marvell: prestera: handle fib notificationsYevhen Orlov3-0/+427
For now we support only TRAP or DROP, so we can offload only "local" or "blackhole" routes. Nexthop routes is TRAP for now. Will be implemented 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>
2022-02-17net: marvell: prestera: add hardware router objects accounting for lpmYevhen Orlov3-7/+170
Add new router_hw object "fib_node". For now it support only DROP and TRAP mode. 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>
2022-02-17net: marvell: prestera: Add router LPM ABIYevhen Orlov2-0/+55
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>
2022-02-14net: prestera: acl: add multi-chain support offloadVolodymyr Mytnyk7-39/+203
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>
2022-01-12net: marvell: prestera: Fix deinit sequence for routerYevhen Orlov4-2/+10
* Add missed call prestera_router_fini in prestera_switch_fini * Add prestera_router_hw_fini, which verify lists are empty Fixes: 69204174cc5c ("net: marvell: prestera: Add prestera router infra") Signed-off-by: Yevhen Orlov <yevhen.orlov@plvision.eu> Link: https://lore.kernel.org/r/20220111011129.5457-1-yevhen.orlov@plvision.eu Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-01-12net: marvell: prestera: Refactor router functionsYevhen Orlov3-12/+14
* 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>
2022-01-12net: marvell: prestera: Refactor get/put VR functionsYevhen Orlov2-17/+17
* Use refcount, instead of uint * Increment/decrement recount inside get/put * Fix error path in __prestera_vr_create. Remove unnecessary kfree. * Make __prestera_vr_destroy symmetric to "create" Fixes: bca5859bc6c6 ("net: marvell: prestera: add hardware router objects accounting") Signed-off-by: Yevhen Orlov <yevhen.orlov@plvision.eu> Link: https://lore.kernel.org/r/20220111011014.4418-1-yevhen.orlov@plvision.eu Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-01-12net: marvell: prestera: Cleanup router structYevhen Orlov1-1/+0
Field "aborted" was added in 69204174cc5c ("net: marvell: prestera: Add prestera router infra"). It will not be used. So remove. Signed-off-by: Yevhen Orlov <yevhen.orlov@plvision.eu> Link: https://lore.kernel.org/r/20220111010826.3779-1-yevhen.orlov@plvision.eu Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2021-12-30net: marvell: prestera: Implement initial inetaddr notifiersYevhen Orlov1-0/+40
Add inetaddr notifiers to support add/del IPv4 address on switchdev port. We create TRAP on first address, added on port and delete TRAP, when last address removed. Currently, driver supports only regular port to became routed. Other port type support will be added later 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>
2021-12-30net: marvell: prestera: Register inetaddr stub notifiersYevhen Orlov3-1/+110
Initial implementation of notification handlers. For now this is just stub. So that we can move forward and add prestera_router_hw's objects manipulations. We support several addresses on interface. We just have nothing to do for second address, because rif is already enabled on this interface, after first one. 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>
2021-12-30net: marvell: prestera: add hardware router objects accountingYevhen Orlov4-1/+255
Add prestera_router_hw.c. This file contains functions, which track HW objects relations and links. This include implicity creation of objects, that needed by requested one and implicity removing of objects, which reference counter is became zero. We need this layer, because kernel callbacks not always mapped to creation of single HW object. So let it be two different layers - one for subscribing and parsing kernel structures, and another (prestera_router_hw.c) for HW objects relations tracking. There is two types of objects on router_hw layer: - Explicit objects (rif_entry) : created by higher layer. - Implicit objects (vr) : created on demand by explicit objects. 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>
2021-12-30net: marvell: prestera: Add prestera router infraYevhen Orlov4-1/+46
Add prestera_router.c, which contains code to subscribe/unsubscribe on kernel notifiers for router. This handle kernel notifications, parse structures to make key to manipulate prestera_router_hw's objects. Also prestera_router is container for router's objects database. 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>
2021-12-30net: marvell: prestera: Add router interface ABIYevhen Orlov3-0/+127
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>