Introduce sssnic PMD for 3SNIC's 9x0 serials Ethernet adapters
Subsystems (2)
v4 cover Introduce sssnic PMD for 3SNIC's 9x0 serials Ethernet adapters
From: Renyong Wan <[email protected]>
The sssnic PMD (**librte_pmd_sssnic**) provides poll mode driver support for 3SNIC 9x0 serials family of Ethernet adapters.
Supported NICs are:
- 3S910 Dual Port SFP28 10/25GbE Ethernet adapter
- 3S920 Quad Port SFP28 10/25GbE Ethernet adapter
- 3S920 Quad Port QSFP28 100GbE Ethernet adapter
Features of sssnic PMD are:
- Link status
- Link status event
- Queue start/stop
- Rx interrupt
- Scattered Rx
- TSO
- LRO
- Promiscuous mode
- Allmulticast mode
- Unicast MAC filter
- Multicast MAC filte
- RSS hash
- RSS key update
- RSS reta update
- Inner RSS
- VLAN filter
- VLAN offload
- L3 checksum offload
- L4 checksum offload
- Inner L3 checksum
- Inner L4 checksum
- Basic stats
- Extended stats
- Stats per queue
- Flow control
- FW version
- Generic flow API
---
v2:
* Fixed 'Title underline too short' in doc/guides/nics/sssnic.rst.
* Removed error.h from including files.
* Fixed variable 'cmd_len' is uninitialized when used.
* Fixed 'EINVAL' undeclared.
* Fixed wrong format of printing uint64_t.
* Fixed 'mask->hdr.src_addr' will always evaluate to 'true'.
v3:
* Fixed dereferencing type-punned pointer in base/sssnic_mbox.c.
v4:
* Fixed dereferencing type-punned pointer in base/sssnic_eventq.c.
* Fixed coding style issue of COMPLEX_MACRO.
* Fixed coding style issue of REPEATED_WORD.
---
Renyong Wan (32):
net/sssnic: add build and doc infrastructure net/sssnic: add log type and log macros net/sssnic: support probe and remove net/sssnic: initialize hardware base net/sssnic: add event queue net/sssnic/base: add message definition and utility net/sssnic/base: add mailbox support net/sssnic/base: add work queue net/sssnic/base: add control queue net/sssnic: add dev configure and infos get net/sssnic: add dev MAC ops
net/sssnic: support dev link status net/sssnic: support link status event net/sssnic: support Rx queue setup and release net/sssnic: support Tx queue setup and release net/sssnic: support Rx queue start and stop net/sssnic: support Tx queue start and stop net/sssnic: add Rx interrupt support net/sssnic: support dev start and stop net/sssnic: support dev close and reset net/sssnic: add allmulticast and promiscuous ops net/sssnic: add basic and extended stats ops net/sssnic: support Rx packet burst net/sssnic: support Tx packet burst net/sssnic: add RSS support
net/sssnic: support dev MTU set
net/sssnic: support dev queue info get net/sssnic: support dev firmware version get net/sssnic: add dev flow control ops net/sssnic: support VLAN offload and filter net/sssnic: add generic flow ops net/sssnic: add VF dev support
.mailmap | 5 +- MAINTAINERS | 8 + doc/guides/nics/features/sssnic.ini | 47 + doc/guides/nics/index.rst | 1 + doc/guides/nics/sssnic.rst | 73 + drivers/net/meson.build | 1 + drivers/net/sssnic/base/meson.build | 20 + drivers/net/sssnic/base/sssnic_api.c | 1943 ++++++++++++++++++++ drivers/net/sssnic/base/sssnic_api.h | 498 +++++ drivers/net/sssnic/base/sssnic_cmd.h | 514 ++++++ drivers/net/sssnic/base/sssnic_ctrlq.c | 521 ++++++ drivers/net/sssnic/base/sssnic_ctrlq.h | 58 + drivers/net/sssnic/base/sssnic_eventq.c | 461 +++++ drivers/net/sssnic/base/sssnic_eventq.h | 84 + drivers/net/sssnic/base/sssnic_exception.c | 116 ++ drivers/net/sssnic/base/sssnic_exception.h | 10 + drivers/net/sssnic/base/sssnic_hw.c | 486 +++++ drivers/net/sssnic/base/sssnic_hw.h | 117 ++ drivers/net/sssnic/base/sssnic_mbox.c | 615 +++++++ drivers/net/sssnic/base/sssnic_mbox.h | 45 + drivers/net/sssnic/base/sssnic_misc.h | 52 + drivers/net/sssnic/base/sssnic_msg.c | 254 +++ drivers/net/sssnic/base/sssnic_msg.h | 166 ++ drivers/net/sssnic/base/sssnic_reg.h | 267 +++ drivers/net/sssnic/base/sssnic_workq.c | 141 ++ drivers/net/sssnic/base/sssnic_workq.h | 108 ++ drivers/net/sssnic/meson.build | 28 + drivers/net/sssnic/sssnic_ethdev.c | 1139 ++++++++++++ drivers/net/sssnic/sssnic_ethdev.h | 102 + drivers/net/sssnic/sssnic_ethdev_fdir.c | 1017 ++++++++++ drivers/net/sssnic/sssnic_ethdev_fdir.h | 332 ++++ drivers/net/sssnic/sssnic_ethdev_flow.c | 981 ++++++++++ drivers/net/sssnic/sssnic_ethdev_flow.h | 11 + drivers/net/sssnic/sssnic_ethdev_link.c | 209 +++ drivers/net/sssnic/sssnic_ethdev_link.h | 14 + drivers/net/sssnic/sssnic_ethdev_rss.c | 377 ++++ drivers/net/sssnic/sssnic_ethdev_rss.h | 20 + drivers/net/sssnic/sssnic_ethdev_rx.c | 1396 ++++++++++++++ drivers/net/sssnic/sssnic_ethdev_rx.h | 50 + drivers/net/sssnic/sssnic_ethdev_stats.c | 414 +++++ drivers/net/sssnic/sssnic_ethdev_stats.h | 18 + drivers/net/sssnic/sssnic_ethdev_tx.c | 1123 +++++++++++ drivers/net/sssnic/sssnic_ethdev_tx.h | 45 + drivers/net/sssnic/sssnic_log.h | 51 + 44 files changed, 13935 insertions(+), 3 deletions(-) create mode 100644 doc/guides/nics/features/sssnic.ini create mode 100644 doc/guides/nics/sssnic.rst create mode 100644 drivers/net/sssnic/base/meson.build create mode 100644 drivers/net/sssnic/base/sssnic_api.c create mode 100644 drivers/net/sssnic/base/sssnic_api.h create mode 100644 drivers/net/sssnic/base/sssnic_cmd.h create mode 100644 drivers/net/sssnic/base/sssnic_ctrlq.c create mode 100644 drivers/net/sssnic/base/sssnic_ctrlq.h create mode 100644 drivers/net/sssnic/base/sssnic_eventq.c create mode 100644 drivers/net/sssnic/base/sssnic_eventq.h create mode 100644 drivers/net/sssnic/base/sssnic_exception.c create mode 100644 drivers/net/sssnic/base/sssnic_exception.h create mode 100644 drivers/net/sssnic/base/sssnic_hw.c create mode 100644 drivers/net/sssnic/base/sssnic_hw.h create mode 100644 drivers/net/sssnic/base/sssnic_mbox.c create mode 100644 drivers/net/sssnic/base/sssnic_mbox.h create mode 100644 drivers/net/sssnic/base/sssnic_misc.h create mode 100644 drivers/net/sssnic/base/sssnic_msg.c create mode 100644 drivers/net/sssnic/base/sssnic_msg.h create mode 100644 drivers/net/sssnic/base/sssnic_reg.h create mode 100644 drivers/net/sssnic/base/sssnic_workq.c create mode 100644 drivers/net/sssnic/base/sssnic_workq.h create mode 100644 drivers/net/sssnic/meson.build create mode 100644 drivers/net/sssnic/sssnic_ethdev.c create mode 100644 drivers/net/sssnic/sssnic_ethdev.h create mode 100644 drivers/net/sssnic/sssnic_ethdev_fdir.c create mode 100644 drivers/net/sssnic/sssnic_ethdev_fdir.h create mode 100644 drivers/net/sssnic/sssnic_ethdev_flow.c create mode 100644 drivers/net/sssnic/sssnic_ethdev_flow.h create mode 100644 drivers/net/sssnic/sssnic_ethdev_link.c create mode 100644 drivers/net/sssnic/sssnic_ethdev_link.h create mode 100644 drivers/net/sssnic/sssnic_ethdev_rss.c create mode 100644 drivers/net/sssnic/sssnic_ethdev_rss.h create mode 100644 drivers/net/sssnic/sssnic_ethdev_rx.c create mode 100644 drivers/net/sssnic/sssnic_ethdev_rx.h create mode 100644 drivers/net/sssnic/sssnic_ethdev_stats.c create mode 100644 drivers/net/sssnic/sssnic_ethdev_stats.h create mode 100644 drivers/net/sssnic/sssnic_ethdev_tx.c create mode 100644 drivers/net/sssnic/sssnic_ethdev_tx.h create mode 100644 drivers/net/sssnic/sssnic_log.h
Signature · 1 line
2.27.0
PATCH v4 1/32 net/sssnic: add build and doc infrastructure
From: Renyong Wan <[email protected]>
Adding minimum PMD code, doc and build infrastructure for sssnic.
---
v2:
* Fixed 'Title underline too short' in doc/guides/nics/sssnic.rst.
* Removed error.h from including files.
--- .mailmap | 5 +- MAINTAINERS | 8 ++++ doc/guides/nics/features/sssnic.ini | 9 ++++ doc/guides/nics/index.rst | 1 + doc/guides/nics/sssnic.rst | 73 +++++++++++++++++++++++++++++ drivers/net/meson.build | 1 + drivers/net/sssnic/meson.build | 18 +++++++ drivers/net/sssnic/sssnic_ethdev.c | 28 +++++++++++ 8 files changed, 140 insertions(+), 3 deletions(-) create mode 100644 doc/guides/nics/features/sssnic.ini create mode 100644 doc/guides/nics/sssnic.rst create mode 100644 drivers/net/sssnic/meson.build create mode 100644 drivers/net/sssnic/sssnic_ethdev.c
.mailmap +2 -3
@@ -151,7 +151,6 @@ Bao-Long Tran <[email protected]> Bar Neuman <[email protected]> Barak Enat <[email protected]> Barry Cao <[email protected]> -Bartosz Staszewski <[email protected]> Baruch Siach <[email protected]> Bassam Zaid AlKilani <[email protected]> Beilei Xing <[email protected]>
@@ -496,7 +495,6 @@ Helin Zhang <[email protected]> Hemant Agrawal <[email protected]> <[email protected]> Heng Ding <[email protected]> Hengjian Zhang <[email protected]> -Heng Jiang <[email protected]> Heng Wang <[email protected]> Henning Schild <[email protected]> Henry Cai <[email protected]>
@@ -630,7 +628,6 @@ Jie Liu <[email protected]> Jie Pan <[email protected]> Jie Wang <[email protected]> Jie Zhou <[email protected]> <[email protected]> -Jieqiang Wang <[email protected]> Jijiang Liu <[email protected]> Jilei Chen <[email protected]> Jim Harris <[email protected]>
@@ -1156,6 +1153,7 @@ Rebecca Troy <[email protected]> Remi Pommarel <[email protected]> Remy Horton <[email protected]> Renata Saiakhova <[email protected]> +Renyong Wan <[email protected]> Reshma Pattan <[email protected]> <[email protected]> Ricardo Roldan <[email protected]> Ricardo Salveti <[email protected]>
@@ -1329,6 +1327,7 @@ Stephen Hurd <[email protected]> <[email protected]> Steve Capper <[email protected]> Steven Lariau <[email protected]> Steven Luong <[email protected]> +Steven Song <[email protected]> Steven Webster <[email protected]> Steven Zou <[email protected]> Steve Rempe <[email protected]>
MAINTAINERS +8 -0
@@ -633,6 +633,13 @@ F: drivers/net/af_xdp/ F: doc/guides/nics/af_xdp.rst F: doc/guides/nics/features/af_xdp.ini +3SNIC sssnic +M: Renyong Wan <[email protected]> +M: Steven Song <[email protected]> +F: driver/net/sssnic/ +F: doc/guides/nics/sssnic.rst +F: doc/guides/nics/features/sssnic.ini + Amazon ENA M: Michal Krawczyk <[email protected]> M: Shai Brandes <[email protected]>
@@ -1793,6 +1800,7 @@ F: doc/guides/tools/img/eventdev_* F: app/test/test_event_ring.c Procinfo tool +M: Maryam Tahhan <[email protected]> M: Reshma Pattan <[email protected]> F: app/proc-info/ F: doc/guides/tools/proc_info.rst
doc/guides/nics/features/sssnic.ini new file +9 -0
@@ -0,0 +1,9 @@ +; +; Supported features of the 'sssnic' network poll mode driver. +; +; Refer to default.ini for the full list of available PMD features. +; +[Features] +Linux = Y +ARMv8 = Y +x86-64 = Y
doc/guides/nics/index.rst +1 -0
@@ -61,6 +61,7 @@ Network Interface Controller Drivers qede sfc_efx softnic + sssnic tap thunderx txgbe
doc/guides/nics/sssnic.rst new file +73 -0
73 lines not on this page · raw message
drivers/net/meson.build +1 -0
@@ -54,6 +54,7 @@ drivers = [ 'ring', 'sfc', 'softnic', + 'sssnic', 'tap', 'thunderx', 'txgbe',
drivers/net/sssnic/meson.build new file +18 -0
@@ -0,0 +1,18 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018-2022 Shenzhen 3SNIC Information Technology Co., Ltd. + +if not is_linux + build = false + reason = 'only supported on Linux' + subdir_done() +endif + +if (arch_subdir != 'x86' and arch_subdir != 'arm') or (not dpdk_conf.get('RTE_ARCH_64')) + build = false + reason = 'only supported on x86_64 and aarch64' + subdir_done() +endif + +sources = files( + 'sssnic_ethdev.c', +)
drivers/net/sssnic/sssnic_ethdev.c new file +28 -0
@@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2018-2022 Shenzhen 3SNIC Information Technology Co., Ltd. +*/ + +#include <rte_common.h> +#include <ethdev_pci.h> + +static int +sssnic_pci_probe (struct rte_pci_driver *pci_drv,struct rte_pci_device *pci_dev) +{ +RTE_SET_USED (pci_drv); +RTE_SET_USED (pci_dev); +return -EINVAL ; +} + +static int +sssnic_pci_remove (struct rte_pci_device *pci_dev) +{ +RTE_SET_USED (pci_dev); +return -EINVAL ; +} + +static struct rte_pci_driver sssnic_pmd = { + .probe = sssnic_pci_probe, + .remove = sssnic_pci_remove, +}; + +RTE_PMD_REGISTER_PCI (net_sssnic, sssnic_pmd);
Signature · 1 line
2.27.0
Re: [PATCH v4 01/32] net/sssnic: add build and doc infrastructure
Quoted 31 lines · On Fri, Sep 1, 2023 at 11:35 AM <[email protected]> wrote:
From: Renyong Wan <[email protected]>
Adding minimum PMD code, doc and build infrastructure for sssnic.
Signed-off-by Steven Song <[email protected]>Signed-off-by Renyong Wan <[email protected]>---
v2:
* Fixed 'Title underline too short' indoc/guides/nics/sssnic.rst.
* Removederror.hfrom including files.--- .mailmap | 5 +- MAINTAINERS | 8 ++++ doc/guides/nics/features/sssnic.ini | 9 ++++ doc/guides/nics/index.rst | 1 + doc/guides/nics/sssnic.rst | 73 +++++++++++++++++++++++++++++ drivers/net/meson.build | 1 + drivers/net/sssnic/meson.build | 18 +++++++ drivers/net/sssnic/sssnic_ethdev.c | 28 +++++++++++ 8 files changed, 140 insertions(+), 3 deletions(-) create mode 100644 doc/guides/nics/features/sssnic.ini create mode 100644 doc/guides/nics/sssnic.rst create mode 100644 drivers/net/sssnic/meson.build create mode 100644 drivers/net/sssnic/sssnic_ethdev.c.mailmap +0
-0
.mailmap Bao-Long Tran <[email protected]> · line 156
Quoted 7 lines
.mailmap +0
-1@@ -151,7 +151,6 @@ Bao-Long Tran <[email protected]> Bar Neuman <[email protected]> Barak Enat <[email protected]> Barry Cao <[email protected]> -Bartosz Staszewski <[email protected]> Baruch Siach <[email protected]> Bassam Zaid AlKilani <[email protected]> Beilei Xing <[email protected]>
This looks like some rebase damage, or at least unwanted changes. Please fix.
Quoted 37 lines
.mailmap +2
-2@@ -496,7 +495,6 @@ Helin Zhang <[email protected]> Hemant Agrawal <[email protected]> <[email protected]> Heng Ding <[email protected]> Hengjian Zhang <[email protected]> -Heng Jiang <[email protected]> Heng Wang <[email protected]> Henning Schild <[email protected]> Henry Cai <[email protected]>@@ -630,7 +628,6 @@ Jie Liu <[email protected]> Jie Pan <[email protected]> Jie Wang <[email protected]> Jie Zhou <[email protected]> <[email protected]> -Jieqiang Wang <[email protected]> Jijiang Liu <[email protected]> Jilei Chen <[email protected]> Jim Harris <[email protected]>@@ -1156,6 +1153,7 @@ Rebecca Troy <[email protected]> Remi Pommarel <[email protected]> Remy Horton <[email protected]> Renata Saiakhova <[email protected]> +Renyong Wan <[email protected]> Reshma Pattan <[email protected]> <[email protected]> Ricardo Roldan <[email protected]> Ricardo Salveti <[email protected]>@@ -1329,6 +1327,7 @@ Stephen Hurd <[email protected]> <[email protected]> Steve Capper <[email protected]> Steven Lariau <[email protected]> Steven Luong <[email protected]> +Steven Song <[email protected]> Steven Webster <[email protected]> Steven Zou <[email protected]> Steve Rempe <[email protected]>MAINTAINERS +0
-0
MAINTAINERS F: drivers/net/af_xdp/ · line 639
Quoted 7 lines
MAINTAINERS +4
-0@@ -633,6 +633,13 @@ F: drivers/net/af_xdp/ F: doc/guides/nics/af_xdp.rst F: doc/guides/nics/features/af_xdp.ini +3SNIC sssnic +M: Renyong Wan <[email protected]> +M: Steven Song <[email protected]> +F: driver/net/sssnic/
This path is incorrect.
*drivers*
Quoted 14 lines
MAINTAINERS +4
-0+F: doc/guides/nics/sssnic.rst +F: doc/guides/nics/features/sssnic.ini + Amazon ENA M: Michal Krawczyk <[email protected]> M: Shai Brandes <[email protected]>@@ -1793,6 +1800,7 @@ F: doc/guides/tools/img/eventdev_* F: app/test/test_event_ring.c Procinfo tool +M: Maryam Tahhan <[email protected]> M: Reshma Pattan <[email protected]> F: app/proc-info/ F: doc/guides/tools/proc_info.rst
Signature · 1 line
David Marchand
Re: [PATCH v4 01/32] net/sssnic: add build and doc infrastructure
Thanks for your reply, I'll fix them next version.
Quoted 103 lines · David Marchand
Quoted 30 lines · On Fri, Sep 1, 2023 at 11:35 AM <[email protected]> wrote:
From: Renyong Wan <[email protected]>
Adding minimum PMD code, doc and build infrastructure for sssnic.
Signed-off-by Steven Song <[email protected]>Signed-off-by Renyong Wan <[email protected]>---
v2:
* Fixed 'Title underline too short' indoc/guides/nics/sssnic.rst.
* Removederror.hfrom including files.--- .mailmap | 5 +- MAINTAINERS | 8 ++++ doc/guides/nics/features/sssnic.ini | 9 ++++ doc/guides/nics/index.rst | 1 + doc/guides/nics/sssnic.rst | 73 +++++++++++++++++++++++++++++ drivers/net/meson.build | 1 + drivers/net/sssnic/meson.build | 18 +++++++ drivers/net/sssnic/sssnic_ethdev.c | 28 +++++++++++ 8 files changed, 140 insertions(+), 3 deletions(-)create mode 100644 doc/guides/nics/features/sssnic.ini create mode 100644
doc/guides/nics/sssnic.rstcreate mode 100644drivers/net/sssnic/meson.buildcreate mode 100644drivers/net/sssnic/sssnic_ethdev.c.mailmap +0
-0.mailmap Bao-Long Tran <[email protected]> · line 156
Quoted 7 lines
.mailmap +0
-1@@ -151,7 +151,6 @@ Bao-Long Tran <[email protected]> Bar Neuman <[email protected]> Barak Enat <[email protected]> Barry Cao <[email protected]> -Bartosz Staszewski <[email protected]> Baruch Siach <[email protected]> Bassam Zaid AlKilani <[email protected]> Beilei Xing <[email protected]>This looks like some rebase damage, or at least unwanted changes. Please fix.
Quoted 37 lines
.mailmap +2
-2@@ -496,7 +495,6 @@ Helin Zhang <[email protected]> Hemant Agrawal <[email protected]> <[email protected]> Heng Ding <[email protected]> Hengjian Zhang <[email protected]> -Heng Jiang <[email protected]> Heng Wang <[email protected]> Henning Schild <[email protected]> Henry Cai <[email protected]>@@ -630,7 +628,6 @@ Jie Liu <[email protected]> Jie Pan <[email protected]> Jie Wang <[email protected]> Jie Zhou <[email protected]> <[email protected]> -Jieqiang Wang <[email protected]> Jijiang Liu <[email protected]> Jilei Chen <[email protected]> Jim Harris <[email protected]>@@ -1156,6 +1153,7 @@ Rebecca Troy <[email protected]> Remi Pommarel <[email protected]> Remy Horton <[email protected]> Renata Saiakhova <[email protected]> +Renyong Wan <[email protected]> Reshma Pattan <[email protected]> <[email protected]> Ricardo Roldan <[email protected]> Ricardo Salveti <[email protected]>@@ -1329,6 +1327,7 @@ Stephen Hurd <[email protected]> <[email protected]> Steve Capper <[email protected]> Steven Lariau <[email protected]> Steven Luong <[email protected]> +Steven Song <[email protected]> Steven Webster <[email protected]> Steven Zou <[email protected]> Steve Rempe <[email protected]>MAINTAINERS +0
-0MAINTAINERS F: drivers/net/af_xdp/ · line 639
Quoted 7 lines
MAINTAINERS +4
-0@@ -633,6 +633,13 @@ F: drivers/net/af_xdp/ F: doc/guides/nics/af_xdp.rst F: doc/guides/nics/features/af_xdp.ini +3SNIC sssnic +M: Renyong Wan <[email protected]> +M: Steven Song <[email protected]> +F: driver/net/sssnic/This path is incorrect.
*drivers*Quoted 14 lines
MAINTAINERS +4
-0+F: doc/guides/nics/sssnic.rst +F: doc/guides/nics/features/sssnic.ini + Amazon ENA M: Michal Krawczyk <[email protected]> M: Shai Brandes <[email protected]>@@ -1793,6 +1800,7 @@ F: doc/guides/tools/img/eventdev_* F: app/test/test_event_ring.c Procinfo tool +M: Maryam Tahhan <[email protected]> M: Reshma Pattan <[email protected]> F: app/proc-info/ F: doc/guides/tools/proc_info.rst
PATCH v4 2/32 net/sssnic: add log type and log macros
In reply to [email protected]From: Renyong Wan <[email protected]>
Adding log macros to print runtime messages and trace functions.
--- drivers/net/sssnic/sssnic_ethdev.c | 13 ++++++++ drivers/net/sssnic/sssnic_log.h | 51 ++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 drivers/net/sssnic/sssnic_log.h
drivers/net/sssnic/sssnic_ethdev.c +13 -0
@@ -5,11 +5,14 @@#include <rte_common.h> #include <ethdev_pci.h> +#include "sssnic_log.h" +static int sssnic_pci_probe (struct rte_pci_driver *pci_drv,struct rte_pci_device *pci_dev) {RTE_SET_USED (pci_drv);RTE_SET_USED (pci_dev); +PMD_INIT_FUNC_TRACE ();return -EINVAL ; }
@@ -17,6 +20,7 @@ static int sssnic_pci_remove(struct rte_pci_device *pci_dev) {RTE_SET_USED (pci_dev); +PMD_INIT_FUNC_TRACE ();return -EINVAL ; }
@@ -26,3 +30,12 @@ static struct rte_pci_driver sssnic_pmd = { };RTE_PMD_REGISTER_PCI (net_sssnic, sssnic_pmd); + +RTE_LOG_REGISTER_SUFFIX (sssnic_logtype_driver, driver,INFO ); +RTE_LOG_REGISTER_SUFFIX (sssnic_logtype_init, init,NOTICE ); +#ifdef RTE_ETHDEV_DEBUG_RX +RTE_LOG_REGISTER_SUFFIX (sssnic_logtype_rx, rx,DEBUG ); +#endif /*RTE_ETHDEV_DEBUG_RX*/ +#ifdef RTE_ETHDEV_DEBUG_TX +RTE_LOG_REGISTER_SUFFIX (sssnic_logtype_tx, tx,DEBUG ); +#endif /*RTE_ETHDEV_DEBUG_TX*/
drivers/net/sssnic/sssnic_log.h new file +51 -0
51 lines not on this page · raw message
Signature · 1 line
2.27.0
PATCH v4 3/32 net/sssnic: support probe and remove
In reply to [email protected]From: Renyong Wan <[email protected]>
Register device ID for 3SNIC ethernet adapter to support PCI ethdev probe and remove.
--- drivers/net/sssnic/base/sssnic_hw.h | 11 +++++++++ drivers/net/sssnic/sssnic_ethdev.c | 37 +++++++++++++++++++++++++---- 2 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 drivers/net/sssnic/base/sssnic_hw.h
drivers/net/sssnic/base/sssnic_hw.h new file +11 -0
@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2018-2022 Shenzhen 3SNIC Information Technology Co., Ltd. +*/ + +#ifndef _SSSNIC_HW_H_ +#define _SSSNIC_HW_H_ + +#define SSSNIC_PCI_VENDOR_ID 0x1F3F +#define SSSNIC_DEVICE_ID_STD 0x9020 + +#endif /* _SSSNIC_HW_H_ */
drivers/net/sssnic/sssnic_ethdev.c +33 -4
@@ -6,25 +6,54 @@#include <ethdev_pci.h> #include "sssnic_log.h" +#include "base/sssnic_hw.h" + +static int +sssnic_ethdev_init (struct rte_eth_dev *ethdev) +{ +RTE_SET_USED (ethdev); +PMD_INIT_FUNC_TRACE (); + +return -EINVAL ; +} + +static int +sssnic_ethdev_uninit (struct rte_eth_dev *ethdev) +{ +RTE_SET_USED (ethdev); +PMD_INIT_FUNC_TRACE (); + +if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +return 0 ; + +return -EINVAL ; +}static int sssnic_pci_probe (struct rte_pci_driver *pci_drv,struct rte_pci_device *pci_dev) {RTE_SET_USED (pci_drv); -RTE_SET_USED (pci_dev);PMD_INIT_FUNC_TRACE (); -return -EINVAL ; + +return rte_eth_dev_pci_generic_probe (pci_dev,0 , sssnic_ethdev_init); }static int sssnic_pci_remove (struct rte_pci_device *pci_dev) { -RTE_SET_USED (pci_dev);PMD_INIT_FUNC_TRACE (); -return -EINVAL ; + +return rte_eth_dev_pci_generic_remove (pci_dev, sssnic_ethdev_uninit); } +static const struct rte_pci_id sssnic_pci_id_map[] = { + {RTE_PCI_DEVICE (SSSNIC_PCI_VENDOR_ID ,SSSNIC_DEVICE_ID_STD ) }, + { .vendor_id =0 }, +}; +static struct rte_pci_driver sssnic_pmd = { + .id_table = sssnic_pci_id_map, + .drv_flags =RTE_PCI_DRV_NEED_MAPPING , .probe = sssnic_pci_probe, .remove = sssnic_pci_remove, };
Signature · 1 line
2.27.0
PATCH v4 4/32 net/sssnic: initialize hardware base
In reply to [email protected]From: Renyong Wan <[email protected]>
Initializing hardware base make hardware ready to be access.
--- drivers/net/sssnic/base/meson.build | 13 ++ drivers/net/sssnic/base/sssnic_hw.c | 207 +++++++++++++++++++++++++++ drivers/net/sssnic/base/sssnic_hw.h | 49 +++++++ drivers/net/sssnic/base/sssnic_reg.h | 169 ++++++++++++++++++++++ drivers/net/sssnic/meson.build | 3 + drivers/net/sssnic/sssnic_ethdev.c | 46 +++++- drivers/net/sssnic/sssnic_ethdev.h | 18 +++ 7 files changed, 501 insertions(+), 4 deletions(-) create mode 100644 drivers/net/sssnic/base/meson.build create mode 100644 drivers/net/sssnic/base/sssnic_hw.c create mode 100644 drivers/net/sssnic/base/sssnic_reg.h create mode 100644 drivers/net/sssnic/sssnic_ethdev.h
drivers/net/sssnic/base/meson.build new file +13 -0
@@ -0,0 +1,13 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018-2022 Shenzhen 3SNIC Information Technology Co., Ltd. + +sources = [ + 'sssnic_hw.c', +] + +c_args = cflags +base_lib = static_library('sssnic_base', sources, + dependencies: [static_rte_eal, static_rte_ethdev, static_rte_bus_pci, static_rte_net], + c_args: c_args) + +base_objs = base_lib.extract_all_objects()
drivers/net/sssnic/base/sssnic_hw.c new file +207 -0
207 lines not on this page · raw message
drivers/net/sssnic/base/sssnic_hw.h +49 -0
53 lines not on this page · raw message
drivers/net/sssnic/base/sssnic_reg.h new file +169 -0
169 lines not on this page · raw message
drivers/net/sssnic/meson.build +3 -0
@@ -13,6 +13,9 @@ if (arch_subdir != 'x86' and arch_subdir != 'arm') or (not dpdk_conf.get('RTE_AR subdir_done() endif +subdir('base') +objs = [base_objs] + sources = files( 'sssnic_ethdev.c', )
drivers/net/sssnic/sssnic_ethdev.c +42 -4
74 lines not on this page · raw message
drivers/net/sssnic/sssnic_ethdev.h new file +18 -0
@@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2018-2022 Shenzhen 3SNIC Information Technology Co., Ltd. +*/ + +#ifndef _SSSNIC_ETHDEV_H_ +#define _SSSNIC_ETHDEV_H_ + +struct sssnic_netdev { +void *hw; +}; + +#define SSSNIC_ETHDEV_PRIVATE (eth_dev) \ + ((struct sssnic_netdev *)(eth_dev)->data->dev_private) +#define SSSNIC_NETDEV_TO_HW (netdev) ((struct sssnic_hw *)(netdev)->hw) +#define SSSNIC_ETHDEV_TO_HW (eth_dev) \ + SSSNIC_NETDEV_TO_HW(SSSNIC_ETHDEV_PRIVATE(eth_dev)) + +#endif /*_SSSNIC_ETHDEV_H_*/
Signature · 1 line
2.27.0
PATCH v4 5/32 net/sssnic: add event queue
In reply to [email protected]From: Renyong Wan <[email protected]>
Event queue is intended for receiving event from hardware as well as mailbox response message.
---
v4:
* Fixed dereferencing type-punned pointer.
* Fixed coding style issue of COMPLEX_MACRO.
--- drivers/net/sssnic/base/meson.build | 1 + drivers/net/sssnic/base/sssnic_eventq.c | 432 ++++++++++++++++++++++++ drivers/net/sssnic/base/sssnic_eventq.h | 84 +++++ drivers/net/sssnic/base/sssnic_hw.c | 9 +- drivers/net/sssnic/base/sssnic_hw.h | 5 + drivers/net/sssnic/base/sssnic_reg.h | 51 +++ drivers/net/sssnic/sssnic_ethdev.c | 1 + 7 files changed, 582 insertions(+), 1 deletion(-) create mode 100644 drivers/net/sssnic/base/sssnic_eventq.c create mode 100644 drivers/net/sssnic/base/sssnic_eventq.h
drivers/net/sssnic/base/meson.build +1 -0
@@ -3,6 +3,7 @@ sources = [ 'sssnic_hw.c', + 'sssnic_eventq.c' ] c_args = cflags
drivers/net/sssnic/base/sssnic_eventq.c new file +432 -0
432 lines not on this page · raw message
drivers/net/sssnic/base/sssnic_eventq.h new file +84 -0
84 lines not on this page · raw message
drivers/net/sssnic/base/sssnic_hw.c +8 -1
@@ -9,6 +9,7 @@#include "../sssnic_log.h" #include "sssnic_hw.h" #include "sssnic_reg.h" +#include "sssnic_eventq.h" static int wait_for_sssnic_hw_ready (struct sssnic_hw *hw)
@@ -196,12 +197,18 @@ sssnic_hw_init(struct sssnic_hw *hw)return ret; } + ret =sssnic_eventq_all_init (hw); +if (ret !=0 ) { +PMD_DRV_LOG (ERR ,"Failed to initialize event queues" ); +return ret; + } +return -EINVAL ; }void sssnic_hw_shutdown (struct sssnic_hw *hw) { -RTE_SET_USED (hw);PMD_INIT_FUNC_TRACE (); +sssnic_eventq_all_shutdown (hw); }
drivers/net/sssnic/base/sssnic_hw.h +5 -0
@@ -51,8 +51,13 @@ struct sssnic_hw {uint8_t *db_base_addr;uint8_t *db_mem_len;struct sssnic_hw_attr attr; +struct sssnic_eventq *eventqs; +uint8_t num_eventqs; +uint16_t eth_port_id; }; +#define SSSNIC_ETH_PORT_ID (hw) ((hw)->eth_port_id) +int sssnic_hw_init (struct sssnic_hw *hw);void sssnic_hw_shutdown (struct sssnic_hw *hw);void sssnic_msix_state_set (struct sssnic_hw *hw,uint16_t msix_id,int state);
drivers/net/sssnic/base/sssnic_reg.h +51 -0
63 lines not on this page · raw message
drivers/net/sssnic/sssnic_ethdev.c +1 -0
@@ -40,6 +40,7 @@ sssnic_ethdev_init(struct rte_eth_dev *ethdev) } netdev->hw = hw; hw->pci_dev = pci_dev; + hw->eth_port_id = ethdev->data->port_id; ret =sssnic_hw_init (hw);if (ret !=0 ) {rte_free (hw);
Signature · 1 line
2.27.0
PATCH v4 6/32 net/sssnic/base: add message definition and utility
In reply to [email protected]From: Renyong Wan <[email protected]>
sssnic message is used to encapsulate sssnic command for transmission between driver and firmware. sssnic message is sent by driver via mail box and is received by driver via event queue.
---
v2:
* Removed error.h from including files.
--- drivers/net/sssnic/base/meson.build | 3 +- drivers/net/sssnic/base/sssnic_eventq.c | 29 +++ drivers/net/sssnic/base/sssnic_hw.c | 15 +- drivers/net/sssnic/base/sssnic_hw.h | 2 + drivers/net/sssnic/base/sssnic_msg.c | 254 ++++++++++++++++++++++++ drivers/net/sssnic/base/sssnic_msg.h | 166 ++++++++++++++++ 6 files changed, 467 insertions(+), 2 deletions(-) create mode 100644 drivers/net/sssnic/base/sssnic_msg.c create mode 100644 drivers/net/sssnic/base/sssnic_msg.h
drivers/net/sssnic/base/meson.build +2 -1
@@ -3,7 +3,8 @@ sources = [ 'sssnic_hw.c', - 'sssnic_eventq.c' + 'sssnic_eventq.c', + 'sssnic_msg.c', ] c_args = cflags
drivers/net/sssnic/base/sssnic_eventq.c +29 -0
@@ -14,6 +14,7 @@#include "../sssnic_log.h" #include "sssnic_hw.h" #include "sssnic_reg.h" +#include "sssnic_msg.h" #include "sssnic_eventq.h" #define SSSNIC_EVENTQ_DEF_DEPTH 64
@@ -184,6 +185,32 @@ sssnic_eventq_ci_update(struct sssnic_eventq *eq, int informed)sssnic_eventq_reg_write (eq,SSSNIC_EVENTQ_CI_CTRL_REG , reg.u32); } +static int +sssnic_event_default_handler_func (struct sssnic_eventq *eq, + struct sssnic_event *ev, __rte_unused void *data) +{ +struct sssnic_hw *hw; +int ret; + + hw = eq->hw; + ret =sssnic_msg_rx_handle (hw, (struct sssnic_msg_hdr *)(ev->data)); +if (ret !=SSSNIC_MSG_DONE ) +return -1 ; + +return SSSNIC_EVENT_DONE ; +} + +static void +sssnic_eventq_handlers_init (struct sssnic_eventq *eq) +{ +int i; + +for (i =SSSNIC_EVENT_CODE_MIN ; i <=SSSNIC_EVENT_CODE_MAX ; i++) { + eq->handlers[i].func = sssnic_event_default_handler_func; + eq->handlers[i].data =NULL ; + } +} +static int sssnic_eventq_init (struct sssnic_hw *hw,struct sssnic_eventq *eq,uint16_t qid) {
@@ -230,6 +257,8 @@ sssnic_eventq_init(struct sssnic_hw *hw, struct sssnic_eventq *eq, uint16_t qid)PMD_DRV_LOG (ERR ,"Failed to setup eventq pages!" );return ret; } + +sssnic_eventq_handlers_init (eq);sssnic_eventq_ctrl_setup (eq);sssnic_eventq_ci_update (eq,1 );if (qid ==0 )
drivers/net/sssnic/base/sssnic_hw.c +14 -1
@@ -10,6 +10,7 @@#include "sssnic_hw.h" #include "sssnic_reg.h" #include "sssnic_eventq.h" +#include "sssnic_msg.h" static int wait_for_sssnic_hw_ready (struct sssnic_hw *hw)
@@ -197,18 +198,30 @@ sssnic_hw_init(struct sssnic_hw *hw)return ret; } + ret =sssnic_msg_inbox_init (hw); +if (ret) { +PMD_DRV_LOG (ERR ,"Failed to initialize message inbox." ); +return ret; + } + ret =sssnic_eventq_all_init (hw);if (ret !=0 ) {PMD_DRV_LOG (ERR ,"Failed to initialize event queues" ); -return ret; + goto eventq_init_fail; }return -EINVAL ; + +eventq_init_fail: +sssnic_msg_inbox_shutdown (hw); +return ret; }void sssnic_hw_shutdown (struct sssnic_hw *hw) {PMD_INIT_FUNC_TRACE (); +sssnic_eventq_all_shutdown (hw); +sssnic_msg_inbox_shutdown (hw); }
drivers/net/sssnic/base/sssnic_hw.h +2 -0
@@ -52,11 +52,13 @@ struct sssnic_hw {uint8_t *db_mem_len;struct sssnic_hw_attr attr;struct sssnic_eventq *eventqs; +struct sssnic_msg_inbox *msg_inbox;uint8_t num_eventqs;uint16_t eth_port_id; };#define SSSNIC_ETH_PORT_ID (hw) ((hw)->eth_port_id) +#define SSSNIC_MPU_FUNC_IDX 0x1fffint sssnic_hw_init (struct sssnic_hw *hw);void sssnic_hw_shutdown (struct sssnic_hw *hw);
drivers/net/sssnic/base/sssnic_msg.c new file +254 -0
254 lines not on this page · raw message
drivers/net/sssnic/base/sssnic_msg.h new file +166 -0
166 lines not on this page · raw message
Signature · 1 line
2.27.0
PATCH v4 7/32 net/sssnic/base: add mailbox support
In reply to [email protected]From: Renyong Wan <[email protected]>
Mailbox is a message channel used to communicate between PF and VF as well as driver and hardware functions.
Mailbox messages are received by driver through event queue, and sent by driver through registers of mailbox.
There are two transfer modes for sending mailbox message, one is DMA mode used to send message to PF, another is inline mode used to send message to VF.
---
v3:
* Fixed dereferencing type-punned pointer.
--- drivers/net/sssnic/base/meson.build | 1 + drivers/net/sssnic/base/sssnic_hw.c | 10 + drivers/net/sssnic/base/sssnic_hw.h | 4 + drivers/net/sssnic/base/sssnic_mbox.c | 615 ++++++++++++++++++++++++++ drivers/net/sssnic/base/sssnic_mbox.h | 45 ++ drivers/net/sssnic/base/sssnic_misc.h | 11 + drivers/net/sssnic/base/sssnic_reg.h | 47 ++ 7 files changed, 733 insertions(+) create mode 100644 drivers/net/sssnic/base/sssnic_mbox.c create mode 100644 drivers/net/sssnic/base/sssnic_mbox.h create mode 100644 drivers/net/sssnic/base/sssnic_misc.h
drivers/net/sssnic/base/meson.build +1 -0
@@ -5,6 +5,7 @@ sources = [ 'sssnic_hw.c', 'sssnic_eventq.c', 'sssnic_msg.c', + 'sssnic_mbox.c', ] c_args = cflags
drivers/net/sssnic/base/sssnic_hw.c +10 -0
@@ -11,6 +11,7 @@#include "sssnic_reg.h" #include "sssnic_eventq.h" #include "sssnic_msg.h" +#include "sssnic_mbox.h" static int wait_for_sssnic_hw_ready (struct sssnic_hw *hw)
@@ -210,8 +211,16 @@ sssnic_hw_init(struct sssnic_hw *hw) goto eventq_init_fail; } + ret =sssnic_mbox_init (hw); +if (ret) { +PMD_DRV_LOG (ERR ,"Failed to initialize mailbox" ); + goto mbox_init_fail; + } +return -EINVAL ; +mbox_init_fail: +sssnic_eventq_all_shutdown (hw); eventq_init_fail:sssnic_msg_inbox_shutdown (hw);return ret;
@@ -222,6 +231,7 @@ sssnic_hw_shutdown(struct sssnic_hw *hw) {PMD_INIT_FUNC_TRACE (); +sssnic_mbox_shutdown (hw);sssnic_eventq_all_shutdown (hw);sssnic_msg_inbox_shutdown (hw); }
drivers/net/sssnic/base/sssnic_hw.h +4 -0
@@ -53,12 +53,16 @@ struct sssnic_hw {struct sssnic_hw_attr attr;struct sssnic_eventq *eventqs;struct sssnic_msg_inbox *msg_inbox; +struct sssnic_mbox *mbox;uint8_t num_eventqs;uint16_t eth_port_id; }; +#define SSSNIC_FUNC_IDX (hw) ((hw)->attr.func_idx)#define SSSNIC_ETH_PORT_ID (hw) ((hw)->eth_port_id)#define SSSNIC_MPU_FUNC_IDX 0x1fff +#define SSSNIC_FUNC_TYPE (hw) ((hw)->attr.func_type) +#define SSSNIC_AF_FUNC_IDX (hw) ((hw)->attr.af_idx)int sssnic_hw_init (struct sssnic_hw *hw);void sssnic_hw_shutdown (struct sssnic_hw *hw);
drivers/net/sssnic/base/sssnic_mbox.c new file +615 -0
615 lines not on this page · raw message
drivers/net/sssnic/base/sssnic_mbox.h new file +45 -0
45 lines not on this page · raw message
drivers/net/sssnic/base/sssnic_misc.h new file +11 -0
@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2018-2022 Shenzhen 3SNIC Information Technology Co., Ltd. +*/ + +#ifndef _SSSNIC_MISC_H_ +#define _SSSNIC_MISC_H_ + +#define SSSNIC_LOWER_32_BITS (x) ((uint32_t)(x)) +#define SSSNIC_UPPER_32_BITS (x) ((uint32_t)(((x) >> 16) >> 16)) + +#endif /* _SSSNIC_MISC_H_ */
drivers/net/sssnic/base/sssnic_reg.h +47 -0
59 lines not on this page · raw message
Signature · 1 line
2.27.0
PATCH v4 8/32 net/sssnic/base: add work queue
In reply to [email protected]From: Renyong Wan <[email protected]>
Work queue is used to maintain hardware queue information by driver, it is usually used in control queue, rx queue and tx queue.
---
v2:
* Removed error.h from including files.
--- drivers/net/sssnic/base/meson.build | 1 + drivers/net/sssnic/base/sssnic_workq.c | 141 +++++++++++++++++++++++++ drivers/net/sssnic/base/sssnic_workq.h | 108 +++++++++++++++++++ 3 files changed, 250 insertions(+) create mode 100644 drivers/net/sssnic/base/sssnic_workq.c create mode 100644 drivers/net/sssnic/base/sssnic_workq.h
drivers/net/sssnic/base/meson.build +1 -0
@@ -6,6 +6,7 @@ sources = [ 'sssnic_eventq.c', 'sssnic_msg.c', 'sssnic_mbox.c', + 'sssnic_workq.c', ] c_args = cflags
drivers/net/sssnic/base/sssnic_workq.c new file +141 -0
141 lines not on this page · raw message
drivers/net/sssnic/base/sssnic_workq.h new file +108 -0
108 lines not on this page · raw message
Signature · 1 line
2.27.0
PATCH v4 9/32 net/sssnic/base: add control queue
In reply to [email protected]From: Renyong Wan <[email protected]>
Control queue is used for communication between driver and datapath code of firmware.
---
v2:
* Fixed variable 'cmd_len' is uninitialized when used.
--- drivers/net/sssnic/base/meson.build | 2 + drivers/net/sssnic/base/sssnic_api.c | 102 +++++ drivers/net/sssnic/base/sssnic_api.h | 23 ++ drivers/net/sssnic/base/sssnic_cmd.h | 114 ++++++ drivers/net/sssnic/base/sssnic_ctrlq.c | 521 +++++++++++++++++++++++++ drivers/net/sssnic/base/sssnic_ctrlq.h | 58 +++ drivers/net/sssnic/base/sssnic_hw.c | 149 +++++++ drivers/net/sssnic/base/sssnic_hw.h | 8 + 8 files changed, 977 insertions(+) create mode 100644 drivers/net/sssnic/base/sssnic_api.c create mode 100644 drivers/net/sssnic/base/sssnic_api.h create mode 100644 drivers/net/sssnic/base/sssnic_cmd.h create mode 100644 drivers/net/sssnic/base/sssnic_ctrlq.c create mode 100644 drivers/net/sssnic/base/sssnic_ctrlq.h
drivers/net/sssnic/base/meson.build +2 -0
@@ -7,6 +7,8 @@ sources = [ 'sssnic_msg.c', 'sssnic_mbox.c', 'sssnic_workq.c', + 'sssnic_ctrlq.c', + 'sssnic_api.c', ] c_args = cflags
drivers/net/sssnic/base/sssnic_api.c new file +102 -0
102 lines not on this page · raw message
drivers/net/sssnic/base/sssnic_api.h new file +23 -0
@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2018-2022 Shenzhen 3SNIC Information Technology Co., Ltd. +*/ + +#ifndef _SSSNIC_API_H_ +#define _SSSNIC_API_H_ + +struct sssnic_msix_attr { +uint32_t lli_set; +uint32_t coalescing_set; +uint8_t lli_credit; +uint8_t lli_timer; +uint8_t pending_limit; +uint8_t coalescing_timer; +uint8_t resend_timer; +}; + +int sssnic_msix_attr_get (struct sssnic_hw *hw,uint16_t msix_idx, +struct sssnic_msix_attr *attr); +int sssnic_msix_attr_set (struct sssnic_hw *hw,uint16_t msix_idx, +struct sssnic_msix_attr *attr); + +#endif /* _SSSNIC_API_H_ */
drivers/net/sssnic/base/sssnic_cmd.h new file +114 -0
114 lines not on this page · raw message
drivers/net/sssnic/base/sssnic_ctrlq.c new file +521 -0
521 lines not on this page · raw message
drivers/net/sssnic/base/sssnic_ctrlq.h new file +58 -0
58 lines not on this page · raw message
drivers/net/sssnic/base/sssnic_hw.c +149 -0
178 lines not on this page · raw message
drivers/net/sssnic/base/sssnic_hw.h +8 -0
@@ -54,6 +54,7 @@ struct sssnic_hw {struct sssnic_eventq *eventqs;struct sssnic_msg_inbox *msg_inbox;struct sssnic_mbox *mbox; +struct sssnic_ctrlq *ctrlq;uint8_t num_eventqs;uint16_t eth_port_id; };
@@ -64,6 +65,13 @@ struct sssnic_hw {#define SSSNIC_FUNC_TYPE (hw) ((hw)->attr.func_type)#define SSSNIC_AF_FUNC_IDX (hw) ((hw)->attr.af_idx) +enum sssnic_module { +SSSNIC_COMM_MODULE =0 , +SSSNIC_LAN_MODULE =1 , +SSSNIC_CFG_MODULE =7 , +SSSNIC_NETIF_MODULE =14 , +}; +int sssnic_hw_init (struct sssnic_hw *hw);void sssnic_hw_shutdown (struct sssnic_hw *hw);void sssnic_msix_state_set (struct sssnic_hw *hw,uint16_t msix_id,int state);
Signature · 1 line
2.27.0
PATCH v4 10/32 net/sssnic: add dev configure and infos get
In reply to [email protected]From: Renyong Wan <[email protected]>
--- drivers/net/sssnic/base/sssnic_api.c | 33 ++++++++++++ drivers/net/sssnic/base/sssnic_api.h | 8 +++ drivers/net/sssnic/base/sssnic_cmd.h | 14 +++++ drivers/net/sssnic/base/sssnic_hw.c | 33 +++++++++++- drivers/net/sssnic/base/sssnic_hw.h | 6 +++ drivers/net/sssnic/sssnic_ethdev.c | 76 ++++++++++++++++++++++++++++ drivers/net/sssnic/sssnic_ethdev.h | 53 +++++++++++++++++++ 7 files changed, 222 insertions(+), 1 deletion(-)
drivers/net/sssnic/base/sssnic_api.c +33 -0
@@ -100,3 +100,36 @@ sssnic_msix_attr_set(struct sssnic_hw *hw, uint16_t msix_idx,return 0 ; } + +int +sssnic_capability_get (struct sssnic_hw *hw,struct sssnic_capability *capa) +{ +struct sssnic_capability_get_cmd cmd; +struct sssnic_msg msg; +uint32_t cmd_len; +int ret; + +memset (&cmd,0 ,sizeof (cmd)); + cmd_len =sizeof (cmd); + cmd.function =SSSNIC_FUNC_IDX (hw); +sssnic_msg_init (&msg, (uint8_t *)&cmd, cmd_len, +SSSNIC_GET_CAPABILITY_CMD ,SSSNIC_MPU_FUNC_IDX , +SSSNIC_CFG_MODULE ,SSSNIC_MSG_TYPE_REQ ); + ret =sssnic_mbox_send (hw, &msg, (uint8_t *)&cmd, &cmd_len,0 ); +if (ret !=0 ) { +PMD_DRV_LOG (ERR ,"Failed to send mbox message, ret=%d" , ret); +return ret; + } +if (cmd_len ==0 || cmd.common.status !=0 ) { +PMD_DRV_LOG (ERR , +"Bad response to SSSNIC_GET_CAPABILITY_CMD, len=%u, status=%u" , + cmd_len, cmd.common.status); +return -EIO ; + } + + capa->phy_port = cmd.phy_port; + capa->max_num_rxq = cmd.rxq_max_id +1 ; + capa->max_num_txq = cmd.txq_max_id +1 ; + +return 0 ; +}
drivers/net/sssnic/base/sssnic_api.h +8 -0
@@ -15,9 +15,17 @@ struct sssnic_msix_attr { uint8_t resend_timer; }; +struct sssnic_capability { +uint16_t max_num_txq; +uint16_t max_num_rxq; +uint8_t phy_port; +uint8_t cos; +}; +int sssnic_msix_attr_get (struct sssnic_hw *hw,uint16_t msix_idx,struct sssnic_msix_attr *attr);int sssnic_msix_attr_set (struct sssnic_hw *hw,uint16_t msix_idx,struct sssnic_msix_attr *attr); +int sssnic_capability_get (struct sssnic_hw *hw,struct sssnic_capability *capa);#endif /* _SSSNIC_API_H_ */
drivers/net/sssnic/base/sssnic_cmd.h +14 -0
@@ -18,6 +18,8 @@ enum sssnic_mgmt_cmd_id { SSSNIC_GET_FW_VERSION_CMD = 60, }; +#define SSSNIC_GET_CAPABILITY_CMD 0 +struct sssnic_cmd_common {uint8_t status;uint8_t version;
@@ -111,4 +113,16 @@ struct sssnic_msix_ctrl_cmd { uint8_t resvd1[5]; }; +struct sssnic_capability_get_cmd { +struct sssnic_cmd_common common; +uint16_t function; +uint16_t resvd0; +uint8_t resvd1[3 ]; +uint8_t phy_port; +uint32_t resvd2[16 ]; +uint16_t txq_max_id; +uint16_t rxq_max_id; +uint32_t resvd3[63 ]; +}; +#endif /* _SSSNIC_CMD_H_ */
drivers/net/sssnic/base/sssnic_hw.c +32 -1
@@ -253,6 +253,29 @@ sssnic_msix_attr_init(struct sssnic_hw *hw)return 0 ; } +static int +sssnic_capability_init (struct sssnic_hw *hw) +{ +struct sssnic_capability cap; +int ret; + + ret =sssnic_capability_get (hw, &cap); +if (ret !=0 ) { +PMD_DRV_LOG (ERR ,"Failed to get sssnic capability" ); +return ret; + } + +PMD_DRV_LOG (INFO , +"Initialized capability, physic port:%u, max %u txqs, max %u rxqs" , + cap.phy_port, cap.max_num_txq, cap.max_num_rxq); + + hw->phy_port = cap.phy_port; + hw->max_num_rxq = cap.max_num_rxq; + hw->max_num_txq = cap.max_num_txq; + +return 0 ; +} +static int sssnic_base_init (struct sssnic_hw *hw) {
@@ -360,10 +383,18 @@ sssnic_hw_init(struct sssnic_hw *hw) goto ctrlq_init_fail; } + ret =sssnic_capability_init (hw); +if (ret !=0 ) { +PMD_DRV_LOG (ERR ,"Failed to initialize capability" ); + goto capbility_init_fail; + } +sssnic_pf_status_set (hw,SSSNIC_PF_STATUS_ACTIVE ); -return -EINVAL ; +return 0 ; +capbility_init_fail: +sssnic_ctrlq_shutdown (hw); ctrlq_init_fail:sssnic_mbox_shutdown (hw); mbox_init_fail:
drivers/net/sssnic/base/sssnic_hw.h +6 -0
@@ -56,12 +56,18 @@ struct sssnic_hw {struct sssnic_mbox *mbox;struct sssnic_ctrlq *ctrlq;uint8_t num_eventqs; +uint8_t phy_port;uint16_t eth_port_id; +uint16_t max_num_rxq; +uint16_t max_num_txq; };#define SSSNIC_FUNC_IDX (hw) ((hw)->attr.func_idx)#define SSSNIC_ETH_PORT_ID (hw) ((hw)->eth_port_id)#define SSSNIC_MPU_FUNC_IDX 0x1fff +#define SSSNIC_MAX_NUM_RXQ (hw) ((hw)->max_num_rxq) +#define SSSNIC_MAX_NUM_TXQ (hw) ((hw)->max_num_txq) +#define SSSNIC_PHY_PORT (hw) ((hw)->phy_port)#define SSSNIC_FUNC_TYPE (hw) ((hw)->attr.func_type)#define SSSNIC_AF_FUNC_IDX (hw) ((hw)->attr.af_idx)
drivers/net/sssnic/sssnic_ethdev.c +76 -0
94 lines not on this page · raw message
drivers/net/sssnic/sssnic_ethdev.h +53 -0
61 lines not on this page · raw message
Signature · 1 line
2.27.0
PATCH v4 11/32 net/sssnic: add dev MAC ops
In reply to [email protected]From: Renyong Wan <[email protected]>
--- doc/guides/nics/features/sssnic.ini | 2 + drivers/net/sssnic/base/sssnic_api.c | 174 +++++++++++++++++ drivers/net/sssnic/base/sssnic_api.h | 4 + drivers/net/sssnic/base/sssnic_cmd.h | 25 +++ drivers/net/sssnic/base/sssnic_hw.h | 1 + drivers/net/sssnic/sssnic_ethdev.c | 270 ++++++++++++++++++++++++++- drivers/net/sssnic/sssnic_ethdev.h | 2 + 7 files changed, 477 insertions(+), 1 deletion(-)
doc/guides/nics/features/sssnic.ini +2 -0
@@ -4,6 +4,8 @@ ; Refer to default.ini for the full list of available PMD features. ; [Features] +Unicast MAC filter = Y +Multicast MAC filter = Y Linux = Y ARMv8 = Y x86-64 = Y
drivers/net/sssnic/base/sssnic_api.c +174 -0
177 lines not on this page · raw message
drivers/net/sssnic/base/sssnic_api.h +4 -0
@@ -27,5 +27,9 @@ int sssnic_msix_attr_get(struct sssnic_hw *hw, uint16_t msix_idx,int sssnic_msix_attr_set (struct sssnic_hw *hw,uint16_t msix_idx,struct sssnic_msix_attr *attr);int sssnic_capability_get (struct sssnic_hw *hw,struct sssnic_capability *capa); +int sssnic_mac_addr_get (struct sssnic_hw *hw,uint8_t *addr); +int sssnic_mac_addr_update (struct sssnic_hw *hw,uint8_t *new,uint8_t *old); +int sssnic_mac_addr_add (struct sssnic_hw *hw,uint8_t *addr); +int sssnic_mac_addr_del (struct sssnic_hw *hw,uint8_t *addr);#endif /* _SSSNIC_API_H_ */
drivers/net/sssnic/base/sssnic_cmd.h +25 -0
@@ -20,6 +20,14 @@ enum sssnic_mgmt_cmd_id {#define SSSNIC_GET_CAPABILITY_CMD 0 +#define SSSNIC_MAC_ADDR_CMD_STATUS_IGNORED 0x4 +enum sssnic_mac_addr_cmd_id { +SSSNIC_GET_MAC_ADDR_CMD =20 , +SSSNIC_ADD_MAC_ADDR_CMD , +SSSNIC_DEL_MAC_ADDR_CMD , +SSSNIC_UPDATE_MAC_ADDR_CMD , +}; +struct sssnic_cmd_common {uint8_t status;uint8_t version;
@@ -125,4 +133,21 @@ struct sssnic_capability_get_cmd { uint32_t resvd3[63]; }; +struct sssnic_mac_addr_cmd { +struct sssnic_cmd_common common; +uint16_t function; +uint16_t vlan; +uint16_t resvd; +uint8_t addr[6 ]; +}; + +struct sssnic_mac_addr_update_cmd { +struct sssnic_cmd_common common; +uint16_t function; +uint16_t vlan; +uint16_t resvd0; +uint8_t old_addr[6 ]; +uint16_t resvd1; +uint8_t new_addr[6 ]; +};#endif /* _SSSNIC_CMD_H_ */
drivers/net/sssnic/base/sssnic_hw.h +1 -0
@@ -70,6 +70,7 @@ struct sssnic_hw {#define SSSNIC_PHY_PORT (hw) ((hw)->phy_port)#define SSSNIC_FUNC_TYPE (hw) ((hw)->attr.func_type)#define SSSNIC_AF_FUNC_IDX (hw) ((hw)->attr.af_idx) +#define SSSNIC_PF_FUNC_IDX (hw) ((hw)->attr.pf_idx)enum sssnic_module {SSSNIC_COMM_MODULE =0 ,
drivers/net/sssnic/sssnic_ethdev.c +269 -1
312 lines not on this page · raw message
drivers/net/sssnic/sssnic_ethdev.h +2 -0
@@ -58,6 +58,8 @@struct sssnic_netdev {void *hw; +struct rte_ether_addr *mcast_addrs; +struct rte_ether_addr default_addr;uint16_t max_num_txq;uint16_t max_num_rxq; };
Signature · 1 line
2.27.0
PATCH v4 12/32 net/sssnic: support dev link status
In reply to [email protected]From: Renyong Wan <[email protected]>
---
v2:
* Removed error.h from including files.
--- doc/guides/nics/features/sssnic.ini | 1 + drivers/net/sssnic/base/sssnic_api.c | 127 ++++++++++++++++++++++++ drivers/net/sssnic/base/sssnic_api.h | 14 +++ drivers/net/sssnic/base/sssnic_cmd.h | 37 +++++++ drivers/net/sssnic/meson.build | 1 + drivers/net/sssnic/sssnic_ethdev.c | 4 + drivers/net/sssnic/sssnic_ethdev_link.c | 111 +++++++++++++++++++++ drivers/net/sssnic/sssnic_ethdev_link.h | 12 +++ 8 files changed, 307 insertions(+) create mode 100644 drivers/net/sssnic/sssnic_ethdev_link.c create mode 100644 drivers/net/sssnic/sssnic_ethdev_link.h
doc/guides/nics/features/sssnic.ini +1 -0
@@ -4,6 +4,7 @@ ; Refer to default.ini for the full list of available PMD features. ; [Features] +Link status = Y Unicast MAC filter = Y Multicast MAC filter = Y Linux = Y
drivers/net/sssnic/base/sssnic_api.c +127 -0
130 lines not on this page · raw message
drivers/net/sssnic/base/sssnic_api.h +14 -0
@@ -22,6 +22,16 @@ struct sssnic_capability {uint8_t cos; }; +struct sssnic_netif_link_info { +uint8_t status; +uint8_t type; +uint8_t autoneg_capa; +uint8_t autoneg; +uint8_t duplex; +uint8_t speed; +uint8_t fec; +}; +int sssnic_msix_attr_get (struct sssnic_hw *hw,uint16_t msix_idx,struct sssnic_msix_attr *attr); int sssnic_msix_attr_set(struct sssnic_hw *hw, uint16_t msix_idx,
@@ -31,5 +41,9 @@ int sssnic_mac_addr_get(struct sssnic_hw *hw, uint8_t *addr);int sssnic_mac_addr_update (struct sssnic_hw *hw,uint8_t *new,uint8_t *old);int sssnic_mac_addr_add (struct sssnic_hw *hw,uint8_t *addr);int sssnic_mac_addr_del (struct sssnic_hw *hw,uint8_t *addr); +int sssnic_netif_link_status_get (struct sssnic_hw *hw,uint8_t *status); +int sssnic_netif_link_info_get (struct sssnic_hw *hw, +struct sssnic_netif_link_info *info); +int sssnic_netif_enable_set (struct sssnic_hw *hw,uint8_t state);#endif /* _SSSNIC_API_H_ */
drivers/net/sssnic/base/sssnic_cmd.h +37 -0
@@ -27,6 +27,13 @@ enum sssnic_mac_addr_cmd_id { SSSNIC_DEL_MAC_ADDR_CMD, SSSNIC_UPDATE_MAC_ADDR_CMD, }; +enum sssnic_netif_cmd_id { +SSSNIC_SET_NETIF_ENABLE_CMD =6 , +SSSNIC_GET_NETIF_LINK_STATUS_CMD =7 , +SSSNIC_GET_NETIF_MAC_STATS_CMD =151 , +SSSNIC_CLEAR_NETIF_MAC_STATS_CMD =152 , +SSSNIC_GET_NETIF_LINK_INFO_CMD =153 , +};struct sssnic_cmd_common {uint8_t status;
@@ -150,4 +157,34 @@ struct sssnic_mac_addr_update_cmd {uint16_t resvd1; uint8_t new_addr[6]; }; +struct sssnic_netif_link_status_get_cmd { +struct sssnic_cmd_common common; +uint8_t port; +uint8_t status; +uint16_t rsvd; +}; + +struct sssnic_netif_link_info_get_cmd { +struct sssnic_cmd_common common; +uint8_t port; +uint8_t resvd0[3 ]; +uint8_t type; +uint8_t autoneg_capa; +uint8_t autoneg; +uint8_t duplex; +uint8_t speed; +uint8_t fec; +uint8_t resvd1[18 ]; +}; + +#define SSSNIC_SET_NETIF_ENABLE_CMD_FLAG_TX_EN 0x1 +#define SSSNIC_SET_NETIF_ENABLE_CMD_FLAG_RX_EN 0x2 +struct sssnic_netif_enable_set_cmd { +struct sssnic_cmd_common common; +uint16_t function; +uint16_t resvd0; +uint8_t flag; +uint8_t resvd1[3 ]; +}; +#endif /* _SSSNIC_CMD_H_ */
drivers/net/sssnic/meson.build +1 -0
@@ -18,4 +18,5 @@ objs = [base_objs] sources = files( 'sssnic_ethdev.c', + 'sssnic_ethdev_link.c', )
drivers/net/sssnic/sssnic_ethdev.c +4 -0
@@ -9,6 +9,7 @@#include "base/sssnic_hw.h" #include "base/sssnic_api.h" #include "sssnic_ethdev.h" +#include "sssnic_ethdev_link.h" static int sssnic_ethdev_infos_get(struct rte_eth_dev *ethdev,
@@ -339,6 +340,9 @@ sssnic_ethdev_release(struct rte_eth_dev *ethdev) }static const struct eth_dev_ops sssnic_ethdev_ops = { + .dev_set_link_up = sssnic_ethdev_set_link_up, + .dev_set_link_down = sssnic_ethdev_set_link_down, + .link_update = sssnic_ethdev_link_update, .dev_configure = sssnic_ethdev_configure, .dev_infos_get = sssnic_ethdev_infos_get, .mac_addr_set = sssnic_ethdev_mac_addr_set,
drivers/net/sssnic/sssnic_ethdev_link.c new file +111 -0
111 lines not on this page · raw message
drivers/net/sssnic/sssnic_ethdev_link.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2018-2022 Shenzhen 3SNIC Information Technology Co., Ltd. +*/ + +#ifndef _SSSNIC_ETHDEV_LINK_H_ +#define _SSSNIC_ETHDEV_LINK_H_ + +int sssnic_ethdev_set_link_up (struct rte_eth_dev *ethdev); +int sssnic_ethdev_set_link_down (struct rte_eth_dev *ethdev); +int sssnic_ethdev_link_update (struct rte_eth_dev *ethdev,int wait_to_complete); + +#endif /* _SSSNIC_ETHDEV_LINK_H_ */
Signature · 1 line
2.27.0
PATCH v4 13/32 net/sssnic: support link status event
In reply to [email protected]From: Renyong Wan <[email protected]>
---
v2:
* Fixed 'EINVAL' undeclared.
--- doc/guides/nics/features/sssnic.ini | 1 + drivers/net/sssnic/base/meson.build | 1 + drivers/net/sssnic/base/sssnic_exception.c | 116 +++++++++++++++++++++ drivers/net/sssnic/base/sssnic_exception.h | 10 ++ drivers/net/sssnic/base/sssnic_hw.c | 46 ++++++++ drivers/net/sssnic/base/sssnic_hw.h | 22 ++++ drivers/net/sssnic/sssnic_ethdev.c | 6 +- drivers/net/sssnic/sssnic_ethdev_link.c | 98 +++++++++++++++++ drivers/net/sssnic/sssnic_ethdev_link.h | 2 + 9 files changed, 301 insertions(+), 1 deletion(-) create mode 100644 drivers/net/sssnic/base/sssnic_exception.c create mode 100644 drivers/net/sssnic/base/sssnic_exception.h
doc/guides/nics/features/sssnic.ini +1 -0
@@ -5,6 +5,7 @@ ; [Features] Link status = Y +Link status event = Y Unicast MAC filter = Y Multicast MAC filter = Y Linux = Y
drivers/net/sssnic/base/meson.build +1 -0
@@ -9,6 +9,7 @@ sources = [ 'sssnic_workq.c', 'sssnic_ctrlq.c', 'sssnic_api.c', + 'sssnic_exception.c', ] c_args = cflags
drivers/net/sssnic/base/sssnic_exception.c new file +116 -0
116 lines not on this page · raw message
drivers/net/sssnic/base/sssnic_exception.h new file +10 -0
@@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2018-2022 Shenzhen 3SNIC Information Technology Co., Ltd. +*/ + +#ifndef _SSSNIC_EXCEPTION_H_ +#define _SSSNIC_EXCEPTION_H_ + +int sssnic_exception_process_init (struct sssnic_hw *hw); + +#endif /* _SSSNIC_EXCEPTION_H_ */
drivers/net/sssnic/base/sssnic_hw.c +46 -0
70 lines not on this page · raw message
drivers/net/sssnic/base/sssnic_hw.h +22 -0
@@ -44,6 +44,22 @@ struct sssnic_hw_attr {uint16_t num_irq; }; +enum sssnic_link_status { +SSSNIC_LINK_STATUS_DOWN , +SSSNIC_LINK_STATUS_UP , +}; + +#define SSSNIC_LINK_INTR_MSIX_ID 0 +#define SSSNIC_LINK_INTR_EVENTQ 0 + +typedef void sssnic_link_event_cb_t (uint8_t port, +enum sssnic_link_status status,void *priv); + +struct sssnic_link_event_handler { +sssnic_link_event_cb_t *cb; +void *priv; +}; +struct sssnic_hw {struct rte_pci_device *pci_dev;uint8_t *cfg_base_addr;
@@ -55,6 +71,7 @@ struct sssnic_hw {struct sssnic_msg_inbox *msg_inbox;struct sssnic_mbox *mbox;struct sssnic_ctrlq *ctrlq; +struct sssnic_link_event_handler link_event_handler;uint8_t num_eventqs;uint8_t phy_port;uint16_t eth_port_id;
@@ -82,5 +99,10 @@ enum sssnic_module {int sssnic_hw_init (struct sssnic_hw *hw);void sssnic_hw_shutdown (struct sssnic_hw *hw);void sssnic_msix_state_set (struct sssnic_hw *hw,uint16_t msix_id,int state); +void sssnic_msix_resend_disable (struct sssnic_hw *hw,uint16_t msix_id); +int sssnic_link_event_callback_register (struct sssnic_hw *hw, +sssnic_link_event_cb_t *cb,void *priv); +void sssnic_link_event_callback_unregister (struct sssnic_hw *hw); +void sssnic_link_intr_handle (struct sssnic_hw *hw);#endif /* _SSSNIC_HW_H_ */
drivers/net/sssnic/sssnic_ethdev.c +5 -1
@@ -334,6 +334,7 @@ sssnic_ethdev_release(struct rte_eth_dev *ethdev) {struct sssnic_hw *hw =SSSNIC_ETHDEV_TO_HW (ethdev); +sssnic_ethdev_link_intr_disable (ethdev);sssnic_ethdev_mac_addrs_clean (ethdev);sssnic_hw_shutdown (hw);rte_free (hw);
@@ -391,6 +392,9 @@ sssnic_ethdev_init(struct rte_eth_dev *ethdev) ethdev->dev_ops = &sssnic_ethdev_ops; +sssnic_ethdev_link_update (ethdev,0 ); +sssnic_ethdev_link_intr_enable (ethdev); +return 0 ; mac_addrs_init_fail:
@@ -440,7 +444,7 @@ static const struct rte_pci_id sssnic_pci_id_map[] = {static struct rte_pci_driver sssnic_pmd = { .id_table = sssnic_pci_id_map, - .drv_flags =RTE_PCI_DRV_NEED_MAPPING , + .drv_flags =RTE_PCI_DRV_NEED_MAPPING |RTE_PCI_DRV_INTR_LSC , .probe = sssnic_pci_probe, .remove = sssnic_pci_remove, };
drivers/net/sssnic/sssnic_ethdev_link.c +98 -0
101 lines not on this page · raw message
drivers/net/sssnic/sssnic_ethdev_link.h +2 -0
@@ -8,5 +8,7 @@int sssnic_ethdev_set_link_up (struct rte_eth_dev *ethdev);int sssnic_ethdev_set_link_down (struct rte_eth_dev *ethdev);int sssnic_ethdev_link_update (struct rte_eth_dev *ethdev,int wait_to_complete); +void sssnic_ethdev_link_intr_enable (struct rte_eth_dev *ethdev); +void sssnic_ethdev_link_intr_disable (struct rte_eth_dev *ethdev);#endif /* _SSSNIC_ETHDEV_LINK_H_ */
Signature · 1 line
2.27.0
PATCH v4 14/32 net/sssnic: support Rx queue setup and release
In reply to [email protected]From: Renyong Wan <[email protected]>
---
v2:
* Removed error.h from including files.
--- drivers/net/sssnic/meson.build | 1 + drivers/net/sssnic/sssnic_ethdev.c | 4 + drivers/net/sssnic/sssnic_ethdev.h | 2 + drivers/net/sssnic/sssnic_ethdev_rx.c | 420 ++++++++++++++++++++++++++ drivers/net/sssnic/sssnic_ethdev_rx.h | 24 ++ 5 files changed, 451 insertions(+) create mode 100644 drivers/net/sssnic/sssnic_ethdev_rx.c create mode 100644 drivers/net/sssnic/sssnic_ethdev_rx.h
drivers/net/sssnic/meson.build +1 -0
@@ -19,4 +19,5 @@ objs = [base_objs] sources = files( 'sssnic_ethdev.c', 'sssnic_ethdev_link.c', + 'sssnic_ethdev_rx.c', )
drivers/net/sssnic/sssnic_ethdev.c +4 -0
@@ -10,6 +10,7 @@#include "base/sssnic_api.h" #include "sssnic_ethdev.h" #include "sssnic_ethdev_link.h" +#include "sssnic_ethdev_rx.h" static int sssnic_ethdev_infos_get(struct rte_eth_dev *ethdev,
@@ -335,6 +336,7 @@ sssnic_ethdev_release(struct rte_eth_dev *ethdev)struct sssnic_hw *hw =SSSNIC_ETHDEV_TO_HW (ethdev);sssnic_ethdev_link_intr_disable (ethdev); +sssnic_ethdev_rx_queue_all_release (ethdev);sssnic_ethdev_mac_addrs_clean (ethdev);sssnic_hw_shutdown (hw);rte_free (hw);
@@ -350,6 +352,8 @@ static const struct eth_dev_ops sssnic_ethdev_ops = { .mac_addr_remove = sssnic_ethdev_mac_addr_remove, .mac_addr_add = sssnic_ethdev_mac_addr_add, .set_mc_addr_list = sssnic_ethdev_set_mc_addr_list, + .rx_queue_setup = sssnic_ethdev_rx_queue_setup, + .rx_queue_release = sssnic_ethdev_rx_queue_release, }; static int
drivers/net/sssnic/sssnic_ethdev.h +2 -0
@@ -56,6 +56,8 @@#define SSSNIC_ETHDEV_MAX_NUM_UC_MAC 128#define SSSNIC_ETHDEV_MAX_NUM_MC_MAC 2048 +#define SSSNIC_ETHDEV_DEF_RX_FREE_THRESH 32 +struct sssnic_netdev {void *hw;struct rte_ether_addr *mcast_addrs;
drivers/net/sssnic/sssnic_ethdev_rx.c new file +420 -0
420 lines not on this page · raw message
drivers/net/sssnic/sssnic_ethdev_rx.h new file +24 -0
@@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2018-2022 Shenzhen 3SNIC Information Technology Co., Ltd. +*/ + +#ifndef _SSSNIC_ETHDEV_RX_H_ +#define _SSSNIC_ETHDEV_RX_H_ + +struct sssnic_ethdev_rxq_stats { +uint64_t packets; +uint64_t bytes; +uint64_t csum_errors; +uint64_t other_errors; +uint64_t nombuf; +uint64_t burst; +}; + +int sssnic_ethdev_rx_queue_setup (struct rte_eth_dev *ethdev, +uint16_t rx_queue_id,uint16_t nb_rx_desc,unsigned int socket_id, +const struct rte_eth_rxconf *rx_conf,struct rte_mempool *mb_pool); +void sssnic_ethdev_rx_queue_release (struct rte_eth_dev *ethdev, +uint16_t queue_id); +void sssnic_ethdev_rx_queue_all_release (struct rte_eth_dev *ethdev); + +#endif
Signature · 1 line
2.27.0
PATCH v4 15/32 net/sssnic: support Tx queue setup and release
In reply to [email protected]From: Renyong Wan <[email protected]>
---
v2:
* Removed error.h from including files.
v4:
* Fixed coding style issue of REPEATED_WORD.
--- drivers/net/sssnic/meson.build | 1 + drivers/net/sssnic/sssnic_ethdev.c | 4 + drivers/net/sssnic/sssnic_ethdev.h | 1 + drivers/net/sssnic/sssnic_ethdev_tx.c | 354 ++++++++++++++++++++++++++ drivers/net/sssnic/sssnic_ethdev_tx.h | 27 ++ 5 files changed, 387 insertions(+) create mode 100644 drivers/net/sssnic/sssnic_ethdev_tx.c create mode 100644 drivers/net/sssnic/sssnic_ethdev_tx.h
drivers/net/sssnic/meson.build +1 -0
@@ -20,4 +20,5 @@ sources = files( 'sssnic_ethdev.c', 'sssnic_ethdev_link.c', 'sssnic_ethdev_rx.c', + 'sssnic_ethdev_tx.c', )
drivers/net/sssnic/sssnic_ethdev.c +4 -0
@@ -11,6 +11,7 @@#include "sssnic_ethdev.h" #include "sssnic_ethdev_link.h" #include "sssnic_ethdev_rx.h" +#include "sssnic_ethdev_tx.h" static int sssnic_ethdev_infos_get(struct rte_eth_dev *ethdev,
@@ -336,6 +337,7 @@ sssnic_ethdev_release(struct rte_eth_dev *ethdev)struct sssnic_hw *hw =SSSNIC_ETHDEV_TO_HW (ethdev);sssnic_ethdev_link_intr_disable (ethdev); +sssnic_ethdev_tx_queue_all_release (ethdev);sssnic_ethdev_rx_queue_all_release (ethdev);sssnic_ethdev_mac_addrs_clean (ethdev);sssnic_hw_shutdown (hw);
@@ -354,6 +356,8 @@ static const struct eth_dev_ops sssnic_ethdev_ops = { .set_mc_addr_list = sssnic_ethdev_set_mc_addr_list, .rx_queue_setup = sssnic_ethdev_rx_queue_setup, .rx_queue_release = sssnic_ethdev_rx_queue_release, + .tx_queue_setup = sssnic_ethdev_tx_queue_setup, + .tx_queue_release = sssnic_ethdev_tx_queue_release, }; static int
drivers/net/sssnic/sssnic_ethdev.h +1 -0
@@ -57,6 +57,7 @@#define SSSNIC_ETHDEV_MAX_NUM_MC_MAC 2048#define SSSNIC_ETHDEV_DEF_RX_FREE_THRESH 32 +#define SSSNIC_ETHDEV_DEF_TX_FREE_THRESH 32struct sssnic_netdev {void *hw;
drivers/net/sssnic/sssnic_ethdev_tx.c new file +354 -0
354 lines not on this page · raw message
drivers/net/sssnic/sssnic_ethdev_tx.h new file +27 -0
@@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2018-2022 Shenzhen 3SNIC Information Technology Co., Ltd. +*/ + +#ifndef _SSSNIC_ETHDEV_TX_H_ +#define _SSSNIC_ETHDEV_TX_H_ + +struct sssnic_ethdev_txq_stats { +uint64_t packets; +uint64_t bytes; +uint64_t nobuf; +uint64_t zero_len_segs; +uint64_t too_large_pkts; +uint64_t too_many_segs; +uint64_t null_segs; +uint64_t offload_errors; +uint64_t burst; +}; + +int sssnic_ethdev_tx_queue_setup (struct rte_eth_dev *ethdev, +uint16_t tx_queue_id,uint16_t nb_tx_desc,unsigned int socket_id, +const struct rte_eth_txconf *tx_conf); +void sssnic_ethdev_tx_queue_release (struct rte_eth_dev *ethdev, +uint16_t queue_id); +void sssnic_ethdev_tx_queue_all_release (struct rte_eth_dev *ethdev); + +#endif /* _SSSNIC_ETHDEV_TX_H_ */
Signature · 1 line
2.27.0
PATCH v4 16/32 net/sssnic: support Rx queue start and stop
In reply to [email protected]From: Renyong Wan <[email protected]>
--- drivers/net/sssnic/base/sssnic_api.c | 63 +++++ drivers/net/sssnic/base/sssnic_api.h | 2 + drivers/net/sssnic/base/sssnic_cmd.h | 49 ++++ drivers/net/sssnic/sssnic_ethdev.c | 2 + drivers/net/sssnic/sssnic_ethdev.h | 2 + drivers/net/sssnic/sssnic_ethdev_rx.c | 332 ++++++++++++++++++++++++++ drivers/net/sssnic/sssnic_ethdev_rx.h | 4 + 7 files changed, 454 insertions(+)
drivers/net/sssnic/base/sssnic_api.c +63 -0
@@ -11,6 +11,7 @@#include "sssnic_hw.h" #include "sssnic_cmd.h" #include "sssnic_mbox.h" +#include "sssnic_ctrlq.h" #include "sssnic_api.h" int
@@ -434,3 +435,65 @@ sssnic_netif_enable_set(struct sssnic_hw *hw, uint8_t state)return 0 ; } + +int +sssnic_port_enable_set (struct sssnic_hw *hw,bool state) +{ +int ret; +struct sssnic_port_enable_set_cmd cmd; +struct sssnic_msg msg; +uint32_t cmd_len; + +if (hw ==NULL ) +return -EINVAL ; + +memset (&cmd,0 ,sizeof (cmd)); + cmd.function =SSSNIC_FUNC_IDX (hw); + cmd.state = state ?1 :0 ; + cmd_len =sizeof (cmd); +sssnic_msg_init (&msg, (uint8_t *)&cmd, cmd_len, +SSSNIC_SET_PORT_ENABLE_CMD ,SSSNIC_MPU_FUNC_IDX , +SSSNIC_LAN_MODULE ,SSSNIC_MSG_TYPE_REQ ); + ret =sssnic_mbox_send (hw, &msg, (uint8_t *)&cmd, &cmd_len,0 ); +if (ret !=0 ) { +PMD_DRV_LOG (ERR ,"Failed to send mbox message, ret=%d" , ret); +return ret; + } + +if (cmd_len ==0 || cmd.common.status !=0 ) { +PMD_DRV_LOG (ERR , +"Bad response to SSSNIC_SET_PORT_ENABLE_CMD, len=%u, status=%u" , + cmd_len, cmd.common.status); +return -EIO ; + } + +return 0 ; +} + +int +sssnic_rxq_flush (struct sssnic_hw *hw,uint16_t qid) +{ +struct sssnic_ctrlq_cmd cmd; +struct sssnic_rxq_flush_cmd data; +int ret; + + data.u32 =0 ; + data.qid = qid; + data.u32 =rte_cpu_to_be_32 (data.u32); + +memset (&cmd,0 ,sizeof (cmd)); + cmd.data = &data; + cmd.module =SSSNIC_LAN_MODULE ; + cmd.data_len =sizeof (data); + cmd.cmd =SSSNIC_FLUSH_RXQ_CMD ; + + ret =sssnic_ctrlq_cmd_exec (hw, &cmd,0 ); +if (ret !=0 || cmd.result !=0 ) { +PMD_DRV_LOG (ERR , +"Failed to execulte ctrlq command %s, ret=%d, result=%" PRIu64, +"SSSNIC_FLUSH_RXQ_CMD" , ret, cmd.result); +return -EIO ; + } + +return 0 ; +}
drivers/net/sssnic/base/sssnic_api.h +2 -0
@@ -45,5 +45,7 @@ int sssnic_netif_link_status_get(struct sssnic_hw *hw, uint8_t *status);int sssnic_netif_link_info_get (struct sssnic_hw *hw,struct sssnic_netif_link_info *info);int sssnic_netif_enable_set (struct sssnic_hw *hw,uint8_t state); +int sssnic_port_enable_set (struct sssnic_hw *hw,bool state); +int sssnic_rxq_flush (struct sssnic_hw *hw,uint16_t qid);#endif /* _SSSNIC_API_H_ */
drivers/net/sssnic/base/sssnic_cmd.h +49 -0
59 lines not on this page · raw message
drivers/net/sssnic/sssnic_ethdev.c +2 -0
@@ -358,6 +358,8 @@ static const struct eth_dev_ops sssnic_ethdev_ops = { .rx_queue_release = sssnic_ethdev_rx_queue_release, .tx_queue_setup = sssnic_ethdev_tx_queue_setup, .tx_queue_release = sssnic_ethdev_tx_queue_release, + .rx_queue_start = sssnic_ethdev_rx_queue_start, + .rx_queue_stop = sssnic_ethdev_rx_queue_stop, }; static int
drivers/net/sssnic/sssnic_ethdev.h +2 -0
@@ -65,6 +65,8 @@ struct sssnic_netdev {struct rte_ether_addr default_addr;uint16_t max_num_txq;uint16_t max_num_rxq; +uint16_t num_started_rxqs; +uint16_t num_started_txqs; };#define SSSNIC_ETHDEV_PRIVATE (eth_dev) \
drivers/net/sssnic/sssnic_ethdev_rx.c +332 -0
359 lines not on this page · raw message
drivers/net/sssnic/sssnic_ethdev_rx.h +4 -0
@@ -20,5 +20,9 @@ int sssnic_ethdev_rx_queue_setup(struct rte_eth_dev *ethdev,void sssnic_ethdev_rx_queue_release (struct rte_eth_dev *ethdev,uint16_t queue_id);void sssnic_ethdev_rx_queue_all_release (struct rte_eth_dev *ethdev); +int sssnic_ethdev_rx_queue_start (struct rte_eth_dev *ethdev,uint16_t queue_id); +int sssnic_ethdev_rx_queue_stop (struct rte_eth_dev *ethdev,uint16_t queue_id); +int sssnic_ethdev_rx_queue_all_start (struct rte_eth_dev *ethdev); +int sssnic_ethdev_rx_queue_all_stop (struct rte_eth_dev *ethdev);#endif
Signature · 1 line
2.27.0
PATCH v4 17/32 net/sssnic: support Tx queue start and stop
In reply to [email protected]From: Renyong Wan <[email protected]>
--- doc/guides/nics/features/sssnic.ini | 1 + drivers/net/sssnic/sssnic_ethdev.c | 2 + drivers/net/sssnic/sssnic_ethdev_tx.c | 155 ++++++++++++++++++++++++++ drivers/net/sssnic/sssnic_ethdev_tx.h | 4 + 4 files changed, 162 insertions(+)
doc/guides/nics/features/sssnic.ini +1 -0
@@ -6,6 +6,7 @@ [Features] Link status = Y Link status event = Y +Queue start/stop = Y Unicast MAC filter = Y Multicast MAC filter = Y Linux = Y
drivers/net/sssnic/sssnic_ethdev.c +2 -0
@@ -360,6 +360,8 @@ static const struct eth_dev_ops sssnic_ethdev_ops = { .tx_queue_release = sssnic_ethdev_tx_queue_release, .rx_queue_start = sssnic_ethdev_rx_queue_start, .rx_queue_stop = sssnic_ethdev_rx_queue_stop, + .tx_queue_start = sssnic_ethdev_tx_queue_start, + .tx_queue_stop = sssnic_ethdev_tx_queue_stop, }; static int
drivers/net/sssnic/sssnic_ethdev_tx.c +155 -0
164 lines not on this page · raw message
drivers/net/sssnic/sssnic_ethdev_tx.h +4 -0
@@ -23,5 +23,9 @@ int sssnic_ethdev_tx_queue_setup(struct rte_eth_dev *ethdev,void sssnic_ethdev_tx_queue_release (struct rte_eth_dev *ethdev,uint16_t queue_id);void sssnic_ethdev_tx_queue_all_release (struct rte_eth_dev *ethdev); +int sssnic_ethdev_tx_queue_start (struct rte_eth_dev *ethdev,uint16_t queue_id); +int sssnic_ethdev_tx_queue_stop (struct rte_eth_dev *ethdev,uint16_t queue_id); +int sssnic_ethdev_tx_queue_all_start (struct rte_eth_dev *ethdev); +void sssnic_ethdev_tx_queue_all_stop (struct rte_eth_dev *ethdev);#endif /* _SSSNIC_ETHDEV_TX_H_ */
Signature · 1 line
2.27.0
PATCH v4 18/32 net/sssnic: add Rx interrupt support
In reply to [email protected]From: Renyong Wan <[email protected]>
--- doc/guides/nics/features/sssnic.ini | 1 + drivers/net/sssnic/base/sssnic_hw.c | 14 +++ drivers/net/sssnic/base/sssnic_hw.h | 2 + drivers/net/sssnic/sssnic_ethdev.c | 2 + drivers/net/sssnic/sssnic_ethdev_rx.c | 135 ++++++++++++++++++++++++++ drivers/net/sssnic/sssnic_ethdev_rx.h | 6 ++ 6 files changed, 160 insertions(+)
doc/guides/nics/features/sssnic.ini +1 -0
@@ -7,6 +7,7 @@ Link status = Y Link status event = Y Queue start/stop = Y +Rx interrupt = Y Unicast MAC filter = Y Multicast MAC filter = Y Linux = Y
drivers/net/sssnic/base/sssnic_hw.c +14 -0
@@ -145,6 +145,20 @@ sssnic_msix_resend_disable(struct sssnic_hw *hw, uint16_t msix_id)sssnic_cfg_reg_write (hw,SSSNIC_MSIX_CTRL_REG , reg.u32); } +void +sssnic_msix_auto_mask_set (struct sssnic_hw *hw,uint16_t msix_id,int state) +{ +struct sssnic_msix_ctrl_reg reg; + + reg.u32 =0 ; +if (state ==SSSNIC_MSIX_ENABLE ) + reg.auto_msk_set =1 ; +else + reg.auto_msk_clr =1 ; + reg.msxi_idx = msix_id; +sssnic_cfg_reg_write (hw,SSSNIC_MSIX_CTRL_REG , reg.u32); +} +static void sssnic_pf_status_set (struct sssnic_hw *hw,enum sssnic_pf_status status) {
drivers/net/sssnic/base/sssnic_hw.h +2 -0
@@ -100,6 +100,8 @@ int sssnic_hw_init(struct sssnic_hw *hw);void sssnic_hw_shutdown (struct sssnic_hw *hw);void sssnic_msix_state_set (struct sssnic_hw *hw,uint16_t msix_id,int state);void sssnic_msix_resend_disable (struct sssnic_hw *hw,uint16_t msix_id); +void sssnic_msix_auto_mask_set (struct sssnic_hw *hw,uint16_t msix_id, +int state);int sssnic_link_event_callback_register (struct sssnic_hw *hw,sssnic_link_event_cb_t *cb,void *priv);void sssnic_link_event_callback_unregister (struct sssnic_hw *hw);
drivers/net/sssnic/sssnic_ethdev.c +2 -0
@@ -362,6 +362,8 @@ static const struct eth_dev_ops sssnic_ethdev_ops = { .rx_queue_stop = sssnic_ethdev_rx_queue_stop, .tx_queue_start = sssnic_ethdev_tx_queue_start, .tx_queue_stop = sssnic_ethdev_tx_queue_stop, + .rx_queue_intr_enable = sssnic_ethdev_rx_queue_intr_enable, + .rx_queue_intr_disable = sssnic_ethdev_rx_queue_intr_disable, }; static int
drivers/net/sssnic/sssnic_ethdev_rx.c +135 -0
144 lines not on this page · raw message
drivers/net/sssnic/sssnic_ethdev_rx.h +6 -0
@@ -24,5 +24,11 @@ int sssnic_ethdev_rx_queue_start(struct rte_eth_dev *ethdev, uint16_t queue_id);int sssnic_ethdev_rx_queue_stop (struct rte_eth_dev *ethdev,uint16_t queue_id);int sssnic_ethdev_rx_queue_all_start (struct rte_eth_dev *ethdev);int sssnic_ethdev_rx_queue_all_stop (struct rte_eth_dev *ethdev); +int sssnic_ethdev_rx_queue_intr_enable (struct rte_eth_dev *ethdev, +uint16_t qid); +int sssnic_ethdev_rx_queue_intr_disable (struct rte_eth_dev *ethdev, +uint16_t qid); +int sssnic_ethdev_rx_intr_init (struct rte_eth_dev *ethdev); +void sssnic_ethdev_rx_intr_shutdown (struct rte_eth_dev *ethdev);#endif
Signature · 1 line
2.27.0
PATCH v4 19/32 net/sssnic: support dev start and stop
In reply to [email protected]From: Renyong Wan <[email protected]>
--- drivers/net/sssnic/base/sssnic_api.c | 508 ++++++++++++++++++++++++++ drivers/net/sssnic/base/sssnic_api.h | 257 +++++++++++++ drivers/net/sssnic/base/sssnic_cmd.h | 100 +++++ drivers/net/sssnic/base/sssnic_misc.h | 34 ++ drivers/net/sssnic/sssnic_ethdev.c | 284 ++++++++++++++ drivers/net/sssnic/sssnic_ethdev.h | 21 ++ drivers/net/sssnic/sssnic_ethdev_rx.c | 270 +++++++++++++- drivers/net/sssnic/sssnic_ethdev_rx.h | 8 + drivers/net/sssnic/sssnic_ethdev_tx.c | 163 +++++++++ drivers/net/sssnic/sssnic_ethdev_tx.h | 6 + 10 files changed, 1650 insertions(+), 1 deletion(-)
drivers/net/sssnic/base/sssnic_api.c +508 -0
@@ -13,6 +13,7 @@#include "sssnic_mbox.h" #include "sssnic_ctrlq.h" #include "sssnic_api.h" +#include "sssnic_misc.h" int sssnic_msix_attr_get(struct sssnic_hw *hw, uint16_t msix_idx,
@@ -497,3 +498,510 @@ sssnic_rxq_flush(struct sssnic_hw *hw, uint16_t qid)return 0 ; } + +static int +sssnic_rxtx_size_set (struct sssnic_hw *hw,uint16_t rx_size,uint16_t tx_size, +uint32_t flags) +{ +int ret; +struct sssnic_rxtx_size_set_cmd cmd; +struct sssnic_msg msg; +uint32_t cmd_len; + +if (hw ==NULL ) +return -EINVAL ; + +memset (&cmd,0 ,sizeof (cmd)); + cmd.function =SSSNIC_FUNC_IDX (hw); + cmd.rx_size = rx_size; + cmd.tx_size = tx_size; + cmd.flags = flags; + cmd_len =sizeof (cmd); +sssnic_msg_init (&msg, (uint8_t *)&cmd, cmd_len, +SSSNIC_SET_PORT_RXTX_SIZE_CMD ,SSSNIC_MPU_FUNC_IDX , +SSSNIC_LAN_MODULE ,SSSNIC_MSG_TYPE_REQ ); + ret =sssnic_mbox_send (hw, &msg, (uint8_t *)&cmd, &cmd_len,0 ); +if (ret !=0 ) { +PMD_DRV_LOG (ERR ,"Failed to send mbox message, ret=%d" , ret); +return ret; + } + +if (cmd_len ==0 || cmd.common.status !=0 ) { +PMD_DRV_LOG (ERR , +"Bad response to SSSNIC_SET_PORT_RXTX_SIZE_CMD, len=%u, status=%u" , + cmd_len, cmd.common.status); +return -EIO ; + } + +return 0 ; +} + +int +sssnic_rxtx_max_size_init (struct sssnic_hw *hw,uint16_t rx_size, +uint16_t tx_size) +{ +return sssnic_rxtx_size_set (hw, rx_size, tx_size, +SSSNIC_CMD_INIT_RXTX_SIZE_FLAG |SSSNIC_CMD_SET_RX_SIZE_FLAG | +SSSNIC_CMD_SET_TX_SIZE_FLAG ); +} + +int +sssnic_tx_max_size_set (struct sssnic_hw *hw,uint16_t tx_size) +{ +return sssnic_rxtx_size_set (hw,0 , tx_size, +SSSNIC_CMD_SET_TX_SIZE_FLAG ); +} + +int +sssnic_port_features_get (struct sssnic_hw *hw,uint64_t *features) +{ +int ret; +struct sssnic_port_feature_cmd cmd; +struct sssnic_msg msg; +uint32_t cmd_len; + +memset (&cmd,0 ,sizeof (cmd)); + cmd.function =SSSNIC_FUNC_IDX (hw); + cmd.opcode =SSSNIC_CMD_OPCODE_GET ; + cmd_len =sizeof (cmd); +sssnic_msg_init (&msg, (uint8_t *)&cmd, cmd_len,SSSNIC_PORT_FEATURE_CMD , +SSSNIC_MPU_FUNC_IDX ,SSSNIC_LAN_MODULE ,SSSNIC_MSG_TYPE_REQ ); + ret =sssnic_mbox_send (hw, &msg, (uint8_t *)&cmd, &cmd_len,0 ); +if (ret !=0 ) { +PMD_DRV_LOG (ERR ,"Failed to send mbox message, ret=%d" , ret); +return ret; + } + +if (cmd_len ==0 || cmd.common.status !=0 ) { +PMD_DRV_LOG (ERR , +"Bad response to SSSNIC_PORT_FEATURE_CMD, len=%u, status=%u" , + cmd_len, cmd.common.status); +return -EIO ; + } + + *features = cmd.features; + +return 0 ; +} + +int +sssnic_port_features_set (struct sssnic_hw *hw,uint64_t features) +{ +int ret; +struct sssnic_port_feature_cmd cmd; +struct sssnic_msg msg; +uint32_t cmd_len; + +memset (&cmd,0 ,sizeof (cmd)); + cmd.function =SSSNIC_FUNC_IDX (hw); + cmd.features = features; + cmd.opcode =SSSNIC_CMD_OPCODE_SET ; + cmd_len =sizeof (cmd); +sssnic_msg_init (&msg, (uint8_t *)&cmd, cmd_len,SSSNIC_PORT_FEATURE_CMD , +SSSNIC_MPU_FUNC_IDX ,SSSNIC_LAN_MODULE ,SSSNIC_MSG_TYPE_REQ ); + ret =sssnic_mbox_send (hw, &msg, (uint8_t *)&cmd, &cmd_len,0 ); +if (ret !=0 ) { +PMD_DRV_LOG (ERR ,"Failed to send mbox message, ret=%d" , ret); +return ret; + } + +if (cmd_len ==0 || cmd.common.status !=0 ) { +PMD_DRV_LOG (ERR , +"Bad response to SSSNIC_PORT_FEATURE_CMD, len=%u, status=%u" , + cmd_len, cmd.common.status); +return -EIO ; + } + +return 0 ; +} + +#define SSSNIC_MAX_NUM_RXTXQ_CTX_SET_IN_BULK \ + ((SSSNIC_CTRLQ_MAX_CMD_DATA_LEN - SSSNIC_RXTXQ_CTX_CMD_INFO_LEN) / \ + SSSNIC_RXTXQ_CTX_SIZE) + +static int +sssnic_rxtxq_ctx_set (struct sssnic_hw *hw,struct sssnic_rxtxq_ctx *q_ctx, +uint16_t q_start,enum sssnic_rxtxq_ctx_type type,uint16_t count) +{ +struct sssnic_ctrlq_cmd *cmd; +struct sssnic_rxtxq_ctx_cmd *data; +struct sssnic_rxtxq_ctx *ctx; +uint32_t num, i; +uint32_t max_num; +struct sssnic_rxtxq_ctx_cmd_info cmd_info; +int ret =0 ; + + cmd =sssnic_ctrlq_cmd_alloc (hw); +if (cmd ==NULL ) { +PMD_DRV_LOG (ERR ,"Failed to alloc ctrlq command" ); +return -ENOMEM ; + } + + data = cmd->data; + ctx = (struct sssnic_rxtxq_ctx *)(data +1 ); + max_num =SSSNIC_MAX_NUM_RXTXQ_CTX_SET_IN_BULK ; + +while (count >0 ) { + num =RTE_MIN (count, max_num); + + cmd_info.q_count = num; + cmd_info.q_type = type; + cmd_info.q_start = q_start; + cmd_info.resvd0 =0 ; +sssnic_mem_cpu_to_be_32 (&cmd_info, &data->info, +sizeof (struct sssnic_rxtxq_ctx_cmd_info )); + +for (i =0 ; i < num; i++) +sssnic_mem_cpu_to_be_32 (q_ctx + i, ctx + i, +SSSNIC_RXTXQ_CTX_SIZE ); + + cmd->data_len =sizeof (struct sssnic_rxtxq_ctx_cmd_info ) + + (SSSNIC_RXTXQ_CTX_SIZE * num); + cmd->module =SSSNIC_LAN_MODULE ; + cmd->cmd =SSSNIC_SET_RXTXQ_CTX_CMD ; + +rte_wmb (); + + ret =sssnic_ctrlq_cmd_exec (hw, cmd,0 ); +if (ret !=0 || cmd->result !=0 ) { +PMD_DRV_LOG (ERR , +"Failed to execulte ctrlq command %s, ret=%d, result=%" PRIu64, +"SSSNIC_SET_RXTXQ_CTX_CMD" , ret, cmd->result); + ret = -EIO ; + goto out; + } + + count -= num; + q_ctx += num; + q_start += num; + } + +out: +sssnic_ctrlq_cmd_destroy (hw, cmd); +return ret; +} + +int +sssnic_txq_ctx_set (struct sssnic_hw *hw,struct sssnic_txq_ctx *ctx, +uint16_t qstart,uint16_t count) +{ +return sssnic_rxtxq_ctx_set (hw, (struct sssnic_rxtxq_ctx *)ctx, qstart, +SSSNIC_TXQ_CTX , count); +} + +int +sssnic_rxq_ctx_set (struct sssnic_hw *hw,struct sssnic_rxq_ctx *ctx, +uint16_t qstart,uint16_t count) +{ +return sssnic_rxtxq_ctx_set (hw, (struct sssnic_rxtxq_ctx *)ctx, qstart, +SSSNIC_RXQ_CTX , count); +} + +static int +sssnic_offload_ctx_reset (struct sssnic_hw *hw,uint16_t q_start, +enum sssnic_rxtxq_ctx_type q_type,uint16_t count) +{ +struct sssnic_ctrlq_cmd cmd; +struct sssnic_offload_ctx_reset_cmd data; +int ret; + +memset (&cmd,0 ,sizeof (cmd)); +memset (&data,0 ,sizeof (data)); + + data.info.q_count = count; + data.info.q_start = q_start; + data.info.q_type = q_type; + + cmd.data = &data; + cmd.module =SSSNIC_LAN_MODULE ; + cmd.data_len =sizeof (data); + cmd.cmd =SSSNIC_RESET_OFFLOAD_CTX_CMD ; + +sssnic_mem_cpu_to_be_32 (&data, &data,sizeof (data)); + + ret =sssnic_ctrlq_cmd_exec (hw, &cmd,0 ); +if (ret !=0 || cmd.result !=0 ) { +PMD_DRV_LOG (ERR , +"Failed to execulte ctrlq command %s, ret=%d, result=%" PRIu64, +"SSSNIC_RESET_OFFLOAD_CTX_CMD" , ret, cmd.result); + +return -EIO ; + } + +return 0 ; +} + +int +sssnic_rx_offload_ctx_reset (struct sssnic_hw *hw) +{ +return sssnic_offload_ctx_reset (hw,0 ,SSSNIC_RXQ_CTX , +SSSNIC_MAX_NUM_RXQ (hw)); +} + +int +sssnic_tx_offload_ctx_reset (struct sssnic_hw *hw) +{ +return sssnic_offload_ctx_reset (hw,0 ,SSSNIC_TXQ_CTX , +SSSNIC_MAX_NUM_TXQ (hw)); +} + +int +sssnic_rxtx_ctx_set (struct sssnic_hw *hw,bool lro_en,uint16_t rxq_depth, +uint16_t rx_buf,uint16_t txq_depth) +{ +int ret; +struct sssnic_msg msg; +struct sssnic_root_ctx_cmd cmd; +uint32_t cmd_len; + +memset (&cmd,0 ,sizeof (cmd)); + cmd.func_id =SSSNIC_FUNC_IDX (hw); + cmd.lro_enable = lro_en ?1 :0 ; + cmd.rx_buf = rx_buf; + cmd.rxq_depth = (uint16_t )rte_log2_u32 (rxq_depth); + cmd.txq_depth = (uint16_t )rte_log2_u32 (txq_depth); + cmd_len =sizeof (cmd); + +sssnic_msg_init (&msg, (uint8_t *)&cmd, cmd_len,SSSNIC_SET_ROOT_CTX_CMD , +SSSNIC_MPU_FUNC_IDX ,SSSNIC_COMM_MODULE ,SSSNIC_MSG_TYPE_REQ ); + ret =sssnic_mbox_send (hw, &msg, (uint8_t *)&cmd, &cmd_len,0 ); +if (ret !=0 ) { +PMD_DRV_LOG (ERR ,"Failed to send mbox message, ret=%d" , ret); +return ret; + } +if (cmd_len ==0 || cmd.common.status !=0 ) { +PMD_DRV_LOG (ERR , +"Bad response to SET_ROOT_CTX_CMD, len=%u, status=%u" , + cmd_len, cmd.common.status); +return -EIO ; + } + +return 0 ; +} + +int +sssnic_port_tx_ci_attr_set (struct sssnic_hw *hw,uint16_t tx_qid, +uint8_t pending_limit,uint8_t coalescing_time,uint64_t dma_addr) +{ +int ret; +struct sssnic_port_tx_ci_attr_set_cmd cmd; +struct sssnic_msg msg; +uint32_t cmd_len; + +memset (&cmd,0 ,sizeof (cmd)); + cmd.function =SSSNIC_FUNC_IDX (hw); + cmd.coalescing_time = coalescing_time; + cmd.pending_limit = pending_limit; + cmd.qid = tx_qid; + cmd.dma_addr = dma_addr >>2 ; + cmd_len =sizeof (cmd); +sssnic_msg_init (&msg, (uint8_t *)&cmd, cmd_len, +SSSNIC_SET_PORT_TX_CI_ATTR_CMD ,SSSNIC_MPU_FUNC_IDX , +SSSNIC_LAN_MODULE ,SSSNIC_MSG_TYPE_REQ ); + ret =sssnic_mbox_send (hw, &msg, (uint8_t *)&cmd, &cmd_len,0 ); +if (ret !=0 ) { +PMD_DRV_LOG (ERR ,"Failed to send mbox message, ret=%d" , ret); +return ret; + } + +if (cmd_len ==0 || cmd.common.status !=0 ) { +PMD_DRV_LOG (ERR , +"Bad response to SSSNIC_SET_PORT_TX_CI_ATTR_CMD, len=%u, status=%u" , + cmd_len, cmd.common.status); +return -EIO ; + } + +return 0 ; +} + +int +sssnic_port_rx_mode_set (struct sssnic_hw *hw,uint32_t mode) +{ +int ret; +struct sssnic_port_rx_mode_set_cmd cmd; +struct sssnic_msg msg; +uint32_t cmd_len; + +memset (&cmd,0 ,sizeof (cmd)); + cmd.function =SSSNIC_FUNC_IDX (hw); + cmd.mode = mode; + cmd_len =sizeof (cmd); +sssnic_msg_init (&msg, (uint8_t *)&cmd, cmd_len, +SSSNIC_SET_PORT_RX_MODE_CMD ,SSSNIC_MPU_FUNC_IDX , +SSSNIC_LAN_MODULE ,SSSNIC_MSG_TYPE_REQ ); + + ret =sssnic_mbox_send (hw, &msg, (uint8_t *)&cmd, &cmd_len,0 ); +if (ret !=0 ) { +PMD_DRV_LOG (ERR ,"Failed to send mbox message, ret=%d" , ret); +return ret; + } + +if (cmd_len ==0 || cmd.common.status !=0 ) { +PMD_DRV_LOG (ERR , +"Bad response to SSSNIC_SET_PORT_RX_MODE_CMD, len=%u, status=%u" , + cmd_len, cmd.common.status); +return -EIO ; + } + +return 0 ; +} + +int +sssnic_lro_enable_set (struct sssnic_hw *hw,bool ipv4_en,bool ipv6_en, +uint8_t nb_lro_bufs) +{ +int ret; +struct sssnic_lro_cfg_cmd cmd; +struct sssnic_msg msg; +uint32_t cmd_len; + +memset (&cmd,0 ,sizeof (cmd)); + cmd.function =SSSNIC_FUNC_IDX (hw); + cmd.ipv4_en = ipv4_en ?1 :0 ; + cmd.opcode =SSSNIC_CMD_OPCODE_SET ; + cmd.ipv6_en = ipv6_en ?1 :0 ; + cmd.nb_bufs = nb_lro_bufs; + cmd_len =sizeof (cmd); +sssnic_msg_init (&msg, (uint8_t *)&cmd, cmd_len,SSSNIC_PORT_LRO_CFG_CMD , +SSSNIC_MPU_FUNC_IDX ,SSSNIC_LAN_MODULE ,SSSNIC_MSG_TYPE_REQ ); + ret =sssnic_mbox_send (hw, &msg, (uint8_t *)&cmd, &cmd_len,0 ); +if (ret !=0 ) { +PMD_DRV_LOG (ERR ,"Failed to send mbox message, ret=%d" , ret); +return ret; + } + +if (cmd_len ==0 || cmd.common.status !=0 ) { +PMD_DRV_LOG (ERR , +"Bad response to SSSNIC_PORT_LRO_CFG_CMD, len=%u, status=%u" , + cmd_len, cmd.common.status); +return -EIO ; + } + +return 0 ; +} + +int +sssnic_lro_timer_set (struct sssnic_hw *hw,uint32_t timer) +{ +int ret; +struct sssnic_lro_timer_cmd cmd; +struct sssnic_msg msg; +uint32_t cmd_len; + +if (SSSNIC_FUNC_TYPE (hw) ==SSSNIC_FUNC_TYPE_VF ) +return 0 ; + +memset (&cmd,0 ,sizeof (cmd)); + cmd.opcode =SSSNIC_CMD_OPCODE_SET ; + cmd.timer = timer; + cmd_len =sizeof (cmd); +sssnic_msg_init (&msg, (uint8_t *)&cmd, cmd_len, +SSSNIC_PORT_LRO_TIMER_CMD ,SSSNIC_MPU_FUNC_IDX , +SSSNIC_LAN_MODULE ,SSSNIC_MSG_TYPE_REQ ); + ret =sssnic_mbox_send (hw, &msg, (uint8_t *)&cmd, &cmd_len,0 ); +if (ret !=0 ) { +PMD_DRV_LOG (ERR ,"Failed to send mbox message, ret=%d" , ret); +return ret; + } + +if (cmd_len ==0 || cmd.common.status !=0 ) { +PMD_DRV_LOG (ERR , +"Bad response to SSSNIC_PORT_LRO_TIMER_CMD, len=%u, status=%u" , + cmd_len, cmd.common.status); +return -EIO ; + } + +return 0 ; +} + +int +sssnic_vlan_filter_enable_set (struct sssnic_hw *hw,bool state) +{ +int ret; +struct sssnic_vlan_filter_enable_cmd cmd; +struct sssnic_msg msg; +uint32_t cmd_len; + +memset (&cmd,0 ,sizeof (cmd)); + cmd.function =SSSNIC_FUNC_IDX (hw); + cmd.state = state ?1 :0 ; + cmd_len =sizeof (cmd); +sssnic_msg_init (&msg, (uint8_t *)&cmd, cmd_len, +SSSNIC_ENABLE_PORT_VLAN_FILTER_CMD ,SSSNIC_MPU_FUNC_IDX , +SSSNIC_LAN_MODULE ,SSSNIC_MSG_TYPE_REQ ); + ret =sssnic_mbox_send (hw, &msg, (uint8_t *)&cmd, &cmd_len,0 ); +if (ret !=0 ) { +PMD_DRV_LOG (ERR ,"Failed to send mbox message, ret=%d" , ret); +return ret; + } + +if (cmd_len ==0 || cmd.common.status !=0 ) { +PMD_DRV_LOG (ERR , +"Bad response to SSSNIC_ENABLE_PORT_VLAN_FILTER_CMD, len=%u, status=%u" , + cmd_len, cmd.common.status); +return -EIO ; + } + +return 0 ; +} + +int +sssnic_vlan_strip_enable_set (struct sssnic_hw *hw,bool state) +{ +int ret; +struct sssnic_vlan_strip_enable_cmd cmd; +struct sssnic_msg msg; +uint32_t cmd_len; + +memset (&cmd,0 ,sizeof (cmd)); + cmd.function =SSSNIC_FUNC_IDX (hw); + cmd.state = state ?1 :0 ; + cmd_len =sizeof (cmd); +sssnic_msg_init (&msg, (uint8_t *)&cmd, cmd_len, +SSSNIC_ENABLE_PORT_VLAN_STRIP_CMD ,SSSNIC_MPU_FUNC_IDX , +SSSNIC_LAN_MODULE ,SSSNIC_MSG_TYPE_REQ ); + ret =sssnic_mbox_send (hw, &msg, (uint8_t *)&cmd, &cmd_len,0 ); +if (ret !=0 ) { +PMD_DRV_LOG (ERR ,"Failed to send mbox message, ret=%d" , ret); +return ret; + } + +if (cmd_len ==0 || cmd.common.status !=0 ) { +PMD_DRV_LOG (ERR , +"Bad response to SSSNIC_ENABLE_PORT_VLAN_STRIP_CMD, len=%u, status=%u" , + cmd_len, cmd.common.status); +return -EIO ; + } + +return 0 ; +} + +int +sssnic_port_resource_clean (struct sssnic_hw *hw) +{ +int ret; +struct sssnic_port_resource_clean_cmd cmd; +struct sssnic_msg msg; +uint32_t cmd_len; + +memset (&cmd,0 ,sizeof (cmd)); + cmd.function =SSSNIC_FUNC_IDX (hw); + cmd_len =sizeof (cmd); +sssnic_msg_init (&msg, (uint8_t *)&cmd, cmd_len, +SSSNIC_CLEAN_PORT_RES_CMD ,SSSNIC_MPU_FUNC_IDX , +SSSNIC_LAN_MODULE ,SSSNIC_MSG_TYPE_REQ ); + ret =sssnic_mbox_send (hw, &msg, (uint8_t *)&cmd, &cmd_len,0 ); +if (ret !=0 ) { +PMD_DRV_LOG (ERR ,"Failed to send mbox message, ret=%d" , ret); +return ret; + } + +if (cmd_len ==0 || cmd.common.status !=0 ) { +PMD_DRV_LOG (ERR , +"Bad response to SSSNIC_CLEAN_PORT_RES_CMD, len=%u, status=%u" , + cmd_len, cmd.common.status); +return -EIO ; + } + +return 0 ; +}
drivers/net/sssnic/base/sssnic_api.h +257 -0
268 lines not on this page · raw message
drivers/net/sssnic/base/sssnic_cmd.h +100 -0
104 lines not on this page · raw message
drivers/net/sssnic/base/sssnic_misc.h +34 -0
@@ -8,4 +8,38 @@#define SSSNIC_LOWER_32_BITS (x) ((uint32_t)(x))#define SSSNIC_UPPER_32_BITS (x) ((uint32_t)(((x) >> 16) >> 16)) +static inline void +sssnic_mem_cpu_to_be_32 (void *in,void *out,int size) +{ +uint32_t i; +uint32_t num; +uint32_t *data_in = (uint32_t *)in; +uint32_t *data_out = (uint32_t *)out; + + num = size /sizeof (uint32_t ); + +for (i =0 ; i < num; i++) { + *data_out =rte_cpu_to_be_32 (*data_in); + data_in++; + data_out++; + } +} + +static inline void +sssnic_mem_be_to_cpu_32 (void *in,void *out,int size) +{ +uint32_t i; +uint32_t num; +uint32_t *data_in = (uint32_t *)in; +uint32_t *data_out = (uint32_t *)out; + + num = size /sizeof (uint32_t ); + +for (i =0 ; i < num; i++) { + *data_out =rte_be_to_cpu_32 (*data_in); + data_in++; + data_out++; + } +} +#endif /* _SSSNIC_MISC_H_ */
drivers/net/sssnic/sssnic_ethdev.c +284 -0
297 lines not on this page · raw message
drivers/net/sssnic/sssnic_ethdev.h +21 -0
@@ -59,6 +59,25 @@#define SSSNIC_ETHDEV_DEF_RX_FREE_THRESH 32#define SSSNIC_ETHDEV_DEF_TX_FREE_THRESH 32 +#define SSSNIC_ETHDEV_DEFAULT_FEATURES 0x3fff + +enum sssnic_ethdev_rx_mode { +SSSNIC_ETHDEV_RX_MODE_NONE =0 , +SSSNIC_ETHDEV_RX_UCAST =RTE_BIT32 (0 ), +SSSNIC_ETHDEV_RX_MCAST =RTE_BIT32 (1 ), +SSSNIC_ETHDEV_RX_BCAST =RTE_BIT32 (2 ), +SSSNIC_ETHDEV_RX_ALL_MCAST =RTE_BIT32 (3 ), +SSSNIC_ETHDEV_RX_PROMISC =RTE_BIT32 (4 ), +SSSNIC_ETHDEV_RX_MODE_INVAL =RTE_BIT32 (5 ), +}; + +#define SSSNIC_ETHDEV_DEF_RX_MODE \ + (SSSNIC_ETHDEV_RX_UCAST | SSSNIC_ETHDEV_RX_MCAST | \ + SSSNIC_ETHDEV_RX_BCAST) + +#define SSSNIC_ETHDEV_LRO_BUF_SIZE 1024 +#define SSSNIC_ETHDEV_LRO_TIMER 16 +struct sssnic_netdev {void *hw;struct rte_ether_addr *mcast_addrs;
@@ -67,6 +86,8 @@ struct sssnic_netdev {uint16_t max_num_rxq;uint16_t num_started_rxqs;uint16_t num_started_txqs; +uint16_t max_rx_size; +uint32_t rx_mode; };#define SSSNIC_ETHDEV_PRIVATE (eth_dev) \
drivers/net/sssnic/sssnic_ethdev_rx.c +269 -1
279 lines not on this page · raw message
drivers/net/sssnic/sssnic_ethdev_rx.h +8 -0
@@ -30,5 +30,13 @@ int sssnic_ethdev_rx_queue_intr_disable(struct rte_eth_dev *ethdev, uint16_t qid);int sssnic_ethdev_rx_intr_init (struct rte_eth_dev *ethdev);void sssnic_ethdev_rx_intr_shutdown (struct rte_eth_dev *ethdev); +uint16_t sssnic_ethdev_rx_max_size_determine (struct rte_eth_dev *ethdev); +int sssnic_ethdev_rx_queues_ctx_init (struct rte_eth_dev *ethdev); +int sssnic_ethdev_rx_offload_ctx_reset (struct rte_eth_dev *ethdev); +uint16_t sssnic_ethdev_rx_queue_depth_get (struct rte_eth_dev *ethdev, +uint16_t qid); +uint32_t sssnic_ethdev_rx_buf_size_index_get (uint16_t rx_buf_size); +int sssnic_ethdev_rx_mode_set (struct rte_eth_dev *ethdev,uint32_t mode); +int sssnic_ethdev_rx_offload_setup (struct rte_eth_dev *ethdev);#endif
drivers/net/sssnic/sssnic_ethdev_tx.c +163 -0
172 lines not on this page · raw message
drivers/net/sssnic/sssnic_ethdev_tx.h +6 -0
@@ -27,5 +27,11 @@ int sssnic_ethdev_tx_queue_start(struct rte_eth_dev *ethdev, uint16_t queue_id);int sssnic_ethdev_tx_queue_stop (struct rte_eth_dev *ethdev,uint16_t queue_id);int sssnic_ethdev_tx_queue_all_start (struct rte_eth_dev *ethdev);void sssnic_ethdev_tx_queue_all_stop (struct rte_eth_dev *ethdev); +int sssnic_ethdev_tx_queues_ctx_init (struct rte_eth_dev *ethdev); +int sssnic_ethdev_tx_offload_ctx_reset (struct rte_eth_dev *ethdev); +uint16_t sssnic_ethdev_tx_queue_depth_get (struct rte_eth_dev *ethdev, +uint16_t qid); +int sssnic_ethdev_tx_ci_attr_init (struct rte_eth_dev *ethdev); +int sssnic_ethdev_tx_max_size_set (struct rte_eth_dev *ethdev,uint16_t size);#endif /* _SSSNIC_ETHDEV_TX_H_ */
Signature · 1 line
2.27.0
PATCH v4 20/32 net/sssnic: support dev close and reset
In reply to [email protected]From: Renyong Wan <[email protected]>
--- drivers/net/sssnic/sssnic_ethdev.c | 32 ++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
drivers/net/sssnic/sssnic_ethdev.c +32 -0
@@ -13,6 +13,8 @@#include "sssnic_ethdev_rx.h" #include "sssnic_ethdev_tx.h" +static int sssnic_ethdev_init (struct rte_eth_dev *ethdev); +static int sssnic_ethdev_infos_get (struct rte_eth_dev *ethdev,struct rte_eth_dev_info *devinfo)
@@ -622,9 +624,39 @@ sssnic_ethdev_stop(struct rte_eth_dev *ethdev)return 0 ; } +static int +sssnic_ethdev_close (struct rte_eth_dev *ethdev) +{ +sssnic_ethdev_release (ethdev); + +PMD_DRV_LOG (INFO ,"Port %u is closed" , ethdev->data->port_id); + +return 0 ; +} + +static int +sssnic_ethdev_reset (struct rte_eth_dev *ethdev) +{ +int ret; + +sssnic_ethdev_release (ethdev); + + ret =sssnic_ethdev_init (ethdev); +if (ret !=0 ) { +PMD_DRV_LOG (ERR ,"Failed to initialize sssnic ethdev" ); +return ret; + } + +PMD_DRV_LOG (INFO ,"Port %u is reset" , ethdev->data->port_id); + +return 0 ; +} +static const struct eth_dev_ops sssnic_ethdev_ops = { .dev_start = sssnic_ethdev_start, .dev_stop = sssnic_ethdev_stop, + .dev_close = sssnic_ethdev_close, + .dev_reset = sssnic_ethdev_reset, .dev_set_link_up = sssnic_ethdev_set_link_up, .dev_set_link_down = sssnic_ethdev_set_link_down, .link_update = sssnic_ethdev_link_update,
Signature · 1 line
2.27.0
PATCH v4 21/32 net/sssnic: add allmulticast and promiscuous ops
In reply to [email protected]From: Renyong Wan <[email protected]>
--- doc/guides/nics/features/sssnic.ini | 2 + drivers/net/sssnic/sssnic_ethdev.c | 72 +++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+)
doc/guides/nics/features/sssnic.ini +2 -0
@@ -8,6 +8,8 @@ Link status = Y Link status event = Y Queue start/stop = Y Rx interrupt = Y +Promiscuous mode = Y +Allmulticast mode = Y Unicast MAC filter = Y Multicast MAC filter = Y Linux = Y
drivers/net/sssnic/sssnic_ethdev.c +72 -0
84 lines not on this page · raw message
Signature · 1 line
2.27.0
PATCH v4 22/32 net/sssnic: add basic and extended stats ops
In reply to [email protected]From: Renyong Wan <[email protected]>
---
v2:
* Removed error.h from including files.
--- doc/guides/nics/features/sssnic.ini | 3 + drivers/net/sssnic/base/sssnic_api.c | 154 +++++++++ drivers/net/sssnic/base/sssnic_api.h | 116 +++++++ drivers/net/sssnic/base/sssnic_cmd.h | 12 + drivers/net/sssnic/meson.build | 1 + drivers/net/sssnic/sssnic_ethdev.c | 6 + drivers/net/sssnic/sssnic_ethdev_rx.c | 30 ++ drivers/net/sssnic/sssnic_ethdev_rx.h | 4 + drivers/net/sssnic/sssnic_ethdev_stats.c | 391 +++++++++++++++++++++++ drivers/net/sssnic/sssnic_ethdev_stats.h | 18 ++ drivers/net/sssnic/sssnic_ethdev_tx.c | 36 +++ drivers/net/sssnic/sssnic_ethdev_tx.h | 4 + 12 files changed, 775 insertions(+) create mode 100644 drivers/net/sssnic/sssnic_ethdev_stats.c create mode 100644 drivers/net/sssnic/sssnic_ethdev_stats.h
doc/guides/nics/features/sssnic.ini +3 -0
@@ -12,6 +12,9 @@ Promiscuous mode = Y Allmulticast mode = Y Unicast MAC filter = Y Multicast MAC filter = Y +Basic stats = Y +Extended stats = Y +Stats per queue = Y Linux = Y ARMv8 = Y x86-64 = Y
drivers/net/sssnic/base/sssnic_api.c +154 -0
157 lines not on this page · raw message
drivers/net/sssnic/base/sssnic_api.h +116 -0
127 lines not on this page · raw message
drivers/net/sssnic/base/sssnic_cmd.h +12 -0
@@ -336,4 +336,16 @@ struct sssnic_port_resource_clean_cmd { uint16_t resvd; }; +struct sssnic_port_stats_cmd { +struct sssnic_cmd_common common; +uint16_t function; +uint16_t resvd; +}; + +struct sssnic_mac_stats_cmd { +struct sssnic_cmd_common common; +uint8_t port; +uint8_t resvd[3 ]; +}; +#endif /* _SSSNIC_CMD_H_ */
drivers/net/sssnic/meson.build +1 -0
@@ -21,4 +21,5 @@ sources = files( 'sssnic_ethdev_link.c', 'sssnic_ethdev_rx.c', 'sssnic_ethdev_tx.c', + 'sssnic_ethdev_stats.c', )
drivers/net/sssnic/sssnic_ethdev.c +6 -0
@@ -12,6 +12,7 @@#include "sssnic_ethdev_link.h" #include "sssnic_ethdev_rx.h" #include "sssnic_ethdev_tx.h" +#include "sssnic_ethdev_stats.h" static int sssnic_ethdev_init (struct rte_eth_dev *ethdev);
@@ -748,6 +749,11 @@ static const struct eth_dev_ops sssnic_ethdev_ops = { .allmulticast_disable = sssnic_ethdev_allmulticast_disable, .promiscuous_enable = sssnic_ethdev_promiscuous_enable, .promiscuous_disable = sssnic_ethdev_promiscuous_disable, + .stats_get = sssnic_ethdev_stats_get, + .stats_reset = sssnic_ethdev_stats_reset, + .xstats_get_names = sssnic_ethdev_xstats_get_names, + .xstats_get = sssnic_ethdev_xstats_get, + .xstats_reset = sssnic_ethdev_xstats_reset, }; static int
drivers/net/sssnic/sssnic_ethdev_rx.c +30 -0
@@ -1153,3 +1153,33 @@ sssnic_ethdev_rx_offload_setup(struct rte_eth_dev *ethdev)return 0 ; } + +int +sssnic_ethdev_rx_queue_stats_get (struct rte_eth_dev *ethdev,uint16_t qid, +struct sssnic_ethdev_rxq_stats *stats) +{ +struct sssnic_ethdev_rxq *rxq; + +if (qid >= ethdev->data->nb_rx_queues) { +PMD_DRV_LOG (ERR , +"Invalid qid, qid must less than nb_rx_queues(%u)" , + ethdev->data->nb_rx_queues); +return -EINVAL ; + } + + rxq = ethdev->data->rx_queues[qid]; +memcpy (stats, &rxq->stats,sizeof (rxq->stats)); + +return 0 ; +} + +void +sssnic_ethdev_rx_queue_stats_clear (struct rte_eth_dev *ethdev,uint16_t qid) +{ +struct sssnic_ethdev_rxq *rxq; + +if (qid < ethdev->data->nb_rx_queues) { + rxq = ethdev->data->rx_queues[qid]; +memset (&rxq->stats,0 ,sizeof (rxq->stats)); + } +};
drivers/net/sssnic/sssnic_ethdev_rx.h +4 -0
@@ -38,5 +38,9 @@ uint16_t sssnic_ethdev_rx_queue_depth_get(struct rte_eth_dev *ethdev,uint32_t sssnic_ethdev_rx_buf_size_index_get (uint16_t rx_buf_size);int sssnic_ethdev_rx_mode_set (struct rte_eth_dev *ethdev,uint32_t mode);int sssnic_ethdev_rx_offload_setup (struct rte_eth_dev *ethdev); +int sssnic_ethdev_rx_queue_stats_get (struct rte_eth_dev *ethdev,uint16_t qid, +struct sssnic_ethdev_rxq_stats *stats); +void sssnic_ethdev_rx_queue_stats_clear (struct rte_eth_dev *ethdev, +uint16_t qid);#endif
drivers/net/sssnic/sssnic_ethdev_stats.c new file +391 -0
391 lines not on this page · raw message
drivers/net/sssnic/sssnic_ethdev_stats.h new file +18 -0
@@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2018-2022 Shenzhen 3SNIC Information Technology Co., Ltd. +*/ + +#ifndef _SSSNIC_ETHDEV_STATS_H_ +#define _SSSNIC_ETHDEV_STATS_H_ + +int sssnic_ethdev_stats_get (struct rte_eth_dev *ethdev, +struct rte_eth_stats *stats); +int sssnic_ethdev_stats_reset (struct rte_eth_dev *ethdev); +int sssnic_ethdev_xstats_get_names (struct rte_eth_dev *ethdev, +struct rte_eth_xstat_name *xstats_names, + __rte_unused unsigned int limit); +int sssnic_ethdev_xstats_get (struct rte_eth_dev *ethdev, +struct rte_eth_xstat *xstats,unsigned int n); +int sssnic_ethdev_xstats_reset (struct rte_eth_dev *ethdev); + +#endif /* _SSSNIC_ETHDEV_STATS_H_ */
drivers/net/sssnic/sssnic_ethdev_tx.c +36 -0
@@ -670,3 +670,39 @@ sssnic_ethdev_tx_max_size_set(struct rte_eth_dev *ethdev, uint16_t size)return 0 ; }; + +int +sssnic_ethdev_tx_queue_stats_get (struct rte_eth_dev *ethdev,uint16_t qid, +struct sssnic_ethdev_txq_stats *stats) +{ +struct sssnic_ethdev_txq *txq; + +if (qid >= ethdev->data->nb_tx_queues) { +PMD_DRV_LOG (ERR , +"Invalid qid, qid must less than nb_tx_queues(%u)" , + ethdev->data->nb_tx_queues); +return -EINVAL ; + } + + txq = ethdev->data->tx_queues[qid]; +memcpy (stats, &txq->stats,sizeof (txq->stats)); + +return 0 ; +} + +void +sssnic_ethdev_tx_queue_stats_clear (struct rte_eth_dev *ethdev,uint16_t qid) +{ +struct sssnic_ethdev_txq *txq; +uint64_t *stat; +int i, len; + + len =sizeof (struct sssnic_ethdev_txq_stats ) /sizeof (uint64_t ); + +if (qid < ethdev->data->nb_tx_queues) { + txq = ethdev->data->tx_queues[qid]; + stat = (uint64_t *)&txq->stats; +for (i =0 ; i < len; i++) + *(stat++) =0 ; + } +}
drivers/net/sssnic/sssnic_ethdev_tx.h +4 -0
@@ -33,5 +33,9 @@ uint16_t sssnic_ethdev_tx_queue_depth_get(struct rte_eth_dev *ethdev, uint16_t qid);int sssnic_ethdev_tx_ci_attr_init (struct rte_eth_dev *ethdev);int sssnic_ethdev_tx_max_size_set (struct rte_eth_dev *ethdev,uint16_t size); +int sssnic_ethdev_tx_queue_stats_get (struct rte_eth_dev *ethdev,uint16_t qid, +struct sssnic_ethdev_txq_stats *stats); +void sssnic_ethdev_tx_queue_stats_clear (struct rte_eth_dev *ethdev, +uint16_t qid);#endif /* _SSSNIC_ETHDEV_TX_H_ */
Signature · 1 line
2.27.0
PATCH v4 23/32 net/sssnic: support Rx packet burst
In reply to [email protected]From: Renyong Wan <[email protected]>
---
v2:
* Fixed wrong format of printing uint64_t.
--- doc/guides/nics/features/sssnic.ini | 2 + drivers/net/sssnic/sssnic_ethdev.c | 2 + drivers/net/sssnic/sssnic_ethdev_rx.c | 167 ++++++++++++++++++++++++++ drivers/net/sssnic/sssnic_ethdev_rx.h | 2 + 4 files changed, 173 insertions(+)
doc/guides/nics/features/sssnic.ini +2 -0
@@ -8,6 +8,8 @@ Link status = Y Link status event = Y Queue start/stop = Y Rx interrupt = Y +Scattered Rx = Y +LRO = Y Promiscuous mode = Y Allmulticast mode = Y Unicast MAC filter = Y
drivers/net/sssnic/sssnic_ethdev.c +2 -0
@@ -769,6 +769,8 @@ sssnic_ethdev_init(struct rte_eth_dev *ethdev)if (rte_eal_process_type () !=RTE_PROC_PRIMARY )return 0 ; + ethdev->rx_pkt_burst = sssnic_ethdev_rx_pkt_burst; + netdev =SSSNIC_ETHDEV_PRIVATE (ethdev); pci_dev =RTE_ETH_DEV_TO_PCI (ethdev); hw =rte_zmalloc ("sssnic_hw" ,sizeof (struct sssnic_hw ),0 );
drivers/net/sssnic/sssnic_ethdev_rx.c +167 -0
170 lines not on this page · raw message
drivers/net/sssnic/sssnic_ethdev_rx.h +2 -0
@@ -42,5 +42,7 @@ int sssnic_ethdev_rx_queue_stats_get(struct rte_eth_dev *ethdev, uint16_t qid, struct sssnic_ethdev_rxq_stats *stats);void sssnic_ethdev_rx_queue_stats_clear (struct rte_eth_dev *ethdev,uint16_t qid); +uint16_t sssnic_ethdev_rx_pkt_burst (void *rx_queue,struct rte_mbuf **rx_pkts, +uint16_t nb_pkts);#endif
Signature · 1 line
2.27.0
PATCH v4 24/32 net/sssnic: support Tx packet burst
In reply to [email protected]From: Renyong Wan <[email protected]>
---
v2:
* Fixed wrong format of printing uint64_t.
--- doc/guides/nics/features/sssnic.ini | 5 + drivers/net/sssnic/sssnic_ethdev.c | 1 + drivers/net/sssnic/sssnic_ethdev_tx.c | 404 ++++++++++++++++++++++++++ drivers/net/sssnic/sssnic_ethdev_tx.h | 2 + 4 files changed, 412 insertions(+)
doc/guides/nics/features/sssnic.ini +5 -0
@@ -9,11 +9,16 @@ Link status event = Y Queue start/stop = Y Rx interrupt = Y Scattered Rx = Y +TSO = Y LRO = Y Promiscuous mode = Y Allmulticast mode = Y Unicast MAC filter = Y Multicast MAC filter = Y +L3 checksum offload = Y +L4 checksum offload = Y +Inner L3 checksum = Y +Inner L4 checksum = Y Basic stats = Y Extended stats = Y Stats per queue = Y
drivers/net/sssnic/sssnic_ethdev.c +1 -0
@@ -770,6 +770,7 @@ sssnic_ethdev_init(struct rte_eth_dev *ethdev)return 0 ; ethdev->rx_pkt_burst = sssnic_ethdev_rx_pkt_burst; + ethdev->tx_pkt_burst = sssnic_ethdev_tx_pkt_burst; netdev =SSSNIC_ETHDEV_PRIVATE (ethdev); pci_dev =RTE_ETH_DEV_TO_PCI (ethdev);
drivers/net/sssnic/sssnic_ethdev_tx.c +404 -0
431 lines not on this page · raw message
drivers/net/sssnic/sssnic_ethdev_tx.h +2 -0
@@ -37,5 +37,7 @@ int sssnic_ethdev_tx_queue_stats_get(struct rte_eth_dev *ethdev, uint16_t qid, struct sssnic_ethdev_txq_stats *stats);void sssnic_ethdev_tx_queue_stats_clear (struct rte_eth_dev *ethdev,uint16_t qid); +uint16_t sssnic_ethdev_tx_pkt_burst (void *tx_queue,struct rte_mbuf **tx_pkts, +uint16_t nb_pkts);#endif /* _SSSNIC_ETHDEV_TX_H_ */
Signature · 1 line
2.27.0
PATCH v4 25/32 net/sssnic: add RSS support
In reply to [email protected]From: Renyong Wan <[email protected]>
---
v2:
* Removed error.h from including files.
--- doc/guides/nics/features/sssnic.ini | 4 + drivers/net/sssnic/base/sssnic_api.c | 338 ++++++++++++++++++++++ drivers/net/sssnic/base/sssnic_api.h | 36 +++ drivers/net/sssnic/base/sssnic_cmd.h | 58 ++++ drivers/net/sssnic/meson.build | 1 + drivers/net/sssnic/sssnic_ethdev.c | 16 ++ drivers/net/sssnic/sssnic_ethdev.h | 2 + drivers/net/sssnic/sssnic_ethdev_rss.c | 377 +++++++++++++++++++++++++ drivers/net/sssnic/sssnic_ethdev_rss.h | 20 ++ drivers/net/sssnic/sssnic_ethdev_rx.c | 13 + 10 files changed, 865 insertions(+) create mode 100644 drivers/net/sssnic/sssnic_ethdev_rss.c create mode 100644 drivers/net/sssnic/sssnic_ethdev_rss.h
doc/guides/nics/features/sssnic.ini +4 -0
@@ -15,6 +15,10 @@ Promiscuous mode = Y Allmulticast mode = Y Unicast MAC filter = Y Multicast MAC filter = Y +RSS hash = Y +RSS key update = Y +RSS reta update = Y +Inner RSS = Y L3 checksum offload = Y L4 checksum offload = Y Inner L3 checksum = Y
drivers/net/sssnic/base/sssnic_api.c +338 -0
341 lines not on this page · raw message
drivers/net/sssnic/base/sssnic_api.h +36 -0
@@ -378,6 +378,30 @@ struct sssnic_mac_stats {uint64_t rx_unfilter_pkts; }; +struct sssnic_rss_type { +union { +uint32_t mask; +struct { +uint32_t resvd :23 ; +uint32_t valid :1 ; +uint32_t ipv6_tcp_ex :1 ; +uint32_t ipv6_ex :1 ; +uint32_t ipv6_tcp :1 ; +uint32_t ipv6 :1 ; +uint32_t ipv4_tcp :1 ; +uint32_t ipv4 :1 ; +uint32_t ipv6_udp :1 ; +uint32_t ipv4_udp :1 ; + }; + }; +}; + +enum sssnic_rss_hash_engine_type { +SSSNIC_RSS_HASH_ENGINE_XOR , +SSSNIC_RSS_HASH_ENGINE_TOEP , +SSSNIC_RSS_HASH_ENGINE_COUNT , +}; +int sssnic_msix_attr_get (struct sssnic_hw *hw,uint16_t msix_idx,struct sssnic_msix_attr *attr); int sssnic_msix_attr_set(struct sssnic_hw *hw, uint16_t msix_idx,
@@ -420,5 +444,17 @@ int sssnic_port_stats_get(struct sssnic_hw *hw,int sssnic_port_stats_clear (struct sssnic_hw *hw);int sssnic_mac_stats_get (struct sssnic_hw *hw,struct sssnic_mac_stats *stats);int sssnic_mac_stats_clear (struct sssnic_hw *hw); +int sssnic_rss_enable_set (struct sssnic_hw *hw,bool state); +int sssnic_rss_profile_create (struct sssnic_hw *hw); +int sssnic_rss_profile_destroy (struct sssnic_hw *hw); +int sssnic_rss_hash_key_set (struct sssnic_hw *hw,uint8_t *key,uint16_t len); +int sssnic_rss_type_set (struct sssnic_hw *hw,struct sssnic_rss_type *type); +int sssnic_rss_type_get (struct sssnic_hw *hw,struct sssnic_rss_type *type); +int sssnic_rss_hash_engine_set (struct sssnic_hw *hw, +enum sssnic_rss_hash_engine_type engine); +int sssnic_rss_indir_table_set (struct sssnic_hw *hw,const uint16_t *entry, +uint32_t num_entries); +int sssnic_rss_indir_table_get (struct sssnic_hw *hw,uint16_t *entry, +uint32_t num_entries);#endif /* _SSSNIC_API_H_ */
drivers/net/sssnic/base/sssnic_cmd.h +58 -0
68 lines not on this page · raw message
drivers/net/sssnic/meson.build +1 -0
@@ -22,4 +22,5 @@ sources = files( 'sssnic_ethdev_rx.c', 'sssnic_ethdev_tx.c', 'sssnic_ethdev_stats.c', + 'sssnic_ethdev_rss.c', )
drivers/net/sssnic/sssnic_ethdev.c +16 -0
@@ -13,6 +13,7 @@#include "sssnic_ethdev_rx.h" #include "sssnic_ethdev_tx.h" #include "sssnic_ethdev_stats.h" +#include "sssnic_ethdev_rss.h" static int sssnic_ethdev_init (struct rte_eth_dev *ethdev);
@@ -542,6 +543,13 @@ sssnic_ethdev_start(struct rte_eth_dev *ethdev) goto rx_mode_reset; } +/* setup RSS */ + ret =sssnic_ethdev_rss_setup (ethdev); +if (ret !=0 ) { +PMD_DRV_LOG (ERR ,"Failed to setup RSS" ); + goto rx_mode_reset; + } +/* start all rx queues */ ret =sssnic_ethdev_rx_queue_all_start (ethdev);if (ret !=0 ) {
@@ -572,6 +580,7 @@ sssnic_ethdev_start(struct rte_eth_dev *ethdev) clean_port_res:sssnic_ethdev_resource_clean (ethdev); rx_mode_reset: +sssnic_ethdev_rss_shutdown (ethdev);sssnic_ethdev_rx_mode_set (ethdev,SSSNIC_ETHDEV_RX_MODE_NONE ); rxtx_ctx_clean:sssnic_ethdev_rxtx_ctx_clean (ethdev);
@@ -614,6 +623,9 @@ sssnic_ethdev_stop(struct rte_eth_dev *ethdev)/* shut down rx queue interrupt */ sssnic_ethdev_rx_intr_shutdown (ethdev); +/* Disable RSS */ +sssnic_ethdev_rss_shutdown (ethdev); +/* clean rxtx context */ sssnic_ethdev_rxtx_ctx_clean (ethdev);
@@ -754,6 +766,10 @@ static const struct eth_dev_ops sssnic_ethdev_ops = { .xstats_get_names = sssnic_ethdev_xstats_get_names, .xstats_get = sssnic_ethdev_xstats_get, .xstats_reset = sssnic_ethdev_xstats_reset, + .rss_hash_conf_get = sssnic_ethdev_rss_hash_config_get, + .rss_hash_update = sssnic_ethdev_rss_hash_update, + .reta_update = sssnic_ethdev_rss_reta_update, + .reta_query = sssnic_ethdev_rss_reta_query, }; static int
drivers/net/sssnic/sssnic_ethdev.h +2 -0
@@ -88,6 +88,8 @@ struct sssnic_netdev {uint16_t num_started_txqs;uint16_t max_rx_size;uint32_t rx_mode; +uint32_t rss_enable; +uint8_t rss_hash_key[SSSNIC_ETHDEV_RSS_KEY_SZ ]; };#define SSSNIC_ETHDEV_PRIVATE (eth_dev) \
drivers/net/sssnic/sssnic_ethdev_rss.c new file +377 -0
377 lines not on this page · raw message
drivers/net/sssnic/sssnic_ethdev_rss.h new file +20 -0
@@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2018-2022 Shenzhen 3SNIC Information Technology Co., Ltd. +*/ + +#ifndef _SSSNIC_ETHDEV_RSS_H_ +#define _SSSNIC_ETHDEV_RSS_H_ + +int sssnic_ethdev_rss_hash_update (struct rte_eth_dev *ethdev, +struct rte_eth_rss_conf *rss_conf); +int sssnic_ethdev_rss_hash_config_get (struct rte_eth_dev *ethdev, +struct rte_eth_rss_conf *rss_conf); +int sssnic_ethdev_rss_reta_update (struct rte_eth_dev *ethdev, +struct rte_eth_rss_reta_entry64 *reta_conf,uint16_t reta_size); +int sssnic_ethdev_rss_reta_query (struct rte_eth_dev *ethdev, +struct rte_eth_rss_reta_entry64 *reta_conf,uint16_t reta_size); +int sssnic_ethdev_rss_reta_reset (struct rte_eth_dev *ethdev); +int sssnic_ethdev_rss_setup (struct rte_eth_dev *ethdev); +int sssnic_ethdev_rss_shutdown (struct rte_eth_dev *ethdev); + +#endif /* _SSSNIC_ETHDEV_RSS_H_ */
drivers/net/sssnic/sssnic_ethdev_rx.c +13 -0
@@ -10,6 +10,7 @@#include "sssnic_log.h" #include "sssnic_ethdev.h" #include "sssnic_ethdev_rx.h" +#include "sssnic_ethdev_rss.h" #include "base/sssnic_hw.h" #include "base/sssnic_workq.h" #include "base/sssnic_api.h"
@@ -640,6 +641,10 @@ sssnic_ethdev_rx_queue_start(struct rte_eth_dev *ethdev, uint16_t queue_id) netdev->num_started_rxqs++; ethdev->data->rx_queue_state[queue_id] =RTE_ETH_QUEUE_STATE_STARTED ; + ret =sssnic_ethdev_rss_reta_reset (ethdev); +if (ret) +PMD_DRV_LOG (WARNING ,"Failed to reset RSS reta" ); +PMD_DRV_LOG (DEBUG ,"port %u rxq %u started" , ethdev->data->port_id, queue_id);
@@ -673,6 +678,10 @@ sssnic_ethdev_rx_queue_stop(struct rte_eth_dev *ethdev, uint16_t queue_id) netdev->num_started_rxqs--; ethdev->data->rx_queue_state[queue_id] =RTE_ETH_QUEUE_STATE_STOPPED ; + ret =sssnic_ethdev_rss_reta_reset (ethdev); +if (ret) +PMD_DRV_LOG (WARNING ,"Failed to reset RSS reta" ); +PMD_DRV_LOG (DEBUG ,"port %u rxq %u stopped" , ethdev->data->port_id, queue_id);
@@ -704,6 +713,10 @@ sssnic_ethdev_rx_queue_all_start(struct rte_eth_dev *ethdev) ethdev->data->port_id, qid); } + ret =sssnic_ethdev_rss_reta_reset (ethdev); +if (ret) +PMD_DRV_LOG (WARNING ,"Failed to reset RSS reta" ); + ret =sssnic_port_enable_set (hw, true);if (ret) { PMD_DRV_LOG(ERR, "Failed to enable port:%u",
Signature · 1 line
2.27.0
PATCH v4 26/32 net/sssnic: support dev MTU set
In reply to [email protected]From: Renyong Wan <[email protected]>
--- drivers/net/sssnic/sssnic_ethdev.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/sssnic/sssnic_ethdev.c +7 -0
@@ -733,6 +733,12 @@ sssnic_ethdev_promiscuous_disable(struct rte_eth_dev *ethdev)return 0 ; } +static int +sssnic_ethdev_mtu_set (struct rte_eth_dev *ethdev,uint16_t mtu) +{ +return sssnic_ethdev_tx_max_size_set (ethdev, mtu); +} +static const struct eth_dev_ops sssnic_ethdev_ops = { .dev_start = sssnic_ethdev_start, .dev_stop = sssnic_ethdev_stop,
@@ -770,6 +776,7 @@ static const struct eth_dev_ops sssnic_ethdev_ops = { .rss_hash_update = sssnic_ethdev_rss_hash_update, .reta_update = sssnic_ethdev_rss_reta_update, .reta_query = sssnic_ethdev_rss_reta_query, + .mtu_set = sssnic_ethdev_mtu_set, }; static int
Signature · 1 line
2.27.0
PATCH v4 27/32 net/sssnic: support dev queue info get
In reply to [email protected]From: Renyong Wan <[email protected]>
--- drivers/net/sssnic/sssnic_ethdev.c | 2 ++ drivers/net/sssnic/sssnic_ethdev_rx.c | 13 +++++++++++++ drivers/net/sssnic/sssnic_ethdev_rx.h | 2 ++ drivers/net/sssnic/sssnic_ethdev_tx.c | 11 +++++++++++ drivers/net/sssnic/sssnic_ethdev_tx.h | 2 ++ 5 files changed, 30 insertions(+)
drivers/net/sssnic/sssnic_ethdev.c +2 -0
@@ -777,6 +777,8 @@ static const struct eth_dev_ops sssnic_ethdev_ops = { .reta_update = sssnic_ethdev_rss_reta_update, .reta_query = sssnic_ethdev_rss_reta_query, .mtu_set = sssnic_ethdev_mtu_set, + .rxq_info_get = sssnic_ethdev_rx_queue_info_get, + .txq_info_get = sssnic_ethdev_tx_queue_info_get, }; static int
drivers/net/sssnic/sssnic_ethdev_rx.c +13 -0
@@ -1363,3 +1363,16 @@ sssnic_ethdev_rx_pkt_burst(void *rx_queue, struct rte_mbuf **rx_pkts,return nb_rx; } + +void +sssnic_ethdev_rx_queue_info_get (struct rte_eth_dev *ethdev, +uint16_t rx_queue_id,struct rte_eth_rxq_info *qinfo) +{ +struct sssnic_ethdev_rxq *rxq = ethdev->data->rx_queues[rx_queue_id]; + + qinfo->rx_buf_size = rxq->rx_buf_size; + qinfo->nb_desc = rxq->depth; + qinfo->queue_state = ethdev->data->rx_queue_state[rx_queue_id]; + qinfo->mp = rxq->mp; + qinfo->conf.rx_free_thresh = rxq->rx_free_thresh; +}
drivers/net/sssnic/sssnic_ethdev_rx.h +2 -0
@@ -44,5 +44,7 @@ void sssnic_ethdev_rx_queue_stats_clear(struct rte_eth_dev *ethdev, uint16_t qid);uint16_t sssnic_ethdev_rx_pkt_burst (void *rx_queue,struct rte_mbuf **rx_pkts,uint16_t nb_pkts); +void sssnic_ethdev_rx_queue_info_get (struct rte_eth_dev *ethdev, +uint16_t rx_queue_id,struct rte_eth_rxq_info *qinfo);#endif
drivers/net/sssnic/sssnic_ethdev_tx.c +11 -0
@@ -1110,3 +1110,14 @@ sssnic_ethdev_tx_pkt_burst(void *tx_queue, struct rte_mbuf **tx_pkts,return nb_tx; } + +void +sssnic_ethdev_tx_queue_info_get (struct rte_eth_dev *ethdev, +uint16_t tx_queue_id,struct rte_eth_txq_info *qinfo) +{ +struct sssnic_ethdev_txq *txq = ethdev->data->tx_queues[tx_queue_id]; + + qinfo->nb_desc = txq->depth; + qinfo->queue_state = ethdev->data->tx_queue_state[tx_queue_id]; + qinfo->conf.tx_free_thresh = txq->tx_free_thresh; +}
drivers/net/sssnic/sssnic_ethdev_tx.h +2 -0
@@ -39,5 +39,7 @@ void sssnic_ethdev_tx_queue_stats_clear(struct rte_eth_dev *ethdev, uint16_t qid);uint16_t sssnic_ethdev_tx_pkt_burst (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +void sssnic_ethdev_tx_queue_info_get (struct rte_eth_dev *ethdev, +uint16_t tx_queue_id,struct rte_eth_txq_info *qinfo);#endif /* _SSSNIC_ETHDEV_TX_H_ */
Signature · 1 line
2.27.0
PATCH v4 28/32 net/sssnic: support dev firmware version get
In reply to [email protected]From: Renyong Wan <[email protected]>
--- doc/guides/nics/features/sssnic.ini | 1 + drivers/net/sssnic/base/sssnic_api.c | 36 ++++++++++++++++++++++++++++ drivers/net/sssnic/base/sssnic_api.h | 9 +++++++ drivers/net/sssnic/base/sssnic_cmd.h | 8 +++++++ drivers/net/sssnic/sssnic_ethdev.c | 20 ++++++++++++++++ 5 files changed, 74 insertions(+)
doc/guides/nics/features/sssnic.ini +1 -0
@@ -26,6 +26,7 @@ Inner L4 checksum = Y Basic stats = Y Extended stats = Y Stats per queue = Y +FW version = Y Linux = Y ARMv8 = Y x86-64 = Y
drivers/net/sssnic/base/sssnic_api.c +36 -0
@@ -1497,3 +1497,39 @@ sssnic_rss_indir_table_get(struct sssnic_hw *hw, uint16_t *entry,sssnic_ctrlq_cmd_destroy (hw, cmd);return ret; } + +int +sssnic_fw_version_get (struct sssnic_hw *hw,struct sssnic_fw_version *version) +{ +int ret; +struct sssnic_msg msg; +struct sssnic_fw_version_get_cmd cmd; +uint32_t cmdlen =sizeof (cmd); +int len; + +memset (&cmd,0 ,sizeof (cmd)); + cmd.type =1 ;/* get MPU firmware version */ + +sssnic_msg_init (&msg, (uint8_t *)&cmd, cmdlen, +SSSNIC_GET_FW_VERSION_CMD ,SSSNIC_MPU_FUNC_IDX , +SSSNIC_COMM_MODULE ,SSSNIC_MSG_TYPE_REQ ); + ret =sssnic_mbox_send (hw, &msg, (uint8_t *)&cmd, &cmdlen,0 ); +if (ret !=0 ) { +PMD_DRV_LOG (ERR ,"Failed to send mbox message, ret=%d" , ret); +return ret; + } + +if (cmdlen ==0 || cmd.common.status !=0 ) { +PMD_DRV_LOG (ERR , +"Bad response to SSSNIC_GET_FW_VERSION_CMD, len=%u, status=%u" , + cmdlen, cmd.common.status); +return -EIO ; + } + + len =RTE_MIN (sizeof (version->version),sizeof (cmd.version)); +rte_memcpy (version->version, cmd.version, len); + len =RTE_MIN (sizeof (version->time),sizeof (cmd.time)); +rte_memcpy (version->time, cmd.time, len); + +return 0 ; +}
drivers/net/sssnic/base/sssnic_api.h +9 -0
@@ -402,6 +402,13 @@ enum sssnic_rss_hash_engine_type { SSSNIC_RSS_HASH_ENGINE_COUNT, }; +#define SSSNIC_FW_VERSION_LEN 16 +#define SSSNIC_FW_TIME_LEN 20 +struct sssnic_fw_version { +char version[SSSNIC_FW_VERSION_LEN ]; +char time[SSSNIC_FW_VERSION_LEN ]; +}; +int sssnic_msix_attr_get (struct sssnic_hw *hw,uint16_t msix_idx,struct sssnic_msix_attr *attr); int sssnic_msix_attr_set(struct sssnic_hw *hw, uint16_t msix_idx,
@@ -456,5 +463,7 @@ int sssnic_rss_indir_table_set(struct sssnic_hw *hw, const uint16_t *entry, uint32_t num_entries);int sssnic_rss_indir_table_get (struct sssnic_hw *hw,uint16_t *entry,uint32_t num_entries); +int sssnic_fw_version_get (struct sssnic_hw *hw, +struct sssnic_fw_version *version);#endif /* _SSSNIC_API_H_ */
drivers/net/sssnic/base/sssnic_cmd.h +8 -0
@@ -406,4 +406,12 @@ struct sssnic_rss_indir_table_cmd { uint16_t entry[256]; }; +struct sssnic_fw_version_get_cmd { +struct sssnic_cmd_common common; +uint16_t type; +uint16_t resvd; +uint8_t version[16 ]; +uint8_t time[20 ]; +}; +#endif /* _SSSNIC_CMD_H_ */
drivers/net/sssnic/sssnic_ethdev.c +20 -0
@@ -739,6 +739,25 @@ sssnic_ethdev_mtu_set(struct rte_eth_dev *ethdev, uint16_t mtu)return sssnic_ethdev_tx_max_size_set (ethdev, mtu); } +static int +sssnic_ethdev_fw_version_get (struct rte_eth_dev *ethdev,char *fw_version, +size_t fw_size) +{ +struct sssnic_hw *hw =SSSNIC_ETHDEV_TO_HW (ethdev); +struct sssnic_fw_version version; +int ret; + + ret =sssnic_fw_version_get (hw, &version); +if (ret) { +PMD_DRV_LOG (ERR ,"Failed to get firmware version" ); +return ret; + } + +snprintf (fw_version, fw_size,"%s" , version.version); + +return 0 ; +} +static const struct eth_dev_ops sssnic_ethdev_ops = { .dev_start = sssnic_ethdev_start, .dev_stop = sssnic_ethdev_stop,
@@ -779,6 +798,7 @@ static const struct eth_dev_ops sssnic_ethdev_ops = { .mtu_set = sssnic_ethdev_mtu_set, .rxq_info_get = sssnic_ethdev_rx_queue_info_get, .txq_info_get = sssnic_ethdev_tx_queue_info_get, + .fw_version_get = sssnic_ethdev_fw_version_get, }; static int
Signature · 1 line
2.27.0
PATCH v4 29/32 net/sssnic: add dev flow control ops
In reply to [email protected]From: Renyong Wan <[email protected]>
--- doc/guides/nics/features/sssnic.ini | 1 + drivers/net/sssnic/base/sssnic_api.c | 68 ++++++++++++++++++++++++++++ drivers/net/sssnic/base/sssnic_api.h | 4 ++ drivers/net/sssnic/base/sssnic_cmd.h | 11 +++++ drivers/net/sssnic/sssnic_ethdev.c | 65 ++++++++++++++++++++++++++ 5 files changed, 149 insertions(+)
doc/guides/nics/features/sssnic.ini +1 -0
@@ -26,6 +26,7 @@ Inner L4 checksum = Y Basic stats = Y Extended stats = Y Stats per queue = Y +Flow control = P FW version = Y Linux = Y ARMv8 = Y
drivers/net/sssnic/base/sssnic_api.c +68 -0
71 lines not on this page · raw message
drivers/net/sssnic/base/sssnic_api.h +4 -0
@@ -465,5 +465,9 @@ int sssnic_rss_indir_table_get(struct sssnic_hw *hw, uint16_t *entry, uint32_t num_entries);int sssnic_fw_version_get (struct sssnic_hw *hw,struct sssnic_fw_version *version); +int sssnic_flow_ctrl_set (struct sssnic_hw *hw,bool autoneg,bool rx_en, +bool tx_en); +int sssnic_flow_ctrl_get (struct sssnic_hw *hw,bool *autoneg,bool *rx_en, +bool *tx_en);#endif /* _SSSNIC_API_H_ */
drivers/net/sssnic/base/sssnic_cmd.h +11 -0
@@ -414,4 +414,15 @@ struct sssnic_fw_version_get_cmd { uint8_t time[20]; }; +struct sssnic_flow_ctrl_cmd { +struct sssnic_cmd_common common; +uint8_t port; +uint8_t opcode; +uint16_t resvd0; +uint8_t auto_neg; +uint8_t rx_en; +uint8_t tx_en; +uint8_t resvd1[5 ]; +}; +#endif /* _SSSNIC_CMD_H_ */
drivers/net/sssnic/sssnic_ethdev.c +65 -0
77 lines not on this page · raw message
Signature · 1 line
2.27.0
PATCH v4 30/32 net/sssnic: support VLAN offload and filter
In reply to [email protected]From: Renyong Wan <[email protected]>
--- doc/guides/nics/features/sssnic.ini | 2 + drivers/net/sssnic/base/sssnic_api.c | 34 +++++++++++ drivers/net/sssnic/base/sssnic_api.h | 1 + drivers/net/sssnic/base/sssnic_cmd.h | 9 +++ drivers/net/sssnic/sssnic_ethdev.c | 87 ++++++++++++++++++++++++++++ 5 files changed, 133 insertions(+)
doc/guides/nics/features/sssnic.ini +2 -0
@@ -19,6 +19,8 @@ RSS hash = Y RSS key update = Y RSS reta update = Y Inner RSS = Y +VLAN filter = Y +VLAN offload = Y L3 checksum offload = Y L4 checksum offload = Y Inner L3 checksum = Y
drivers/net/sssnic/base/sssnic_api.c +34 -0
@@ -1601,3 +1601,37 @@ sssnic_flow_ctrl_get(struct sssnic_hw *hw, bool *autoneg, bool *rx_en,return 0 ; } + +int +sssnic_vlan_filter_set (struct sssnic_hw *hw,uint16_t vid,bool add) +{ +int ret; +struct sssnic_vlan_filter_set_cmd cmd; +struct sssnic_msg msg; +uint32_t cmd_len; + +memset (&cmd,0 ,sizeof (cmd)); + cmd.function =SSSNIC_FUNC_IDX (hw); + cmd.add = add ?1 :0 ; + cmd.vid = vid; + cmd_len =sizeof (cmd); + +sssnic_msg_init (&msg, (uint8_t *)&cmd, cmd_len, +SSSNIC_SET_PORT_VLAN_FILTER_CMD ,SSSNIC_MPU_FUNC_IDX , +SSSNIC_LAN_MODULE ,SSSNIC_MSG_TYPE_REQ ); + + ret =sssnic_mbox_send (hw, &msg, (uint8_t *)&cmd, &cmd_len,0 ); +if (ret !=0 ) { +PMD_DRV_LOG (ERR ,"Failed to send mbox message, ret=%d" , ret); +return ret; + } + +if (cmd_len ==0 || cmd.common.status !=0 ) { +PMD_DRV_LOG (ERR , +"Bad response to SSSNIC_SET_PORT_VLAN_FILTER_CMD, len=%u, status=%u" , + cmd_len, cmd.common.status); +return -EIO ; + } + +return 0 ; +}
drivers/net/sssnic/base/sssnic_api.h +1 -0
@@ -469,5 +469,6 @@ int sssnic_flow_ctrl_set(struct sssnic_hw *hw, bool autoneg, bool rx_en, bool tx_en);int sssnic_flow_ctrl_get (struct sssnic_hw *hw,bool *autoneg,bool *rx_en,bool *tx_en); +int sssnic_vlan_filter_set (struct sssnic_hw *hw,uint16_t vid,bool add);#endif /* _SSSNIC_API_H_ */
drivers/net/sssnic/base/sssnic_cmd.h +9 -0
@@ -425,4 +425,13 @@ struct sssnic_flow_ctrl_cmd { uint8_t resvd1[5]; }; +struct sssnic_vlan_filter_set_cmd { +struct sssnic_cmd_common common; +uint16_t function; +uint8_t add; +uint8_t resvd0; +uint16_t vid; +uint16_t resvd1; +}; +#endif /* _SSSNIC_CMD_H_ */
drivers/net/sssnic/sssnic_ethdev.c +87 -0
111 lines not on this page · raw message
Signature · 1 line
2.27.0
PATCH v4 31/32 net/sssnic: add generic flow ops
In reply to [email protected]From: Renyong Wan <[email protected]>
---
v2:
* Fixed 'mask->hdr.src_addr' will always evaluate to 'true'.
* Removed error.h from including files.
--- doc/guides/nics/features/sssnic.ini | 12 + drivers/net/sssnic/base/sssnic_api.c | 264 ++++++ drivers/net/sssnic/base/sssnic_api.h | 22 + drivers/net/sssnic/base/sssnic_cmd.h | 71 ++ drivers/net/sssnic/base/sssnic_hw.h | 3 + drivers/net/sssnic/base/sssnic_misc.h | 7 + drivers/net/sssnic/meson.build | 2 + drivers/net/sssnic/sssnic_ethdev.c | 12 + drivers/net/sssnic/sssnic_ethdev.h | 1 + drivers/net/sssnic/sssnic_ethdev_fdir.c | 1017 +++++++++++++++++++++++ drivers/net/sssnic/sssnic_ethdev_fdir.h | 332 ++++++++ drivers/net/sssnic/sssnic_ethdev_flow.c | 981 ++++++++++++++++++++++ drivers/net/sssnic/sssnic_ethdev_flow.h | 11 + drivers/net/sssnic/sssnic_ethdev_rx.c | 18 + 14 files changed, 2753 insertions(+) create mode 100644 drivers/net/sssnic/sssnic_ethdev_fdir.c create mode 100644 drivers/net/sssnic/sssnic_ethdev_fdir.h create mode 100644 drivers/net/sssnic/sssnic_ethdev_flow.c create mode 100644 drivers/net/sssnic/sssnic_ethdev_flow.h
doc/guides/nics/features/sssnic.ini +12 -0
@@ -33,3 +33,15 @@ FW version = Y Linux = Y ARMv8 = Y x86-64 = Y + +[rte_flow items] +any = Y +eth = Y +ipv4 = Y +ipv6 = Y +tcp = Y +udp = Y +vxlan = Y + +[rte_flow actions] +queue = Y
drivers/net/sssnic/base/sssnic_api.c +264 -0
267 lines not on this page · raw message
drivers/net/sssnic/base/sssnic_api.h +22 -0
@@ -409,6 +409,18 @@ struct sssnic_fw_version {char time[SSSNIC_FW_VERSION_LEN ]; }; +struct sssnic_tcam_entry { +uint32_t index; +struct { +uint32_t qid; +uint32_t resvd; + } result; +struct { +uint8_t data0[SSSNIC_TCAM_KEY_SIZE ]; +uint8_t data1[SSSNIC_TCAM_KEY_SIZE ]; + } key; +}; +int sssnic_msix_attr_get (struct sssnic_hw *hw,uint16_t msix_idx,struct sssnic_msix_attr *attr); int sssnic_msix_attr_set(struct sssnic_hw *hw, uint16_t msix_idx,
@@ -470,5 +482,15 @@ int sssnic_flow_ctrl_set(struct sssnic_hw *hw, bool autoneg, bool rx_en,int sssnic_flow_ctrl_get (struct sssnic_hw *hw,bool *autoneg,bool *rx_en,bool *tx_en);int sssnic_vlan_filter_set (struct sssnic_hw *hw,uint16_t vid,bool add); +int sssnic_tcam_enable_set (struct sssnic_hw *hw,bool enabled); +int sssnic_tcam_flush (struct sssnic_hw *hw); +int sssnic_tcam_disable_and_flush (struct sssnic_hw *hw); +int sssnic_tcam_block_alloc (struct sssnic_hw *hw,uint16_t *block_idx); +int sssnic_tcam_block_free (struct sssnic_hw *hw,uint16_t block_idx); +int sssnic_tcam_packet_type_filter_set (struct sssnic_hw *hw,uint8_t ptype, +uint16_t qid,bool enabled); +int sssnic_tcam_entry_add (struct sssnic_hw *hw, +struct sssnic_tcam_entry *entry); +int sssnic_tcam_entry_del (struct sssnic_hw *hw,uint32_t entry_idx);#endif /* _SSSNIC_API_H_ */
drivers/net/sssnic/base/sssnic_cmd.h +71 -0
81 lines not on this page · raw message
drivers/net/sssnic/base/sssnic_hw.h +3 -0
@@ -96,6 +96,9 @@ enum sssnic_module { SSSNIC_NETIF_MODULE = 14, }; +#define SSSNIC_TCAM_KEY_SIZE 44 +#define SSSNIC_TCAM_MAX_ENTRY_NUM 4096 +int sssnic_hw_init (struct sssnic_hw *hw);void sssnic_hw_shutdown (struct sssnic_hw *hw);void sssnic_msix_state_set (struct sssnic_hw *hw,uint16_t msix_id,int state);
drivers/net/sssnic/base/sssnic_misc.h +7 -0
@@ -42,4 +42,11 @@ sssnic_mem_be_to_cpu_32(void *in, void *out, int size) } } +static inline bool +sssnic_is_zero_ipv6_addr (const void *ipv6_addr) +{ +const uint64_t *ddw = ipv6_addr; +return ddw[0 ] ==0 && ddw[1 ] ==0 ; +} +#endif /* _SSSNIC_MISC_H_ */
drivers/net/sssnic/meson.build +2 -0
@@ -23,4 +23,6 @@ sources = files( 'sssnic_ethdev_tx.c', 'sssnic_ethdev_stats.c', 'sssnic_ethdev_rss.c', + 'sssnic_ethdev_fdir.c', + 'sssnic_ethdev_flow.c', )
drivers/net/sssnic/sssnic_ethdev.c +12 -0
@@ -14,6 +14,8 @@#include "sssnic_ethdev_tx.h" #include "sssnic_ethdev_stats.h" #include "sssnic_ethdev_rss.h" +#include "sssnic_ethdev_fdir.h" +#include "sssnic_ethdev_flow.h" static int sssnic_ethdev_init (struct rte_eth_dev *ethdev);static void sssnic_ethdev_vlan_filter_clean (struct rte_eth_dev *ethdev);
@@ -345,6 +347,7 @@ sssnic_ethdev_release(struct rte_eth_dev *ethdev)sssnic_ethdev_link_intr_disable (ethdev);sssnic_ethdev_tx_queue_all_release (ethdev);sssnic_ethdev_rx_queue_all_release (ethdev); +sssnic_ethdev_fdir_shutdown (ethdev);sssnic_ethdev_mac_addrs_clean (ethdev);sssnic_hw_shutdown (hw);rte_free (hw);
@@ -951,6 +954,7 @@ static const struct eth_dev_ops sssnic_ethdev_ops = { .flow_ctrl_get = sssnic_ethdev_flow_ctrl_get, .vlan_offload_set = sssnic_ethdev_vlan_offload_set, .vlan_filter_set = sssnic_ethdev_vlan_filter_set, + .flow_ops_get = sssnic_ethdev_flow_ops_get, }; static int
@@ -991,6 +995,12 @@ sssnic_ethdev_init(struct rte_eth_dev *ethdev) goto mac_addrs_init_fail; } + ret =sssnic_ethdev_fdir_init (ethdev); +if (ret) { +PMD_DRV_LOG (ERR ,"Failed to initialize fdir info" ); + goto fdir_init_fail; + } + netdev->max_num_rxq =SSSNIC_MAX_NUM_RXQ (hw); netdev->max_num_txq =SSSNIC_MAX_NUM_TXQ (hw);
@@ -1001,6 +1011,8 @@ sssnic_ethdev_init(struct rte_eth_dev *ethdev)return 0 ; +fdir_init_fail: +sssnic_ethdev_mac_addrs_clean (ethdev); mac_addrs_init_fail:sssnic_hw_shutdown (0 );return ret;
drivers/net/sssnic/sssnic_ethdev.h +1 -0
@@ -82,6 +82,7 @@ struct sssnic_netdev {void *hw;struct rte_ether_addr *mcast_addrs;struct rte_ether_addr default_addr; +struct sssnic_ethdev_fdir_info *fdir_info;uint16_t max_num_txq;uint16_t max_num_rxq;uint16_t num_started_rxqs;
drivers/net/sssnic/sssnic_ethdev_fdir.c new file +1017 -0
1,017 lines not on this page · raw message
drivers/net/sssnic/sssnic_ethdev_fdir.h new file +332 -0
332 lines not on this page · raw message
drivers/net/sssnic/sssnic_ethdev_flow.c new file +981 -0
981 lines not on this page · raw message
drivers/net/sssnic/sssnic_ethdev_flow.h new file +11 -0
@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2018-2022 Shenzhen 3SNIC Information Technology Co., Ltd. +*/ + +#ifndef _SSSNIC_ETHDEV_FLOW_H_ +#define _SSSNIC_ETHDEV_FLOW_H_ + +int sssnic_ethdev_flow_ops_get (struct rte_eth_dev *ethdev, +const struct rte_flow_ops **ops); + +#endif /* _SSSNIC_ETHDEV_FLOW_H_ */
drivers/net/sssnic/sssnic_ethdev_rx.c +18 -0
@@ -11,6 +11,7 @@#include "sssnic_ethdev.h" #include "sssnic_ethdev_rx.h" #include "sssnic_ethdev_rss.h" +#include "sssnic_ethdev_fdir.h" #include "base/sssnic_hw.h" #include "base/sssnic_workq.h" #include "base/sssnic_api.h"
@@ -593,9 +594,18 @@ static int sssnic_ethdev_rxq_enable(struct rte_eth_dev *ethdev, uint16_t queue_id) {struct sssnic_ethdev_rxq *rxq = ethdev->data->rx_queues[queue_id]; +int ret;sssnic_ethdev_rxq_pktmbufs_fill (rxq); +pthread_mutex_lock (ðdev->data->flow_ops_mutex); + ret =sssnic_ethdev_fdir_rules_enable_by_queue (ethdev, queue_id); +if (ret) +PMD_DRV_LOG (WARNING , +"Failed to enable fdir rules of rxq:%u, port:%u" , + queue_id, ethdev->data->port_id); +pthread_mutex_unlock (ðdev->data->flow_ops_mutex); +return 0 ; }
@@ -605,6 +615,14 @@ sssnic_ethdev_rxq_disable(struct rte_eth_dev *ethdev, uint16_t queue_id)struct sssnic_ethdev_rxq *rxq = ethdev->data->rx_queues[queue_id];int ret; +pthread_mutex_lock (ðdev->data->flow_ops_mutex); + ret =sssnic_ethdev_fdir_rules_disable_by_queue (ethdev, queue_id); +if (ret !=0 ) +PMD_DRV_LOG (WARNING , +"Failed to disable fdir rules of rxq:%u, port:%u" , + queue_id, ethdev->data->port_id); +pthread_mutex_unlock (ðdev->data->flow_ops_mutex); + ret =sssnic_ethdev_rxq_flush (rxq);if (ret !=0 ) { PMD_DRV_LOG(ERR, "Failed to flush rxq:%u, port:%u", queue_id,
Signature · 1 line
2.27.0
PATCH v4 32/32 net/sssnic: add VF dev support
In reply to [email protected]From: Renyong Wan <[email protected]>
In comparison to PF, VF PMD does not support the following features:
1. link up and link down set
2. promiscuous enable and disable
3. MAC stats in extend xstats
--- drivers/net/sssnic/base/sssnic_api.c | 42 +++++++++++++++++ drivers/net/sssnic/base/sssnic_api.h | 2 + drivers/net/sssnic/base/sssnic_cmd.h | 6 +++ drivers/net/sssnic/base/sssnic_hw.c | 19 ++++++-- drivers/net/sssnic/base/sssnic_hw.h | 4 ++ drivers/net/sssnic/sssnic_ethdev.c | 60 +++++++++++++++++++++++- drivers/net/sssnic/sssnic_ethdev_stats.c | 29 ++++++++++-- 7 files changed, 153 insertions(+), 9 deletions(-)
drivers/net/sssnic/base/sssnic_api.c +42 -0
@@ -1899,3 +1899,45 @@ sssnic_tcam_entry_del(struct sssnic_hw *hw, uint32_t entry_idx)return 0 ; } + +static int +sssnic_vf_port_register_op (struct sssnic_hw *hw,bool op) +{ +int ret; +struct sssnic_vf_port_register_cmd cmd; +struct sssnic_msg msg; +uint32_t cmd_len; + +memset (&cmd,0 ,sizeof (cmd)); + cmd.op = op ?1 :0 ; + cmd_len =sizeof (cmd); +sssnic_msg_init (&msg, (uint8_t *)&cmd, cmd_len, +SSSNIC_REGISTER_VF_PORT_CMD ,SSSNIC_PF_FUNC_IDX (hw), +SSSNIC_LAN_MODULE ,SSSNIC_MSG_TYPE_REQ ); + ret =sssnic_mbox_send (hw, &msg, (uint8_t *)&cmd, &cmd_len,0 ); +if (ret !=0 ) { +PMD_DRV_LOG (ERR ,"Failed to send mbox message, ret=%d" , ret); +return ret; + } + +if (cmd_len ==0 || cmd.common.status !=0 ) { +PMD_DRV_LOG (ERR , +"Bad response to SSSNIC_REGISTER_VF_PORT_CMD, len=%u, status=%u" , + cmd_len, cmd.common.status); +return -EIO ; + } + +return 0 ; +} + +int +sssnic_vf_port_register (struct sssnic_hw *hw) +{ +return sssnic_vf_port_register_op (hw, true); +} + +int +sssnic_vf_port_unregister (struct sssnic_hw *hw) +{ +return sssnic_vf_port_register_op (hw, false); +}
drivers/net/sssnic/base/sssnic_api.h +2 -0
@@ -492,5 +492,7 @@ int sssnic_tcam_packet_type_filter_set(struct sssnic_hw *hw, uint8_t ptype,int sssnic_tcam_entry_add (struct sssnic_hw *hw,struct sssnic_tcam_entry *entry);int sssnic_tcam_entry_del (struct sssnic_hw *hw,uint32_t entry_idx); +int sssnic_vf_port_register (struct sssnic_hw *hw); +int sssnic_vf_port_unregister (struct sssnic_hw *hw);#endif /* _SSSNIC_API_H_ */
drivers/net/sssnic/base/sssnic_cmd.h +6 -0
@@ -505,4 +505,10 @@ struct sssnic_tcam_entry_del_cmd { uint32_t num; /* number of entries to be deleted */ }; +struct sssnic_vf_port_register_cmd { +struct sssnic_cmd_common common; +uint8_t op;/* 0: unregister, 1: register */ +uint8_t resvd[39 ]; +}; +#endif /* _SSSNIC_CMD_H_ */
drivers/net/sssnic/base/sssnic_hw.c +14 -5
@@ -345,10 +345,16 @@ sssnic_base_init(struct sssnic_hw *hw) pci_dev = hw->pci_dev;/* get base addresses of hw registers */ - hw->cfg_base_addr = - (uint8_t *)pci_dev->mem_resource[SSSNIC_PCI_BAR_CFG ].addr; - hw->mgmt_base_addr = - (uint8_t *)pci_dev->mem_resource[SSSNIC_PCI_BAR_MGMT ].addr; +if (pci_dev->id.device_id ==SSSNIC_VF_DEVICE_ID ) { +uint8_t *addr = + (uint8_t *)pci_dev->mem_resource[SSSNIC_VF_PCI_BAR_CFG ].addr; + hw->cfg_base_addr = addr +SSSNIC_VF_CFG_ADDR_OFFSET ; + }else { + hw->cfg_base_addr = + (uint8_t *)pci_dev->mem_resource[SSSNIC_PCI_BAR_CFG ].addr; + hw->mgmt_base_addr = + (uint8_t *)pci_dev->mem_resource[SSSNIC_PCI_BAR_MGMT ].addr; + } hw->db_base_addr = (uint8_t *)pci_dev->mem_resource[SSSNIC_PCI_BAR_DB ].addr; hw->db_mem_len =
@@ -365,7 +371,10 @@ sssnic_base_init(struct sssnic_hw *hw)PMD_DRV_LOG (ERR ,"Doorbell is not enabled!" );return -EBUSY ; } -sssnic_af_setup (hw); + +if (SSSNIC_FUNC_TYPE (hw) !=SSSNIC_FUNC_TYPE_VF ) +sssnic_af_setup (hw); +sssnic_msix_all_disable (hw);sssnic_pf_status_set (hw,SSSNIC_PF_STATUS_INIT );
drivers/net/sssnic/base/sssnic_hw.h +4 -0
@@ -7,11 +7,15 @@#define SSSNIC_PCI_VENDOR_ID 0x1F3F#define SSSNIC_DEVICE_ID_STD 0x9020 +#define SSSNIC_VF_DEVICE_ID 0x9001 +#define SSSNIC_VF_PCI_BAR_CFG 0#define SSSNIC_PCI_BAR_CFG 1#define SSSNIC_PCI_BAR_MGMT 3#define SSSNIC_PCI_BAR_DB 4 +#define SSSNIC_VF_CFG_ADDR_OFFSET 0x2000 +#define SSSNIC_FUNC_TYPE_PF 0#define SSSNIC_FUNC_TYPE_VF 1#define SSSNIC_FUNC_TYPE_AF 2
drivers/net/sssnic/sssnic_ethdev.c +59 -1
96 lines not on this page · raw message
drivers/net/sssnic/sssnic_ethdev_stats.c +26 -3
@@ -244,9 +244,19 @@ sssnic_ethdev_stats_reset(struct rte_eth_dev *ethdev)static uint32_t sssnic_ethdev_xstats_num_calc (struct rte_eth_dev *ethdev) { -return SSSNIC_ETHDEV_NB_PORT_XSTATS +SSSNIC_ETHDEV_NB_MAC_XSTATS + - (SSSNIC_ETHDEV_NB_TXQ_XSTATS * ethdev->data->nb_tx_queues) + - (SSSNIC_ETHDEV_NB_RXQ_XSTATS * ethdev->data->nb_rx_queues); +struct sssnic_hw *hw =SSSNIC_ETHDEV_TO_HW (ethdev); +uint32_t num; + + num =SSSNIC_ETHDEV_NB_PORT_XSTATS ; + num +=SSSNIC_ETHDEV_NB_TXQ_XSTATS * ethdev->data->nb_tx_queues; + num +=SSSNIC_ETHDEV_NB_RXQ_XSTATS * ethdev->data->nb_rx_queues; + +if (SSSNIC_FUNC_TYPE (hw) ==SSSNIC_FUNC_TYPE_VF ) +return num; + + num +=SSSNIC_ETHDEV_NB_MAC_XSTATS ; + +return num; }int
@@ -255,6 +265,7 @@ sssnic_ethdev_xstats_get_names(struct rte_eth_dev *ethdev, __rte_unused unsigned int limit) {uint16_t i, qid, count =0 ; +struct sssnic_hw *hw =SSSNIC_ETHDEV_TO_HW (ethdev);if (xstats_names ==NULL )return sssnic_ethdev_xstats_num_calc (ethdev);
@@ -283,6 +294,9 @@ sssnic_ethdev_xstats_get_names(struct rte_eth_dev *ethdev, count++; } +if (SSSNIC_FUNC_TYPE (hw) ==SSSNIC_FUNC_TYPE_VF ) +return count; +for (i =0 ; i <SSSNIC_ETHDEV_NB_MAC_XSTATS ; i++) {snprintf (xstats_names[count].name,RTE_ETH_XSTATS_NAME_SIZE ,"mac_%s" , mac_stats_strings[i].name);
@@ -348,6 +362,11 @@ sssnic_ethdev_xstats_get(struct rte_eth_dev *ethdev, count++; } +if (SSSNIC_FUNC_TYPE (hw) ==SSSNIC_FUNC_TYPE_VF ) { + ret = count; + goto out; + } + ret =sssnic_mac_stats_get (hw, &stats->mac);if (ret) { PMD_DRV_LOG(ERR, "Failed to get port %u mac stats",
@@ -372,6 +391,7 @@ int sssnic_ethdev_xstats_reset(struct rte_eth_dev *ethdev) {int ret; +struct sssnic_hw *hw =SSSNIC_ETHDEV_TO_HW (ethdev); ret =sssnic_ethdev_stats_reset (ethdev);if (ret) {
@@ -380,6 +400,9 @@ sssnic_ethdev_xstats_reset(struct rte_eth_dev *ethdev)return ret; } +if (SSSNIC_FUNC_TYPE (hw) ==SSSNIC_FUNC_TYPE_VF ) +return 0 ; + ret =sssnic_mac_stats_clear (SSSNIC_ETHDEV_TO_HW (ethdev));if (ret) { PMD_DRV_LOG(ERR, "Failed to clear port %u MAC stats",
Signature · 1 line
2.27.0