Skip to contentSkip to conversation

Introduce sssnic PMD for 3SNIC's 9x0 serials Ethernet adapters

PATCH In review [email protected] 4 participants 67 messages Sep 4, 2023 – Jan 16, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v5 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.

v5:
* Fixed rebase mistake.
* Fixed incorrect path in MAINTAINERS file.
---

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                                   |    2 +
 MAINTAINERS                                |    7 +
 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, 13934 insertions(+)
 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
#1 lore raw

PATCH v5 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.

v5:
* Fixed rebase mistake.
* Fixed incorrect path in MAINTAINERS file.

---
 .mailmap                            |  2 +
 MAINTAINERS                         |  7 +++
 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, 139 insertions(+)
 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 -0
index 864d33ee46..8b66f866d0 100644
@@ -1156,6 +1156,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 +1330,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 +7 -0
index a926155f26..1e161c3305 100644
@@ -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: drivers/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]>
doc/guides/nics/features/sssnic.ini new file +9 -0
new file mode 100644
index 0000000000..6d9786db7e
@@ -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
index 7bfcac880f..9d2b29383b 100644
@@ -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
index bd38b533c5..224eab99a7 100644
@@ -54,6 +54,7 @@ drivers = [
         'ring',
         'sfc',
         'softnic',
+        'sssnic',
         'tap',
         'thunderx',
         'txgbe',
drivers/net/sssnic/meson.build new file +18 -0
new file mode 100644
index 0000000000..fda65aa380
@@ -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
new file mode 100644
index 0000000000..dcda01eeb8
@@ -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
#2 lore raw

Re: [PATCH v5 01/32] net/sssnic: add build and doc infrastructure

Quoted 7 lines · On 9/4/2023 5:56 AM, [email protected] wrote:

From: Renyong Wan <[email protected]>

Adding minimum PMD code, doc and build infrastructure for sssnic.

<...>

MAINTAINERS F: drivers/net/af_xdp/ · line 643

Quoted 12 lines
MAINTAINERS +7 -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: drivers/net/sssnic/
+F: doc/guides/nics/sssnic.rst
+F: doc/guides/nics/features/sssnic.ini
+
 

The list is sorted by the company name, I am aware above virtual devices (af_xdp, af_packet & bondign) are causing the confusion, they are not sorted clearly, please move the driver as first net driver, we can fix the virtual ones later.

Quoted 43 lines
MAINTAINERS +0 -0
 Amazon ENA
 M: Michal Krawczyk <[email protected]>

M: Shai Brandes <[email protected]>

doc/guides/nics/features/sssnic.ini new file +9 -0
new file mode 100644
index 0000000000..6d9786db7e
@@ -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
index 7bfcac880f..9d2b29383b 100644
@@ -61,6 +61,7 @@ Network Interface Controller Drivers
     qede
     sfc_efx
     softnic
+    sssnic
     tap
     thunderx
     txgbe
doc/guides/nics/sssnic.rst new file +6 -0
new file mode 100644
index 0000000000..fe0180c2e6
@@ -0,0 +1,73 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2022 Shenzhen 3SNIC Information Technology Co., Ltd.
+
+SSSNIC Poll Mode Driver
+=======================
+

doc/guides/nics/sssnic.rst line 16

Quoted 10 lines
doc/guides/nics/sssnic.rst new file +10 -0
+The sssnic PMD (**librte_pmd_sssnic**) provides poll mode driver support
+for 3SNIC 9x0 serials family of Ethernet adapters.
+
+
+Supported NICs
+--------------
+
+- 3S910 Dual Port SFP28 10/25GbE Ethernet adapter
+- 3S920 Quad Port SFP28 10/25GbE Ethernet adapter
+- 3S920 Quad Port QSFP28 100GbE Ethernet adapter

3S930 ?
I can see from your website, that is the one with 100GbE interface.

It can be nice to have a link to each device page, if possible.

Quoted 26 lines
doc/guides/nics/sssnic.rst new file +25 -0
+
+
+Features
+--------
+
+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

doc/guides/nics/sssnic.rst line 51

Quoted 10 lines
doc/guides/nics/sssnic.rst new file +10 -0
+- L4 checksum offload
+- Inner L3 checksum
+- Inner L4 checksum
+- Basic stats
+- Extended stats
+- Stats per queue
+- Flow control
+- FW version
+- Generic flow API
+

Can you please update this list as features added to the code? Similar to what you are already doing with sssnic.ini.

This helps whoever checking the git history can find the relevant code from documentation git blame.

Quoted 12 lines
doc/guides/nics/sssnic.rst new file +11 -0
+
+Prerequisites
+-------------
+
+- Learning about 3SNIC Ethernet NICs using
+  `<https://www.3snic.com/products/SSSNIC>`_.
+
+- Follow the DPDK :ref:`Getting Started Guide for Linux <linux_gsg>` to setup the basic DPDK environment.
+
+
+Driver compilation and testing

doc/guides/nics/sssnic.rst line 72

Quoted 10 lines
doc/guides/nics/sssnic.rst new file +10 -0
+------------------------------
+
+Refer to the document :ref:`compiling and testing a PMD for a NIC <pmd_build_and_test>`
+for details.
+
+
+Limitations or Known issues
+---------------------------
+
+Build with ICC is not supported yet.

I don't know listing ICC as relevant anymore, I am not aware of anyone testing it. So can drop this limitation.

#3 lore raw

PATCH v5 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
index dcda01eeb8..0f1017af9d 100644
@@ -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
#4 lore raw

PATCH v5 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
new file mode 100644
index 0000000000..db916b1977
@@ -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
index 0f1017af9d..4f8b5c2684 100644
@@ -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
#5 lore raw

Re: [PATCH v5 03/32] net/sssnic: support probe and remove

drivers/net/sssnic/sssnic_ethdev.c line 18

Quoted 8 lines · On Mon, 4 Sep 2023 12:56:29 +0800 <[email protected]> wrote:
drivers/net/sssnic/sssnic_ethdev.c +8 -0
+static int
+sssnic_ethdev_init(struct rte_eth_dev *ethdev)
+{
+	RTE_SET_USED(ethdev);
+	PMD_INIT_FUNC_TRACE();
+
+	return -EINVAL;
+}

Since device does not support secondary process, should check and return error here.

#6 lore raw

Re: [PATCH v5 03/32] net/sssnic: support probe and remove

Hello Stephen,

This patch is just a minimum probe frame, it does nothing and always return error. The error check will apear in the subsequent patch([PATCH v5 04/32]), in that patch, hardware base is initialized, so secondary process check is added logically.

Thanks.

Quoted 14 lines · Stephen Hemminger

drivers/net/sssnic/sssnic_ethdev.c line 18

Quoted 8 lines · On Mon, 4 Sep 2023 12:56:29 +0800 <[email protected]> wrote:
drivers/net/sssnic/sssnic_ethdev.c +8 -0
+static int
+sssnic_ethdev_init(struct rte_eth_dev *ethdev)
+{
+	RTE_SET_USED(ethdev);
+	PMD_INIT_FUNC_TRACE();
+
+	return -EINVAL;
+}

Since device does not support secondary process, should check and return error here.

Signature · 2 lines
Regards,
Renyong Wan
#7 lore raw

PATCH v5 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
new file mode 100644
index 0000000000..3e64112c72
@@ -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
index fda65aa380..328bb41436 100644
@@ -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
new file mode 100644
index 0000000000..5d951134cc
@@ -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
#8 lore raw

Re: [PATCH v5 04/32] net/sssnic: initialize hardware base

Quoted 8 lines · On Mon, 4 Sep 2023 12:56:30 +0800 <[email protected]> wrote:

static int
sssnic_ethdev_init(struct rte_eth_dev *ethdev)
{

drivers/net/sssnic/sssnic_ethdev.c +4 -1
-	RTE_SET_USED(ethdev);
+	int ret;
+	struct sssnic_hw *hw;
+	struct sssnic_netdev *netdev;
+	struct rte_pci_device *pci_dev;

drivers/net/sssnic/sssnic_ethdev.c line 36

Quoted 10 lines
drivers/net/sssnic/sssnic_ethdev.c +7 -1
+
 	PMD_INIT_FUNC_TRACE();
 
-	return -EINVAL;
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		return 0;
+
+	netdev = SSSNIC_ETHDEV_PRIVATE(ethdev);
+	pci_dev = RTE_ETH_DEV_TO_PCI(ethdev);
+	hw = rte_zmalloc("sssnic_hw", sizeof(struct sssnic_hw), 0);

For performance you might want to use rte_zmalloc_socket() to make sure the hw structure is on the same NUMA node as PCI device.

#9 lore raw

Re: [PATCH v5 04/32] net/sssnic: initialize hardware base

Hello Stephen,

hw struct is just used in control plane, I think it has little impact on performance, howerver I am going to take your advice and fix it in next version of patches.

Thanks.

Quoted 24 lines · Stephen Hemminger
Quoted 8 lines · On Mon, 4 Sep 2023 12:56:30 +0800 <[email protected]> wrote:
  static int
  sssnic_ethdev_init(struct rte_eth_dev *ethdev)
  {
drivers/net/sssnic/sssnic_ethdev.c +4 -1
-	RTE_SET_USED(ethdev);
+	int ret;
+	struct sssnic_hw *hw;
+	struct sssnic_netdev *netdev;
+	struct rte_pci_device *pci_dev;

drivers/net/sssnic/sssnic_ethdev.c line 36

Quoted 10 lines
drivers/net/sssnic/sssnic_ethdev.c +7 -1
+
  	PMD_INIT_FUNC_TRACE();
 
-	return -EINVAL;
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		return 0;
+
+	netdev = SSSNIC_ETHDEV_PRIVATE(ethdev);
+	pci_dev = RTE_ETH_DEV_TO_PCI(ethdev);
+	hw = rte_zmalloc("sssnic_hw", sizeof(struct sssnic_hw), 0);

For performance you might want to use rte_zmalloc_socket() to make sure the hw structure is on the same NUMA node as PCI device.

Signature · 2 lines
Regards,
Renyong Wan
#10 lore raw

PATCH v5 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
index 3e64112c72..7758faa482 100644
@@ -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
index 8b7bba7644..44e04486a5 100644
@@ -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
index 65d4d562b4..6caf3a6d66 100644
@@ -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
index e198b1e1d0..460ff604aa 100644
@@ -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
#11 lore raw

PATCH v5 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
index 7758faa482..dd4dd08fc1 100644
@@ -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
index a74b74f756..e90d24bb6b 100644
@@ -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
index 44e04486a5..387c823c7e 100644
@@ -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
index 6caf3a6d66..38fb9ac1ac 100644
@@ -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 0x1fff
 
 int 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
#12 lore raw

Re: [PATCH v5 06/32] net/sssnic/base: add message definition and utility

drivers/net/sssnic/base/sssnic_msg.c line 68

Quoted 4 lines · On Mon, 4 Sep 2023 12:56:32 +0800 <[email protected]> wrote:
drivers/net/sssnic/base/sssnic_msg.c new file +4 -0
+static int
+sssnic_msg_buf_alloc(struct sssnic_msg *msg, size_t size)
+{
+	msg->data_buf = rte_zmalloc("sssnic_msg_data", size, 1);

Putting message buffer on same NUMA node as device might help performance on NUMA architecture.

#13 lore raw

Re: [PATCH v5 06/32] net/sssnic/base: add message definition and utility

Hello, Stephen,

data_buf is just used by control plane process, and it will not be used very frequtely, it has a little impact on IO performance. I'm not going to fix it.

Thanks.

Quoted 9 lines · Stephen Hemminger

drivers/net/sssnic/base/sssnic_msg.c line 68

Quoted 4 lines · On Mon, 4 Sep 2023 12:56:32 +0800 <[email protected]> wrote:
drivers/net/sssnic/base/sssnic_msg.c new file +4 -0
+static int
+sssnic_msg_buf_alloc(struct sssnic_msg *msg, size_t size)
+{
+	msg->data_buf = rte_zmalloc("sssnic_msg_data", size, 1);

Putting message buffer on same NUMA node as device might help performance on NUMA architecture.

Signature · 2 lines
Regards,
Renyong Wan
#14 lore raw

PATCH v5 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
index dd4dd08fc1..4abd1a0daf 100644
@@ -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
index 387c823c7e..ff527b2c7f 100644
@@ -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
index 38fb9ac1ac..41e65f5880 100644
@@ -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
new file mode 100644
index 0000000000..ac1bbd9c73
@@ -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
#15 lore raw

Re: [PATCH v5 07/32] net/sssnic/base: add mailbox support

Quoted 8 lines · On Mon, 4 Sep 2023 12:56:33 +0800 <[email protected]> wrote:
drivers/net/sssnic/base/sssnic_reg.h +8 -0
+struct sssnic_mbox_send_ctrl1_reg {
+	union {
+		uint32_t u32;
+		struct {
+			uint32_t resvd0 : 10;
+			/* Destination eventq in the mgmt cpu */
+			uint32_t dst_eq : 2;
+			/* eventq that will be informed if tx done */

drivers/net/sssnic/base/sssnic_reg.h struct sssnic_eventq_ci_ctrl_reg { · line 237

Quoted 10 lines
drivers/net/sssnic/base/sssnic_reg.h +10 -0
+			uint32_t src_eq : 2;
+			uint32_t dma_attr : 6;
+			/* mailbox message size include header and body
+			 * must 4byte align and unit is 4byte
+			 */
+			uint32_t tx_size : 5;
+			uint32_t ordering : 2;
+			uint32_t resvd1 : 1;
+			/*write result back to DMA address of sending result  */
+			uint32_t wb : 1;

Minor nit: the comment above has odd word spacing.

#16 lore raw

Re: [PATCH v5 07/32] net/sssnic/base: add mailbox support

Hello Stephen,

I'll fix it next version.

Quoted 22 lines · Stephen Hemminger
Quoted 8 lines · On Mon, 4 Sep 2023 12:56:33 +0800 <[email protected]> wrote:
drivers/net/sssnic/base/sssnic_reg.h +8 -0
+struct sssnic_mbox_send_ctrl1_reg {
+	union {
+		uint32_t u32;
+		struct {
+			uint32_t resvd0 : 10;
+			/* Destination eventq in the mgmt cpu */
+			uint32_t dst_eq : 2;
+			/* eventq that will be informed if tx done */

drivers/net/sssnic/base/sssnic_reg.h struct sssnic_eventq_ci_ctrl_reg { · line 237

Quoted 10 lines
drivers/net/sssnic/base/sssnic_reg.h +10 -0
+			uint32_t src_eq : 2;
+			uint32_t dma_attr : 6;
+			/* mailbox message size include header and body
+			 * must 4byte align and unit is 4byte
+			 */
+			uint32_t tx_size : 5;
+			uint32_t ordering : 2;
+			uint32_t resvd1 : 1;
+			/*write result back to DMA address of sending result  */
+			uint32_t wb : 1;

Minor nit: the comment above has odd word spacing.

Signature · 2 lines
Regards,
Renyong Wan
#17 lore raw

Re: [PATCH v5 07/32] net/sssnic/base: add mailbox support

In reply to [email protected]
Quoted 13 lines · On 9/4/2023 5:56 AM, [email protected] wrote:

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.

<...>

Quoted 27 lines
drivers/net/sssnic/base/sssnic_mbox.h new file +20 -0
new file mode 100644
index 0000000000..00fa02ea78
@@ -0,0 +1,45 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018-2022 Shenzhen 3SNIC Information Technology Co., Ltd.
+ */
+
+#ifndef _SSSNIC_MBOX_H_
+#define _SSSNIC_MBOX_H_
+
+#include <rte_spinlock.h>
+
+#include "sssnic_msg.h"
+
+enum sssnic_mbox_state {
+	/* Mbox is sending message or waiting for response */
+	SSSNIC_MBOX_STATE_RUNNING,
+	/* Waiting for response timed out*/
+	SSSNIC_MBOX_STATE_TIMEOUT,
+	/* Mbox failed to send message */
+	SSSNIC_MBOX_STATE_FAILED,
+	/* Response is ready */
+	SSSNIC_MBOX_STATE_READY,

drivers/net/sssnic/base/sssnic_mbox.h line 30

Quoted 10 lines
drivers/net/sssnic/base/sssnic_mbox.h new file +10 -0
+	/* Mbox is idle, it can send message */
+	SSSNIC_MBOX_STATE_IDLE,
+};
+
+struct sssnic_sendbox;
+
+struct sssnic_mbox {
+	struct sssnic_hw *hw;
+	/* just be used for sending request msg*/
+	pthread_mutex_t req_lock;

This is causing build error in my local environment for armv8 cross compile, I guess including pthread header explicitly is required:

In file included from ../drivers/net/sssnic/base/sssnic_ctrlq.c:15:
../drivers/net/sssnic/base/sssnic_mbox.h:30:9: error: unknown type name
‘pthread_mutex_t’

    30 |         pthread_mutex_t req_lock;
       |         ^~~~~~~~~~~~~~~
#18 lore raw

PATCH v5 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
index 4abd1a0daf..7c23a82ff3 100644
@@ -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
#19 lore raw

Re: [PATCH v5 08/32] net/sssnic/base: add work queue

drivers/net/sssnic/base/sssnic_workq.c line 27

Quoted 12 lines · On Mon, 4 Sep 2023 12:56:34 +0800 <[email protected]> wrote:
drivers/net/sssnic/base/sssnic_workq.c new file +12 -0
+void *
+sssnic_workq_consume(struct sssnic_workq *workq, uint16_t num_entries,
+	uint16_t *ci)
+{
+	void *e;
+	uint16_t current_ci;
+
+	if (workq->idle_entries + num_entries > workq->num_entries)
+		return NULL;
+
+	current_ci = sssnic_workq_ci_get(workq);
+	e = (void *)sssnic_workq_entry_get(workq, current_ci);

Minor nit: cast to void * is not normally necessary in C. Compiler will do it for you.

#20 lore raw

Re: [PATCH v5 08/32] net/sssnic/base: add work queue

Hello Stephen,

 I'll fix it next version.

Quoted 17 lines · Stephen Hemminger

drivers/net/sssnic/base/sssnic_workq.c line 27

Quoted 12 lines · On Mon, 4 Sep 2023 12:56:34 +0800 <[email protected]> wrote:
drivers/net/sssnic/base/sssnic_workq.c new file +12 -0
+void *
+sssnic_workq_consume(struct sssnic_workq *workq, uint16_t num_entries,
+	uint16_t *ci)
+{
+	void *e;
+	uint16_t current_ci;
+
+	if (workq->idle_entries + num_entries > workq->num_entries)
+		return NULL;
+
+	current_ci = sssnic_workq_ci_get(workq);
+	e = (void *)sssnic_workq_entry_get(workq, current_ci);

Minor nit: cast to void * is not normally necessary in C. Compiler will do it for you.

Signature · 2 lines
Regards,
Renyong Wan
#21 lore raw

PATCH v5 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
index 7c23a82ff3..e93ca7b24b 100644
@@ -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
new file mode 100644
index 0000000000..3d54eb826a
@@ -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
index 41e65f5880..c1b9539015 100644
@@ -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
#22 lore raw

Re: [PATCH v5 09/32] net/sssnic/base: add control queue

Review

Quoted 2 lines · On Mon, 4 Sep 2023 12:56:35 +0800 <[email protected]> wrote:
		rte_memcpy(cmd->response_data, rte_pktmbuf_mtod(mbuf, void *),
(quoted diff) +1 -0
+			cmd->response_len);

For small sizes, regular memcpy is going to be the same or faster than rte_memcpy

#23 lore raw

Re: [PATCH v5 09/32] net/sssnic/base: add control queue

Hello Stephen,

The length of response_data could up to 1920 bytes.

Thanks.

Quoted 6 lines · Stephen Hemminger

Review

Quoted 2 lines · On Mon, 4 Sep 2023 12:56:35 +0800 <[email protected]> wrote:
		rte_memcpy(cmd->response_data, rte_pktmbuf_mtod(mbuf, void *),
(quoted diff) +1 -0
+			cmd->response_len);

For small sizes, regular memcpy is going to be the same or faster than rte_memcpy

Signature · 2 lines
Regards,
Renyong Wan
#24 lore raw

PATCH v5 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
index 51a59f0f25..bf0859cd63 100644
@@ -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
index 3d54eb826a..8011cc8b0f 100644
@@ -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
index ee9f536ac2..79192affbc 100644
@@ -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
index 4ca75208af..8f5f556bde 100644
@@ -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
index c1b9539015..5f20a9465d 100644
@@ -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
#25 lore raw

PATCH v5 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
index 6d9786db7e..602839d301 100644
@@ -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
index 8011cc8b0f..b985230595 100644
@@ -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
index 79192affbc..e70184866e 100644
@@ -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
index 5f20a9465d..f8fe2ac7e1 100644
@@ -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
index 70dd43d5c0..636b3fd04c 100644
@@ -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
#26 lore raw

Re: [PATCH v5 11/32] net/sssnic: add dev MAC ops

Quoted 5 lines · On 9/4/2023 5:56 AM, [email protected] wrote:

From: Renyong Wan <[email protected]>

<...>

Quoted 12 lines
drivers/net/sssnic/base/sssnic_api.c +12 -0
+int
+sssnic_mac_addr_update(struct sssnic_hw *hw, uint8_t *new, uint8_t *old)
+{
+	int ret;
+	struct sssnic_mac_addr_update_cmd cmd;
+	struct sssnic_msg msg;
+	uint32_t cmd_len;
+	uint16_t func;
+
+	if (hw == NULL || new == NULL || old == NULL)
+		return -EINVAL;
+

drivers/net/sssnic/base/sssnic_api.c sssnic_capability_get(struct sssnic_hw *hw, struct sssnic_capability *capa)

Quoted 10 lines
drivers/net/sssnic/base/sssnic_api.c +10 -0
+	if (SSSNIC_FUNC_TYPE(hw) == SSSNIC_FUNC_TYPE_VF)
+		func = SSSNIC_PF_FUNC_IDX(hw);
+	else
+		func = SSSNIC_MPU_FUNC_IDX;
+
+	memset(&cmd, 0, sizeof(cmd));
+	cmd_len = sizeof(cmd);
+	cmd.function = SSSNIC_FUNC_IDX(hw);
+	rte_memcpy(cmd.new_addr, new, 6);
+	rte_memcpy(cmd.old_addr, old, 6);>

Can use 'RTE_ETHER_ADDR_LEN' instead of hardcoded '6', same for a few other locations,

<...>

Quoted 48 lines
drivers/net/sssnic/sssnic_ethdev.c +47 -0
+static int
+sssnic_ethdev_mac_addrs_init(struct rte_eth_dev *ethdev)
+{
+	int ret;
+	struct sssnic_netdev *netdev;
+	struct sssnic_hw *hw;
+	struct rte_ether_addr default_addr;
+	char mac_str[RTE_ETHER_ADDR_FMT_SIZE];
+
+	PMD_INIT_FUNC_TRACE();
+
+	netdev = SSSNIC_ETHDEV_PRIVATE(ethdev);
+	hw = SSSNIC_NETDEV_TO_HW(netdev);
+
+	ethdev->data->mac_addrs = rte_zmalloc(NULL,
+		SSSNIC_ETHDEV_MAX_NUM_UC_MAC * sizeof(struct rte_ether_addr),
+		0);
+	if (ethdev->data->mac_addrs == NULL) {
+		PMD_DRV_LOG(ERR,
+			"Failed to allocate memory to store %u mac addresses",
+			SSSNIC_ETHDEV_MAX_NUM_UC_MAC);
+		return -ENOMEM;
+	}
+
+	netdev->mcast_addrs = rte_zmalloc(NULL,
+		SSSNIC_ETHDEV_MAX_NUM_MC_MAC * sizeof(struct rte_ether_addr),
+		0);
+	if (netdev->mcast_addrs == NULL) {
+		PMD_DRV_LOG(ERR,
+			"Failed to allocate memory to store %u mcast addresses",
+			SSSNIC_ETHDEV_MAX_NUM_MC_MAC);
+		ret = -ENOMEM;
+		goto alloc_mcast_addr_fail;
+	}
+
+	/* initialize default MAC address */
+	memset(&default_addr, 0, sizeof(default_addr));
+	ret = sssnic_mac_addr_get(hw, default_addr.addr_bytes);
+	if (ret != 0)
+		PMD_DRV_LOG(NOTICE,
+			"Could not get default MAC address, will use random address");
+
+	if (rte_is_zero_ether_addr(&default_addr))
+		rte_eth_random_addr(default_addr.addr_bytes);
+
+	rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, &default_addr);
+

drivers/net/sssnic/sssnic_ethdev.c sssnic_ethdev_infos_get(struct rte_eth_dev *ethdev, · line 278

Quoted 10 lines
drivers/net/sssnic/sssnic_ethdev.c +10 -0
+	ret = sssnic_mac_addr_add(hw, default_addr.addr_bytes);
+	if (ret != 0) {
+		PMD_DRV_LOG(ERR, "Failed to add default MAC address: %s",
+			mac_str);
+		goto add_ether_addr_fail;
+	}
+
+	rte_ether_addr_copy(&default_addr, &ethdev->data->mac_addrs[0]);
+	rte_ether_addr_copy(&default_addr, &netdev->default_addr);
+

Is there a reason to keep 'default_addr' in the device private data, when it is already stored in 'ethdev->data->mac_addrs[0]'?

<...>

drivers/net/sssnic/sssnic_ethdev.c sssnic_ethdev_release(struct rte_eth_dev *ethdev) · line 337

Quoted 6 lines
drivers/net/sssnic/sssnic_ethdev.c +1 -0
@@ -80,6 +333,7 @@ sssnic_ethdev_release(struct rte_eth_dev *ethdev)
 {
 	struct sssnic_hw *hw = SSSNIC_ETHDEV_TO_HW(ethdev);
 
+	sssnic_ethdev_mac_addrs_clean(ethdev);
 

Should 'netdev->mcast_addrs' freed in this context? As far as I can see it is not freed anywhere.

<...>

drivers/net/sssnic/sssnic_ethdev.c sssnic_ethdev_uninit(struct rte_eth_dev *ethdev) · line 412

Quoted 7 lines
drivers/net/sssnic/sssnic_ethdev.c +1 -1
@@ -140,7 +408,7 @@ sssnic_ethdev_uninit(struct rte_eth_dev *ethdev)
 
 	sssnic_ethdev_release(ethdev);
 
-	return -EINVAL;
+	return 0;
 

This should be in previous patch, 4/32, which updates uninit function.

#27 lore raw

PATCH v5 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
index 602839d301..a0688e70ef 100644
@@ -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
index b985230595..168aa152b9 100644
@@ -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
index e70184866e..6957b742fc 100644
@@ -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
index 328bb41436..12e967722a 100644
@@ -18,4 +18,5 @@ objs = [base_objs]
 
 sources = files(
         'sssnic_ethdev.c',
+        'sssnic_ethdev_link.c',
 )
drivers/net/sssnic/sssnic_ethdev.c +4 -0
index 92a20649fc..4e546cca66 100644
@@ -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
new file mode 100644
index 0000000000..00ad13fe9b
@@ -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
#28 lore raw

PATCH v5 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
index a0688e70ef..82b527ba26 100644
@@ -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
index e93ca7b24b..cf0c177cab 100644
@@ -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
new file mode 100644
index 0000000000..46f2f7465b
@@ -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
index f8fe2ac7e1..e25f5595e6 100644
@@ -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
index 4e546cca66..1e2b5c0450 100644
@@ -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
index 00ad13fe9b..52a86b4771 100644
@@ -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
#29 lore raw

Re: [PATCH v5 13/32] net/sssnic: support link status event

Quoted 5 lines · On 9/4/2023 5:56 AM, [email protected] wrote:

From: Renyong Wan <[email protected]>

<...>

drivers/net/sssnic/base/meson.build sources = [ · line 13

Quoted 10 lines
drivers/net/sssnic/base/meson.build +1 -0
index e93ca7b24b..cf0c177cab 100644
@@ -9,6 +9,7 @@ sources = [
         'sssnic_workq.c',
         'sssnic_ctrlq.c',
         'sssnic_api.c',
+	'sssnic_exception.c',
 

There is an indendation issue, overall there are some meson warnings, can you please address them:

$ ./devtools/check-meson.py
Error parsing drivers/net/sssnic/base/meson.build:11, got some tabulation
Error: Incorrect indent at drivers/net/sssnic/base/meson.build:12
Error parsing drivers/net/sssnic/base/meson.build:16, got some tabulation
Error parsing drivers/net/sssnic/base/meson.build:17, got some tabulation
#30 lore raw

PATCH v5 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
index 12e967722a..7c3516a279 100644
@@ -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
index 1e2b5c0450..f98510a55d 100644
@@ -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
index 636b3fd04c..51740413c6 100644
@@ -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
new file mode 100644
index 0000000000..dc41811a2f
@@ -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
#31 lore raw

PATCH v5 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
index 7c3516a279..0c6e21310d 100644
@@ -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
index f98510a55d..732fddfcf7 100644
@@ -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
index 51740413c6..ab832d179f 100644
@@ -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 32
 
 struct 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
new file mode 100644
index 0000000000..bd1d721e37
@@ -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
#32 lore raw

PATCH v5 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
index 3bb31009c5..3050d573bf 100644
@@ -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
index 168aa152b9..29962aabf8 100644
@@ -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
index 732fddfcf7..208f0db402 100644
@@ -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
index ab832d179f..38e6dc0d62 100644
@@ -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
index dc41811a2f..c6ddc366d5 100644
@@ -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
#33 lore raw

PATCH v5 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
index 82b527ba26..b75c68cb33 100644
@@ -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
index 208f0db402..8a18f25889 100644
@@ -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
index bd1d721e37..3de9e899a0 100644
@@ -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
#34 lore raw

PATCH v5 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
index b75c68cb33..e3b8166629 100644
@@ -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
index 82eb4ea295..651a0aa7ef 100644
@@ -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
index e25f5595e6..4820212543 100644
@@ -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
index 8a18f25889..35bb26a0b1 100644
@@ -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
index c6ddc366d5..77a116f4a5 100644
@@ -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
#35 lore raw

PATCH v5 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
index 3050d573bf..81020387bd 100644
@@ -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
index ac1bbd9c73..e30691caef 100644
@@ -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
index 38e6dc0d62..1f1e991780 100644
@@ -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
index 77a116f4a5..f4b4545944 100644
@@ -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
index 3de9e899a0..88ad82a055 100644
@@ -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
#36 lore raw

Re: [PATCH v5 19/32] net/sssnic: support dev start and stop

Quoted 5 lines · On 9/4/2023 5:56 AM, [email protected] wrote:

From: Renyong Wan <[email protected]>

<...>

drivers/net/sssnic/sssnic_ethdev_rx.c sssnic_ethdev_rxq_doorbell_ring(struct sssnic_ethdev_rxq *rxq, uint16_t pi) · line 189

Quoted 11 lines
drivers/net/sssnic/sssnic_ethdev_rx.c +1 -1
index 9c1b2f20d1..fd4975dfd5 100644
@@ -185,7 +185,7 @@ sssnic_ethdev_rxq_doorbell_ring(struct sssnic_ethdev_rxq *rxq, uint16_t pi)
 	db.qid = rxq->qid;
 	db.pi_hi = (hw_pi >> 8) & 0xff;
 
-	db_addr = (uint64_t *)(rxq->doorbell + (hw_pi & 0xff));
+	db_addr = ((uint64_t *)rxq->doorbell) + (hw_pi & 0xff);
 

Can you please fix this where it is introduced at first place?

#37 lore raw

PATCH v5 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
index 8201a1e3c4..b59c4fd3ad 100644
@@ -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
#38 lore raw

Re: [PATCH v5 20/32] net/sssnic: support dev close and reset

Quoted 5 lines · On 9/4/2023 5:56 AM, [email protected] wrote:

From: Renyong Wan <[email protected]>

<...>

drivers/net/sssnic/sssnic_ethdev.c sssnic_ethdev_stop(struct rte_eth_dev *ethdev) · line 631

Quoted 6 lines
drivers/net/sssnic/sssnic_ethdev.c +5 -0
+static int
+sssnic_ethdev_close(struct rte_eth_dev *ethdev)
+{
+	sssnic_ethdev_release(ethdev);
+

As close() is mostly empty, I just want to remind that all resources should be freed in this function.

I am not aware anything missing, but can you please double check all driver allocated memory is freed in this function?

#39 lore raw

PATCH v5 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
index e3b8166629..359834ce4c 100644
@@ -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
#40 lore raw

PATCH v5 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
index 359834ce4c..aba0b78c95 100644
@@ -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
index e89719b0de..bc7303ff57 100644
@@ -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
index 0c6e21310d..dea24f4b06 100644
@@ -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
index e1c805aeea..99e6d6152a 100644
@@ -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
index fd4975dfd5..66045f7a98 100644
@@ -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
index f4b4545944..5532aced4e 100644
@@ -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
new file mode 100644
index 0000000000..2fdc419e60
@@ -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
index b9c4f97cb3..d167e3f307 100644
@@ -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
index 88ad82a055..f04c3d5be8 100644
@@ -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
#41 lore raw

PATCH v5 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
index aba0b78c95..320ac4533d 100644
@@ -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
index 99e6d6152a..021fabcbe5 100644
@@ -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
index 5532aced4e..b0b35dee73 100644
@@ -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
#42 lore raw

PATCH v5 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
index 320ac4533d..7e6b70684a 100644
@@ -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
index 021fabcbe5..328fb85d30 100644
@@ -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
index f04c3d5be8..3a7cd47080 100644
@@ -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
#43 lore raw

Re: [PATCH v5 24/32] net/sssnic: support Tx packet burst

Quoted 5 lines · On 9/4/2023 5:56 AM, [email protected] wrote:

From: Renyong Wan <[email protected]>

<...>

Quoted 8 lines
drivers/net/sssnic/sssnic_ethdev_tx.c +7 -0
+static inline int
+sssnic_ethdev_tx_offload_check(struct rte_mbuf *tx_mbuf,
+	struct sssnic_ethdev_tx_info *tx_info)
+{
+	uint64_t ol_flags = tx_mbuf->ol_flags;
+
+	if ((ol_flags & SSSNIC_ETHDEV_TX_OFFLOAD_MASK) == 0) {

drivers/net/sssnic/sssnic_ethdev_tx.c sssnic_ethdev_tx_queue_stats_clear(struct rte_eth_dev *ethdev, uint16_t qid) · line 792

Quoted 10 lines
drivers/net/sssnic/sssnic_ethdev_tx.c +10 -0
+		tx_info->offload_en = 0;
+		return 0;
+	}
+
+#ifdef RTE_LIBRTE_ETHDEV_DEBUG
+	if (rte_validate_tx_offload(tx_mbuf) != 0) {
+		SSSNIC_TX_LOG(ERR, "Bad tx mbuf offload flags: %" PRIx64, ol_flags);
+		return -EINVAL;
+	}
+#endif

'RTE_LIBRTE_ETHDEV_DEBUG' kept as backward compatibilty alias, better to prefer fine grained RTE_ETHDEV_DEBUG_TX.

#44 lore raw

PATCH v5 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
index 7e6b70684a..020a9e7056 100644
@@ -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
index c2f4f90209..1d80b93e38 100644
@@ -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
index dea24f4b06..3541b75c30 100644
@@ -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
index 328fb85d30..a00e96bebe 100644
@@ -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
index 1f1e991780..f19b2bd88f 100644
@@ -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
new file mode 100644
index 0000000000..559722eec7
@@ -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
index 82e65f2482..2874a93a54 100644
@@ -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
#45 lore raw

PATCH v5 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
index a00e96bebe..b086e91d2d 100644
@@ -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
#46 lore raw

PATCH v5 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
index b086e91d2d..bde8d89ddc 100644
@@ -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
index 2874a93a54..6c5f209262 100644
@@ -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
index b0b35dee73..20e4d1ac0e 100644
@@ -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
index 533befb6ea..51931df645 100644
@@ -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
index 3a7cd47080..6130ade4d1 100644
@@ -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
#47 lore raw

PATCH v5 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
index 020a9e7056..a40b509558 100644
@@ -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
index 32b24e841c..12aca16995 100644
@@ -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
index 1d80b93e38..bd4f01d388 100644
@@ -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
index 56818471b6..9da07770b1 100644
@@ -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
index bde8d89ddc..cceaa5c8be 100644
@@ -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
#48 lore raw

PATCH v5 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
index a40b509558..9bf05cb968 100644
@@ -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
index bd4f01d388..36544a5dc3 100644
@@ -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
index 9da07770b1..d2054fad5a 100644
@@ -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
#49 lore raw

Re: [PATCH v5 29/32] net/sssnic: add dev flow control ops

Quoted 17 lines · On 9/4/2023 5:56 AM, [email protected] wrote:

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 +0 -0
index a40b509558..9bf05cb968 100644

doc/guides/nics/features/sssnic.ini Inner L4 checksum = Y · line 30

Quoted 5 lines
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
 

Can you please describe in the commit log, why flow control is supported partially?

#50 lore raw

PATCH v5 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
index 9bf05cb968..f5738ac934 100644
@@ -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
index d91896cdd2..68c16c9c1e 100644
@@ -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
index 36544a5dc3..28b235dda2 100644
@@ -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
index d2054fad5a..3e70d0e223 100644
@@ -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
#51 lore raw

PATCH v5 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
index f5738ac934..57e7440d86 100644
@@ -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
index 28b235dda2..7a02ec61ee 100644
@@ -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
index 4820212543..6a2d980d5a 100644
@@ -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
index e30691caef..a1e268710e 100644
@@ -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
index 3541b75c30..03d60f08ec 100644
@@ -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
index 8a1ccff70b..545833fb55 100644
@@ -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
index f19b2bd88f..0ca933b53b 100644
@@ -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
new file mode 100644
index 0000000000..2812b783e2
@@ -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
index 6c5f209262..46a1d5fd23 100644
@@ -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(&ethdev->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(&ethdev->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(&ethdev->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(&ethdev->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
#52 lore raw

PATCH v5 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
index 0e965442fd..2d829bc884 100644
@@ -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
index 7a02ec61ee..2506682821 100644
@@ -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
index c75cb0dad3..058ab298f3 100644
@@ -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
index 651a0aa7ef..0edd5b9508 100644
@@ -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
index 6a2d980d5a..9d8a3653a7 100644
@@ -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
index dd91aef5f7..dc7d912dbf 100644
@@ -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
#53 lore raw

Re: [PATCH v5 32/32] net/sssnic: add VF dev support

Quoted 8 lines · On 9/4/2023 5:56 AM, [email protected] wrote:

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

Does it make sense to document these in the driver documentation?

#54 lore raw
In reply to [email protected]
Quoted 32 lines · On Mon, 4 Sep 2023 12:56:26 +0800 <[email protected]> wrote:

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

Quoted 8 lines

- Inner L3 checksum
- Inner L4 checksum
- Basic stats
- Extended stats
- Stats per queue
- Flow control
- FW version
- Generic flow API

Does this device support primary/secondary process?

#55 lore raw

Hello Stephen,

SSSNIC PMD does not support primary/secondary process right now, it can only run in primary process. We are going to support multiprocessnext release.

Thanks.

Quoted 44 lines · Stephen Hemminger
Quoted 32 lines · On Mon, 4 Sep 2023 12:56:26 +0800 <[email protected]> wrote:

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

Quoted 8 lines

- Inner L3 checksum
- Inner L4 checksum
- Basic stats
- Extended stats
- Stats per queue
- Flow control
- FW version
- Generic flow API

Does this device support primary/secondary process?

Signature · 2 lines
Regards,
Renyong Wan
#56 lore raw
In reply to [email protected]
Quoted 174 lines · On Mon, 4 Sep 2023 12:56:26 +0800 <[email protected]> wrote:

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.

v5:
* Fixed rebase mistake.
* Fixed incorrect path in MAINTAINERS file.
---

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                                   |    2 +
 MAINTAINERS                                |    7 +
 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, 13934 insertions(+)
 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
Quoted 9 lines
 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

There seem to be a leftover stub, after all merged together.

static int
sssnic_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)

{
	RTE_SET_USED(pci_drv);     <<< this is wrong, you do use it by passing to generic probe
	PMD_INIT_FUNC_TRACE();

	return rte_eth_dev_pci_generic_probe(pci_dev,
		sizeof(struct sssnic_netdev), sssnic_ethdev_init);
}

It is simpler to used __rte_unused here.

int
sssnic_ethdev_flow_ops_get(struct rte_eth_dev *ethdev,
const struct rte_flow_ops **ops)

{
	RTE_SET_USED(ethdev);

	*ops = &sssnic_ethdev_flow_ops;

	return 0;
}
#57 lore raw

Hello Stephen,

I'll fix it in next version of patch.

Thanks.

Quoted 212 lines · Stephen Hemminger
Quoted 174 lines · On Mon, 4 Sep 2023 12:56:26 +0800 <[email protected]> wrote:

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.

v5:
* Fixed rebase mistake.
* Fixed incorrect path in MAINTAINERS file.
---

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                                   |    2 +
  MAINTAINERS                                |    7 +
  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, 13934 insertions(+)

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

Quoted 9 lines

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

There seem to be a leftover stub, after all merged together.

static int
sssnic_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)

{
	RTE_SET_USED(pci_drv);     <<< this is wrong, you do use it by passing to generic probe
	PMD_INIT_FUNC_TRACE();

	return rte_eth_dev_pci_generic_probe(pci_dev,
		sizeof(struct sssnic_netdev), sssnic_ethdev_init);
}

It is simpler to used __rte_unused here.

int
sssnic_ethdev_flow_ops_get(struct rte_eth_dev *ethdev,
const struct rte_flow_ops **ops)

{
	RTE_SET_USED(ethdev);

	*ops = &sssnic_ethdev_flow_ops;

	return 0;
}
Signature · 2 lines
Regards,
Renyong Wan
#58 lore raw
In reply to [email protected]
Quoted 174 lines · On Mon, 4 Sep 2023 12:56:26 +0800 <[email protected]> wrote:

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.

v5:
* Fixed rebase mistake.
* Fixed incorrect path in MAINTAINERS file.
---

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                                   |    2 +
 MAINTAINERS                                |    7 +
 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, 13934 insertions(+)
 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
Quoted 9 lines
 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

Since the PMD_DRV_LOG() macro you defined adds a newline, a new line should not be needed on format string in this driver.

Doing a search for \n found this one:

int
sssnic_ethdev_rx_intr_init(struct rte_eth_dev *ethdev)

{
	struct rte_intr_handle *intr_handle;
	struct sssnic_ethdev_rxq *rxq;
	uint32_t nb_rxq, i;
	int vec;
	int ret;

	if (!ethdev->data->dev_conf.intr_conf.rxq)
		return 0;

	intr_handle = ethdev->intr_handle;

	if (!rte_intr_cap_multiple(intr_handle)) {
		PMD_DRV_LOG(ERR,
			"Rx interrupts require MSI-X interrupts (vfio-pci driver)\n");
#59 lore raw

Hello Stephen,

I'll fix it in next version of patch.

Thanks.

Quoted 208 lines · Stephen Hemminger
Quoted 174 lines · On Mon, 4 Sep 2023 12:56:26 +0800 <[email protected]> wrote:

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.

v5:
* Fixed rebase mistake.
* Fixed incorrect path in MAINTAINERS file.
---

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                                   |    2 +
  MAINTAINERS                                |    7 +
  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, 13934 insertions(+)

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

Quoted 9 lines

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

Since the PMD_DRV_LOG() macro you defined adds a newline, a new line should not be needed on format string in this driver.

Doing a search for \n found this one:

int
sssnic_ethdev_rx_intr_init(struct rte_eth_dev *ethdev)

{
	struct rte_intr_handle *intr_handle;
	struct sssnic_ethdev_rxq *rxq;
	uint32_t nb_rxq, i;
	int vec;
	int ret;

	if (!ethdev->data->dev_conf.intr_conf.rxq)
		return 0;

	intr_handle = ethdev->intr_handle;

	if (!rte_intr_cap_multiple(intr_handle)) {
		PMD_DRV_LOG(ERR,
			"Rx interrupts require MSI-X interrupts (vfio-pci driver)\n");
Signature · 2 lines
Regards,
Renyong Wan
#60 lore raw
In reply to [email protected]
Quoted 174 lines · On Mon, 4 Sep 2023 12:56:26 +0800 <[email protected]> wrote:

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.

v5:
* Fixed rebase mistake.
* Fixed incorrect path in MAINTAINERS file.
---

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                                   |    2 +
 MAINTAINERS                                |    7 +
 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, 13934 insertions(+)
 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
Quoted 8 lines
 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

Since secondary process is not supported...

static int
sssnic_ethdev_init(struct rte_eth_dev *ethdev)

{
	int ret;
	struct sssnic_hw *hw;
	struct sssnic_netdev *netdev;
	struct rte_pci_device *pci_dev;

	PMD_INIT_FUNC_TRACE();

	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
		return 0;

Should be something like:

	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
		PMD_DRV_LOG(ERR, "Secondary process not supported");
		return -ENOTSUP;
	}
#61 lore raw

Hello Stephen,

I'll fix it in next version of patch.

Thanks.

Quoted 205 lines · Stephen Hemminger
Quoted 174 lines · On Mon, 4 Sep 2023 12:56:26 +0800 <[email protected]> wrote:

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.

v5:
* Fixed rebase mistake.
* Fixed incorrect path in MAINTAINERS file.
---

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                                   |    2 +
  MAINTAINERS                                |    7 +
  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, 13934 insertions(+)

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

Quoted 8 lines

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

Since secondary process is not supported...

static int
sssnic_ethdev_init(struct rte_eth_dev *ethdev)

{
	int ret;
	struct sssnic_hw *hw;
	struct sssnic_netdev *netdev;
	struct rte_pci_device *pci_dev;

	PMD_INIT_FUNC_TRACE();

	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
		return 0;

Should be something like:

	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
		PMD_DRV_LOG(ERR, "Secondary process not supported");
		return -ENOTSUP;
	}
Signature · 2 lines
Regards,
Renyong Wan
#62 lore raw
In reply to [email protected]
Quoted 174 lines · On Mon, 4 Sep 2023 12:56:26 +0800 <[email protected]> wrote:

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.

v5:
* Fixed rebase mistake.
* Fixed incorrect path in MAINTAINERS file.
---

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                                   |    2 +
 MAINTAINERS                                |    7 +
 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, 13934 insertions(+)
 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
Quoted 9 lines
 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

Overall this driver looks fine, and could be merged as is.
All my comments are little things that could be modified at anytime no urgency.

#63 lore raw
In reply to [email protected]
Quoted 88 lines · On 9/4/2023 5:56 AM, [email protected] wrote:

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.

v5:
* Fixed rebase mistake.
* Fixed incorrect path in MAINTAINERS file.
---

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

Quoted 9 lines

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

Hi Renyong,

Driver mostly looks good, I did put some minor comments, I guess driver can be merged soon with those issues addressed.

Also agree on Stephen's comments, if you apply them in next version, please feel free to keep Stephen's ack in next version.

Thanks,
ferruh

#64 lore raw
Quoted 99 lines · Ferruh Yigit
Quoted 88 lines · On 9/4/2023 5:56 AM, [email protected] wrote:

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.

v5:
* Fixed rebase mistake.
* Fixed incorrect path in MAINTAINERS file.
---

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

Quoted 9 lines

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

Quoted 9 lines

Hi Renyong,

Driver mostly looks good, I did put some minor comments, I guess driver can be merged soon with those issues addressed.

Also agree on Stephen's comments, if you apply them in next version, please feel free to keep Stephen's ack in next version.

Hi Renyong,

v5 was almost there, will there be a new version for the v24.07?

#65 lore raw

29/03/2024 12:32, Ferruh Yigit:

Quoted 18 lines · Ferruh Yigit
Quoted 17 lines · On 9/4/2023 5:56 AM, [email protected] wrote:
Quoted 10 lines

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

Hi Renyong,

Driver mostly looks good, I did put some minor comments, I guess driver can be merged soon with those issues addressed.

Quoted 6 lines
Quoted 2 lines

Also agree on Stephen's comments, if you apply them in next version, please feel free to keep Stephen's ack in next version.

Hi Renyong,

v5 was almost there, will there be a new version for the v24.07?

I still expect some news for integration in 24.11.

#66 lore raw

Hello,

Is there any plan to resume this work?

31/07/2024 19:32, Thomas Monjalon:

Quoted 27 lines

29/03/2024 12:32, Ferruh Yigit:

Quoted 18 lines · Ferruh Yigit
Quoted 17 lines · On 9/4/2023 5:56 AM, [email protected] wrote:
Quoted 10 lines

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

Hi Renyong,

Driver mostly looks good, I did put some minor comments, I guess driver can be merged soon with those issues addressed.

Quoted 6 lines
Quoted 2 lines

Also agree on Stephen's comments, if you apply them in next version, please feel free to keep Stephen's ack in next version.

Hi Renyong,

v5 was almost there, will there be a new version for the v24.07?

I still expect some news for integration in 24.11.