Skip to contentSkip to conversation

Marvell CNXK Ethdev Driver

PATCH Superseded Nithin Dabilpuram 8 participants 262 messages Mar 6, 2021 – Jul 7, 2021 Page 1 of 3

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

cover Marvell CNXK Ethdev Driver

This patchset adds support for Marvell CN106XX SoC based on 'common/cnxk' driver. In future, CN9K a.k.a octeontx2 will also be supported by same driver when code is ready and 'net/octeontx2' will be deprecated.

Depends-on: series-15511 ("Add Marvell CNXK mempool driver")

Jerin Jacob (6):
net/cnxk: add Rx support for cn9k
net/cnxk: add Rx vector version for cn9k
net/cnxk: add Tx support for cn9k
net/cnxk: add Rx support for cn10k
net/cnxk: add Rx vector version for cn10k
net/cnxk: add Tx support for cn10k

Kiran Kumar K (2):
net/cnxk: add support to configure npc net/cnxk: add initial version of rte flow support

Nithin Dabilpuram (17):
net/cnxk: add build infra and common probe net/cnxk: add platform specific probe and remove net/cnxk: add common devargs parsing function net/cnxk: add common dev infos get support net/cnxk: add device configuration operation net/cnxk: add link status update support net/cnxk: add Rx queue setup and release net/cnxk: add Tx queue setup and release net/cnxk: add packet type support net/cnxk: add queue start and stop support net/cnxk: add Rx multi-segmented version for cn9k net/cnxk: add Tx multi-segment version for cn9k net/cnxk: add Tx vector version for cn9k net/cnxk: add Rx multi-segment version for cn10k net/cnxk: add Tx multi-segment version for cn10k net/cnxk: add Tx vector version for cn10k net/cnxk: add device start and stop operations

Satha Rao (5):
net/cnxk: add port/queue stats
net/cnxk: add xstats apis
net/cnxk: add rxq/txq info get operations
net/cnxk: add ethdev firmware version get
net/cnxk: add get register operation

Satheesh Paul (1):
net/cnxk: add filter ctrl operation

Sunil Kumar Kori (13):
net/cnxk: add MAC address set ops
net/cnxk: add MTU set device operation net/cnxk: add promiscuous mode enable and disable net/cnxk: add DMAC filter support
net/cnxk: add all multicast enable/disable ethops net/cnxk: add Rx/Tx burst mode get ops net/cnxk: add flow ctrl set/get ops net/cnxk: add link up/down operations net/cnxk: add EEPROM module info get operations net/cnxk: add Rx queue interrupt enable/disable ops net/cnxk: add validation API for mempool ops net/cnxk: add device close and reset operations net/cnxk: add pending Tx mbuf cleanup operation

 MAINTAINERS                            |    3 +
 doc/guides/nics/cnxk.rst               |  343 ++++++++
 doc/guides/nics/features/cnxk.ini      |   44 +
 doc/guides/nics/features/cnxk_vec.ini  |   42 +
 doc/guides/nics/features/cnxk_vf.ini   |   39 +
 doc/guides/nics/index.rst              |    1 +
 doc/guides/platform/cnxk.rst           |    3 +
 drivers/common/cnxk/roc_npc.c          |    2 +
 drivers/net/cnxk/cn10k_ethdev.c        |  374 +++++++++
 drivers/net/cnxk/cn10k_ethdev.h        |   39 +
 drivers/net/cnxk/cn10k_rx.c            |  388 +++++++++
 drivers/net/cnxk/cn10k_rx.h            |  212 +++++
 drivers/net/cnxk/cn10k_tx.c            | 1284 ++++++++++++++++++++++++++++
 drivers/net/cnxk/cn10k_tx.h            |  442 ++++++++++
 drivers/net/cnxk/cn9k_ethdev.c         |  404 +++++++++
 drivers/net/cnxk/cn9k_ethdev.h         |   37 +
 drivers/net/cnxk/cn9k_rx.c             |  388 +++++++++
 drivers/net/cnxk/cn9k_rx.h             |  215 +++++
 drivers/net/cnxk/cn9k_tx.c             | 1122 +++++++++++++++++++++++++
 drivers/net/cnxk/cn9k_tx.h             |  475 +++++++++++
 drivers/net/cnxk/cnxk_ethdev.c         | 1449 ++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cnxk_ethdev.h         |  387 +++++++++
 drivers/net/cnxk/cnxk_ethdev_devargs.c |  169 ++++
 drivers/net/cnxk/cnxk_ethdev_ops.c     |  729 ++++++++++++++++
 drivers/net/cnxk/cnxk_link.c           |  113 +++
 drivers/net/cnxk/cnxk_lookup.c         |  326 +++++++
 drivers/net/cnxk/cnxk_rte_flow.c       |  280 ++++++
 drivers/net/cnxk/cnxk_rte_flow.h       |   69 ++
 drivers/net/cnxk/cnxk_stats.c          |  217 +++++
 drivers/net/cnxk/meson.build           |   36 +
 drivers/net/cnxk/version.map           |    3 +
 drivers/net/meson.build                |    1 +
 32 files changed, 9636 insertions(+)
 create mode 100644 doc/guides/nics/cnxk.rst
 create mode 100644 doc/guides/nics/features/cnxk.ini
 create mode 100644 doc/guides/nics/features/cnxk_vec.ini
 create mode 100644 doc/guides/nics/features/cnxk_vf.ini
 create mode 100644 drivers/net/cnxk/cn10k_ethdev.c
 create mode 100644 drivers/net/cnxk/cn10k_ethdev.h
 create mode 100644 drivers/net/cnxk/cn10k_rx.c
 create mode 100644 drivers/net/cnxk/cn10k_rx.h
 create mode 100644 drivers/net/cnxk/cn10k_tx.c
 create mode 100644 drivers/net/cnxk/cn10k_tx.h
 create mode 100644 drivers/net/cnxk/cn9k_ethdev.c
 create mode 100644 drivers/net/cnxk/cn9k_ethdev.h
 create mode 100644 drivers/net/cnxk/cn9k_rx.c
 create mode 100644 drivers/net/cnxk/cn9k_rx.h
 create mode 100644 drivers/net/cnxk/cn9k_tx.c
 create mode 100644 drivers/net/cnxk/cn9k_tx.h
 create mode 100644 drivers/net/cnxk/cnxk_ethdev.c
 create mode 100644 drivers/net/cnxk/cnxk_ethdev.h
 create mode 100644 drivers/net/cnxk/cnxk_ethdev_devargs.c
 create mode 100644 drivers/net/cnxk/cnxk_ethdev_ops.c
 create mode 100644 drivers/net/cnxk/cnxk_link.c
 create mode 100644 drivers/net/cnxk/cnxk_lookup.c
 create mode 100644 drivers/net/cnxk/cnxk_rte_flow.c
 create mode 100644 drivers/net/cnxk/cnxk_rte_flow.h
 create mode 100644 drivers/net/cnxk/cnxk_stats.c
 create mode 100644 drivers/net/cnxk/meson.build
 create mode 100644 drivers/net/cnxk/version.map
Signature · 1 line
2.8.4
#1 lore raw

PATCH 1/44 net/cnxk: add build infra and common probe

Add build infrastructure and common probe and remove for cnxk driver which is used by both CN10K and CN9K SoC.

---
 MAINTAINERS                           |   3 +
 doc/guides/nics/cnxk.rst              |  29 +++++
 doc/guides/nics/features/cnxk.ini     |   9 ++
 doc/guides/nics/features/cnxk_vec.ini |   9 ++
 doc/guides/nics/features/cnxk_vf.ini  |   9 ++
 doc/guides/nics/index.rst             |   1 +
 doc/guides/platform/cnxk.rst          |   3 +
 drivers/net/cnxk/cnxk_ethdev.c        | 219 ++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cnxk_ethdev.h        |  57 +++++++++
 drivers/net/cnxk/meson.build          |  21 ++++
 drivers/net/cnxk/version.map          |   3 +
 drivers/net/meson.build               |   1 +
 12 files changed, 364 insertions(+)
 create mode 100644 doc/guides/nics/cnxk.rst
 create mode 100644 doc/guides/nics/features/cnxk.ini
 create mode 100644 doc/guides/nics/features/cnxk_vec.ini
 create mode 100644 doc/guides/nics/features/cnxk_vf.ini
 create mode 100644 drivers/net/cnxk/cnxk_ethdev.c
 create mode 100644 drivers/net/cnxk/cnxk_ethdev.h
 create mode 100644 drivers/net/cnxk/meson.build
 create mode 100644 drivers/net/cnxk/version.map
MAINTAINERS +3 -0
index 67c179f..efabc3c 100644
@@ -745,6 +745,9 @@ M: Sunil Kumar Kori <[email protected]>
 M: Satha Rao <[email protected]>
 T: git://dpdk.org/next/dpdk-next-net-mrvl
 F: drivers/common/cnxk/
+F: drivers/net/cnxk/
+F: doc/guides/nics/cnxk.rst
+F: doc/guides/nics/features/cnxk*.ini
 F: doc/guides/platform/cnxk.rst
 
 Marvell mvpp2
doc/guides/nics/cnxk.rst new file +29 -0
new file mode 100644
index 0000000..ca21842
@@ -0,0 +1,29 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(C) 2021 Marvell.
+
+CNXK Poll Mode driver
+=====================
+
+The CNXK ETHDEV PMD (**librte_net_cnxk**) provides poll mode ethdev driver
+support for the inbuilt network device found in **Marvell OCTEON CN9K/CN10K**
+SoC family as well as for their virtual functions (VF) in SR-IOV context.
+
+More information can be found at `Marvell Official Website
+<https://www.marvell.com/embedded-processors/infrastructure-processors>`_.
+
+Features
+--------
+
+Features of the CNXK Ethdev PMD are:
+
+Prerequisites
+-------------
+
+See :doc:`../platform/cnxk` for setup information.
+
+
+Driver compilation and testing
+------------------------------
+
+Refer to the document :ref:`compiling and testing a PMD for a NIC <pmd_build_and_test>`
+for details.
doc/guides/nics/features/cnxk.ini new file +9 -0
new file mode 100644
index 0000000..2c23464
@@ -0,0 +1,9 @@
+;
+; Supported features of the 'cnxk' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Linux                = Y
+ARMv8                = Y
+Usage doc            = Y
doc/guides/nics/features/cnxk_vec.ini new file +9 -0
new file mode 100644
index 0000000..de78516
@@ -0,0 +1,9 @@
+;
+; Supported features of the 'cnxk_vec' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Linux                = Y
+ARMv8                = Y
+Usage doc            = Y
doc/guides/nics/features/cnxk_vf.ini new file +9 -0
new file mode 100644
index 0000000..9c96351
@@ -0,0 +1,9 @@
+;
+; Supported features of the 'cnxk_vf' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Linux                = Y
+ARMv8                = Y
+Usage doc            = Y
doc/guides/nics/index.rst +1 -0
index 799697c..c1a04d9 100644
@@ -19,6 +19,7 @@ Network Interface Controller Drivers
     axgbe
     bnx2x
     bnxt
+    cnxk
     cxgbe
     dpaa
     dpaa2
doc/guides/platform/cnxk.rst +3 -0
index 9bbba65..a9c050e 100644
@@ -141,6 +141,9 @@ HW Offload Drivers
 
 This section lists dataplane H/W block(s) available in CNXK SoC.
 
+#. **Ethdev Driver**
+   See :doc:`../nics/cnxk` for NIX Ethdev driver information.
+
 #. **Mempool Driver**
    See :doc:`../mempool/cnxk` for NPA mempool driver information.
 
drivers/net/cnxk/cnxk_ethdev.c new file +219 -0

219 lines not on this page · raw message

drivers/net/cnxk/cnxk_ethdev.h new file +57 -0

57 lines not on this page · raw message

drivers/net/cnxk/meson.build new file +21 -0
new file mode 100644
index 0000000..77b2f18
@@ -0,0 +1,21 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(C) 2021 Marvell.
+#
+
+if not dpdk_conf.get('RTE_ARCH_64')
+	build = false
+	reason = 'only supported on 64-bit'
+	subdir_done()
+endif
+
+sources = files('cnxk_ethdev.c')
+
+deps += ['bus_pci', 'cryptodev', 'eventdev', 'security']
+deps += ['common_cnxk', 'mempool_cnxk']
+
+extra_flags = ['-flax-vector-conversions', '-Wno-strict-aliasing']
+foreach flag: extra_flags
+	if cc.has_argument(flag)
+		cflags += flag
+	endif
+endforeach
drivers/net/cnxk/version.map new file +3 -0
new file mode 100644
index 0000000..ee80c51
@@ -0,0 +1,3 @@
+INTERNAL {
+	local: *;
+};
drivers/net/meson.build +1 -0
index fb9ff05..9f69842 100644
@@ -10,6 +10,7 @@ drivers = ['af_packet',
 	'axgbe', 'bonding',
 	'bnx2x',
 	'bnxt',
+	'cnxk',
 	'cxgbe',
 	'dpaa', 'dpaa2',
 	'e1000',
Signature · 1 line
2.8.4
#2 lore raw

PATCH 2/44 net/cnxk: add platform specific probe and remove

In reply to Nithin Dabilpuram

Add platform specific probe and remove callbacks for CN9K and CN10K which use common probe and remove functions. Register ethdev driver for CN9K and CN10K.

---
 drivers/net/cnxk/cn10k_ethdev.c | 64 ++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cn10k_ethdev.h |  9 +++++
 drivers/net/cnxk/cn9k_ethdev.c  | 82 +++++++++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cn9k_ethdev.h  |  9 +++++
 drivers/net/cnxk/cnxk_ethdev.c  | 42 +++++++++++++++++++++
 drivers/net/cnxk/cnxk_ethdev.h  | 19 ++++++++++
 drivers/net/cnxk/meson.build    |  5 +++
 7 files changed, 230 insertions(+)
 create mode 100644 drivers/net/cnxk/cn10k_ethdev.c
 create mode 100644 drivers/net/cnxk/cn10k_ethdev.h
 create mode 100644 drivers/net/cnxk/cn9k_ethdev.c
 create mode 100644 drivers/net/cnxk/cn9k_ethdev.h
drivers/net/cnxk/cn10k_ethdev.c new file +64 -0
new file mode 100644
index 0000000..54711ea
@@ -0,0 +1,64 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+#include "cn10k_ethdev.h"
+
+static int
+cn10k_nix_remove(struct rte_pci_device *pci_dev)
+{
+	return cnxk_nix_remove(pci_dev);
+}
+
+static int
+cn10k_nix_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
+{
+	struct rte_eth_dev *eth_dev;
+	int rc;
+
+	if (RTE_CACHE_LINE_SIZE != 64) {
+		plt_err("Driver not compiled for CN10K");
+		return -EFAULT;
+	}
+
+	rc = plt_init();
+	if (rc) {
+		plt_err("Failed to initialize platform model, rc=%d", rc);
+		return rc;
+	}
+
+	/* Common probe */
+	rc = cnxk_nix_probe(pci_drv, pci_dev);
+	if (rc)
+		return rc;
+
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+		eth_dev = rte_eth_dev_allocated(pci_dev->device.name);
+		if (!eth_dev)
+			return -ENOENT;
+	}
+	return 0;
+}
+
+static const struct rte_pci_id cn10k_pci_nix_map[] = {
+	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN10KA, PCI_DEVID_CNXK_RVU_PF),
+	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN10KAS, PCI_DEVID_CNXK_RVU_PF),
+	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN10KA, PCI_DEVID_CNXK_RVU_VF),
+	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN10KAS, PCI_DEVID_CNXK_RVU_VF),
+	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN10KA, PCI_DEVID_CNXK_RVU_AF_VF),
+	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN10KAS, PCI_DEVID_CNXK_RVU_AF_VF),
+	{
+		.vendor_id = 0,
+	},
+};
+
+static struct rte_pci_driver cn10k_pci_nix = {
+	.id_table = cn10k_pci_nix_map,
+	.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_NEED_IOVA_AS_VA |
+		     RTE_PCI_DRV_INTR_LSC,
+	.probe = cn10k_nix_probe,
+	.remove = cn10k_nix_remove,
+};
+
+RTE_PMD_REGISTER_PCI(net_cn10k, cn10k_pci_nix);
+RTE_PMD_REGISTER_PCI_TABLE(net_cn10k, cn10k_pci_nix_map);
+RTE_PMD_REGISTER_KMOD_DEP(net_cn10k, "vfio-pci");
drivers/net/cnxk/cn10k_ethdev.h new file +9 -0
new file mode 100644
index 0000000..1bf4a65
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+#ifndef __CN10K_ETHDEV_H__
+#define __CN10K_ETHDEV_H__
+
+#include <cnxk_ethdev.h>
+
+#endif /* __CN10K_ETHDEV_H__ */
drivers/net/cnxk/cn9k_ethdev.c new file +82 -0

82 lines not on this page · raw message

drivers/net/cnxk/cn9k_ethdev.h new file +9 -0
new file mode 100644
index 0000000..15d9397
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+#ifndef __CN9K_ETHDEV_H__
+#define __CN9K_ETHDEV_H__
+
+#include <cnxk_ethdev.h>
+
+#endif /* __CN9K_ETHDEV_H__ */
drivers/net/cnxk/cnxk_ethdev.c +42 -0

54 lines not on this page · raw message

drivers/net/cnxk/cnxk_ethdev.h +19 -0
index 0460d1e..ba2bfcd 100644
@@ -14,6 +14,22 @@
 
 #define CNXK_ETH_DEV_PMD_VERSION "1.0"
 
+#define CNXK_NIX_TX_OFFLOAD_CAPA                                               \
+	(DEV_TX_OFFLOAD_MBUF_FAST_FREE | DEV_TX_OFFLOAD_MT_LOCKFREE |          \
+	 DEV_TX_OFFLOAD_VLAN_INSERT | DEV_TX_OFFLOAD_QINQ_INSERT |             \
+	 DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM | DEV_TX_OFFLOAD_OUTER_UDP_CKSUM |    \
+	 DEV_TX_OFFLOAD_TCP_CKSUM | DEV_TX_OFFLOAD_UDP_CKSUM |                 \
+	 DEV_TX_OFFLOAD_SCTP_CKSUM | DEV_TX_OFFLOAD_TCP_TSO |                  \
+	 DEV_TX_OFFLOAD_VXLAN_TNL_TSO | DEV_TX_OFFLOAD_GENEVE_TNL_TSO |        \
+	 DEV_TX_OFFLOAD_GRE_TNL_TSO | DEV_TX_OFFLOAD_MULTI_SEGS |              \
+	 DEV_TX_OFFLOAD_IPV4_CKSUM)
+
+#define CNXK_NIX_RX_OFFLOAD_CAPA                                               \
+	(DEV_RX_OFFLOAD_CHECKSUM | DEV_RX_OFFLOAD_SCTP_CKSUM |                 \
+	 DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM | DEV_RX_OFFLOAD_SCATTER |            \
+	 DEV_RX_OFFLOAD_JUMBO_FRAME | DEV_RX_OFFLOAD_OUTER_UDP_CKSUM |         \
+	 DEV_RX_OFFLOAD_RSS_HASH)
+
 struct cnxk_eth_dev {
 	/* ROC NIX */
 	struct roc_nix nix;
@@ -28,6 +44,9 @@ struct cnxk_eth_dev {
 
 	/* HW capabilities / Limitations */
 	union {
+		struct {
+			uint64_t cq_min_4k : 1;
+		};
 		uint64_t hwcap;
 	};
 
drivers/net/cnxk/meson.build +5 -0
index 77b2f18..57dea5e 100644
@@ -10,6 +10,11 @@ endif
 
 sources = files('cnxk_ethdev.c')
 
+# CN9K
+sources += files('cn9k_ethdev.c')
+# CN10K
+sources += files('cn10k_ethdev.c')
+
 deps += ['bus_pci', 'cryptodev', 'eventdev', 'security']
 deps += ['common_cnxk', 'mempool_cnxk']
 
Signature · 1 line
2.8.4
#3 lore raw

PATCH 3/44 net/cnxk: add common devargs parsing function

In reply to Nithin Dabilpuram

Add various devargs parsing command line arguments parsing functions supported by CN9K and CN10K.

---
 doc/guides/nics/cnxk.rst               |  94 +++++++++++++++++++
 drivers/net/cnxk/cnxk_ethdev.c         |   7 ++
 drivers/net/cnxk/cnxk_ethdev.h         |   9 ++
 drivers/net/cnxk/cnxk_ethdev_devargs.c | 166 +++++++++++++++++++++++++++++++++
 drivers/net/cnxk/meson.build           |   3 +-
 5 files changed, 278 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/cnxk/cnxk_ethdev_devargs.c
doc/guides/nics/cnxk.rst +94 -0
index ca21842..611ffb4 100644
@@ -27,3 +27,97 @@ Driver compilation and testing
 
 Refer to the document :ref:`compiling and testing a PMD for a NIC <pmd_build_and_test>`
 for details.
+
+Runtime Config Options
+----------------------
+
+- ``Rx&Tx scalar mode enable`` (default ``0``)
+
+   Ethdev supports both scalar and vector mode, it may be selected at runtime
+   using ``scalar_enable`` ``devargs`` parameter.
+
+- ``RSS reta size`` (default ``64``)
+
+   RSS redirection table size may be configured during runtime using ``reta_size``
+   ``devargs`` parameter.
+
+   For example::
+
+      -a 0002:02:00.0,reta_size=256
+
+   With the above configuration, reta table of size 256 is populated.
+
+- ``Flow priority levels`` (default ``3``)
+
+   RTE Flow priority levels can be configured during runtime using
+   ``flow_max_priority`` ``devargs`` parameter.
+
+   For example::
+
+      -a 0002:02:00.0,flow_max_priority=10
+
+   With the above configuration, priority level was set to 10 (0-9). Max
+   priority level supported is 32.
+
+- ``Reserve Flow entries`` (default ``8``)
+
+   RTE flow entries can be pre allocated and the size of pre allocation can be
+   selected runtime using ``flow_prealloc_size`` ``devargs`` parameter.
+
+   For example::
+
+      -a 0002:02:00.0,flow_prealloc_size=4
+
+   With the above configuration, pre alloc size was set to 4. Max pre alloc
+   size supported is 32.
+
+- ``Max SQB buffer count`` (default ``512``)
+
+   Send queue descriptor buffer count may be limited during runtime using
+   ``max_sqb_count`` ``devargs`` parameter.
+
+   For example::
+
+      -a 0002:02:00.0,max_sqb_count=64
+
+   With the above configuration, each send queue's decscriptor buffer count is
+   limited to a maximum of 64 buffers.
+
+- ``Switch header enable`` (default ``none``)
+
+   A port can be configured to a specific switch header type by using
+   ``switch_header`` ``devargs`` parameter.
+
+   For example::
+
+      -a 0002:02:00.0,switch_header="higig2"
+
+   With the above configuration, higig2 will be enabled on that port and the
+   traffic on this port should be higig2 traffic only. Supported switch header
+   types are "higig2", "dsa", "chlen90b" and "chlen24b".
+
+- ``RSS tag as XOR`` (default ``0``)
+
+   The HW gives two options to configure the RSS adder i.e
+
+   * ``rss_adder<7:0> = flow_tag<7:0> ^ flow_tag<15:8> ^ flow_tag<23:16> ^ flow_tag<31:24>``
+
+   * ``rss_adder<7:0> = flow_tag<7:0>``
+
+   Latter one aligns with standard NIC behavior vs former one is a legacy
+   RSS adder scheme used in OCTEON TX2 products.
+
+   By default, the driver runs in the latter mode.
+   Setting this flag to 1 to select the legacy mode.
+
+   For example to select the legacy mode(RSS tag adder as XOR)::
+
+      -a 0002:02:00.0,tag_as_xor=1
+
+
+
+.. note::
+
+   Above devarg parameters are configurable per device, user needs to pass the
+   parameters to all the PCIe devices if application requires to configure on
+   all the ethdev ports.
drivers/net/cnxk/cnxk_ethdev.c +7 -0
index b836fc2..3a2309e 100644
@@ -58,6 +58,13 @@ cnxk_eth_dev_init(struct rte_eth_dev *eth_dev)
 	rte_eth_copy_pci_info(eth_dev, pci_dev);
 	eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
 
+	/* Parse devargs string */
+	rc = cnxk_ethdev_parse_devargs(eth_dev->device->devargs, dev);
+	if (rc) {
+		plt_err("Failed to parse devargs rc=%d", rc);
+		goto error;
+	}
+
 	/* Initialize base roc nix */
 	nix->pci_dev = pci_dev;
 	rc = roc_nix_dev_init(nix);
drivers/net/cnxk/cnxk_ethdev.h +9 -0
index ba2bfcd..97e3a15 100644
@@ -9,11 +9,15 @@
 
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
+#include <rte_kvargs.h>
 
 #include "roc_api.h"
 
 #define CNXK_ETH_DEV_PMD_VERSION "1.0"
 
+/* Max supported SQB count */
+#define CNXK_NIX_TX_MAX_SQB 512
+
 #define CNXK_NIX_TX_OFFLOAD_CAPA                                               \
 	(DEV_TX_OFFLOAD_MBUF_FAST_FREE | DEV_TX_OFFLOAD_MT_LOCKFREE |          \
 	 DEV_TX_OFFLOAD_VLAN_INSERT | DEV_TX_OFFLOAD_QINQ_INSERT |             \
@@ -38,6 +42,7 @@ struct cnxk_eth_dev {
 	uint8_t max_mac_entries;
 
 	uint16_t flags;
+	bool scalar_ena;
 
 	/* Pointer back to rte */
 	struct rte_eth_dev *eth_dev;
@@ -73,4 +78,8 @@ int cnxk_nix_probe(struct rte_pci_driver *pci_drv,
 		   struct rte_pci_device *pci_dev);
 int cnxk_nix_remove(struct rte_pci_device *pci_dev);
 
+/* Devargs */
+int cnxk_ethdev_parse_devargs(struct rte_devargs *devargs,
+			      struct cnxk_eth_dev *dev);
+
 #endif /* __CNXK_ETHDEV_H__ */
drivers/net/cnxk/cnxk_ethdev_devargs.c new file +166 -0

166 lines not on this page · raw message

drivers/net/cnxk/meson.build +2 -1
index 57dea5e..00c4722 100644
@@ -8,7 +8,8 @@ if not dpdk_conf.get('RTE_ARCH_64')
 	subdir_done()
 endif
 
-sources = files('cnxk_ethdev.c')
+sources = files('cnxk_ethdev.c',
+		'cnxk_ethdev_devargs.c')
 
 # CN9K
 sources += files('cn9k_ethdev.c')
Signature · 1 line
2.8.4
#4 lore raw

PATCH 4/44 net/cnxk: add common dev infos get support

In reply to Nithin Dabilpuram

Add support to retrieve dev infos get for CN9K and CN10K.

---
 doc/guides/nics/cnxk.rst              |  3 ++
 doc/guides/nics/features/cnxk.ini     |  4 ++
 doc/guides/nics/features/cnxk_vec.ini |  4 ++
 doc/guides/nics/features/cnxk_vf.ini  |  3 ++
 drivers/net/cnxk/cnxk_ethdev.c        |  4 +-
 drivers/net/cnxk/cnxk_ethdev.h        | 33 ++++++++++++++++
 drivers/net/cnxk/cnxk_ethdev_ops.c    | 71 +++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/meson.build          |  1 +
 8 files changed, 122 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/cnxk/cnxk_ethdev_ops.c
doc/guides/nics/cnxk.rst +3 -0
index 611ffb4..dfe2e7a 100644
@@ -16,6 +16,9 @@ Features
 
 Features of the CNXK Ethdev PMD are:
 
+- SR-IOV VF
+- Lock-free Tx queue
+
 Prerequisites
 -------------
 
doc/guides/nics/features/cnxk.ini +4 -0
index 2c23464..b426340 100644
@@ -4,6 +4,10 @@
 ; Refer to default.ini for the full list of available PMD features.
 ;
 [Features]
+Speed capabilities   = Y
+Lock-free Tx queue   = Y
+SR-IOV               = Y
+Multiprocess aware   = Y
 Linux                = Y
 ARMv8                = Y
 Usage doc            = Y
doc/guides/nics/features/cnxk_vec.ini +4 -0
index de78516..292ac1e 100644
@@ -4,6 +4,10 @@
 ; Refer to default.ini for the full list of available PMD features.
 ;
 [Features]
+Speed capabilities   = Y
+Lock-free Tx queue   = Y
+SR-IOV               = Y
+Multiprocess aware   = Y
 Linux                = Y
 ARMv8                = Y
 Usage doc            = Y
doc/guides/nics/features/cnxk_vf.ini +3 -0
index 9c96351..bc2eb8a 100644
@@ -4,6 +4,9 @@
 ; Refer to default.ini for the full list of available PMD features.
 ;
 [Features]
+Speed capabilities   = Y
+Lock-free Tx queue   = Y
+Multiprocess aware   = Y
 Linux                = Y
 ARMv8                = Y
 Usage doc            = Y
drivers/net/cnxk/cnxk_ethdev.c +3 -1
index 3a2309e..1567007 100644
@@ -38,7 +38,9 @@ nix_get_speed_capa(struct cnxk_eth_dev *dev)
 }
 
 /* CNXK platform independent eth dev ops */
-struct eth_dev_ops cnxk_eth_dev_ops;
+struct eth_dev_ops cnxk_eth_dev_ops = {
+	.dev_infos_get = cnxk_nix_info_get,
+};
 
 static int
 cnxk_eth_dev_init(struct rte_eth_dev *eth_dev)
drivers/net/cnxk/cnxk_ethdev.h +33 -0
index 97e3a15..8d9a7e0 100644
@@ -15,9 +15,40 @@
 
 #define CNXK_ETH_DEV_PMD_VERSION "1.0"
 
+/* VLAN tag inserted by NIX_TX_VTAG_ACTION.
+ * In Tx space is always reserved for this in FRS.
+ */
+#define CNXK_NIX_MAX_VTAG_INS	   2
+#define CNXK_NIX_MAX_VTAG_ACT_SIZE (4 * CNXK_NIX_MAX_VTAG_INS)
+
+/* ETH_HLEN+ETH_FCS+2*VLAN_HLEN */
+#define CNXK_NIX_L2_OVERHEAD (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + 8)
+
+#define CNXK_NIX_RX_MIN_DESC	    16
+#define CNXK_NIX_RX_MIN_DESC_ALIGN  16
+#define CNXK_NIX_RX_NB_SEG_MAX	    6
+#define CNXK_NIX_RX_DEFAULT_RING_SZ 4096
 /* Max supported SQB count */
 #define CNXK_NIX_TX_MAX_SQB 512
 
+/* If PTP is enabled additional SEND MEM DESC is required which
+ * takes 2 words, hence max 7 iova address are possible
+ */
+#if defined(RTE_LIBRTE_IEEE1588)
+#define CNXK_NIX_TX_NB_SEG_MAX 7
+#else
+#define CNXK_NIX_TX_NB_SEG_MAX 9
+#endif
+
+#define CNXK_NIX_RSS_L3_L4_SRC_DST                                             \
+	(ETH_RSS_L3_SRC_ONLY | ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_SRC_ONLY |     \
+	 ETH_RSS_L4_DST_ONLY)
+
+#define CNXK_NIX_RSS_OFFLOAD                                                   \
+	(ETH_RSS_PORT | ETH_RSS_IP | ETH_RSS_UDP | ETH_RSS_TCP |               \
+	 ETH_RSS_SCTP | ETH_RSS_TUNNEL | ETH_RSS_L2_PAYLOAD |                  \
+	 CNXK_NIX_RSS_L3_L4_SRC_DST | ETH_RSS_LEVEL_MASK | ETH_RSS_C_VLAN)
+
 #define CNXK_NIX_TX_OFFLOAD_CAPA                                               \
 	(DEV_TX_OFFLOAD_MBUF_FAST_FREE | DEV_TX_OFFLOAD_MT_LOCKFREE |          \
 	 DEV_TX_OFFLOAD_VLAN_INSERT | DEV_TX_OFFLOAD_QINQ_INSERT |             \
@@ -77,6 +108,8 @@ extern struct eth_dev_ops cnxk_eth_dev_ops;
 int cnxk_nix_probe(struct rte_pci_driver *pci_drv,
 		   struct rte_pci_device *pci_dev);
 int cnxk_nix_remove(struct rte_pci_device *pci_dev);
+int cnxk_nix_info_get(struct rte_eth_dev *eth_dev,
+		      struct rte_eth_dev_info *dev_info);
 
 /* Devargs */
 int cnxk_ethdev_parse_devargs(struct rte_devargs *devargs,
drivers/net/cnxk/cnxk_ethdev_ops.c new file +71 -0

71 lines not on this page · raw message

drivers/net/cnxk/meson.build +1 -0
index 00c4722..45ccbe3 100644
@@ -9,6 +9,7 @@ if not dpdk_conf.get('RTE_ARCH_64')
 endif
 
 sources = files('cnxk_ethdev.c',
+		'cnxk_ethdev_ops.c',
 		'cnxk_ethdev_devargs.c')
 
 # CN9K
Signature · 1 line
2.8.4
#5 lore raw

PATCH 5/44 net/cnxk: add device configuration operation

In reply to Nithin Dabilpuram

Add device configuration op for CN9K and CN10K. Most of the device configuration is common between two platforms except for some supported offloads.

---
 doc/guides/nics/cnxk.rst              |   2 +
 doc/guides/nics/features/cnxk.ini     |   2 +
 doc/guides/nics/features/cnxk_vec.ini |   2 +
 doc/guides/nics/features/cnxk_vf.ini  |   2 +
 drivers/net/cnxk/cn10k_ethdev.c       |  34 +++
 drivers/net/cnxk/cn9k_ethdev.c        |  45 +++
 drivers/net/cnxk/cnxk_ethdev.c        | 521 ++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cnxk_ethdev.h        |  70 +++++
 8 files changed, 678 insertions(+)
doc/guides/nics/cnxk.rst +2 -0
index dfe2e7a..73eb62a 100644
@@ -18,6 +18,8 @@ Features of the CNXK Ethdev PMD are:
 
 - SR-IOV VF
 - Lock-free Tx queue
+- Multiple queues for TX and RX
+- Receiver Side Scaling (RSS)
 
 Prerequisites
 -------------
doc/guides/nics/features/cnxk.ini +2 -0
index b426340..96dba2a 100644
@@ -8,6 +8,8 @@ Speed capabilities   = Y
 Lock-free Tx queue   = Y
 SR-IOV               = Y
 Multiprocess aware   = Y
+RSS hash             = Y
+Inner RSS            = Y
 Linux                = Y
 ARMv8                = Y
 Usage doc            = Y
doc/guides/nics/features/cnxk_vec.ini +2 -0
index 292ac1e..616991c 100644
@@ -8,6 +8,8 @@ Speed capabilities   = Y
 Lock-free Tx queue   = Y
 SR-IOV               = Y
 Multiprocess aware   = Y
+RSS hash             = Y
+Inner RSS            = Y
 Linux                = Y
 ARMv8                = Y
 Usage doc            = Y
doc/guides/nics/features/cnxk_vf.ini +2 -0
index bc2eb8a..a0bd2f1 100644
@@ -7,6 +7,8 @@
 Speed capabilities   = Y
 Lock-free Tx queue   = Y
 Multiprocess aware   = Y
+RSS hash             = Y
+Inner RSS            = Y
 Linux                = Y
 ARMv8                = Y
 Usage doc            = Y
drivers/net/cnxk/cn10k_ethdev.c +34 -0
index 54711ea..9cf0f9e 100644
@@ -4,6 +4,38 @@
 #include "cn10k_ethdev.h"
 
 static int
+cn10k_nix_configure(struct rte_eth_dev *eth_dev)
+{
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	int rc;
+
+	/* Common nix configure */
+	rc = cnxk_nix_configure(eth_dev);
+	if (rc)
+		return rc;
+
+	plt_nix_dbg("Configured port%d platform specific rx_offload_flags=%x"
+		    " tx_offload_flags=0x%x",
+		    eth_dev->data->port_id, dev->rx_offload_flags,
+		    dev->tx_offload_flags);
+	return 0;
+}
+
+/* Update platform specific eth dev ops */
+static void
+nix_eth_dev_ops_override(void)
+{
+	static int init_once;
+
+	if (init_once)
+		return;
+	init_once = 1;
+
+	/* Update platform specific ops */
+	cnxk_eth_dev_ops.dev_configure = cn10k_nix_configure;
+}
+
+static int
 cn10k_nix_remove(struct rte_pci_device *pci_dev)
 {
 	return cnxk_nix_remove(pci_dev);
@@ -26,6 +58,8 @@ cn10k_nix_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 		return rc;
 	}
 
+	nix_eth_dev_ops_override();
+
 	/* Common probe */
 	rc = cnxk_nix_probe(pci_drv, pci_dev);
 	if (rc)
drivers/net/cnxk/cn9k_ethdev.c +45 -0

57 lines not on this page · raw message

drivers/net/cnxk/cnxk_ethdev.c +521 -0

545 lines not on this page · raw message

drivers/net/cnxk/cnxk_ethdev.h +70 -0

97 lines not on this page · raw message

Signature · 1 line
2.8.4
#6 lore raw

PATCH 6/44 net/cnxk: add link status update support

In reply to Nithin Dabilpuram

Add link status update callback to get current
link status.

---
 doc/guides/nics/cnxk.rst              |   1 +
 doc/guides/nics/features/cnxk.ini     |   2 +
 doc/guides/nics/features/cnxk_vec.ini |   2 +
 doc/guides/nics/features/cnxk_vf.ini  |   2 +
 drivers/net/cnxk/cnxk_ethdev.c        |   7 +++
 drivers/net/cnxk/cnxk_ethdev.h        |   8 +++
 drivers/net/cnxk/cnxk_link.c          | 102 ++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/meson.build          |   3 +-
 8 files changed, 126 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/cnxk/cnxk_link.c
doc/guides/nics/cnxk.rst +1 -0
index 73eb62a..a982450 100644
@@ -20,6 +20,7 @@ Features of the CNXK Ethdev PMD are:
 - Lock-free Tx queue
 - Multiple queues for TX and RX
 - Receiver Side Scaling (RSS)
+- Link state information
 
 Prerequisites
 -------------
doc/guides/nics/features/cnxk.ini +2 -0
index 96dba2a..affbbd9 100644
@@ -8,6 +8,8 @@ Speed capabilities   = Y
 Lock-free Tx queue   = Y
 SR-IOV               = Y
 Multiprocess aware   = Y
+Link status          = Y
+Link status event    = Y
 RSS hash             = Y
 Inner RSS            = Y
 Linux                = Y
doc/guides/nics/features/cnxk_vec.ini +2 -0
index 616991c..836cc9f 100644
@@ -8,6 +8,8 @@ Speed capabilities   = Y
 Lock-free Tx queue   = Y
 SR-IOV               = Y
 Multiprocess aware   = Y
+Link status          = Y
+Link status event    = Y
 RSS hash             = Y
 Inner RSS            = Y
 Linux                = Y
doc/guides/nics/features/cnxk_vf.ini +2 -0
index a0bd2f1..29bb24f 100644
@@ -7,6 +7,8 @@
 Speed capabilities   = Y
 Lock-free Tx queue   = Y
 Multiprocess aware   = Y
+Link status          = Y
+Link status event    = Y
 RSS hash             = Y
 Inner RSS            = Y
 Linux                = Y
drivers/net/cnxk/cnxk_ethdev.c +7 -0
index f141027..c07827c 100644
@@ -554,6 +554,7 @@ cnxk_nix_configure(struct rte_eth_dev *eth_dev)
 /* CNXK platform independent eth dev ops */
 struct eth_dev_ops cnxk_eth_dev_ops = {
 	.dev_infos_get = cnxk_nix_info_get,
+	.link_update = cnxk_nix_link_update,
 };
 
 static int
@@ -589,6 +590,9 @@ cnxk_eth_dev_init(struct rte_eth_dev *eth_dev)
 		goto error;
 	}
 
+	/* Register up msg callbacks */
+	roc_nix_mac_link_cb_register(nix, cnxk_eth_dev_link_status_cb);
+
 	dev->eth_dev = eth_dev;
 	dev->configured = 0;
 
@@ -677,6 +681,9 @@ cnxk_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close)
 
 	roc_nix_npc_rx_ena_dis(nix, false);
 
+	/* Disable link status events */
+	roc_nix_mac_link_event_start_stop(nix, false);
+
 	/* Free up SQs */
 	for (i = 0; i < eth_dev->data->nb_tx_queues; i++) {
 		dev_ops->tx_queue_release(eth_dev->data->tx_queues[i]);
drivers/net/cnxk/cnxk_ethdev.h +8 -0
index 55da1da..6dad8ac 100644
@@ -15,6 +15,9 @@
 
 #define CNXK_ETH_DEV_PMD_VERSION "1.0"
 
+/* Used for struct cnxk_eth_dev::flags */
+#define CNXK_LINK_CFG_IN_PROGRESS_F BIT_ULL(0)
+
 /* VLAN tag inserted by NIX_TX_VTAG_ACTION.
  * In Tx space is always reserved for this in FRS.
  */
@@ -181,6 +184,11 @@ int cnxk_nix_configure(struct rte_eth_dev *eth_dev);
 uint32_t cnxk_rss_ethdev_to_nix(struct cnxk_eth_dev *dev, uint64_t ethdev_rss,
 				uint8_t rss_level);
 
+/* Link */
+void cnxk_eth_dev_link_status_cb(struct roc_nix *nix,
+				 struct roc_nix_link_info *link);
+int cnxk_nix_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete);
+
 /* Devargs */
 int cnxk_ethdev_parse_devargs(struct rte_devargs *devargs,
 			      struct cnxk_eth_dev *dev);
drivers/net/cnxk/cnxk_link.c new file +102 -0

102 lines not on this page · raw message

drivers/net/cnxk/meson.build +2 -1
index 45ccbe3..c0ec91a 100644
@@ -10,7 +10,8 @@ endif
 
 sources = files('cnxk_ethdev.c',
 		'cnxk_ethdev_ops.c',
-		'cnxk_ethdev_devargs.c')
+		'cnxk_ethdev_devargs.c',
+		'cnxk_link.c')
 
 # CN9K
 sources += files('cn9k_ethdev.c')
Signature · 1 line
2.8.4
#7 lore raw

PATCH 7/44 net/cnxk: add Rx queue setup and release

In reply to Nithin Dabilpuram

Add Rx queue setup and release op for CN9K and CN10K SoC. Release is completely common while setup is platform dependent due to fast path Rx queue structure variation. Fastpath is platform dependent partly due to core cacheline size difference.

---
 doc/guides/nics/features/cnxk.ini     |   1 +
 doc/guides/nics/features/cnxk_vec.ini |   1 +
 doc/guides/nics/features/cnxk_vf.ini  |   1 +
 drivers/net/cnxk/cn10k_ethdev.c       |  44 +++++++++
 drivers/net/cnxk/cn10k_ethdev.h       |  14 +++
 drivers/net/cnxk/cn9k_ethdev.c        |  44 +++++++++
 drivers/net/cnxk/cn9k_ethdev.h        |  14 +++
 drivers/net/cnxk/cnxk_ethdev.c        | 172 ++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cnxk_ethdev.h        |   9 ++
 9 files changed, 300 insertions(+)
doc/guides/nics/features/cnxk.ini +1 -0
index affbbd9..a9d2b03 100644
@@ -10,6 +10,7 @@ SR-IOV               = Y
 Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
+Runtime Rx queue setup = Y
 RSS hash             = Y
 Inner RSS            = Y
 Linux                = Y
doc/guides/nics/features/cnxk_vec.ini +1 -0
index 836cc9f..6a8ca1f 100644
@@ -10,6 +10,7 @@ SR-IOV               = Y
 Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
+Runtime Rx queue setup = Y
 RSS hash             = Y
 Inner RSS            = Y
 Linux                = Y
doc/guides/nics/features/cnxk_vf.ini +1 -0
index 29bb24f..f761638 100644
@@ -9,6 +9,7 @@ Lock-free Tx queue   = Y
 Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
+Runtime Rx queue setup = Y
 RSS hash             = Y
 Inner RSS            = Y
 Linux                = Y
drivers/net/cnxk/cn10k_ethdev.c +44 -0

56 lines not on this page · raw message

drivers/net/cnxk/cn10k_ethdev.h +14 -0
index 1bf4a65..08e11bb 100644
@@ -6,4 +6,18 @@
 
 #include <cnxk_ethdev.h>
 
+struct cn10k_eth_rxq {
+	uint64_t mbuf_initializer;
+	uintptr_t desc;
+	void *lookup_mem;
+	uintptr_t cq_door;
+	uint64_t wdata;
+	int64_t *cq_status;
+	uint32_t head;
+	uint32_t qmask;
+	uint32_t available;
+	uint16_t data_off;
+	uint16_t rq;
+} __plt_cache_aligned;
+
 #endif /* __CN10K_ETHDEV_H__ */
drivers/net/cnxk/cn9k_ethdev.c +44 -0

56 lines not on this page · raw message

drivers/net/cnxk/cn9k_ethdev.h +14 -0
index 15d9397..6384609 100644
@@ -6,4 +6,18 @@
 
 #include <cnxk_ethdev.h>
 
+struct cn9k_eth_rxq {
+	uint64_t mbuf_initializer;
+	uint64_t data_off;
+	uintptr_t desc;
+	void *lookup_mem;
+	uintptr_t cq_door;
+	uint64_t wdata;
+	int64_t *cq_status;
+	uint32_t head;
+	uint32_t qmask;
+	uint32_t available;
+	uint16_t rq;
+} __plt_cache_aligned;
+
 #endif /* __CN9K_ETHDEV_H__ */
drivers/net/cnxk/cnxk_ethdev.c +172 -0

184 lines not on this page · raw message

drivers/net/cnxk/cnxk_ethdev.h +9 -0
index 6dad8ac..e938c64 100644
@@ -10,6 +10,9 @@
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_kvargs.h>
+#include <rte_mbuf.h>
+#include <rte_mbuf_pool_ops.h>
+#include <rte_mempool.h>
 
 #include "roc_api.h"
 
@@ -179,6 +182,12 @@ int cnxk_nix_remove(struct rte_pci_device *pci_dev);
 int cnxk_nix_info_get(struct rte_eth_dev *eth_dev,
 		      struct rte_eth_dev_info *dev_info);
 int cnxk_nix_configure(struct rte_eth_dev *eth_dev);
+int cnxk_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
+			    uint16_t nb_desc, uint16_t fp_rx_q_sz,
+			    const struct rte_eth_rxconf *rx_conf,
+			    struct rte_mempool *mp);
+
+uint64_t cnxk_nix_rxq_mbuf_setup(struct cnxk_eth_dev *dev);
 
 /* RSS */
 uint32_t cnxk_rss_ethdev_to_nix(struct cnxk_eth_dev *dev, uint64_t ethdev_rss,
Signature · 1 line
2.8.4
#8 lore raw

PATCH 8/44 net/cnxk: add Tx queue setup and release

In reply to Nithin Dabilpuram

Add Tx queue setup and release for CN9K and CN10K. Release is common while setup is platform dependent due to differences in fast path Tx queue structures.

---
 doc/guides/nics/features/cnxk.ini     |  1 +
 doc/guides/nics/features/cnxk_vec.ini |  1 +
 doc/guides/nics/features/cnxk_vf.ini  |  1 +
 drivers/net/cnxk/cn10k_ethdev.c       | 71 +++++++++++++++++++++++++
 drivers/net/cnxk/cn10k_ethdev.h       | 12 +++++
 drivers/net/cnxk/cn10k_tx.h           | 13 +++++
 drivers/net/cnxk/cn9k_ethdev.c        | 69 ++++++++++++++++++++++++
 drivers/net/cnxk/cn9k_ethdev.h        | 10 ++++
 drivers/net/cnxk/cn9k_tx.h            | 13 +++++
 drivers/net/cnxk/cnxk_ethdev.c        | 98 +++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cnxk_ethdev.h        |  3 ++
 11 files changed, 292 insertions(+)
 create mode 100644 drivers/net/cnxk/cn10k_tx.h
 create mode 100644 drivers/net/cnxk/cn9k_tx.h
doc/guides/nics/features/cnxk.ini +1 -0
index a9d2b03..462d7c4 100644
@@ -11,6 +11,7 @@ Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
+Runtime Tx queue setup = Y
 RSS hash             = Y
 Inner RSS            = Y
 Linux                = Y
doc/guides/nics/features/cnxk_vec.ini +1 -0
index 6a8ca1f..09e0d3a 100644
@@ -11,6 +11,7 @@ Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
+Runtime Tx queue setup = Y
 RSS hash             = Y
 Inner RSS            = Y
 Linux                = Y
doc/guides/nics/features/cnxk_vf.ini +1 -0
index f761638..4a93a35 100644
@@ -10,6 +10,7 @@ Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
+Runtime Tx queue setup = Y
 RSS hash             = Y
 Inner RSS            = Y
 Linux                = Y
drivers/net/cnxk/cn10k_ethdev.c +71 -0

83 lines not on this page · raw message

drivers/net/cnxk/cn10k_ethdev.h +12 -0
index 08e11bb..2157b16 100644
@@ -6,6 +6,18 @@
 
 #include <cnxk_ethdev.h>
 
+struct cn10k_eth_txq {
+	uint64_t send_hdr_w0;
+	uint64_t sg_w0;
+	int64_t fc_cache_pkts;
+	uint64_t *fc_mem;
+	uintptr_t lmt_base;
+	rte_iova_t io_addr;
+	uint16_t sqes_per_sqb_log2;
+	int16_t nb_sqb_bufs_adj;
+	uint64_t cmd[4];
+} __plt_cache_aligned;
+
 struct cn10k_eth_rxq {
 	uint64_t mbuf_initializer;
 	uintptr_t desc;
drivers/net/cnxk/cn10k_tx.h new file +13 -0
new file mode 100644
index 0000000..39d4755
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+#ifndef __CN10K_TX_H__
+#define __CN10K_TX_H__
+
+#define NIX_TX_OFFLOAD_VLAN_QINQ_F    BIT(2)
+#define NIX_TX_OFFLOAD_TSO_F	      BIT(4)
+
+#define NIX_TX_NEED_EXT_HDR                                                    \
+	(NIX_TX_OFFLOAD_VLAN_QINQ_F | NIX_TX_OFFLOAD_TSO_F)
+
+#endif /* __CN10K_TX_H__ */
drivers/net/cnxk/cn9k_ethdev.c +69 -0

81 lines not on this page · raw message

drivers/net/cnxk/cn9k_ethdev.h +10 -0
index 6384609..9ebf68f 100644
@@ -6,6 +6,16 @@
 
 #include <cnxk_ethdev.h>
 
+struct cn9k_eth_txq {
+	uint64_t cmd[8];
+	int64_t fc_cache_pkts;
+	uint64_t *fc_mem;
+	void *lmt_addr;
+	rte_iova_t io_addr;
+	uint16_t sqes_per_sqb_log2;
+	int16_t nb_sqb_bufs_adj;
+} __plt_cache_aligned;
+
 struct cn9k_eth_rxq {
 	uint64_t mbuf_initializer;
 	uint64_t data_off;
drivers/net/cnxk/cn9k_tx.h new file +13 -0
new file mode 100644
index 0000000..bb6379b
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+#ifndef __CN9K_TX_H__
+#define __CN9K_TX_H__
+
+#define NIX_TX_OFFLOAD_VLAN_QINQ_F    BIT(2)
+#define NIX_TX_OFFLOAD_TSO_F	      BIT(4)
+
+#define NIX_TX_NEED_EXT_HDR                                                    \
+	(NIX_TX_OFFLOAD_VLAN_QINQ_F | NIX_TX_OFFLOAD_TSO_F)
+
+#endif /* __CN9K_TX_H__ */
drivers/net/cnxk/cnxk_ethdev.c +98 -0

110 lines not on this page · raw message

drivers/net/cnxk/cnxk_ethdev.h +3 -0
index e938c64..90c8ff6 100644
@@ -182,6 +182,9 @@ int cnxk_nix_remove(struct rte_pci_device *pci_dev);
 int cnxk_nix_info_get(struct rte_eth_dev *eth_dev,
 		      struct rte_eth_dev_info *dev_info);
 int cnxk_nix_configure(struct rte_eth_dev *eth_dev);
+int cnxk_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
+			    uint16_t nb_desc, uint16_t fp_tx_q_sz,
+			    const struct rte_eth_txconf *tx_conf);
 int cnxk_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 			    uint16_t nb_desc, uint16_t fp_rx_q_sz,
 			    const struct rte_eth_rxconf *rx_conf,
Signature · 1 line
2.8.4
#9 lore raw

PATCH 9/44 net/cnxk: add packet type support

In reply to Nithin Dabilpuram

Add support for packet type lookup on Rx to translate HW specific types to RTE_PTYPE_* defines

---
 doc/guides/nics/cnxk.rst              |   1 +
 doc/guides/nics/features/cnxk.ini     |   1 +
 doc/guides/nics/features/cnxk_vec.ini |   1 +
 doc/guides/nics/features/cnxk_vf.ini  |   1 +
 drivers/net/cnxk/cn10k_ethdev.c       |  21 +++
 drivers/net/cnxk/cn10k_rx.h           |  11 ++
 drivers/net/cnxk/cn9k_ethdev.c        |  21 +++
 drivers/net/cnxk/cn9k_rx.h            |  12 ++
 drivers/net/cnxk/cnxk_ethdev.c        |   2 +
 drivers/net/cnxk/cnxk_ethdev.h        |  14 ++
 drivers/net/cnxk/cnxk_lookup.c        | 326 ++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/meson.build          |   3 +-
 12 files changed, 413 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/cnxk/cn10k_rx.h
 create mode 100644 drivers/net/cnxk/cn9k_rx.h
 create mode 100644 drivers/net/cnxk/cnxk_lookup.c
doc/guides/nics/cnxk.rst +1 -0
index a982450..4f1b58c 100644
@@ -16,6 +16,7 @@ Features
 
 Features of the CNXK Ethdev PMD are:
 
+- Packet type information
 - SR-IOV VF
 - Lock-free Tx queue
 - Multiple queues for TX and RX
doc/guides/nics/features/cnxk.ini +1 -0
index 462d7c4..503582c 100644
@@ -14,6 +14,7 @@ Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
 RSS hash             = Y
 Inner RSS            = Y
+Packet type parsing  = Y
 Linux                = Y
 ARMv8                = Y
 Usage doc            = Y
doc/guides/nics/features/cnxk_vec.ini +1 -0
index 09e0d3a..9ad225a 100644
@@ -14,6 +14,7 @@ Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
 RSS hash             = Y
 Inner RSS            = Y
+Packet type parsing  = Y
 Linux                = Y
 ARMv8                = Y
 Usage doc            = Y
doc/guides/nics/features/cnxk_vf.ini +1 -0
index 4a93a35..8c93ba7 100644
@@ -13,6 +13,7 @@ Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
 RSS hash             = Y
 Inner RSS            = Y
+Packet type parsing  = Y
 Linux                = Y
 ARMv8                = Y
 Usage doc            = Y
drivers/net/cnxk/cn10k_ethdev.c +21 -0
index e194b13..efd5b67 100644
@@ -2,8 +2,25 @@
  * Copyright(C) 2021 Marvell.
  */
 #include "cn10k_ethdev.h"
+#include "cn10k_rx.h"
 #include "cn10k_tx.h"
 
+static int
+cn10k_nix_ptypes_set(struct rte_eth_dev *eth_dev, uint32_t ptype_mask)
+{
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+
+	if (ptype_mask) {
+		dev->rx_offload_flags |= NIX_RX_OFFLOAD_PTYPE_F;
+		dev->ptype_disable = 0;
+	} else {
+		dev->rx_offload_flags &= ~NIX_RX_OFFLOAD_PTYPE_F;
+		dev->ptype_disable = 1;
+	}
+
+	return 0;
+}
+
 static void
 nix_form_default_desc(struct cnxk_eth_dev *dev, struct cn10k_eth_txq *txq,
 		      uint16_t qid)
@@ -113,6 +130,9 @@ cn10k_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 	/* Data offset from data to start of mbuf is first_skip */
 	rxq->data_off = rq->first_skip;
 	rxq->mbuf_initializer = cnxk_nix_rxq_mbuf_setup(dev);
+
+	/* Lookup mem */
+	rxq->lookup_mem = cnxk_nix_fastpath_lookup_mem_get();
 	return 0;
 }
 
@@ -148,6 +168,7 @@ nix_eth_dev_ops_override(void)
 	cnxk_eth_dev_ops.dev_configure = cn10k_nix_configure;
 	cnxk_eth_dev_ops.tx_queue_setup = cn10k_nix_tx_queue_setup;
 	cnxk_eth_dev_ops.rx_queue_setup = cn10k_nix_rx_queue_setup;
+	cnxk_eth_dev_ops.dev_ptypes_set = cn10k_nix_ptypes_set;
 }
 
 static int
drivers/net/cnxk/cn10k_rx.h new file +11 -0
new file mode 100644
index 0000000..d3d1661
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+#ifndef __CN10K_RX_H__
+#define __CN10K_RX_H__
+
+#include <rte_ether.h>
+
+#define NIX_RX_OFFLOAD_PTYPE_F	     BIT(1)
+
+#endif /* __CN10K_RX_H__ */
drivers/net/cnxk/cn9k_ethdev.c +21 -0
index e97ce15..3f3de4f 100644
@@ -2,8 +2,25 @@
  * Copyright(C) 2021 Marvell.
  */
 #include "cn9k_ethdev.h"
+#include "cn9k_rx.h"
 #include "cn9k_tx.h"
 
+static int
+cn9k_nix_ptypes_set(struct rte_eth_dev *eth_dev, uint32_t ptype_mask)
+{
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+
+	if (ptype_mask) {
+		dev->rx_offload_flags |= NIX_RX_OFFLOAD_PTYPE_F;
+		dev->ptype_disable = 0;
+	} else {
+		dev->rx_offload_flags &= ~NIX_RX_OFFLOAD_PTYPE_F;
+		dev->ptype_disable = 1;
+	}
+
+	return 0;
+}
+
 static void
 nix_form_default_desc(struct cnxk_eth_dev *dev, struct cn9k_eth_txq *txq,
 		      uint16_t qid)
@@ -111,6 +128,9 @@ cn9k_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 	/* Data offset from data to start of mbuf is first_skip */
 	rxq->data_off = rq->first_skip;
 	rxq->mbuf_initializer = cnxk_nix_rxq_mbuf_setup(dev);
+
+	/* Lookup mem */
+	rxq->lookup_mem = cnxk_nix_fastpath_lookup_mem_get();
 	return 0;
 }
 
@@ -157,6 +177,7 @@ nix_eth_dev_ops_override(void)
 	cnxk_eth_dev_ops.dev_configure = cn9k_nix_configure;
 	cnxk_eth_dev_ops.tx_queue_setup = cn9k_nix_tx_queue_setup;
 	cnxk_eth_dev_ops.rx_queue_setup = cn9k_nix_rx_queue_setup;
+	cnxk_eth_dev_ops.dev_ptypes_set = cn9k_nix_ptypes_set;
 }
 
 static int
drivers/net/cnxk/cn9k_rx.h new file +12 -0
new file mode 100644
index 0000000..95a1e69
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+
+#ifndef __CN9K_RX_H__
+#define __CN9K_RX_H__
+
+#include <rte_ether.h>
+
+#define NIX_RX_OFFLOAD_PTYPE_F	     BIT(1)
+
+#endif /* __CN9K_RX_H__ */
drivers/net/cnxk/cnxk_ethdev.c +2 -0
index 5772345..96acf90 100644
@@ -825,6 +825,7 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
 	.link_update = cnxk_nix_link_update,
 	.tx_queue_release = cnxk_nix_tx_queue_release,
 	.rx_queue_release = cnxk_nix_rx_queue_release,
+	.dev_supported_ptypes_get = cnxk_nix_supported_ptypes_get,
 };
 
 static int
@@ -865,6 +866,7 @@ cnxk_eth_dev_init(struct rte_eth_dev *eth_dev)
 
 	dev->eth_dev = eth_dev;
 	dev->configured = 0;
+	dev->ptype_disable = 0;
 
 	/* For vfs, returned max_entries will be 0. but to keep default mac
 	 * address, one entry must be allocated. so setting up to 1.
drivers/net/cnxk/cnxk_ethdev.h +14 -0
index 90c8ff6..6b7261c 100644
@@ -91,6 +91,15 @@
 #define RSS_SCTP_INDEX 4
 #define RSS_DMAC_INDEX 5
 
+#define PTYPE_NON_TUNNEL_WIDTH	  16
+#define PTYPE_TUNNEL_WIDTH	  12
+#define PTYPE_NON_TUNNEL_ARRAY_SZ BIT(PTYPE_NON_TUNNEL_WIDTH)
+#define PTYPE_TUNNEL_ARRAY_SZ	  BIT(PTYPE_TUNNEL_WIDTH)
+#define PTYPE_ARRAY_SZ                                                         \
+	((PTYPE_NON_TUNNEL_ARRAY_SZ + PTYPE_TUNNEL_ARRAY_SZ) * sizeof(uint16_t))
+/* Fastpath lookup */
+#define CNXK_NIX_FASTPATH_LOOKUP_MEM "cnxk_nix_fastpath_lookup_mem"
+
 struct cnxk_eth_qconf {
 	union {
 		struct rte_eth_txconf tx;
@@ -119,6 +128,7 @@ struct cnxk_eth_dev {
 	uint8_t max_mac_entries;
 
 	uint16_t flags;
+	uint8_t ptype_disable;
 	bool scalar_ena;
 
 	/* Pointer back to rte */
@@ -201,6 +211,10 @@ void cnxk_eth_dev_link_status_cb(struct roc_nix *nix,
 				 struct roc_nix_link_info *link);
 int cnxk_nix_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete);
 
+/* Lookup configuration */
+const uint32_t *cnxk_nix_supported_ptypes_get(struct rte_eth_dev *eth_dev);
+void *cnxk_nix_fastpath_lookup_mem_get(void);
+
 /* Devargs */
 int cnxk_ethdev_parse_devargs(struct rte_devargs *devargs,
 			      struct cnxk_eth_dev *dev);
drivers/net/cnxk/cnxk_lookup.c new file +326 -0

326 lines not on this page · raw message

drivers/net/cnxk/meson.build +2 -1
index c0ec91a..b6b6989 100644
@@ -11,7 +11,8 @@ endif
 sources = files('cnxk_ethdev.c',
 		'cnxk_ethdev_ops.c',
 		'cnxk_ethdev_devargs.c',
-		'cnxk_link.c')
+		'cnxk_link.c',
+		'cnxk_lookup.c')
 
 # CN9K
 sources += files('cn9k_ethdev.c')
Signature · 1 line
2.8.4
#10 lore raw

PATCH 10/44 net/cnxk: add queue start and stop support

In reply to Nithin Dabilpuram

Add Rx/Tx queue start and stop callbacks for
CN9K and CN10K.

---
 doc/guides/nics/features/cnxk.ini     |  1 +
 doc/guides/nics/features/cnxk_vec.ini |  1 +
 doc/guides/nics/features/cnxk_vf.ini  |  1 +
 drivers/net/cnxk/cn10k_ethdev.c       | 16 ++++++
 drivers/net/cnxk/cn9k_ethdev.c        | 16 ++++++
 drivers/net/cnxk/cnxk_ethdev.c        | 92 +++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cnxk_ethdev.h        |  1 +
 7 files changed, 128 insertions(+)
doc/guides/nics/features/cnxk.ini +1 -0
index 503582c..712f8d5 100644
@@ -12,6 +12,7 @@ Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
+Queue start/stop     = Y
 RSS hash             = Y
 Inner RSS            = Y
 Packet type parsing  = Y
doc/guides/nics/features/cnxk_vec.ini +1 -0
index 9ad225a..82f2af0 100644
@@ -12,6 +12,7 @@ Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
+Queue start/stop     = Y
 RSS hash             = Y
 Inner RSS            = Y
 Packet type parsing  = Y
doc/guides/nics/features/cnxk_vf.ini +1 -0
index 8c93ba7..61fed11 100644
@@ -11,6 +11,7 @@ Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
+Queue start/stop     = Y
 RSS hash             = Y
 Inner RSS            = Y
 Packet type parsing  = Y
drivers/net/cnxk/cn10k_ethdev.c +16 -0
index efd5b67..1a9fcbb 100644
@@ -137,6 +137,21 @@ cn10k_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 }
 
 static int
+cn10k_nix_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t qidx)
+{
+	struct cn10k_eth_txq *txq = eth_dev->data->tx_queues[qidx];
+	int rc;
+
+	rc = cnxk_nix_tx_queue_stop(eth_dev, qidx);
+	if (rc)
+		return rc;
+
+	/* Clear fc cache pkts to trigger worker stop */
+	txq->fc_cache_pkts = 0;
+	return 0;
+}
+
+static int
 cn10k_nix_configure(struct rte_eth_dev *eth_dev)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
@@ -168,6 +183,7 @@ nix_eth_dev_ops_override(void)
 	cnxk_eth_dev_ops.dev_configure = cn10k_nix_configure;
 	cnxk_eth_dev_ops.tx_queue_setup = cn10k_nix_tx_queue_setup;
 	cnxk_eth_dev_ops.rx_queue_setup = cn10k_nix_rx_queue_setup;
+	cnxk_eth_dev_ops.tx_queue_stop = cn10k_nix_tx_queue_stop;
 	cnxk_eth_dev_ops.dev_ptypes_set = cn10k_nix_ptypes_set;
 }
 
drivers/net/cnxk/cn9k_ethdev.c +16 -0
index 3f3de4f..3561632 100644
@@ -135,6 +135,21 @@ cn9k_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 }
 
 static int
+cn9k_nix_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t qidx)
+{
+	struct cn9k_eth_txq *txq = eth_dev->data->tx_queues[qidx];
+	int rc;
+
+	rc = cnxk_nix_tx_queue_stop(eth_dev, qidx);
+	if (rc)
+		return rc;
+
+	/* Clear fc cache pkts to trigger worker stop */
+	txq->fc_cache_pkts = 0;
+	return 0;
+}
+
+static int
 cn9k_nix_configure(struct rte_eth_dev *eth_dev)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
@@ -177,6 +192,7 @@ nix_eth_dev_ops_override(void)
 	cnxk_eth_dev_ops.dev_configure = cn9k_nix_configure;
 	cnxk_eth_dev_ops.tx_queue_setup = cn9k_nix_tx_queue_setup;
 	cnxk_eth_dev_ops.rx_queue_setup = cn9k_nix_rx_queue_setup;
+	cnxk_eth_dev_ops.tx_queue_stop = cn9k_nix_tx_queue_stop;
 	cnxk_eth_dev_ops.dev_ptypes_set = cn9k_nix_ptypes_set;
 }
 
drivers/net/cnxk/cnxk_ethdev.c +92 -0

104 lines not on this page · raw message

drivers/net/cnxk/cnxk_ethdev.h +1 -0
index 6b7261c..7e79a8d 100644
@@ -199,6 +199,7 @@ int cnxk_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 			    uint16_t nb_desc, uint16_t fp_rx_q_sz,
 			    const struct rte_eth_rxconf *rx_conf,
 			    struct rte_mempool *mp);
+int cnxk_nix_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t qid);
 
 uint64_t cnxk_nix_rxq_mbuf_setup(struct cnxk_eth_dev *dev);
 
Signature · 1 line
2.8.4
#11 lore raw

PATCH 11/44 net/cnxk: add Rx support for cn9k

In reply to Nithin Dabilpuram

From: Jerin Jacob <[email protected]>

Add Rx burst scalar version for CN9K.

---
 drivers/net/cnxk/cn9k_ethdev.h |   3 +
 drivers/net/cnxk/cn9k_rx.c     | 124 +++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cn9k_rx.h     | 152 +++++++++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cnxk_ethdev.h |   3 +
 drivers/net/cnxk/meson.build   |   3 +-
 5 files changed, 284 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/cnxk/cn9k_rx.c
drivers/net/cnxk/cn9k_ethdev.h +3 -0
index 9ebf68f..84dcc2c 100644
@@ -30,4 +30,7 @@ struct cn9k_eth_rxq {
 	uint16_t rq;
 } __plt_cache_aligned;
 
+/* Rx and Tx routines */
+void cn9k_eth_set_rx_function(struct rte_eth_dev *eth_dev);
+
 #endif /* __CN9K_ETHDEV_H__ */
drivers/net/cnxk/cn9k_rx.c new file +124 -0

124 lines not on this page · raw message

drivers/net/cnxk/cn9k_rx.h +152 -0

158 lines not on this page · raw message

drivers/net/cnxk/cnxk_ethdev.h +3 -0
index 7e79a8d..58c6710 100644
@@ -91,6 +91,9 @@
 #define RSS_SCTP_INDEX 4
 #define RSS_DMAC_INDEX 5
 
+/* Default mark value used when none is provided. */
+#define CNXK_FLOW_ACTION_FLAG_DEFAULT 0xffff
+
 #define PTYPE_NON_TUNNEL_WIDTH	  16
 #define PTYPE_TUNNEL_WIDTH	  12
 #define PTYPE_NON_TUNNEL_ARRAY_SZ BIT(PTYPE_NON_TUNNEL_WIDTH)
drivers/net/cnxk/meson.build +2 -1
index b6b6989..c2bfd94 100644
@@ -15,7 +15,8 @@ sources = files('cnxk_ethdev.c',
 		'cnxk_lookup.c')
 
 # CN9K
-sources += files('cn9k_ethdev.c')
+sources += files('cn9k_ethdev.c',
+		 'cn9k_rx.c')
 # CN10K
 sources += files('cn10k_ethdev.c')
 
Signature · 1 line
2.8.4
#12 lore raw

PATCH 12/44 net/cnxk: add Rx multi-segmented version for cn9k

In reply to Nithin Dabilpuram

Add Rx burst multi-segmented version for CN9K.

---
 drivers/net/cnxk/cn9k_rx.c     | 26 ++++++++++++++++++++
 drivers/net/cnxk/cn9k_rx.h     | 55 ++++++++++++++++++++++++++++++++++++++++--
 drivers/net/cnxk/cnxk_ethdev.h |  3 +++
 3 files changed, 82 insertions(+), 2 deletions(-)
drivers/net/cnxk/cn9k_rx.c +26 -0
index 1c05cf3..5535735 100644
@@ -88,6 +88,15 @@ nix_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts,
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
 		return nix_recv_pkts(rx_queue, rx_pkts, pkts, (flags));        \
+	}                                                                      \
+									       \
+	static uint16_t __rte_noinline __rte_hot                               \
+		cn9k_nix_recv_pkts_mseg_##name(void *rx_queue,                 \
+					       struct rte_mbuf **rx_pkts,      \
+					       uint16_t pkts)                  \
+	{                                                                      \
+		return nix_recv_pkts(rx_queue, rx_pkts, pkts,                  \
+				     (flags) | NIX_RX_MULTI_SEG_F);            \
 	}
 
 NIX_RX_FASTPATH_MODES
@@ -110,6 +119,8 @@ pick_rx_func(struct rte_eth_dev *eth_dev,
 void
 cn9k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
 {
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+
 	const eth_rx_burst_t nix_eth_rx_burst[2][2][2][2] = {
 #define R(name, f3, f2, f1, f0, flags)					\
 	[f3][f2][f1][f0] = cn9k_nix_recv_pkts_##name,
@@ -118,7 +129,22 @@ cn9k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
 #undef R
 	};
 
+	const eth_rx_burst_t nix_eth_rx_burst_mseg[2][2][2][2] = {
+#define R(name, f3, f2, f1, f0, flags)					\
+	[f3][f2][f1][f0] = cn9k_nix_recv_pkts_mseg_##name,
+
+		NIX_RX_FASTPATH_MODES
+#undef R
+	};
+
 	pick_rx_func(eth_dev, nix_eth_rx_burst);
 
+	if (dev->rx_offloads & DEV_RX_OFFLOAD_SCATTER)
+		pick_rx_func(eth_dev, nix_eth_rx_burst_mseg);
+
+	/* Copy multi seg version with no offload for tear down sequence */
+	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
+		dev->rx_pkt_burst_no_offload =
+			nix_eth_rx_burst_mseg[0][0][0][0];
 	rte_mb();
 }
drivers/net/cnxk/cn9k_rx.h +53 -2

67 lines not on this page · raw message

drivers/net/cnxk/cnxk_ethdev.h +3 -0
index 58c6710..a94f5eb 100644
@@ -163,6 +163,9 @@ struct cnxk_eth_dev {
 	struct cnxk_eth_qconf *tx_qconf;
 	struct cnxk_eth_qconf *rx_qconf;
 
+	/* Rx burst for cleanup(Only Primary) */
+	eth_rx_burst_t rx_pkt_burst_no_offload;
+
 	/* Default mac address */
 	uint8_t mac_addr[RTE_ETHER_ADDR_LEN];
 };
Signature · 1 line
2.8.4
#13 lore raw

PATCH 13/44 net/cnxk: add Rx vector version for cn9k

In reply to Nithin Dabilpuram

From: Jerin Jacob <[email protected]>

Add Rx burst vector version for CN9K.

---
 drivers/net/cnxk/cn9k_rx.c | 240 ++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 239 insertions(+), 1 deletion(-)
drivers/net/cnxk/cn9k_rx.c +239 -1
index 5535735..391f1e2 100644
@@ -2,6 +2,8 @@
  * Copyright(C) 2021 Marvell.
  */
 
+#include <rte_vect.h>
+
 #include "cn9k_ethdev.h"
 #include "cn9k_rx.h"
 
@@ -83,6 +85,223 @@ nix_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts,
 	return nb_pkts;
 }
 
+#if defined(RTE_ARCH_ARM64)
+
+static __rte_always_inline uint16_t
+nix_recv_pkts_vector(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts,
+		     const uint16_t flags)
+{
+	struct cn9k_eth_rxq *rxq = rx_queue;
+	uint16_t packets = 0;
+	uint64x2_t cq0_w8, cq1_w8, cq2_w8, cq3_w8, mbuf01, mbuf23;
+	const uint64_t mbuf_initializer = rxq->mbuf_initializer;
+	const uint64x2_t data_off = vdupq_n_u64(rxq->data_off);
+	uint64_t ol_flags0, ol_flags1, ol_flags2, ol_flags3;
+	uint64x2_t rearm0 = vdupq_n_u64(mbuf_initializer);
+	uint64x2_t rearm1 = vdupq_n_u64(mbuf_initializer);
+	uint64x2_t rearm2 = vdupq_n_u64(mbuf_initializer);
+	uint64x2_t rearm3 = vdupq_n_u64(mbuf_initializer);
+	struct rte_mbuf *mbuf0, *mbuf1, *mbuf2, *mbuf3;
+	const uint16_t *lookup_mem = rxq->lookup_mem;
+	const uint32_t qmask = rxq->qmask;
+	const uint64_t wdata = rxq->wdata;
+	const uintptr_t desc = rxq->desc;
+	uint8x16_t f0, f1, f2, f3;
+	uint32_t head = rxq->head;
+	uint16_t pkts_left;
+
+	pkts = nix_rx_nb_pkts(rxq, wdata, pkts, qmask);
+	pkts_left = pkts & (NIX_DESCS_PER_LOOP - 1);
+
+	/* Packets has to be floor-aligned to NIX_DESCS_PER_LOOP */
+	pkts = RTE_ALIGN_FLOOR(pkts, NIX_DESCS_PER_LOOP);
+
+	while (packets < pkts) {
+		/* Exit loop if head is about to wrap and become unaligned */
+		if (((head + NIX_DESCS_PER_LOOP - 1) & qmask) <
+		    NIX_DESCS_PER_LOOP) {
+			pkts_left += (pkts - packets);
+			break;
+		}
+
+		const uintptr_t cq0 = desc + CQE_SZ(head);
+
+		/* Prefetch N desc ahead */
+		rte_prefetch_non_temporal((void *)(cq0 + CQE_SZ(8)));
+		rte_prefetch_non_temporal((void *)(cq0 + CQE_SZ(9)));
+		rte_prefetch_non_temporal((void *)(cq0 + CQE_SZ(10)));
+		rte_prefetch_non_temporal((void *)(cq0 + CQE_SZ(11)));
+
+		/* Get NIX_RX_SG_S for size and buffer pointer */
+		cq0_w8 = vld1q_u64((uint64_t *)(cq0 + CQE_SZ(0) + 64));
+		cq1_w8 = vld1q_u64((uint64_t *)(cq0 + CQE_SZ(1) + 64));
+		cq2_w8 = vld1q_u64((uint64_t *)(cq0 + CQE_SZ(2) + 64));
+		cq3_w8 = vld1q_u64((uint64_t *)(cq0 + CQE_SZ(3) + 64));
+
+		/* Extract mbuf from NIX_RX_SG_S */
+		mbuf01 = vzip2q_u64(cq0_w8, cq1_w8);
+		mbuf23 = vzip2q_u64(cq2_w8, cq3_w8);
+		mbuf01 = vqsubq_u64(mbuf01, data_off);
+		mbuf23 = vqsubq_u64(mbuf23, data_off);
+
+		/* Move mbufs to scalar registers for future use */
+		mbuf0 = (struct rte_mbuf *)vgetq_lane_u64(mbuf01, 0);
+		mbuf1 = (struct rte_mbuf *)vgetq_lane_u64(mbuf01, 1);
+		mbuf2 = (struct rte_mbuf *)vgetq_lane_u64(mbuf23, 0);
+		mbuf3 = (struct rte_mbuf *)vgetq_lane_u64(mbuf23, 1);
+
+		/* Mask to get packet len from NIX_RX_SG_S */
+		const uint8x16_t shuf_msk = {
+			0xFF, 0xFF, /* pkt_type set as unknown */
+			0xFF, 0xFF, /* pkt_type set as unknown */
+			0,    1,    /* octet 1~0, low 16 bits pkt_len */
+			0xFF, 0xFF, /* skip high 16 bits pkt_len, zero out */
+			0,    1,    /* octet 1~0, 16 bits data_len */
+			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
+
+		/* Form the rx_descriptor_fields1 with pkt_len and data_len */
+		f0 = vqtbl1q_u8(cq0_w8, shuf_msk);
+		f1 = vqtbl1q_u8(cq1_w8, shuf_msk);
+		f2 = vqtbl1q_u8(cq2_w8, shuf_msk);
+		f3 = vqtbl1q_u8(cq3_w8, shuf_msk);
+
+		/* Load CQE word0 and word 1 */
+		uint64_t cq0_w0 = ((uint64_t *)(cq0 + CQE_SZ(0)))[0];
+		uint64_t cq0_w1 = ((uint64_t *)(cq0 + CQE_SZ(0)))[1];
+		uint64_t cq1_w0 = ((uint64_t *)(cq0 + CQE_SZ(1)))[0];
+		uint64_t cq1_w1 = ((uint64_t *)(cq0 + CQE_SZ(1)))[1];
+		uint64_t cq2_w0 = ((uint64_t *)(cq0 + CQE_SZ(2)))[0];
+		uint64_t cq2_w1 = ((uint64_t *)(cq0 + CQE_SZ(2)))[1];
+		uint64_t cq3_w0 = ((uint64_t *)(cq0 + CQE_SZ(3)))[0];
+		uint64_t cq3_w1 = ((uint64_t *)(cq0 + CQE_SZ(3)))[1];
+
+		if (flags & NIX_RX_OFFLOAD_RSS_F) {
+			/* Fill rss in the rx_descriptor_fields1 */
+			f0 = vsetq_lane_u32(cq0_w0, f0, 3);
+			f1 = vsetq_lane_u32(cq1_w0, f1, 3);
+			f2 = vsetq_lane_u32(cq2_w0, f2, 3);
+			f3 = vsetq_lane_u32(cq3_w0, f3, 3);
+			ol_flags0 = PKT_RX_RSS_HASH;
+			ol_flags1 = PKT_RX_RSS_HASH;
+			ol_flags2 = PKT_RX_RSS_HASH;
+			ol_flags3 = PKT_RX_RSS_HASH;
+		} else {
+			ol_flags0 = 0;
+			ol_flags1 = 0;
+			ol_flags2 = 0;
+			ol_flags3 = 0;
+		}
+
+		if (flags & NIX_RX_OFFLOAD_PTYPE_F) {
+			/* Fill packet_type in the rx_descriptor_fields1 */
+			f0 = vsetq_lane_u32(nix_ptype_get(lookup_mem, cq0_w1),
+					    f0, 0);
+			f1 = vsetq_lane_u32(nix_ptype_get(lookup_mem, cq1_w1),
+					    f1, 0);
+			f2 = vsetq_lane_u32(nix_ptype_get(lookup_mem, cq2_w1),
+					    f2, 0);
+			f3 = vsetq_lane_u32(nix_ptype_get(lookup_mem, cq3_w1),
+					    f3, 0);
+		}
+
+		if (flags & NIX_RX_OFFLOAD_CHECKSUM_F) {
+			ol_flags0 |= nix_rx_olflags_get(lookup_mem, cq0_w1);
+			ol_flags1 |= nix_rx_olflags_get(lookup_mem, cq1_w1);
+			ol_flags2 |= nix_rx_olflags_get(lookup_mem, cq2_w1);
+			ol_flags3 |= nix_rx_olflags_get(lookup_mem, cq3_w1);
+		}
+
+		if (flags & NIX_RX_OFFLOAD_MARK_UPDATE_F) {
+			ol_flags0 = nix_update_match_id(
+				*(uint16_t *)(cq0 + CQE_SZ(0) + 38), ol_flags0,
+				mbuf0);
+			ol_flags1 = nix_update_match_id(
+				*(uint16_t *)(cq0 + CQE_SZ(1) + 38), ol_flags1,
+				mbuf1);
+			ol_flags2 = nix_update_match_id(
+				*(uint16_t *)(cq0 + CQE_SZ(2) + 38), ol_flags2,
+				mbuf2);
+			ol_flags3 = nix_update_match_id(
+				*(uint16_t *)(cq0 + CQE_SZ(3) + 38), ol_flags3,
+				mbuf3);
+		}
+
+		/* Form rearm_data with ol_flags */
+		rearm0 = vsetq_lane_u64(ol_flags0, rearm0, 1);
+		rearm1 = vsetq_lane_u64(ol_flags1, rearm1, 1);
+		rearm2 = vsetq_lane_u64(ol_flags2, rearm2, 1);
+		rearm3 = vsetq_lane_u64(ol_flags3, rearm3, 1);
+
+		/* Update rx_descriptor_fields1 */
+		vst1q_u64((uint64_t *)mbuf0->rx_descriptor_fields1, f0);
+		vst1q_u64((uint64_t *)mbuf1->rx_descriptor_fields1, f1);
+		vst1q_u64((uint64_t *)mbuf2->rx_descriptor_fields1, f2);
+		vst1q_u64((uint64_t *)mbuf3->rx_descriptor_fields1, f3);
+
+		/* Update rearm_data */
+		vst1q_u64((uint64_t *)mbuf0->rearm_data, rearm0);
+		vst1q_u64((uint64_t *)mbuf1->rearm_data, rearm1);
+		vst1q_u64((uint64_t *)mbuf2->rearm_data, rearm2);
+		vst1q_u64((uint64_t *)mbuf3->rearm_data, rearm3);
+
+		/* Update that no more segments */
+		mbuf0->next = NULL;
+		mbuf1->next = NULL;
+		mbuf2->next = NULL;
+		mbuf3->next = NULL;
+
+		/* Store the mbufs to rx_pkts */
+		vst1q_u64((uint64_t *)&rx_pkts[packets], mbuf01);
+		vst1q_u64((uint64_t *)&rx_pkts[packets + 2], mbuf23);
+
+		/* Prefetch mbufs */
+		roc_prefetch_store_keep(mbuf0);
+		roc_prefetch_store_keep(mbuf1);
+		roc_prefetch_store_keep(mbuf2);
+		roc_prefetch_store_keep(mbuf3);
+
+		/* Mark mempool obj as "get" as it is alloc'ed by NIX */
+		__mempool_check_cookies(mbuf0->pool, (void **)&mbuf0, 1, 1);
+		__mempool_check_cookies(mbuf1->pool, (void **)&mbuf1, 1, 1);
+		__mempool_check_cookies(mbuf2->pool, (void **)&mbuf2, 1, 1);
+		__mempool_check_cookies(mbuf3->pool, (void **)&mbuf3, 1, 1);
+
+		/* Advance head pointer and packets */
+		head += NIX_DESCS_PER_LOOP;
+		head &= qmask;
+		packets += NIX_DESCS_PER_LOOP;
+	}
+
+	rxq->head = head;
+	rxq->available -= packets;
+
+	rte_io_wmb();
+	/* Free all the CQs that we've processed */
+	plt_write64((rxq->wdata | packets), rxq->cq_door);
+
+	if (unlikely(pkts_left))
+		packets += nix_recv_pkts(rx_queue, &rx_pkts[packets], pkts_left,
+					 flags);
+
+	return packets;
+}
+
+#else
+
+static inline uint16_t
+nix_recv_pkts_vector(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts,
+		     const uint16_t flags)
+{
+	RTE_SET_USED(rx_queue);
+	RTE_SET_USED(rx_pkts);
+	RTE_SET_USED(pkts);
+	RTE_SET_USED(flags);
+
+	return 0;
+}
+
+#endif
+
 #define R(name, f3, f2, f1, f0, flags)					       \
 	static uint16_t __rte_noinline __rte_hot cn9k_nix_recv_pkts_##name(    \
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
@@ -97,6 +316,14 @@ nix_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts,
 	{                                                                      \
 		return nix_recv_pkts(rx_queue, rx_pkts, pkts,                  \
 				     (flags) | NIX_RX_MULTI_SEG_F);            \
+	}                                                                      \
+									       \
+	static uint16_t __rte_noinline __rte_hot                               \
+		cn9k_nix_recv_pkts_vec_##name(void *rx_queue,                  \
+					      struct rte_mbuf **rx_pkts,       \
+					      uint16_t pkts)                   \
+	{                                                                      \
+		return nix_recv_pkts_vector(rx_queue, rx_pkts, pkts, (flags)); \
 	}
 
 NIX_RX_FASTPATH_MODES
@@ -137,7 +364,18 @@ cn9k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
 #undef R
 	};
 
-	pick_rx_func(eth_dev, nix_eth_rx_burst);
+	const eth_rx_burst_t nix_eth_rx_vec_burst[2][2][2][2] = {
+#define R(name, f3, f2, f1, f0, flags)					\
+	[f3][f2][f1][f0] = cn9k_nix_recv_pkts_vec_##name,
+
+		NIX_RX_FASTPATH_MODES
+#undef R
+	};
+
+	if (dev->scalar_ena)
+		pick_rx_func(eth_dev, nix_eth_rx_burst);
+	else
+		pick_rx_func(eth_dev, nix_eth_rx_vec_burst);
 
 	if (dev->rx_offloads & DEV_RX_OFFLOAD_SCATTER)
 		pick_rx_func(eth_dev, nix_eth_rx_burst_mseg);
Signature · 1 line
2.8.4
#14 lore raw

PATCH 14/44 net/cnxk: add Tx support for cn9k

In reply to Nithin Dabilpuram

From: Jerin Jacob <[email protected]>

Add Tx burst scalar version for CN9K.

---
 drivers/net/cnxk/cn9k_ethdev.h |   1 +
 drivers/net/cnxk/cn9k_tx.c     | 103 ++++++++++++
 drivers/net/cnxk/cn9k_tx.h     | 357 +++++++++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cnxk_ethdev.h |  71 ++++++++
 drivers/net/cnxk/meson.build   |   3 +-
 5 files changed, 534 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/cnxk/cn9k_tx.c
drivers/net/cnxk/cn9k_ethdev.h +1 -0
index 84dcc2c..cd0938f 100644
@@ -32,5 +32,6 @@ struct cn9k_eth_rxq {
 
 /* Rx and Tx routines */
 void cn9k_eth_set_rx_function(struct rte_eth_dev *eth_dev);
+void cn9k_eth_set_tx_function(struct rte_eth_dev *eth_dev);
 
 #endif /* __CN9K_ETHDEV_H__ */
drivers/net/cnxk/cn9k_tx.c new file +103 -0

103 lines not on this page · raw message

drivers/net/cnxk/cn9k_tx.h +357 -0

367 lines not on this page · raw message

drivers/net/cnxk/cnxk_ethdev.h +71 -0

81 lines not on this page · raw message

drivers/net/cnxk/meson.build +2 -1
index c2bfd94..d152f08 100644
@@ -16,7 +16,8 @@ sources = files('cnxk_ethdev.c',
 
 # CN9K
 sources += files('cn9k_ethdev.c',
-		 'cn9k_rx.c')
+		 'cn9k_rx.c',
+		 'cn9k_tx.c')
 # CN10K
 sources += files('cn10k_ethdev.c')
 
Signature · 1 line
2.8.4
#15 lore raw

PATCH 15/44 net/cnxk: add Tx multi-segment version for cn9k

In reply to Nithin Dabilpuram

Add Tx burst multi-segment version for CN9K.

---
 drivers/net/cnxk/cn9k_tx.c     |  70 +++++++++++++++++++++++++++
 drivers/net/cnxk/cn9k_tx.h     | 105 +++++++++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cnxk_ethdev.h |   4 ++
 3 files changed, 179 insertions(+)
drivers/net/cnxk/cn9k_tx.c +70 -0
index 06e9618..a474eb5 100644
@@ -55,6 +55,44 @@ nix_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t pkts,
 	return pkts;
 }
 
+static __rte_always_inline uint16_t
+nix_xmit_pkts_mseg(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t pkts,
+		   uint64_t *cmd, const uint16_t flags)
+{
+	struct cn9k_eth_txq *txq = tx_queue;
+	uint64_t i;
+	const rte_iova_t io_addr = txq->io_addr;
+	void *lmt_addr = txq->lmt_addr;
+	uint16_t segdw;
+
+	NIX_XMIT_FC_OR_RETURN(txq, pkts);
+
+	roc_lmt_mov(cmd, &txq->cmd[0], cn9k_nix_tx_ext_subs(flags));
+
+	/* Perform header writes before barrier for TSO */
+	if (flags & NIX_TX_OFFLOAD_TSO_F) {
+		for (i = 0; i < pkts; i++)
+			cn9k_nix_xmit_prepare_tso(tx_pkts[i], flags);
+	}
+
+	/* Lets commit any changes in the packet here as no further changes
+	 * to the packet will be done unless no fast free is enabled.
+	 */
+	if (!(flags & NIX_TX_OFFLOAD_MBUF_NOFF_F))
+		rte_io_wmb();
+
+	for (i = 0; i < pkts; i++) {
+		cn9k_nix_xmit_prepare(tx_pkts[i], cmd, flags);
+		segdw = cn9k_nix_prepare_mseg(tx_pkts[i], cmd, flags);
+		cn9k_nix_xmit_mseg_one(cmd, lmt_addr, io_addr, segdw);
+	}
+
+	/* Reduce the cached count */
+	txq->fc_cache_pkts -= pkts;
+
+	return pkts;
+}
+
 #define T(name, f4, f3, f2, f1, f0, sz, flags)				       \
 	static uint16_t __rte_noinline __rte_hot cn9k_nix_xmit_pkts_##name(    \
 		void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t pkts)      \
@@ -71,6 +109,25 @@ nix_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t pkts,
 NIX_TX_FASTPATH_MODES
 #undef T
 
+#define T(name, f4, f3, f2, f1, f0, sz, flags)				       \
+	static uint16_t __rte_noinline __rte_hot                               \
+		cn9k_nix_xmit_pkts_mseg_##name(void *tx_queue,                 \
+					       struct rte_mbuf **tx_pkts,      \
+					       uint16_t pkts)                  \
+	{                                                                      \
+		uint64_t cmd[(sz) + CNXK_NIX_TX_MSEG_SG_DWORDS - 2];           \
+									       \
+		/* For TSO inner checksum is a must */                         \
+		if (((flags) & NIX_TX_OFFLOAD_TSO_F) &&			       \
+		    !((flags) & NIX_TX_OFFLOAD_L3_L4_CSUM_F))		       \
+			return 0;                                              \
+		return nix_xmit_pkts_mseg(tx_queue, tx_pkts, pkts, cmd,        \
+					  (flags) | NIX_TX_MULTI_SEG_F);       \
+	}
+
+NIX_TX_FASTPATH_MODES
+#undef T
+
 static inline void
 pick_tx_func(struct rte_eth_dev *eth_dev,
 	     const eth_tx_burst_t tx_burst[2][2][2][2][2])
@@ -89,6 +146,8 @@ pick_tx_func(struct rte_eth_dev *eth_dev,
 void
 cn9k_eth_set_tx_function(struct rte_eth_dev *eth_dev)
 {
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+
 	const eth_tx_burst_t nix_eth_tx_burst[2][2][2][2][2] = {
 #define T(name, f4, f3, f2, f1, f0, sz, flags)					\
 	[f4][f3][f2][f1][f0] = cn9k_nix_xmit_pkts_##name,
@@ -97,7 +156,18 @@ cn9k_eth_set_tx_function(struct rte_eth_dev *eth_dev)
 #undef T
 	};
 
+	const eth_tx_burst_t nix_eth_tx_burst_mseg[2][2][2][2][2] = {
+#define T(name, f4, f3, f2, f1, f0, sz, flags)					\
+	[f4][f3][f2][f1][f0] = cn9k_nix_xmit_pkts_mseg_##name,
+
+		NIX_TX_FASTPATH_MODES
+#undef T
+	};
+
 	pick_tx_func(eth_dev, nix_eth_tx_burst);
 
+	if (dev->tx_offloads & DEV_TX_OFFLOAD_MULTI_SEGS)
+		pick_tx_func(eth_dev, nix_eth_tx_burst_mseg);
+
 	rte_mb();
 }
drivers/net/cnxk/cn9k_tx.h +105 -0

111 lines not on this page · raw message

drivers/net/cnxk/cnxk_ethdev.h +4 -0
index 8facafc..2f31cba 100644
@@ -46,6 +46,10 @@
 #define CNXK_NIX_TX_NB_SEG_MAX 9
 #endif
 
+#define CNXK_NIX_TX_MSEG_SG_DWORDS                                             \
+	((RTE_ALIGN_MUL_CEIL(CNXK_NIX_TX_NB_SEG_MAX, 3) / 3) +                 \
+	 CNXK_NIX_TX_NB_SEG_MAX)
+
 #define CNXK_NIX_RSS_L3_L4_SRC_DST                                             \
 	(ETH_RSS_L3_SRC_ONLY | ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_SRC_ONLY |     \
 	 ETH_RSS_L4_DST_ONLY)
Signature · 1 line
2.8.4
#16 lore raw

PATCH 16/44 net/cnxk: add Tx vector version for cn9k

In reply to Nithin Dabilpuram

Add Tx burst vector version for CN9K.

---
 drivers/net/cnxk/cn9k_tx.c | 951 ++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 950 insertions(+), 1 deletion(-)
drivers/net/cnxk/cn9k_tx.c +950 -1
index a474eb5..300ccd2 100644
@@ -2,6 +2,8 @@
  * Copyright(C) 2021 Marvell.
  */
 
+#include <rte_vect.h>
+
 #include "cn9k_ethdev.h"
 #include "cn9k_tx.h"
 
@@ -93,6 +95,921 @@ nix_xmit_pkts_mseg(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t pkts,
 	return pkts;
 }
 
+#if defined(RTE_ARCH_ARM64)
+
+#define NIX_DESCS_PER_LOOP 4
+static __rte_always_inline uint16_t
+nix_xmit_pkts_vector(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t pkts,
+		     uint64_t *cmd, const uint16_t flags)
+{
+	uint64x2_t dataoff_iova0, dataoff_iova1, dataoff_iova2, dataoff_iova3;
+	uint64x2_t len_olflags0, len_olflags1, len_olflags2, len_olflags3;
+	uint64_t *mbuf0, *mbuf1, *mbuf2, *mbuf3;
+	uint64x2_t senddesc01_w0, senddesc23_w0;
+	uint64x2_t senddesc01_w1, senddesc23_w1;
+	uint64x2_t sgdesc01_w0, sgdesc23_w0;
+	uint64x2_t sgdesc01_w1, sgdesc23_w1;
+	struct cn9k_eth_txq *txq = tx_queue;
+	uint64_t *lmt_addr = txq->lmt_addr;
+	rte_iova_t io_addr = txq->io_addr;
+	uint64x2_t ltypes01, ltypes23;
+	uint64x2_t xtmp128, ytmp128;
+	uint64x2_t xmask01, xmask23;
+	uint64x2_t cmd00, cmd01;
+	uint64x2_t cmd10, cmd11;
+	uint64x2_t cmd20, cmd21;
+	uint64x2_t cmd30, cmd31;
+	uint64_t lmt_status, i;
+	uint16_t pkts_left;
+
+	NIX_XMIT_FC_OR_RETURN(txq, pkts);
+
+	pkts_left = pkts & (NIX_DESCS_PER_LOOP - 1);
+	pkts = RTE_ALIGN_FLOOR(pkts, NIX_DESCS_PER_LOOP);
+
+	/* Reduce the cached count */
+	txq->fc_cache_pkts -= pkts;
+
+	/* Lets commit any changes in the packet here as no further changes
+	 * to the packet will be done unless no fast free is enabled.
+	 */
+	if (!(flags & NIX_TX_OFFLOAD_MBUF_NOFF_F))
+		rte_io_wmb();
+
+	senddesc01_w0 = vld1q_dup_u64(&txq->cmd[0]);
+	senddesc23_w0 = senddesc01_w0;
+	senddesc01_w1 = vdupq_n_u64(0);
+	senddesc23_w1 = senddesc01_w1;
+	sgdesc01_w0 = vld1q_dup_u64(&txq->cmd[2]);
+	sgdesc23_w0 = sgdesc01_w0;
+
+	for (i = 0; i < pkts; i += NIX_DESCS_PER_LOOP) {
+		/* Clear lower 32bit of SEND_HDR_W0 and SEND_SG_W0 */
+		senddesc01_w0 =
+			vbicq_u64(senddesc01_w0, vdupq_n_u64(0xFFFFFFFF));
+		sgdesc01_w0 = vbicq_u64(sgdesc01_w0, vdupq_n_u64(0xFFFFFFFF));
+
+		senddesc23_w0 = senddesc01_w0;
+		sgdesc23_w0 = sgdesc01_w0;
+
+		/* Move mbufs to iova */
+		mbuf0 = (uint64_t *)tx_pkts[0];
+		mbuf1 = (uint64_t *)tx_pkts[1];
+		mbuf2 = (uint64_t *)tx_pkts[2];
+		mbuf3 = (uint64_t *)tx_pkts[3];
+
+		mbuf0 = (uint64_t *)((uintptr_t)mbuf0 +
+				     offsetof(struct rte_mbuf, buf_iova));
+		mbuf1 = (uint64_t *)((uintptr_t)mbuf1 +
+				     offsetof(struct rte_mbuf, buf_iova));
+		mbuf2 = (uint64_t *)((uintptr_t)mbuf2 +
+				     offsetof(struct rte_mbuf, buf_iova));
+		mbuf3 = (uint64_t *)((uintptr_t)mbuf3 +
+				     offsetof(struct rte_mbuf, buf_iova));
+		/*
+		 * Get mbuf's, olflags, iova, pktlen, dataoff
+		 * dataoff_iovaX.D[0] = iova,
+		 * dataoff_iovaX.D[1](15:0) = mbuf->dataoff
+		 * len_olflagsX.D[0] = ol_flags,
+		 * len_olflagsX.D[1](63:32) = mbuf->pkt_len
+		 */
+		dataoff_iova0 = vld1q_u64(mbuf0);
+		len_olflags0 = vld1q_u64(mbuf0 + 2);
+		dataoff_iova1 = vld1q_u64(mbuf1);
+		len_olflags1 = vld1q_u64(mbuf1 + 2);
+		dataoff_iova2 = vld1q_u64(mbuf2);
+		len_olflags2 = vld1q_u64(mbuf2 + 2);
+		dataoff_iova3 = vld1q_u64(mbuf3);
+		len_olflags3 = vld1q_u64(mbuf3 + 2);
+
+		if (flags & NIX_TX_OFFLOAD_MBUF_NOFF_F) {
+			struct rte_mbuf *mbuf;
+			/* Set don't free bit if reference count > 1 */
+			xmask01 = vdupq_n_u64(0);
+			xmask23 = xmask01;
+
+			mbuf = (struct rte_mbuf *)((uintptr_t)mbuf0 -
+						   offsetof(struct rte_mbuf,
+							    buf_iova));
+
+			if (cnxk_nix_prefree_seg(mbuf))
+				vsetq_lane_u64(0x80000, xmask01, 0);
+			else
+				__mempool_check_cookies(mbuf->pool,
+							(void **)&mbuf, 1, 0);
+
+			mbuf = (struct rte_mbuf *)((uintptr_t)mbuf1 -
+						   offsetof(struct rte_mbuf,
+							    buf_iova));
+			if (cnxk_nix_prefree_seg(mbuf))
+				vsetq_lane_u64(0x80000, xmask01, 1);
+			else
+				__mempool_check_cookies(mbuf->pool,
+							(void **)&mbuf, 1, 0);
+
+			mbuf = (struct rte_mbuf *)((uintptr_t)mbuf2 -
+						   offsetof(struct rte_mbuf,
+							    buf_iova));
+			if (cnxk_nix_prefree_seg(mbuf))
+				vsetq_lane_u64(0x80000, xmask23, 0);
+			else
+				__mempool_check_cookies(mbuf->pool,
+							(void **)&mbuf, 1, 0);
+
+			mbuf = (struct rte_mbuf *)((uintptr_t)mbuf3 -
+						   offsetof(struct rte_mbuf,
+							    buf_iova));
+			if (cnxk_nix_prefree_seg(mbuf))
+				vsetq_lane_u64(0x80000, xmask23, 1);
+			else
+				__mempool_check_cookies(mbuf->pool,
+							(void **)&mbuf, 1, 0);
+			senddesc01_w0 = vorrq_u64(senddesc01_w0, xmask01);
+			senddesc23_w0 = vorrq_u64(senddesc23_w0, xmask23);
+			/* Ensuring mbuf fields which got updated in
+			 * cnxk_nix_prefree_seg are written before LMTST.
+			 */
+			rte_io_wmb();
+		} else {
+			struct rte_mbuf *mbuf;
+			/* Mark mempool object as "put" since
+			 * it is freed by NIX
+			 */
+			mbuf = (struct rte_mbuf *)((uintptr_t)mbuf0 -
+						   offsetof(struct rte_mbuf,
+							    buf_iova));
+			__mempool_check_cookies(mbuf->pool, (void **)&mbuf, 1,
+						0);
+
+			mbuf = (struct rte_mbuf *)((uintptr_t)mbuf1 -
+						   offsetof(struct rte_mbuf,
+							    buf_iova));
+			__mempool_check_cookies(mbuf->pool, (void **)&mbuf, 1,
+						0);
+
+			mbuf = (struct rte_mbuf *)((uintptr_t)mbuf2 -
+						   offsetof(struct rte_mbuf,
+							    buf_iova));
+			__mempool_check_cookies(mbuf->pool, (void **)&mbuf, 1,
+						0);
+
+			mbuf = (struct rte_mbuf *)((uintptr_t)mbuf3 -
+						   offsetof(struct rte_mbuf,
+							    buf_iova));
+			__mempool_check_cookies(mbuf->pool, (void **)&mbuf, 1,
+						0);
+			RTE_SET_USED(mbuf);
+		}
+
+		/* Move mbufs to point pool */
+		mbuf0 = (uint64_t *)((uintptr_t)mbuf0 +
+				     offsetof(struct rte_mbuf, pool) -
+				     offsetof(struct rte_mbuf, buf_iova));
+		mbuf1 = (uint64_t *)((uintptr_t)mbuf1 +
+				     offsetof(struct rte_mbuf, pool) -
+				     offsetof(struct rte_mbuf, buf_iova));
+		mbuf2 = (uint64_t *)((uintptr_t)mbuf2 +
+				     offsetof(struct rte_mbuf, pool) -
+				     offsetof(struct rte_mbuf, buf_iova));
+		mbuf3 = (uint64_t *)((uintptr_t)mbuf3 +
+				     offsetof(struct rte_mbuf, pool) -
+				     offsetof(struct rte_mbuf, buf_iova));
+
+		if (flags & (NIX_TX_OFFLOAD_OL3_OL4_CSUM_F |
+			     NIX_TX_OFFLOAD_L3_L4_CSUM_F)) {
+			/* Get tx_offload for ol2, ol3, l2, l3 lengths */
+			/*
+			 * E(8):OL2_LEN(7):OL3_LEN(9):E(24):L3_LEN(9):L2_LEN(7)
+			 * E(8):OL2_LEN(7):OL3_LEN(9):E(24):L3_LEN(9):L2_LEN(7)
+			 */
+
+			asm volatile("LD1 {%[a].D}[0],[%[in]]\n\t"
+				     : [a] "+w"(senddesc01_w1)
+				     : [in] "r"(mbuf0 + 2)
+				     : "memory");
+
+			asm volatile("LD1 {%[a].D}[1],[%[in]]\n\t"
+				     : [a] "+w"(senddesc01_w1)
+				     : [in] "r"(mbuf1 + 2)
+				     : "memory");
+
+			asm volatile("LD1 {%[b].D}[0],[%[in]]\n\t"
+				     : [b] "+w"(senddesc23_w1)
+				     : [in] "r"(mbuf2 + 2)
+				     : "memory");
+
+			asm volatile("LD1 {%[b].D}[1],[%[in]]\n\t"
+				     : [b] "+w"(senddesc23_w1)
+				     : [in] "r"(mbuf3 + 2)
+				     : "memory");
+
+			/* Get pool pointer alone */
+			mbuf0 = (uint64_t *)*mbuf0;
+			mbuf1 = (uint64_t *)*mbuf1;
+			mbuf2 = (uint64_t *)*mbuf2;
+			mbuf3 = (uint64_t *)*mbuf3;
+		} else {
+			/* Get pool pointer alone */
+			mbuf0 = (uint64_t *)*mbuf0;
+			mbuf1 = (uint64_t *)*mbuf1;
+			mbuf2 = (uint64_t *)*mbuf2;
+			mbuf3 = (uint64_t *)*mbuf3;
+		}
+
+		const uint8x16_t shuf_mask2 = {
+			0x4, 0x5, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xc, 0xd, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+		};
+		xtmp128 = vzip2q_u64(len_olflags0, len_olflags1);
+		ytmp128 = vzip2q_u64(len_olflags2, len_olflags3);
+
+		/* Clear dataoff_iovaX.D[1] bits other than dataoff(15:0) */
+		const uint64x2_t and_mask0 = {
+			0xFFFFFFFFFFFFFFFF,
+			0x000000000000FFFF,
+		};
+
+		dataoff_iova0 = vandq_u64(dataoff_iova0, and_mask0);
+		dataoff_iova1 = vandq_u64(dataoff_iova1, and_mask0);
+		dataoff_iova2 = vandq_u64(dataoff_iova2, and_mask0);
+		dataoff_iova3 = vandq_u64(dataoff_iova3, and_mask0);
+
+		/*
+		 * Pick only 16 bits of pktlen preset at bits 63:32
+		 * and place them at bits 15:0.
+		 */
+		xtmp128 = vqtbl1q_u8(xtmp128, shuf_mask2);
+		ytmp128 = vqtbl1q_u8(ytmp128, shuf_mask2);
+
+		/* Add pairwise to get dataoff + iova in sgdesc_w1 */
+		sgdesc01_w1 = vpaddq_u64(dataoff_iova0, dataoff_iova1);
+		sgdesc23_w1 = vpaddq_u64(dataoff_iova2, dataoff_iova3);
+
+		/* Orr both sgdesc_w0 and senddesc_w0 with 16 bits of
+		 * pktlen at 15:0 position.
+		 */
+		sgdesc01_w0 = vorrq_u64(sgdesc01_w0, xtmp128);
+		sgdesc23_w0 = vorrq_u64(sgdesc23_w0, ytmp128);
+		senddesc01_w0 = vorrq_u64(senddesc01_w0, xtmp128);
+		senddesc23_w0 = vorrq_u64(senddesc23_w0, ytmp128);
+
+		if ((flags & NIX_TX_OFFLOAD_L3_L4_CSUM_F) &&
+		    !(flags & NIX_TX_OFFLOAD_OL3_OL4_CSUM_F)) {
+			/*
+			 * Lookup table to translate ol_flags to
+			 * il3/il4 types. But we still use ol3/ol4 types in
+			 * senddesc_w1 as only one header processing is enabled.
+			 */
+			const uint8x16_t tbl = {
+				/* [0-15] = il4type:il3type */
+				0x04, /* none (IPv6 assumed) */
+				0x14, /* PKT_TX_TCP_CKSUM (IPv6 assumed) */
+				0x24, /* PKT_TX_SCTP_CKSUM (IPv6 assumed) */
+				0x34, /* PKT_TX_UDP_CKSUM (IPv6 assumed) */
+				0x03, /* PKT_TX_IP_CKSUM */
+				0x13, /* PKT_TX_IP_CKSUM | PKT_TX_TCP_CKSUM */
+				0x23, /* PKT_TX_IP_CKSUM | PKT_TX_SCTP_CKSUM */
+				0x33, /* PKT_TX_IP_CKSUM | PKT_TX_UDP_CKSUM */
+				0x02, /* PKT_TX_IPV4  */
+				0x12, /* PKT_TX_IPV4 | PKT_TX_TCP_CKSUM */
+				0x22, /* PKT_TX_IPV4 | PKT_TX_SCTP_CKSUM */
+				0x32, /* PKT_TX_IPV4 | PKT_TX_UDP_CKSUM */
+				0x03, /* PKT_TX_IPV4 | PKT_TX_IP_CKSUM */
+				0x13, /* PKT_TX_IPV4 | PKT_TX_IP_CKSUM |
+				       * PKT_TX_TCP_CKSUM
+				       */
+				0x23, /* PKT_TX_IPV4 | PKT_TX_IP_CKSUM |
+				       * PKT_TX_SCTP_CKSUM
+				       */
+				0x33, /* PKT_TX_IPV4 | PKT_TX_IP_CKSUM |
+				       * PKT_TX_UDP_CKSUM
+				       */
+			};
+
+			/* Extract olflags to translate to iltypes */
+			xtmp128 = vzip1q_u64(len_olflags0, len_olflags1);
+			ytmp128 = vzip1q_u64(len_olflags2, len_olflags3);
+
+			/*
+			 * E(47):L3_LEN(9):L2_LEN(7+z)
+			 * E(47):L3_LEN(9):L2_LEN(7+z)
+			 */
+			senddesc01_w1 = vshlq_n_u64(senddesc01_w1, 1);
+			senddesc23_w1 = vshlq_n_u64(senddesc23_w1, 1);
+
+			/* Move OLFLAGS bits 55:52 to 51:48
+			 * with zeros preprended on the byte and rest
+			 * don't care
+			 */
+			xtmp128 = vshrq_n_u8(xtmp128, 4);
+			ytmp128 = vshrq_n_u8(ytmp128, 4);
+			/*
+			 * E(48):L3_LEN(8):L2_LEN(z+7)
+			 * E(48):L3_LEN(8):L2_LEN(z+7)
+			 */
+			const int8x16_t tshft3 = {
+				-1, 0, 8, 8, 8, 8, 8, 8,
+				-1, 0, 8, 8, 8, 8, 8, 8,
+			};
+
+			senddesc01_w1 = vshlq_u8(senddesc01_w1, tshft3);
+			senddesc23_w1 = vshlq_u8(senddesc23_w1, tshft3);
+
+			/* Do the lookup */
+			ltypes01 = vqtbl1q_u8(tbl, xtmp128);
+			ltypes23 = vqtbl1q_u8(tbl, ytmp128);
+
+			/* Just use ld1q to retrieve aura
+			 * when we don't need tx_offload
+			 */
+			mbuf0 = (uint64_t *)((uintptr_t)mbuf0 +
+					     offsetof(struct rte_mempool,
+						      pool_id));
+			mbuf1 = (uint64_t *)((uintptr_t)mbuf1 +
+					     offsetof(struct rte_mempool,
+						      pool_id));
+			mbuf2 = (uint64_t *)((uintptr_t)mbuf2 +
+					     offsetof(struct rte_mempool,
+						      pool_id));
+			mbuf3 = (uint64_t *)((uintptr_t)mbuf3 +
+					     offsetof(struct rte_mempool,
+						      pool_id));
+
+			/* Pick only relevant fields i.e Bit 48:55 of iltype
+			 * and place it in ol3/ol4type of senddesc_w1
+			 */
+			const uint8x16_t shuf_mask0 = {
+				0xFF, 0xFF, 0xFF, 0xFF, 0x6, 0xFF, 0xFF, 0xFF,
+				0xFF, 0xFF, 0xFF, 0xFF, 0xE, 0xFF, 0xFF, 0xFF,
+			};
+
+			ltypes01 = vqtbl1q_u8(ltypes01, shuf_mask0);
+			ltypes23 = vqtbl1q_u8(ltypes23, shuf_mask0);
+
+			/* Prepare ol4ptr, ol3ptr from ol3len, ol2len.
+			 * a [E(32):E(16):OL3(8):OL2(8)]
+			 * a = a + (a << 8)
+			 * a [E(32):E(16):(OL3+OL2):OL2]
+			 * => E(32):E(16)::OL4PTR(8):OL3PTR(8)
+			 */
+			senddesc01_w1 = vaddq_u8(senddesc01_w1,
+						 vshlq_n_u16(senddesc01_w1, 8));
+			senddesc23_w1 = vaddq_u8(senddesc23_w1,
+						 vshlq_n_u16(senddesc23_w1, 8));
+
+			/* Create first half of 4W cmd for 4 mbufs (sgdesc) */
+			cmd01 = vzip1q_u64(sgdesc01_w0, sgdesc01_w1);
+			cmd11 = vzip2q_u64(sgdesc01_w0, sgdesc01_w1);
+			cmd21 = vzip1q_u64(sgdesc23_w0, sgdesc23_w1);
+			cmd31 = vzip2q_u64(sgdesc23_w0, sgdesc23_w1);
+
+			xmask01 = vdupq_n_u64(0);
+			xmask23 = xmask01;
+			asm volatile("LD1 {%[a].H}[0],[%[in]]\n\t"
+				     : [a] "+w"(xmask01)
+				     : [in] "r"(mbuf0)
+				     : "memory");
+
+			asm volatile("LD1 {%[a].H}[4],[%[in]]\n\t"
+				     : [a] "+w"(xmask01)
+				     : [in] "r"(mbuf1)
+				     : "memory");
+
+			asm volatile("LD1 {%[b].H}[0],[%[in]]\n\t"
+				     : [b] "+w"(xmask23)
+				     : [in] "r"(mbuf2)
+				     : "memory");
+
+			asm volatile("LD1 {%[b].H}[4],[%[in]]\n\t"
+				     : [b] "+w"(xmask23)
+				     : [in] "r"(mbuf3)
+				     : "memory");
+			xmask01 = vshlq_n_u64(xmask01, 20);
+			xmask23 = vshlq_n_u64(xmask23, 20);
+
+			senddesc01_w0 = vorrq_u64(senddesc01_w0, xmask01);
+			senddesc23_w0 = vorrq_u64(senddesc23_w0, xmask23);
+			/* Move ltypes to senddesc*_w1 */
+			senddesc01_w1 = vorrq_u64(senddesc01_w1, ltypes01);
+			senddesc23_w1 = vorrq_u64(senddesc23_w1, ltypes23);
+
+			/* Create first half of 4W cmd for 4 mbufs (sendhdr) */
+			cmd00 = vzip1q_u64(senddesc01_w0, senddesc01_w1);
+			cmd10 = vzip2q_u64(senddesc01_w0, senddesc01_w1);
+			cmd20 = vzip1q_u64(senddesc23_w0, senddesc23_w1);
+			cmd30 = vzip2q_u64(senddesc23_w0, senddesc23_w1);
+
+		} else if (!(flags & NIX_TX_OFFLOAD_L3_L4_CSUM_F) &&
+			   (flags & NIX_TX_OFFLOAD_OL3_OL4_CSUM_F)) {
+			/*
+			 * Lookup table to translate ol_flags to
+			 * ol3/ol4 types.
+			 */
+
+			const uint8x16_t tbl = {
+				/* [0-15] = ol4type:ol3type */
+				0x00, /* none */
+				0x03, /* OUTER_IP_CKSUM */
+				0x02, /* OUTER_IPV4 */
+				0x03, /* OUTER_IPV4 | OUTER_IP_CKSUM */
+				0x04, /* OUTER_IPV6 */
+				0x00, /* OUTER_IPV6 | OUTER_IP_CKSUM */
+				0x00, /* OUTER_IPV6 | OUTER_IPV4 */
+				0x00, /* OUTER_IPV6 | OUTER_IPV4 |
+				       * OUTER_IP_CKSUM
+				       */
+				0x00, /* OUTER_UDP_CKSUM */
+				0x33, /* OUTER_UDP_CKSUM | OUTER_IP_CKSUM */
+				0x32, /* OUTER_UDP_CKSUM | OUTER_IPV4 */
+				0x33, /* OUTER_UDP_CKSUM | OUTER_IPV4 |
+				       * OUTER_IP_CKSUM
+				       */
+				0x34, /* OUTER_UDP_CKSUM | OUTER_IPV6 */
+				0x00, /* OUTER_UDP_CKSUM | OUTER_IPV6 |
+				       * OUTER_IP_CKSUM
+				       */
+				0x00, /* OUTER_UDP_CKSUM | OUTER_IPV6 |
+				       * OUTER_IPV4
+				       */
+				0x00, /* OUTER_UDP_CKSUM | OUTER_IPV6 |
+				       * OUTER_IPV4 | OUTER_IP_CKSUM
+				       */
+			};
+
+			/* Extract olflags to translate to iltypes */
+			xtmp128 = vzip1q_u64(len_olflags0, len_olflags1);
+			ytmp128 = vzip1q_u64(len_olflags2, len_olflags3);
+
+			/*
+			 * E(47):OL3_LEN(9):OL2_LEN(7+z)
+			 * E(47):OL3_LEN(9):OL2_LEN(7+z)
+			 */
+			const uint8x16_t shuf_mask5 = {
+				0x6, 0x5, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+				0xE, 0xD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			};
+			senddesc01_w1 = vqtbl1q_u8(senddesc01_w1, shuf_mask5);
+			senddesc23_w1 = vqtbl1q_u8(senddesc23_w1, shuf_mask5);
+
+			/* Extract outer ol flags only */
+			const uint64x2_t o_cksum_mask = {
+				0x1C00020000000000,
+				0x1C00020000000000,
+			};
+
+			xtmp128 = vandq_u64(xtmp128, o_cksum_mask);
+			ytmp128 = vandq_u64(ytmp128, o_cksum_mask);
+
+			/* Extract OUTER_UDP_CKSUM bit 41 and
+			 * move it to bit 61
+			 */
+
+			xtmp128 = xtmp128 | vshlq_n_u64(xtmp128, 20);
+			ytmp128 = ytmp128 | vshlq_n_u64(ytmp128, 20);
+
+			/* Shift oltype by 2 to start nibble from BIT(56)
+			 * instead of BIT(58)
+			 */
+			xtmp128 = vshrq_n_u8(xtmp128, 2);
+			ytmp128 = vshrq_n_u8(ytmp128, 2);
+			/*
+			 * E(48):L3_LEN(8):L2_LEN(z+7)
+			 * E(48):L3_LEN(8):L2_LEN(z+7)
+			 */
+			const int8x16_t tshft3 = {
+				-1, 0, 8, 8, 8, 8, 8, 8,
+				-1, 0, 8, 8, 8, 8, 8, 8,
+			};
+
+			senddesc01_w1 = vshlq_u8(senddesc01_w1, tshft3);
+			senddesc23_w1 = vshlq_u8(senddesc23_w1, tshft3);
+
+			/* Do the lookup */
+			ltypes01 = vqtbl1q_u8(tbl, xtmp128);
+			ltypes23 = vqtbl1q_u8(tbl, ytmp128);
+
+			/* Just use ld1q to retrieve aura
+			 * when we don't need tx_offload
+			 */
+			mbuf0 = (uint64_t *)((uintptr_t)mbuf0 +
+					     offsetof(struct rte_mempool,
+						      pool_id));
+			mbuf1 = (uint64_t *)((uintptr_t)mbuf1 +
+					     offsetof(struct rte_mempool,
+						      pool_id));
+			mbuf2 = (uint64_t *)((uintptr_t)mbuf2 +
+					     offsetof(struct rte_mempool,
+						      pool_id));
+			mbuf3 = (uint64_t *)((uintptr_t)mbuf3 +
+					     offsetof(struct rte_mempool,
+						      pool_id));
+
+			/* Pick only relevant fields i.e Bit 56:63 of oltype
+			 * and place it in ol3/ol4type of senddesc_w1
+			 */
+			const uint8x16_t shuf_mask0 = {
+				0xFF, 0xFF, 0xFF, 0xFF, 0x7, 0xFF, 0xFF, 0xFF,
+				0xFF, 0xFF, 0xFF, 0xFF, 0xF, 0xFF, 0xFF, 0xFF,
+			};
+
+			ltypes01 = vqtbl1q_u8(ltypes01, shuf_mask0);
+			ltypes23 = vqtbl1q_u8(ltypes23, shuf_mask0);
+
+			/* Prepare ol4ptr, ol3ptr from ol3len, ol2len.
+			 * a [E(32):E(16):OL3(8):OL2(8)]
+			 * a = a + (a << 8)
+			 * a [E(32):E(16):(OL3+OL2):OL2]
+			 * => E(32):E(16)::OL4PTR(8):OL3PTR(8)
+			 */
+			senddesc01_w1 = vaddq_u8(senddesc01_w1,
+						 vshlq_n_u16(senddesc01_w1, 8));
+			senddesc23_w1 = vaddq_u8(senddesc23_w1,
+						 vshlq_n_u16(senddesc23_w1, 8));
+
+			/* Create second half of 4W cmd for 4 mbufs (sgdesc) */
+			cmd01 = vzip1q_u64(sgdesc01_w0, sgdesc01_w1);
+			cmd11 = vzip2q_u64(sgdesc01_w0, sgdesc01_w1);
+			cmd21 = vzip1q_u64(sgdesc23_w0, sgdesc23_w1);
+			cmd31 = vzip2q_u64(sgdesc23_w0, sgdesc23_w1);
+
+			xmask01 = vdupq_n_u64(0);
+			xmask23 = xmask01;
+			asm volatile("LD1 {%[a].H}[0],[%[in]]\n\t"
+				     : [a] "+w"(xmask01)
+				     : [in] "r"(mbuf0)
+				     : "memory");
+
+			asm volatile("LD1 {%[a].H}[4],[%[in]]\n\t"
+				     : [a] "+w"(xmask01)
+				     : [in] "r"(mbuf1)
+				     : "memory");
+
+			asm volatile("LD1 {%[b].H}[0],[%[in]]\n\t"
+				     : [b] "+w"(xmask23)
+				     : [in] "r"(mbuf2)
+				     : "memory");
+
+			asm volatile("LD1 {%[b].H}[4],[%[in]]\n\t"
+				     : [b] "+w"(xmask23)
+				     : [in] "r"(mbuf3)
+				     : "memory");
+			xmask01 = vshlq_n_u64(xmask01, 20);
+			xmask23 = vshlq_n_u64(xmask23, 20);
+
+			senddesc01_w0 = vorrq_u64(senddesc01_w0, xmask01);
+			senddesc23_w0 = vorrq_u64(senddesc23_w0, xmask23);
+			/* Move ltypes to senddesc*_w1 */
+			senddesc01_w1 = vorrq_u64(senddesc01_w1, ltypes01);
+			senddesc23_w1 = vorrq_u64(senddesc23_w1, ltypes23);
+
+			/* Create first half of 4W cmd for 4 mbufs (sendhdr) */
+			cmd00 = vzip1q_u64(senddesc01_w0, senddesc01_w1);
+			cmd10 = vzip2q_u64(senddesc01_w0, senddesc01_w1);
+			cmd20 = vzip1q_u64(senddesc23_w0, senddesc23_w1);
+			cmd30 = vzip2q_u64(senddesc23_w0, senddesc23_w1);
+
+		} else if ((flags & NIX_TX_OFFLOAD_L3_L4_CSUM_F) &&
+			   (flags & NIX_TX_OFFLOAD_OL3_OL4_CSUM_F)) {
+			/* Lookup table to translate ol_flags to
+			 * ol4type, ol3type, il4type, il3type of senddesc_w1
+			 */
+			const uint8x16x2_t tbl = {{
+				{
+					/* [0-15] = il4type:il3type */
+					0x04, /* none (IPv6) */
+					0x14, /* PKT_TX_TCP_CKSUM (IPv6) */
+					0x24, /* PKT_TX_SCTP_CKSUM (IPv6) */
+					0x34, /* PKT_TX_UDP_CKSUM (IPv6) */
+					0x03, /* PKT_TX_IP_CKSUM */
+					0x13, /* PKT_TX_IP_CKSUM |
+					       * PKT_TX_TCP_CKSUM
+					       */
+					0x23, /* PKT_TX_IP_CKSUM |
+					       * PKT_TX_SCTP_CKSUM
+					       */
+					0x33, /* PKT_TX_IP_CKSUM |
+					       * PKT_TX_UDP_CKSUM
+					       */
+					0x02, /* PKT_TX_IPV4 */
+					0x12, /* PKT_TX_IPV4 |
+					       * PKT_TX_TCP_CKSUM
+					       */
+					0x22, /* PKT_TX_IPV4 |
+					       * PKT_TX_SCTP_CKSUM
+					       */
+					0x32, /* PKT_TX_IPV4 |
+					       * PKT_TX_UDP_CKSUM
+					       */
+					0x03, /* PKT_TX_IPV4 |
+					       * PKT_TX_IP_CKSUM
+					       */
+					0x13, /* PKT_TX_IPV4 | PKT_TX_IP_CKSUM |
+					       * PKT_TX_TCP_CKSUM
+					       */
+					0x23, /* PKT_TX_IPV4 | PKT_TX_IP_CKSUM |
+					       * PKT_TX_SCTP_CKSUM
+					       */
+					0x33, /* PKT_TX_IPV4 | PKT_TX_IP_CKSUM |
+					       * PKT_TX_UDP_CKSUM
+					       */
+				},
+
+				{
+					/* [16-31] = ol4type:ol3type */
+					0x00, /* none */
+					0x03, /* OUTER_IP_CKSUM */
+					0x02, /* OUTER_IPV4 */
+					0x03, /* OUTER_IPV4 | OUTER_IP_CKSUM */
+					0x04, /* OUTER_IPV6 */
+					0x00, /* OUTER_IPV6 | OUTER_IP_CKSUM */
+					0x00, /* OUTER_IPV6 | OUTER_IPV4 */
+					0x00, /* OUTER_IPV6 | OUTER_IPV4 |
+					       * OUTER_IP_CKSUM
+					       */
+					0x00, /* OUTER_UDP_CKSUM */
+					0x33, /* OUTER_UDP_CKSUM |
+					       * OUTER_IP_CKSUM
+					       */
+					0x32, /* OUTER_UDP_CKSUM |
+					       * OUTER_IPV4
+					       */
+					0x33, /* OUTER_UDP_CKSUM |
+					       * OUTER_IPV4 | OUTER_IP_CKSUM
+					       */
+					0x34, /* OUTER_UDP_CKSUM |
+					       * OUTER_IPV6
+					       */
+					0x00, /* OUTER_UDP_CKSUM | OUTER_IPV6 |
+					       * OUTER_IP_CKSUM
+					       */
+					0x00, /* OUTER_UDP_CKSUM | OUTER_IPV6 |
+					       * OUTER_IPV4
+					       */
+					0x00, /* OUTER_UDP_CKSUM | OUTER_IPV6 |
+					       * OUTER_IPV4 | OUTER_IP_CKSUM
+					       */
+				},
+			}};
+
+			/* Extract olflags to translate to oltype & iltype */
+			xtmp128 = vzip1q_u64(len_olflags0, len_olflags1);
+			ytmp128 = vzip1q_u64(len_olflags2, len_olflags3);
+
+			/*
+			 * E(8):OL2_LN(7):OL3_LN(9):E(23):L3_LN(9):L2_LN(7+z)
+			 * E(8):OL2_LN(7):OL3_LN(9):E(23):L3_LN(9):L2_LN(7+z)
+			 */
+			const uint32x4_t tshft_4 = {
+				1,
+				0,
+				1,
+				0,
+			};
+			senddesc01_w1 = vshlq_u32(senddesc01_w1, tshft_4);
+			senddesc23_w1 = vshlq_u32(senddesc23_w1, tshft_4);
+
+			/*
+			 * E(32):L3_LEN(8):L2_LEN(7+Z):OL3_LEN(8):OL2_LEN(7+Z)
+			 * E(32):L3_LEN(8):L2_LEN(7+Z):OL3_LEN(8):OL2_LEN(7+Z)
+			 */
+			const uint8x16_t shuf_mask5 = {
+				0x6, 0x5, 0x0, 0x1, 0xFF, 0xFF, 0xFF, 0xFF,
+				0xE, 0xD, 0x8, 0x9, 0xFF, 0xFF, 0xFF, 0xFF,
+			};
+			senddesc01_w1 = vqtbl1q_u8(senddesc01_w1, shuf_mask5);
+			senddesc23_w1 = vqtbl1q_u8(senddesc23_w1, shuf_mask5);
+
+			/* Extract outer and inner header ol_flags */
+			const uint64x2_t oi_cksum_mask = {
+				0x1CF0020000000000,
+				0x1CF0020000000000,
+			};
+
+			xtmp128 = vandq_u64(xtmp128, oi_cksum_mask);
+			ytmp128 = vandq_u64(ytmp128, oi_cksum_mask);
+
+			/* Extract OUTER_UDP_CKSUM bit 41 and
+			 * move it to bit 61
+			 */
+
+			xtmp128 = xtmp128 | vshlq_n_u64(xtmp128, 20);
+			ytmp128 = ytmp128 | vshlq_n_u64(ytmp128, 20);
+
+			/* Shift right oltype by 2 and iltype by 4
+			 * to start oltype nibble from BIT(58)
+			 * instead of BIT(56) and iltype nibble from BIT(48)
+			 * instead of BIT(52).
+			 */
+			const int8x16_t tshft5 = {
+				8, 8, 8, 8, 8, 8, -4, -2,
+				8, 8, 8, 8, 8, 8, -4, -2,
+			};
+
+			xtmp128 = vshlq_u8(xtmp128, tshft5);
+			ytmp128 = vshlq_u8(ytmp128, tshft5);
+			/*
+			 * E(32):L3_LEN(8):L2_LEN(8):OL3_LEN(8):OL2_LEN(8)
+			 * E(32):L3_LEN(8):L2_LEN(8):OL3_LEN(8):OL2_LEN(8)
+			 */
+			const int8x16_t tshft3 = {
+				-1, 0, -1, 0, 0, 0, 0, 0,
+				-1, 0, -1, 0, 0, 0, 0, 0,
+			};
+
+			senddesc01_w1 = vshlq_u8(senddesc01_w1, tshft3);
+			senddesc23_w1 = vshlq_u8(senddesc23_w1, tshft3);
+
+			/* Mark Bit(4) of oltype */
+			const uint64x2_t oi_cksum_mask2 = {
+				0x1000000000000000,
+				0x1000000000000000,
+			};
+
+			xtmp128 = vorrq_u64(xtmp128, oi_cksum_mask2);
+			ytmp128 = vorrq_u64(ytmp128, oi_cksum_mask2);
+
+			/* Do the lookup */
+			ltypes01 = vqtbl2q_u8(tbl, xtmp128);
+			ltypes23 = vqtbl2q_u8(tbl, ytmp128);
+
+			/* Just use ld1q to retrieve aura
+			 * when we don't need tx_offload
+			 */
+			mbuf0 = (uint64_t *)((uintptr_t)mbuf0 +
+					     offsetof(struct rte_mempool,
+						      pool_id));
+			mbuf1 = (uint64_t *)((uintptr_t)mbuf1 +
+					     offsetof(struct rte_mempool,
+						      pool_id));
+			mbuf2 = (uint64_t *)((uintptr_t)mbuf2 +
+					     offsetof(struct rte_mempool,
+						      pool_id));
+			mbuf3 = (uint64_t *)((uintptr_t)mbuf3 +
+					     offsetof(struct rte_mempool,
+						      pool_id));
+
+			/* Pick only relevant fields i.e Bit 48:55 of iltype and
+			 * Bit 56:63 of oltype and place it in corresponding
+			 * place in senddesc_w1.
+			 */
+			const uint8x16_t shuf_mask0 = {
+				0xFF, 0xFF, 0xFF, 0xFF, 0x7, 0x6, 0xFF, 0xFF,
+				0xFF, 0xFF, 0xFF, 0xFF, 0xF, 0xE, 0xFF, 0xFF,
+			};
+
+			ltypes01 = vqtbl1q_u8(ltypes01, shuf_mask0);
+			ltypes23 = vqtbl1q_u8(ltypes23, shuf_mask0);
+
+			/* Prepare l4ptr, l3ptr, ol4ptr, ol3ptr from
+			 * l3len, l2len, ol3len, ol2len.
+			 * a [E(32):L3(8):L2(8):OL3(8):OL2(8)]
+			 * a = a + (a << 8)
+			 * a [E:(L3+L2):(L2+OL3):(OL3+OL2):OL2]
+			 * a = a + (a << 16)
+			 * a [E:(L3+L2+OL3+OL2):(L2+OL3+OL2):(OL3+OL2):OL2]
+			 * => E(32):IL4PTR(8):IL3PTR(8):OL4PTR(8):OL3PTR(8)
+			 */
+			senddesc01_w1 = vaddq_u8(senddesc01_w1,
+						 vshlq_n_u32(senddesc01_w1, 8));
+			senddesc23_w1 = vaddq_u8(senddesc23_w1,
+						 vshlq_n_u32(senddesc23_w1, 8));
+
+			/* Create second half of 4W cmd for 4 mbufs (sgdesc) */
+			cmd01 = vzip1q_u64(sgdesc01_w0, sgdesc01_w1);
+			cmd11 = vzip2q_u64(sgdesc01_w0, sgdesc01_w1);
+			cmd21 = vzip1q_u64(sgdesc23_w0, sgdesc23_w1);
+			cmd31 = vzip2q_u64(sgdesc23_w0, sgdesc23_w1);
+
+			/* Continue preparing l4ptr, l3ptr, ol4ptr, ol3ptr */
+			senddesc01_w1 = vaddq_u8(
+				senddesc01_w1, vshlq_n_u32(senddesc01_w1, 16));
+			senddesc23_w1 = vaddq_u8(
+				senddesc23_w1, vshlq_n_u32(senddesc23_w1, 16));
+
+			xmask01 = vdupq_n_u64(0);
+			xmask23 = xmask01;
+			asm volatile("LD1 {%[a].H}[0],[%[in]]\n\t"
+				     : [a] "+w"(xmask01)
+				     : [in] "r"(mbuf0)
+				     : "memory");
+
+			asm volatile("LD1 {%[a].H}[4],[%[in]]\n\t"
+				     : [a] "+w"(xmask01)
+				     : [in] "r"(mbuf1)
+				     : "memory");
+
+			asm volatile("LD1 {%[b].H}[0],[%[in]]\n\t"
+				     : [b] "+w"(xmask23)
+				     : [in] "r"(mbuf2)
+				     : "memory");
+
+			asm volatile("LD1 {%[b].H}[4],[%[in]]\n\t"
+				     : [b] "+w"(xmask23)
+				     : [in] "r"(mbuf3)
+				     : "memory");
+			xmask01 = vshlq_n_u64(xmask01, 20);
+			xmask23 = vshlq_n_u64(xmask23, 20);
+
+			senddesc01_w0 = vorrq_u64(senddesc01_w0, xmask01);
+			senddesc23_w0 = vorrq_u64(senddesc23_w0, xmask23);
+			/* Move ltypes to senddesc*_w1 */
+			senddesc01_w1 = vorrq_u64(senddesc01_w1, ltypes01);
+			senddesc23_w1 = vorrq_u64(senddesc23_w1, ltypes23);
+
+			/* Create first half of 4W cmd for 4 mbufs (sendhdr) */
+			cmd00 = vzip1q_u64(senddesc01_w0, senddesc01_w1);
+			cmd10 = vzip2q_u64(senddesc01_w0, senddesc01_w1);
+			cmd20 = vzip1q_u64(senddesc23_w0, senddesc23_w1);
+			cmd30 = vzip2q_u64(senddesc23_w0, senddesc23_w1);
+		} else {
+			/* Just use ld1q to retrieve aura
+			 * when we don't need tx_offload
+			 */
+			mbuf0 = (uint64_t *)((uintptr_t)mbuf0 +
+					     offsetof(struct rte_mempool,
+						      pool_id));
+			mbuf1 = (uint64_t *)((uintptr_t)mbuf1 +
+					     offsetof(struct rte_mempool,
+						      pool_id));
+			mbuf2 = (uint64_t *)((uintptr_t)mbuf2 +
+					     offsetof(struct rte_mempool,
+						      pool_id));
+			mbuf3 = (uint64_t *)((uintptr_t)mbuf3 +
+					     offsetof(struct rte_mempool,
+						      pool_id));
+			xmask01 = vdupq_n_u64(0);
+			xmask23 = xmask01;
+			asm volatile("LD1 {%[a].H}[0],[%[in]]\n\t"
+				     : [a] "+w"(xmask01)
+				     : [in] "r"(mbuf0)
+				     : "memory");
+
+			asm volatile("LD1 {%[a].H}[4],[%[in]]\n\t"
+				     : [a] "+w"(xmask01)
+				     : [in] "r"(mbuf1)
+				     : "memory");
+
+			asm volatile("LD1 {%[b].H}[0],[%[in]]\n\t"
+				     : [b] "+w"(xmask23)
+				     : [in] "r"(mbuf2)
+				     : "memory");
+
+			asm volatile("LD1 {%[b].H}[4],[%[in]]\n\t"
+				     : [b] "+w"(xmask23)
+				     : [in] "r"(mbuf3)
+				     : "memory");
+			xmask01 = vshlq_n_u64(xmask01, 20);
+			xmask23 = vshlq_n_u64(xmask23, 20);
+
+			senddesc01_w0 = vorrq_u64(senddesc01_w0, xmask01);
+			senddesc23_w0 = vorrq_u64(senddesc23_w0, xmask23);
+
+			/* Create 4W cmd for 4 mbufs (sendhdr, sgdesc) */
+			cmd00 = vzip1q_u64(senddesc01_w0, senddesc01_w1);
+			cmd01 = vzip1q_u64(sgdesc01_w0, sgdesc01_w1);
+			cmd10 = vzip2q_u64(senddesc01_w0, senddesc01_w1);
+			cmd11 = vzip2q_u64(sgdesc01_w0, sgdesc01_w1);
+			cmd20 = vzip1q_u64(senddesc23_w0, senddesc23_w1);
+			cmd21 = vzip1q_u64(sgdesc23_w0, sgdesc23_w1);
+			cmd30 = vzip2q_u64(senddesc23_w0, senddesc23_w1);
+			cmd31 = vzip2q_u64(sgdesc23_w0, sgdesc23_w1);
+		}
+
+		do {
+			vst1q_u64(lmt_addr, cmd00);
+			vst1q_u64(lmt_addr + 2, cmd01);
+			vst1q_u64(lmt_addr + 4, cmd10);
+			vst1q_u64(lmt_addr + 6, cmd11);
+			vst1q_u64(lmt_addr + 8, cmd20);
+			vst1q_u64(lmt_addr + 10, cmd21);
+			vst1q_u64(lmt_addr + 12, cmd30);
+			vst1q_u64(lmt_addr + 14, cmd31);
+			lmt_status = roc_lmt_submit_ldeor(io_addr);
+
+		} while (lmt_status == 0);
+		tx_pkts = tx_pkts + NIX_DESCS_PER_LOOP;
+	}
+
+	if (unlikely(pkts_left))
+		pkts += nix_xmit_pkts(tx_queue, tx_pkts, pkts_left, cmd, flags);
+
+	return pkts;
+}
+
+#else
+static __rte_always_inline uint16_t
+nix_xmit_pkts_vector(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t pkts,
+		     uint64_t *cmd, const uint16_t flags)
+{
+	RTE_SET_USED(tx_queue);
+	RTE_SET_USED(tx_pkts);
+	RTE_SET_USED(pkts);
+	RTE_SET_USED(cmd);
+	RTE_SET_USED(flags);
+	return 0;
+}
+#endif
+
 #define T(name, f4, f3, f2, f1, f0, sz, flags)				       \
 	static uint16_t __rte_noinline __rte_hot cn9k_nix_xmit_pkts_##name(    \
 		void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t pkts)      \
@@ -128,6 +1045,25 @@ NIX_TX_FASTPATH_MODES
 NIX_TX_FASTPATH_MODES
 #undef T
 
+#define T(name, f4, f3, f2, f1, f0, sz, flags)				       \
+	static uint16_t __rte_noinline __rte_hot                               \
+		cn9k_nix_xmit_pkts_vec_##name(void *tx_queue,                  \
+					      struct rte_mbuf **tx_pkts,       \
+					      uint16_t pkts)                   \
+	{                                                                      \
+		uint64_t cmd[sz];                                              \
+									       \
+		/* VLAN, TSTMP, TSO is not supported by vec */                 \
+		if ((flags) & NIX_TX_OFFLOAD_VLAN_QINQ_F ||		       \
+		    (flags) & NIX_TX_OFFLOAD_TSO_F)			       \
+			return 0;                                              \
+		return nix_xmit_pkts_vector(tx_queue, tx_pkts, pkts, cmd,      \
+					    (flags));                          \
+	}
+
+NIX_TX_FASTPATH_MODES
+#undef T
+
 static inline void
 pick_tx_func(struct rte_eth_dev *eth_dev,
 	     const eth_tx_burst_t tx_burst[2][2][2][2][2])
@@ -164,7 +1100,20 @@ cn9k_eth_set_tx_function(struct rte_eth_dev *eth_dev)
 #undef T
 	};
 
-	pick_tx_func(eth_dev, nix_eth_tx_burst);
+	const eth_tx_burst_t nix_eth_tx_vec_burst[2][2][2][2][2] = {
+#define T(name, f4, f3, f2, f1, f0, sz, flags)					\
+	[f4][f3][f2][f1][f0] = cn9k_nix_xmit_pkts_vec_##name,
+
+		NIX_TX_FASTPATH_MODES
+#undef T
+	};
+
+	if (dev->scalar_ena ||
+	    (dev->tx_offload_flags &
+	     (NIX_TX_OFFLOAD_VLAN_QINQ_F | NIX_TX_OFFLOAD_TSO_F)))
+		pick_tx_func(eth_dev, nix_eth_tx_burst);
+	else
+		pick_tx_func(eth_dev, nix_eth_tx_vec_burst);
 
 	if (dev->tx_offloads & DEV_TX_OFFLOAD_MULTI_SEGS)
 		pick_tx_func(eth_dev, nix_eth_tx_burst_mseg);
Signature · 1 line
2.8.4
#17 lore raw

PATCH 17/44 net/cnxk: add Rx support for cn10k

In reply to Nithin Dabilpuram

From: Jerin Jacob <[email protected]>

Add Rx burst support for CN10K SoC.

---
 drivers/net/cnxk/cn10k_ethdev.h |   3 +
 drivers/net/cnxk/cn10k_rx.c     | 123 ++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cn10k_rx.h     | 151 ++++++++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/meson.build    |   3 +-
 4 files changed, 279 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/cnxk/cn10k_rx.c
drivers/net/cnxk/cn10k_ethdev.h +3 -0
index 2157b16..e4332d3 100644
@@ -32,4 +32,7 @@ struct cn10k_eth_rxq {
 	uint16_t rq;
 } __plt_cache_aligned;
 
+/* Rx and Tx routines */
+void cn10k_eth_set_rx_function(struct rte_eth_dev *eth_dev);
+
 #endif /* __CN10K_ETHDEV_H__ */
drivers/net/cnxk/cn10k_rx.c new file +123 -0

123 lines not on this page · raw message

drivers/net/cnxk/cn10k_rx.h +151 -0

157 lines not on this page · raw message

drivers/net/cnxk/meson.build +2 -1
index d152f08..1ac6b85 100644
@@ -19,7 +19,8 @@ sources += files('cn9k_ethdev.c',
 		 'cn9k_rx.c',
 		 'cn9k_tx.c')
 # CN10K
-sources += files('cn10k_ethdev.c')
+sources += files('cn10k_ethdev.c',
+		 'cn10k_rx.c')
 
 deps += ['bus_pci', 'cryptodev', 'eventdev', 'security']
 deps += ['common_cnxk', 'mempool_cnxk']
Signature · 1 line
2.8.4
#18 lore raw

PATCH 18/44 net/cnxk: add Rx multi-segment version for cn10k

In reply to Nithin Dabilpuram

Add Rx burst multi-segment version for CN10K.

---
 doc/guides/nics/cnxk.rst              |  2 ++
 doc/guides/nics/features/cnxk.ini     |  2 ++
 doc/guides/nics/features/cnxk_vec.ini |  1 +
 doc/guides/nics/features/cnxk_vf.ini  |  2 ++
 drivers/net/cnxk/cn10k_rx.c           | 27 ++++++++++++++++++
 drivers/net/cnxk/cn10k_rx.h           | 54 +++++++++++++++++++++++++++++++++--
 6 files changed, 86 insertions(+), 2 deletions(-)
doc/guides/nics/cnxk.rst +2 -0
index 4f1b58c..789ec29 100644
@@ -17,11 +17,13 @@ Features
 Features of the CNXK Ethdev PMD are:
 
 - Packet type information
+- Jumbo frames
 - SR-IOV VF
 - Lock-free Tx queue
 - Multiple queues for TX and RX
 - Receiver Side Scaling (RSS)
 - Link state information
+- Scatter-Gather IO support
 
 Prerequisites
 -------------
doc/guides/nics/features/cnxk.ini +2 -0
index 712f8d5..23564b7 100644
@@ -15,6 +15,8 @@ Runtime Tx queue setup = Y
 Queue start/stop     = Y
 RSS hash             = Y
 Inner RSS            = Y
+Jumbo frame          = Y
+Scattered Rx         = Y
 Packet type parsing  = Y
 Linux                = Y
 ARMv8                = Y
doc/guides/nics/features/cnxk_vec.ini +1 -0
index 82f2af0..421048d 100644
@@ -15,6 +15,7 @@ Runtime Tx queue setup = Y
 Queue start/stop     = Y
 RSS hash             = Y
 Inner RSS            = Y
+Jumbo frame          = Y
 Packet type parsing  = Y
 Linux                = Y
 ARMv8                = Y
doc/guides/nics/features/cnxk_vf.ini +2 -0
index 61fed11..e901fa2 100644
@@ -14,6 +14,8 @@ Runtime Tx queue setup = Y
 Queue start/stop     = Y
 RSS hash             = Y
 Inner RSS            = Y
+Jumbo frame          = Y
+Scattered Rx         = Y
 Packet type parsing  = Y
 Linux                = Y
 ARMv8                = Y
drivers/net/cnxk/cn10k_rx.c +27 -0
index 1ff1b04..b98e7a1 100644
@@ -88,6 +88,15 @@ nix_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts,
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
 		return nix_recv_pkts(rx_queue, rx_pkts, pkts, (flags));        \
+	}                                                                      \
+									       \
+	static uint16_t __rte_noinline __rte_hot                               \
+		cn10k_nix_recv_pkts_mseg_##name(void *rx_queue,                \
+						struct rte_mbuf **rx_pkts,     \
+						uint16_t pkts)                 \
+	{                                                                      \
+		return nix_recv_pkts(rx_queue, rx_pkts, pkts,                  \
+				     (flags) | NIX_RX_MULTI_SEG_F);            \
 	}
 
 NIX_RX_FASTPATH_MODES
@@ -110,6 +119,8 @@ pick_rx_func(struct rte_eth_dev *eth_dev,
 void
 cn10k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
 {
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+
 	const eth_rx_burst_t nix_eth_rx_burst[2][2][2][2] = {
 #define R(name, f3, f2, f1, f0, flags)					      \
 	[f3][f2][f1][f0] = cn10k_nix_recv_pkts_##name,
@@ -118,6 +129,22 @@ cn10k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
 #undef R
 	};
 
+	const eth_rx_burst_t nix_eth_rx_burst_mseg[2][2][2][2] = {
+#define R(name, f3, f2, f1, f0, flags)					      \
+	[f3][f2][f1][f0] = cn10k_nix_recv_pkts_mseg_##name,
+
+		NIX_RX_FASTPATH_MODES
+#undef R
+	};
+
 	pick_rx_func(eth_dev, nix_eth_rx_burst);
+
+	if (dev->rx_offloads & DEV_RX_OFFLOAD_SCATTER)
+		pick_rx_func(eth_dev, nix_eth_rx_burst_mseg);
+
+	/* Copy multi seg version with no offload for tear down sequence */
+	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
+		dev->rx_pkt_burst_no_offload =
+			nix_eth_rx_burst_mseg[0][0][0][0];
 	rte_mb();
 }
drivers/net/cnxk/cn10k_rx.h +52 -2

66 lines not on this page · raw message

Signature · 1 line
2.8.4
#19 lore raw

PATCH 19/44 net/cnxk: add Rx vector version for cn10k

In reply to Nithin Dabilpuram

From: Jerin Jacob <[email protected]>

Add Rx burst vector version for CN10K.

---
 doc/guides/nics/cnxk.rst    |   1 +
 drivers/net/cnxk/cn10k_rx.c | 240 +++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 240 insertions(+), 1 deletion(-)
doc/guides/nics/cnxk.rst +1 -0
index 789ec29..4187e9d 100644
@@ -24,6 +24,7 @@ Features of the CNXK Ethdev PMD are:
 - Receiver Side Scaling (RSS)
 - Link state information
 - Scatter-Gather IO support
+- Vector Poll mode driver
 
 Prerequisites
 -------------
drivers/net/cnxk/cn10k_rx.c +239 -1

264 lines not on this page · raw message

Signature · 1 line
2.8.4
#20 lore raw

PATCH 20/44 net/cnxk: add Tx support for cn10k

In reply to Nithin Dabilpuram

From: Jerin Jacob <[email protected]>

Add Tx burst scalar version for CN10K.

---
 doc/guides/nics/cnxk.rst              |   1 +
 doc/guides/nics/features/cnxk.ini     |   7 +
 doc/guides/nics/features/cnxk_vec.ini |   6 +
 doc/guides/nics/features/cnxk_vf.ini  |   7 +
 drivers/net/cnxk/cn10k_ethdev.h       |   1 +
 drivers/net/cnxk/cn10k_tx.c           | 174 +++++++++++++++++
 drivers/net/cnxk/cn10k_tx.h           | 358 ++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/meson.build          |   3 +-
 8 files changed, 556 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/cnxk/cn10k_tx.c
doc/guides/nics/cnxk.rst +1 -0
index 4187e9d..555730d 100644
@@ -22,6 +22,7 @@ Features of the CNXK Ethdev PMD are:
 - Lock-free Tx queue
 - Multiple queues for TX and RX
 - Receiver Side Scaling (RSS)
+- Inner and Outer Checksum offload
 - Link state information
 - Scatter-Gather IO support
 - Vector Poll mode driver
doc/guides/nics/features/cnxk.ini +7 -0
index 23564b7..02be26b 100644
@@ -12,11 +12,18 @@ Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
+Fast mbuf free       = Y
+Free Tx mbuf on demand = Y
 Queue start/stop     = Y
+TSO                  = Y
 RSS hash             = Y
 Inner RSS            = Y
 Jumbo frame          = Y
 Scattered Rx         = Y
+L3 checksum offload  = Y
+L4 checksum offload  = Y
+Inner L3 checksum    = Y
+Inner L4 checksum    = Y
 Packet type parsing  = Y
 Linux                = Y
 ARMv8                = Y
doc/guides/nics/features/cnxk_vec.ini +6 -0
index 421048d..8c63853 100644
@@ -12,10 +12,16 @@ Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
+Fast mbuf free       = Y
+Free Tx mbuf on demand = Y
 Queue start/stop     = Y
 RSS hash             = Y
 Inner RSS            = Y
 Jumbo frame          = Y
+L3 checksum offload  = Y
+L4 checksum offload  = Y
+Inner L3 checksum    = Y
+Inner L4 checksum    = Y
 Packet type parsing  = Y
 Linux                = Y
 ARMv8                = Y
doc/guides/nics/features/cnxk_vf.ini +7 -0
index e901fa2..a1bd49b 100644
@@ -11,11 +11,18 @@ Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
+Fast mbuf free       = Y
+Free Tx mbuf on demand = Y
 Queue start/stop     = Y
+TSO                  = Y
 RSS hash             = Y
 Inner RSS            = Y
 Jumbo frame          = Y
 Scattered Rx         = Y
+L3 checksum offload  = Y
+L4 checksum offload  = Y
+Inner L3 checksum    = Y
+Inner L4 checksum    = Y
 Packet type parsing  = Y
 Linux                = Y
 ARMv8                = Y
drivers/net/cnxk/cn10k_ethdev.h +1 -0
index e4332d3..58c51ab 100644
@@ -34,5 +34,6 @@ struct cn10k_eth_rxq {
 
 /* Rx and Tx routines */
 void cn10k_eth_set_rx_function(struct rte_eth_dev *eth_dev);
+void cn10k_eth_set_tx_function(struct rte_eth_dev *eth_dev);
 
 #endif /* __CN10K_ETHDEV_H__ */
drivers/net/cnxk/cn10k_tx.c new file +174 -0

174 lines not on this page · raw message

drivers/net/cnxk/cn10k_tx.h +358 -0

368 lines not on this page · raw message

drivers/net/cnxk/meson.build +2 -1
index 1ac6b85..3aa9f70 100644
@@ -20,7 +20,8 @@ sources += files('cn9k_ethdev.c',
 		 'cn9k_tx.c')
 # CN10K
 sources += files('cn10k_ethdev.c',
-		 'cn10k_rx.c')
+		 'cn10k_rx.c',
+		 'cn10k_tx.c')
 
 deps += ['bus_pci', 'cryptodev', 'eventdev', 'security']
 deps += ['common_cnxk', 'mempool_cnxk']
Signature · 1 line
2.8.4
#21 lore raw

PATCH 21/44 net/cnxk: add Tx multi-segment version for cn10k

In reply to Nithin Dabilpuram

Add Tx burst multi-segment version for CN10K.

---
 drivers/net/cnxk/cn10k_tx.c | 124 ++++++++++++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cn10k_tx.h |  71 +++++++++++++++++++++++++
 2 files changed, 195 insertions(+)
drivers/net/cnxk/cn10k_tx.c +124 -0
index 0fad4c0..d170f31 100644
@@ -125,6 +125,98 @@ nix_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t pkts,
 	return pkts;
 }
 
+static __rte_always_inline uint16_t
+nix_xmit_pkts_mseg(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t pkts,
+		   uint64_t *cmd, const uint16_t flags)
+{
+	struct cn10k_eth_txq *txq = tx_queue;
+	uintptr_t pa0, pa1, lmt_addr = txq->lmt_base;
+	const rte_iova_t io_addr = txq->io_addr;
+	uint16_t segdw, lmt_id, burst, left, i;
+	uint64_t data0, data1;
+	__uint128_t data128;
+	uint16_t shft;
+
+	NIX_XMIT_FC_OR_RETURN(txq, pkts);
+
+	cn10k_nix_tx_skeleton(txq, cmd, flags);
+
+	/* Reduce the cached count */
+	txq->fc_cache_pkts -= pkts;
+
+	/* Get LMT base address and LMT ID as lcore id */
+	ROC_LMT_BASE_ID_GET(lmt_addr, lmt_id);
+	left = pkts;
+again:
+	burst = left > 32 ? 32 : left;
+	shft = 16;
+	data128 = 0;
+	for (i = 0; i < burst; i++) {
+		/* Perform header writes for TSO, barrier at
+		 * lmt steorl will suffice.
+		 */
+		if (flags & NIX_TX_OFFLOAD_TSO_F)
+			cn10k_nix_xmit_prepare_tso(tx_pkts[i], flags);
+
+		cn10k_nix_xmit_prepare(tx_pkts[i], cmd, lmt_addr, flags);
+		/* Store sg list directly on lmt line */
+		segdw = cn10k_nix_prepare_mseg(tx_pkts[i], (uint64_t *)lmt_addr,
+					       flags);
+		lmt_addr += (1ULL << ROC_LMT_LINE_SIZE_LOG2);
+		data128 |= (((__uint128_t)(segdw - 1)) << shft);
+		shft += 3;
+	}
+
+	data0 = (uint64_t)data128;
+	data1 = (uint64_t)(data128 >> 64);
+	/* Make data0 similar to data1 */
+	data0 >>= 16;
+	/* Trigger LMTST */
+	if (burst > 16) {
+		pa0 = io_addr | (data0 & 0x7) << 4;
+		data0 &= ~0x7ULL;
+		/* Move lmtst1..15 sz to bits 63:19 */
+		data0 <<= 16;
+		data0 |= (15ULL << 12);
+		data0 |= (uint64_t)lmt_id;
+
+		/* STEOR0 */
+		roc_lmt_submit_steorl(data0, pa0);
+
+		pa1 = io_addr | (data1 & 0x7) << 4;
+		data1 &= ~0x7ULL;
+		data1 <<= 16;
+		data1 |= ((uint64_t)(burst - 17)) << 12;
+		data1 |= (uint64_t)(lmt_id + 16);
+
+		/* STEOR1 */
+		roc_lmt_submit_steorl(data1, pa1);
+	} else if (burst) {
+		pa0 = io_addr | (data0 & 0x7) << 4;
+		data0 &= ~0x7ULL;
+		/* Move lmtst1..15 sz to bits 63:19 */
+		data0 <<= 16;
+		data0 |= ((burst - 1) << 12);
+		data0 |= (uint64_t)lmt_id;
+
+		/* STEOR0 */
+		roc_lmt_submit_steorl(data0, pa0);
+	}
+
+	left -= burst;
+	rte_io_wmb();
+	if (left) {
+		/* Start processing another burst */
+		tx_pkts += burst;
+		/* Reset lmt base addr */
+		lmt_addr -= (1ULL << ROC_LMT_LINE_SIZE_LOG2);
+		lmt_addr &= (~(BIT_ULL(ROC_LMT_BASE_PER_CORE_LOG2) - 1));
+		goto again;
+	}
+
+	return pkts;
+}
+
 
 #define T(name, f4, f3, f2, f1, f0, sz, flags)				       \
 	static uint16_t __rte_noinline __rte_hot cn10k_nix_xmit_pkts_##name(   \
@@ -142,6 +234,25 @@ nix_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t pkts,
 NIX_TX_FASTPATH_MODES
 #undef T
 
+#define T(name, f4, f3, f2, f1, f0, sz, flags)				       \
+	static uint16_t __rte_noinline __rte_hot                               \
+		cn10k_nix_xmit_pkts_mseg_##name(void *tx_queue,                \
+						struct rte_mbuf **tx_pkts,     \
+						uint16_t pkts)                 \
+	{                                                                      \
+		uint64_t cmd[(sz)];                                            \
+									       \
+		/* For TSO inner checksum is a must */                         \
+		if (((flags) & NIX_TX_OFFLOAD_TSO_F) &&			       \
+		    !((flags) & NIX_TX_OFFLOAD_L3_L4_CSUM_F))		       \
+			return 0;                                              \
+		return nix_xmit_pkts_mseg(tx_queue, tx_pkts, pkts, cmd,        \
+					  (flags) | NIX_TX_MULTI_SEG_F);       \
+	}
+
+NIX_TX_FASTPATH_MODES
+#undef T
+
 static inline void
 pick_tx_func(struct rte_eth_dev *eth_dev,
 	     const eth_tx_burst_t tx_burst[2][2][2][2][2])
@@ -160,6 +271,8 @@ pick_tx_func(struct rte_eth_dev *eth_dev,
 void
 cn10k_eth_set_tx_function(struct rte_eth_dev *eth_dev)
 {
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+
 	const eth_tx_burst_t nix_eth_tx_burst[2][2][2][2][2] = {
 #define T(name, f4, f3, f2, f1, f0, sz, flags)                         \
 	[f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_##name,
@@ -168,7 +281,18 @@ cn10k_eth_set_tx_function(struct rte_eth_dev *eth_dev)
 #undef T
 	};
 
+	const eth_tx_burst_t nix_eth_tx_burst_mseg[2][2][2][2][2] = {
+#define T(name, f4, f3, f2, f1, f0, sz, flags)				\
+	[f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_mseg_##name,
+
+		NIX_TX_FASTPATH_MODES
+#undef T
+	};
+
 	pick_tx_func(eth_dev, nix_eth_tx_burst);
 
+	if (dev->tx_offloads & DEV_TX_OFFLOAD_MULTI_SEGS)
+		pick_tx_func(eth_dev, nix_eth_tx_burst_mseg);
+
 	rte_mb();
 }
drivers/net/cnxk/cn10k_tx.h +71 -0

77 lines not on this page · raw message

Signature · 1 line
2.8.4
#22 lore raw

PATCH 22/44 net/cnxk: add Tx vector version for cn10k

In reply to Nithin Dabilpuram

Add Tx burst vector version for CN10K.

---
 drivers/net/cnxk/cn10k_tx.c | 988 +++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 987 insertions(+), 1 deletion(-)
drivers/net/cnxk/cn10k_tx.c +987 -1
index d170f31..c487c83 100644
@@ -2,6 +2,8 @@
  * Copyright(C) 2021 Marvell.
  */
 
+#include <rte_vect.h>
+
 #include "cn10k_ethdev.h"
 #include "cn10k_tx.h"
 
@@ -217,6 +219,958 @@ nix_xmit_pkts_mseg(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t pkts,
 	return pkts;
 }
 
+#if defined(RTE_ARCH_ARM64)
+
+#define NIX_DESCS_PER_LOOP 4
+static __rte_always_inline uint16_t
+nix_xmit_pkts_vector(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t pkts,
+		     uint64_t *cmd, const uint16_t flags)
+{
+	uint64x2_t dataoff_iova0, dataoff_iova1, dataoff_iova2, dataoff_iova3;
+	uint64x2_t len_olflags0, len_olflags1, len_olflags2, len_olflags3;
+	uint64_t *mbuf0, *mbuf1, *mbuf2, *mbuf3, data, pa;
+	uint64x2_t senddesc01_w0, senddesc23_w0;
+	uint64x2_t senddesc01_w1, senddesc23_w1;
+	uint16_t left, scalar, burst, i, lmt_id;
+	uint64x2_t sgdesc01_w0, sgdesc23_w0;
+	uint64x2_t sgdesc01_w1, sgdesc23_w1;
+	struct cn10k_eth_txq *txq = tx_queue;
+	uintptr_t lmt_addr = txq->lmt_base;
+	rte_iova_t io_addr = txq->io_addr;
+	uint64x2_t ltypes01, ltypes23;
+	uint64x2_t xtmp128, ytmp128;
+	uint64x2_t xmask01, xmask23;
+	uint64x2_t cmd00, cmd01;
+	uint64x2_t cmd10, cmd11;
+	uint64x2_t cmd20, cmd21;
+	uint64x2_t cmd30, cmd31;
+
+	NIX_XMIT_FC_OR_RETURN(txq, pkts);
+
+	scalar = pkts & (NIX_DESCS_PER_LOOP - 1);
+	pkts = RTE_ALIGN_FLOOR(pkts, NIX_DESCS_PER_LOOP);
+
+	/* Reduce the cached count */
+	txq->fc_cache_pkts -= pkts;
+
+	senddesc01_w0 = vld1q_dup_u64(&txq->send_hdr_w0);
+	senddesc23_w0 = senddesc01_w0;
+	senddesc01_w1 = vdupq_n_u64(0);
+	senddesc23_w1 = senddesc01_w1;
+	sgdesc01_w0 = vld1q_dup_u64(&txq->sg_w0);
+	sgdesc23_w0 = sgdesc01_w0;
+
+	/* Get LMT base address and LMT ID as lcore id */
+	ROC_LMT_BASE_ID_GET(lmt_addr, lmt_id);
+	left = pkts;
+again:
+	burst = left > 32 ? 32 : left;
+	for (i = 0; i < burst; i += NIX_DESCS_PER_LOOP) {
+		/* Clear lower 32bit of SEND_HDR_W0 and SEND_SG_W0 */
+		senddesc01_w0 =
+			vbicq_u64(senddesc01_w0, vdupq_n_u64(0xFFFFFFFF));
+		sgdesc01_w0 = vbicq_u64(sgdesc01_w0, vdupq_n_u64(0xFFFFFFFF));
+
+		senddesc23_w0 = senddesc01_w0;
+		sgdesc23_w0 = sgdesc01_w0;
+
+		/* Move mbufs to iova */
+		mbuf0 = (uint64_t *)tx_pkts[0];
+		mbuf1 = (uint64_t *)tx_pkts[1];
+		mbuf2 = (uint64_t *)tx_pkts[2];
+		mbuf3 = (uint64_t *)tx_pkts[3];
+
+		mbuf0 = (uint64_t *)((uintptr_t)mbuf0 +
+				     offsetof(struct rte_mbuf, buf_iova));
+		mbuf1 = (uint64_t *)((uintptr_t)mbuf1 +
+				     offsetof(struct rte_mbuf, buf_iova));
+		mbuf2 = (uint64_t *)((uintptr_t)mbuf2 +
+				     offsetof(struct rte_mbuf, buf_iova));
+		mbuf3 = (uint64_t *)((uintptr_t)mbuf3 +
+				     offsetof(struct rte_mbuf, buf_iova));
+		/*
+		 * Get mbuf's, olflags, iova, pktlen, dataoff
+		 * dataoff_iovaX.D[0] = iova,
+		 * dataoff_iovaX.D[1](15:0) = mbuf->dataoff
+		 * len_olflagsX.D[0] = ol_flags,
+		 * len_olflagsX.D[1](63:32) = mbuf->pkt_len
+		 */
+		dataoff_iova0 = vld1q_u64(mbuf0);
+		len_olflags0 = vld1q_u64(mbuf0 + 2);
+		dataoff_iova1 = vld1q_u64(mbuf1);
+		len_olflags1 = vld1q_u64(mbuf1 + 2);
+		dataoff_iova2 = vld1q_u64(mbuf2);
+		len_olflags2 = vld1q_u64(mbuf2 + 2);
+		dataoff_iova3 = vld1q_u64(mbuf3);
+		len_olflags3 = vld1q_u64(mbuf3 + 2);
+
+		if (flags & NIX_TX_OFFLOAD_MBUF_NOFF_F) {
+			struct rte_mbuf *mbuf;
+			/* Set don't free bit if reference count > 1 */
+			xmask01 = vdupq_n_u64(0);
+			xmask23 = xmask01;
+
+			mbuf = (struct rte_mbuf *)((uintptr_t)mbuf0 -
+						   offsetof(struct rte_mbuf,
+							    buf_iova));
+
+			if (cnxk_nix_prefree_seg(mbuf))
+				vsetq_lane_u64(0x80000, xmask01, 0);
+			else
+				__mempool_check_cookies(mbuf->pool,
+							(void **)&mbuf, 1, 0);
+
+			mbuf = (struct rte_mbuf *)((uintptr_t)mbuf1 -
+						   offsetof(struct rte_mbuf,
+							    buf_iova));
+			if (cnxk_nix_prefree_seg(mbuf))
+				vsetq_lane_u64(0x80000, xmask01, 1);
+			else
+				__mempool_check_cookies(mbuf->pool,
+							(void **)&mbuf, 1, 0);
+
+			mbuf = (struct rte_mbuf *)((uintptr_t)mbuf2 -
+						   offsetof(struct rte_mbuf,
+							    buf_iova));
+			if (cnxk_nix_prefree_seg(mbuf))
+				vsetq_lane_u64(0x80000, xmask23, 0);
+			else
+				__mempool_check_cookies(mbuf->pool,
+							(void **)&mbuf, 1, 0);
+
+			mbuf = (struct rte_mbuf *)((uintptr_t)mbuf3 -
+						   offsetof(struct rte_mbuf,
+							    buf_iova));
+			if (cnxk_nix_prefree_seg(mbuf))
+				vsetq_lane_u64(0x80000, xmask23, 1);
+			else
+				__mempool_check_cookies(mbuf->pool,
+							(void **)&mbuf, 1, 0);
+			senddesc01_w0 = vorrq_u64(senddesc01_w0, xmask01);
+			senddesc23_w0 = vorrq_u64(senddesc23_w0, xmask23);
+		} else {
+			struct rte_mbuf *mbuf;
+			/* Mark mempool object as "put" since
+			 * it is freed by NIX
+			 */
+			mbuf = (struct rte_mbuf *)((uintptr_t)mbuf0 -
+						   offsetof(struct rte_mbuf,
+							    buf_iova));
+			__mempool_check_cookies(mbuf->pool, (void **)&mbuf, 1,
+						0);
+
+			mbuf = (struct rte_mbuf *)((uintptr_t)mbuf1 -
+						   offsetof(struct rte_mbuf,
+							    buf_iova));
+			__mempool_check_cookies(mbuf->pool, (void **)&mbuf, 1,
+						0);
+
+			mbuf = (struct rte_mbuf *)((uintptr_t)mbuf2 -
+						   offsetof(struct rte_mbuf,
+							    buf_iova));
+			__mempool_check_cookies(mbuf->pool, (void **)&mbuf, 1,
+						0);
+
+			mbuf = (struct rte_mbuf *)((uintptr_t)mbuf3 -
+						   offsetof(struct rte_mbuf,
+							    buf_iova));
+			__mempool_check_cookies(mbuf->pool, (void **)&mbuf, 1,
+						0);
+			RTE_SET_USED(mbuf);
+		}
+
+		/* Move mbufs to point pool */
+		mbuf0 = (uint64_t *)((uintptr_t)mbuf0 +
+				     offsetof(struct rte_mbuf, pool) -
+				     offsetof(struct rte_mbuf, buf_iova));
+		mbuf1 = (uint64_t *)((uintptr_t)mbuf1 +
+				     offsetof(struct rte_mbuf, pool) -
+				     offsetof(struct rte_mbuf, buf_iova));
+		mbuf2 = (uint64_t *)((uintptr_t)mbuf2 +
+				     offsetof(struct rte_mbuf, pool) -
+				     offsetof(struct rte_mbuf, buf_iova));
+		mbuf3 = (uint64_t *)((uintptr_t)mbuf3 +
+				     offsetof(struct rte_mbuf, pool) -
+				     offsetof(struct rte_mbuf, buf_iova));
+
+		if (flags & (NIX_TX_OFFLOAD_OL3_OL4_CSUM_F |
+			     NIX_TX_OFFLOAD_L3_L4_CSUM_F)) {
+			/* Get tx_offload for ol2, ol3, l2, l3 lengths */
+			/*
+			 * E(8):OL2_LEN(7):OL3_LEN(9):E(24):L3_LEN(9):L2_LEN(7)
+			 * E(8):OL2_LEN(7):OL3_LEN(9):E(24):L3_LEN(9):L2_LEN(7)
+			 */
+
+			asm volatile("LD1 {%[a].D}[0],[%[in]]\n\t"
+				     : [a] "+w"(senddesc01_w1)
+				     : [in] "r"(mbuf0 + 2)
+				     : "memory");
+
+			asm volatile("LD1 {%[a].D}[1],[%[in]]\n\t"
+				     : [a] "+w"(senddesc01_w1)
+				     : [in] "r"(mbuf1 + 2)
+				     : "memory");
+
+			asm volatile("LD1 {%[b].D}[0],[%[in]]\n\t"
+				     : [b] "+w"(senddesc23_w1)
+				     : [in] "r"(mbuf2 + 2)
+				     : "memory");
+
+			asm volatile("LD1 {%[b].D}[1],[%[in]]\n\t"
+				     : [b] "+w"(senddesc23_w1)
+				     : [in] "r"(mbuf3 + 2)
+				     : "memory");
+
+			/* Get pool pointer alone */
+			mbuf0 = (uint64_t *)*mbuf0;
+			mbuf1 = (uint64_t *)*mbuf1;
+			mbuf2 = (uint64_t *)*mbuf2;
+			mbuf3 = (uint64_t *)*mbuf3;
+		} else {
+			/* Get pool pointer alone */
+			mbuf0 = (uint64_t *)*mbuf0;
+			mbuf1 = (uint64_t *)*mbuf1;
+			mbuf2 = (uint64_t *)*mbuf2;
+			mbuf3 = (uint64_t *)*mbuf3;
+		}
+
+		const uint8x16_t shuf_mask2 = {
+			0x4, 0x5, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			0xc, 0xd, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+		};
+		xtmp128 = vzip2q_u64(len_olflags0, len_olflags1);
+		ytmp128 = vzip2q_u64(len_olflags2, len_olflags3);
+
+		/* Clear dataoff_iovaX.D[1] bits other than dataoff(15:0) */
+		const uint64x2_t and_mask0 = {
+			0xFFFFFFFFFFFFFFFF,
+			0x000000000000FFFF,
+		};
+
+		dataoff_iova0 = vandq_u64(dataoff_iova0, and_mask0);
+		dataoff_iova1 = vandq_u64(dataoff_iova1, and_mask0);
+		dataoff_iova2 = vandq_u64(dataoff_iova2, and_mask0);
+		dataoff_iova3 = vandq_u64(dataoff_iova3, and_mask0);
+
+		/*
+		 * Pick only 16 bits of pktlen preset at bits 63:32
+		 * and place them at bits 15:0.
+		 */
+		xtmp128 = vqtbl1q_u8(xtmp128, shuf_mask2);
+		ytmp128 = vqtbl1q_u8(ytmp128, shuf_mask2);
+
+		/* Add pairwise to get dataoff + iova in sgdesc_w1 */
+		sgdesc01_w1 = vpaddq_u64(dataoff_iova0, dataoff_iova1);
+		sgdesc23_w1 = vpaddq_u64(dataoff_iova2, dataoff_iova3);
+
+		/* Orr both sgdesc_w0 and senddesc_w0 with 16 bits of
+		 * pktlen at 15:0 position.
+		 */
+		sgdesc01_w0 = vorrq_u64(sgdesc01_w0, xtmp128);
+		sgdesc23_w0 = vorrq_u64(sgdesc23_w0, ytmp128);
+		senddesc01_w0 = vorrq_u64(senddesc01_w0, xtmp128);
+		senddesc23_w0 = vorrq_u64(senddesc23_w0, ytmp128);
+
+		if ((flags & NIX_TX_OFFLOAD_L3_L4_CSUM_F) &&
+		    !(flags & NIX_TX_OFFLOAD_OL3_OL4_CSUM_F)) {
+			/*
+			 * Lookup table to translate ol_flags to
+			 * il3/il4 types. But we still use ol3/ol4 types in
+			 * senddesc_w1 as only one header processing is enabled.
+			 */
+			const uint8x16_t tbl = {
+				/* [0-15] = il4type:il3type */
+				0x04, /* none (IPv6 assumed) */
+				0x14, /* PKT_TX_TCP_CKSUM (IPv6 assumed) */
+				0x24, /* PKT_TX_SCTP_CKSUM (IPv6 assumed) */
+				0x34, /* PKT_TX_UDP_CKSUM (IPv6 assumed) */
+				0x03, /* PKT_TX_IP_CKSUM */
+				0x13, /* PKT_TX_IP_CKSUM | PKT_TX_TCP_CKSUM */
+				0x23, /* PKT_TX_IP_CKSUM | PKT_TX_SCTP_CKSUM */
+				0x33, /* PKT_TX_IP_CKSUM | PKT_TX_UDP_CKSUM */
+				0x02, /* PKT_TX_IPV4  */
+				0x12, /* PKT_TX_IPV4 | PKT_TX_TCP_CKSUM */
+				0x22, /* PKT_TX_IPV4 | PKT_TX_SCTP_CKSUM */
+				0x32, /* PKT_TX_IPV4 | PKT_TX_UDP_CKSUM */
+				0x03, /* PKT_TX_IPV4 | PKT_TX_IP_CKSUM */
+				0x13, /* PKT_TX_IPV4 | PKT_TX_IP_CKSUM |
+				       * PKT_TX_TCP_CKSUM
+				       */
+				0x23, /* PKT_TX_IPV4 | PKT_TX_IP_CKSUM |
+				       * PKT_TX_SCTP_CKSUM
+				       */
+				0x33, /* PKT_TX_IPV4 | PKT_TX_IP_CKSUM |
+				       * PKT_TX_UDP_CKSUM
+				       */
+			};
+
+			/* Extract olflags to translate to iltypes */
+			xtmp128 = vzip1q_u64(len_olflags0, len_olflags1);
+			ytmp128 = vzip1q_u64(len_olflags2, len_olflags3);
+
+			/*
+			 * E(47):L3_LEN(9):L2_LEN(7+z)
+			 * E(47):L3_LEN(9):L2_LEN(7+z)
+			 */
+			senddesc01_w1 = vshlq_n_u64(senddesc01_w1, 1);
+			senddesc23_w1 = vshlq_n_u64(senddesc23_w1, 1);
+
+			/* Move OLFLAGS bits 55:52 to 51:48
+			 * with zeros preprended on the byte and rest
+			 * don't care
+			 */
+			xtmp128 = vshrq_n_u8(xtmp128, 4);
+			ytmp128 = vshrq_n_u8(ytmp128, 4);
+			/*
+			 * E(48):L3_LEN(8):L2_LEN(z+7)
+			 * E(48):L3_LEN(8):L2_LEN(z+7)
+			 */
+			const int8x16_t tshft3 = {
+				-1, 0, 8, 8, 8, 8, 8, 8,
+				-1, 0, 8, 8, 8, 8, 8, 8,
+			};
+
+			senddesc01_w1 = vshlq_u8(senddesc01_w1, tshft3);
+			senddesc23_w1 = vshlq_u8(senddesc23_w1, tshft3);
+
+			/* Do the lookup */
+			ltypes01 = vqtbl1q_u8(tbl, xtmp128);
+			ltypes23 = vqtbl1q_u8(tbl, ytmp128);
+
+			/* Just use ld1q to retrieve aura
+			 * when we don't need tx_offload
+			 */
+			mbuf0 = (uint64_t *)((uintptr_t)mbuf0 +
+					     offsetof(struct rte_mempool,
+						      pool_id));
+			mbuf1 = (uint64_t *)((uintptr_t)mbuf1 +
+					     offsetof(struct rte_mempool,
+						      pool_id));
+			mbuf2 = (uint64_t *)((uintptr_t)mbuf2 +
+					     offsetof(struct rte_mempool,
+						      pool_id));
+			mbuf3 = (uint64_t *)((uintptr_t)mbuf3 +
+					     offsetof(struct rte_mempool,
+						      pool_id));
+
+			/* Pick only relevant fields i.e Bit 48:55 of iltype
+			 * and place it in ol3/ol4type of senddesc_w1
+			 */
+			const uint8x16_t shuf_mask0 = {
+				0xFF, 0xFF, 0xFF, 0xFF, 0x6, 0xFF, 0xFF, 0xFF,
+				0xFF, 0xFF, 0xFF, 0xFF, 0xE, 0xFF, 0xFF, 0xFF,
+			};
+
+			ltypes01 = vqtbl1q_u8(ltypes01, shuf_mask0);
+			ltypes23 = vqtbl1q_u8(ltypes23, shuf_mask0);
+
+			/* Prepare ol4ptr, ol3ptr from ol3len, ol2len.
+			 * a [E(32):E(16):OL3(8):OL2(8)]
+			 * a = a + (a << 8)
+			 * a [E(32):E(16):(OL3+OL2):OL2]
+			 * => E(32):E(16)::OL4PTR(8):OL3PTR(8)
+			 */
+			senddesc01_w1 = vaddq_u8(senddesc01_w1,
+						 vshlq_n_u16(senddesc01_w1, 8));
+			senddesc23_w1 = vaddq_u8(senddesc23_w1,
+						 vshlq_n_u16(senddesc23_w1, 8));
+
+			/* Create first half of 4W cmd for 4 mbufs (sgdesc) */
+			cmd01 = vzip1q_u64(sgdesc01_w0, sgdesc01_w1);
+			cmd11 = vzip2q_u64(sgdesc01_w0, sgdesc01_w1);
+			cmd21 = vzip1q_u64(sgdesc23_w0, sgdesc23_w1);
+			cmd31 = vzip2q_u64(sgdesc23_w0, sgdesc23_w1);
+
+			xmask01 = vdupq_n_u64(0);
+			xmask23 = xmask01;
+			asm volatile("LD1 {%[a].H}[0],[%[in]]\n\t"
+				     : [a] "+w"(xmask01)
+				     : [in] "r"(mbuf0)
+				     : "memory");
+
+			asm volatile("LD1 {%[a].H}[4],[%[in]]\n\t"
+				     : [a] "+w"(xmask01)
+				     : [in] "r"(mbuf1)
+				     : "memory");
+
+			asm volatile("LD1 {%[b].H}[0],[%[in]]\n\t"
+				     : [b] "+w"(xmask23)
+				     : [in] "r"(mbuf2)
+				     : "memory");
+
+			asm volatile("LD1 {%[b].H}[4],[%[in]]\n\t"
+				     : [b] "+w"(xmask23)
+				     : [in] "r"(mbuf3)
+				     : "memory");
+			xmask01 = vshlq_n_u64(xmask01, 20);
+			xmask23 = vshlq_n_u64(xmask23, 20);
+
+			senddesc01_w0 = vorrq_u64(senddesc01_w0, xmask01);
+			senddesc23_w0 = vorrq_u64(senddesc23_w0, xmask23);
+			/* Move ltypes to senddesc*_w1 */
+			senddesc01_w1 = vorrq_u64(senddesc01_w1, ltypes01);
+			senddesc23_w1 = vorrq_u64(senddesc23_w1, ltypes23);
+
+			/* Create first half of 4W cmd for 4 mbufs (sendhdr) */
+			cmd00 = vzip1q_u64(senddesc01_w0, senddesc01_w1);
+			cmd10 = vzip2q_u64(senddesc01_w0, senddesc01_w1);
+			cmd20 = vzip1q_u64(senddesc23_w0, senddesc23_w1);
+			cmd30 = vzip2q_u64(senddesc23_w0, senddesc23_w1);
+
+		} else if (!(flags & NIX_TX_OFFLOAD_L3_L4_CSUM_F) &&
+			   (flags & NIX_TX_OFFLOAD_OL3_OL4_CSUM_F)) {
+			/*
+			 * Lookup table to translate ol_flags to
+			 * ol3/ol4 types.
+			 */
+
+			const uint8x16_t tbl = {
+				/* [0-15] = ol4type:ol3type */
+				0x00, /* none */
+				0x03, /* OUTER_IP_CKSUM */
+				0x02, /* OUTER_IPV4 */
+				0x03, /* OUTER_IPV4 | OUTER_IP_CKSUM */
+				0x04, /* OUTER_IPV6 */
+				0x00, /* OUTER_IPV6 | OUTER_IP_CKSUM */
+				0x00, /* OUTER_IPV6 | OUTER_IPV4 */
+				0x00, /* OUTER_IPV6 | OUTER_IPV4 |
+				       * OUTER_IP_CKSUM
+				       */
+				0x00, /* OUTER_UDP_CKSUM */
+				0x33, /* OUTER_UDP_CKSUM | OUTER_IP_CKSUM */
+				0x32, /* OUTER_UDP_CKSUM | OUTER_IPV4 */
+				0x33, /* OUTER_UDP_CKSUM | OUTER_IPV4 |
+				       * OUTER_IP_CKSUM
+				       */
+				0x34, /* OUTER_UDP_CKSUM | OUTER_IPV6 */
+				0x00, /* OUTER_UDP_CKSUM | OUTER_IPV6 |
+				       * OUTER_IP_CKSUM
+				       */
+				0x00, /* OUTER_UDP_CKSUM | OUTER_IPV6 |
+				       * OUTER_IPV4
+				       */
+				0x00, /* OUTER_UDP_CKSUM | OUTER_IPV6 |
+				       * OUTER_IPV4 | OUTER_IP_CKSUM
+				       */
+			};
+
+			/* Extract olflags to translate to iltypes */
+			xtmp128 = vzip1q_u64(len_olflags0, len_olflags1);
+			ytmp128 = vzip1q_u64(len_olflags2, len_olflags3);
+
+			/*
+			 * E(47):OL3_LEN(9):OL2_LEN(7+z)
+			 * E(47):OL3_LEN(9):OL2_LEN(7+z)
+			 */
+			const uint8x16_t shuf_mask5 = {
+				0x6, 0x5, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+				0xE, 0xD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+			};
+			senddesc01_w1 = vqtbl1q_u8(senddesc01_w1, shuf_mask5);
+			senddesc23_w1 = vqtbl1q_u8(senddesc23_w1, shuf_mask5);
+
+			/* Extract outer ol flags only */
+			const uint64x2_t o_cksum_mask = {
+				0x1C00020000000000,
+				0x1C00020000000000,
+			};
+
+			xtmp128 = vandq_u64(xtmp128, o_cksum_mask);
+			ytmp128 = vandq_u64(ytmp128, o_cksum_mask);
+
+			/* Extract OUTER_UDP_CKSUM bit 41 and
+			 * move it to bit 61
+			 */
+
+			xtmp128 = xtmp128 | vshlq_n_u64(xtmp128, 20);
+			ytmp128 = ytmp128 | vshlq_n_u64(ytmp128, 20);
+
+			/* Shift oltype by 2 to start nibble from BIT(56)
+			 * instead of BIT(58)
+			 */
+			xtmp128 = vshrq_n_u8(xtmp128, 2);
+			ytmp128 = vshrq_n_u8(ytmp128, 2);
+			/*
+			 * E(48):L3_LEN(8):L2_LEN(z+7)
+			 * E(48):L3_LEN(8):L2_LEN(z+7)
+			 */
+			const int8x16_t tshft3 = {
+				-1, 0, 8, 8, 8, 8, 8, 8,
+				-1, 0, 8, 8, 8, 8, 8, 8,
+			};
+
+			senddesc01_w1 = vshlq_u8(senddesc01_w1, tshft3);
+			senddesc23_w1 = vshlq_u8(senddesc23_w1, tshft3);
+
+			/* Do the lookup */
+			ltypes01 = vqtbl1q_u8(tbl, xtmp128);
+			ltypes23 = vqtbl1q_u8(tbl, ytmp128);
+
+			/* Just use ld1q to retrieve aura
+			 * when we don't need tx_offload
+			 */
+			mbuf0 = (uint64_t *)((uintptr_t)mbuf0 +
+					     offsetof(struct rte_mempool,
+						      pool_id));
+			mbuf1 = (uint64_t *)((uintptr_t)mbuf1 +
+					     offsetof(struct rte_mempool,
+						      pool_id));
+			mbuf2 = (uint64_t *)((uintptr_t)mbuf2 +
+					     offsetof(struct rte_mempool,
+						      pool_id));
+			mbuf3 = (uint64_t *)((uintptr_t)mbuf3 +
+					     offsetof(struct rte_mempool,
+						      pool_id));
+
+			/* Pick only relevant fields i.e Bit 56:63 of oltype
+			 * and place it in ol3/ol4type of senddesc_w1
+			 */
+			const uint8x16_t shuf_mask0 = {
+				0xFF, 0xFF, 0xFF, 0xFF, 0x7, 0xFF, 0xFF, 0xFF,
+				0xFF, 0xFF, 0xFF, 0xFF, 0xF, 0xFF, 0xFF, 0xFF,
+			};
+
+			ltypes01 = vqtbl1q_u8(ltypes01, shuf_mask0);
+			ltypes23 = vqtbl1q_u8(ltypes23, shuf_mask0);
+
+			/* Prepare ol4ptr, ol3ptr from ol3len, ol2len.
+			 * a [E(32):E(16):OL3(8):OL2(8)]
+			 * a = a + (a << 8)
+			 * a [E(32):E(16):(OL3+OL2):OL2]
+			 * => E(32):E(16)::OL4PTR(8):OL3PTR(8)
+			 */
+			senddesc01_w1 = vaddq_u8(senddesc01_w1,
+						 vshlq_n_u16(senddesc01_w1, 8));
+			senddesc23_w1 = vaddq_u8(senddesc23_w1,
+						 vshlq_n_u16(senddesc23_w1, 8));
+
+			/* Create second half of 4W cmd for 4 mbufs (sgdesc) */
+			cmd01 = vzip1q_u64(sgdesc01_w0, sgdesc01_w1);
+			cmd11 = vzip2q_u64(sgdesc01_w0, sgdesc01_w1);
+			cmd21 = vzip1q_u64(sgdesc23_w0, sgdesc23_w1);
+			cmd31 = vzip2q_u64(sgdesc23_w0, sgdesc23_w1);
+
+			xmask01 = vdupq_n_u64(0);
+			xmask23 = xmask01;
+			asm volatile("LD1 {%[a].H}[0],[%[in]]\n\t"
+				     : [a] "+w"(xmask01)
+				     : [in] "r"(mbuf0)
+				     : "memory");
+
+			asm volatile("LD1 {%[a].H}[4],[%[in]]\n\t"
+				     : [a] "+w"(xmask01)
+				     : [in] "r"(mbuf1)
+				     : "memory");
+
+			asm volatile("LD1 {%[b].H}[0],[%[in]]\n\t"
+				     : [b] "+w"(xmask23)
+				     : [in] "r"(mbuf2)
+				     : "memory");
+
+			asm volatile("LD1 {%[b].H}[4],[%[in]]\n\t"
+				     : [b] "+w"(xmask23)
+				     : [in] "r"(mbuf3)
+				     : "memory");
+			xmask01 = vshlq_n_u64(xmask01, 20);
+			xmask23 = vshlq_n_u64(xmask23, 20);
+
+			senddesc01_w0 = vorrq_u64(senddesc01_w0, xmask01);
+			senddesc23_w0 = vorrq_u64(senddesc23_w0, xmask23);
+			/* Move ltypes to senddesc*_w1 */
+			senddesc01_w1 = vorrq_u64(senddesc01_w1, ltypes01);
+			senddesc23_w1 = vorrq_u64(senddesc23_w1, ltypes23);
+
+			/* Create first half of 4W cmd for 4 mbufs (sendhdr) */
+			cmd00 = vzip1q_u64(senddesc01_w0, senddesc01_w1);
+			cmd10 = vzip2q_u64(senddesc01_w0, senddesc01_w1);
+			cmd20 = vzip1q_u64(senddesc23_w0, senddesc23_w1);
+			cmd30 = vzip2q_u64(senddesc23_w0, senddesc23_w1);
+
+		} else if ((flags & NIX_TX_OFFLOAD_L3_L4_CSUM_F) &&
+			   (flags & NIX_TX_OFFLOAD_OL3_OL4_CSUM_F)) {
+			/* Lookup table to translate ol_flags to
+			 * ol4type, ol3type, il4type, il3type of senddesc_w1
+			 */
+			const uint8x16x2_t tbl = {{
+				{
+					/* [0-15] = il4type:il3type */
+					0x04, /* none (IPv6) */
+					0x14, /* PKT_TX_TCP_CKSUM (IPv6) */
+					0x24, /* PKT_TX_SCTP_CKSUM (IPv6) */
+					0x34, /* PKT_TX_UDP_CKSUM (IPv6) */
+					0x03, /* PKT_TX_IP_CKSUM */
+					0x13, /* PKT_TX_IP_CKSUM |
+					       * PKT_TX_TCP_CKSUM
+					       */
+					0x23, /* PKT_TX_IP_CKSUM |
+					       * PKT_TX_SCTP_CKSUM
+					       */
+					0x33, /* PKT_TX_IP_CKSUM |
+					       * PKT_TX_UDP_CKSUM
+					       */
+					0x02, /* PKT_TX_IPV4 */
+					0x12, /* PKT_TX_IPV4 |
+					       * PKT_TX_TCP_CKSUM
+					       */
+					0x22, /* PKT_TX_IPV4 |
+					       * PKT_TX_SCTP_CKSUM
+					       */
+					0x32, /* PKT_TX_IPV4 |
+					       * PKT_TX_UDP_CKSUM
+					       */
+					0x03, /* PKT_TX_IPV4 |
+					       * PKT_TX_IP_CKSUM
+					       */
+					0x13, /* PKT_TX_IPV4 | PKT_TX_IP_CKSUM |
+					       * PKT_TX_TCP_CKSUM
+					       */
+					0x23, /* PKT_TX_IPV4 | PKT_TX_IP_CKSUM |
+					       * PKT_TX_SCTP_CKSUM
+					       */
+					0x33, /* PKT_TX_IPV4 | PKT_TX_IP_CKSUM |
+					       * PKT_TX_UDP_CKSUM
+					       */
+				},
+
+				{
+					/* [16-31] = ol4type:ol3type */
+					0x00, /* none */
+					0x03, /* OUTER_IP_CKSUM */
+					0x02, /* OUTER_IPV4 */
+					0x03, /* OUTER_IPV4 | OUTER_IP_CKSUM */
+					0x04, /* OUTER_IPV6 */
+					0x00, /* OUTER_IPV6 | OUTER_IP_CKSUM */
+					0x00, /* OUTER_IPV6 | OUTER_IPV4 */
+					0x00, /* OUTER_IPV6 | OUTER_IPV4 |
+					       * OUTER_IP_CKSUM
+					       */
+					0x00, /* OUTER_UDP_CKSUM */
+					0x33, /* OUTER_UDP_CKSUM |
+					       * OUTER_IP_CKSUM
+					       */
+					0x32, /* OUTER_UDP_CKSUM |
+					       * OUTER_IPV4
+					       */
+					0x33, /* OUTER_UDP_CKSUM |
+					       * OUTER_IPV4 | OUTER_IP_CKSUM
+					       */
+					0x34, /* OUTER_UDP_CKSUM |
+					       * OUTER_IPV6
+					       */
+					0x00, /* OUTER_UDP_CKSUM | OUTER_IPV6 |
+					       * OUTER_IP_CKSUM
+					       */
+					0x00, /* OUTER_UDP_CKSUM | OUTER_IPV6 |
+					       * OUTER_IPV4
+					       */
+					0x00, /* OUTER_UDP_CKSUM | OUTER_IPV6 |
+					       * OUTER_IPV4 | OUTER_IP_CKSUM
+					       */
+				},
+			}};
+
+			/* Extract olflags to translate to oltype & iltype */
+			xtmp128 = vzip1q_u64(len_olflags0, len_olflags1);
+			ytmp128 = vzip1q_u64(len_olflags2, len_olflags3);
+
+			/*
+			 * E(8):OL2_LN(7):OL3_LN(9):E(23):L3_LN(9):L2_LN(7+z)
+			 * E(8):OL2_LN(7):OL3_LN(9):E(23):L3_LN(9):L2_LN(7+z)
+			 */
+			const uint32x4_t tshft_4 = {
+				1,
+				0,
+				1,
+				0,
+			};
+			senddesc01_w1 = vshlq_u32(senddesc01_w1, tshft_4);
+			senddesc23_w1 = vshlq_u32(senddesc23_w1, tshft_4);
+
+			/*
+			 * E(32):L3_LEN(8):L2_LEN(7+Z):OL3_LEN(8):OL2_LEN(7+Z)
+			 * E(32):L3_LEN(8):L2_LEN(7+Z):OL3_LEN(8):OL2_LEN(7+Z)
+			 */
+			const uint8x16_t shuf_mask5 = {
+				0x6, 0x5, 0x0, 0x1, 0xFF, 0xFF, 0xFF, 0xFF,
+				0xE, 0xD, 0x8, 0x9, 0xFF, 0xFF, 0xFF, 0xFF,
+			};
+			senddesc01_w1 = vqtbl1q_u8(senddesc01_w1, shuf_mask5);
+			senddesc23_w1 = vqtbl1q_u8(senddesc23_w1, shuf_mask5);
+
+			/* Extract outer and inner header ol_flags */
+			const uint64x2_t oi_cksum_mask = {
+				0x1CF0020000000000,
+				0x1CF0020000000000,
+			};
+
+			xtmp128 = vandq_u64(xtmp128, oi_cksum_mask);
+			ytmp128 = vandq_u64(ytmp128, oi_cksum_mask);
+
+			/* Extract OUTER_UDP_CKSUM bit 41 and
+			 * move it to bit 61
+			 */
+
+			xtmp128 = xtmp128 | vshlq_n_u64(xtmp128, 20);
+			ytmp128 = ytmp128 | vshlq_n_u64(ytmp128, 20);
+
+			/* Shift right oltype by 2 and iltype by 4
+			 * to start oltype nibble from BIT(58)
+			 * instead of BIT(56) and iltype nibble from BIT(48)
+			 * instead of BIT(52).
+			 */
+			const int8x16_t tshft5 = {
+				8, 8, 8, 8, 8, 8, -4, -2,
+				8, 8, 8, 8, 8, 8, -4, -2,
+			};
+
+			xtmp128 = vshlq_u8(xtmp128, tshft5);
+			ytmp128 = vshlq_u8(ytmp128, tshft5);
+			/*
+			 * E(32):L3_LEN(8):L2_LEN(8):OL3_LEN(8):OL2_LEN(8)
+			 * E(32):L3_LEN(8):L2_LEN(8):OL3_LEN(8):OL2_LEN(8)
+			 */
+			const int8x16_t tshft3 = {
+				-1, 0, -1, 0, 0, 0, 0, 0,
+				-1, 0, -1, 0, 0, 0, 0, 0,
+			};
+
+			senddesc01_w1 = vshlq_u8(senddesc01_w1, tshft3);
+			senddesc23_w1 = vshlq_u8(senddesc23_w1, tshft3);
+
+			/* Mark Bit(4) of oltype */
+			const uint64x2_t oi_cksum_mask2 = {
+				0x1000000000000000,
+				0x1000000000000000,
+			};
+
+			xtmp128 = vorrq_u64(xtmp128, oi_cksum_mask2);
+			ytmp128 = vorrq_u64(ytmp128, oi_cksum_mask2);
+
+			/* Do the lookup */
+			ltypes01 = vqtbl2q_u8(tbl, xtmp128);
+			ltypes23 = vqtbl2q_u8(tbl, ytmp128);
+
+			/* Just use ld1q to retrieve aura
+			 * when we don't need tx_offload
+			 */
+			mbuf0 = (uint64_t *)((uintptr_t)mbuf0 +
+					     offsetof(struct rte_mempool,
+						      pool_id));
+			mbuf1 = (uint64_t *)((uintptr_t)mbuf1 +
+					     offsetof(struct rte_mempool,
+						      pool_id));
+			mbuf2 = (uint64_t *)((uintptr_t)mbuf2 +
+					     offsetof(struct rte_mempool,
+						      pool_id));
+			mbuf3 = (uint64_t *)((uintptr_t)mbuf3 +
+					     offsetof(struct rte_mempool,
+						      pool_id));
+
+			/* Pick only relevant fields i.e Bit 48:55 of iltype and
+			 * Bit 56:63 of oltype and place it in corresponding
+			 * place in senddesc_w1.
+			 */
+			const uint8x16_t shuf_mask0 = {
+				0xFF, 0xFF, 0xFF, 0xFF, 0x7, 0x6, 0xFF, 0xFF,
+				0xFF, 0xFF, 0xFF, 0xFF, 0xF, 0xE, 0xFF, 0xFF,
+			};
+
+			ltypes01 = vqtbl1q_u8(ltypes01, shuf_mask0);
+			ltypes23 = vqtbl1q_u8(ltypes23, shuf_mask0);
+
+			/* Prepare l4ptr, l3ptr, ol4ptr, ol3ptr from
+			 * l3len, l2len, ol3len, ol2len.
+			 * a [E(32):L3(8):L2(8):OL3(8):OL2(8)]
+			 * a = a + (a << 8)
+			 * a [E:(L3+L2):(L2+OL3):(OL3+OL2):OL2]
+			 * a = a + (a << 16)
+			 * a [E:(L3+L2+OL3+OL2):(L2+OL3+OL2):(OL3+OL2):OL2]
+			 * => E(32):IL4PTR(8):IL3PTR(8):OL4PTR(8):OL3PTR(8)
+			 */
+			senddesc01_w1 = vaddq_u8(senddesc01_w1,
+						 vshlq_n_u32(senddesc01_w1, 8));
+			senddesc23_w1 = vaddq_u8(senddesc23_w1,
+						 vshlq_n_u32(senddesc23_w1, 8));
+
+			/* Create second half of 4W cmd for 4 mbufs (sgdesc) */
+			cmd01 = vzip1q_u64(sgdesc01_w0, sgdesc01_w1);
+			cmd11 = vzip2q_u64(sgdesc01_w0, sgdesc01_w1);
+			cmd21 = vzip1q_u64(sgdesc23_w0, sgdesc23_w1);
+			cmd31 = vzip2q_u64(sgdesc23_w0, sgdesc23_w1);
+
+			/* Continue preparing l4ptr, l3ptr, ol4ptr, ol3ptr */
+			senddesc01_w1 = vaddq_u8(
+				senddesc01_w1, vshlq_n_u32(senddesc01_w1, 16));
+			senddesc23_w1 = vaddq_u8(
+				senddesc23_w1, vshlq_n_u32(senddesc23_w1, 16));
+
+			xmask01 = vdupq_n_u64(0);
+			xmask23 = xmask01;
+			asm volatile("LD1 {%[a].H}[0],[%[in]]\n\t"
+				     : [a] "+w"(xmask01)
+				     : [in] "r"(mbuf0)
+				     : "memory");
+
+			asm volatile("LD1 {%[a].H}[4],[%[in]]\n\t"
+				     : [a] "+w"(xmask01)
+				     : [in] "r"(mbuf1)
+				     : "memory");
+
+			asm volatile("LD1 {%[b].H}[0],[%[in]]\n\t"
+				     : [b] "+w"(xmask23)
+				     : [in] "r"(mbuf2)
+				     : "memory");
+
+			asm volatile("LD1 {%[b].H}[4],[%[in]]\n\t"
+				     : [b] "+w"(xmask23)
+				     : [in] "r"(mbuf3)
+				     : "memory");
+			xmask01 = vshlq_n_u64(xmask01, 20);
+			xmask23 = vshlq_n_u64(xmask23, 20);
+
+			senddesc01_w0 = vorrq_u64(senddesc01_w0, xmask01);
+			senddesc23_w0 = vorrq_u64(senddesc23_w0, xmask23);
+			/* Move ltypes to senddesc*_w1 */
+			senddesc01_w1 = vorrq_u64(senddesc01_w1, ltypes01);
+			senddesc23_w1 = vorrq_u64(senddesc23_w1, ltypes23);
+
+			/* Create first half of 4W cmd for 4 mbufs (sendhdr) */
+			cmd00 = vzip1q_u64(senddesc01_w0, senddesc01_w1);
+			cmd10 = vzip2q_u64(senddesc01_w0, senddesc01_w1);
+			cmd20 = vzip1q_u64(senddesc23_w0, senddesc23_w1);
+			cmd30 = vzip2q_u64(senddesc23_w0, senddesc23_w1);
+		} else {
+			/* Just use ld1q to retrieve aura
+			 * when we don't need tx_offload
+			 */
+			mbuf0 = (uint64_t *)((uintptr_t)mbuf0 +
+					     offsetof(struct rte_mempool,
+						      pool_id));
+			mbuf1 = (uint64_t *)((uintptr_t)mbuf1 +
+					     offsetof(struct rte_mempool,
+						      pool_id));
+			mbuf2 = (uint64_t *)((uintptr_t)mbuf2 +
+					     offsetof(struct rte_mempool,
+						      pool_id));
+			mbuf3 = (uint64_t *)((uintptr_t)mbuf3 +
+					     offsetof(struct rte_mempool,
+						      pool_id));
+			xmask01 = vdupq_n_u64(0);
+			xmask23 = xmask01;
+			asm volatile("LD1 {%[a].H}[0],[%[in]]\n\t"
+				     : [a] "+w"(xmask01)
+				     : [in] "r"(mbuf0)
+				     : "memory");
+
+			asm volatile("LD1 {%[a].H}[4],[%[in]]\n\t"
+				     : [a] "+w"(xmask01)
+				     : [in] "r"(mbuf1)
+				     : "memory");
+
+			asm volatile("LD1 {%[b].H}[0],[%[in]]\n\t"
+				     : [b] "+w"(xmask23)
+				     : [in] "r"(mbuf2)
+				     : "memory");
+
+			asm volatile("LD1 {%[b].H}[4],[%[in]]\n\t"
+				     : [b] "+w"(xmask23)
+				     : [in] "r"(mbuf3)
+				     : "memory");
+			xmask01 = vshlq_n_u64(xmask01, 20);
+			xmask23 = vshlq_n_u64(xmask23, 20);
+
+			senddesc01_w0 = vorrq_u64(senddesc01_w0, xmask01);
+			senddesc23_w0 = vorrq_u64(senddesc23_w0, xmask23);
+
+			/* Create 4W cmd for 4 mbufs (sendhdr, sgdesc) */
+			cmd00 = vzip1q_u64(senddesc01_w0, senddesc01_w1);
+			cmd01 = vzip1q_u64(sgdesc01_w0, sgdesc01_w1);
+			cmd10 = vzip2q_u64(senddesc01_w0, senddesc01_w1);
+			cmd11 = vzip2q_u64(sgdesc01_w0, sgdesc01_w1);
+			cmd20 = vzip1q_u64(senddesc23_w0, senddesc23_w1);
+			cmd21 = vzip1q_u64(sgdesc23_w0, sgdesc23_w1);
+			cmd30 = vzip2q_u64(senddesc23_w0, senddesc23_w1);
+			cmd31 = vzip2q_u64(sgdesc23_w0, sgdesc23_w1);
+		}
+
+		/* Store the prepared send desc to LMT lines */
+		vst1q_u64((void *)lmt_addr, cmd00);
+		vst1q_u64((void *)(lmt_addr + 16), cmd01);
+		lmt_addr += (1ULL << ROC_LMT_LINE_SIZE_LOG2);
+
+		vst1q_u64((void *)lmt_addr, cmd10);
+		vst1q_u64((void *)(lmt_addr + 16), cmd11);
+		lmt_addr += (1ULL << ROC_LMT_LINE_SIZE_LOG2);
+
+		vst1q_u64((void *)lmt_addr, cmd20);
+		vst1q_u64((void *)(lmt_addr + 16), cmd21);
+		lmt_addr += (1ULL << ROC_LMT_LINE_SIZE_LOG2);
+
+		vst1q_u64((void *)lmt_addr, cmd30);
+		vst1q_u64((void *)(lmt_addr + 16), cmd31);
+		lmt_addr += (1ULL << ROC_LMT_LINE_SIZE_LOG2);
+
+		tx_pkts = tx_pkts + NIX_DESCS_PER_LOOP;
+	}
+
+	/* Trigger LMTST */
+	if (burst > 16) {
+		data = cn10k_nix_tx_steor_data(flags);
+		pa = io_addr | (data & 0x7) << 4;
+		data &= ~0x7ULL;
+		data |= (15ULL << 12);
+		data |= (uint64_t)lmt_id;
+
+		/* STEOR0 */
+		roc_lmt_submit_steorl(data, pa);
+
+		data = cn10k_nix_tx_steor_data(flags);
+		pa = io_addr | (data & 0x7) << 4;
+		data &= ~0x7ULL;
+		data |= ((uint64_t)(burst - 17)) << 12;
+		data |= (uint64_t)(lmt_id + 16);
+
+		/* STEOR1 */
+		roc_lmt_submit_steorl(data, pa);
+	} else if (burst) {
+		data = cn10k_nix_tx_steor_data(flags);
+		pa = io_addr | (data & 0x7) << 4;
+		data &= ~0x7ULL;
+		data |= ((uint64_t)(burst - 1)) << 12;
+		data |= lmt_id;
+
+		/* STEOR0 */
+		roc_lmt_submit_steorl(data, pa);
+	}
+
+	left -= burst;
+	rte_io_wmb();
+	if (left) {
+		/* Reset lmt base addr to start another burst */
+		lmt_addr -= (1ULL << ROC_LMT_LINE_SIZE_LOG2);
+		lmt_addr &= (~(BIT_ULL(ROC_LMT_BASE_PER_CORE_LOG2) - 1));
+		goto again;
+	}
+
+	if (unlikely(scalar))
+		pkts += nix_xmit_pkts(tx_queue, tx_pkts, scalar, cmd, flags);
+
+	return pkts;
+}
+
+#else
+static __rte_always_inline uint16_t
+nix_xmit_pkts_vector(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t pkts,
+		     uint64_t *cmd, const uint16_t flags)
+{
+	RTE_SET_USED(tx_queue);
+	RTE_SET_USED(tx_pkts);
+	RTE_SET_USED(pkts);
+	RTE_SET_USED(cmd);
+	RTE_SET_USED(flags);
+	return 0;
+}
+#endif
 
 #define T(name, f4, f3, f2, f1, f0, sz, flags)				       \
 	static uint16_t __rte_noinline __rte_hot cn10k_nix_xmit_pkts_##name(   \
@@ -253,6 +1207,25 @@ NIX_TX_FASTPATH_MODES
 NIX_TX_FASTPATH_MODES
 #undef T
 
+#define T(name, f4, f3, f2, f1, f0, sz, flags)				       \
+	static uint16_t __rte_noinline __rte_hot                               \
+		cn10k_nix_xmit_pkts_vec_##name(void *tx_queue,                 \
+					       struct rte_mbuf **tx_pkts,      \
+					       uint16_t pkts)                  \
+	{                                                                      \
+		uint64_t cmd[sz];                                              \
+									       \
+		/* VLAN, TSTMP, TSO is not supported by vec */                 \
+		if ((flags) & NIX_TX_OFFLOAD_VLAN_QINQ_F ||		       \
+		    (flags) & NIX_TX_OFFLOAD_TSO_F)			       \
+			return 0;                                              \
+		return nix_xmit_pkts_vector(tx_queue, tx_pkts, pkts, cmd,      \
+					    (flags));                          \
+	}
+
+NIX_TX_FASTPATH_MODES
+#undef T
+
 static inline void
 pick_tx_func(struct rte_eth_dev *eth_dev,
 	     const eth_tx_burst_t tx_burst[2][2][2][2][2])
@@ -289,7 +1262,20 @@ cn10k_eth_set_tx_function(struct rte_eth_dev *eth_dev)
 #undef T
 	};
 
-	pick_tx_func(eth_dev, nix_eth_tx_burst);
+	const eth_tx_burst_t nix_eth_tx_vec_burst[2][2][2][2][2] = {
+#define T(name, f4, f3, f2, f1, f0, sz, flags)                         \
+	[f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_vec_##name,
+
+		NIX_TX_FASTPATH_MODES
+#undef T
+	};
+
+	if (dev->scalar_ena ||
+	    (dev->tx_offload_flags &
+	     (NIX_TX_OFFLOAD_VLAN_QINQ_F | NIX_TX_OFFLOAD_TSO_F)))
+		pick_tx_func(eth_dev, nix_eth_tx_burst);
+	else
+		pick_tx_func(eth_dev, nix_eth_tx_vec_burst);
 
 	if (dev->tx_offloads & DEV_TX_OFFLOAD_MULTI_SEGS)
 		pick_tx_func(eth_dev, nix_eth_tx_burst_mseg);
Signature · 1 line
2.8.4
#23 lore raw

PATCH 23/44 net/cnxk: add device start and stop operations

In reply to Nithin Dabilpuram

Add device start and stop operation callbacks for CN9K and CN10K. Device stop is common for both platforms while device start as some platform dependent portion where the platform specific offload flags are recomputed and the right Rx/Tx burst function is chosen.

---
 doc/guides/nics/cnxk.rst        |  84 ++++++++++++++++++++++++++
 drivers/net/cnxk/cn10k_ethdev.c | 124 +++++++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cn9k_ethdev.c  | 127 ++++++++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cnxk_ethdev.c  |  90 ++++++++++++++++++++++++++++
 drivers/net/cnxk/cnxk_ethdev.h  |   2 +
 drivers/net/cnxk/cnxk_link.c    |  11 ++++
 6 files changed, 438 insertions(+)
doc/guides/nics/cnxk.rst +84 -0
index 555730d..42aa7a5 100644
@@ -39,6 +39,58 @@ Driver compilation and testing
 Refer to the document :ref:`compiling and testing a PMD for a NIC <pmd_build_and_test>`
 for details.
 
+#. Running testpmd:
+
+   Follow instructions available in the document
+   :ref:`compiling and testing a PMD for a NIC <pmd_build_and_test>`
+   to run testpmd.
+
+   Example output:
+
+   .. code-block:: console
+
+      ./<build_dir>/app/dpdk-testpmd -c 0xc -a 0002:02:00.0 -- --portmask=0x1 --nb-cores=1 --port-topology=loop --rxq=1 --txq=1
+      EAL: Detected 4 lcore(s)
+      EAL: Detected 1 NUMA nodes
+      EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
+      EAL: Selected IOVA mode 'VA'
+      EAL: No available hugepages reported in hugepages-16777216kB
+      EAL: No available hugepages reported in hugepages-2048kB
+      EAL: Probing VFIO support...
+      EAL: VFIO support initialized
+      EAL:   using IOMMU type 1 (Type 1)
+      [ 2003.202721] vfio-pci 0002:02:00.0: vfio_cap_init: hiding cap 0x14@0x98
+      EAL: Probe PCI driver: net_cn10k (177d:a063) device: 0002:02:00.0 (socket 0)
+      PMD: RoC Model: cn10k
+      EAL: No legacy callbacks, legacy socket not created
+      testpmd: create a new mbuf pool <mb_pool_0>: n=155456, size=2176, socket=0
+      testpmd: preferred mempool ops selected: cn10k_mempool_ops
+      Configuring Port 0 (socket 0)
+      PMD: Port 0: Link Up - speed 25000 Mbps - full-duplex
+
+      Port 0: link state change event
+      Port 0: 96:D4:99:72:A5:BF
+      Checking link statuses...
+      Done
+      No commandline core given, start packet forwarding
+      io packet forwarding - ports=1 - cores=1 - streams=1 - NUMA support enabled, MP allocation mode: native
+      Logical Core 3 (socket 0) forwards packets on 1 streams:
+        RX P=0/Q=0 (socket 0) -> TX P=0/Q=0 (socket 0) peer=02:00:00:00:00:00
+
+        io packet forwarding packets/burst=32
+        nb forwarding cores=1 - nb forwarding ports=1
+        port 0: RX queue number: 1 Tx queue number: 1
+          Rx offloads=0x0 Tx offloads=0x10000
+          RX queue: 0
+            RX desc=4096 - RX free threshold=0
+            RX threshold registers: pthresh=0 hthresh=0  wthresh=0
+            RX Offloads=0x0
+          TX queue: 0
+            TX desc=512 - TX free threshold=0
+            TX threshold registers: pthresh=0 hthresh=0  wthresh=0
+            TX offloads=0x0 - TX RS bit threshold=0
+      Press enter to exit
+
 Runtime Config Options
 ----------------------
 
@@ -132,3 +184,35 @@ Runtime Config Options
    Above devarg parameters are configurable per device, user needs to pass the
    parameters to all the PCIe devices if application requires to configure on
    all the ethdev ports.
+
+Limitations
+-----------
+
+``mempool_cnxk`` external mempool handler dependency
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The OCTEON CN9K/CN10K SoC family NIC has inbuilt HW assisted external mempool manager.
+``net_cnxk`` pmd only works with ``mempool_cnxk`` mempool handler
+as it is performance wise most effective way for packet allocation and Tx buffer
+recycling on OCTEON TX2 SoC platform.
+
+CRC stripping
+~~~~~~~~~~~~~
+
+The OCTEON CN9K/CN10K SoC family NICs strip the CRC for every packet being received by
+the host interface irrespective of the offload configuration.
+
+Debugging Options
+-----------------
+
+.. _table_cnxk_ethdev_debug_options:
+
+.. table:: cnxk ethdev debug options
+
+   +---+------------+-------------------------------------------------------+
+   | # | Component  | EAL log command                                       |
+   +===+============+=======================================================+
+   | 1 | NIX        | --log-level='pmd\.net.cnxk,8'                         |
+   +---+------------+-------------------------------------------------------+
+   | 2 | NPC        | --log-level='pmd\.net.cnxk\.flow,8'                   |
+   +---+------------+-------------------------------------------------------+
drivers/net/cnxk/cn10k_ethdev.c +124 -0

160 lines not on this page · raw message

drivers/net/cnxk/cn9k_ethdev.c +127 -0

163 lines not on this page · raw message

drivers/net/cnxk/cnxk_ethdev.c +90 -0

102 lines not on this page · raw message

drivers/net/cnxk/cnxk_ethdev.h +2 -0
index 2f31cba..984f4fe 100644
@@ -214,6 +214,7 @@ int cnxk_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 			    const struct rte_eth_rxconf *rx_conf,
 			    struct rte_mempool *mp);
 int cnxk_nix_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t qid);
+int cnxk_nix_dev_start(struct rte_eth_dev *eth_dev);
 
 uint64_t cnxk_nix_rxq_mbuf_setup(struct cnxk_eth_dev *dev);
 
@@ -222,6 +223,7 @@ uint32_t cnxk_rss_ethdev_to_nix(struct cnxk_eth_dev *dev, uint64_t ethdev_rss,
 				uint8_t rss_level);
 
 /* Link */
+void cnxk_nix_toggle_flag_link_cfg(struct cnxk_eth_dev *dev, bool set);
 void cnxk_eth_dev_link_status_cb(struct roc_nix *nix,
 				 struct roc_nix_link_info *link);
 int cnxk_nix_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete);
drivers/net/cnxk/cnxk_link.c +11 -0
index 0223d68..8728eb1 100644
@@ -4,6 +4,17 @@
 
 #include "cnxk_ethdev.h"
 
+void
+cnxk_nix_toggle_flag_link_cfg(struct cnxk_eth_dev *dev, bool set)
+{
+	if (set)
+		dev->flags |= CNXK_LINK_CFG_IN_PROGRESS_F;
+	else
+		dev->flags &= ~CNXK_LINK_CFG_IN_PROGRESS_F;
+
+	rte_wmb();
+}
+
 static inline int
 nix_wait_for_link_cfg(struct cnxk_eth_dev *dev)
 {
Signature · 1 line
2.8.4
#24 lore raw

PATCH 24/44 net/cnxk: add MAC address set ops

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

Default mac address set operation is implemented for cn9k and cn10k platforms.

---
 drivers/net/cnxk/cnxk_ethdev.c     |  1 +
 drivers/net/cnxk/cnxk_ethdev.h     |  2 ++
 drivers/net/cnxk/cnxk_ethdev_ops.c | 29 +++++++++++++++++++++++++++++
 3 files changed, 32 insertions(+)
drivers/net/cnxk/cnxk_ethdev.c +1 -0
index ba05711..ed01087 100644
@@ -999,6 +999,7 @@ cnxk_nix_dev_start(struct rte_eth_dev *eth_dev)
 
 /* CNXK platform independent eth dev ops */
 struct eth_dev_ops cnxk_eth_dev_ops = {
+	.mac_addr_set = cnxk_nix_mac_addr_set,
 	.dev_infos_get = cnxk_nix_info_get,
 	.link_update = cnxk_nix_link_update,
 	.tx_queue_release = cnxk_nix_tx_queue_release,
drivers/net/cnxk/cnxk_ethdev.h +2 -0
index 984f4fe..717a8d8 100644
@@ -203,6 +203,8 @@ extern struct eth_dev_ops cnxk_eth_dev_ops;
 int cnxk_nix_probe(struct rte_pci_driver *pci_drv,
 		   struct rte_pci_device *pci_dev);
 int cnxk_nix_remove(struct rte_pci_device *pci_dev);
+int cnxk_nix_mac_addr_set(struct rte_eth_dev *eth_dev,
+			  struct rte_ether_addr *addr);
 int cnxk_nix_info_get(struct rte_eth_dev *eth_dev,
 		      struct rte_eth_dev_info *dev_info);
 int cnxk_nix_configure(struct rte_eth_dev *eth_dev);
drivers/net/cnxk/cnxk_ethdev_ops.c +29 -0
index 4a45956..87cf4ee 100644
@@ -69,3 +69,32 @@ cnxk_nix_info_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *devinfo)
 			    RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP;
 	return 0;
 }
+
+int
+cnxk_nix_mac_addr_set(struct rte_eth_dev *eth_dev, struct rte_ether_addr *addr)
+{
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	struct roc_nix *nix = &dev->nix;
+	int rc;
+
+	/* Update mac address at NPC */
+	rc = roc_nix_npc_mac_addr_set(nix, addr->addr_bytes);
+	if (rc)
+		goto exit;
+
+	/* Update mac address at CGX for PFs only */
+	if (!roc_nix_is_vf_or_sdp(nix)) {
+		rc = roc_nix_mac_addr_set(nix, addr->addr_bytes);
+		if (rc) {
+			/* Rollback to previous mac address */
+			roc_nix_npc_mac_addr_set(nix, dev->mac_addr);
+			goto exit;
+		}
+	}
+
+	/* Update mac address to cnxk ethernet device */
+	rte_memcpy(dev->mac_addr, addr->addr_bytes, RTE_ETHER_ADDR_LEN);
+
+exit:
+	return rc;
+}
Signature · 1 line
2.8.4
#25 lore raw

PATCH 25/44 net/cnxk: add MTU set device operation

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

This Patch implements mtu set dev op for cn9k and cn10k platforms.

---
 doc/guides/nics/cnxk.rst              |  1 +
 doc/guides/nics/features/cnxk.ini     |  1 +
 doc/guides/nics/features/cnxk_vec.ini |  1 +
 doc/guides/nics/features/cnxk_vf.ini  |  1 +
 drivers/net/cnxk/cnxk_ethdev.c        | 51 +++++++++++++++++++++++
 drivers/net/cnxk/cnxk_ethdev.h        |  5 ++-
 drivers/net/cnxk/cnxk_ethdev_ops.c    | 77 ++++++++++++++++++++++++++++++++++-
 7 files changed, 135 insertions(+), 2 deletions(-)
doc/guides/nics/cnxk.rst +1 -0
index 42aa7a5..6cb90a7 100644
@@ -24,6 +24,7 @@ Features of the CNXK Ethdev PMD are:
 - Receiver Side Scaling (RSS)
 - Inner and Outer Checksum offload
 - Link state information
+- MTU update
 - Scatter-Gather IO support
 - Vector Poll mode driver
 
doc/guides/nics/features/cnxk.ini +1 -0
index 02be26b..6fef725 100644
@@ -15,6 +15,7 @@ Runtime Tx queue setup = Y
 Fast mbuf free       = Y
 Free Tx mbuf on demand = Y
 Queue start/stop     = Y
+MTU update           = Y
 TSO                  = Y
 RSS hash             = Y
 Inner RSS            = Y
doc/guides/nics/features/cnxk_vec.ini +1 -0
index 8c63853..79cb1e2 100644
@@ -15,6 +15,7 @@ Runtime Tx queue setup = Y
 Fast mbuf free       = Y
 Free Tx mbuf on demand = Y
 Queue start/stop     = Y
+MTU update           = Y
 RSS hash             = Y
 Inner RSS            = Y
 Jumbo frame          = Y
doc/guides/nics/features/cnxk_vf.ini +1 -0
index a1bd49b..5cc9f3f 100644
@@ -14,6 +14,7 @@ Runtime Tx queue setup = Y
 Fast mbuf free       = Y
 Free Tx mbuf on demand = Y
 Queue start/stop     = Y
+MTU update           = Y
 TSO                  = Y
 RSS hash             = Y
 Inner RSS            = Y
drivers/net/cnxk/cnxk_ethdev.c +51 -0

69 lines not on this page · raw message

drivers/net/cnxk/cnxk_ethdev.h +4 -1
index 717a8d8..3838573 100644
@@ -28,7 +28,9 @@
 #define CNXK_NIX_MAX_VTAG_ACT_SIZE (4 * CNXK_NIX_MAX_VTAG_INS)
 
 /* ETH_HLEN+ETH_FCS+2*VLAN_HLEN */
-#define CNXK_NIX_L2_OVERHEAD (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + 8)
+#define CNXK_NIX_L2_OVERHEAD (RTE_ETHER_HDR_LEN + \
+			      RTE_ETHER_CRC_LEN + \
+			      CNXK_NIX_MAX_VTAG_ACT_SIZE)
 
 #define CNXK_NIX_RX_MIN_DESC	    16
 #define CNXK_NIX_RX_MIN_DESC_ALIGN  16
@@ -203,6 +205,7 @@ extern struct eth_dev_ops cnxk_eth_dev_ops;
 int cnxk_nix_probe(struct rte_pci_driver *pci_drv,
 		   struct rte_pci_device *pci_dev);
 int cnxk_nix_remove(struct rte_pci_device *pci_dev);
+int cnxk_nix_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu);
 int cnxk_nix_mac_addr_set(struct rte_eth_dev *eth_dev,
 			  struct rte_ether_addr *addr);
 int cnxk_nix_info_get(struct rte_eth_dev *eth_dev,
drivers/net/cnxk/cnxk_ethdev_ops.c +76 -1

86 lines not on this page · raw message

Signature · 1 line
2.8.4
#26 lore raw

PATCH 26/44 net/cnxk: add promiscuous mode enable and disable

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

Add device operations to enable and disable promisc mode for cn9k and cn10k.

---
 doc/guides/nics/cnxk.rst              |  1 +
 doc/guides/nics/features/cnxk.ini     |  1 +
 doc/guides/nics/features/cnxk_vec.ini |  1 +
 drivers/net/cnxk/cnxk_ethdev.c        |  2 ++
 drivers/net/cnxk/cnxk_ethdev.h        |  2 ++
 drivers/net/cnxk/cnxk_ethdev_ops.c    | 56 +++++++++++++++++++++++++++++++++++
 6 files changed, 63 insertions(+)
doc/guides/nics/cnxk.rst +1 -0
index 6cb90a7..364e511 100644
@@ -17,6 +17,7 @@ Features
 Features of the CNXK Ethdev PMD are:
 
 - Packet type information
+- Promiscuous mode
 - Jumbo frames
 - SR-IOV VF
 - Lock-free Tx queue
doc/guides/nics/features/cnxk.ini +1 -0
index 6fef725..9b2e163 100644
@@ -17,6 +17,7 @@ Free Tx mbuf on demand = Y
 Queue start/stop     = Y
 MTU update           = Y
 TSO                  = Y
+Promiscuous mode     = Y
 RSS hash             = Y
 Inner RSS            = Y
 Jumbo frame          = Y
doc/guides/nics/features/cnxk_vec.ini +1 -0
index 79cb1e2..31471e0 100644
@@ -16,6 +16,7 @@ Fast mbuf free       = Y
 Free Tx mbuf on demand = Y
 Queue start/stop     = Y
 MTU update           = Y
+Promiscuous mode     = Y
 RSS hash             = Y
 Inner RSS            = Y
 Jumbo frame          = Y
drivers/net/cnxk/cnxk_ethdev.c +2 -0
index 9040ce6..8d16dec 100644
@@ -1060,6 +1060,8 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
 	.rx_queue_start = cnxk_nix_rx_queue_start,
 	.rx_queue_stop = cnxk_nix_rx_queue_stop,
 	.dev_supported_ptypes_get = cnxk_nix_supported_ptypes_get,
+	.promiscuous_enable = cnxk_nix_promisc_enable,
+	.promiscuous_disable = cnxk_nix_promisc_disable,
 };
 
 static int
drivers/net/cnxk/cnxk_ethdev.h +2 -0
index 3838573..73aef34 100644
@@ -208,6 +208,8 @@ int cnxk_nix_remove(struct rte_pci_device *pci_dev);
 int cnxk_nix_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu);
 int cnxk_nix_mac_addr_set(struct rte_eth_dev *eth_dev,
 			  struct rte_ether_addr *addr);
+int cnxk_nix_promisc_enable(struct rte_eth_dev *eth_dev);
+int cnxk_nix_promisc_disable(struct rte_eth_dev *eth_dev);
 int cnxk_nix_info_get(struct rte_eth_dev *eth_dev,
 		      struct rte_eth_dev_info *dev_info);
 int cnxk_nix_configure(struct rte_eth_dev *eth_dev);
drivers/net/cnxk/cnxk_ethdev_ops.c +56 -0

59 lines not on this page · raw message

Signature · 1 line
2.8.4
#27 lore raw

PATCH 27/44 net/cnxk: add DMAC filter support

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

DMAC filter support is added for cn9k and cn10k platforms.

---
 doc/guides/nics/cnxk.rst              |  1 +
 doc/guides/nics/features/cnxk.ini     |  1 +
 doc/guides/nics/features/cnxk_vec.ini |  1 +
 drivers/net/cnxk/cnxk_ethdev.c        |  2 ++
 drivers/net/cnxk/cnxk_ethdev.h        |  5 ++++
 drivers/net/cnxk/cnxk_ethdev_ops.c    | 44 ++++++++++++++++++++++++++++++++---
 6 files changed, 51 insertions(+), 3 deletions(-)
doc/guides/nics/cnxk.rst +1 -0
index 364e511..ce33f17 100644
@@ -23,6 +23,7 @@ Features of the CNXK Ethdev PMD are:
 - Lock-free Tx queue
 - Multiple queues for TX and RX
 - Receiver Side Scaling (RSS)
+- MAC filtering
 - Inner and Outer Checksum offload
 - Link state information
 - MTU update
doc/guides/nics/features/cnxk.ini +1 -0
index 9b2e163..20d4d12 100644
@@ -18,6 +18,7 @@ Queue start/stop     = Y
 MTU update           = Y
 TSO                  = Y
 Promiscuous mode     = Y
+Unicast MAC filter   = Y
 RSS hash             = Y
 Inner RSS            = Y
 Jumbo frame          = Y
doc/guides/nics/features/cnxk_vec.ini +1 -0
index 31471e0..e1de8ab 100644
@@ -17,6 +17,7 @@ Free Tx mbuf on demand = Y
 Queue start/stop     = Y
 MTU update           = Y
 Promiscuous mode     = Y
+Unicast MAC filter   = Y
 RSS hash             = Y
 Inner RSS            = Y
 Jumbo frame          = Y
drivers/net/cnxk/cnxk_ethdev.c +2 -0
index 8d16dec..171418a 100644
@@ -1050,6 +1050,8 @@ cnxk_nix_dev_start(struct rte_eth_dev *eth_dev)
 /* CNXK platform independent eth dev ops */
 struct eth_dev_ops cnxk_eth_dev_ops = {
 	.mtu_set = cnxk_nix_mtu_set,
+	.mac_addr_add = cnxk_nix_mac_addr_add,
+	.mac_addr_remove = cnxk_nix_mac_addr_del,
 	.mac_addr_set = cnxk_nix_mac_addr_set,
 	.dev_infos_get = cnxk_nix_info_get,
 	.link_update = cnxk_nix_link_update,
drivers/net/cnxk/cnxk_ethdev.h +5 -0
index 73aef34..38ac654 100644
@@ -139,6 +139,7 @@ struct cnxk_eth_dev {
 
 	/* Max macfilter entries */
 	uint8_t max_mac_entries;
+	bool dmac_filter_enable;
 
 	uint16_t flags;
 	uint8_t ptype_disable;
@@ -206,6 +207,10 @@ int cnxk_nix_probe(struct rte_pci_driver *pci_drv,
 		   struct rte_pci_device *pci_dev);
 int cnxk_nix_remove(struct rte_pci_device *pci_dev);
 int cnxk_nix_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu);
+int cnxk_nix_mac_addr_add(struct rte_eth_dev *eth_dev,
+			  struct rte_ether_addr *addr, uint32_t index,
+			  uint32_t pool);
+void cnxk_nix_mac_addr_del(struct rte_eth_dev *eth_dev, uint32_t index);
 int cnxk_nix_mac_addr_set(struct rte_eth_dev *eth_dev,
 			  struct rte_ether_addr *addr);
 int cnxk_nix_promisc_enable(struct rte_eth_dev *eth_dev);
drivers/net/cnxk/cnxk_ethdev_ops.c +41 -3

64 lines not on this page · raw message

Signature · 1 line
2.8.4
#28 lore raw

PATCH 28/44 net/cnxk: add all multicast enable/disable ethops

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

L2 multicast packets can be allowed or blocked. Patch implements corresponding ethops.

---
 doc/guides/nics/features/cnxk.ini     |  1 +
 doc/guides/nics/features/cnxk_vec.ini |  1 +
 drivers/net/cnxk/cnxk_ethdev.c        |  2 ++
 drivers/net/cnxk/cnxk_ethdev.h        |  2 ++
 drivers/net/cnxk/cnxk_ethdev_ops.c    | 17 +++++++++++++++++
 5 files changed, 23 insertions(+)
doc/guides/nics/features/cnxk.ini +1 -0
index 20d4d12..b41af2d 100644
@@ -18,6 +18,7 @@ Queue start/stop     = Y
 MTU update           = Y
 TSO                  = Y
 Promiscuous mode     = Y
+Allmulticast mode    = Y
 Unicast MAC filter   = Y
 RSS hash             = Y
 Inner RSS            = Y
doc/guides/nics/features/cnxk_vec.ini +1 -0
index e1de8ab..7fe8018 100644
@@ -17,6 +17,7 @@ Free Tx mbuf on demand = Y
 Queue start/stop     = Y
 MTU update           = Y
 Promiscuous mode     = Y
+Allmulticast mode    = Y
 Unicast MAC filter   = Y
 RSS hash             = Y
 Inner RSS            = Y
drivers/net/cnxk/cnxk_ethdev.c +2 -0
index 171418a..77a8c09 100644
@@ -1064,6 +1064,8 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
 	.dev_supported_ptypes_get = cnxk_nix_supported_ptypes_get,
 	.promiscuous_enable = cnxk_nix_promisc_enable,
 	.promiscuous_disable = cnxk_nix_promisc_disable,
+	.allmulticast_enable = cnxk_nix_allmulticast_enable,
+	.allmulticast_disable = cnxk_nix_allmulticast_disable,
 };
 
 static int
drivers/net/cnxk/cnxk_ethdev.h +2 -0
index 38ac654..09031e9 100644
@@ -215,6 +215,8 @@ int cnxk_nix_mac_addr_set(struct rte_eth_dev *eth_dev,
 			  struct rte_ether_addr *addr);
 int cnxk_nix_promisc_enable(struct rte_eth_dev *eth_dev);
 int cnxk_nix_promisc_disable(struct rte_eth_dev *eth_dev);
+int cnxk_nix_allmulticast_enable(struct rte_eth_dev *eth_dev);
+int cnxk_nix_allmulticast_disable(struct rte_eth_dev *eth_dev);
 int cnxk_nix_info_get(struct rte_eth_dev *eth_dev,
 		      struct rte_eth_dev_info *dev_info);
 int cnxk_nix_configure(struct rte_eth_dev *eth_dev);
drivers/net/cnxk/cnxk_ethdev_ops.c +17 -0
index fc60576..61ecbab 100644
@@ -267,3 +267,20 @@ cnxk_nix_promisc_disable(struct rte_eth_dev *eth_dev)
 	dev->dmac_filter_enable = false;
 	return 0;
 }
+
+int
+cnxk_nix_allmulticast_enable(struct rte_eth_dev *eth_dev)
+{
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+
+	return roc_nix_npc_mcast_config(&dev->nix, true, false);
+}
+
+int
+cnxk_nix_allmulticast_disable(struct rte_eth_dev *eth_dev)
+{
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+
+	return roc_nix_npc_mcast_config(&dev->nix, false,
+					eth_dev->data->promiscuous);
+}
Signature · 1 line
2.8.4
#29 lore raw

PATCH 29/44 net/cnxk: add Rx/Tx burst mode get ops

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

Patch implements ethdev operations to get Rx and Tx burst mode.

---
 doc/guides/nics/features/cnxk.ini     |   1 +
 doc/guides/nics/features/cnxk_vec.ini |   1 +
 doc/guides/nics/features/cnxk_vf.ini  |   1 +
 drivers/net/cnxk/cnxk_ethdev.c        |   2 +
 drivers/net/cnxk/cnxk_ethdev.h        |   4 ++
 drivers/net/cnxk/cnxk_ethdev_ops.c    | 127 ++++++++++++++++++++++++++++++++++
 6 files changed, 136 insertions(+)
doc/guides/nics/features/cnxk.ini +1 -0
index b41af2d..298f167 100644
@@ -12,6 +12,7 @@ Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
+Burst mode info      = Y
 Fast mbuf free       = Y
 Free Tx mbuf on demand = Y
 Queue start/stop     = Y
doc/guides/nics/features/cnxk_vec.ini +1 -0
index 7fe8018..a673cc1 100644
@@ -12,6 +12,7 @@ Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
+Burst mode info      = Y
 Fast mbuf free       = Y
 Free Tx mbuf on demand = Y
 Queue start/stop     = Y
doc/guides/nics/features/cnxk_vf.ini +1 -0
index 5cc9f3f..335d082 100644
@@ -11,6 +11,7 @@ Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
+Burst mode info      = Y
 Fast mbuf free       = Y
 Free Tx mbuf on demand = Y
 Queue start/stop     = Y
drivers/net/cnxk/cnxk_ethdev.c +2 -0
index 77a8c09..28fcf8c 100644
@@ -1066,6 +1066,8 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
 	.promiscuous_disable = cnxk_nix_promisc_disable,
 	.allmulticast_enable = cnxk_nix_allmulticast_enable,
 	.allmulticast_disable = cnxk_nix_allmulticast_disable,
+	.rx_burst_mode_get = cnxk_nix_rx_burst_mode_get,
+	.tx_burst_mode_get = cnxk_nix_tx_burst_mode_get,
 };
 
 static int
drivers/net/cnxk/cnxk_ethdev.h +4 -0
index 09031e9..481ede9 100644
@@ -219,6 +219,10 @@ int cnxk_nix_allmulticast_enable(struct rte_eth_dev *eth_dev);
 int cnxk_nix_allmulticast_disable(struct rte_eth_dev *eth_dev);
 int cnxk_nix_info_get(struct rte_eth_dev *eth_dev,
 		      struct rte_eth_dev_info *dev_info);
+int cnxk_nix_rx_burst_mode_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
+			       struct rte_eth_burst_mode *mode);
+int cnxk_nix_tx_burst_mode_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
+			       struct rte_eth_burst_mode *mode);
 int cnxk_nix_configure(struct rte_eth_dev *eth_dev);
 int cnxk_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 			    uint16_t nb_desc, uint16_t fp_tx_q_sz,
drivers/net/cnxk/cnxk_ethdev_ops.c +127 -0

133 lines not on this page · raw message

Signature · 1 line
2.8.4
#30 lore raw

PATCH 30/44 net/cnxk: add flow ctrl set/get ops

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

Patch implements set and get operations for flow control.

---
 doc/guides/nics/cnxk.rst              |  1 +
 doc/guides/nics/features/cnxk.ini     |  1 +
 doc/guides/nics/features/cnxk_vec.ini |  1 +
 drivers/net/cnxk/cnxk_ethdev.c        | 74 +++++++++++++++++++++++++++
 drivers/net/cnxk/cnxk_ethdev.h        | 13 +++++
 drivers/net/cnxk/cnxk_ethdev_ops.c    | 95 +++++++++++++++++++++++++++++++++++
 6 files changed, 185 insertions(+)
doc/guides/nics/cnxk.rst +1 -0
index ce33f17..96b2c5d 100644
@@ -26,6 +26,7 @@ Features of the CNXK Ethdev PMD are:
 - MAC filtering
 - Inner and Outer Checksum offload
 - Link state information
+- Link flow control
 - MTU update
 - Scatter-Gather IO support
 - Vector Poll mode driver
doc/guides/nics/features/cnxk.ini +1 -0
index 298f167..afd0f01 100644
@@ -23,6 +23,7 @@ Allmulticast mode    = Y
 Unicast MAC filter   = Y
 RSS hash             = Y
 Inner RSS            = Y
+Flow control         = Y
 Jumbo frame          = Y
 Scattered Rx         = Y
 L3 checksum offload  = Y
doc/guides/nics/features/cnxk_vec.ini +1 -0
index a673cc1..4bd11ce 100644
@@ -22,6 +22,7 @@ Allmulticast mode    = Y
 Unicast MAC filter   = Y
 RSS hash             = Y
 Inner RSS            = Y
+Flow control         = Y
 Jumbo frame          = Y
 L3 checksum offload  = Y
 L4 checksum offload  = Y
drivers/net/cnxk/cnxk_ethdev.c +74 -0

104 lines not on this page · raw message

drivers/net/cnxk/cnxk_ethdev.h +13 -0
index 481ede9..77139d0 100644
@@ -113,6 +113,12 @@
 	((1ull << (PKT_TX_TUNNEL_VXLAN >> 45)) |                               \
 	 (1ull << (PKT_TX_TUNNEL_GENEVE >> 45)))
 
+struct cnxk_fc_cfg {
+	enum rte_eth_fc_mode mode;
+	uint8_t rx_pause;
+	uint8_t tx_pause;
+};
+
 struct cnxk_eth_qconf {
 	union {
 		struct rte_eth_txconf tx;
@@ -174,6 +180,9 @@ struct cnxk_eth_dev {
 	struct cnxk_eth_qconf *tx_qconf;
 	struct cnxk_eth_qconf *rx_qconf;
 
+	/* Flow control configuration */
+	struct cnxk_fc_cfg fc_cfg;
+
 	/* Rx burst for cleanup(Only Primary) */
 	eth_rx_burst_t rx_pkt_burst_no_offload;
 
@@ -223,6 +232,10 @@ int cnxk_nix_rx_burst_mode_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
 			       struct rte_eth_burst_mode *mode);
 int cnxk_nix_tx_burst_mode_get(struct rte_eth_dev *eth_dev, uint16_t queue_id,
 			       struct rte_eth_burst_mode *mode);
+int cnxk_nix_flow_ctrl_set(struct rte_eth_dev *eth_dev,
+			   struct rte_eth_fc_conf *fc_conf);
+int cnxk_nix_flow_ctrl_get(struct rte_eth_dev *eth_dev,
+			   struct rte_eth_fc_conf *fc_conf);
 int cnxk_nix_configure(struct rte_eth_dev *eth_dev);
 int cnxk_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 			    uint16_t nb_desc, uint16_t fp_tx_q_sz,
drivers/net/cnxk/cnxk_ethdev_ops.c +95 -0

101 lines not on this page · raw message

Signature · 1 line
2.8.4
#31 lore raw

PATCH 31/44 net/cnxk: add link up/down operations

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

Patch implements link up/down ethdev operations for cn9k and cn10k platform.

---
 drivers/net/cnxk/cnxk_ethdev.c     |  4 +++-
 drivers/net/cnxk/cnxk_ethdev.h     |  4 ++++
 drivers/net/cnxk/cnxk_ethdev_ops.c | 47 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 54 insertions(+), 1 deletion(-)
drivers/net/cnxk/cnxk_ethdev.c +3 -1
index 0ffc45b..cb7404f 100644
@@ -928,7 +928,7 @@ cnxk_nix_configure(struct rte_eth_dev *eth_dev)
 	return rc;
 }
 
-static int
+int
 cnxk_nix_tx_queue_start(struct rte_eth_dev *eth_dev, uint16_t qid)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
@@ -1142,6 +1142,8 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
 	.tx_burst_mode_get = cnxk_nix_tx_burst_mode_get,
 	.flow_ctrl_get = cnxk_nix_flow_ctrl_get,
 	.flow_ctrl_set = cnxk_nix_flow_ctrl_set,
+	.dev_set_link_up = cnxk_nix_set_link_up,
+	.dev_set_link_down = cnxk_nix_set_link_down,
 };
 
 static int
drivers/net/cnxk/cnxk_ethdev.h +4 -0
index 77139d0..6500433 100644
@@ -236,6 +236,9 @@ int cnxk_nix_flow_ctrl_set(struct rte_eth_dev *eth_dev,
 			   struct rte_eth_fc_conf *fc_conf);
 int cnxk_nix_flow_ctrl_get(struct rte_eth_dev *eth_dev,
 			   struct rte_eth_fc_conf *fc_conf);
+int cnxk_nix_set_link_up(struct rte_eth_dev *eth_dev);
+int cnxk_nix_set_link_down(struct rte_eth_dev *eth_dev);
+
 int cnxk_nix_configure(struct rte_eth_dev *eth_dev);
 int cnxk_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 			    uint16_t nb_desc, uint16_t fp_tx_q_sz,
@@ -244,6 +247,7 @@ int cnxk_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 			    uint16_t nb_desc, uint16_t fp_rx_q_sz,
 			    const struct rte_eth_rxconf *rx_conf,
 			    struct rte_mempool *mp);
+int cnxk_nix_tx_queue_start(struct rte_eth_dev *eth_dev, uint16_t qid);
 int cnxk_nix_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t qid);
 int cnxk_nix_dev_start(struct rte_eth_dev *eth_dev);
 
drivers/net/cnxk/cnxk_ethdev_ops.c +47 -0

50 lines not on this page · raw message

Signature · 1 line
2.8.4
#32 lore raw

PATCH 32/44 net/cnxk: add EEPROM module info get operations

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

Patch implements eeprom module info get ethops for cn9k and cn10k platforms.

---
 doc/guides/nics/features/cnxk.ini     |  1 +
 doc/guides/nics/features/cnxk_vec.ini |  1 +
 doc/guides/nics/features/cnxk_vf.ini  |  1 +
 drivers/net/cnxk/cnxk_ethdev.c        |  2 ++
 drivers/net/cnxk/cnxk_ethdev.h        |  4 ++++
 drivers/net/cnxk/cnxk_ethdev_ops.c    | 39 +++++++++++++++++++++++++++++++++++
 6 files changed, 48 insertions(+)
doc/guides/nics/features/cnxk.ini +1 -0
index afd0f01..b1e8641 100644
@@ -31,6 +31,7 @@ L4 checksum offload  = Y
 Inner L3 checksum    = Y
 Inner L4 checksum    = Y
 Packet type parsing  = Y
+Module EEPROM dump   = Y
 Linux                = Y
 ARMv8                = Y
 Usage doc            = Y
doc/guides/nics/features/cnxk_vec.ini +1 -0
index 4bd11ce..0f99634 100644
@@ -29,6 +29,7 @@ L4 checksum offload  = Y
 Inner L3 checksum    = Y
 Inner L4 checksum    = Y
 Packet type parsing  = Y
+Module EEPROM dump   = Y
 Linux                = Y
 ARMv8                = Y
 Usage doc            = Y
doc/guides/nics/features/cnxk_vf.ini +1 -0
index 335d082..cecced9 100644
@@ -26,6 +26,7 @@ L4 checksum offload  = Y
 Inner L3 checksum    = Y
 Inner L4 checksum    = Y
 Packet type parsing  = Y
+Module EEPROM dump   = Y
 Linux                = Y
 ARMv8                = Y
 Usage doc            = Y
drivers/net/cnxk/cnxk_ethdev.c +2 -0
index cb7404f..97d8e6d 100644
@@ -1144,6 +1144,8 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
 	.flow_ctrl_set = cnxk_nix_flow_ctrl_set,
 	.dev_set_link_up = cnxk_nix_set_link_up,
 	.dev_set_link_down = cnxk_nix_set_link_down,
+	.get_module_info = cnxk_nix_get_module_info,
+	.get_module_eeprom = cnxk_nix_get_module_eeprom,
 };
 
 static int
drivers/net/cnxk/cnxk_ethdev.h +4 -0
index 6500433..c4a562b 100644
@@ -238,6 +238,10 @@ int cnxk_nix_flow_ctrl_get(struct rte_eth_dev *eth_dev,
 			   struct rte_eth_fc_conf *fc_conf);
 int cnxk_nix_set_link_up(struct rte_eth_dev *eth_dev);
 int cnxk_nix_set_link_down(struct rte_eth_dev *eth_dev);
+int cnxk_nix_get_module_info(struct rte_eth_dev *eth_dev,
+			     struct rte_eth_dev_module_info *modinfo);
+int cnxk_nix_get_module_eeprom(struct rte_eth_dev *eth_dev,
+			       struct rte_dev_eeprom_info *info);
 
 int cnxk_nix_configure(struct rte_eth_dev *eth_dev);
 int cnxk_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
drivers/net/cnxk/cnxk_ethdev_ops.c +39 -0
index 37ba211..a1a963a 100644
@@ -553,3 +553,42 @@ cnxk_nix_set_link_down(struct rte_eth_dev *eth_dev)
 exit:
 	return rc;
 }
+
+int
+cnxk_nix_get_module_info(struct rte_eth_dev *eth_dev,
+			 struct rte_eth_dev_module_info *modinfo)
+{
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	struct roc_nix_eeprom_info eeprom_info = {0};
+	struct roc_nix *nix = &dev->nix;
+	int rc;
+
+	rc = roc_nix_eeprom_info_get(nix, &eeprom_info);
+	if (rc)
+		return rc;
+
+	modinfo->type = eeprom_info.sff_id;
+	modinfo->eeprom_len = ROC_NIX_EEPROM_SIZE;
+	return 0;
+}
+
+int
+cnxk_nix_get_module_eeprom(struct rte_eth_dev *eth_dev,
+			   struct rte_dev_eeprom_info *info)
+{
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	struct roc_nix_eeprom_info eeprom_info = {0};
+	struct roc_nix *nix = &dev->nix;
+	int rc = -EINVAL;
+
+	if (!info->data || !info->length ||
+	    (info->offset + info->length > ROC_NIX_EEPROM_SIZE))
+		return rc;
+
+	rc = roc_nix_eeprom_info_get(nix, &eeprom_info);
+	if (rc)
+		return rc;
+
+	rte_memcpy(info->data, eeprom_info.buf + info->offset, info->length);
+	return 0;
+}
Signature · 1 line
2.8.4
#33 lore raw

PATCH 33/44 net/cnxk: add Rx queue interrupt enable/disable ops

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

Application may choose to enable/disable interrupts on Rx queues so that application can select its processing if no packets are available on queues for a longer period.

---
 doc/guides/nics/cnxk.rst              |  1 +
 doc/guides/nics/features/cnxk.ini     |  1 +
 doc/guides/nics/features/cnxk_vec.ini |  1 +
 doc/guides/nics/features/cnxk_vf.ini  |  1 +
 drivers/net/cnxk/cnxk_ethdev.c        |  2 ++
 drivers/net/cnxk/cnxk_ethdev.h        |  4 ++++
 drivers/net/cnxk/cnxk_ethdev_ops.c    | 19 +++++++++++++++++++
 7 files changed, 29 insertions(+)
doc/guides/nics/cnxk.rst +1 -0
index 96b2c5d..6a001d9 100644
@@ -30,6 +30,7 @@ Features of the CNXK Ethdev PMD are:
 - MTU update
 - Scatter-Gather IO support
 - Vector Poll mode driver
+- Support Rx interrupt
 
 Prerequisites
 -------------
doc/guides/nics/features/cnxk.ini +1 -0
index b1e8641..e5669f5 100644
@@ -5,6 +5,7 @@
 ;
 [Features]
 Speed capabilities   = Y
+Rx interrupt         = Y
 Lock-free Tx queue   = Y
 SR-IOV               = Y
 Multiprocess aware   = Y
doc/guides/nics/features/cnxk_vec.ini +1 -0
index 0f99634..dff0c9b 100644
@@ -5,6 +5,7 @@
 ;
 [Features]
 Speed capabilities   = Y
+Rx interrupt         = Y
 Lock-free Tx queue   = Y
 SR-IOV               = Y
 Multiprocess aware   = Y
doc/guides/nics/features/cnxk_vf.ini +1 -0
index cecced9..b950d2f 100644
@@ -5,6 +5,7 @@
 ;
 [Features]
 Speed capabilities   = Y
+Rx interrupt         = Y
 Lock-free Tx queue   = Y
 Multiprocess aware   = Y
 Link status          = Y
drivers/net/cnxk/cnxk_ethdev.c +2 -0
index 97d8e6d..bfcc456 100644
@@ -1146,6 +1146,8 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
 	.dev_set_link_down = cnxk_nix_set_link_down,
 	.get_module_info = cnxk_nix_get_module_info,
 	.get_module_eeprom = cnxk_nix_get_module_eeprom,
+	.rx_queue_intr_enable = cnxk_nix_rx_queue_intr_enable,
+	.rx_queue_intr_disable = cnxk_nix_rx_queue_intr_disable,
 };
 
 static int
drivers/net/cnxk/cnxk_ethdev.h +4 -0
index c4a562b..76e1049 100644
@@ -242,6 +242,10 @@ int cnxk_nix_get_module_info(struct rte_eth_dev *eth_dev,
 			     struct rte_eth_dev_module_info *modinfo);
 int cnxk_nix_get_module_eeprom(struct rte_eth_dev *eth_dev,
 			       struct rte_dev_eeprom_info *info);
+int cnxk_nix_rx_queue_intr_enable(struct rte_eth_dev *eth_dev,
+				  uint16_t rx_queue_id);
+int cnxk_nix_rx_queue_intr_disable(struct rte_eth_dev *eth_dev,
+				   uint16_t rx_queue_id);
 
 int cnxk_nix_configure(struct rte_eth_dev *eth_dev);
 int cnxk_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
drivers/net/cnxk/cnxk_ethdev_ops.c +19 -0
index a1a963a..34d4a42 100644
@@ -592,3 +592,22 @@ cnxk_nix_get_module_eeprom(struct rte_eth_dev *eth_dev,
 	rte_memcpy(info->data, eeprom_info.buf + info->offset, info->length);
 	return 0;
 }
+
+int
+cnxk_nix_rx_queue_intr_enable(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id)
+{
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+
+	roc_nix_rx_queue_intr_enable(&dev->nix, rx_queue_id);
+	return 0;
+}
+
+int
+cnxk_nix_rx_queue_intr_disable(struct rte_eth_dev *eth_dev,
+			       uint16_t rx_queue_id)
+{
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+
+	roc_nix_rx_queue_intr_disable(&dev->nix, rx_queue_id);
+	return 0;
+}
Signature · 1 line
2.8.4
#34 lore raw

PATCH 34/44 net/cnxk: add validation API for mempool ops

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

cn9k and cn10k supports platform specific mempool ops. This patch implements API to validate whether given mempool ops is supported or not.

---
 drivers/net/cnxk/cnxk_ethdev.c     |  1 +
 drivers/net/cnxk/cnxk_ethdev.h     |  1 +
 drivers/net/cnxk/cnxk_ethdev_ops.c | 11 +++++++++++
 3 files changed, 13 insertions(+)
drivers/net/cnxk/cnxk_ethdev.c +1 -0
index bfcc456..8a76486 100644
@@ -1148,6 +1148,7 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
 	.get_module_eeprom = cnxk_nix_get_module_eeprom,
 	.rx_queue_intr_enable = cnxk_nix_rx_queue_intr_enable,
 	.rx_queue_intr_disable = cnxk_nix_rx_queue_intr_disable,
+	.pool_ops_supported = cnxk_nix_pool_ops_supported,
 };
 
 static int
drivers/net/cnxk/cnxk_ethdev.h +1 -0
index 76e1049..0b501f6 100644
@@ -246,6 +246,7 @@ int cnxk_nix_rx_queue_intr_enable(struct rte_eth_dev *eth_dev,
 				  uint16_t rx_queue_id);
 int cnxk_nix_rx_queue_intr_disable(struct rte_eth_dev *eth_dev,
 				   uint16_t rx_queue_id);
+int cnxk_nix_pool_ops_supported(struct rte_eth_dev *eth_dev, const char *pool);
 
 int cnxk_nix_configure(struct rte_eth_dev *eth_dev);
 int cnxk_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
drivers/net/cnxk/cnxk_ethdev_ops.c +11 -0
index 34d4a42..5b8bc53 100644
@@ -611,3 +611,14 @@ cnxk_nix_rx_queue_intr_disable(struct rte_eth_dev *eth_dev,
 	roc_nix_rx_queue_intr_disable(&dev->nix, rx_queue_id);
 	return 0;
 }
+
+int
+cnxk_nix_pool_ops_supported(struct rte_eth_dev *eth_dev, const char *pool)
+{
+	RTE_SET_USED(eth_dev);
+
+	if (!strcmp(pool, rte_mbuf_platform_mempool_ops()))
+		return 0;
+
+	return -ENOTSUP;
+}
Signature · 1 line
2.8.4
#35 lore raw

PATCH 35/44 net/cnxk: add port/queue stats

In reply to Nithin Dabilpuram

From: Satha Rao <[email protected]>

This patch implements regular port statistics and queue mapping set api to get queue statistics

---
 doc/guides/nics/cnxk.rst              |  1 +
 doc/guides/nics/features/cnxk.ini     |  2 +
 doc/guides/nics/features/cnxk_vec.ini |  2 +
 doc/guides/nics/features/cnxk_vf.ini  |  2 +
 drivers/net/cnxk/cnxk_ethdev.c        |  3 ++
 drivers/net/cnxk/cnxk_ethdev.h        |  8 ++++
 drivers/net/cnxk/cnxk_stats.c         | 85 +++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/meson.build          |  3 +-
 8 files changed, 105 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/cnxk/cnxk_stats.c
doc/guides/nics/cnxk.rst +1 -0
index 6a001d9..c2a6fbb 100644
@@ -25,6 +25,7 @@ Features of the CNXK Ethdev PMD are:
 - Receiver Side Scaling (RSS)
 - MAC filtering
 - Inner and Outer Checksum offload
+- Port hardware statistics
 - Link state information
 - Link flow control
 - MTU update
doc/guides/nics/features/cnxk.ini +2 -0
index e5669f5..40952a9 100644
@@ -32,6 +32,8 @@ L4 checksum offload  = Y
 Inner L3 checksum    = Y
 Inner L4 checksum    = Y
 Packet type parsing  = Y
+Basic stats          = Y
+Stats per queue      = Y
 Module EEPROM dump   = Y
 Linux                = Y
 ARMv8                = Y
doc/guides/nics/features/cnxk_vec.ini +2 -0
index dff0c9b..32035bb 100644
@@ -30,6 +30,8 @@ L4 checksum offload  = Y
 Inner L3 checksum    = Y
 Inner L4 checksum    = Y
 Packet type parsing  = Y
+Basic stats          = Y
+Stats per queue      = Y
 Module EEPROM dump   = Y
 Linux                = Y
 ARMv8                = Y
doc/guides/nics/features/cnxk_vf.ini +2 -0
index b950d2f..8060a68 100644
@@ -27,6 +27,8 @@ L4 checksum offload  = Y
 Inner L3 checksum    = Y
 Inner L4 checksum    = Y
 Packet type parsing  = Y
+Basic stats          = Y
+Stats per queue      = Y
 Module EEPROM dump   = Y
 Linux                = Y
 ARMv8                = Y
drivers/net/cnxk/cnxk_ethdev.c +3 -0
index 8a76486..a798b14 100644
@@ -1149,6 +1149,9 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
 	.rx_queue_intr_enable = cnxk_nix_rx_queue_intr_enable,
 	.rx_queue_intr_disable = cnxk_nix_rx_queue_intr_disable,
 	.pool_ops_supported = cnxk_nix_pool_ops_supported,
+	.queue_stats_mapping_set = cnxk_nix_queue_stats_mapping,
+	.stats_get = cnxk_nix_stats_get,
+	.stats_reset = cnxk_nix_stats_reset,
 };
 
 static int
drivers/net/cnxk/cnxk_ethdev.h +8 -0
index 0b501f6..5075e7c 100644
@@ -188,6 +188,10 @@ struct cnxk_eth_dev {
 
 	/* Default mac address */
 	uint8_t mac_addr[RTE_ETHER_ADDR_LEN];
+
+	/* Per queue statistics counters */
+	uint32_t txq_stat_map[RTE_ETHDEV_QUEUE_STAT_CNTRS];
+	uint32_t rxq_stat_map[RTE_ETHDEV_QUEUE_STAT_CNTRS];
 };
 
 struct cnxk_eth_rxq_sp {
@@ -271,6 +275,10 @@ void cnxk_nix_toggle_flag_link_cfg(struct cnxk_eth_dev *dev, bool set);
 void cnxk_eth_dev_link_status_cb(struct roc_nix *nix,
 				 struct roc_nix_link_info *link);
 int cnxk_nix_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete);
+int cnxk_nix_queue_stats_mapping(struct rte_eth_dev *dev, uint16_t queue_id,
+				 uint8_t stat_idx, uint8_t is_rx);
+int cnxk_nix_stats_reset(struct rte_eth_dev *dev);
+int cnxk_nix_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats);
 
 /* Lookup configuration */
 const uint32_t *cnxk_nix_supported_ptypes_get(struct rte_eth_dev *eth_dev);
drivers/net/cnxk/cnxk_stats.c new file +85 -0

85 lines not on this page · raw message

drivers/net/cnxk/meson.build +2 -1
index 3aa9f70..0e141d7 100644
@@ -12,7 +12,8 @@ sources = files('cnxk_ethdev.c',
 		'cnxk_ethdev_ops.c',
 		'cnxk_ethdev_devargs.c',
 		'cnxk_link.c',
-		'cnxk_lookup.c')
+		'cnxk_lookup.c',
+		'cnxk_stats.c')
 
 # CN9K
 sources += files('cn9k_ethdev.c',
Signature · 1 line
2.8.4
#36 lore raw

PATCH 36/44 net/cnxk: add xstats apis

In reply to Nithin Dabilpuram

From: Satha Rao <[email protected]>

Initial implementation of xstats operations.

---
 doc/guides/nics/features/cnxk.ini     |   1 +
 doc/guides/nics/features/cnxk_vec.ini |   1 +
 doc/guides/nics/features/cnxk_vf.ini  |   1 +
 drivers/net/cnxk/cnxk_ethdev.c        |   5 ++
 drivers/net/cnxk/cnxk_ethdev.h        |  11 +++
 drivers/net/cnxk/cnxk_stats.c         | 132 ++++++++++++++++++++++++++++++++++
 6 files changed, 151 insertions(+)
doc/guides/nics/features/cnxk.ini +1 -0
index 40952a9..192c15a 100644
@@ -34,6 +34,7 @@ Inner L4 checksum    = Y
 Packet type parsing  = Y
 Basic stats          = Y
 Stats per queue      = Y
+Extended stats       = Y
 Module EEPROM dump   = Y
 Linux                = Y
 ARMv8                = Y
doc/guides/nics/features/cnxk_vec.ini +1 -0
index 32035bb..e990480 100644
@@ -32,6 +32,7 @@ Inner L4 checksum    = Y
 Packet type parsing  = Y
 Basic stats          = Y
 Stats per queue      = Y
+Extended stats       = Y
 Module EEPROM dump   = Y
 Linux                = Y
 ARMv8                = Y
doc/guides/nics/features/cnxk_vf.ini +1 -0
index 8060a68..3a4417c 100644
@@ -29,6 +29,7 @@ Inner L4 checksum    = Y
 Packet type parsing  = Y
 Basic stats          = Y
 Stats per queue      = Y
+Extended stats       = Y
 Module EEPROM dump   = Y
 Linux                = Y
 ARMv8                = Y
drivers/net/cnxk/cnxk_ethdev.c +5 -0
index a798b14..a145aaa 100644
@@ -1152,6 +1152,11 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
 	.queue_stats_mapping_set = cnxk_nix_queue_stats_mapping,
 	.stats_get = cnxk_nix_stats_get,
 	.stats_reset = cnxk_nix_stats_reset,
+	.xstats_get = cnxk_nix_xstats_get,
+	.xstats_get_names = cnxk_nix_xstats_get_names,
+	.xstats_reset = cnxk_nix_xstats_reset,
+	.xstats_get_by_id = cnxk_nix_xstats_get_by_id,
+	.xstats_get_names_by_id = cnxk_nix_xstats_get_names_by_id,
 };
 
 static int
drivers/net/cnxk/cnxk_ethdev.h +11 -0
index 5075e7c..dd05c24 100644
@@ -279,6 +279,17 @@ int cnxk_nix_queue_stats_mapping(struct rte_eth_dev *dev, uint16_t queue_id,
 				 uint8_t stat_idx, uint8_t is_rx);
 int cnxk_nix_stats_reset(struct rte_eth_dev *dev);
 int cnxk_nix_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats);
+int cnxk_nix_xstats_get(struct rte_eth_dev *eth_dev,
+			struct rte_eth_xstat *xstats, unsigned int n);
+int cnxk_nix_xstats_get_names(struct rte_eth_dev *eth_dev,
+			      struct rte_eth_xstat_name *xstats_names,
+			      unsigned int limit);
+int cnxk_nix_xstats_get_names_by_id(struct rte_eth_dev *eth_dev,
+				    struct rte_eth_xstat_name *xstats_names,
+				    const uint64_t *ids, unsigned int limit);
+int cnxk_nix_xstats_get_by_id(struct rte_eth_dev *eth_dev, const uint64_t *ids,
+			      uint64_t *values, unsigned int n);
+int cnxk_nix_xstats_reset(struct rte_eth_dev *eth_dev);
 
 /* Lookup configuration */
 const uint32_t *cnxk_nix_supported_ptypes_get(struct rte_eth_dev *eth_dev);
drivers/net/cnxk/cnxk_stats.c +132 -0

135 lines not on this page · raw message

Signature · 1 line
2.8.4
#37 lore raw

PATCH 37/44 net/cnxk: add rxq/txq info get operations

In reply to Nithin Dabilpuram

From: Satha Rao <[email protected]>

Initial apis to get default queue information.

---
 drivers/net/cnxk/cnxk_ethdev.c     |  2 ++
 drivers/net/cnxk/cnxk_ethdev.h     |  4 ++++
 drivers/net/cnxk/cnxk_ethdev_ops.c | 30 ++++++++++++++++++++++++++++++
 3 files changed, 36 insertions(+)
drivers/net/cnxk/cnxk_ethdev.c +2 -0
index a145aaa..24c51b4 100644
@@ -1157,6 +1157,8 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
 	.xstats_reset = cnxk_nix_xstats_reset,
 	.xstats_get_by_id = cnxk_nix_xstats_get_by_id,
 	.xstats_get_names_by_id = cnxk_nix_xstats_get_names_by_id,
+	.rxq_info_get = cnxk_nix_rxq_info_get,
+	.txq_info_get = cnxk_nix_txq_info_get,
 };
 
 static int
drivers/net/cnxk/cnxk_ethdev.h +4 -0
index dd05c24..eeb6a53 100644
@@ -290,6 +290,10 @@ int cnxk_nix_xstats_get_names_by_id(struct rte_eth_dev *eth_dev,
 int cnxk_nix_xstats_get_by_id(struct rte_eth_dev *eth_dev, const uint64_t *ids,
 			      uint64_t *values, unsigned int n);
 int cnxk_nix_xstats_reset(struct rte_eth_dev *eth_dev);
+void cnxk_nix_rxq_info_get(struct rte_eth_dev *eth_dev, uint16_t qid,
+			   struct rte_eth_rxq_info *qinfo);
+void cnxk_nix_txq_info_get(struct rte_eth_dev *eth_dev, uint16_t qid,
+			   struct rte_eth_txq_info *qinfo);
 
 /* Lookup configuration */
 const uint32_t *cnxk_nix_supported_ptypes_get(struct rte_eth_dev *eth_dev);
drivers/net/cnxk/cnxk_ethdev_ops.c +30 -0
index 5b8bc53..0bcba0c 100644
@@ -622,3 +622,33 @@ cnxk_nix_pool_ops_supported(struct rte_eth_dev *eth_dev, const char *pool)
 
 	return -ENOTSUP;
 }
+
+void
+cnxk_nix_rxq_info_get(struct rte_eth_dev *eth_dev, uint16_t qid,
+		      struct rte_eth_rxq_info *qinfo)
+{
+	struct cnxk_eth_rxq_sp *rxq_sp =
+		((struct cnxk_eth_rxq_sp *)eth_dev->data->rx_queues[qid]) - 1;
+
+	memset(qinfo, 0, sizeof(*qinfo));
+
+	qinfo->mp = rxq_sp->qconf.mp;
+	qinfo->scattered_rx = eth_dev->data->scattered_rx;
+	qinfo->nb_desc = rxq_sp->qconf.nb_desc;
+
+	memcpy(&qinfo->conf, &rxq_sp->qconf.conf.rx, sizeof(qinfo->conf));
+}
+
+void
+cnxk_nix_txq_info_get(struct rte_eth_dev *eth_dev, uint16_t qid,
+		      struct rte_eth_txq_info *qinfo)
+{
+	struct cnxk_eth_txq_sp *txq_sp =
+		((struct cnxk_eth_txq_sp *)eth_dev->data->tx_queues[qid]) - 1;
+
+	memset(qinfo, 0, sizeof(*qinfo));
+
+	qinfo->nb_desc = txq_sp->qconf.nb_desc;
+
+	memcpy(&qinfo->conf, &txq_sp->qconf.conf.tx, sizeof(qinfo->conf));
+}
Signature · 1 line
2.8.4
#38 lore raw

PATCH 38/44 net/cnxk: add device close and reset operations

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

Patch implements device close and reset operations for cn9k and cn10k platforms.

---
 drivers/net/cnxk/cnxk_ethdev.c | 35 ++++++++++++++++++++++++++++-------
 1 file changed, 28 insertions(+), 7 deletions(-)
drivers/net/cnxk/cnxk_ethdev.c +28 -7
index 24c51b4..86dabad 100644
@@ -1119,6 +1119,9 @@ cnxk_nix_dev_start(struct rte_eth_dev *eth_dev)
 	return rc;
 }
 
+static int cnxk_nix_dev_reset(struct rte_eth_dev *eth_dev);
+static int cnxk_nix_dev_close(struct rte_eth_dev *eth_dev);
+
 /* CNXK platform independent eth dev ops */
 struct eth_dev_ops cnxk_eth_dev_ops = {
 	.mtu_set = cnxk_nix_mtu_set,
@@ -1130,6 +1133,8 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
 	.tx_queue_release = cnxk_nix_tx_queue_release,
 	.rx_queue_release = cnxk_nix_rx_queue_release,
 	.dev_stop = cnxk_nix_dev_stop,
+	.dev_close = cnxk_nix_dev_close,
+	.dev_reset = cnxk_nix_dev_reset,
 	.tx_queue_start = cnxk_nix_tx_queue_start,
 	.rx_queue_start = cnxk_nix_rx_queue_start,
 	.rx_queue_stop = cnxk_nix_rx_queue_stop,
@@ -1270,7 +1275,7 @@ cnxk_eth_dev_init(struct rte_eth_dev *eth_dev)
 }
 
 static int
-cnxk_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close)
+cnxk_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool reset)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 	const struct eth_dev_ops *dev_ops = eth_dev->dev_ops;
@@ -1324,14 +1329,11 @@ cnxk_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close)
 	rte_free(eth_dev->data->mac_addrs);
 	eth_dev->data->mac_addrs = NULL;
 
-	/* Check if mbox close is needed */
-	if (!mbox_close)
-		return 0;
-
 	rc = roc_nix_dev_fini(nix);
 	/* Can be freed later by PMD if NPA LF is in use */
 	if (rc == -EAGAIN) {
-		eth_dev->data->dev_private = NULL;
+		if (!reset)
+			eth_dev->data->dev_private = NULL;
 		return 0;
 	} else if (rc) {
 		plt_err("Failed in nix dev fini, rc=%d", rc);
@@ -1340,6 +1342,25 @@ cnxk_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close)
 	return rc;
 }
 
+static int
+cnxk_nix_dev_close(struct rte_eth_dev *eth_dev)
+{
+	cnxk_eth_dev_uninit(eth_dev, false);
+	return 0;
+}
+
+static int
+cnxk_nix_dev_reset(struct rte_eth_dev *eth_dev)
+{
+	int rc;
+
+	rc = cnxk_eth_dev_uninit(eth_dev, true);
+	if (rc)
+		return rc;
+
+	return cnxk_eth_dev_init(eth_dev);
+}
+
 int
 cnxk_nix_remove(struct rte_pci_device *pci_dev)
 {
@@ -1350,7 +1371,7 @@ cnxk_nix_remove(struct rte_pci_device *pci_dev)
 	eth_dev = rte_eth_dev_allocated(pci_dev->device.name);
 	if (eth_dev) {
 		/* Cleanup eth dev */
-		rc = cnxk_eth_dev_uninit(eth_dev, true);
+		rc = cnxk_eth_dev_uninit(eth_dev, false);
 		if (rc)
 			return rc;
 
Signature · 1 line
2.8.4
#39 lore raw

PATCH 39/44 net/cnxk: add pending Tx mbuf cleanup operation

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

Once mbufs are transmitted, mbufs are freed by H/W. No mbufs are accumalated as a pending mbuf.
Hence operation is NOP for cnxk platform.

---
 drivers/net/cnxk/cnxk_ethdev.c     |  1 +
 drivers/net/cnxk/cnxk_ethdev.h     |  1 +
 drivers/net/cnxk/cnxk_ethdev_ops.c | 10 ++++++++++
 3 files changed, 12 insertions(+)
drivers/net/cnxk/cnxk_ethdev.c +1 -0
index 86dabad..5a2f90b 100644
@@ -1164,6 +1164,7 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
 	.xstats_get_names_by_id = cnxk_nix_xstats_get_names_by_id,
 	.rxq_info_get = cnxk_nix_rxq_info_get,
 	.txq_info_get = cnxk_nix_txq_info_get,
+	.tx_done_cleanup = cnxk_nix_tx_done_cleanup,
 };
 
 static int
drivers/net/cnxk/cnxk_ethdev.h +1 -0
index eeb6a53..1ca52bc 100644
@@ -251,6 +251,7 @@ int cnxk_nix_rx_queue_intr_enable(struct rte_eth_dev *eth_dev,
 int cnxk_nix_rx_queue_intr_disable(struct rte_eth_dev *eth_dev,
 				   uint16_t rx_queue_id);
 int cnxk_nix_pool_ops_supported(struct rte_eth_dev *eth_dev, const char *pool);
+int cnxk_nix_tx_done_cleanup(void *txq, uint32_t free_cnt);
 
 int cnxk_nix_configure(struct rte_eth_dev *eth_dev);
 int cnxk_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
drivers/net/cnxk/cnxk_ethdev_ops.c +10 -0
index 0bcba0c..ff8afac 100644
@@ -652,3 +652,13 @@ cnxk_nix_txq_info_get(struct rte_eth_dev *eth_dev, uint16_t qid,
 
 	memcpy(&qinfo->conf, &txq_sp->qconf.conf.tx, sizeof(qinfo->conf));
 }
+
+/* It is a NOP for cnxk as HW frees the buffer on xmit */
+int
+cnxk_nix_tx_done_cleanup(void *txq, uint32_t free_cnt)
+{
+	RTE_SET_USED(txq);
+	RTE_SET_USED(free_cnt);
+
+	return 0;
+}
Signature · 1 line
2.8.4
#40 lore raw

PATCH 40/44 net/cnxk: add support to configure npc

In reply to Nithin Dabilpuram

From: Kiran Kumar K <[email protected]>

Adding support to configure NPC on device initialization. This involves reading the MKEX and initializing the necessary data.

---
 drivers/net/cnxk/cnxk_ethdev.c         | 25 ++++++++++++++++++++++---
 drivers/net/cnxk/cnxk_ethdev.h         |  3 +++
 drivers/net/cnxk/cnxk_ethdev_devargs.c |  3 +++
 3 files changed, 28 insertions(+), 3 deletions(-)
drivers/net/cnxk/cnxk_ethdev.c +22 -3
index 5a2f90b..afe97f1 100644
@@ -8,7 +8,8 @@ nix_get_rx_offload_capa(struct cnxk_eth_dev *dev)
 {
 	uint64_t capa = CNXK_NIX_RX_OFFLOAD_CAPA;
 
-	if (roc_nix_is_vf_or_sdp(&dev->nix))
+	if (roc_nix_is_vf_or_sdp(&dev->nix) ||
+	    dev->npc.switch_header_type == ROC_PRIV_FLAGS_HIGIG)
 		capa &= ~DEV_RX_OFFLOAD_TIMESTAMP;
 
 	return capa;
@@ -120,6 +121,7 @@ nix_update_flow_ctrl_config(struct rte_eth_dev *eth_dev)
 
 	/* To avoid Link credit deadlock on Ax, disable Tx FC if it's enabled */
 	if (roc_model_is_cn96_Ax() &&
+	    dev->npc.switch_header_type != ROC_PRIV_FLAGS_HIGIG &&
 	    (fc_cfg.mode == RTE_FC_FULL || fc_cfg.mode == RTE_FC_RX_PAUSE)) {
 		fc_cfg.mode =
 				(fc_cfg.mode == RTE_FC_FULL ||
@@ -419,8 +421,10 @@ cnxk_rss_ethdev_to_nix(struct cnxk_eth_dev *dev, uint64_t ethdev_rss,
 
 	dev->ethdev_rss_hf = ethdev_rss;
 
-	if (ethdev_rss & ETH_RSS_L2_PAYLOAD)
+	if (ethdev_rss & ETH_RSS_L2_PAYLOAD &&
+	    dev->npc.switch_header_type == ROC_PRIV_FLAGS_LEN_90B) {
 		flowkey_cfg |= FLOW_KEY_TYPE_CH_LEN_90B;
+	}
 
 	if (ethdev_rss & ETH_RSS_C_VLAN)
 		flowkey_cfg |= FLOW_KEY_TYPE_VLAN;
@@ -803,11 +807,18 @@ cnxk_nix_configure(struct rte_eth_dev *eth_dev)
 	roc_nix_err_intr_ena_dis(nix, true);
 	roc_nix_ras_intr_ena_dis(nix, true);
 
-	if (nix->rx_ptp_ena) {
+	if (nix->rx_ptp_ena &&
+	    dev->npc.switch_header_type == ROC_PRIV_FLAGS_HIGIG) {
 		plt_err("Both PTP and switch header enabled");
 		goto free_nix_lf;
 	}
 
+	rc = roc_nix_switch_hdr_set(nix, dev->npc.switch_header_type);
+	if (rc) {
+		plt_err("Failed to enable switch type nix_lf rc=%d", rc);
+		goto free_nix_lf;
+	}
+
 	rc = roc_nix_lso_fmt_setup(nix);
 	if (rc) {
 		plt_err("failed to setup nix lso format fields, rc=%d", rc);
@@ -1259,6 +1270,11 @@ cnxk_eth_dev_init(struct rte_eth_dev *eth_dev)
 	dev->speed_capa = nix_get_speed_capa(dev);
 
 	/* Initialize roc npc */
+	dev->npc.roc_nix = nix;
+	rc = roc_npc_init(&dev->npc);
+	if (rc)
+		goto free_mac_addrs;
+
 	plt_nix_dbg("Port=%d pf=%d vf=%d ver=%s hwcap=0x%" PRIx64
 		    " rxoffload_capa=0x%" PRIx64 " txoffload_capa=0x%" PRIx64,
 		    eth_dev->data->port_id, roc_nix_get_pf(nix),
@@ -1292,6 +1308,9 @@ cnxk_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool reset)
 
 	roc_nix_npc_rx_ena_dis(nix, false);
 
+	/* Disable and free rte_flow entries */
+	roc_npc_fini(&dev->npc);
+
 	/* Disable link status events */
 	roc_nix_mac_link_event_start_stop(nix, false);
 
drivers/net/cnxk/cnxk_ethdev.h +3 -0
index 1ca52bc..e3b0bc1 100644
@@ -133,6 +133,9 @@ struct cnxk_eth_dev {
 	/* ROC NIX */
 	struct roc_nix nix;
 
+	/* ROC NPC */
+	struct roc_npc npc;
+
 	/* ROC RQs, SQs and CQs */
 	struct roc_nix_rq *rqs;
 	struct roc_nix_sq *sqs;
drivers/net/cnxk/cnxk_ethdev_devargs.c +3 -0
index 4af2803..7fd06eb 100644
@@ -150,6 +150,9 @@ cnxk_ethdev_parse_devargs(struct rte_devargs *devargs, struct cnxk_eth_dev *dev)
 	dev->nix.rss_tag_as_xor = !!rss_tag_as_xor;
 	dev->nix.max_sqb_count = sqb_count;
 	dev->nix.reta_sz = reta_sz;
+	dev->npc.flow_prealloc_size = flow_prealloc_size;
+	dev->npc.flow_max_priority = flow_max_priority;
+	dev->npc.switch_header_type = switch_header_type;
 	return 0;
 
 exit:
Signature · 1 line
2.8.4
#41 lore raw

PATCH 41/44 net/cnxk: add initial version of rte flow support

In reply to Nithin Dabilpuram

From: Kiran Kumar K <[email protected]>

Adding initial version of rte_flow support for cnxk family device. Supported rte_flow ops are flow_validate, flow_create, flow_crstroy, flow_flush, flow_query, flow_isolate.

---
 doc/guides/nics/cnxk.rst              | 118 ++++++++++++++
 doc/guides/nics/features/cnxk.ini     |   1 +
 doc/guides/nics/features/cnxk_vec.ini |   1 +
 doc/guides/nics/features/cnxk_vf.ini  |   1 +
 drivers/net/cnxk/cnxk_rte_flow.c      | 280 ++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cnxk_rte_flow.h      |  69 +++++++++
 drivers/net/cnxk/meson.build          |   1 +
 7 files changed, 471 insertions(+)
 create mode 100644 drivers/net/cnxk/cnxk_rte_flow.c
 create mode 100644 drivers/net/cnxk/cnxk_rte_flow.h
doc/guides/nics/cnxk.rst +118 -0
index c2a6fbb..87401f0 100644
@@ -24,6 +24,7 @@ Features of the CNXK Ethdev PMD are:
 - Multiple queues for TX and RX
 - Receiver Side Scaling (RSS)
 - MAC filtering
+- Generic flow API
 - Inner and Outer Checksum offload
 - Port hardware statistics
 - Link state information
@@ -222,3 +223,120 @@ Debugging Options
    +---+------------+-------------------------------------------------------+
    | 2 | NPC        | --log-level='pmd\.net.cnxk\.flow,8'                   |
    +---+------------+-------------------------------------------------------+
+
+RTE Flow Support
+----------------
+
+The OCTEON CN9K/CN10K SoC family NIC has support for the following patterns and
+actions.
+
+Patterns:
+
+.. _table_cnxk_supported_flow_item_types:
+
+.. table:: Item types
+
+   +----+--------------------------------+
+   | #  | Pattern Type                   |
+   +====+================================+
+   | 1  | RTE_FLOW_ITEM_TYPE_ETH         |
+   +----+--------------------------------+
+   | 2  | RTE_FLOW_ITEM_TYPE_VLAN        |
+   +----+--------------------------------+
+   | 3  | RTE_FLOW_ITEM_TYPE_E_TAG       |
+   +----+--------------------------------+
+   | 4  | RTE_FLOW_ITEM_TYPE_IPV4        |
+   +----+--------------------------------+
+   | 5  | RTE_FLOW_ITEM_TYPE_IPV6        |
+   +----+--------------------------------+
+   | 6  | RTE_FLOW_ITEM_TYPE_ARP_ETH_IPV4|
+   +----+--------------------------------+
+   | 7  | RTE_FLOW_ITEM_TYPE_MPLS        |
+   +----+--------------------------------+
+   | 8  | RTE_FLOW_ITEM_TYPE_ICMP        |
+   +----+--------------------------------+
+   | 9  | RTE_FLOW_ITEM_TYPE_UDP         |
+   +----+--------------------------------+
+   | 10 | RTE_FLOW_ITEM_TYPE_TCP         |
+   +----+--------------------------------+
+   | 11 | RTE_FLOW_ITEM_TYPE_SCTP        |
+   +----+--------------------------------+
+   | 12 | RTE_FLOW_ITEM_TYPE_ESP         |
+   +----+--------------------------------+
+   | 13 | RTE_FLOW_ITEM_TYPE_GRE         |
+   +----+--------------------------------+
+   | 14 | RTE_FLOW_ITEM_TYPE_NVGRE       |
+   +----+--------------------------------+
+   | 15 | RTE_FLOW_ITEM_TYPE_VXLAN       |
+   +----+--------------------------------+
+   | 16 | RTE_FLOW_ITEM_TYPE_GTPC        |
+   +----+--------------------------------+
+   | 17 | RTE_FLOW_ITEM_TYPE_GTPU        |
+   +----+--------------------------------+
+   | 18 | RTE_FLOW_ITEM_TYPE_GENEVE      |
+   +----+--------------------------------+
+   | 19 | RTE_FLOW_ITEM_TYPE_VXLAN_GPE   |
+   +----+--------------------------------+
+   | 20 | RTE_FLOW_ITEM_TYPE_IPV6_EXT    |
+   +----+--------------------------------+
+   | 21 | RTE_FLOW_ITEM_TYPE_VOID        |
+   +----+--------------------------------+
+   | 22 | RTE_FLOW_ITEM_TYPE_ANY         |
+   +----+--------------------------------+
+   | 23 | RTE_FLOW_ITEM_TYPE_GRE_KEY     |
+   +----+--------------------------------+
+   | 24 | RTE_FLOW_ITEM_TYPE_HIGIG2      |
+   +----+--------------------------------+
+
+.. note::
+
+   ``RTE_FLOW_ITEM_TYPE_GRE_KEY`` works only when checksum and routing
+   bits in the GRE header are equal to 0.
+
+Actions:
+
+.. _table_cnxk_supported_ingress_action_types:
+
+.. table:: Ingress action types
+
+   +----+-----------------------------------------+
+   | #  | Action Type                             |
+   +====+=========================================+
+   | 1  | RTE_FLOW_ACTION_TYPE_VOID               |
+   +----+-----------------------------------------+
+   | 2  | RTE_FLOW_ACTION_TYPE_MARK               |
+   +----+-----------------------------------------+
+   | 3  | RTE_FLOW_ACTION_TYPE_FLAG               |
+   +----+-----------------------------------------+
+   | 4  | RTE_FLOW_ACTION_TYPE_COUNT              |
+   +----+-----------------------------------------+
+   | 5  | RTE_FLOW_ACTION_TYPE_DROP               |
+   +----+-----------------------------------------+
+   | 6  | RTE_FLOW_ACTION_TYPE_QUEUE              |
+   +----+-----------------------------------------+
+   | 7  | RTE_FLOW_ACTION_TYPE_RSS                |
+   +----+-----------------------------------------+
+   | 8  | RTE_FLOW_ACTION_TYPE_PF                 |
+   +----+-----------------------------------------+
+   | 9  | RTE_FLOW_ACTION_TYPE_VF                 |
+   +----+-----------------------------------------+
+   | 10 | RTE_FLOW_ACTION_TYPE_OF_POP_VLAN        |
+   +----+-----------------------------------------+
+
+.. _table_cnxk_supported_egress_action_types:
+
+.. table:: Egress action types
+
+   +----+-----------------------------------------+
+   | #  | Action Type                             |
+   +====+=========================================+
+   | 1  | RTE_FLOW_ACTION_TYPE_COUNT              |
+   +----+-----------------------------------------+
+   | 2  | RTE_FLOW_ACTION_TYPE_DROP               |
+   +----+-----------------------------------------+
+   | 3  | RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN       |
+   +----+-----------------------------------------+
+   | 4  | RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID    |
+   +----+-----------------------------------------+
+   | 5  | RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP    |
+   +----+-----------------------------------------+
doc/guides/nics/features/cnxk.ini +1 -0
index 192c15a..7b6d832 100644
@@ -25,6 +25,7 @@ Unicast MAC filter   = Y
 RSS hash             = Y
 Inner RSS            = Y
 Flow control         = Y
+Flow API             = Y
 Jumbo frame          = Y
 Scattered Rx         = Y
 L3 checksum offload  = Y
doc/guides/nics/features/cnxk_vec.ini +1 -0
index e990480..ef37088 100644
@@ -24,6 +24,7 @@ Unicast MAC filter   = Y
 RSS hash             = Y
 Inner RSS            = Y
 Flow control         = Y
+Flow API             = Y
 Jumbo frame          = Y
 L3 checksum offload  = Y
 L4 checksum offload  = Y
doc/guides/nics/features/cnxk_vf.ini +1 -0
index 3a4417c..69419d1 100644
@@ -20,6 +20,7 @@ MTU update           = Y
 TSO                  = Y
 RSS hash             = Y
 Inner RSS            = Y
+Flow API             = Y
 Jumbo frame          = Y
 Scattered Rx         = Y
 L3 checksum offload  = Y
drivers/net/cnxk/cnxk_rte_flow.c new file +280 -0

280 lines not on this page · raw message

drivers/net/cnxk/cnxk_rte_flow.h new file +69 -0

69 lines not on this page · raw message

drivers/net/cnxk/meson.build +1 -0
index 0e141d7..49aa016 100644
@@ -13,6 +13,7 @@ sources = files('cnxk_ethdev.c',
 		'cnxk_ethdev_devargs.c',
 		'cnxk_link.c',
 		'cnxk_lookup.c',
+		'cnxk_rte_flow.c',
 		'cnxk_stats.c')
 
 # CN9K
Signature · 1 line
2.8.4
#42 lore raw

PATCH 42/44 net/cnxk: add filter ctrl operation

In reply to Nithin Dabilpuram

From: Satheesh Paul <[email protected]>

This patch adds filter_ctrl operation to enable rte_flow_ops.

---
 drivers/common/cnxk/roc_npc.c      |  2 ++
 drivers/net/cnxk/cnxk_ethdev.c     |  3 +++
 drivers/net/cnxk/cnxk_ethdev.h     |  6 +++++-
 drivers/net/cnxk/cnxk_ethdev_ops.c | 21 +++++++++++++++++++++
 4 files changed, 31 insertions(+), 1 deletion(-)
drivers/common/cnxk/roc_npc.c +2 -0
index 0efe080..b862e23 100644
@@ -645,6 +645,8 @@ roc_npc_flow_create(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
 	struct npc_flow_list *list;
 	int rc;
 
+	npc->channel = roc_npc->channel;
+
 	flow = plt_zmalloc(sizeof(*flow), 0);
 	if (flow == NULL) {
 		*errcode = NPC_ERR_NO_MEM;
drivers/net/cnxk/cnxk_ethdev.c +3 -0
index afe97f1..347428e 100644
@@ -773,6 +773,8 @@ cnxk_nix_configure(struct rte_eth_dev *eth_dev)
 		goto fail_configure;
 	}
 
+	dev->npc.channel = roc_nix_get_base_chan(nix);
+
 	nb_rxq = data->nb_rx_queues;
 	nb_txq = data->nb_tx_queues;
 	rc = -ENOMEM;
@@ -1176,6 +1178,7 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
 	.rxq_info_get = cnxk_nix_rxq_info_get,
 	.txq_info_get = cnxk_nix_txq_info_get,
 	.tx_done_cleanup = cnxk_nix_tx_done_cleanup,
+	.filter_ctrl = cnxk_nix_filter_ctrl,
 };
 
 static int
drivers/net/cnxk/cnxk_ethdev.h +5 -1
index e3b0bc1..7cf7cf7 100644
@@ -218,6 +218,8 @@ cnxk_eth_pmd_priv(struct rte_eth_dev *eth_dev)
 /* Common ethdev ops */
 extern struct eth_dev_ops cnxk_eth_dev_ops;
 
+extern const struct rte_flow_ops cnxk_flow_ops;
+
 /* Ops */
 int cnxk_nix_probe(struct rte_pci_driver *pci_drv,
 		   struct rte_pci_device *pci_dev);
@@ -255,7 +257,9 @@ int cnxk_nix_rx_queue_intr_disable(struct rte_eth_dev *eth_dev,
 				   uint16_t rx_queue_id);
 int cnxk_nix_pool_ops_supported(struct rte_eth_dev *eth_dev, const char *pool);
 int cnxk_nix_tx_done_cleanup(void *txq, uint32_t free_cnt);
-
+int cnxk_nix_filter_ctrl(struct rte_eth_dev *eth_dev,
+			 enum rte_filter_type filter_type,
+			 enum rte_filter_op filter_op, void *arg);
 int cnxk_nix_configure(struct rte_eth_dev *eth_dev);
 int cnxk_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 			    uint16_t nb_desc, uint16_t fp_tx_q_sz,
drivers/net/cnxk/cnxk_ethdev_ops.c +21 -0
index ff8afac..00f1fe7 100644
@@ -294,6 +294,27 @@ cnxk_nix_flow_ctrl_set(struct rte_eth_dev *eth_dev,
 }
 
 int
+cnxk_nix_filter_ctrl(struct rte_eth_dev *eth_dev,
+		     enum rte_filter_type filter_type,
+		     enum rte_filter_op filter_op, void *arg)
+{
+	RTE_SET_USED(eth_dev);
+
+	if (filter_type != RTE_ETH_FILTER_GENERIC) {
+		plt_err("Unsupported filter type %d", filter_type);
+		return -ENOTSUP;
+	}
+
+	if (filter_op == RTE_ETH_FILTER_GET) {
+		*(const void **)arg = &cnxk_flow_ops;
+		return 0;
+	}
+
+	plt_err("Invalid filter_op %d", filter_op);
+	return -EINVAL;
+}
+
+int
 cnxk_nix_mac_addr_set(struct rte_eth_dev *eth_dev, struct rte_ether_addr *addr)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
Signature · 1 line
2.8.4
#43 lore raw

PATCH 43/44 net/cnxk: add ethdev firmware version get

In reply to Nithin Dabilpuram

From: Satha Rao <[email protected]>

Add callback to get ethdev firmware version.

---
 doc/guides/nics/features/cnxk.ini     |  1 +
 doc/guides/nics/features/cnxk_vec.ini |  1 +
 doc/guides/nics/features/cnxk_vf.ini  |  1 +
 drivers/net/cnxk/cnxk_ethdev.c        |  1 +
 drivers/net/cnxk/cnxk_ethdev.h        |  2 ++
 drivers/net/cnxk/cnxk_ethdev_ops.c    | 19 +++++++++++++++++++
 6 files changed, 25 insertions(+)
doc/guides/nics/features/cnxk.ini +1 -0
index 7b6d832..2c83bfb 100644
@@ -36,6 +36,7 @@ Packet type parsing  = Y
 Basic stats          = Y
 Stats per queue      = Y
 Extended stats       = Y
+FW version           = Y
 Module EEPROM dump   = Y
 Linux                = Y
 ARMv8                = Y
doc/guides/nics/features/cnxk_vec.ini +1 -0
index ef37088..c8ad253 100644
@@ -34,6 +34,7 @@ Packet type parsing  = Y
 Basic stats          = Y
 Stats per queue      = Y
 Extended stats       = Y
+FW version           = Y
 Module EEPROM dump   = Y
 Linux                = Y
 ARMv8                = Y
doc/guides/nics/features/cnxk_vf.ini +1 -0
index 69419d1..4dbdfcb 100644
@@ -31,6 +31,7 @@ Packet type parsing  = Y
 Basic stats          = Y
 Stats per queue      = Y
 Extended stats       = Y
+FW version           = Y
 Module EEPROM dump   = Y
 Linux                = Y
 ARMv8                = Y
drivers/net/cnxk/cnxk_ethdev.c +1 -0
index 347428e..f006718 100644
@@ -1175,6 +1175,7 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
 	.xstats_reset = cnxk_nix_xstats_reset,
 	.xstats_get_by_id = cnxk_nix_xstats_get_by_id,
 	.xstats_get_names_by_id = cnxk_nix_xstats_get_names_by_id,
+	.fw_version_get = cnxk_nix_fw_version_get,
 	.rxq_info_get = cnxk_nix_rxq_info_get,
 	.txq_info_get = cnxk_nix_txq_info_get,
 	.tx_done_cleanup = cnxk_nix_tx_done_cleanup,
drivers/net/cnxk/cnxk_ethdev.h +2 -0
index 7cf7cf7..4b25593 100644
@@ -298,6 +298,8 @@ int cnxk_nix_xstats_get_names_by_id(struct rte_eth_dev *eth_dev,
 int cnxk_nix_xstats_get_by_id(struct rte_eth_dev *eth_dev, const uint64_t *ids,
 			      uint64_t *values, unsigned int n);
 int cnxk_nix_xstats_reset(struct rte_eth_dev *eth_dev);
+int cnxk_nix_fw_version_get(struct rte_eth_dev *eth_dev, char *fw_version,
+			    size_t fw_size);
 void cnxk_nix_rxq_info_get(struct rte_eth_dev *eth_dev, uint16_t qid,
 			   struct rte_eth_rxq_info *qinfo);
 void cnxk_nix_txq_info_get(struct rte_eth_dev *eth_dev, uint16_t qid,
drivers/net/cnxk/cnxk_ethdev_ops.c +19 -0
index 00f1fe7..bf89ede 100644
@@ -644,6 +644,25 @@ cnxk_nix_pool_ops_supported(struct rte_eth_dev *eth_dev, const char *pool)
 	return -ENOTSUP;
 }
 
+int
+cnxk_nix_fw_version_get(struct rte_eth_dev *eth_dev, char *fw_version,
+			size_t fw_size)
+{
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	const char *str = roc_npc_profile_name_get(&dev->npc);
+	uint32_t size = strlen(str) + 1;
+
+	if (fw_size > size)
+		fw_size = size;
+
+	strlcpy(fw_version, str, fw_size);
+
+	if (fw_size < size)
+		return size;
+
+	return 0;
+}
+
 void
 cnxk_nix_rxq_info_get(struct rte_eth_dev *eth_dev, uint16_t qid,
 		      struct rte_eth_rxq_info *qinfo)
Signature · 1 line
2.8.4
#44 lore raw

PATCH 44/44 net/cnxk: add get register operation

In reply to Nithin Dabilpuram

From: Satha Rao <[email protected]>

With this patch implemented api to dump platform registers for debug purposes.

---
 doc/guides/nics/cnxk.rst              |  1 +
 doc/guides/nics/features/cnxk.ini     |  1 +
 doc/guides/nics/features/cnxk_vec.ini |  1 +
 doc/guides/nics/features/cnxk_vf.ini  |  1 +
 drivers/net/cnxk/cnxk_ethdev.c        |  1 +
 drivers/net/cnxk/cnxk_ethdev.h        |  4 ++++
 drivers/net/cnxk/cnxk_ethdev_ops.c    | 25 +++++++++++++++++++++++++
 7 files changed, 34 insertions(+)
doc/guides/nics/cnxk.rst +1 -0
index 87401f0..98bcb51 100644
@@ -32,6 +32,7 @@ Features of the CNXK Ethdev PMD are:
 - MTU update
 - Scatter-Gather IO support
 - Vector Poll mode driver
+- Debug utilities - Context dump and error interrupt support
 - Support Rx interrupt
 
 Prerequisites
doc/guides/nics/features/cnxk.ini +1 -0
index 2c83bfb..d1c6f9d 100644
@@ -38,6 +38,7 @@ Stats per queue      = Y
 Extended stats       = Y
 FW version           = Y
 Module EEPROM dump   = Y
+Registers dump       = Y
 Linux                = Y
 ARMv8                = Y
 Usage doc            = Y
doc/guides/nics/features/cnxk_vec.ini +1 -0
index c8ad253..5f2478d 100644
@@ -36,6 +36,7 @@ Stats per queue      = Y
 Extended stats       = Y
 FW version           = Y
 Module EEPROM dump   = Y
+Registers dump       = Y
 Linux                = Y
 ARMv8                = Y
 Usage doc            = Y
doc/guides/nics/features/cnxk_vf.ini +1 -0
index 4dbdfcb..3cbc369 100644
@@ -33,6 +33,7 @@ Stats per queue      = Y
 Extended stats       = Y
 FW version           = Y
 Module EEPROM dump   = Y
+Registers dump       = Y
 Linux                = Y
 ARMv8                = Y
 Usage doc            = Y
drivers/net/cnxk/cnxk_ethdev.c +1 -0
index f006718..99fb091 100644
@@ -1180,6 +1180,7 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
 	.txq_info_get = cnxk_nix_txq_info_get,
 	.tx_done_cleanup = cnxk_nix_tx_done_cleanup,
 	.filter_ctrl = cnxk_nix_filter_ctrl,
+	.get_reg = cnxk_nix_dev_get_reg,
 };
 
 static int
drivers/net/cnxk/cnxk_ethdev.h +4 -0
index 4b25593..74573f9 100644
@@ -313,6 +313,10 @@ void *cnxk_nix_fastpath_lookup_mem_get(void);
 int cnxk_ethdev_parse_devargs(struct rte_devargs *devargs,
 			      struct cnxk_eth_dev *dev);
 
+/* Debug */
+int cnxk_nix_dev_get_reg(struct rte_eth_dev *eth_dev,
+			 struct rte_dev_reg_info *regs);
+
 /* Inlines */
 static __rte_always_inline uint64_t
 cnxk_pktmbuf_detach(struct rte_mbuf *m)
drivers/net/cnxk/cnxk_ethdev_ops.c +25 -0
index bf89ede..41c6d37 100644
@@ -702,3 +702,28 @@ cnxk_nix_tx_done_cleanup(void *txq, uint32_t free_cnt)
 
 	return 0;
 }
+
+int
+cnxk_nix_dev_get_reg(struct rte_eth_dev *eth_dev, struct rte_dev_reg_info *regs)
+{
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	struct roc_nix *nix = &dev->nix;
+	uint64_t *data = regs->data;
+	int rc = -ENOTSUP;
+
+	if (data == NULL) {
+		rc = roc_nix_lf_get_reg_count(nix);
+		if (rc > 0) {
+			regs->length = rc;
+			regs->width = 8;
+			rc = 0;
+		}
+		return rc;
+	}
+
+	if (!regs->length ||
+	    regs->length == (uint32_t)roc_nix_lf_get_reg_count(nix))
+		return roc_nix_lf_reg_dump(nix, data);
+
+	return rc;
+}
Signature · 1 line
2.8.4
#45 lore raw

v2 cover Marvell CNXK Ethdev Driver

In reply to Nithin Dabilpuram

This patchset adds support for Marvell CN106XX SoC based on 'common/cnxk' driver. In future, CN9K a.k.a octeontx2 will also be supported by same driver when code is ready and 'net/octeontx2' will be deprecated.

Harman Kalra (1):
common/cnxk: allocate lmt region in userspace

Jerin Jacob (7):
common/cnxk: fix batch alloc completion poll logic net/cnxk: add Rx support for cn9k net/cnxk: add Rx vector version for cn9k net/cnxk: add Tx support for cn9k net/cnxk: add Rx support for cn10k net/cnxk: add Rx vector version for cn10k net/cnxk: add Tx support for cn10k

Kiran Kumar K (2):
net/cnxk: add support to configure npc net/cnxk: add initial version of rte flow support

Nithin Dabilpuram (17):
net/cnxk: add build infra and common probe net/cnxk: add platform specific probe and remove net/cnxk: add common devargs parsing function net/cnxk: add common dev infos get support net/cnxk: add device configuration operation net/cnxk: add link status update support net/cnxk: add Rx queue setup and release net/cnxk: add Tx queue setup and release net/cnxk: add packet type support net/cnxk: add queue start and stop support net/cnxk: add Rx multi-segmented version for cn9k net/cnxk: add Tx multi-segment version for cn9k net/cnxk: add Tx vector version for cn9k net/cnxk: add Rx multi-segment version for cn10k net/cnxk: add Tx multi-segment version for cn10k net/cnxk: add Tx vector version for cn10k net/cnxk: add device start and stop operations

Satha Rao (8):
common/cnxk: add support to lock NIX RQ contexts common/cnxk: add provision to enable RED on RQ net/cnxk: add port/queue stats
net/cnxk: add xstats apis
net/cnxk: add rxq/txq info get operations net/cnxk: add ethdev firmware version get net/cnxk: add get register operation net/cnxk: added reta and rss_hash operations

Satheesh Paul (6):
common/cnxk: add support to dump flow entries common/cnxk: support for mark and flag flow actions common/cnxk: fix flow create on CN98xx net/cnxk: add flow ops get operation net/cnxk: support for rss in rte_flow net/cnxk: support for rte flow dev dump API

Srujana Challa (1):
common/cnxk: update Rx inline IPsec mbox message format

Sunil Kumar Kori (20):
net/cnxk: add MAC address set ops
net/cnxk: add MTU set device operation net/cnxk: add promiscuous mode enable and disable net/cnxk: add DMAC filter support
net/cnxk: add all multicast enable/disable ethops net/cnxk: add Rx/Tx burst mode get ops net/cnxk: add flow ctrl set/get ops net/cnxk: add link up/down operations net/cnxk: add EEPROM module info get operations net/cnxk: add Rx queue interrupt enable/disable ops net/cnxk: add validation API for mempool ops net/cnxk: add device close and reset operations net/cnxk: add pending Tx mbuf cleanup operation net/cnxk: register callback to get PTP status net/cnxk: add base PTP timesync support net/cnxk: add timesync enable/disable operations net/cnxk: add Rx/Tx timestamp read operations net/cnxk: add time read/write/adjust operations net/cnxk: add read clock operation net/cnxk: add multicast filter support

--

v2:
- Fixed issue with flow validate and flow create for 98xx
- Fixed issue batch alloc logic
- Fix lmtline allocation to be cached
- Sync Inline IPSec Rx mbox with kernel
- Add support for mark and flag flow actions
- Add reta key and hash update ops
- Added PTP and multicast filter support

 MAINTAINERS                             |    3 +
 doc/guides/nics/cnxk.rst                |  343 ++++++
 doc/guides/nics/features/cnxk.ini       |   90 ++
 doc/guides/nics/features/cnxk_vec.ini   |   44 +
 doc/guides/nics/features/cnxk_vf.ini    |   40 +
 doc/guides/nics/index.rst               |    1 +
 doc/guides/platform/cnxk.rst            |    3 +
 drivers/common/cnxk/hw/npc.h            |    2 +
 drivers/common/cnxk/meson.build         |    1 +
 drivers/common/cnxk/roc_api.h           |    2 +
 drivers/common/cnxk/roc_dev.c           |   98 +-
 drivers/common/cnxk/roc_dev_priv.h      |    1 +
 drivers/common/cnxk/roc_mbox.h          |    6 +
 drivers/common/cnxk/roc_model.h         |    6 +
 drivers/common/cnxk/roc_nix.h           |   39 +-
 drivers/common/cnxk/roc_nix_queue.c     |   52 +
 drivers/common/cnxk/roc_nix_rss.c       |   51 +-
 drivers/common/cnxk/roc_nix_tm_utils.c  |   86 +-
 drivers/common/cnxk/roc_npa.c           |   10 +-
 drivers/common/cnxk/roc_npa.h           |   35 +-
 drivers/common/cnxk/roc_npc.c           |   41 +-
 drivers/common/cnxk/roc_npc.h           |   15 +-
 drivers/common/cnxk/roc_npc_mcam_dump.c |  611 +++++++++++
 drivers/common/cnxk/roc_npc_priv.h      |    2 +-
 drivers/common/cnxk/roc_npc_utils.c     |    4 +
 drivers/common/cnxk/roc_platform.h      |   13 +
 drivers/common/cnxk/version.map         |    5 +
 drivers/net/cnxk/cn10k_ethdev.c         |  534 ++++++++++
 drivers/net/cnxk/cn10k_ethdev.h         |   40 +
 drivers/net/cnxk/cn10k_rx.c             |   78 ++
 drivers/net/cnxk/cn10k_rx.h             |  546 ++++++++++
 drivers/net/cnxk/cn10k_rx_mseg.c        |   17 +
 drivers/net/cnxk/cn10k_rx_vec.c         |   22 +
 drivers/net/cnxk/cn10k_tx.c             |   82 ++
 drivers/net/cnxk/cn10k_tx.h             | 1737 +++++++++++++++++++++++++++++++
 drivers/net/cnxk/cn10k_tx_mseg.c        |   25 +
 drivers/net/cnxk/cn10k_tx_vec.c         |   26 +
 drivers/net/cnxk/cn9k_ethdev.c          |  557 ++++++++++
 drivers/net/cnxk/cn9k_ethdev.h          |   38 +
 drivers/net/cnxk/cn9k_rx.c              |   78 ++
 drivers/net/cnxk/cn9k_rx.h              |  548 ++++++++++
 drivers/net/cnxk/cn9k_rx_mseg.c         |   17 +
 drivers/net/cnxk/cn9k_rx_vec.c          |   20 +
 drivers/net/cnxk/cn9k_tx.c              |   81 ++
 drivers/net/cnxk/cn9k_tx.h              | 1605 ++++++++++++++++++++++++++++
 drivers/net/cnxk/cn9k_tx_mseg.c         |   25 +
 drivers/net/cnxk/cn9k_tx_vec.c          |   26 +
 drivers/net/cnxk/cnxk_ethdev.c          | 1511 +++++++++++++++++++++++++++
 drivers/net/cnxk/cnxk_ethdev.h          |  478 +++++++++
 drivers/net/cnxk/cnxk_ethdev_devargs.c  |  173 +++
 drivers/net/cnxk/cnxk_ethdev_ops.c      |  904 ++++++++++++++++
 drivers/net/cnxk/cnxk_link.c            |  113 ++
 drivers/net/cnxk/cnxk_lookup.c          |  326 ++++++
 drivers/net/cnxk/cnxk_ptp.c             |  287 +++++
 drivers/net/cnxk/cnxk_rte_flow.c        |  366 +++++++
 drivers/net/cnxk/cnxk_rte_flow.h        |   69 ++
 drivers/net/cnxk/cnxk_stats.c           |  217 ++++
 drivers/net/cnxk/meson.build            |   45 +
 drivers/net/cnxk/version.map            |    3 +
 drivers/net/meson.build                 |    1 +
 60 files changed, 12116 insertions(+), 83 deletions(-)
 create mode 100644 doc/guides/nics/cnxk.rst
 create mode 100644 doc/guides/nics/features/cnxk.ini
 create mode 100644 doc/guides/nics/features/cnxk_vec.ini
 create mode 100644 doc/guides/nics/features/cnxk_vf.ini
 create mode 100644 drivers/common/cnxk/roc_npc_mcam_dump.c
 create mode 100644 drivers/net/cnxk/cn10k_ethdev.c
 create mode 100644 drivers/net/cnxk/cn10k_ethdev.h
 create mode 100644 drivers/net/cnxk/cn10k_rx.c
 create mode 100644 drivers/net/cnxk/cn10k_rx.h
 create mode 100644 drivers/net/cnxk/cn10k_rx_mseg.c
 create mode 100644 drivers/net/cnxk/cn10k_rx_vec.c
 create mode 100644 drivers/net/cnxk/cn10k_tx.c
 create mode 100644 drivers/net/cnxk/cn10k_tx.h
 create mode 100644 drivers/net/cnxk/cn10k_tx_mseg.c
 create mode 100644 drivers/net/cnxk/cn10k_tx_vec.c
 create mode 100644 drivers/net/cnxk/cn9k_ethdev.c
 create mode 100644 drivers/net/cnxk/cn9k_ethdev.h
 create mode 100644 drivers/net/cnxk/cn9k_rx.c
 create mode 100644 drivers/net/cnxk/cn9k_rx.h
 create mode 100644 drivers/net/cnxk/cn9k_rx_mseg.c
 create mode 100644 drivers/net/cnxk/cn9k_rx_vec.c
 create mode 100644 drivers/net/cnxk/cn9k_tx.c
 create mode 100644 drivers/net/cnxk/cn9k_tx.h
 create mode 100644 drivers/net/cnxk/cn9k_tx_mseg.c
 create mode 100644 drivers/net/cnxk/cn9k_tx_vec.c
 create mode 100644 drivers/net/cnxk/cnxk_ethdev.c
 create mode 100644 drivers/net/cnxk/cnxk_ethdev.h
 create mode 100644 drivers/net/cnxk/cnxk_ethdev_devargs.c
 create mode 100644 drivers/net/cnxk/cnxk_ethdev_ops.c
 create mode 100644 drivers/net/cnxk/cnxk_link.c
 create mode 100644 drivers/net/cnxk/cnxk_lookup.c
 create mode 100644 drivers/net/cnxk/cnxk_ptp.c
 create mode 100644 drivers/net/cnxk/cnxk_rte_flow.c
 create mode 100644 drivers/net/cnxk/cnxk_rte_flow.h
 create mode 100644 drivers/net/cnxk/cnxk_stats.c
 create mode 100644 drivers/net/cnxk/meson.build
 create mode 100644 drivers/net/cnxk/version.map
Signature · 1 line
2.8.4
#46 lore raw

PATCH v2 1/62 common/cnxk: add support to lock NIX RQ contexts

From: Satha Rao <[email protected]>

This patch will consider device argument to lock rss table in NIX.

This patch also adds few misc fixes such as disabling NIX Tx vlan insertion conf in SMQ, enabling SSO in NIX Tx SQ for Tx completions and TM related stats API.

---
 drivers/common/cnxk/roc_nix.h          | 31 ++++++++++--
 drivers/common/cnxk/roc_nix_queue.c    |  2 +
 drivers/common/cnxk/roc_nix_rss.c      | 51 ++++++++++++++++++--
 drivers/common/cnxk/roc_nix_tm_utils.c | 86 +++++++++++++++++++++++++++++++++-
 drivers/common/cnxk/roc_platform.h     |  2 +
 drivers/common/cnxk/version.map        |  1 +
 6 files changed, 163 insertions(+), 10 deletions(-)
drivers/common/cnxk/roc_nix.h +27 -4
index b39f461..6d9ac10 100644
@@ -85,10 +85,11 @@ struct roc_nix_eeprom_info {
 #define ROC_NIX_LF_RX_CFG_LEN_OL3     BIT_ULL(41)
 
 /* Group 0 will be used for RSS, 1 -7 will be used for npc_flow RSS action*/
-#define ROC_NIX_RSS_GROUP_DEFAULT 0
-#define ROC_NIX_RSS_GRPS	  8
-#define ROC_NIX_RSS_RETA_MAX	  ROC_NIX_RSS_RETA_SZ_256
-#define ROC_NIX_RSS_KEY_LEN	  48 /* 352 Bits */
+#define ROC_NIX_RSS_GROUP_DEFAULT    0
+#define ROC_NIX_RSS_GRPS	     8
+#define ROC_NIX_RSS_RETA_MAX	     ROC_NIX_RSS_RETA_SZ_256
+#define ROC_NIX_RSS_KEY_LEN	     48 /* 352 Bits */
+#define ROC_NIX_RSS_MCAM_IDX_DEFAULT (-1)
 
 #define ROC_NIX_DEFAULT_HW_FRS 1514
 
@@ -184,6 +185,7 @@ struct roc_nix_sq {
 	enum roc_nix_sq_max_sqe_sz max_sqe_sz;
 	uint32_t nb_desc;
 	uint16_t qid;
+	bool sso_ena;
 	/* End of Input parameters */
 	uint16_t sqes_per_sqb_log2;
 	struct roc_nix *roc_nix;
@@ -241,6 +243,8 @@ struct roc_nix {
 	uint16_t max_sqb_count;
 	enum roc_nix_rss_reta_sz reta_sz;
 	bool enable_loop;
+	bool hw_vlan_ins;
+	uint8_t lock_rx_ctx;
 	/* End of input parameters */
 	/* LMT line base for "Per Core Tx LMT line" mode*/
 	uintptr_t lmt_base;
@@ -371,6 +375,22 @@ struct roc_nix_tm_shaper_profile {
 	void (*free_fn)(void *profile);
 };
 
+enum roc_nix_tm_node_stats_type {
+	ROC_NIX_TM_NODE_PKTS_DROPPED,
+	ROC_NIX_TM_NODE_BYTES_DROPPED,
+	ROC_NIX_TM_NODE_GREEN_PKTS,
+	ROC_NIX_TM_NODE_GREEN_BYTES,
+	ROC_NIX_TM_NODE_YELLOW_PKTS,
+	ROC_NIX_TM_NODE_YELLOW_BYTES,
+	ROC_NIX_TM_NODE_RED_PKTS,
+	ROC_NIX_TM_NODE_RED_BYTES,
+	ROC_NIX_TM_NODE_STATS_MAX,
+};
+
+struct roc_nix_tm_node_stats {
+	uint64_t stats[ROC_NIX_TM_NODE_STATS_MAX];
+};
+
 int __roc_api roc_nix_tm_node_add(struct roc_nix *roc_nix,
 				  struct roc_nix_tm_node *roc_node);
 int __roc_api roc_nix_tm_node_delete(struct roc_nix *roc_nix, uint32_t node_id,
@@ -408,6 +428,9 @@ roc_nix_tm_shaper_profile_get(struct roc_nix *roc_nix, uint32_t profile_id);
 struct roc_nix_tm_shaper_profile *__roc_api roc_nix_tm_shaper_profile_next(
 	struct roc_nix *roc_nix, struct roc_nix_tm_shaper_profile *__prev);
 
+int __roc_api roc_nix_tm_node_stats_get(struct roc_nix *roc_nix,
+					uint32_t node_id, bool clear,
+					struct roc_nix_tm_node_stats *stats);
 /*
  * TM ratelimit tree API.
  */
drivers/common/cnxk/roc_nix_queue.c +2 -0
index fbf7efa..1c62aa2 100644
@@ -582,6 +582,7 @@ sq_cn9k_init(struct nix *nix, struct roc_nix_sq *sq, uint32_t rr_quantum,
 	aq->sq.default_chan = nix->tx_chan_base;
 	aq->sq.sqe_stype = NIX_STYPE_STF;
 	aq->sq.ena = 1;
+	aq->sq.sso_ena = !!sq->sso_ena;
 	if (aq->sq.max_sqe_size == NIX_MAXSQESZ_W8)
 		aq->sq.sqe_stype = NIX_STYPE_STP;
 	aq->sq.sqb_aura = roc_npa_aura_handle_to_aura(sq->aura_handle);
@@ -679,6 +680,7 @@ sq_init(struct nix *nix, struct roc_nix_sq *sq, uint32_t rr_quantum,
 	aq->sq.default_chan = nix->tx_chan_base;
 	aq->sq.sqe_stype = NIX_STYPE_STF;
 	aq->sq.ena = 1;
+	aq->sq.sso_ena = !!sq->sso_ena;
 	if (aq->sq.max_sqe_size == NIX_MAXSQESZ_W8)
 		aq->sq.sqe_stype = NIX_STYPE_STP;
 	aq->sq.sqb_aura = roc_npa_aura_handle_to_aura(sq->aura_handle);
drivers/common/cnxk/roc_nix_rss.c +47 -4

82 lines not on this page · raw message

drivers/common/cnxk/roc_nix_tm_utils.c +84 -2

101 lines not on this page · raw message

drivers/common/cnxk/roc_platform.h +2 -0
index 7864fa4..911ae15 100644
@@ -127,6 +127,8 @@
 #define plt_memzone_reserve_cache_align(name, sz)                              \
 	rte_memzone_reserve_aligned(name, sz, 0, 0, RTE_CACHE_LINE_SIZE)
 #define plt_memzone_free rte_memzone_free
+#define plt_memzone_reserve_aligned(name, len, flags, align)                   \
+	rte_memzone_reserve_aligned((name), (len), 0, (flags), (align))
 
 #define plt_tsc_hz   rte_get_tsc_hz
 #define plt_delay_ms rte_delay_ms
drivers/common/cnxk/version.map +1 -0
index 8e67c83..c39d76f 100644
@@ -123,6 +123,7 @@ INTERNAL {
 	roc_nix_tm_node_parent_update;
 	roc_nix_tm_node_pkt_mode_update;
 	roc_nix_tm_node_shaper_update;
+	roc_nix_tm_node_stats_get;
 	roc_nix_tm_node_suspend_resume;
 	roc_nix_tm_prealloc_res;
 	roc_nix_tm_rlimit_sq;
Signature · 1 line
2.8.4
#47 lore raw

Re: [dpdk-dev] [PATCH v2 01/62] common/cnxk: add support to lock NIX RQ contexts

Quoted 10 lines · On Mon, 7 Jun 2021 23:28:42 +0530 Nithin Dabilpuram <[email protected]>…

From: Satha Rao <[email protected]>

This patch will consider device argument to lock rss table in NIX.

This patch also adds few misc fixes such as disabling NIX Tx vlan insertion conf in SMQ, enabling SSO in NIX Tx SQ for Tx completions and TM related stats API.

In general, breaking patches into smaller parts is helpful. But in this case breaking a driver into 62 smaller pieces is getting ridiculous. It is too tedious to review the small chunks.

#48 lore raw

Re: [dpdk-dev] [PATCH v2 01/62] common/cnxk: add support to lock NIX RQ contexts

Quoted 13 lines · Stephen Hemminger
Quoted 9 lines · On Mon, 7 Jun 2021 23:28:42 +0530 Nithin Dabilpuram <[email protected]>…

From: Satha Rao <[email protected]>

This patch will consider device argument to lock rss table in NIX.

This patch also adds few misc fixes such as disabling NIX Tx vlan insertion conf in SMQ, enabling SSO in NIX Tx SQ for Tx completions and TM related stats API.

Quoted 5 lines
Quoted 1 line

In general, breaking patches into smaller parts is helpful. But in this case breaking a driver into 62 smaller pieces is getting ridiculous. It is too tedious to review the small chunks.

I think, it is other way around. More logically splited patches are easy to review.

Quoted 1 line
#49 lore raw

PATCH v2 2/62 common/cnxk: update Rx inline IPsec mbox message format

In reply to Nithin Dabilpuram

From: Srujana Challa <[email protected]>

Updates Rx inline IPSEC mailbox message format to make it sync with latest CPT PF driver.

---
 drivers/common/cnxk/roc_mbox.h | 3 +++
 1 file changed, 3 insertions(+)
drivers/common/cnxk/roc_mbox.h +3 -0
index f6b11b6..fe4df21 100644
@@ -1328,6 +1328,9 @@ struct cpt_rxc_time_cfg_req {
 struct cpt_rx_inline_lf_cfg_msg {
 	struct mbox_msghdr hdr;
 	uint16_t __io sso_pf_func;
+	uint16_t __io param1;
+	uint16_t __io param2;
+	uint16_t __io reserved;
 };
 
 enum cpt_eng_type {
Signature · 1 line
2.8.4
#50 lore raw

Re: [dpdk-dev] [PATCH v2 02/62] common/cnxk: update Rx inline IPsec mbox message format

Quoted 16 lines · Nithin Dabilpuram

From: Srujana Challa <[email protected]>

Updates Rx inline IPSEC mailbox message format to make it sync with latest CPT PF driver.

---
 drivers/common/cnxk/roc_mbox.h | 3 +++
 1 file changed, 3 insertions(+)
drivers/common/cnxk/roc_mbox.h +0 -0
index f6b11b6..fe4df21 100644

drivers/common/cnxk/roc_mbox.h struct cpt_rxc_time_cfg_req { · line 1336

Quoted 9 lines
drivers/common/cnxk/roc_mbox.h +3 -0
@@ -1328,6 +1328,9 @@ struct cpt_rxc_time_cfg_req {
 struct cpt_rx_inline_lf_cfg_msg {
 	struct mbox_msghdr hdr;
 	uint16_t __io sso_pf_func;
+	uint16_t __io param1;
+	uint16_t __io param2;
+	uint16_t __io reserved;
 };
 
 enum cpt_eng_type {

Isn't is a dead code?
May be it should be added when it is actually used?

#51 lore raw

Re: [dpdk-dev] [PATCH v2 02/62] common/cnxk: update Rx inline IPsec mbox message format

Quoted 24 lines · Andrew Rybchenko
Quoted 23 lines · Nithin Dabilpuram

From: Srujana Challa <[email protected]>

Updates Rx inline IPSEC mailbox message format to make it sync with latest CPT PF driver.

---
 drivers/common/cnxk/roc_mbox.h | 3 +++
 1 file changed, 3 insertions(+)
drivers/common/cnxk/roc_mbox.h +3 -0
index f6b11b6..fe4df21 100644
@@ -1328,6 +1328,9 @@ struct cpt_rxc_time_cfg_req {
 struct cpt_rx_inline_lf_cfg_msg {
 	struct mbox_msghdr hdr;
 	uint16_t __io sso_pf_func;
+	uint16_t __io param1;
+	uint16_t __io param2;
+	uint16_t __io reserved;
 };
 
Quoted 5 lines

drivers/common/cnxk/roc_mbox.h struct cpt_rxc_time_cfg_req { · line 1336

Quoted 2 lines
drivers/common/cnxk/roc_mbox.h +0 -0
 enum cpt_eng_type {

Isn't is a dead code?
May be it should be added when it is actually used?

This patch is just a sync of this data structure b/w Kernel and Userspace used for mbox communication.
It is already used to generate mbox message request response API's via and drivers/common/cnxk/roc_mbox_priv.h:158 for all mbox messages.

Since it is common code and just a datastructure update to be in sync with kernel, isn't it fine ?

#52 lore raw

Re: [dpdk-dev] [PATCH v2 02/62] common/cnxk: update Rx inline IPsec mbox message format

In reply to Nithin Dabilpuram
Quoted 16 lines · Nithin Dabilpuram

From: Srujana Challa <[email protected]>

Updates Rx inline IPSEC mailbox message format to make it sync with latest CPT PF driver.

---
 drivers/common/cnxk/roc_mbox.h | 3 +++
 1 file changed, 3 insertions(+)
drivers/common/cnxk/roc_mbox.h +0 -0
index f6b11b6..fe4df21 100644

drivers/common/cnxk/roc_mbox.h struct cpt_rxc_time_cfg_req { · line 1333

Quoted 6 lines
drivers/common/cnxk/roc_mbox.h +3 -0
@@ -1328,6 +1328,9 @@ struct cpt_rxc_time_cfg_req {
 struct cpt_rx_inline_lf_cfg_msg {
        struct mbox_msghdr hdr;
        uint16_t __io sso_pf_func;
+       uint16_t __io param1;
+       uint16_t __io param2;
+       uint16_t __io reserved;

Items like 3 lines changes, Please squash to some other patches in the series.

Quoted 6 lines
drivers/common/cnxk/roc_mbox.h +0 -1
 };
 
 enum cpt_eng_type {
--

2.8.4

#53 lore raw

PATCH v2 3/62 common/cnxk: fix batch alloc completion poll logic

In reply to Nithin Dabilpuram

From: Jerin Jacob <[email protected]>

The instruction generation was not correct due to fact that volatile suppose to use with ccode variable as well.

Change the logic to use gcc atomic builtin to simplify and avoid explicit volatile from the code.

Fixes 81af26789316 ("common/cnxk: support NPA batch alloc/free")
---
 drivers/common/cnxk/roc_npa.c |  2 +-
 drivers/common/cnxk/roc_npa.h | 30 +++++++++++++++---------------
 2 files changed, 16 insertions(+), 16 deletions(-)
drivers/common/cnxk/roc_npa.c +1 -1
index f1e03b7..5ba6e81 100644
@@ -236,7 +236,7 @@ npa_aura_pool_pair_alloc(struct npa_lf *lf, const uint32_t block_size,
 
 	/* Block size should be cache line aligned and in range of 128B-128KB */
 	if (block_size % ROC_ALIGN || block_size < 128 ||
-	    block_size > 128 * 1024)
+	    block_size > ROC_NPA_MAX_BLOCK_SZ)
 		return NPA_ERR_INVALID_BLOCK_SZ;
 
 	pos = 0;
drivers/common/cnxk/roc_npa.h +15 -15
index 89f5c6f..59d6223 100644
@@ -8,6 +8,7 @@
 #define ROC_AURA_ID_MASK       (BIT_ULL(16) - 1)
 #define ROC_AURA_OP_LIMIT_MASK (BIT_ULL(36) - 1)
 
+#define ROC_NPA_MAX_BLOCK_SZ		   (128 * 1024)
 #define ROC_CN10K_NPA_BATCH_ALLOC_MAX_PTRS 512
 #define ROC_CN10K_NPA_BATCH_FREE_MAX_PTRS  15
 
@@ -219,6 +220,17 @@ roc_npa_aura_batch_alloc_issue(uint64_t aura_handle, uint64_t *buf,
 	return 0;
 }
 
+static inline void
+roc_npa_batch_alloc_wait(uint64_t *cache_line)
+{
+	/* Batch alloc status code is updated in bits [5:6] of the first word
+	 * of the 128 byte cache line.
+	 */
+	while (((__atomic_load_n(cache_line, __ATOMIC_RELAXED) >> 5) & 0x3) ==
+	       ALLOC_CCODE_INVAL)
+		;
+}
+
 static inline unsigned int
 roc_npa_aura_batch_alloc_count(uint64_t *aligned_buf, unsigned int num)
 {
@@ -231,17 +243,10 @@ roc_npa_aura_batch_alloc_count(uint64_t *aligned_buf, unsigned int num)
 	/* Check each ROC cache line one by one */
 	for (i = 0; i < num; i += (ROC_ALIGN >> 3)) {
 		struct npa_batch_alloc_status_s *status;
-		int ccode;
 
 		status = (struct npa_batch_alloc_status_s *)&aligned_buf[i];
 
-		/* Status is updated in first 7 bits of each 128 byte cache
-		 * line. Wait until the status gets updated.
-		 */
-		do {
-			ccode = (volatile int)status->ccode;
-		} while (ccode == ALLOC_CCODE_INVAL);
-
+		roc_npa_batch_alloc_wait(&aligned_buf[i]);
 		count += status->count;
 	}
 
@@ -261,16 +266,11 @@ roc_npa_aura_batch_alloc_extract(uint64_t *buf, uint64_t *aligned_buf,
 	/* Check each ROC cache line one by one */
 	for (i = 0; i < num; i += (ROC_ALIGN >> 3)) {
 		struct npa_batch_alloc_status_s *status;
-		int line_count, ccode;
+		int line_count;
 
 		status = (struct npa_batch_alloc_status_s *)&aligned_buf[i];
 
-		/* Status is updated in first 7 bits of each 128 byte cache
-		 * line. Wait until the status gets updated.
-		 */
-		do {
-			ccode = (volatile int)status->ccode;
-		} while (ccode == ALLOC_CCODE_INVAL);
+		roc_npa_batch_alloc_wait(&aligned_buf[i]);
 
 		line_count = status->count;
 
Signature · 1 line
2.8.4
#54 lore raw

PATCH v2 4/62 common/cnxk: add support to dump flow entries

In reply to Nithin Dabilpuram

From: Satheesh Paul <[email protected]>

Add NPC support API to dump created flow entries.

---
 drivers/common/cnxk/hw/npc.h            |   2 +
 drivers/common/cnxk/meson.build         |   1 +
 drivers/common/cnxk/roc_npc.c           |  20 ++
 drivers/common/cnxk/roc_npc.h           |  12 +-
 drivers/common/cnxk/roc_npc_mcam_dump.c | 611 ++++++++++++++++++++++++++++++++
 drivers/common/cnxk/roc_npc_priv.h      |   2 +-
 drivers/common/cnxk/roc_npc_utils.c     |   4 +
 drivers/common/cnxk/version.map         |   2 +
 8 files changed, 652 insertions(+), 2 deletions(-)
 create mode 100644 drivers/common/cnxk/roc_npc_mcam_dump.c
drivers/common/cnxk/hw/npc.h +2 -0
index e0f06bf..68c5037 100644
@@ -193,6 +193,7 @@ enum npc_kpu_lb_ltype {
 	NPC_LT_LB_EXDSA,
 	NPC_LT_LB_EXDSA_VLAN,
 	NPC_LT_LB_FDSA,
+	NPC_LT_LB_VLAN_EXDSA,
 	NPC_LT_LB_CUSTOM0 = 0xE,
 	NPC_LT_LB_CUSTOM1 = 0xF,
 };
@@ -208,6 +209,7 @@ enum npc_kpu_lc_ltype {
 	NPC_LT_LC_MPLS,
 	NPC_LT_LC_NSH,
 	NPC_LT_LC_FCOE,
+	NPC_LT_LC_NGIO,
 	NPC_LT_LC_CUSTOM0 = 0xE,
 	NPC_LT_LC_CUSTOM1 = 0xF,
 };
drivers/common/cnxk/meson.build +1 -0
index 178bce7..e7ab79f 100644
@@ -37,6 +37,7 @@ sources = files(
         'roc_npa_irq.c',
         'roc_npc.c',
         'roc_npc_mcam.c',
+        'roc_npc_mcam_dump.c',
         'roc_npc_parse.c',
         'roc_npc_utils.c',
         'roc_platform.c',
drivers/common/cnxk/roc_npc.c +20 -0
index abaef77..81c7fd9 100644
@@ -870,3 +870,23 @@ roc_npc_flow_destroy(struct roc_npc *roc_npc, struct roc_npc_flow *flow)
 	plt_free(flow);
 	return 0;
 }
+
+void
+roc_npc_flow_dump(FILE *file, struct roc_npc *roc_npc)
+{
+	struct npc *npc = roc_npc_to_npc_priv(roc_npc);
+	struct roc_npc_flow *flow_iter;
+	struct npc_flow_list *list;
+	uint32_t max_prio, i;
+
+	max_prio = npc->flow_max_priority;
+
+	for (i = 0; i < max_prio; i++) {
+		list = &npc->flow_list[i];
+
+		/* List in ascending order of mcam entries */
+		TAILQ_FOREACH(flow_iter, list, next) {
+			roc_npc_flow_mcam_dump(file, roc_npc, flow_iter);
+		}
+	}
+}
drivers/common/cnxk/roc_npc.h +11 -1
index 223c4ba..115bcd5 100644
@@ -90,6 +90,11 @@ struct roc_npc_attr {
 	uint32_t reserved : 30; /**< Reserved, must be zero. */
 };
 
+struct roc_npc_flow_dump_data {
+	uint8_t lid;
+	uint16_t ltype;
+};
+
 struct roc_npc_flow {
 	uint8_t nix_intf;
 	uint8_t enable;
@@ -102,6 +107,9 @@ struct roc_npc_flow {
 	uint64_t mcam_mask[ROC_NPC_MAX_MCAM_WIDTH_DWORDS];
 	uint64_t npc_action;
 	uint64_t vtag_action;
+#define ROC_NPC_MAX_FLOW_PATTERNS 32
+	struct roc_npc_flow_dump_data dump_data[ROC_NPC_MAX_FLOW_PATTERNS];
+	uint16_t num_patterns;
 
 	TAILQ_ENTRY(roc_npc_flow) next;
 };
@@ -185,5 +193,7 @@ int __roc_api roc_npc_mcam_clear_counter(struct roc_npc *roc_npc,
 					 uint32_t ctr_id);
 
 int __roc_api roc_npc_mcam_free_all_resources(struct roc_npc *roc_npc);
-
+void __roc_api roc_npc_flow_dump(FILE *file, struct roc_npc *roc_npc);
+void __roc_api roc_npc_flow_mcam_dump(FILE *file, struct roc_npc *roc_npc,
+				      struct roc_npc_flow *mcam);
 #endif /* _ROC_NPC_H_ */
drivers/common/cnxk/roc_npc_mcam_dump.c new file +611 -0

611 lines not on this page · raw message

drivers/common/cnxk/roc_npc_priv.h +1 -1
index 8bc5bac..961583b 100644
@@ -47,7 +47,7 @@
 #define NPC_RVUPF_MAX_9XXX 0x10 /* HRM: RVU_PRIV_CONST */
 #define NPC_RVUPF_MAX_10XX 0x20 /* HRM: RVU_PRIV_CONST */
 #define NPC_NIXLF_MAX	   0x80 /* HRM: NIX_AF_CONST2 */
-#define NPC_MCAME_PER_PF   2	/* DRV: RSVD_MCAM_ENTRIES_PER_PF */
+#define NPC_MCAME_PER_PF   3	/* DRV: RSVD_MCAM_ENTRIES_PER_PF */
 #define NPC_MCAME_PER_LF   1	/* DRV: RSVD_MCAM_ENTRIES_PER_NIXLF */
 #define NPC_MCAME_RESVD_9XXX                                                   \
 	(NPC_NIXLF_MAX * NPC_MCAME_PER_LF +                                    \
drivers/common/cnxk/roc_npc_utils.c +4 -0
index 1fb8973..5c97588 100644
@@ -206,6 +206,7 @@ npc_update_parse_state(struct npc_parse_state *pst,
 		       uint8_t flags)
 {
 	struct npc_lid_lt_xtract_info *xinfo;
+	struct roc_npc_flow_dump_data *dump;
 	struct npc_xtract_info *lfinfo;
 	int intf, lf_cfg;
 	int i, j, rc = 0;
@@ -248,6 +249,9 @@ npc_update_parse_state(struct npc_parse_state *pst,
 	}
 
 done:
+	dump = &pst->flow->dump_data[pst->flow->num_patterns++];
+	dump->lid = lid;
+	dump->ltype = lt;
 	pst->pattern++;
 	return 0;
 }
drivers/common/cnxk/version.map +2 -0
index c39d76f..a11ba4d 100644
@@ -160,6 +160,8 @@ INTERNAL {
 	roc_npc_fini;
 	roc_npc_flow_create;
 	roc_npc_flow_destroy;
+	roc_npc_flow_dump;
+	roc_npc_flow_mcam_dump;
 	roc_npc_flow_parse;
 	roc_npc_get_low_priority_mcam;
 	roc_npc_init;
Signature · 1 line
2.8.4
#55 lore raw

PATCH v2 5/62 common/cnxk: support for mark and flag flow actions

In reply to Nithin Dabilpuram

From: Satheesh Paul <[email protected]>

Add roc API to get mark action.

---
 drivers/common/cnxk/roc_npc.c   | 17 +++++++++++++++++
 drivers/common/cnxk/roc_npc.h   |  3 +++
 drivers/common/cnxk/version.map |  2 ++
 3 files changed, 22 insertions(+)
drivers/common/cnxk/roc_npc.c +17 -0
index 81c7fd9..e6a5036 100644
@@ -757,6 +757,23 @@ npc_rss_action_program(struct roc_npc *roc_npc,
 	return 0;
 }
 
+int
+roc_npc_mark_actions_get(struct roc_npc *roc_npc)
+{
+	struct npc *npc = roc_npc_to_npc_priv(roc_npc);
+
+	return npc->mark_actions;
+}
+
+int
+roc_npc_mark_actions_sub_return(struct roc_npc *roc_npc, uint32_t count)
+{
+	struct npc *npc = roc_npc_to_npc_priv(roc_npc);
+
+	npc->mark_actions -= count;
+	return npc->mark_actions;
+}
+
 struct roc_npc_flow *
 roc_npc_flow_create(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
 		    const struct roc_npc_item_info pattern[],
drivers/common/cnxk/roc_npc.h +3 -0
index 115bcd5..cf6f732 100644
@@ -196,4 +196,7 @@ int __roc_api roc_npc_mcam_free_all_resources(struct roc_npc *roc_npc);
 void __roc_api roc_npc_flow_dump(FILE *file, struct roc_npc *roc_npc);
 void __roc_api roc_npc_flow_mcam_dump(FILE *file, struct roc_npc *roc_npc,
 				      struct roc_npc_flow *mcam);
+int __roc_api roc_npc_mark_actions_get(struct roc_npc *roc_npc);
+int __roc_api roc_npc_mark_actions_sub_return(struct roc_npc *roc_npc,
+					      uint32_t count);
 #endif /* _ROC_NPC_H_ */
drivers/common/cnxk/version.map +2 -0
index a11ba4d..554459b 100644
@@ -165,6 +165,8 @@ INTERNAL {
 	roc_npc_flow_parse;
 	roc_npc_get_low_priority_mcam;
 	roc_npc_init;
+	roc_npc_mark_actions_get;
+	roc_npc_mark_actions_sub_return;
 	roc_npc_mcam_alloc_entries;
 	roc_npc_mcam_alloc_entry;
 	roc_npc_mcam_clear_counter;
Signature · 1 line
2.8.4
#56 lore raw

PATCH v2 6/62 common/cnxk: allocate lmt region in userspace

In reply to Nithin Dabilpuram

From: Harman Kalra <[email protected]>

As per the new LMTST design, userspace shall allocate lmt region, setup the DMA translation and share the IOVA with kernel via MBOX. Kernel will convert this IOVA to physical memory and update the LMT table entry with the same.
With this new design also shared mode (i.e. all pci funcs sharing the LMT region allocated by primary/base pci func) is intact.

---
 drivers/common/cnxk/roc_api.h      |  2 +
 drivers/common/cnxk/roc_dev.c      | 98 ++++++++++++++++++--------------------
 drivers/common/cnxk/roc_dev_priv.h |  1 +
 drivers/common/cnxk/roc_mbox.h     |  3 ++
 drivers/common/cnxk/roc_platform.h | 11 +++++
 5 files changed, 63 insertions(+), 52 deletions(-)
drivers/common/cnxk/roc_api.h +2 -0
index 67f5d13..32e383c 100644
@@ -24,6 +24,8 @@
 /* Platform definition */
 #include "roc_platform.h"
 
+#define ROC_LMT_LINE_SZ		    128
+#define ROC_NUM_LMT_LINES	    2048
 #define ROC_LMT_LINES_PER_CORE_LOG2 5
 #define ROC_LMT_LINE_SIZE_LOG2	    7
 #define ROC_LMT_BASE_PER_CORE_LOG2                                             \
drivers/common/cnxk/roc_dev.c +46 -52

150 lines not on this page · raw message

drivers/common/cnxk/roc_dev_priv.h +1 -0
index 910cfb6..7ee604e 100644
@@ -84,6 +84,7 @@ struct dev {
 	struct dev_ops *ops;
 	void *roc_nix;
 	bool disable_shared_lmt; /* false(default): shared lmt mode enabled */
+	const struct plt_memzone *lmt_mz;
 } __plt_cache_aligned;
 
 struct npa {
drivers/common/cnxk/roc_mbox.h +3 -0
index fe4df21..ea11382 100644
@@ -403,6 +403,9 @@ struct lmtst_tbl_setup_req {
 	uint64_t __io dis_line_pref : 1;
 	uint64_t __io ssow_pf_func : 13;
 	uint16_t __io pcifunc;
+	uint8_t __io use_local_lmt_region;
+	uint64_t __io lmt_iova;
+	uint64_t __io rsvd[2]; /* Future use */
 };
 
 /* CGX mbox message formats */
drivers/common/cnxk/roc_platform.h +11 -0
index 911ae15..be58625 100644
@@ -194,4 +194,15 @@ int roc_plt_init(void);
 typedef int (*roc_plt_init_cb_t)(void);
 int __roc_api roc_plt_init_cb_register(roc_plt_init_cb_t cb);
 
+static inline const void *
+plt_lmt_region_reserve_aligned(const char *name, size_t len, uint32_t align)
+{
+	/* To ensure returned memory is physically contiguous, bounding
+	 * the start and end address in 2M range.
+	 */
+	return rte_memzone_reserve_bounded(name, len, SOCKET_ID_ANY,
+					   RTE_MEMZONE_IOVA_CONTIG,
+					   align, RTE_PGSIZE_2M);
+}
+
 #endif /* _ROC_PLATFORM_H_ */
Signature · 1 line
2.8.4
Reviewed-by on v2 6/62
#57 lore raw

Re: [dpdk-dev] [PATCH v2 06/62] common/cnxk: allocate lmt region in userspace

Quoted 11 lines · Nithin Dabilpuram

From: Harman Kalra <[email protected]>

As per the new LMTST design, userspace shall allocate lmt region, setup the DMA translation and share the IOVA with kernel via MBOX. Kernel will convert this IOVA to physical memory and update the LMT table entry with the same.
With this new design also shared mode (i.e. all pci funcs sharing the LMT region allocated by primary/base pci func) is intact.

#58 lore raw

PATCH v2 7/62 common/cnxk: add provision to enable RED on RQ

In reply to Nithin Dabilpuram

From: Satha Rao <[email protected]>

Send RED pass/drop levels based on rq configurations to kernel. Fixed the aura and pool shift value calculation.

---
 drivers/common/cnxk/roc_nix.h       |  8 ++++++
 drivers/common/cnxk/roc_nix_queue.c | 50 +++++++++++++++++++++++++++++++++++++
 drivers/common/cnxk/roc_npa.c       |  8 ++++--
 drivers/common/cnxk/roc_npa.h       |  5 ++++
 4 files changed, 69 insertions(+), 2 deletions(-)
drivers/common/cnxk/roc_nix.h +8 -0
index 6d9ac10..bb69027 100644
@@ -161,6 +161,14 @@ struct roc_nix_rq {
 	uint32_t vwqe_max_sz_exp;
 	uint64_t vwqe_wait_tmo;
 	uint64_t vwqe_aura_handle;
+	/* Average LPB aura level drop threshold for RED */
+	uint8_t red_drop;
+	/* Average LPB aura level pass threshold for RED */
+	uint8_t red_pass;
+	/* Average SPB aura level drop threshold for RED */
+	uint8_t spb_red_drop;
+	/* Average SPB aura level pass threshold for RED */
+	uint8_t spb_red_pass;
 	/* End of Input parameters */
 	struct roc_nix *roc_nix;
 };
drivers/common/cnxk/roc_nix_queue.c +50 -0

74 lines not on this page · raw message

drivers/common/cnxk/roc_npa.c +6 -2
index 5ba6e81..d064d12 100644
@@ -278,13 +278,15 @@ npa_aura_pool_pair_alloc(struct npa_lf *lf, const uint32_t block_size,
 	/* Update aura fields */
 	aura->pool_addr = pool_id; /* AF will translate to associated poolctx */
 	aura->ena = 1;
-	aura->shift = __builtin_clz(block_count) - 8;
+	aura->shift = plt_log2_u32(block_count);
+	aura->shift = aura->shift < 8 ? 0 : aura->shift - 8;
 	aura->limit = block_count;
 	aura->pool_caching = 1;
 	aura->err_int_ena = BIT(NPA_AURA_ERR_INT_AURA_ADD_OVER);
 	aura->err_int_ena |= BIT(NPA_AURA_ERR_INT_AURA_ADD_UNDER);
 	aura->err_int_ena |= BIT(NPA_AURA_ERR_INT_AURA_FREE_UNDER);
 	aura->err_int_ena |= BIT(NPA_AURA_ERR_INT_POOL_DIS);
+	aura->avg_con = ROC_NPA_AVG_CONT;
 	/* Many to one reduction */
 	aura->err_qint_idx = aura_id % lf->qints;
 
@@ -293,13 +295,15 @@ npa_aura_pool_pair_alloc(struct npa_lf *lf, const uint32_t block_size,
 	pool->ena = 1;
 	pool->buf_size = block_size / ROC_ALIGN;
 	pool->stack_max_pages = stack_size;
-	pool->shift = __builtin_clz(block_count) - 8;
+	pool->shift = plt_log2_u32(block_count);
+	pool->shift = pool->shift < 8 ? 0 : pool->shift - 8;
 	pool->ptr_start = 0;
 	pool->ptr_end = ~0;
 	pool->stack_caching = 1;
 	pool->err_int_ena = BIT(NPA_POOL_ERR_INT_OVFLS);
 	pool->err_int_ena |= BIT(NPA_POOL_ERR_INT_RANGE);
 	pool->err_int_ena |= BIT(NPA_POOL_ERR_INT_PERR);
+	pool->avg_con = ROC_NPA_AVG_CONT;
 
 	/* Many to one reduction */
 	pool->err_qint_idx = pool_id % lf->qints;
drivers/common/cnxk/roc_npa.h +5 -0
index 59d6223..3fc6192 100644
@@ -12,6 +12,11 @@
 #define ROC_CN10K_NPA_BATCH_ALLOC_MAX_PTRS 512
 #define ROC_CN10K_NPA_BATCH_FREE_MAX_PTRS  15
 
+/* This value controls how much of the present average resource level is used to
+ * calculate the new resource level.
+ */
+#define ROC_NPA_AVG_CONT 0xE0
+
 /* 16 CASP instructions can be outstanding in CN9k, but we use only 15
  * outstanding CASPs as we run out of registers.
  */
Signature · 1 line
2.8.4
#59 lore raw

PATCH v2 8/62 common/cnxk: fix flow create on CN98xx

In reply to Nithin Dabilpuram

From: Satheesh Paul <[email protected]>

CN96xx and CN98xx have 4096 and 16384 MCAM entries respectively. Aligning the code with the same numbers.

Fixes a07f7ced436d ("common/cnxk: add NPC init and fini")
---
 drivers/common/cnxk/roc_model.h | 6 ++++++
 drivers/common/cnxk/roc_npc.c   | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/common/cnxk/roc_model.h +6 -0
index fb774ac..d6ef459 100644
@@ -88,6 +88,12 @@ roc_model_is_cn10k(void)
 }
 
 static inline uint64_t
+roc_model_is_cn98xx(void)
+{
+	return (roc_model->flag & ROC_MODEL_CN98xx_A0);
+}
+
+static inline uint64_t
 roc_model_is_cn96_A0(void)
 {
 	return roc_model->flag & ROC_MODEL_CN96xx_A0;
drivers/common/cnxk/roc_npc.c +1 -1
index e6a5036..a69be4f 100644
@@ -101,7 +101,7 @@ npc_mcam_tot_entries(void)
 	/* FIXME: change to reading in AF from NPC_AF_CONST1/2
 	 * MCAM_BANK_DEPTH(_EXT) * MCAM_BANKS
 	 */
-	if (roc_model_is_cn10k())
+	if (roc_model_is_cn10k() || roc_model_is_cn98xx())
 		return 16 * 1024; /* MCAM_BANKS = 4, BANK_DEPTH_EXT = 4096 */
 	else
 		return 4 * 1024; /* MCAM_BANKS = 4, BANK_DEPTH_EXT = 1024 */
Signature · 1 line
2.8.4
#60 lore raw

PATCH v2 9/62 net/cnxk: add build infra and common probe

In reply to Nithin Dabilpuram

Add build infrastructure and common probe and remove for cnxk driver which is used by both CN10K and CN9K SoC.

---
 MAINTAINERS                           |   3 +
 doc/guides/nics/cnxk.rst              |  29 +++++
 doc/guides/nics/features/cnxk.ini     |   9 ++
 doc/guides/nics/features/cnxk_vec.ini |   9 ++
 doc/guides/nics/features/cnxk_vf.ini  |   9 ++
 doc/guides/nics/index.rst             |   1 +
 doc/guides/platform/cnxk.rst          |   3 +
 drivers/net/cnxk/cnxk_ethdev.c        | 219 ++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cnxk_ethdev.h        |  57 +++++++++
 drivers/net/cnxk/meson.build          |  21 ++++
 drivers/net/cnxk/version.map          |   3 +
 drivers/net/meson.build               |   1 +
 12 files changed, 364 insertions(+)
 create mode 100644 doc/guides/nics/cnxk.rst
 create mode 100644 doc/guides/nics/features/cnxk.ini
 create mode 100644 doc/guides/nics/features/cnxk_vec.ini
 create mode 100644 doc/guides/nics/features/cnxk_vf.ini
 create mode 100644 drivers/net/cnxk/cnxk_ethdev.c
 create mode 100644 drivers/net/cnxk/cnxk_ethdev.h
 create mode 100644 drivers/net/cnxk/meson.build
 create mode 100644 drivers/net/cnxk/version.map
MAINTAINERS +3 -0
index 5877a16..2be220e 100644
@@ -746,6 +746,9 @@ M: Sunil Kumar Kori <[email protected]>
 M: Satha Rao <[email protected]>
 T: git://dpdk.org/next/dpdk-next-net-mrvl
 F: drivers/common/cnxk/
+F: drivers/net/cnxk/
+F: doc/guides/nics/cnxk.rst
+F: doc/guides/nics/features/cnxk*.ini
 F: doc/guides/platform/cnxk.rst
 
 Marvell mvpp2
doc/guides/nics/cnxk.rst new file +29 -0
new file mode 100644
index 0000000..ca21842
@@ -0,0 +1,29 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(C) 2021 Marvell.
+
+CNXK Poll Mode driver
+=====================
+
+The CNXK ETHDEV PMD (**librte_net_cnxk**) provides poll mode ethdev driver
+support for the inbuilt network device found in **Marvell OCTEON CN9K/CN10K**
+SoC family as well as for their virtual functions (VF) in SR-IOV context.
+
+More information can be found at `Marvell Official Website
+<https://www.marvell.com/embedded-processors/infrastructure-processors>`_.
+
+Features
+--------
+
+Features of the CNXK Ethdev PMD are:
+
+Prerequisites
+-------------
+
+See :doc:`../platform/cnxk` for setup information.
+
+
+Driver compilation and testing
+------------------------------
+
+Refer to the document :ref:`compiling and testing a PMD for a NIC <pmd_build_and_test>`
+for details.
doc/guides/nics/features/cnxk.ini new file +9 -0
new file mode 100644
index 0000000..2c23464
@@ -0,0 +1,9 @@
+;
+; Supported features of the 'cnxk' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Linux                = Y
+ARMv8                = Y
+Usage doc            = Y
doc/guides/nics/features/cnxk_vec.ini new file +9 -0
new file mode 100644
index 0000000..de78516
@@ -0,0 +1,9 @@
+;
+; Supported features of the 'cnxk_vec' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Linux                = Y
+ARMv8                = Y
+Usage doc            = Y
doc/guides/nics/features/cnxk_vf.ini new file +9 -0
new file mode 100644
index 0000000..9c96351
@@ -0,0 +1,9 @@
+;
+; Supported features of the 'cnxk_vf' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Linux                = Y
+ARMv8                = Y
+Usage doc            = Y
doc/guides/nics/index.rst +1 -0
index 799697c..c1a04d9 100644
@@ -19,6 +19,7 @@ Network Interface Controller Drivers
     axgbe
     bnx2x
     bnxt
+    cnxk
     cxgbe
     dpaa
     dpaa2
doc/guides/platform/cnxk.rst +3 -0
index cebb3d0..b506c11 100644
@@ -142,6 +142,9 @@ HW Offload Drivers
 
 This section lists dataplane H/W block(s) available in cnxk SoC.
 
+#. **Ethdev Driver**
+   See :doc:`../nics/cnxk` for NIX Ethdev driver information.
+
 #. **Mempool Driver**
    See :doc:`../mempool/cnxk` for NPA mempool driver information.
 
drivers/net/cnxk/cnxk_ethdev.c new file +219 -0

219 lines not on this page · raw message

drivers/net/cnxk/cnxk_ethdev.h new file +57 -0

57 lines not on this page · raw message

drivers/net/cnxk/meson.build new file +21 -0
new file mode 100644
index 0000000..77b2f18
@@ -0,0 +1,21 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(C) 2021 Marvell.
+#
+
+if not dpdk_conf.get('RTE_ARCH_64')
+	build = false
+	reason = 'only supported on 64-bit'
+	subdir_done()
+endif
+
+sources = files('cnxk_ethdev.c')
+
+deps += ['bus_pci', 'cryptodev', 'eventdev', 'security']
+deps += ['common_cnxk', 'mempool_cnxk']
+
+extra_flags = ['-flax-vector-conversions', '-Wno-strict-aliasing']
+foreach flag: extra_flags
+	if cc.has_argument(flag)
+		cflags += flag
+	endif
+endforeach
drivers/net/cnxk/version.map new file +3 -0
new file mode 100644
index 0000000..ee80c51
@@ -0,0 +1,3 @@
+INTERNAL {
+	local: *;
+};
drivers/net/meson.build +1 -0
index c8b5ce2..5b066fd 100644
@@ -12,6 +12,7 @@ drivers = [
         'bnx2x',
         'bnxt',
         'bonding',
+	'cnxk',
         'cxgbe',
         'dpaa',
         'dpaa2',
Signature · 1 line
2.8.4
Acked-by Haiyue Wang Acked-by Xiao Wang Acked-by Thomas Monjalon on v2 9/62
#61 lore raw

Re: [dpdk-dev] [PATCH v2 09/62] net/cnxk: add build infra and common probe

Quoted 168 lines · Nithin Dabilpuram

Add build infrastructure and common probe and remove for cnxk driver which is used by both CN10K and CN9K SoC.

---
  MAINTAINERS                           |   3 +
  doc/guides/nics/cnxk.rst              |  29 +++++
  doc/guides/nics/features/cnxk.ini     |   9 ++
  doc/guides/nics/features/cnxk_vec.ini |   9 ++
  doc/guides/nics/features/cnxk_vf.ini  |   9 ++
  doc/guides/nics/index.rst             |   1 +
  doc/guides/platform/cnxk.rst          |   3 +
  drivers/net/cnxk/cnxk_ethdev.c        | 219 ++++++++++++++++++++++++++++++++++
  drivers/net/cnxk/cnxk_ethdev.h        |  57 +++++++++
  drivers/net/cnxk/meson.build          |  21 ++++
  drivers/net/cnxk/version.map          |   3 +
  drivers/net/meson.build               |   1 +
  12 files changed, 364 insertions(+)

create mode 100644 doc/guides/nics/cnxk.rst create mode 100644 doc/guides/nics/features/cnxk.ini create mode 100644 doc/guides/nics/features/cnxk_vec.ini create mode 100644 doc/guides/nics/features/cnxk_vf.ini create mode 100644 drivers/net/cnxk/cnxk_ethdev.c create mode 100644 drivers/net/cnxk/cnxk_ethdev.h create mode 100644 drivers/net/cnxk/meson.build create mode 100644 drivers/net/cnxk/version.map

MAINTAINERS +3 -0
index 5877a16..2be220e 100644
@@ -746,6 +746,9 @@ M: Sunil Kumar Kori <[email protected]>
  M: Satha Rao <[email protected]>
  T: git://dpdk.org/next/dpdk-next-net-mrvl
  F: drivers/common/cnxk/
+F: drivers/net/cnxk/
+F: doc/guides/nics/cnxk.rst
+F: doc/guides/nics/features/cnxk*.ini
  F: doc/guides/platform/cnxk.rst
 
  Marvell mvpp2
doc/guides/nics/cnxk.rst new file +29 -0
new file mode 100644
index 0000000..ca21842
@@ -0,0 +1,29 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(C) 2021 Marvell.
+
+CNXK Poll Mode driver
+=====================
+
+The CNXK ETHDEV PMD (**librte_net_cnxk**) provides poll mode ethdev driver
+support for the inbuilt network device found in **Marvell OCTEON CN9K/CN10K**
+SoC family as well as for their virtual functions (VF) in SR-IOV context.
+
+More information can be found at `Marvell Official Website
+<https://www.marvell.com/embedded-processors/infrastructure-processors>`_.
+
+Features
+--------
+
+Features of the CNXK Ethdev PMD are:
+
+Prerequisites
+-------------
+
+See :doc:`../platform/cnxk` for setup information.
+
+
+Driver compilation and testing
+------------------------------
+
+Refer to the document :ref:`compiling and testing a PMD for a NIC <pmd_build_and_test>`
+for details.
doc/guides/nics/features/cnxk.ini new file +9 -0
new file mode 100644
index 0000000..2c23464
@@ -0,0 +1,9 @@
+;
+; Supported features of the 'cnxk' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Linux                = Y
+ARMv8                = Y
+Usage doc            = Y
doc/guides/nics/features/cnxk_vec.ini new file +9 -0
new file mode 100644
index 0000000..de78516
@@ -0,0 +1,9 @@
+;
+; Supported features of the 'cnxk_vec' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Linux                = Y
+ARMv8                = Y
+Usage doc            = Y
doc/guides/nics/features/cnxk_vf.ini new file +9 -0
new file mode 100644
index 0000000..9c96351
@@ -0,0 +1,9 @@
+;
+; Supported features of the 'cnxk_vf' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Linux                = Y
+ARMv8                = Y
+Usage doc            = Y
doc/guides/nics/index.rst +1 -0
index 799697c..c1a04d9 100644
@@ -19,6 +19,7 @@ Network Interface Controller Drivers
      axgbe
      bnx2x
      bnxt
+    cnxk
      cxgbe
      dpaa
      dpaa2
doc/guides/platform/cnxk.rst +3 -0
index cebb3d0..b506c11 100644
@@ -142,6 +142,9 @@ HW Offload Drivers
 
  This section lists dataplane H/W block(s) available in cnxk SoC.
 
+#. **Ethdev Driver**
+   See :doc:`../nics/cnxk` for NIX Ethdev driver information.
+
  #. **Mempool Driver**
     See :doc:`../mempool/cnxk` for NPA mempool driver information.
 
drivers/net/cnxk/cnxk_ethdev.c new file +15 -0
new file mode 100644
index 0000000..6717410
@@ -0,0 +1,219 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+#include <cnxk_ethdev.h>
+
+/* CNXK platform independent eth dev ops */
+struct eth_dev_ops cnxk_eth_dev_ops;
+
+static int
+cnxk_eth_dev_init(struct rte_eth_dev *eth_dev)
+{
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	struct roc_nix *nix = &dev->nix;
+	struct rte_pci_device *pci_dev;
+	int rc, max_entries;

drivers/net/cnxk/cnxk_ethdev.c line 25

Quoted 10 lines
drivers/net/cnxk/cnxk_ethdev.c new file +10 -0
+
+	eth_dev->dev_ops = &cnxk_eth_dev_ops;
+
+	/* For secondary processes, the primary has done all the work */
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		return 0;
+
+	pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+	rte_eth_copy_pci_info(eth_dev, pci_dev);
+	eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;

Hi,

It is recommended not to use this flag when add new driver. Queue stats will be moved to xstats and be filled by PMDs.

Please check the following patch:

commit f30e69b41f949cd4a9afb6ff39de196e661708e2
Author: Ferruh Yigit <[email protected]>
Date:   Wed Oct 14 03:26:47 2020 +0100

    ethdev: add device flag to bypass auto-filled queue xstats

    Queue stats are stored in 'struct rte_eth_stats' as array and array size is defined by 'RTE_ETHDEV_QUEUE_STAT_CNTRS' compile time flag.

    As a result of technical board discussion, decided to remove the queue statistics from 'struct rte_eth_stats' in the long term.

    Instead PMDs should represent the queue statistics via xstats, this gives more flexibility on the number of the queues supported.

    Currently queue stats in the xstats are filled by ethdev layer, using some basic stats, when queue stats removed from basic stats the responsibility to fill the relevant xstats will be pushed to the PMDs.

    During the switch period, temporary 'RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS' device flag is created. Initially all PMDs using xstats set this flag. The PMDs implemented queue stats in the xstats should clear the flag.

    When all PMDs switch to the xstats for the queue stats, queue stats related fields from 'struct rte_eth_stats' will be removed, as well as 'RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS' flag.
    Later 'RTE_ETHDEV_QUEUE_STAT_CNTRS' compile time flag also can be removed.

Quoted 305 lines
drivers/net/cnxk/cnxk_ethdev.c new file +194 -0
+
+	/* Initialize base roc nix */
+	nix->pci_dev = pci_dev;
+	rc = roc_nix_dev_init(nix);
+	if (rc) {
+		plt_err("Failed to initialize roc nix rc=%d", rc);
+		goto error;
+	}
+
+	dev->eth_dev = eth_dev;
+
+	/* For vfs, returned max_entries will be 0. but to keep default mac
+	 * address, one entry must be allocated. so setting up to 1.
+	 */
+	if (roc_nix_is_vf_or_sdp(nix))
+		max_entries = 1;
+	else
+		max_entries = roc_nix_mac_max_entries_get(nix);
+
+	if (max_entries <= 0) {
+		plt_err("Failed to get max entries for mac addr");
+		rc = -ENOTSUP;
+		goto dev_fini;
+	}
+
+	eth_dev->data->mac_addrs =
+		rte_zmalloc("mac_addr", max_entries * RTE_ETHER_ADDR_LEN, 0);
+	if (eth_dev->data->mac_addrs == NULL) {
+		plt_err("Failed to allocate memory for mac addr");
+		rc = -ENOMEM;
+		goto dev_fini;
+	}
+
+	dev->max_mac_entries = max_entries;
+
+	/* Get mac address */
+	rc = roc_nix_npc_mac_addr_get(nix, dev->mac_addr);
+	if (rc) {
+		plt_err("Failed to get mac addr, rc=%d", rc);
+		goto free_mac_addrs;
+	}
+
+	/* Update the mac address */
+	memcpy(eth_dev->data->mac_addrs, dev->mac_addr, RTE_ETHER_ADDR_LEN);
+
+	if (!roc_nix_is_vf_or_sdp(nix)) {
+		/* Sync same MAC address to CGX/RPM table */
+		rc = roc_nix_mac_addr_set(nix, dev->mac_addr);
+		if (rc) {
+			plt_err("Failed to set mac addr, rc=%d", rc);
+			goto free_mac_addrs;
+		}
+	}
+
+	/* Initialize roc npc */
+	plt_nix_dbg("Port=%d pf=%d vf=%d ver=%s hwcap=0x%" PRIx64
+		    " rxoffload_capa=0x%" PRIx64 " txoffload_capa=0x%" PRIx64,
+		    eth_dev->data->port_id, roc_nix_get_pf(nix),
+		    roc_nix_get_vf(nix), CNXK_ETH_DEV_PMD_VERSION, dev->hwcap,
+		    dev->rx_offload_capa, dev->tx_offload_capa);
+	return 0;
+
+free_mac_addrs:
+	rte_free(eth_dev->data->mac_addrs);
+dev_fini:
+	roc_nix_dev_fini(nix);
+error:
+	plt_err("Failed to init nix eth_dev rc=%d", rc);
+	return rc;
+}
+
+static int
+cnxk_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close)
+{
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	const struct eth_dev_ops *dev_ops = eth_dev->dev_ops;
+	struct roc_nix *nix = &dev->nix;
+	int rc, i;
+
+	/* Nothing to be done for secondary processes */
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		return 0;
+
+	roc_nix_npc_rx_ena_dis(nix, false);
+
+	/* Free up SQs */
+	for (i = 0; i < eth_dev->data->nb_tx_queues; i++) {
+		dev_ops->tx_queue_release(eth_dev->data->tx_queues[i]);
+		eth_dev->data->tx_queues[i] = NULL;
+	}
+	eth_dev->data->nb_tx_queues = 0;
+
+	/* Free up RQ's and CQ's */
+	for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
+		dev_ops->rx_queue_release(eth_dev->data->rx_queues[i]);
+		eth_dev->data->rx_queues[i] = NULL;
+	}
+	eth_dev->data->nb_rx_queues = 0;
+
+	/* Free tm resources */
+	roc_nix_tm_fini(nix);
+
+	/* Unregister queue irqs */
+	roc_nix_unregister_queue_irqs(nix);
+
+	/* Unregister cq irqs */
+	if (eth_dev->data->dev_conf.intr_conf.rxq)
+		roc_nix_unregister_cq_irqs(nix);
+
+	/* Free nix lf resources */
+	rc = roc_nix_lf_free(nix);
+	if (rc)
+		plt_err("Failed to free nix lf, rc=%d", rc);
+
+	rte_free(eth_dev->data->mac_addrs);
+	eth_dev->data->mac_addrs = NULL;
+
+	/* Check if mbox close is needed */
+	if (!mbox_close)
+		return 0;
+
+	rc = roc_nix_dev_fini(nix);
+	/* Can be freed later by PMD if NPA LF is in use */
+	if (rc == -EAGAIN) {
+		eth_dev->data->dev_private = NULL;
+		return 0;
+	} else if (rc) {
+		plt_err("Failed in nix dev fini, rc=%d", rc);
+	}
+
+	return rc;
+}
+
+int
+cnxk_nix_remove(struct rte_pci_device *pci_dev)
+{
+	struct rte_eth_dev *eth_dev;
+	struct roc_nix *nix;
+	int rc = -EINVAL;
+
+	eth_dev = rte_eth_dev_allocated(pci_dev->device.name);
+	if (eth_dev) {
+		/* Cleanup eth dev */
+		rc = cnxk_eth_dev_uninit(eth_dev, true);
+		if (rc)
+			return rc;
+
+		rte_eth_dev_release_port(eth_dev);
+	}
+
+	/* Nothing to be done for secondary processes */
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		return 0;
+
+	/* Check if this device is hosting common resource */
+	nix = roc_idev_npa_nix_get();
+	if (nix->pci_dev != pci_dev)
+		return 0;
+
+	/* Try nix fini now */
+	rc = roc_nix_dev_fini(nix);
+	if (rc == -EAGAIN) {
+		plt_info("%s: common resource in use by other devices",
+			 pci_dev->name);
+		goto exit;
+	} else if (rc) {
+		plt_err("Failed in nix dev fini, rc=%d", rc);
+		goto exit;
+	}
+
+	/* Free device pointer as rte_ethdev does not have it anymore */
+	rte_free(nix);
+exit:
+	return rc;
+}
+
+int
+cnxk_nix_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
+{
+	int rc;
+
+	RTE_SET_USED(pci_drv);
+
+	rc = rte_eth_dev_pci_generic_probe(pci_dev, sizeof(struct cnxk_eth_dev),
+					   cnxk_eth_dev_init);
+
+	/* On error on secondary, recheck if port exists in primary or
+	 * in mid of detach state.
+	 */
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY && rc)
+		if (!rte_eth_dev_allocated(pci_dev->device.name))
+			return 0;
+	return rc;
+}
drivers/net/cnxk/cnxk_ethdev.h new file +57 -0
new file mode 100644
index 0000000..0460d1e
@@ -0,0 +1,57 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+#ifndef __CNXK_ETHDEV_H__
+#define __CNXK_ETHDEV_H__
+
+#include <math.h>
+#include <stdint.h>
+
+#include <ethdev_driver.h>
+#include <ethdev_pci.h>
+
+#include "roc_api.h"
+
+#define CNXK_ETH_DEV_PMD_VERSION "1.0"
+
+struct cnxk_eth_dev {
+	/* ROC NIX */
+	struct roc_nix nix;
+
+	/* Max macfilter entries */
+	uint8_t max_mac_entries;
+
+	uint16_t flags;
+
+	/* Pointer back to rte */
+	struct rte_eth_dev *eth_dev;
+
+	/* HW capabilities / Limitations */
+	union {
+		uint64_t hwcap;
+	};
+
+	/* Rx and Tx offload capabilities */
+	uint64_t rx_offload_capa;
+	uint64_t tx_offload_capa;
+	uint32_t speed_capa;
+
+	/* Default mac address */
+	uint8_t mac_addr[RTE_ETHER_ADDR_LEN];
+};
+
+static inline struct cnxk_eth_dev *
+cnxk_eth_pmd_priv(struct rte_eth_dev *eth_dev)
+{
+	return eth_dev->data->dev_private;
+}
+
+/* Common ethdev ops */
+extern struct eth_dev_ops cnxk_eth_dev_ops;
+
+/* Ops */
+int cnxk_nix_probe(struct rte_pci_driver *pci_drv,
+		   struct rte_pci_device *pci_dev);
+int cnxk_nix_remove(struct rte_pci_device *pci_dev);
+
+#endif /* __CNXK_ETHDEV_H__ */
drivers/net/cnxk/meson.build new file +21 -0
new file mode 100644
index 0000000..77b2f18
@@ -0,0 +1,21 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(C) 2021 Marvell.
+#
+
+if not dpdk_conf.get('RTE_ARCH_64')
+	build = false
+	reason = 'only supported on 64-bit'
+	subdir_done()
+endif
+
+sources = files('cnxk_ethdev.c')
+
+deps += ['bus_pci', 'cryptodev', 'eventdev', 'security']
+deps += ['common_cnxk', 'mempool_cnxk']
+
+extra_flags = ['-flax-vector-conversions', '-Wno-strict-aliasing']
+foreach flag: extra_flags
+	if cc.has_argument(flag)
+		cflags += flag
+	endif
+endforeach
drivers/net/cnxk/version.map new file +3 -0
new file mode 100644
index 0000000..ee80c51
@@ -0,0 +1,3 @@
+INTERNAL {
+	local: *;
+};
drivers/net/meson.build +1 -0
index c8b5ce2..5b066fd 100644
@@ -12,6 +12,7 @@ drivers = [
          'bnx2x',
          'bnxt',
          'bonding',
+	'cnxk',
          'cxgbe',
          'dpaa',
          'dpaa2',
#62 lore raw

Re: [dpdk-dev] [PATCH v2 09/62] net/cnxk: add build infra and common probe

Quoted 212 lines · Huisong Li
Quoted 164 lines · Nithin Dabilpuram

Add build infrastructure and common probe and remove for cnxk driver which is used by both CN10K and CN9K SoC.

---
  MAINTAINERS                           |   3 +
  doc/guides/nics/cnxk.rst              |  29 +++++
  doc/guides/nics/features/cnxk.ini     |   9 ++
  doc/guides/nics/features/cnxk_vec.ini |   9 ++
  doc/guides/nics/features/cnxk_vf.ini  |   9 ++
  doc/guides/nics/index.rst             |   1 +
  doc/guides/platform/cnxk.rst          |   3 +
  drivers/net/cnxk/cnxk_ethdev.c        | 219 ++++++++++++++++++++++++++++++++++
  drivers/net/cnxk/cnxk_ethdev.h        |  57 +++++++++
  drivers/net/cnxk/meson.build          |  21 ++++
  drivers/net/cnxk/version.map          |   3 +
  drivers/net/meson.build               |   1 +
  12 files changed, 364 insertions(+)

create mode 100644 doc/guides/nics/cnxk.rst create mode 100644 doc/guides/nics/features/cnxk.ini create mode 100644 doc/guides/nics/features/cnxk_vec.ini create mode 100644 doc/guides/nics/features/cnxk_vf.ini create mode 100644 drivers/net/cnxk/cnxk_ethdev.c create mode 100644 drivers/net/cnxk/cnxk_ethdev.h create mode 100644 drivers/net/cnxk/meson.build create mode 100644 drivers/net/cnxk/version.map

MAINTAINERS +3 -0
index 5877a16..2be220e 100644
@@ -746,6 +746,9 @@ M: Sunil Kumar Kori <[email protected]>
  M: Satha Rao <[email protected]>
  T: git://dpdk.org/next/dpdk-next-net-mrvl
  F: drivers/common/cnxk/
+F: drivers/net/cnxk/
+F: doc/guides/nics/cnxk.rst
+F: doc/guides/nics/features/cnxk*.ini
  F: doc/guides/platform/cnxk.rst
  Marvell mvpp2
doc/guides/nics/cnxk.rst new file +29 -0
new file mode 100644
index 0000000..ca21842
@@ -0,0 +1,29 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(C) 2021 Marvell.
+
+CNXK Poll Mode driver
+=====================
+
+The CNXK ETHDEV PMD (**librte_net_cnxk**) provides poll mode ethdev driver
+support for the inbuilt network device found in **Marvell OCTEON CN9K/CN10K**
+SoC family as well as for their virtual functions (VF) in SR-IOV context.
+
+More information can be found at `Marvell Official Website
+<https://www.marvell.com/embedded-processors/infrastructure-processors>`_.
+
+Features
+--------
+
+Features of the CNXK Ethdev PMD are:
+
+Prerequisites
+-------------
+
+See :doc:`../platform/cnxk` for setup information.
+
+
+Driver compilation and testing
+------------------------------
+
+Refer to the document :ref:`compiling and testing a PMD for a NIC <pmd_build_and_test>`
+for details.
doc/guides/nics/features/cnxk.ini new file +9 -0
new file mode 100644
index 0000000..2c23464
@@ -0,0 +1,9 @@
+;
+; Supported features of the 'cnxk' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Linux                = Y
+ARMv8                = Y
+Usage doc            = Y
doc/guides/nics/features/cnxk_vec.ini new file +9 -0
new file mode 100644
index 0000000..de78516
@@ -0,0 +1,9 @@
+;
+; Supported features of the 'cnxk_vec' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Linux                = Y
+ARMv8                = Y
+Usage doc            = Y
doc/guides/nics/features/cnxk_vf.ini new file +9 -0
new file mode 100644
index 0000000..9c96351
@@ -0,0 +1,9 @@
+;
+; Supported features of the 'cnxk_vf' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Linux                = Y
+ARMv8                = Y
+Usage doc            = Y
doc/guides/nics/index.rst +1 -0
index 799697c..c1a04d9 100644
@@ -19,6 +19,7 @@ Network Interface Controller Drivers
      axgbe
      bnx2x
      bnxt
+    cnxk
      cxgbe
      dpaa
      dpaa2
doc/guides/platform/cnxk.rst +3 -0
index cebb3d0..b506c11 100644
@@ -142,6 +142,9 @@ HW Offload Drivers
  This section lists dataplane H/W block(s) available in cnxk SoC.
+#. **Ethdev Driver**
+   See :doc:`../nics/cnxk` for NIX Ethdev driver information.
+
  #. **Mempool Driver**
     See :doc:`../mempool/cnxk` for NPA mempool driver information.
drivers/net/cnxk/cnxk_ethdev.c new file +15 -0
new file mode 100644
index 0000000..6717410
@@ -0,0 +1,219 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+#include <cnxk_ethdev.h>
+
+/* CNXK platform independent eth dev ops */
+struct eth_dev_ops cnxk_eth_dev_ops;
+
+static int
+cnxk_eth_dev_init(struct rte_eth_dev *eth_dev)
+{
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	struct roc_nix *nix = &dev->nix;
+	struct rte_pci_device *pci_dev;
+	int rc, max_entries;

drivers/net/cnxk/cnxk_ethdev.c line 25

Quoted 10 lines
drivers/net/cnxk/cnxk_ethdev.c new file +10 -0
+
+	eth_dev->dev_ops = &cnxk_eth_dev_ops;
+
+	/* For secondary processes, the primary has done all the work */
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		return 0;
+
+	pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
+	rte_eth_copy_pci_info(eth_dev, pci_dev);
+	eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;

Hi,

It is recommended not to use this flag when add new driver. Queue stats will be moved to xstats and be filled by PMDs.

Please check the following patch:

commit f30e69b41f949cd4a9afb6ff39de196e661708e2
Author: Ferruh Yigit <[email protected]>
Date:   Wed Oct 14 03:26:47 2020 +0100

    ethdev: add device flag to bypass auto-filled queue xstats

    Queue stats are stored in 'struct rte_eth_stats' as array and array size is defined by 'RTE_ETHDEV_QUEUE_STAT_CNTRS' compile time flag.

    As a result of technical board discussion, decided to remove the queue statistics from 'struct rte_eth_stats' in the long term.

    Instead PMDs should represent the queue statistics via xstats, this gives more flexibility on the number of the queues supported.

    Currently queue stats in the xstats are filled by ethdev layer, using some basic stats, when queue stats removed from basic stats the responsibility to fill the relevant xstats will be pushed to the PMDs.

    During the switch period, temporary 'RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS' device flag is created. Initially all PMDs using xstats set this flag. The PMDs implemented queue stats in the xstats should clear the flag.

    When all PMDs switch to the xstats for the queue stats, queue stats related fields from 'struct rte_eth_stats' will be removed, as well as 'RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS' flag.
    Later 'RTE_ETHDEV_QUEUE_STAT_CNTRS' compile time flag also can be removed.

Quoted 4 lines

Ack, will fix it in V3.

Quoted 306 lines
Quoted 306 lines
drivers/net/cnxk/cnxk_ethdev.c new file +194 -0
+
+	/* Initialize base roc nix */
+	nix->pci_dev = pci_dev;
+	rc = roc_nix_dev_init(nix);
+	if (rc) {
+		plt_err("Failed to initialize roc nix rc=%d", rc);
+		goto error;
+	}
+
+	dev->eth_dev = eth_dev;
+
+	/* For vfs, returned max_entries will be 0. but to keep default mac
+	 * address, one entry must be allocated. so setting up to 1.
+	 */
+	if (roc_nix_is_vf_or_sdp(nix))
+		max_entries = 1;
+	else
+		max_entries = roc_nix_mac_max_entries_get(nix);
+
+	if (max_entries <= 0) {
+		plt_err("Failed to get max entries for mac addr");
+		rc = -ENOTSUP;
+		goto dev_fini;
+	}
+
+	eth_dev->data->mac_addrs =
+		rte_zmalloc("mac_addr", max_entries * RTE_ETHER_ADDR_LEN, 0);
+	if (eth_dev->data->mac_addrs == NULL) {
+		plt_err("Failed to allocate memory for mac addr");
+		rc = -ENOMEM;
+		goto dev_fini;
+	}
+
+	dev->max_mac_entries = max_entries;
+
+	/* Get mac address */
+	rc = roc_nix_npc_mac_addr_get(nix, dev->mac_addr);
+	if (rc) {
+		plt_err("Failed to get mac addr, rc=%d", rc);
+		goto free_mac_addrs;
+	}
+
+	/* Update the mac address */
+	memcpy(eth_dev->data->mac_addrs, dev->mac_addr, RTE_ETHER_ADDR_LEN);
+
+	if (!roc_nix_is_vf_or_sdp(nix)) {
+		/* Sync same MAC address to CGX/RPM table */
+		rc = roc_nix_mac_addr_set(nix, dev->mac_addr);
+		if (rc) {
+			plt_err("Failed to set mac addr, rc=%d", rc);
+			goto free_mac_addrs;
+		}
+	}
+
+	/* Initialize roc npc */
+	plt_nix_dbg("Port=%d pf=%d vf=%d ver=%s hwcap=0x%" PRIx64
+		    " rxoffload_capa=0x%" PRIx64 " txoffload_capa=0x%" PRIx64,
+		    eth_dev->data->port_id, roc_nix_get_pf(nix),
+		    roc_nix_get_vf(nix), CNXK_ETH_DEV_PMD_VERSION, dev->hwcap,
+		    dev->rx_offload_capa, dev->tx_offload_capa);
+	return 0;
+
+free_mac_addrs:
+	rte_free(eth_dev->data->mac_addrs);
+dev_fini:
+	roc_nix_dev_fini(nix);
+error:
+	plt_err("Failed to init nix eth_dev rc=%d", rc);
+	return rc;
+}
+
+static int
+cnxk_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close)
+{
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	const struct eth_dev_ops *dev_ops = eth_dev->dev_ops;
+	struct roc_nix *nix = &dev->nix;
+	int rc, i;
+
+	/* Nothing to be done for secondary processes */
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		return 0;
+
+	roc_nix_npc_rx_ena_dis(nix, false);
+
+	/* Free up SQs */
+	for (i = 0; i < eth_dev->data->nb_tx_queues; i++) {
+		dev_ops->tx_queue_release(eth_dev->data->tx_queues[i]);
+		eth_dev->data->tx_queues[i] = NULL;
+	}
+	eth_dev->data->nb_tx_queues = 0;
+
+	/* Free up RQ's and CQ's */
+	for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
+		dev_ops->rx_queue_release(eth_dev->data->rx_queues[i]);
+		eth_dev->data->rx_queues[i] = NULL;
+	}
+	eth_dev->data->nb_rx_queues = 0;
+
+	/* Free tm resources */
+	roc_nix_tm_fini(nix);
+
+	/* Unregister queue irqs */
+	roc_nix_unregister_queue_irqs(nix);
+
+	/* Unregister cq irqs */
+	if (eth_dev->data->dev_conf.intr_conf.rxq)
+		roc_nix_unregister_cq_irqs(nix);
+
+	/* Free nix lf resources */
+	rc = roc_nix_lf_free(nix);
+	if (rc)
+		plt_err("Failed to free nix lf, rc=%d", rc);
+
+	rte_free(eth_dev->data->mac_addrs);
+	eth_dev->data->mac_addrs = NULL;
+
+	/* Check if mbox close is needed */
+	if (!mbox_close)
+		return 0;
+
+	rc = roc_nix_dev_fini(nix);
+	/* Can be freed later by PMD if NPA LF is in use */
+	if (rc == -EAGAIN) {
+		eth_dev->data->dev_private = NULL;
+		return 0;
+	} else if (rc) {
+		plt_err("Failed in nix dev fini, rc=%d", rc);
+	}
+
+	return rc;
+}
+
+int
+cnxk_nix_remove(struct rte_pci_device *pci_dev)
+{
+	struct rte_eth_dev *eth_dev;
+	struct roc_nix *nix;
+	int rc = -EINVAL;
+
+	eth_dev = rte_eth_dev_allocated(pci_dev->device.name);
+	if (eth_dev) {
+		/* Cleanup eth dev */
+		rc = cnxk_eth_dev_uninit(eth_dev, true);
+		if (rc)
+			return rc;
+
+		rte_eth_dev_release_port(eth_dev);
+	}
+
+	/* Nothing to be done for secondary processes */
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		return 0;
+
+	/* Check if this device is hosting common resource */
+	nix = roc_idev_npa_nix_get();
+	if (nix->pci_dev != pci_dev)
+		return 0;
+
+	/* Try nix fini now */
+	rc = roc_nix_dev_fini(nix);
+	if (rc == -EAGAIN) {
+		plt_info("%s: common resource in use by other devices",
+			 pci_dev->name);
+		goto exit;
+	} else if (rc) {
+		plt_err("Failed in nix dev fini, rc=%d", rc);
+		goto exit;
+	}
+
+	/* Free device pointer as rte_ethdev does not have it anymore */
+	rte_free(nix);
+exit:
+	return rc;
+}
+
+int
+cnxk_nix_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
+{
+	int rc;
+
+	RTE_SET_USED(pci_drv);
+
+	rc = rte_eth_dev_pci_generic_probe(pci_dev, sizeof(struct cnxk_eth_dev),
+					   cnxk_eth_dev_init);
+
+	/* On error on secondary, recheck if port exists in primary or
+	 * in mid of detach state.
+	 */
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY && rc)
+		if (!rte_eth_dev_allocated(pci_dev->device.name))
+			return 0;
+	return rc;
+}
drivers/net/cnxk/cnxk_ethdev.h new file +57 -0
new file mode 100644
index 0000000..0460d1e
@@ -0,0 +1,57 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+#ifndef __CNXK_ETHDEV_H__
+#define __CNXK_ETHDEV_H__
+
+#include <math.h>
+#include <stdint.h>
+
+#include <ethdev_driver.h>
+#include <ethdev_pci.h>
+
+#include "roc_api.h"
+
+#define CNXK_ETH_DEV_PMD_VERSION "1.0"
+
+struct cnxk_eth_dev {
+	/* ROC NIX */
+	struct roc_nix nix;
+
+	/* Max macfilter entries */
+	uint8_t max_mac_entries;
+
+	uint16_t flags;
+
+	/* Pointer back to rte */
+	struct rte_eth_dev *eth_dev;
+
+	/* HW capabilities / Limitations */
+	union {
+		uint64_t hwcap;
+	};
+
+	/* Rx and Tx offload capabilities */
+	uint64_t rx_offload_capa;
+	uint64_t tx_offload_capa;
+	uint32_t speed_capa;
+
+	/* Default mac address */
+	uint8_t mac_addr[RTE_ETHER_ADDR_LEN];
+};
+
+static inline struct cnxk_eth_dev *
+cnxk_eth_pmd_priv(struct rte_eth_dev *eth_dev)
+{
+	return eth_dev->data->dev_private;
+}
+
+/* Common ethdev ops */
+extern struct eth_dev_ops cnxk_eth_dev_ops;
+
+/* Ops */
+int cnxk_nix_probe(struct rte_pci_driver *pci_drv,
+		   struct rte_pci_device *pci_dev);
+int cnxk_nix_remove(struct rte_pci_device *pci_dev);
+
+#endif /* __CNXK_ETHDEV_H__ */
drivers/net/cnxk/meson.build new file +21 -0
new file mode 100644
index 0000000..77b2f18
@@ -0,0 +1,21 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(C) 2021 Marvell.
+#
+
+if not dpdk_conf.get('RTE_ARCH_64')
+	build = false
+	reason = 'only supported on 64-bit'
+	subdir_done()
+endif
+
+sources = files('cnxk_ethdev.c')
+
+deps += ['bus_pci', 'cryptodev', 'eventdev', 'security']
+deps += ['common_cnxk', 'mempool_cnxk']
+
+extra_flags = ['-flax-vector-conversions', '-Wno-strict-aliasing']
+foreach flag: extra_flags
+	if cc.has_argument(flag)
+		cflags += flag
+	endif
+endforeach
drivers/net/cnxk/version.map new file +3 -0
new file mode 100644
index 0000000..ee80c51
@@ -0,0 +1,3 @@
+INTERNAL {
+	local: *;
+};
drivers/net/meson.build +1 -0
index c8b5ce2..5b066fd 100644
@@ -12,6 +12,7 @@ drivers = [
          'bnx2x',
          'bnxt',
          'bonding',
+	'cnxk',
          'cxgbe',
          'dpaa',
          'dpaa2',
#63 lore raw

Re: [dpdk-dev] [PATCH v2 09/62] net/cnxk: add build infra and common probe

In reply to Nithin Dabilpuram
Quoted 19 lines · Nithin Dabilpuram

Add build infrastructure and common probe and remove for cnxk driver which is used by both CN10K and CN9K SoC.

---
 MAINTAINERS                           |   3 +
 doc/guides/nics/cnxk.rst              |  29 +++++
 doc/guides/nics/features/cnxk.ini     |   9 ++
 doc/guides/nics/features/cnxk_vec.ini |   9 ++
 doc/guides/nics/features/cnxk_vf.ini  |   9 ++
 doc/guides/nics/index.rst             |   1 +
 doc/guides/platform/cnxk.rst          |   3 +
 drivers/net/cnxk/cnxk_ethdev.c        | 219 ++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cnxk_ethdev.h        |  57 +++++++++
 drivers/net/cnxk/meson.build          |  21 ++++
 drivers/net/cnxk/version.map          |   3 +
 drivers/net/meson.build               |   1 +
 12 files changed, 364 insertions(+)
Quoted 8 lines
 create mode 100644 doc/guides/nics/cnxk.rst
 create mode 100644 doc/guides/nics/features/cnxk.ini
 create mode 100644 doc/guides/nics/features/cnxk_vec.ini
 create mode 100644 doc/guides/nics/features/cnxk_vf.ini
 create mode 100644 drivers/net/cnxk/cnxk_ethdev.c
 create mode 100644 drivers/net/cnxk/cnxk_ethdev.h
 create mode 100644 drivers/net/cnxk/meson.build
 create mode 100644 drivers/net/cnxk/version.map

21.08 release note update also can be done in this patch.

MAINTAINERS M: Sunil Kumar Kori <[email protected]> · line 752

Quoted 13 lines
MAINTAINERS +3 -0
index 5877a16..2be220e 100644
@@ -746,6 +746,9 @@ M: Sunil Kumar Kori <[email protected]>
 M: Satha Rao <[email protected]>
 T: git://dpdk.org/next/dpdk-next-net-mrvl
 F: drivers/common/cnxk/
+F: drivers/net/cnxk/
+F: doc/guides/nics/cnxk.rst
+F: doc/guides/nics/features/cnxk*.ini
 F: doc/guides/platform/cnxk.rst

Sort this in alphabetical order.

MAINTAINERS M: Sunil Kumar Kori <[email protected]> · line 754

Quoted 2 lines
MAINTAINERS +2 -0
+
+extra_flags = ['-flax-vector-conversions', '-Wno-strict-aliasing']

Move this to patch where this actually required and have one line comment on need.

Quoted 5 lines
MAINTAINERS +5 -0
+foreach flag: extra_flags
+       if cc.has_argument(flag)
+               cflags += flag
+       endif
+endforeach
#64 lore raw

PATCH v2 10/62 net/cnxk: add platform specific probe and remove

In reply to Nithin Dabilpuram

Add platform specific probe and remove callbacks for CN9K and CN10K which use common probe and remove functions. Register ethdev driver for CN9K and CN10K.

---
 drivers/net/cnxk/cn10k_ethdev.c | 64 ++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cn10k_ethdev.h |  9 +++++
 drivers/net/cnxk/cn9k_ethdev.c  | 82 +++++++++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cn9k_ethdev.h  |  9 +++++
 drivers/net/cnxk/cnxk_ethdev.c  | 42 +++++++++++++++++++++
 drivers/net/cnxk/cnxk_ethdev.h  | 19 ++++++++++
 drivers/net/cnxk/meson.build    |  5 +++
 7 files changed, 230 insertions(+)
 create mode 100644 drivers/net/cnxk/cn10k_ethdev.c
 create mode 100644 drivers/net/cnxk/cn10k_ethdev.h
 create mode 100644 drivers/net/cnxk/cn9k_ethdev.c
 create mode 100644 drivers/net/cnxk/cn9k_ethdev.h
drivers/net/cnxk/cn10k_ethdev.c new file +64 -0
new file mode 100644
index 0000000..ff8ce31
@@ -0,0 +1,64 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+#include "cn10k_ethdev.h"
+
+static int
+cn10k_nix_remove(struct rte_pci_device *pci_dev)
+{
+	return cnxk_nix_remove(pci_dev);
+}
+
+static int
+cn10k_nix_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
+{
+	struct rte_eth_dev *eth_dev;
+	int rc;
+
+	if (RTE_CACHE_LINE_SIZE != 64) {
+		plt_err("Driver not compiled for CN10K");
+		return -EFAULT;
+	}
+
+	rc = roc_plt_init();
+	if (rc) {
+		plt_err("Failed to initialize platform model, rc=%d", rc);
+		return rc;
+	}
+
+	/* Common probe */
+	rc = cnxk_nix_probe(pci_drv, pci_dev);
+	if (rc)
+		return rc;
+
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+		eth_dev = rte_eth_dev_allocated(pci_dev->device.name);
+		if (!eth_dev)
+			return -ENOENT;
+	}
+	return 0;
+}
+
+static const struct rte_pci_id cn10k_pci_nix_map[] = {
+	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN10KA, PCI_DEVID_CNXK_RVU_PF),
+	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN10KAS, PCI_DEVID_CNXK_RVU_PF),
+	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN10KA, PCI_DEVID_CNXK_RVU_VF),
+	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN10KAS, PCI_DEVID_CNXK_RVU_VF),
+	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN10KA, PCI_DEVID_CNXK_RVU_AF_VF),
+	CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN10KAS, PCI_DEVID_CNXK_RVU_AF_VF),
+	{
+		.vendor_id = 0,
+	},
+};
+
+static struct rte_pci_driver cn10k_pci_nix = {
+	.id_table = cn10k_pci_nix_map,
+	.drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_NEED_IOVA_AS_VA |
+		     RTE_PCI_DRV_INTR_LSC,
+	.probe = cn10k_nix_probe,
+	.remove = cn10k_nix_remove,
+};
+
+RTE_PMD_REGISTER_PCI(net_cn10k, cn10k_pci_nix);
+RTE_PMD_REGISTER_PCI_TABLE(net_cn10k, cn10k_pci_nix_map);
+RTE_PMD_REGISTER_KMOD_DEP(net_cn10k, "vfio-pci");
drivers/net/cnxk/cn10k_ethdev.h new file +9 -0
new file mode 100644
index 0000000..1bf4a65
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+#ifndef __CN10K_ETHDEV_H__
+#define __CN10K_ETHDEV_H__
+
+#include <cnxk_ethdev.h>
+
+#endif /* __CN10K_ETHDEV_H__ */
drivers/net/cnxk/cn9k_ethdev.c new file +82 -0

82 lines not on this page · raw message

drivers/net/cnxk/cn9k_ethdev.h new file +9 -0
new file mode 100644
index 0000000..15d9397
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+#ifndef __CN9K_ETHDEV_H__
+#define __CN9K_ETHDEV_H__
+
+#include <cnxk_ethdev.h>
+
+#endif /* __CN9K_ETHDEV_H__ */
drivers/net/cnxk/cnxk_ethdev.c +42 -0

54 lines not on this page · raw message

drivers/net/cnxk/cnxk_ethdev.h +19 -0
index 0460d1e..ba2bfcd 100644
@@ -14,6 +14,22 @@
 
 #define CNXK_ETH_DEV_PMD_VERSION "1.0"
 
+#define CNXK_NIX_TX_OFFLOAD_CAPA                                               \
+	(DEV_TX_OFFLOAD_MBUF_FAST_FREE | DEV_TX_OFFLOAD_MT_LOCKFREE |          \
+	 DEV_TX_OFFLOAD_VLAN_INSERT | DEV_TX_OFFLOAD_QINQ_INSERT |             \
+	 DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM | DEV_TX_OFFLOAD_OUTER_UDP_CKSUM |    \
+	 DEV_TX_OFFLOAD_TCP_CKSUM | DEV_TX_OFFLOAD_UDP_CKSUM |                 \
+	 DEV_TX_OFFLOAD_SCTP_CKSUM | DEV_TX_OFFLOAD_TCP_TSO |                  \
+	 DEV_TX_OFFLOAD_VXLAN_TNL_TSO | DEV_TX_OFFLOAD_GENEVE_TNL_TSO |        \
+	 DEV_TX_OFFLOAD_GRE_TNL_TSO | DEV_TX_OFFLOAD_MULTI_SEGS |              \
+	 DEV_TX_OFFLOAD_IPV4_CKSUM)
+
+#define CNXK_NIX_RX_OFFLOAD_CAPA                                               \
+	(DEV_RX_OFFLOAD_CHECKSUM | DEV_RX_OFFLOAD_SCTP_CKSUM |                 \
+	 DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM | DEV_RX_OFFLOAD_SCATTER |            \
+	 DEV_RX_OFFLOAD_JUMBO_FRAME | DEV_RX_OFFLOAD_OUTER_UDP_CKSUM |         \
+	 DEV_RX_OFFLOAD_RSS_HASH)
+
 struct cnxk_eth_dev {
 	/* ROC NIX */
 	struct roc_nix nix;
@@ -28,6 +44,9 @@ struct cnxk_eth_dev {
 
 	/* HW capabilities / Limitations */
 	union {
+		struct {
+			uint64_t cq_min_4k : 1;
+		};
 		uint64_t hwcap;
 	};
 
drivers/net/cnxk/meson.build +5 -0
index 77b2f18..57dea5e 100644
@@ -10,6 +10,11 @@ endif
 
 sources = files('cnxk_ethdev.c')
 
+# CN9K
+sources += files('cn9k_ethdev.c')
+# CN10K
+sources += files('cn10k_ethdev.c')
+
 deps += ['bus_pci', 'cryptodev', 'eventdev', 'security']
 deps += ['common_cnxk', 'mempool_cnxk']
 
Signature · 1 line
2.8.4
Reviewed-by on v2 10/62
#65 lore raw

Re: [dpdk-dev] [PATCH v2 10/62] net/cnxk: add platform specific probe and remove

Quoted 6 lines · Nithin Dabilpuram

Add platform specific probe and remove callbacks for CN9K and CN10K which use common probe and remove functions. Register ethdev driver for CN9K and CN10K.

Quoted 318 lines
---
 drivers/net/cnxk/cn10k_ethdev.c | 64 ++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cn10k_ethdev.h |  9 +++++
 drivers/net/cnxk/cn9k_ethdev.c  | 82 +++++++++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cn9k_ethdev.h  |  9 +++++
 drivers/net/cnxk/cnxk_ethdev.c  | 42 +++++++++++++++++++++
 drivers/net/cnxk/cnxk_ethdev.h  | 19 ++++++++++
 drivers/net/cnxk/meson.build    |  5 +++
 7 files changed, 230 insertions(+)
 create mode 100644 drivers/net/cnxk/cn10k_ethdev.c
 create mode 100644 drivers/net/cnxk/cn10k_ethdev.h
 create mode 100644 drivers/net/cnxk/cn9k_ethdev.c
 create mode 100644 drivers/net/cnxk/cn9k_ethdev.h
drivers/net/cnxk/cn10k_ethdev.c new file +64 -0
new file mode 100644
index 0000000..ff8ce31
@@ -0,0 +1,64 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+#include "cn10k_ethdev.h"
+
+static int
+cn10k_nix_remove(struct rte_pci_device *pci_dev)
+{
+       return cnxk_nix_remove(pci_dev);
+}
+
+static int
+cn10k_nix_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
+{
+       struct rte_eth_dev *eth_dev;
+       int rc;
+
+       if (RTE_CACHE_LINE_SIZE != 64) {
+               plt_err("Driver not compiled for CN10K");
+               return -EFAULT;
+       }
+
+       rc = roc_plt_init();
+       if (rc) {
+               plt_err("Failed to initialize platform model, rc=%d", rc);
+               return rc;
+       }
+
+       /* Common probe */
+       rc = cnxk_nix_probe(pci_drv, pci_dev);
+       if (rc)
+               return rc;
+
+       if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+               eth_dev = rte_eth_dev_allocated(pci_dev->device.name);
+               if (!eth_dev)
+                       return -ENOENT;
+       }
+       return 0;
+}
+
+static const struct rte_pci_id cn10k_pci_nix_map[] = {
+       CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN10KA, PCI_DEVID_CNXK_RVU_PF),
+       CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN10KAS, PCI_DEVID_CNXK_RVU_PF),
+       CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN10KA, PCI_DEVID_CNXK_RVU_VF),
+       CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN10KAS, PCI_DEVID_CNXK_RVU_VF),
+       CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN10KA, PCI_DEVID_CNXK_RVU_AF_VF),
+       CNXK_PCI_ID(PCI_SUBSYSTEM_DEVID_CN10KAS, PCI_DEVID_CNXK_RVU_AF_VF),
+       {
+               .vendor_id = 0,
+       },
+};
+
+static struct rte_pci_driver cn10k_pci_nix = {
+       .id_table = cn10k_pci_nix_map,
+       .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_NEED_IOVA_AS_VA |
+                    RTE_PCI_DRV_INTR_LSC,
+       .probe = cn10k_nix_probe,
+       .remove = cn10k_nix_remove,
+};
+
+RTE_PMD_REGISTER_PCI(net_cn10k, cn10k_pci_nix);
+RTE_PMD_REGISTER_PCI_TABLE(net_cn10k, cn10k_pci_nix_map);
+RTE_PMD_REGISTER_KMOD_DEP(net_cn10k, "vfio-pci");
drivers/net/cnxk/cn10k_ethdev.h new file +9 -0
new file mode 100644
index 0000000..1bf4a65
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+#ifndef __CN10K_ETHDEV_H__
+#define __CN10K_ETHDEV_H__
+
+#include <cnxk_ethdev.h>
+
+#endif /* __CN10K_ETHDEV_H__ */
drivers/net/cnxk/cn9k_ethdev.c new file +82 -0
new file mode 100644
index 0000000..701dc12
@@ -0,0 +1,82 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+#include "cn9k_ethdev.h"
+
+static int
+cn9k_nix_remove(struct rte_pci_device *pci_dev)
+{
+       return cnxk_nix_remove(pci_dev);
+}
+
+static int
+cn9k_nix_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
+{
+       struct rte_eth_dev *eth_dev;
+       struct cnxk_eth_dev *dev;
+       int rc;
+
+       if (RTE_CACHE_LINE_SIZE != 128) {
+               plt_err("Driver not compiled for CN9K");
+               return -EFAULT;
+       }
+
+       rc = roc_plt_init();
+       if (rc) {
+               plt_err("Failed to initialize platform model, rc=%d", rc);
+               return rc;
+       }
+
+       /* Common probe */
+       rc = cnxk_nix_probe(pci_drv, pci_dev);
+       if (rc)
+               return rc;
+
+       /* Find eth dev allocated */
+       eth_dev = rte_eth_dev_allocated(pci_dev->device.name);
+       if (!eth_dev)
+               return -ENOENT;
+
+       dev = cnxk_eth_pmd_priv(eth_dev);
+       /* Update capabilities already set for TSO.
+        * TSO not supported for earlier chip revisions
+        */
+       if (roc_model_is_cn96_A0() || roc_model_is_cn95_A0())
+               dev->tx_offload_capa &= ~(DEV_TX_OFFLOAD_TCP_TSO |
+                                         DEV_TX_OFFLOAD_VXLAN_TNL_TSO |
+                                         DEV_TX_OFFLOAD_GENEVE_TNL_TSO |
+                                         DEV_TX_OFFLOAD_GRE_TNL_TSO);
+
+       /* 50G and 100G to be supported for board version C0
+        * and above of CN9K.
+        */
+       if (roc_model_is_cn96_A0() || roc_model_is_cn95_A0()) {
+               dev->speed_capa &= ~(uint64_t)ETH_LINK_SPEED_50G;
+               dev->speed_capa &= ~(uint64_t)ETH_LINK_SPEED_100G;
+       }
+
+       dev->hwcap = 0;
+
+       /* Update HW erratas */
+       if (roc_model_is_cn96_A0() || roc_model_is_cn95_A0())
+               dev->cq_min_4k = 1;
+       return 0;
+}
+
+static const struct rte_pci_id cn9k_pci_nix_map[] = {
+       {
+               .vendor_id = 0,
+       },
+};
+
+static struct rte_pci_driver cn9k_pci_nix = {
+       .id_table = cn9k_pci_nix_map,
+       .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_NEED_IOVA_AS_VA |
+                    RTE_PCI_DRV_INTR_LSC,
+       .probe = cn9k_nix_probe,
+       .remove = cn9k_nix_remove,
+};
+
+RTE_PMD_REGISTER_PCI(net_cn9k, cn9k_pci_nix);
+RTE_PMD_REGISTER_PCI_TABLE(net_cn9k, cn9k_pci_nix_map);
+RTE_PMD_REGISTER_KMOD_DEP(net_cn9k, "vfio-pci");
drivers/net/cnxk/cn9k_ethdev.h new file +9 -0
new file mode 100644
index 0000000..15d9397
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+#ifndef __CN9K_ETHDEV_H__
+#define __CN9K_ETHDEV_H__
+
+#include <cnxk_ethdev.h>
+
+#endif /* __CN9K_ETHDEV_H__ */
drivers/net/cnxk/cnxk_ethdev.c +42 -0
index 6717410..b836fc2 100644
@@ -3,6 +3,40 @@
  */
 #include <cnxk_ethdev.h>
 
+static inline uint64_t
+nix_get_rx_offload_capa(struct cnxk_eth_dev *dev)
+{
+       uint64_t capa = CNXK_NIX_RX_OFFLOAD_CAPA;
+
+       if (roc_nix_is_vf_or_sdp(&dev->nix))
+               capa &= ~DEV_RX_OFFLOAD_TIMESTAMP;
+
+       return capa;
+}
+
+static inline uint64_t
+nix_get_tx_offload_capa(struct cnxk_eth_dev *dev)
+{
+       RTE_SET_USED(dev);
+       return CNXK_NIX_TX_OFFLOAD_CAPA;
+}
+
+static inline uint32_t
+nix_get_speed_capa(struct cnxk_eth_dev *dev)
+{
+       uint32_t speed_capa;
+
+       /* Auto negotiation disabled */
+       speed_capa = ETH_LINK_SPEED_FIXED;
+       if (!roc_nix_is_vf_or_sdp(&dev->nix) && !roc_nix_is_lbk(&dev->nix)) {
+               speed_capa |= ETH_LINK_SPEED_1G | ETH_LINK_SPEED_10G |
+                             ETH_LINK_SPEED_25G | ETH_LINK_SPEED_40G |
+                             ETH_LINK_SPEED_50G | ETH_LINK_SPEED_100G;
+       }
+
+       return speed_capa;
+}
+
 /* CNXK platform independent eth dev ops */
 struct eth_dev_ops cnxk_eth_dev_ops;
 
@@ -77,6 +111,14 @@ cnxk_eth_dev_init(struct rte_eth_dev *eth_dev)
                }
        }
 
+       /* Union of all capabilities supported by CNXK.
+        * Platform specific capabilities will be
+        * updated later.
+        */
+       dev->rx_offload_capa = nix_get_rx_offload_capa(dev);
+       dev->tx_offload_capa = nix_get_tx_offload_capa(dev);
+       dev->speed_capa = nix_get_speed_capa(dev);
+
        /* Initialize roc npc */
        plt_nix_dbg("Port=%d pf=%d vf=%d ver=%s hwcap=0x%" PRIx64
                    " rxoffload_capa=0x%" PRIx64 " txoffload_capa=0x%" PRIx64,
drivers/net/cnxk/cnxk_ethdev.h +19 -0
index 0460d1e..ba2bfcd 100644
@@ -14,6 +14,22 @@
 
 #define CNXK_ETH_DEV_PMD_VERSION "1.0"
 
+#define CNXK_NIX_TX_OFFLOAD_CAPA                                               \
+       (DEV_TX_OFFLOAD_MBUF_FAST_FREE | DEV_TX_OFFLOAD_MT_LOCKFREE |          \
+        DEV_TX_OFFLOAD_VLAN_INSERT | DEV_TX_OFFLOAD_QINQ_INSERT |             \
+        DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM | DEV_TX_OFFLOAD_OUTER_UDP_CKSUM |    \
+        DEV_TX_OFFLOAD_TCP_CKSUM | DEV_TX_OFFLOAD_UDP_CKSUM |                 \
+        DEV_TX_OFFLOAD_SCTP_CKSUM | DEV_TX_OFFLOAD_TCP_TSO |                  \
+        DEV_TX_OFFLOAD_VXLAN_TNL_TSO | DEV_TX_OFFLOAD_GENEVE_TNL_TSO |        \
+        DEV_TX_OFFLOAD_GRE_TNL_TSO | DEV_TX_OFFLOAD_MULTI_SEGS |              \
+        DEV_TX_OFFLOAD_IPV4_CKSUM)
+
+#define CNXK_NIX_RX_OFFLOAD_CAPA                                               \
+       (DEV_RX_OFFLOAD_CHECKSUM | DEV_RX_OFFLOAD_SCTP_CKSUM |                 \
+        DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM | DEV_RX_OFFLOAD_SCATTER |            \
+        DEV_RX_OFFLOAD_JUMBO_FRAME | DEV_RX_OFFLOAD_OUTER_UDP_CKSUM |         \
+        DEV_RX_OFFLOAD_RSS_HASH)
+
 struct cnxk_eth_dev {
        /* ROC NIX */
        struct roc_nix nix;
@@ -28,6 +44,9 @@ struct cnxk_eth_dev {
 
        /* HW capabilities / Limitations */
        union {
+               struct {
+                       uint64_t cq_min_4k : 1;
+               };
                uint64_t hwcap;
        };
 
drivers/net/cnxk/meson.build +5 -1
index 77b2f18..57dea5e 100644
@@ -10,6 +10,11 @@ endif
 
 sources = files('cnxk_ethdev.c')
 
+# CN9K
+sources += files('cn9k_ethdev.c')
+# CN10K
+sources += files('cn10k_ethdev.c')
+
 deps += ['bus_pci', 'cryptodev', 'eventdev', 'security']
 deps += ['common_cnxk', 'mempool_cnxk']
 
--

2.8.4

#66 lore raw

PATCH v2 11/62 net/cnxk: add common devargs parsing function

In reply to Nithin Dabilpuram

Add various devargs parsing command line arguments parsing functions supported by CN9K and CN10K.

---
 doc/guides/nics/cnxk.rst               |  94 +++++++++++++++++++
 drivers/net/cnxk/cnxk_ethdev.c         |   7 ++
 drivers/net/cnxk/cnxk_ethdev.h         |   9 ++
 drivers/net/cnxk/cnxk_ethdev_devargs.c | 166 +++++++++++++++++++++++++++++++++
 drivers/net/cnxk/meson.build           |   3 +-
 5 files changed, 278 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/cnxk/cnxk_ethdev_devargs.c
doc/guides/nics/cnxk.rst +94 -0
index ca21842..611ffb4 100644
@@ -27,3 +27,97 @@ Driver compilation and testing
 
 Refer to the document :ref:`compiling and testing a PMD for a NIC <pmd_build_and_test>`
 for details.
+
+Runtime Config Options
+----------------------
+
+- ``Rx&Tx scalar mode enable`` (default ``0``)
+
+   Ethdev supports both scalar and vector mode, it may be selected at runtime
+   using ``scalar_enable`` ``devargs`` parameter.
+
+- ``RSS reta size`` (default ``64``)
+
+   RSS redirection table size may be configured during runtime using ``reta_size``
+   ``devargs`` parameter.
+
+   For example::
+
+      -a 0002:02:00.0,reta_size=256
+
+   With the above configuration, reta table of size 256 is populated.
+
+- ``Flow priority levels`` (default ``3``)
+
+   RTE Flow priority levels can be configured during runtime using
+   ``flow_max_priority`` ``devargs`` parameter.
+
+   For example::
+
+      -a 0002:02:00.0,flow_max_priority=10
+
+   With the above configuration, priority level was set to 10 (0-9). Max
+   priority level supported is 32.
+
+- ``Reserve Flow entries`` (default ``8``)
+
+   RTE flow entries can be pre allocated and the size of pre allocation can be
+   selected runtime using ``flow_prealloc_size`` ``devargs`` parameter.
+
+   For example::
+
+      -a 0002:02:00.0,flow_prealloc_size=4
+
+   With the above configuration, pre alloc size was set to 4. Max pre alloc
+   size supported is 32.
+
+- ``Max SQB buffer count`` (default ``512``)
+
+   Send queue descriptor buffer count may be limited during runtime using
+   ``max_sqb_count`` ``devargs`` parameter.
+
+   For example::
+
+      -a 0002:02:00.0,max_sqb_count=64
+
+   With the above configuration, each send queue's decscriptor buffer count is
+   limited to a maximum of 64 buffers.
+
+- ``Switch header enable`` (default ``none``)
+
+   A port can be configured to a specific switch header type by using
+   ``switch_header`` ``devargs`` parameter.
+
+   For example::
+
+      -a 0002:02:00.0,switch_header="higig2"
+
+   With the above configuration, higig2 will be enabled on that port and the
+   traffic on this port should be higig2 traffic only. Supported switch header
+   types are "higig2", "dsa", "chlen90b" and "chlen24b".
+
+- ``RSS tag as XOR`` (default ``0``)
+
+   The HW gives two options to configure the RSS adder i.e
+
+   * ``rss_adder<7:0> = flow_tag<7:0> ^ flow_tag<15:8> ^ flow_tag<23:16> ^ flow_tag<31:24>``
+
+   * ``rss_adder<7:0> = flow_tag<7:0>``
+
+   Latter one aligns with standard NIC behavior vs former one is a legacy
+   RSS adder scheme used in OCTEON TX2 products.
+
+   By default, the driver runs in the latter mode.
+   Setting this flag to 1 to select the legacy mode.
+
+   For example to select the legacy mode(RSS tag adder as XOR)::
+
+      -a 0002:02:00.0,tag_as_xor=1
+
+
+
+.. note::
+
+   Above devarg parameters are configurable per device, user needs to pass the
+   parameters to all the PCIe devices if application requires to configure on
+   all the ethdev ports.
drivers/net/cnxk/cnxk_ethdev.c +7 -0
index b836fc2..3a2309e 100644
@@ -58,6 +58,13 @@ cnxk_eth_dev_init(struct rte_eth_dev *eth_dev)
 	rte_eth_copy_pci_info(eth_dev, pci_dev);
 	eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
 
+	/* Parse devargs string */
+	rc = cnxk_ethdev_parse_devargs(eth_dev->device->devargs, dev);
+	if (rc) {
+		plt_err("Failed to parse devargs rc=%d", rc);
+		goto error;
+	}
+
 	/* Initialize base roc nix */
 	nix->pci_dev = pci_dev;
 	rc = roc_nix_dev_init(nix);
drivers/net/cnxk/cnxk_ethdev.h +9 -0
index ba2bfcd..97e3a15 100644
@@ -9,11 +9,15 @@
 
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
+#include <rte_kvargs.h>
 
 #include "roc_api.h"
 
 #define CNXK_ETH_DEV_PMD_VERSION "1.0"
 
+/* Max supported SQB count */
+#define CNXK_NIX_TX_MAX_SQB 512
+
 #define CNXK_NIX_TX_OFFLOAD_CAPA                                               \
 	(DEV_TX_OFFLOAD_MBUF_FAST_FREE | DEV_TX_OFFLOAD_MT_LOCKFREE |          \
 	 DEV_TX_OFFLOAD_VLAN_INSERT | DEV_TX_OFFLOAD_QINQ_INSERT |             \
@@ -38,6 +42,7 @@ struct cnxk_eth_dev {
 	uint8_t max_mac_entries;
 
 	uint16_t flags;
+	bool scalar_ena;
 
 	/* Pointer back to rte */
 	struct rte_eth_dev *eth_dev;
@@ -73,4 +78,8 @@ int cnxk_nix_probe(struct rte_pci_driver *pci_drv,
 		   struct rte_pci_device *pci_dev);
 int cnxk_nix_remove(struct rte_pci_device *pci_dev);
 
+/* Devargs */
+int cnxk_ethdev_parse_devargs(struct rte_devargs *devargs,
+			      struct cnxk_eth_dev *dev);
+
 #endif /* __CNXK_ETHDEV_H__ */
drivers/net/cnxk/cnxk_ethdev_devargs.c new file +166 -0

166 lines not on this page · raw message

drivers/net/cnxk/meson.build +2 -1
index 57dea5e..00c4722 100644
@@ -8,7 +8,8 @@ if not dpdk_conf.get('RTE_ARCH_64')
 	subdir_done()
 endif
 
-sources = files('cnxk_ethdev.c')
+sources = files('cnxk_ethdev.c',
+		'cnxk_ethdev_devargs.c')
 
 # CN9K
 sources += files('cn9k_ethdev.c')
Signature · 1 line
2.8.4
#67 lore raw

Re: [dpdk-dev] [PATCH v2 11/62] net/cnxk: add common devargs parsing function

Quoted 19 lines · Nithin Dabilpuram

Add various devargs parsing command line arguments parsing functions supported by CN9K and CN10K.

---
 doc/guides/nics/cnxk.rst               |  94 +++++++++++++++++++
 drivers/net/cnxk/cnxk_ethdev.c         |   7 ++
 drivers/net/cnxk/cnxk_ethdev.h         |   9 ++
 drivers/net/cnxk/cnxk_ethdev_devargs.c | 166 +++++++++++++++++++++++++++++++++
 drivers/net/cnxk/meson.build           |   3 +-
 5 files changed, 278 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/cnxk/cnxk_ethdev_devargs.c
doc/guides/nics/cnxk.rst +0 -0
index ca21842..611ffb4 100644

doc/guides/nics/cnxk.rst Driver compilation and testing · line 36

Quoted 10 lines
doc/guides/nics/cnxk.rst +7 -0
@@ -27,3 +27,97 @@ Driver compilation and testing
 
 Refer to the document :ref:`compiling and testing a PMD for a NIC <pmd_build_and_test>`
 for details.
+
+Runtime Config Options
+----------------------
+
+- ``Rx&Tx scalar mode enable`` (default ``0``)
+
+   Ethdev supports both scalar and vector mode, it may be selected at runtime

Ethdev->PMD

Quoted 37 lines
doc/guides/nics/cnxk.rst +37 -0
+   using ``scalar_enable`` ``devargs`` parameter.
+
+- ``RSS reta size`` (default ``64``)
+
+   RSS redirection table size may be configured during runtime using ``reta_size``
+   ``devargs`` parameter.
+
+   For example::
+
+      -a 0002:02:00.0,reta_size=256
+
+   With the above configuration, reta table of size 256 is populated.
+
+- ``Flow priority levels`` (default ``3``)
+
+   RTE Flow priority levels can be configured during runtime using
+   ``flow_max_priority`` ``devargs`` parameter.
+
+   For example::
+
+      -a 0002:02:00.0,flow_max_priority=10
+
+   With the above configuration, priority level was set to 10 (0-9). Max
+   priority level supported is 32.
+
+- ``Reserve Flow entries`` (default ``8``)
+
+   RTE flow entries can be pre allocated and the size of pre allocation can be
+   selected runtime using ``flow_prealloc_size`` ``devargs`` parameter.
+
+   For example::
+
+      -a 0002:02:00.0,flow_prealloc_size=4
+
+   With the above configuration, pre alloc size was set to 4. Max pre alloc
+   size supported is 32.
+

doc/guides/nics/cnxk.rst Driver compilation and testing · line 83

Quoted 10 lines
doc/guides/nics/cnxk.rst +10 -0
+- ``Max SQB buffer count`` (default ``512``)
+
+   Send queue descriptor buffer count may be limited during runtime using
+   ``max_sqb_count`` ``devargs`` parameter.
+
+   For example::
+
+      -a 0002:02:00.0,max_sqb_count=64
+
+   With the above configuration, each send queue's decscriptor buffer count is

Typo

Quoted 23 lines
doc/guides/nics/cnxk.rst +23 -0
+   limited to a maximum of 64 buffers.
+
+- ``Switch header enable`` (default ``none``)
+
+   A port can be configured to a specific switch header type by using
+   ``switch_header`` ``devargs`` parameter.
+
+   For example::
+
+      -a 0002:02:00.0,switch_header="higig2"
+
+   With the above configuration, higig2 will be enabled on that port and the
+   traffic on this port should be higig2 traffic only. Supported switch header
+   types are "higig2", "dsa", "chlen90b" and "chlen24b".
+
+- ``RSS tag as XOR`` (default ``0``)
+
+   The HW gives two options to configure the RSS adder i.e
+
+   * ``rss_adder<7:0> = flow_tag<7:0> ^ flow_tag<15:8> ^ flow_tag<23:16> ^ flow_tag<31:24>``
+
+   * ``rss_adder<7:0> = flow_tag<7:0>``
+
#68 lore raw

PATCH v2 12/62 net/cnxk: add common dev infos get support

In reply to Nithin Dabilpuram

Add support to retrieve dev infos get for CN9K and CN10K.

---
 doc/guides/nics/cnxk.rst              |  3 ++
 doc/guides/nics/features/cnxk.ini     |  4 ++
 doc/guides/nics/features/cnxk_vec.ini |  4 ++
 doc/guides/nics/features/cnxk_vf.ini  |  3 ++
 drivers/net/cnxk/cnxk_ethdev.c        |  4 +-
 drivers/net/cnxk/cnxk_ethdev.h        | 33 ++++++++++++++++
 drivers/net/cnxk/cnxk_ethdev_ops.c    | 71 +++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/meson.build          |  1 +
 8 files changed, 122 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/cnxk/cnxk_ethdev_ops.c
doc/guides/nics/cnxk.rst +3 -0
index 611ffb4..dfe2e7a 100644
@@ -16,6 +16,9 @@ Features
 
 Features of the CNXK Ethdev PMD are:
 
+- SR-IOV VF
+- Lock-free Tx queue
+
 Prerequisites
 -------------
 
doc/guides/nics/features/cnxk.ini +4 -0
index 2c23464..b426340 100644
@@ -4,6 +4,10 @@
 ; Refer to default.ini for the full list of available PMD features.
 ;
 [Features]
+Speed capabilities   = Y
+Lock-free Tx queue   = Y
+SR-IOV               = Y
+Multiprocess aware   = Y
 Linux                = Y
 ARMv8                = Y
 Usage doc            = Y
doc/guides/nics/features/cnxk_vec.ini +4 -0
index de78516..292ac1e 100644
@@ -4,6 +4,10 @@
 ; Refer to default.ini for the full list of available PMD features.
 ;
 [Features]
+Speed capabilities   = Y
+Lock-free Tx queue   = Y
+SR-IOV               = Y
+Multiprocess aware   = Y
 Linux                = Y
 ARMv8                = Y
 Usage doc            = Y
doc/guides/nics/features/cnxk_vf.ini +3 -0
index 9c96351..bc2eb8a 100644
@@ -4,6 +4,9 @@
 ; Refer to default.ini for the full list of available PMD features.
 ;
 [Features]
+Speed capabilities   = Y
+Lock-free Tx queue   = Y
+Multiprocess aware   = Y
 Linux                = Y
 ARMv8                = Y
 Usage doc            = Y
drivers/net/cnxk/cnxk_ethdev.c +3 -1
index 3a2309e..1567007 100644
@@ -38,7 +38,9 @@ nix_get_speed_capa(struct cnxk_eth_dev *dev)
 }
 
 /* CNXK platform independent eth dev ops */
-struct eth_dev_ops cnxk_eth_dev_ops;
+struct eth_dev_ops cnxk_eth_dev_ops = {
+	.dev_infos_get = cnxk_nix_info_get,
+};
 
 static int
 cnxk_eth_dev_init(struct rte_eth_dev *eth_dev)
drivers/net/cnxk/cnxk_ethdev.h +33 -0
index 97e3a15..8d9a7e0 100644
@@ -15,9 +15,40 @@
 
 #define CNXK_ETH_DEV_PMD_VERSION "1.0"
 
+/* VLAN tag inserted by NIX_TX_VTAG_ACTION.
+ * In Tx space is always reserved for this in FRS.
+ */
+#define CNXK_NIX_MAX_VTAG_INS	   2
+#define CNXK_NIX_MAX_VTAG_ACT_SIZE (4 * CNXK_NIX_MAX_VTAG_INS)
+
+/* ETH_HLEN+ETH_FCS+2*VLAN_HLEN */
+#define CNXK_NIX_L2_OVERHEAD (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + 8)
+
+#define CNXK_NIX_RX_MIN_DESC	    16
+#define CNXK_NIX_RX_MIN_DESC_ALIGN  16
+#define CNXK_NIX_RX_NB_SEG_MAX	    6
+#define CNXK_NIX_RX_DEFAULT_RING_SZ 4096
 /* Max supported SQB count */
 #define CNXK_NIX_TX_MAX_SQB 512
 
+/* If PTP is enabled additional SEND MEM DESC is required which
+ * takes 2 words, hence max 7 iova address are possible
+ */
+#if defined(RTE_LIBRTE_IEEE1588)
+#define CNXK_NIX_TX_NB_SEG_MAX 7
+#else
+#define CNXK_NIX_TX_NB_SEG_MAX 9
+#endif
+
+#define CNXK_NIX_RSS_L3_L4_SRC_DST                                             \
+	(ETH_RSS_L3_SRC_ONLY | ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_SRC_ONLY |     \
+	 ETH_RSS_L4_DST_ONLY)
+
+#define CNXK_NIX_RSS_OFFLOAD                                                   \
+	(ETH_RSS_PORT | ETH_RSS_IP | ETH_RSS_UDP | ETH_RSS_TCP |               \
+	 ETH_RSS_SCTP | ETH_RSS_TUNNEL | ETH_RSS_L2_PAYLOAD |                  \
+	 CNXK_NIX_RSS_L3_L4_SRC_DST | ETH_RSS_LEVEL_MASK | ETH_RSS_C_VLAN)
+
 #define CNXK_NIX_TX_OFFLOAD_CAPA                                               \
 	(DEV_TX_OFFLOAD_MBUF_FAST_FREE | DEV_TX_OFFLOAD_MT_LOCKFREE |          \
 	 DEV_TX_OFFLOAD_VLAN_INSERT | DEV_TX_OFFLOAD_QINQ_INSERT |             \
@@ -77,6 +108,8 @@ extern struct eth_dev_ops cnxk_eth_dev_ops;
 int cnxk_nix_probe(struct rte_pci_driver *pci_drv,
 		   struct rte_pci_device *pci_dev);
 int cnxk_nix_remove(struct rte_pci_device *pci_dev);
+int cnxk_nix_info_get(struct rte_eth_dev *eth_dev,
+		      struct rte_eth_dev_info *dev_info);
 
 /* Devargs */
 int cnxk_ethdev_parse_devargs(struct rte_devargs *devargs,
drivers/net/cnxk/cnxk_ethdev_ops.c new file +71 -0

71 lines not on this page · raw message

drivers/net/cnxk/meson.build +1 -0
index 00c4722..45ccbe3 100644
@@ -9,6 +9,7 @@ if not dpdk_conf.get('RTE_ARCH_64')
 endif
 
 sources = files('cnxk_ethdev.c',
+		'cnxk_ethdev_ops.c',
 		'cnxk_ethdev_devargs.c')
 
 # CN9K
Signature · 1 line
2.8.4
#69 lore raw

PATCH v2 13/62 net/cnxk: add device configuration operation

In reply to Nithin Dabilpuram

Add device configuration op for CN9K and CN10K. Most of the device configuration is common between two platforms except for some supported offloads.

---
 doc/guides/nics/cnxk.rst              |   2 +
 doc/guides/nics/features/cnxk.ini     |   2 +
 doc/guides/nics/features/cnxk_vec.ini |   2 +
 doc/guides/nics/features/cnxk_vf.ini  |   2 +
 drivers/net/cnxk/cn10k_ethdev.c       |  34 +++
 drivers/net/cnxk/cn9k_ethdev.c        |  45 +++
 drivers/net/cnxk/cnxk_ethdev.c        | 539 ++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cnxk_ethdev.h        |  70 +++++
 8 files changed, 696 insertions(+)
doc/guides/nics/cnxk.rst +2 -0
index dfe2e7a..73eb62a 100644
@@ -18,6 +18,8 @@ Features of the CNXK Ethdev PMD are:
 
 - SR-IOV VF
 - Lock-free Tx queue
+- Multiple queues for TX and RX
+- Receiver Side Scaling (RSS)
 
 Prerequisites
 -------------
doc/guides/nics/features/cnxk.ini +2 -0
index b426340..96dba2a 100644
@@ -8,6 +8,8 @@ Speed capabilities   = Y
 Lock-free Tx queue   = Y
 SR-IOV               = Y
 Multiprocess aware   = Y
+RSS hash             = Y
+Inner RSS            = Y
 Linux                = Y
 ARMv8                = Y
 Usage doc            = Y
doc/guides/nics/features/cnxk_vec.ini +2 -0
index 292ac1e..616991c 100644
@@ -8,6 +8,8 @@ Speed capabilities   = Y
 Lock-free Tx queue   = Y
 SR-IOV               = Y
 Multiprocess aware   = Y
+RSS hash             = Y
+Inner RSS            = Y
 Linux                = Y
 ARMv8                = Y
 Usage doc            = Y
doc/guides/nics/features/cnxk_vf.ini +2 -0
index bc2eb8a..a0bd2f1 100644
@@ -7,6 +7,8 @@
 Speed capabilities   = Y
 Lock-free Tx queue   = Y
 Multiprocess aware   = Y
+RSS hash             = Y
+Inner RSS            = Y
 Linux                = Y
 ARMv8                = Y
 Usage doc            = Y
drivers/net/cnxk/cn10k_ethdev.c +34 -0
index ff8ce31..d971bbd 100644
@@ -4,6 +4,38 @@
 #include "cn10k_ethdev.h"
 
 static int
+cn10k_nix_configure(struct rte_eth_dev *eth_dev)
+{
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	int rc;
+
+	/* Common nix configure */
+	rc = cnxk_nix_configure(eth_dev);
+	if (rc)
+		return rc;
+
+	plt_nix_dbg("Configured port%d platform specific rx_offload_flags=%x"
+		    " tx_offload_flags=0x%x",
+		    eth_dev->data->port_id, dev->rx_offload_flags,
+		    dev->tx_offload_flags);
+	return 0;
+}
+
+/* Update platform specific eth dev ops */
+static void
+nix_eth_dev_ops_override(void)
+{
+	static int init_once;
+
+	if (init_once)
+		return;
+	init_once = 1;
+
+	/* Update platform specific ops */
+	cnxk_eth_dev_ops.dev_configure = cn10k_nix_configure;
+}
+
+static int
 cn10k_nix_remove(struct rte_pci_device *pci_dev)
 {
 	return cnxk_nix_remove(pci_dev);
@@ -26,6 +58,8 @@ cn10k_nix_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 		return rc;
 	}
 
+	nix_eth_dev_ops_override();
+
 	/* Common probe */
 	rc = cnxk_nix_probe(pci_drv, pci_dev);
 	if (rc)
drivers/net/cnxk/cn9k_ethdev.c +45 -0

57 lines not on this page · raw message

drivers/net/cnxk/cnxk_ethdev.c +539 -0

563 lines not on this page · raw message

drivers/net/cnxk/cnxk_ethdev.h +70 -0

97 lines not on this page · raw message

Signature · 1 line
2.8.4
#70 lore raw

Re: [dpdk-dev] [PATCH v2 13/62] net/cnxk: add device configuration operation

Quoted 26 lines · Nithin Dabilpuram

Add device configuration op for CN9K and CN10K. Most of the device configuration is common between two platforms except for some supported offloads.

drivers/net/cnxk/cnxk_ethdev.c +20 -0
+static int
+nix_restore_queue_cfg(struct rte_eth_dev *eth_dev)
+{
+       struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+       const struct eth_dev_ops *dev_ops = eth_dev->dev_ops;
+       struct cnxk_eth_qconf *tx_qconf = dev->tx_qconf;
+       struct cnxk_eth_qconf *rx_qconf = dev->rx_qconf;
+       int rc, i, nb_rxq, nb_txq;
+       void **txq, **rxq;
+
+       nb_rxq = RTE_MIN(dev->nb_rxq, eth_dev->data->nb_rx_queues);
+       nb_txq = RTE_MIN(dev->nb_txq, eth_dev->data->nb_tx_queues);
+
+       rc = -ENOMEM;
+       /* Setup tx & rx queues with previous configuration so
+        * that the queues can be functional in cases like ports
+        * are started without re configuring queues.
+        *
+        * Usual re config sequence is like below:
+        * port_configure() {

drivers/net/cnxk/cnxk_ethdev.c nix_get_speed_capa(struct cnxk_eth_dev *dev) · line 240

Quoted 10 lines
drivers/net/cnxk/cnxk_ethdev.c +10 -0
+        *      if(reconfigure) {
+        *              queue_release()
+        *              queue_setup()
+        *      }
+        *      queue_configure() {
+        *              queue_release()
+        *              queue_setup()
+        *      }
+        * }
+        * port_start()

This logic no more required as the KNI application fixed the bug.

Quoted 57 lines
drivers/net/cnxk/cnxk_ethdev.c +56 -0
+        *
+        * In some application's control path, queue_configure() would
+        * NOT be invoked for TXQs/RXQs in port_configure().
+        * In such cases, queues can be functional after start as the
+        * queues are already setup in port_configure().
+        */
+       for (i = 0; i < nb_txq; i++) {
+               if (!tx_qconf[i].valid)
+                       continue;
+               rc = dev_ops->tx_queue_setup(eth_dev, i, tx_qconf[i].nb_desc, 0,
+                                            &tx_qconf[i].conf.tx);
+               if (rc) {
+                       plt_err("Failed to setup tx queue rc=%d", rc);
+                       txq = eth_dev->data->tx_queues;
+                       for (i -= 1; i >= 0; i--)
+                               dev_ops->tx_queue_release(txq[i]);
+                       goto fail;
+               }
+       }
+
+       free(tx_qconf);
+       tx_qconf = NULL;
+
+       for (i = 0; i < nb_rxq; i++) {
+               if (!rx_qconf[i].valid)
+                       continue;
+               rc = dev_ops->rx_queue_setup(eth_dev, i, rx_qconf[i].nb_desc, 0,
+                                            &rx_qconf[i].conf.rx,
+                                            rx_qconf[i].mp);
+               if (rc) {
+                       plt_err("Failed to setup rx queue rc=%d", rc);
+                       rxq = eth_dev->data->rx_queues;
+                       for (i -= 1; i >= 0; i--)
+                               dev_ops->rx_queue_release(rxq[i]);
+                       goto tx_queue_release;
+               }
+       }
+
+       free(rx_qconf);
+       rx_qconf = NULL;
+
+       return 0;
+
+tx_queue_release:
+       txq = eth_dev->data->tx_queues;
+       for (i = 0; i < eth_dev->data->nb_tx_queues; i++)
+               dev_ops->tx_queue_release(txq[i]);
+fail:
+       if (tx_qconf)
+               free(tx_qconf);
+       if (rx_qconf)
+               free(rx_qconf);
+
+       return rc;
+}
+
#71 lore raw

PATCH v2 14/62 net/cnxk: add link status update support

In reply to Nithin Dabilpuram

Add link status update callback to get current
link status.

---
 doc/guides/nics/cnxk.rst              |   1 +
 doc/guides/nics/features/cnxk.ini     |   2 +
 doc/guides/nics/features/cnxk_vec.ini |   2 +
 doc/guides/nics/features/cnxk_vf.ini  |   2 +
 drivers/net/cnxk/cnxk_ethdev.c        |   7 +++
 drivers/net/cnxk/cnxk_ethdev.h        |   8 +++
 drivers/net/cnxk/cnxk_link.c          | 102 ++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/meson.build          |   3 +-
 8 files changed, 126 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/cnxk/cnxk_link.c
doc/guides/nics/cnxk.rst +1 -0
index 73eb62a..a982450 100644
@@ -20,6 +20,7 @@ Features of the CNXK Ethdev PMD are:
 - Lock-free Tx queue
 - Multiple queues for TX and RX
 - Receiver Side Scaling (RSS)
+- Link state information
 
 Prerequisites
 -------------
doc/guides/nics/features/cnxk.ini +2 -0
index 96dba2a..affbbd9 100644
@@ -8,6 +8,8 @@ Speed capabilities   = Y
 Lock-free Tx queue   = Y
 SR-IOV               = Y
 Multiprocess aware   = Y
+Link status          = Y
+Link status event    = Y
 RSS hash             = Y
 Inner RSS            = Y
 Linux                = Y
doc/guides/nics/features/cnxk_vec.ini +2 -0
index 616991c..836cc9f 100644
@@ -8,6 +8,8 @@ Speed capabilities   = Y
 Lock-free Tx queue   = Y
 SR-IOV               = Y
 Multiprocess aware   = Y
+Link status          = Y
+Link status event    = Y
 RSS hash             = Y
 Inner RSS            = Y
 Linux                = Y
doc/guides/nics/features/cnxk_vf.ini +2 -0
index a0bd2f1..29bb24f 100644
@@ -7,6 +7,8 @@
 Speed capabilities   = Y
 Lock-free Tx queue   = Y
 Multiprocess aware   = Y
+Link status          = Y
+Link status event    = Y
 RSS hash             = Y
 Inner RSS            = Y
 Linux                = Y
drivers/net/cnxk/cnxk_ethdev.c +7 -0
index 7824f3b..1d7e0a7 100644
@@ -572,6 +572,7 @@ cnxk_nix_configure(struct rte_eth_dev *eth_dev)
 /* CNXK platform independent eth dev ops */
 struct eth_dev_ops cnxk_eth_dev_ops = {
 	.dev_infos_get = cnxk_nix_info_get,
+	.link_update = cnxk_nix_link_update,
 };
 
 static int
@@ -607,6 +608,9 @@ cnxk_eth_dev_init(struct rte_eth_dev *eth_dev)
 		goto error;
 	}
 
+	/* Register up msg callbacks */
+	roc_nix_mac_link_cb_register(nix, cnxk_eth_dev_link_status_cb);
+
 	dev->eth_dev = eth_dev;
 	dev->configured = 0;
 
@@ -695,6 +699,9 @@ cnxk_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool mbox_close)
 
 	roc_nix_npc_rx_ena_dis(nix, false);
 
+	/* Disable link status events */
+	roc_nix_mac_link_event_start_stop(nix, false);
+
 	/* Free up SQs */
 	for (i = 0; i < eth_dev->data->nb_tx_queues; i++) {
 		dev_ops->tx_queue_release(eth_dev->data->tx_queues[i]);
drivers/net/cnxk/cnxk_ethdev.h +8 -0
index 55da1da..6dad8ac 100644
@@ -15,6 +15,9 @@
 
 #define CNXK_ETH_DEV_PMD_VERSION "1.0"
 
+/* Used for struct cnxk_eth_dev::flags */
+#define CNXK_LINK_CFG_IN_PROGRESS_F BIT_ULL(0)
+
 /* VLAN tag inserted by NIX_TX_VTAG_ACTION.
  * In Tx space is always reserved for this in FRS.
  */
@@ -181,6 +184,11 @@ int cnxk_nix_configure(struct rte_eth_dev *eth_dev);
 uint32_t cnxk_rss_ethdev_to_nix(struct cnxk_eth_dev *dev, uint64_t ethdev_rss,
 				uint8_t rss_level);
 
+/* Link */
+void cnxk_eth_dev_link_status_cb(struct roc_nix *nix,
+				 struct roc_nix_link_info *link);
+int cnxk_nix_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete);
+
 /* Devargs */
 int cnxk_ethdev_parse_devargs(struct rte_devargs *devargs,
 			      struct cnxk_eth_dev *dev);
drivers/net/cnxk/cnxk_link.c new file +102 -0

102 lines not on this page · raw message

drivers/net/cnxk/meson.build +2 -1
index 45ccbe3..c0ec91a 100644
@@ -10,7 +10,8 @@ endif
 
 sources = files('cnxk_ethdev.c',
 		'cnxk_ethdev_ops.c',
-		'cnxk_ethdev_devargs.c')
+		'cnxk_ethdev_devargs.c',
+		'cnxk_link.c')
 
 # CN9K
 sources += files('cn9k_ethdev.c')
Signature · 1 line
2.8.4
Reviewed-by on v2 14/62
#72 lore raw

Re: [dpdk-dev] [PATCH v2 14/62] net/cnxk: add link status update support

Quoted 20 lines · Nithin Dabilpuram

Add link status update callback to get current
link status.

---
 doc/guides/nics/cnxk.rst              |   1 +
 doc/guides/nics/features/cnxk.ini     |   2 +
 doc/guides/nics/features/cnxk_vec.ini |   2 +
 doc/guides/nics/features/cnxk_vf.ini  |   2 +
 drivers/net/cnxk/cnxk_ethdev.c        |   7 +++
 drivers/net/cnxk/cnxk_ethdev.h        |   8 +++
 drivers/net/cnxk/cnxk_link.c          | 102 ++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/meson.build          |   3 +-
 8 files changed, 126 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/cnxk/cnxk_link.c
drivers/net/cnxk/cnxk_link.c new file +3 -0
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */

drivers/net/cnxk/cnxk_link.c line 13

Quoted 10 lines
drivers/net/cnxk/cnxk_link.c new file +10 -0
+
+#include "cnxk_ethdev.h"
+
+static inline int
+nix_wait_for_link_cfg(struct cnxk_eth_dev *dev)
+{
+       uint16_t wait = 1000;
+
+       do {
+               rte_rmb();

Please use gcc atomics instead.

With above change:

Quoted 9 lines
drivers/net/cnxk/cnxk_link.c new file +8 -0
+               if (!(dev->flags & CNXK_LINK_CFG_IN_PROGRESS_F))
+                       break;
+               wait--;
+               rte_delay_ms(1);
+       } while (wait);
+
+       return wait ? 0 : -1;
+}
#73 lore raw

PATCH v2 15/62 net/cnxk: add Rx queue setup and release

In reply to Nithin Dabilpuram

Add Rx queue setup and release op for CN9K and CN10K SoC. Release is completely common while setup is platform dependent due to fast path Rx queue structure variation. Fastpath is platform dependent partly due to core cacheline size difference.

---
 doc/guides/nics/features/cnxk.ini     |   1 +
 doc/guides/nics/features/cnxk_vec.ini |   1 +
 doc/guides/nics/features/cnxk_vf.ini  |   1 +
 drivers/net/cnxk/cn10k_ethdev.c       |  44 +++++++++
 drivers/net/cnxk/cn10k_ethdev.h       |  14 +++
 drivers/net/cnxk/cn9k_ethdev.c        |  44 +++++++++
 drivers/net/cnxk/cn9k_ethdev.h        |  14 +++
 drivers/net/cnxk/cnxk_ethdev.c        | 172 ++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cnxk_ethdev.h        |   9 ++
 9 files changed, 300 insertions(+)
doc/guides/nics/features/cnxk.ini +1 -0
index affbbd9..a9d2b03 100644
@@ -10,6 +10,7 @@ SR-IOV               = Y
 Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
+Runtime Rx queue setup = Y
 RSS hash             = Y
 Inner RSS            = Y
 Linux                = Y
doc/guides/nics/features/cnxk_vec.ini +1 -0
index 836cc9f..6a8ca1f 100644
@@ -10,6 +10,7 @@ SR-IOV               = Y
 Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
+Runtime Rx queue setup = Y
 RSS hash             = Y
 Inner RSS            = Y
 Linux                = Y
doc/guides/nics/features/cnxk_vf.ini +1 -0
index 29bb24f..f761638 100644
@@ -9,6 +9,7 @@ Lock-free Tx queue   = Y
 Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
+Runtime Rx queue setup = Y
 RSS hash             = Y
 Inner RSS            = Y
 Linux                = Y
drivers/net/cnxk/cn10k_ethdev.c +44 -0

56 lines not on this page · raw message

drivers/net/cnxk/cn10k_ethdev.h +14 -0
index 1bf4a65..08e11bb 100644
@@ -6,4 +6,18 @@
 
 #include <cnxk_ethdev.h>
 
+struct cn10k_eth_rxq {
+	uint64_t mbuf_initializer;
+	uintptr_t desc;
+	void *lookup_mem;
+	uintptr_t cq_door;
+	uint64_t wdata;
+	int64_t *cq_status;
+	uint32_t head;
+	uint32_t qmask;
+	uint32_t available;
+	uint16_t data_off;
+	uint16_t rq;
+} __plt_cache_aligned;
+
 #endif /* __CN10K_ETHDEV_H__ */
drivers/net/cnxk/cn9k_ethdev.c +44 -0

56 lines not on this page · raw message

drivers/net/cnxk/cn9k_ethdev.h +14 -0
index 15d9397..6384609 100644
@@ -6,4 +6,18 @@
 
 #include <cnxk_ethdev.h>
 
+struct cn9k_eth_rxq {
+	uint64_t mbuf_initializer;
+	uint64_t data_off;
+	uintptr_t desc;
+	void *lookup_mem;
+	uintptr_t cq_door;
+	uint64_t wdata;
+	int64_t *cq_status;
+	uint32_t head;
+	uint32_t qmask;
+	uint32_t available;
+	uint16_t rq;
+} __plt_cache_aligned;
+
 #endif /* __CN9K_ETHDEV_H__ */
drivers/net/cnxk/cnxk_ethdev.c +172 -0

184 lines not on this page · raw message

drivers/net/cnxk/cnxk_ethdev.h +9 -0
index 6dad8ac..e938c64 100644
@@ -10,6 +10,9 @@
 #include <ethdev_driver.h>
 #include <ethdev_pci.h>
 #include <rte_kvargs.h>
+#include <rte_mbuf.h>
+#include <rte_mbuf_pool_ops.h>
+#include <rte_mempool.h>
 
 #include "roc_api.h"
 
@@ -179,6 +182,12 @@ int cnxk_nix_remove(struct rte_pci_device *pci_dev);
 int cnxk_nix_info_get(struct rte_eth_dev *eth_dev,
 		      struct rte_eth_dev_info *dev_info);
 int cnxk_nix_configure(struct rte_eth_dev *eth_dev);
+int cnxk_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
+			    uint16_t nb_desc, uint16_t fp_rx_q_sz,
+			    const struct rte_eth_rxconf *rx_conf,
+			    struct rte_mempool *mp);
+
+uint64_t cnxk_nix_rxq_mbuf_setup(struct cnxk_eth_dev *dev);
 
 /* RSS */
 uint32_t cnxk_rss_ethdev_to_nix(struct cnxk_eth_dev *dev, uint64_t ethdev_rss,
Signature · 1 line
2.8.4
#74 lore raw

PATCH v2 16/62 net/cnxk: add Tx queue setup and release

In reply to Nithin Dabilpuram

Add Tx queue setup and release for CN9K and CN10K. Release is common while setup is platform dependent due to differences in fast path Tx queue structures.

---
 doc/guides/nics/features/cnxk.ini     |  1 +
 doc/guides/nics/features/cnxk_vec.ini |  1 +
 doc/guides/nics/features/cnxk_vf.ini  |  1 +
 drivers/net/cnxk/cn10k_ethdev.c       | 71 +++++++++++++++++++++++++
 drivers/net/cnxk/cn10k_ethdev.h       | 12 +++++
 drivers/net/cnxk/cn10k_tx.h           | 13 +++++
 drivers/net/cnxk/cn9k_ethdev.c        | 69 ++++++++++++++++++++++++
 drivers/net/cnxk/cn9k_ethdev.h        | 10 ++++
 drivers/net/cnxk/cn9k_tx.h            | 13 +++++
 drivers/net/cnxk/cnxk_ethdev.c        | 98 +++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cnxk_ethdev.h        |  3 ++
 11 files changed, 292 insertions(+)
 create mode 100644 drivers/net/cnxk/cn10k_tx.h
 create mode 100644 drivers/net/cnxk/cn9k_tx.h
doc/guides/nics/features/cnxk.ini +1 -0
index a9d2b03..462d7c4 100644
@@ -11,6 +11,7 @@ Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
+Runtime Tx queue setup = Y
 RSS hash             = Y
 Inner RSS            = Y
 Linux                = Y
doc/guides/nics/features/cnxk_vec.ini +1 -0
index 6a8ca1f..09e0d3a 100644
@@ -11,6 +11,7 @@ Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
+Runtime Tx queue setup = Y
 RSS hash             = Y
 Inner RSS            = Y
 Linux                = Y
doc/guides/nics/features/cnxk_vf.ini +1 -0
index f761638..4a93a35 100644
@@ -10,6 +10,7 @@ Multiprocess aware   = Y
 Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
+Runtime Tx queue setup = Y
 RSS hash             = Y
 Inner RSS            = Y
 Linux                = Y
drivers/net/cnxk/cn10k_ethdev.c +71 -0

83 lines not on this page · raw message

drivers/net/cnxk/cn10k_ethdev.h +12 -0
index 08e11bb..2157b16 100644
@@ -6,6 +6,18 @@
 
 #include <cnxk_ethdev.h>
 
+struct cn10k_eth_txq {
+	uint64_t send_hdr_w0;
+	uint64_t sg_w0;
+	int64_t fc_cache_pkts;
+	uint64_t *fc_mem;
+	uintptr_t lmt_base;
+	rte_iova_t io_addr;
+	uint16_t sqes_per_sqb_log2;
+	int16_t nb_sqb_bufs_adj;
+	uint64_t cmd[4];
+} __plt_cache_aligned;
+
 struct cn10k_eth_rxq {
 	uint64_t mbuf_initializer;
 	uintptr_t desc;
drivers/net/cnxk/cn10k_tx.h new file +13 -0
new file mode 100644
index 0000000..39d4755
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+#ifndef __CN10K_TX_H__
+#define __CN10K_TX_H__
+
+#define NIX_TX_OFFLOAD_VLAN_QINQ_F    BIT(2)
+#define NIX_TX_OFFLOAD_TSO_F	      BIT(4)
+
+#define NIX_TX_NEED_EXT_HDR                                                    \
+	(NIX_TX_OFFLOAD_VLAN_QINQ_F | NIX_TX_OFFLOAD_TSO_F)
+
+#endif /* __CN10K_TX_H__ */
drivers/net/cnxk/cn9k_ethdev.c +69 -0

81 lines not on this page · raw message

drivers/net/cnxk/cn9k_ethdev.h +10 -0
index 6384609..9ebf68f 100644
@@ -6,6 +6,16 @@
 
 #include <cnxk_ethdev.h>
 
+struct cn9k_eth_txq {
+	uint64_t cmd[8];
+	int64_t fc_cache_pkts;
+	uint64_t *fc_mem;
+	void *lmt_addr;
+	rte_iova_t io_addr;
+	uint16_t sqes_per_sqb_log2;
+	int16_t nb_sqb_bufs_adj;
+} __plt_cache_aligned;
+
 struct cn9k_eth_rxq {
 	uint64_t mbuf_initializer;
 	uint64_t data_off;
drivers/net/cnxk/cn9k_tx.h new file +13 -0
new file mode 100644
index 0000000..bb6379b
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+#ifndef __CN9K_TX_H__
+#define __CN9K_TX_H__
+
+#define NIX_TX_OFFLOAD_VLAN_QINQ_F    BIT(2)
+#define NIX_TX_OFFLOAD_TSO_F	      BIT(4)
+
+#define NIX_TX_NEED_EXT_HDR                                                    \
+	(NIX_TX_OFFLOAD_VLAN_QINQ_F | NIX_TX_OFFLOAD_TSO_F)
+
+#endif /* __CN9K_TX_H__ */
drivers/net/cnxk/cnxk_ethdev.c +98 -0

110 lines not on this page · raw message

drivers/net/cnxk/cnxk_ethdev.h +3 -0
index e938c64..90c8ff6 100644
@@ -182,6 +182,9 @@ int cnxk_nix_remove(struct rte_pci_device *pci_dev);
 int cnxk_nix_info_get(struct rte_eth_dev *eth_dev,
 		      struct rte_eth_dev_info *dev_info);
 int cnxk_nix_configure(struct rte_eth_dev *eth_dev);
+int cnxk_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
+			    uint16_t nb_desc, uint16_t fp_tx_q_sz,
+			    const struct rte_eth_txconf *tx_conf);
 int cnxk_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 			    uint16_t nb_desc, uint16_t fp_rx_q_sz,
 			    const struct rte_eth_rxconf *rx_conf,
Signature · 1 line
2.8.4
#75 lore raw

PATCH v2 17/62 net/cnxk: add packet type support

In reply to Nithin Dabilpuram

Add support for packet type lookup on Rx to translate HW specific types to RTE_PTYPE_* defines

---
 doc/guides/nics/cnxk.rst              |   1 +
 doc/guides/nics/features/cnxk.ini     |   1 +
 doc/guides/nics/features/cnxk_vec.ini |   1 +
 doc/guides/nics/features/cnxk_vf.ini  |   1 +
 drivers/net/cnxk/cn10k_ethdev.c       |  21 +++
 drivers/net/cnxk/cn10k_rx.h           |  11 ++
 drivers/net/cnxk/cn9k_ethdev.c        |  21 +++
 drivers/net/cnxk/cn9k_rx.h            |  12 ++
 drivers/net/cnxk/cnxk_ethdev.c        |   2 +
 drivers/net/cnxk/cnxk_ethdev.h        |  14 ++
 drivers/net/cnxk/cnxk_lookup.c        | 326 ++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/meson.build          |   3 +-
 12 files changed, 413 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/cnxk/cn10k_rx.h
 create mode 100644 drivers/net/cnxk/cn9k_rx.h
 create mode 100644 drivers/net/cnxk/cnxk_lookup.c
doc/guides/nics/cnxk.rst +1 -0
index a982450..4f1b58c 100644
@@ -16,6 +16,7 @@ Features
 
 Features of the CNXK Ethdev PMD are:
 
+- Packet type information
 - SR-IOV VF
 - Lock-free Tx queue
 - Multiple queues for TX and RX
doc/guides/nics/features/cnxk.ini +1 -0
index 462d7c4..503582c 100644
@@ -14,6 +14,7 @@ Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
 RSS hash             = Y
 Inner RSS            = Y
+Packet type parsing  = Y
 Linux                = Y
 ARMv8                = Y
 Usage doc            = Y
doc/guides/nics/features/cnxk_vec.ini +1 -0
index 09e0d3a..9ad225a 100644
@@ -14,6 +14,7 @@ Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
 RSS hash             = Y
 Inner RSS            = Y
+Packet type parsing  = Y
 Linux                = Y
 ARMv8                = Y
 Usage doc            = Y
doc/guides/nics/features/cnxk_vf.ini +1 -0
index 4a93a35..8c93ba7 100644
@@ -13,6 +13,7 @@ Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
 RSS hash             = Y
 Inner RSS            = Y
+Packet type parsing  = Y
 Linux                = Y
 ARMv8                = Y
 Usage doc            = Y
drivers/net/cnxk/cn10k_ethdev.c +21 -0
index 39b8254..56b92ae 100644
@@ -2,8 +2,25 @@
  * Copyright(C) 2021 Marvell.
  */
 #include "cn10k_ethdev.h"
+#include "cn10k_rx.h"
 #include "cn10k_tx.h"
 
+static int
+cn10k_nix_ptypes_set(struct rte_eth_dev *eth_dev, uint32_t ptype_mask)
+{
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+
+	if (ptype_mask) {
+		dev->rx_offload_flags |= NIX_RX_OFFLOAD_PTYPE_F;
+		dev->ptype_disable = 0;
+	} else {
+		dev->rx_offload_flags &= ~NIX_RX_OFFLOAD_PTYPE_F;
+		dev->ptype_disable = 1;
+	}
+
+	return 0;
+}
+
 static void
 nix_form_default_desc(struct cnxk_eth_dev *dev, struct cn10k_eth_txq *txq,
 		      uint16_t qid)
@@ -113,6 +130,9 @@ cn10k_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 	/* Data offset from data to start of mbuf is first_skip */
 	rxq->data_off = rq->first_skip;
 	rxq->mbuf_initializer = cnxk_nix_rxq_mbuf_setup(dev);
+
+	/* Lookup mem */
+	rxq->lookup_mem = cnxk_nix_fastpath_lookup_mem_get();
 	return 0;
 }
 
@@ -148,6 +168,7 @@ nix_eth_dev_ops_override(void)
 	cnxk_eth_dev_ops.dev_configure = cn10k_nix_configure;
 	cnxk_eth_dev_ops.tx_queue_setup = cn10k_nix_tx_queue_setup;
 	cnxk_eth_dev_ops.rx_queue_setup = cn10k_nix_rx_queue_setup;
+	cnxk_eth_dev_ops.dev_ptypes_set = cn10k_nix_ptypes_set;
 }
 
 static int
drivers/net/cnxk/cn10k_rx.h new file +11 -0
new file mode 100644
index 0000000..d3d1661
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+#ifndef __CN10K_RX_H__
+#define __CN10K_RX_H__
+
+#include <rte_ether.h>
+
+#define NIX_RX_OFFLOAD_PTYPE_F	     BIT(1)
+
+#endif /* __CN10K_RX_H__ */
drivers/net/cnxk/cn9k_ethdev.c +21 -0
index 72a880f..b1cbdc7 100644
@@ -2,8 +2,25 @@
  * Copyright(C) 2021 Marvell.
  */
 #include "cn9k_ethdev.h"
+#include "cn9k_rx.h"
 #include "cn9k_tx.h"
 
+static int
+cn9k_nix_ptypes_set(struct rte_eth_dev *eth_dev, uint32_t ptype_mask)
+{
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+
+	if (ptype_mask) {
+		dev->rx_offload_flags |= NIX_RX_OFFLOAD_PTYPE_F;
+		dev->ptype_disable = 0;
+	} else {
+		dev->rx_offload_flags &= ~NIX_RX_OFFLOAD_PTYPE_F;
+		dev->ptype_disable = 1;
+	}
+
+	return 0;
+}
+
 static void
 nix_form_default_desc(struct cnxk_eth_dev *dev, struct cn9k_eth_txq *txq,
 		      uint16_t qid)
@@ -111,6 +128,9 @@ cn9k_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 	/* Data offset from data to start of mbuf is first_skip */
 	rxq->data_off = rq->first_skip;
 	rxq->mbuf_initializer = cnxk_nix_rxq_mbuf_setup(dev);
+
+	/* Lookup mem */
+	rxq->lookup_mem = cnxk_nix_fastpath_lookup_mem_get();
 	return 0;
 }
 
@@ -157,6 +177,7 @@ nix_eth_dev_ops_override(void)
 	cnxk_eth_dev_ops.dev_configure = cn9k_nix_configure;
 	cnxk_eth_dev_ops.tx_queue_setup = cn9k_nix_tx_queue_setup;
 	cnxk_eth_dev_ops.rx_queue_setup = cn9k_nix_rx_queue_setup;
+	cnxk_eth_dev_ops.dev_ptypes_set = cn9k_nix_ptypes_set;
 }
 
 static int
drivers/net/cnxk/cn9k_rx.h new file +12 -0
new file mode 100644
index 0000000..95a1e69
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+
+#ifndef __CN9K_RX_H__
+#define __CN9K_RX_H__
+
+#include <rte_ether.h>
+
+#define NIX_RX_OFFLOAD_PTYPE_F	     BIT(1)
+
+#endif /* __CN9K_RX_H__ */
drivers/net/cnxk/cnxk_ethdev.c +2 -0
index 41a22b1..a0a601f 100644
@@ -843,6 +843,7 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
 	.link_update = cnxk_nix_link_update,
 	.tx_queue_release = cnxk_nix_tx_queue_release,
 	.rx_queue_release = cnxk_nix_rx_queue_release,
+	.dev_supported_ptypes_get = cnxk_nix_supported_ptypes_get,
 };
 
 static int
@@ -883,6 +884,7 @@ cnxk_eth_dev_init(struct rte_eth_dev *eth_dev)
 
 	dev->eth_dev = eth_dev;
 	dev->configured = 0;
+	dev->ptype_disable = 0;
 
 	/* For vfs, returned max_entries will be 0. but to keep default mac
 	 * address, one entry must be allocated. so setting up to 1.
drivers/net/cnxk/cnxk_ethdev.h +14 -0
index 90c8ff6..6b7261c 100644
@@ -91,6 +91,15 @@
 #define RSS_SCTP_INDEX 4
 #define RSS_DMAC_INDEX 5
 
+#define PTYPE_NON_TUNNEL_WIDTH	  16
+#define PTYPE_TUNNEL_WIDTH	  12
+#define PTYPE_NON_TUNNEL_ARRAY_SZ BIT(PTYPE_NON_TUNNEL_WIDTH)
+#define PTYPE_TUNNEL_ARRAY_SZ	  BIT(PTYPE_TUNNEL_WIDTH)
+#define PTYPE_ARRAY_SZ                                                         \
+	((PTYPE_NON_TUNNEL_ARRAY_SZ + PTYPE_TUNNEL_ARRAY_SZ) * sizeof(uint16_t))
+/* Fastpath lookup */
+#define CNXK_NIX_FASTPATH_LOOKUP_MEM "cnxk_nix_fastpath_lookup_mem"
+
 struct cnxk_eth_qconf {
 	union {
 		struct rte_eth_txconf tx;
@@ -119,6 +128,7 @@ struct cnxk_eth_dev {
 	uint8_t max_mac_entries;
 
 	uint16_t flags;
+	uint8_t ptype_disable;
 	bool scalar_ena;
 
 	/* Pointer back to rte */
@@ -201,6 +211,10 @@ void cnxk_eth_dev_link_status_cb(struct roc_nix *nix,
 				 struct roc_nix_link_info *link);
 int cnxk_nix_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete);
 
+/* Lookup configuration */
+const uint32_t *cnxk_nix_supported_ptypes_get(struct rte_eth_dev *eth_dev);
+void *cnxk_nix_fastpath_lookup_mem_get(void);
+
 /* Devargs */
 int cnxk_ethdev_parse_devargs(struct rte_devargs *devargs,
 			      struct cnxk_eth_dev *dev);
drivers/net/cnxk/cnxk_lookup.c new file +326 -0

326 lines not on this page · raw message

drivers/net/cnxk/meson.build +2 -1
index c0ec91a..b6b6989 100644
@@ -11,7 +11,8 @@ endif
 sources = files('cnxk_ethdev.c',
 		'cnxk_ethdev_ops.c',
 		'cnxk_ethdev_devargs.c',
-		'cnxk_link.c')
+		'cnxk_link.c',
+		'cnxk_lookup.c')
 
 # CN9K
 sources += files('cn9k_ethdev.c')
Signature · 1 line
2.8.4
#76 lore raw

PATCH v2 18/62 net/cnxk: add queue start and stop support

In reply to Nithin Dabilpuram

Add Rx/Tx queue start and stop callbacks for
CN9K and CN10K.

---
 doc/guides/nics/features/cnxk.ini     |  1 +
 doc/guides/nics/features/cnxk_vec.ini |  1 +
 doc/guides/nics/features/cnxk_vf.ini  |  1 +
 drivers/net/cnxk/cn10k_ethdev.c       | 16 ++++++
 drivers/net/cnxk/cn9k_ethdev.c        | 16 ++++++
 drivers/net/cnxk/cnxk_ethdev.c        | 92 +++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cnxk_ethdev.h        |  1 +
 7 files changed, 128 insertions(+)
doc/guides/nics/features/cnxk.ini +1 -0
index 503582c..712f8d5 100644
@@ -12,6 +12,7 @@ Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
+Queue start/stop     = Y
 RSS hash             = Y
 Inner RSS            = Y
 Packet type parsing  = Y
doc/guides/nics/features/cnxk_vec.ini +1 -0
index 9ad225a..82f2af0 100644
@@ -12,6 +12,7 @@ Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
+Queue start/stop     = Y
 RSS hash             = Y
 Inner RSS            = Y
 Packet type parsing  = Y
doc/guides/nics/features/cnxk_vf.ini +1 -0
index 8c93ba7..61fed11 100644
@@ -11,6 +11,7 @@ Link status          = Y
 Link status event    = Y
 Runtime Rx queue setup = Y
 Runtime Tx queue setup = Y
+Queue start/stop     = Y
 RSS hash             = Y
 Inner RSS            = Y
 Packet type parsing  = Y
drivers/net/cnxk/cn10k_ethdev.c +16 -0
index 56b92ae..9df30ae 100644
@@ -137,6 +137,21 @@ cn10k_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 }
 
 static int
+cn10k_nix_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t qidx)
+{
+	struct cn10k_eth_txq *txq = eth_dev->data->tx_queues[qidx];
+	int rc;
+
+	rc = cnxk_nix_tx_queue_stop(eth_dev, qidx);
+	if (rc)
+		return rc;
+
+	/* Clear fc cache pkts to trigger worker stop */
+	txq->fc_cache_pkts = 0;
+	return 0;
+}
+
+static int
 cn10k_nix_configure(struct rte_eth_dev *eth_dev)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
@@ -168,6 +183,7 @@ nix_eth_dev_ops_override(void)
 	cnxk_eth_dev_ops.dev_configure = cn10k_nix_configure;
 	cnxk_eth_dev_ops.tx_queue_setup = cn10k_nix_tx_queue_setup;
 	cnxk_eth_dev_ops.rx_queue_setup = cn10k_nix_rx_queue_setup;
+	cnxk_eth_dev_ops.tx_queue_stop = cn10k_nix_tx_queue_stop;
 	cnxk_eth_dev_ops.dev_ptypes_set = cn10k_nix_ptypes_set;
 }
 
drivers/net/cnxk/cn9k_ethdev.c +16 -0
index b1cbdc7..22f5527 100644
@@ -135,6 +135,21 @@ cn9k_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 }
 
 static int
+cn9k_nix_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t qidx)
+{
+	struct cn9k_eth_txq *txq = eth_dev->data->tx_queues[qidx];
+	int rc;
+
+	rc = cnxk_nix_tx_queue_stop(eth_dev, qidx);
+	if (rc)
+		return rc;
+
+	/* Clear fc cache pkts to trigger worker stop */
+	txq->fc_cache_pkts = 0;
+	return 0;
+}
+
+static int
 cn9k_nix_configure(struct rte_eth_dev *eth_dev)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
@@ -177,6 +192,7 @@ nix_eth_dev_ops_override(void)
 	cnxk_eth_dev_ops.dev_configure = cn9k_nix_configure;
 	cnxk_eth_dev_ops.tx_queue_setup = cn9k_nix_tx_queue_setup;
 	cnxk_eth_dev_ops.rx_queue_setup = cn9k_nix_rx_queue_setup;
+	cnxk_eth_dev_ops.tx_queue_stop = cn9k_nix_tx_queue_stop;
 	cnxk_eth_dev_ops.dev_ptypes_set = cn9k_nix_ptypes_set;
 }
 
drivers/net/cnxk/cnxk_ethdev.c +92 -0

104 lines not on this page · raw message

drivers/net/cnxk/cnxk_ethdev.h +1 -0
index 6b7261c..7e79a8d 100644
@@ -199,6 +199,7 @@ int cnxk_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 			    uint16_t nb_desc, uint16_t fp_rx_q_sz,
 			    const struct rte_eth_rxconf *rx_conf,
 			    struct rte_mempool *mp);
+int cnxk_nix_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t qid);
 
 uint64_t cnxk_nix_rxq_mbuf_setup(struct cnxk_eth_dev *dev);
 
Signature · 1 line
2.8.4
#77 lore raw

PATCH v2 19/62 net/cnxk: add Rx support for cn9k

In reply to Nithin Dabilpuram

From: Jerin Jacob <[email protected]>

Add Rx burst scalar version for CN9K.

---
 drivers/net/cnxk/cn9k_ethdev.h |   3 +
 drivers/net/cnxk/cn9k_rx.c     |  46 ++++++++
 drivers/net/cnxk/cn9k_rx.h     | 237 +++++++++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cnxk_ethdev.h |   3 +
 drivers/net/cnxk/meson.build   |   3 +-
 5 files changed, 291 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/cnxk/cn9k_rx.c
drivers/net/cnxk/cn9k_ethdev.h +3 -0
index 9ebf68f..84dcc2c 100644
@@ -30,4 +30,7 @@ struct cn9k_eth_rxq {
 	uint16_t rq;
 } __plt_cache_aligned;
 
+/* Rx and Tx routines */
+void cn9k_eth_set_rx_function(struct rte_eth_dev *eth_dev);
+
 #endif /* __CN9K_ETHDEV_H__ */
drivers/net/cnxk/cn9k_rx.c new file +46 -0

46 lines not on this page · raw message

drivers/net/cnxk/cn9k_rx.h +237 -0

243 lines not on this page · raw message

drivers/net/cnxk/cnxk_ethdev.h +3 -0
index 7e79a8d..58c6710 100644
@@ -91,6 +91,9 @@
 #define RSS_SCTP_INDEX 4
 #define RSS_DMAC_INDEX 5
 
+/* Default mark value used when none is provided. */
+#define CNXK_FLOW_ACTION_FLAG_DEFAULT 0xffff
+
 #define PTYPE_NON_TUNNEL_WIDTH	  16
 #define PTYPE_TUNNEL_WIDTH	  12
 #define PTYPE_NON_TUNNEL_ARRAY_SZ BIT(PTYPE_NON_TUNNEL_WIDTH)
drivers/net/cnxk/meson.build +2 -1
index b6b6989..c2bfd94 100644
@@ -15,7 +15,8 @@ sources = files('cnxk_ethdev.c',
 		'cnxk_lookup.c')
 
 # CN9K
-sources += files('cn9k_ethdev.c')
+sources += files('cn9k_ethdev.c',
+		 'cn9k_rx.c')
 # CN10K
 sources += files('cn10k_ethdev.c')
 
Signature · 1 line
2.8.4
#78 lore raw

PATCH v2 20/62 net/cnxk: add Rx multi-segmented version for cn9k

In reply to Nithin Dabilpuram

Add Rx burst multi-segmented version for CN9K.

---
 drivers/net/cnxk/cn9k_rx.c      | 17 ++++++++++++
 drivers/net/cnxk/cn9k_rx.h      | 60 ++++++++++++++++++++++++++++++++++++++---
 drivers/net/cnxk/cn9k_rx_mseg.c | 17 ++++++++++++
 drivers/net/cnxk/cnxk_ethdev.h  |  3 +++
 drivers/net/cnxk/meson.build    |  3 ++-
 5 files changed, 96 insertions(+), 4 deletions(-)
 create mode 100644 drivers/net/cnxk/cn9k_rx_mseg.c
drivers/net/cnxk/cn9k_rx.c +17 -0
index a4297f9..87a62c9 100644
@@ -32,6 +32,8 @@ pick_rx_func(struct rte_eth_dev *eth_dev,
 void
 cn9k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
 {
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+
 	const eth_rx_burst_t nix_eth_rx_burst[2][2][2][2] = {
 #define R(name, f3, f2, f1, f0, flags)					\
 	[f3][f2][f1][f0] = cn9k_nix_recv_pkts_##name,
@@ -40,7 +42,22 @@ cn9k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
 #undef R
 	};
 
+	const eth_rx_burst_t nix_eth_rx_burst_mseg[2][2][2][2] = {
+#define R(name, f3, f2, f1, f0, flags)					\
+	[f3][f2][f1][f0] = cn9k_nix_recv_pkts_mseg_##name,
+
+		NIX_RX_FASTPATH_MODES
+#undef R
+	};
+
 	pick_rx_func(eth_dev, nix_eth_rx_burst);
 
+	if (dev->rx_offloads & DEV_RX_OFFLOAD_SCATTER)
+		pick_rx_func(eth_dev, nix_eth_rx_burst_mseg);
+
+	/* Copy multi seg version with no offload for tear down sequence */
+	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
+		dev->rx_pkt_burst_no_offload =
+			nix_eth_rx_burst_mseg[0][0][0][0];
 	rte_mb();
 }
drivers/net/cnxk/cn9k_rx.h +57 -3

79 lines not on this page · raw message

drivers/net/cnxk/cn9k_rx_mseg.c new file +17 -0
new file mode 100644
index 0000000..6ad8c1d
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+
+#include "cn9k_ethdev.h"
+#include "cn9k_rx.h"
+
+#define R(name, f3, f2, f1, f0, flags)                                         \
+	uint16_t __rte_noinline __rte_hot cn9k_nix_recv_pkts_mseg_##name(      \
+		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
+	{                                                                      \
+		return cn9k_nix_recv_pkts(rx_queue, rx_pkts, pkts,             \
+					  (flags) | NIX_RX_MULTI_SEG_F);       \
+	}
+
+NIX_RX_FASTPATH_MODES
+#undef R
drivers/net/cnxk/cnxk_ethdev.h +3 -0
index 58c6710..a94f5eb 100644
@@ -163,6 +163,9 @@ struct cnxk_eth_dev {
 	struct cnxk_eth_qconf *tx_qconf;
 	struct cnxk_eth_qconf *rx_qconf;
 
+	/* Rx burst for cleanup(Only Primary) */
+	eth_rx_burst_t rx_pkt_burst_no_offload;
+
 	/* Default mac address */
 	uint8_t mac_addr[RTE_ETHER_ADDR_LEN];
 };
drivers/net/cnxk/meson.build +2 -1
index c2bfd94..9737234 100644
@@ -16,7 +16,8 @@ sources = files('cnxk_ethdev.c',
 
 # CN9K
 sources += files('cn9k_ethdev.c',
-		 'cn9k_rx.c')
+		 'cn9k_rx.c',
+		 'cn9k_rx_mseg.c')
 # CN10K
 sources += files('cn10k_ethdev.c')
 
Signature · 1 line
2.8.4
#79 lore raw

PATCH v2 21/62 net/cnxk: add Rx vector version for cn9k

In reply to Nithin Dabilpuram

From: Jerin Jacob <[email protected]>

Add Rx burst vector version for CN9K.

---
 drivers/net/cnxk/cn9k_rx.c     |  13 ++-
 drivers/net/cnxk/cn9k_rx.h     | 221 +++++++++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cn9k_rx_vec.c |  17 ++++
 drivers/net/cnxk/meson.build   |   3 +-
 4 files changed, 252 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/cnxk/cn9k_rx_vec.c
drivers/net/cnxk/cn9k_rx.c +12 -1
index 87a62c9..01eb21f 100644
@@ -50,7 +50,18 @@ cn9k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
 #undef R
 	};
 
-	pick_rx_func(eth_dev, nix_eth_rx_burst);
+	const eth_rx_burst_t nix_eth_rx_vec_burst[2][2][2][2] = {
+#define R(name, f3, f2, f1, f0, flags)					\
+	[f3][f2][f1][f0] = cn9k_nix_recv_pkts_vec_##name,
+
+		NIX_RX_FASTPATH_MODES
+#undef R
+	};
+
+	if (dev->scalar_ena)
+		pick_rx_func(eth_dev, nix_eth_rx_burst);
+	else
+		pick_rx_func(eth_dev, nix_eth_rx_vec_burst);
 
 	if (dev->rx_offloads & DEV_RX_OFFLOAD_SCATTER)
 		pick_rx_func(eth_dev, nix_eth_rx_burst_mseg);
drivers/net/cnxk/cn9k_rx.h +221 -0

239 lines not on this page · raw message

drivers/net/cnxk/cn9k_rx_vec.c new file +17 -0
new file mode 100644
index 0000000..997177f
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+
+#include "cn9k_ethdev.h"
+#include "cn9k_rx.h"
+
+#define R(name, f3, f2, f1, f0, flags)                                         \
+	uint16_t __rte_noinline __rte_hot cn9k_nix_recv_pkts_vec_##name(       \
+		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
+	{                                                                      \
+		return cn9k_nix_recv_pkts_vector(rx_queue, rx_pkts, pkts,      \
+						 (flags));                     \
+	}
+
+NIX_RX_FASTPATH_MODES
+#undef R
drivers/net/cnxk/meson.build +2 -1
index 9737234..c02d9bd 100644
@@ -17,7 +17,8 @@ sources = files('cnxk_ethdev.c',
 # CN9K
 sources += files('cn9k_ethdev.c',
 		 'cn9k_rx.c',
-		 'cn9k_rx_mseg.c')
+		 'cn9k_rx_mseg.c',
+		 'cn9k_rx_vec.c')
 # CN10K
 sources += files('cn10k_ethdev.c')
 
Signature · 1 line
2.8.4
#80 lore raw

PATCH v2 22/62 net/cnxk: add Tx support for cn9k

In reply to Nithin Dabilpuram

From: Jerin Jacob <[email protected]>

Add Tx burst scalar version for CN9K.

---
 drivers/net/cnxk/cn9k_ethdev.h |   1 +
 drivers/net/cnxk/cn9k_tx.c     |  53 ++++++
 drivers/net/cnxk/cn9k_tx.h     | 414 +++++++++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cnxk_ethdev.h |  71 +++++++
 drivers/net/cnxk/meson.build   |   3 +-
 5 files changed, 541 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/cnxk/cn9k_tx.c
drivers/net/cnxk/cn9k_ethdev.h +1 -0
index 84dcc2c..cd0938f 100644
@@ -32,5 +32,6 @@ struct cn9k_eth_rxq {
 
 /* Rx and Tx routines */
 void cn9k_eth_set_rx_function(struct rte_eth_dev *eth_dev);
+void cn9k_eth_set_tx_function(struct rte_eth_dev *eth_dev);
 
 #endif /* __CN9K_ETHDEV_H__ */
drivers/net/cnxk/cn9k_tx.c new file +53 -0

53 lines not on this page · raw message

drivers/net/cnxk/cn9k_tx.h +414 -0

424 lines not on this page · raw message

drivers/net/cnxk/cnxk_ethdev.h +71 -0

81 lines not on this page · raw message

drivers/net/cnxk/meson.build +2 -1
index c02d9bd..2c1ce72 100644
@@ -18,7 +18,8 @@ sources = files('cnxk_ethdev.c',
 sources += files('cn9k_ethdev.c',
 		 'cn9k_rx.c',
 		 'cn9k_rx_mseg.c',
-		 'cn9k_rx_vec.c')
+		 'cn9k_rx_vec.c',
+		 'cn9k_tx.c')
 # CN10K
 sources += files('cn10k_ethdev.c')
 
Signature · 1 line
2.8.4
#81 lore raw

PATCH v2 23/62 net/cnxk: add Tx multi-segment version for cn9k

In reply to Nithin Dabilpuram

Add Tx burst multi-segment version for CN9K.

---
 drivers/net/cnxk/cn9k_tx.c      |  14 ++++
 drivers/net/cnxk/cn9k_tx.h      | 147 ++++++++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cn9k_tx_mseg.c |  25 +++++++
 drivers/net/cnxk/cnxk_ethdev.h  |   4 ++
 drivers/net/cnxk/meson.build    |   3 +-
 5 files changed, 192 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/cnxk/cn9k_tx_mseg.c
drivers/net/cnxk/cn9k_tx.c +14 -0
index a0b022a..8f1d5f5 100644
@@ -21,6 +21,7 @@
 NIX_TX_FASTPATH_MODES
 #undef T
 
+
 static inline void
 pick_tx_func(struct rte_eth_dev *eth_dev,
 	     const eth_tx_burst_t tx_burst[2][2][2][2][2])
@@ -39,6 +40,8 @@ pick_tx_func(struct rte_eth_dev *eth_dev,
 void
 cn9k_eth_set_tx_function(struct rte_eth_dev *eth_dev)
 {
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+
 	const eth_tx_burst_t nix_eth_tx_burst[2][2][2][2][2] = {
 #define T(name, f4, f3, f2, f1, f0, sz, flags)				       \
 	[f4][f3][f2][f1][f0] = cn9k_nix_xmit_pkts_##name,
@@ -47,7 +50,18 @@ cn9k_eth_set_tx_function(struct rte_eth_dev *eth_dev)
 #undef T
 	};
 
+	const eth_tx_burst_t nix_eth_tx_burst_mseg[2][2][2][2][2] = {
+#define T(name, f4, f3, f2, f1, f0, sz, flags)				       \
+	[f4][f3][f2][f1][f0] = cn9k_nix_xmit_pkts_mseg_##name,
+
+		NIX_TX_FASTPATH_MODES
+#undef T
+	};
+
 	pick_tx_func(eth_dev, nix_eth_tx_burst);
 
+	if (dev->tx_offloads & DEV_TX_OFFLOAD_MULTI_SEGS)
+		pick_tx_func(eth_dev, nix_eth_tx_burst_mseg);
+
 	rte_mb();
 }
drivers/net/cnxk/cn9k_tx.h +147 -0

165 lines not on this page · raw message

drivers/net/cnxk/cn9k_tx_mseg.c new file +25 -0
new file mode 100644
index 0000000..65c5f36
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+
+#include "cn9k_ethdev.h"
+#include "cn9k_tx.h"
+
+#define T(name, f4, f3, f2, f1, f0, sz, flags)				       \
+	uint16_t __rte_noinline __rte_hot				       \
+		cn9k_nix_xmit_pkts_mseg_##name(void *tx_queue,                 \
+					       struct rte_mbuf **tx_pkts,      \
+					       uint16_t pkts)                  \
+	{                                                                      \
+		uint64_t cmd[(sz) + CNXK_NIX_TX_MSEG_SG_DWORDS - 2];           \
+									       \
+		/* For TSO inner checksum is a must */                         \
+		if (((flags) & NIX_TX_OFFLOAD_TSO_F) &&			       \
+		    !((flags) & NIX_TX_OFFLOAD_L3_L4_CSUM_F))		       \
+			return 0;                                              \
+		return cn9k_nix_xmit_pkts_mseg(tx_queue, tx_pkts, pkts, cmd,   \
+					       (flags) | NIX_TX_MULTI_SEG_F);  \
+	}
+
+NIX_TX_FASTPATH_MODES
+#undef T
drivers/net/cnxk/cnxk_ethdev.h +4 -0
index 8facafc..2f31cba 100644
@@ -46,6 +46,10 @@
 #define CNXK_NIX_TX_NB_SEG_MAX 9
 #endif
 
+#define CNXK_NIX_TX_MSEG_SG_DWORDS                                             \
+	((RTE_ALIGN_MUL_CEIL(CNXK_NIX_TX_NB_SEG_MAX, 3) / 3) +                 \
+	 CNXK_NIX_TX_NB_SEG_MAX)
+
 #define CNXK_NIX_RSS_L3_L4_SRC_DST                                             \
 	(ETH_RSS_L3_SRC_ONLY | ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_SRC_ONLY |     \
 	 ETH_RSS_L4_DST_ONLY)
drivers/net/cnxk/meson.build +2 -1
index 2c1ce72..c727a09 100644
@@ -19,7 +19,8 @@ sources += files('cn9k_ethdev.c',
 		 'cn9k_rx.c',
 		 'cn9k_rx_mseg.c',
 		 'cn9k_rx_vec.c',
-		 'cn9k_tx.c')
+		 'cn9k_tx.c',
+		 'cn9k_tx_mseg.c')
 # CN10K
 sources += files('cn10k_ethdev.c')
 
Signature · 1 line
2.8.4
#82 lore raw

PATCH v2 24/62 net/cnxk: add Tx vector version for cn9k

In reply to Nithin Dabilpuram

Add Tx burst vector version for CN9K.

---
 drivers/net/cnxk/cn9k_tx.c     |  16 +-
 drivers/net/cnxk/cn9k_tx.h     | 920 +++++++++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cn9k_tx_vec.c |  25 ++
 drivers/net/cnxk/meson.build   |   3 +-
 4 files changed, 961 insertions(+), 3 deletions(-)
 create mode 100644 drivers/net/cnxk/cn9k_tx_vec.c
drivers/net/cnxk/cn9k_tx.c +14 -2
index 8f1d5f5..2ff9720 100644
@@ -21,7 +21,6 @@
 NIX_TX_FASTPATH_MODES
 #undef T
 
-
 static inline void
 pick_tx_func(struct rte_eth_dev *eth_dev,
 	     const eth_tx_burst_t tx_burst[2][2][2][2][2])
@@ -58,7 +57,20 @@ cn9k_eth_set_tx_function(struct rte_eth_dev *eth_dev)
 #undef T
 	};
 
-	pick_tx_func(eth_dev, nix_eth_tx_burst);
+	const eth_tx_burst_t nix_eth_tx_vec_burst[2][2][2][2][2] = {
+#define T(name, f4, f3, f2, f1, f0, sz, flags)				       \
+	[f4][f3][f2][f1][f0] = cn9k_nix_xmit_pkts_vec_##name,
+
+		NIX_TX_FASTPATH_MODES
+#undef T
+	};
+
+	if (dev->scalar_ena ||
+	    (dev->tx_offload_flags &
+	     (NIX_TX_OFFLOAD_VLAN_QINQ_F | NIX_TX_OFFLOAD_TSO_F)))
+		pick_tx_func(eth_dev, nix_eth_tx_burst);
+	else
+		pick_tx_func(eth_dev, nix_eth_tx_vec_burst);
 
 	if (dev->tx_offloads & DEV_TX_OFFLOAD_MULTI_SEGS)
 		pick_tx_func(eth_dev, nix_eth_tx_burst_mseg);
drivers/net/cnxk/cn9k_tx.h +920 -0

938 lines not on this page · raw message

drivers/net/cnxk/cn9k_tx_vec.c new file +25 -0
new file mode 100644
index 0000000..21ffc2c
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+
+#include "cn9k_ethdev.h"
+#include "cn9k_tx.h"
+
+#define T(name, f4, f3, f2, f1, f0, sz, flags)				       \
+	uint16_t __rte_noinline __rte_hot				       \
+		cn9k_nix_xmit_pkts_vec_##name(void *tx_queue,                  \
+					      struct rte_mbuf **tx_pkts,       \
+					      uint16_t pkts)                   \
+	{                                                                      \
+		uint64_t cmd[sz];                                              \
+									       \
+		/* VLAN, TSTMP, TSO is not supported by vec */                 \
+		if ((flags) & NIX_TX_OFFLOAD_VLAN_QINQ_F ||		       \
+		    (flags) & NIX_TX_OFFLOAD_TSO_F)			       \
+			return 0;                                              \
+		return cn9k_nix_xmit_pkts_vector(tx_queue, tx_pkts, pkts, cmd, \
+						 (flags));		       \
+	}
+
+NIX_TX_FASTPATH_MODES
+#undef T
drivers/net/cnxk/meson.build +2 -1
index c727a09..ce771d1 100644
@@ -20,7 +20,8 @@ sources += files('cn9k_ethdev.c',
 		 'cn9k_rx_mseg.c',
 		 'cn9k_rx_vec.c',
 		 'cn9k_tx.c',
-		 'cn9k_tx_mseg.c')
+		 'cn9k_tx_mseg.c',
+		 'cn9k_tx_vec.c')
 # CN10K
 sources += files('cn10k_ethdev.c')
 
Signature · 1 line
2.8.4
#83 lore raw

PATCH v2 25/62 net/cnxk: add Rx support for cn10k

In reply to Nithin Dabilpuram

From: Jerin Jacob <[email protected]>

Add Rx burst support for CN10K SoC.

---
 drivers/net/cnxk/cn10k_ethdev.h |   3 +
 drivers/net/cnxk/cn10k_rx.c     |  45 ++++++++
 drivers/net/cnxk/cn10k_rx.h     | 236 ++++++++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/meson.build    |   3 +-
 4 files changed, 286 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/cnxk/cn10k_rx.c
drivers/net/cnxk/cn10k_ethdev.h +3 -0
index 2157b16..e4332d3 100644
@@ -32,4 +32,7 @@ struct cn10k_eth_rxq {
 	uint16_t rq;
 } __plt_cache_aligned;
 
+/* Rx and Tx routines */
+void cn10k_eth_set_rx_function(struct rte_eth_dev *eth_dev);
+
 #endif /* __CN10K_ETHDEV_H__ */
drivers/net/cnxk/cn10k_rx.c new file +45 -0

45 lines not on this page · raw message

drivers/net/cnxk/cn10k_rx.h +236 -0

242 lines not on this page · raw message

drivers/net/cnxk/meson.build +2 -1
index ce771d1..48ead8c 100644
@@ -23,7 +23,8 @@ sources += files('cn9k_ethdev.c',
 		 'cn9k_tx_mseg.c',
 		 'cn9k_tx_vec.c')
 # CN10K
-sources += files('cn10k_ethdev.c')
+sources += files('cn10k_ethdev.c',
+		 'cn10k_rx.c')
 
 deps += ['bus_pci', 'cryptodev', 'eventdev', 'security']
 deps += ['common_cnxk', 'mempool_cnxk']
Signature · 1 line
2.8.4
#84 lore raw

PATCH v2 26/62 net/cnxk: add Rx multi-segment version for cn10k

In reply to Nithin Dabilpuram

Add Rx burst multi-segment version for CN10K.

---
 doc/guides/nics/cnxk.rst              |  2 ++
 doc/guides/nics/features/cnxk.ini     |  2 ++
 doc/guides/nics/features/cnxk_vec.ini |  1 +
 doc/guides/nics/features/cnxk_vf.ini  |  2 ++
 drivers/net/cnxk/cn10k_rx.c           | 20 +++++++++++-
 drivers/net/cnxk/cn10k_rx.h           | 57 +++++++++++++++++++++++++++++++++--
 drivers/net/cnxk/cn10k_rx_mseg.c      | 17 +++++++++++
 drivers/net/cnxk/meson.build          |  3 +-
 8 files changed, 100 insertions(+), 4 deletions(-)
 create mode 100644 drivers/net/cnxk/cn10k_rx_mseg.c
doc/guides/nics/cnxk.rst +2 -0
index 4f1b58c..789ec29 100644
@@ -17,11 +17,13 @@ Features
 Features of the CNXK Ethdev PMD are:
 
 - Packet type information
+- Jumbo frames
 - SR-IOV VF
 - Lock-free Tx queue
 - Multiple queues for TX and RX
 - Receiver Side Scaling (RSS)
 - Link state information
+- Scatter-Gather IO support
 
 Prerequisites
 -------------
doc/guides/nics/features/cnxk.ini +2 -0
index 712f8d5..23564b7 100644
@@ -15,6 +15,8 @@ Runtime Tx queue setup = Y
 Queue start/stop     = Y
 RSS hash             = Y
 Inner RSS            = Y
+Jumbo frame          = Y
+Scattered Rx         = Y
 Packet type parsing  = Y
 Linux                = Y
 ARMv8                = Y
doc/guides/nics/features/cnxk_vec.ini +1 -0
index 82f2af0..421048d 100644
@@ -15,6 +15,7 @@ Runtime Tx queue setup = Y
 Queue start/stop     = Y
 RSS hash             = Y
 Inner RSS            = Y
+Jumbo frame          = Y
 Packet type parsing  = Y
 Linux                = Y
 ARMv8                = Y
doc/guides/nics/features/cnxk_vf.ini +2 -0
index 61fed11..e901fa2 100644
@@ -14,6 +14,8 @@ Runtime Tx queue setup = Y
 Queue start/stop     = Y
 RSS hash             = Y
 Inner RSS            = Y
+Jumbo frame          = Y
+Scattered Rx         = Y
 Packet type parsing  = Y
 Linux                = Y
 ARMv8                = Y
drivers/net/cnxk/cn10k_rx.c +19 -1
index 8b422d0..ce2cfee 100644
@@ -10,7 +10,7 @@
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
 		return cn10k_nix_recv_pkts(rx_queue, rx_pkts, pkts, (flags));  \
-	}
+	}                                                                      \
 
 NIX_RX_FASTPATH_MODES
 #undef R
@@ -32,6 +32,8 @@ pick_rx_func(struct rte_eth_dev *eth_dev,
 void
 cn10k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
 {
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+
 	const eth_rx_burst_t nix_eth_rx_burst[2][2][2][2] = {
 #define R(name, f3, f2, f1, f0, flags)					      \
 	[f3][f2][f1][f0] = cn10k_nix_recv_pkts_##name,
@@ -40,6 +42,22 @@ cn10k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
 #undef R
 	};
 
+	const eth_rx_burst_t nix_eth_rx_burst_mseg[2][2][2][2] = {
+#define R(name, f3, f2, f1, f0, flags)					      \
+	[f3][f2][f1][f0] = cn10k_nix_recv_pkts_mseg_##name,
+
+		NIX_RX_FASTPATH_MODES
+#undef R
+	};
+
 	pick_rx_func(eth_dev, nix_eth_rx_burst);
+
+	if (dev->rx_offloads & DEV_RX_OFFLOAD_SCATTER)
+		pick_rx_func(eth_dev, nix_eth_rx_burst_mseg);
+
+	/* Copy multi seg version with no offload for tear down sequence */
+	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
+		dev->rx_pkt_burst_no_offload =
+			nix_eth_rx_burst_mseg[0][0][0][0];
 	rte_mb();
 }
drivers/net/cnxk/cn10k_rx.h +55 -2

75 lines not on this page · raw message

drivers/net/cnxk/cn10k_rx_mseg.c new file +17 -0
new file mode 100644
index 0000000..9d283f7
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+
+#include "cn10k_ethdev.h"
+#include "cn10k_rx.h"
+
+#define R(name, f3, f2, f1, f0, flags)                                         \
+	uint16_t __rte_noinline __rte_hot cn10k_nix_recv_pkts_mseg_##name(     \
+		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
+	{                                                                      \
+		return cn10k_nix_recv_pkts(rx_queue, rx_pkts, pkts,            \
+					   (flags) | NIX_RX_MULTI_SEG_F);      \
+	}
+
+NIX_RX_FASTPATH_MODES
+#undef R
drivers/net/cnxk/meson.build +2 -1
index 48ead8c..b1e9245 100644
@@ -24,7 +24,8 @@ sources += files('cn9k_ethdev.c',
 		 'cn9k_tx_vec.c')
 # CN10K
 sources += files('cn10k_ethdev.c',
-		 'cn10k_rx.c')
+		 'cn10k_rx.c',
+		 'cn10k_rx_mseg.c')
 
 deps += ['bus_pci', 'cryptodev', 'eventdev', 'security']
 deps += ['common_cnxk', 'mempool_cnxk']
Signature · 1 line
2.8.4
#85 lore raw

PATCH v2 27/62 net/cnxk: add Rx vector version for cn10k

In reply to Nithin Dabilpuram

From: Jerin Jacob <[email protected]>

Add Rx burst vector version for CN10K.

---
 doc/guides/nics/cnxk.rst        |   1 +
 drivers/net/cnxk/cn10k_rx.c     |  13 ++-
 drivers/net/cnxk/cn10k_rx.h     | 222 ++++++++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cn10k_rx_vec.c |  19 ++++
 drivers/net/cnxk/meson.build    |   3 +-
 5 files changed, 256 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/cnxk/cn10k_rx_vec.c
doc/guides/nics/cnxk.rst +1 -0
index 789ec29..4187e9d 100644
@@ -24,6 +24,7 @@ Features of the CNXK Ethdev PMD are:
 - Receiver Side Scaling (RSS)
 - Link state information
 - Scatter-Gather IO support
+- Vector Poll mode driver
 
 Prerequisites
 -------------
drivers/net/cnxk/cn10k_rx.c +12 -1
index ce2cfee..0598111 100644
@@ -50,7 +50,18 @@ cn10k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
 #undef R
 	};
 
-	pick_rx_func(eth_dev, nix_eth_rx_burst);
+	const eth_rx_burst_t nix_eth_rx_vec_burst[2][2][2][2] = {
+#define R(name, f3, f2, f1, f0, flags)					      \
+	[f3][f2][f1][f0] = cn10k_nix_recv_pkts_vec_##name,
+
+		NIX_RX_FASTPATH_MODES
+#undef R
+	};
+
+	if (dev->scalar_ena)
+		pick_rx_func(eth_dev, nix_eth_rx_burst);
+	else
+		pick_rx_func(eth_dev, nix_eth_rx_vec_burst);
 
 	if (dev->rx_offloads & DEV_RX_OFFLOAD_SCATTER)
 		pick_rx_func(eth_dev, nix_eth_rx_burst_mseg);
drivers/net/cnxk/cn10k_rx.h +222 -0

240 lines not on this page · raw message

drivers/net/cnxk/cn10k_rx_vec.c new file +19 -0
new file mode 100644
index 0000000..0fa079c
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+
+#include "cn10k_ethdev.h"
+#include "cn10k_rx.h"
+
+#define R(name, f3, f2, f1, f0, flags)					       \
+	uint16_t __rte_noinline __rte_hot				       \
+		cn10k_nix_recv_pkts_vec_##name(void *rx_queue,                 \
+					       struct rte_mbuf **rx_pkts,      \
+					       uint16_t pkts)                  \
+	{                                                                      \
+		return cn10k_nix_recv_pkts_vector(rx_queue, rx_pkts, pkts,     \
+						  (flags));		       \
+	}
+
+NIX_RX_FASTPATH_MODES
+#undef R
drivers/net/cnxk/meson.build +2 -1
index b1e9245..9386005 100644
@@ -25,7 +25,8 @@ sources += files('cn9k_ethdev.c',
 # CN10K
 sources += files('cn10k_ethdev.c',
 		 'cn10k_rx.c',
-		 'cn10k_rx_mseg.c')
+		 'cn10k_rx_mseg.c',
+		 'cn10k_rx_vec.c')
 
 deps += ['bus_pci', 'cryptodev', 'eventdev', 'security']
 deps += ['common_cnxk', 'mempool_cnxk']
Signature · 1 line
2.8.4