Skip to contentSkip to conversation

net/octeontx_ep: add build and doc infrastructure

PATCH Superseded Nalla Pradeep 4 participants 76 messages Jan 18, 2021 – Feb 11, 2021

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

PATCH v2 1/11 net/octeontx_ep: add build and doc infrastructure

Adding bare minimum PMD library and doc build infrastructure and claim the maintainership for octeontx end point PMD.

---
 MAINTAINERS                              |  9 +++++++
 doc/guides/nics/features/octeontx_ep.ini |  8 ++++++
 doc/guides/nics/index.rst                |  1 +
 doc/guides/nics/octeontx_ep.rst          | 32 ++++++++++++++++++++++++
 drivers/net/meson.build                  |  1 +
 drivers/net/octeontx_ep/meson.build      |  8 ++++++
 drivers/net/octeontx_ep/otx_ep_ethdev.c  |  3 +++
 drivers/net/octeontx_ep/version.map      |  4 +++
 8 files changed, 66 insertions(+)
 create mode 100644 doc/guides/nics/features/octeontx_ep.ini
 create mode 100644 doc/guides/nics/octeontx_ep.rst
 create mode 100644 drivers/net/octeontx_ep/meson.build
 create mode 100644 drivers/net/octeontx_ep/otx_ep_ethdev.c
 create mode 100644 drivers/net/octeontx_ep/version.map
MAINTAINERS +9 -0
index 76ed473e44..5a095df77d 100644
@@ -762,6 +762,15 @@ T: git://dpdk.org/next/dpdk-next-crypto
 F: drivers/common/octeontx2/otx2_sec*
 F: drivers/net/octeontx2/otx2_ethdev_sec*
 
+Marvell OCTEON TX EP - endpoint
+M: Nalla Pradeep <[email protected]>
+M: Radha Mohan Chintakuntla <[email protected]>
+M: Veerasenareddy Burru <[email protected]>
+T: git://dpdk.org/next/dpdk-next-net-mrvl
+F: drivers/net/octeontx_ep/
+F: doc/guides/nics/features/octeontx_ep.ini
+F: doc/guides/nics/octeontx_ep.rst
+
 Mellanox mlx4
 M: Matan Azrad <[email protected]>
 M: Shahaf Shuler <[email protected]>
doc/guides/nics/features/octeontx_ep.ini new file +8 -0
new file mode 100644
index 0000000000..95d6585222
@@ -0,0 +1,8 @@
+;
+; Supported features of the 'octeontx_ep' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Linux VFIO           = Y
+Usage doc            = Y
doc/guides/nics/index.rst +1 -0
index 3443617755..799697caf0 100644
@@ -50,6 +50,7 @@ Network Interface Controller Drivers
     null
     octeontx
     octeontx2
+    octeontx_ep
     pfe
     qede
     sfc_efx
doc/guides/nics/octeontx_ep.rst new file +32 -0
new file mode 100644
index 0000000000..d194896093
@@ -0,0 +1,32 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(C) 2020 Marvell.
+
+OCTEON TX EP Poll Mode driver
+===========================
+
+The OCTEON TX EP ETHDEV PMD (**librte_pmd_octeontx_ep**) provides poll mode
+ethdev driver support for the virtual functions (VF) of **Marvell OCTEON TX2**
+and **Cavium OCTEON TX** families of adapters 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 OCTEON TX EP Ethdev PMD are:
+
+
+Prerequisites
+-------------
+
+See :doc:`../platform/octeontx2` and `../platform/octeontx` for setup information.
+
+Compile time Config Options
+---------------------------
+
+The following options may be modified in the ``config`` file.
+
+- ``CONFIG_RTE_LIBRTE_OCTEONTX_EP_PMD`` (default ``y``)
+
+  Toggle compilation of the ``librte_pmd_octeontx_ep`` driver.
drivers/net/meson.build +1 -0
index 4948500aef..007f6d889b 100644
@@ -39,6 +39,7 @@ drivers = ['af_packet',
 	'null',
 	'octeontx',
 	'octeontx2',
+	'octeontx_ep',
 	'pcap',
 	'pfe',
 	'qede',
drivers/net/octeontx_ep/meson.build new file +8 -0
new file mode 100644
index 0000000000..83ffbad7b6
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(C) 2020 Marvell.
+#
+
+sources = files(
+               'otx_ep_ethdev.c',
+               )
+
drivers/net/octeontx_ep/otx_ep_ethdev.c new file +3 -0
new file mode 100644
index 0000000000..2b2d684a0b
@@ -0,0 +1,3 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2020 Marvell.
+ */
drivers/net/octeontx_ep/version.map new file +4 -0
new file mode 100644
index 0000000000..f4db678dd5
@@ -0,0 +1,4 @@
+DPDK_20.0 {
+
+        local: *;
+};
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 2/11 net/octeontx_ep: add ethdev probe and remove

add basic PCIe ethdev probe and remove.

---
 drivers/common/octeontx2/otx2_common.h    |  5 +-
 drivers/net/octeontx_ep/meson.build       | 13 +++++
 drivers/net/octeontx_ep/otx_ep_common.h   | 14 +++++
 drivers/net/octeontx_ep/otx_ep_ethdev.c   | 62 +++++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_vf.h       |  9 ++++
 drivers/raw/octeontx2_ep/otx2_ep_rawdev.c |  6 +--
 6 files changed, 105 insertions(+), 4 deletions(-)
 create mode 100644 drivers/net/octeontx_ep/otx_ep_common.h
 create mode 100644 drivers/net/octeontx_ep/otx_ep_vf.h
drivers/common/octeontx2/otx2_common.h +4 -1
index b6779f7104..cd52e098e6 100644
@@ -136,7 +136,10 @@ extern int otx2_logtype_ree;
 #define PCI_DEVID_OCTEONTX2_RVU_CPT_VF		0xA0FE
 #define PCI_DEVID_OCTEONTX2_RVU_AF_VF		0xA0f8
 #define PCI_DEVID_OCTEONTX2_DPI_VF		0xA081
-#define PCI_DEVID_OCTEONTX2_EP_VF		0xB203 /* OCTEON TX2 EP mode */
+#define PCI_DEVID_OCTEONTX2_EP_NET_VF		0xB203 /* OCTEON TX2 EP mode */
+/* OCTEON TX2 98xx EP mode */
+#define PCI_DEVID_CN98XX_EP_NET_VF		0xB103
+#define PCI_DEVID_OCTEONTX2_EP_RAW_VF		0xB204 /* OCTEON TX2 EP mode */
 #define PCI_DEVID_OCTEONTX2_RVU_SDP_PF		0xA0f6
 #define PCI_DEVID_OCTEONTX2_RVU_SDP_VF		0xA0f7
 #define PCI_DEVID_OCTEONTX2_RVU_REE_PF		0xA0f4
drivers/net/octeontx_ep/meson.build +13 -0
index 83ffbad7b6..06663de4e2 100644
@@ -6,3 +6,16 @@ sources = files(
                'otx_ep_ethdev.c',
                )
 
+extra_flags = []
+# This integrated controller runs only on a arm64 machine, remove 32bit warnings
+if not dpdk_conf.get('RTE_ARCH_64')
+        extra_flags += ['-Wno-int-to-pointer-cast', '-Wno-pointer-to-int-cast']
+endif
+
+foreach flag: extra_flags
+        if cc.has_argument(flag)
+                cflags += flag
+        endif
+endforeach
+
+includes += include_directories('../../common/octeontx2')
drivers/net/octeontx_ep/otx_ep_common.h new file +14 -0
new file mode 100644
index 0000000000..3fa2de9ab3
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2020 Marvell.
+ */
+#ifndef _OTX_EP_COMMON_H_
+#define _OTX_EP_COMMON_H_
+
+/* OTX_EP EP VF device data structure */
+struct otx_ep_device {
+	/* PCI device pointer */
+	struct rte_pci_device *pdev;
+
+	struct rte_eth_dev *eth_dev;
+};
+#endif  /* _OTX_EP_COMMON_H_ */
drivers/net/octeontx_ep/otx_ep_ethdev.c +62 -0

65 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_vf.h new file +9 -0
new file mode 100644
index 0000000000..0498dd0cf5
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2020 Marvell.
+ */
+#ifndef _OTX_EP_VF_H_
+#define _OTX_EP_VF_H_
+
+#define PCI_DEVID_OCTEONTX_EP_VF 0xa303
+
+#endif /*_OTX_EP_VF_H_ */
drivers/raw/octeontx2_ep/otx2_ep_rawdev.c +3 -3
index 2b78a7941d..b2ccdda83e 100644
@@ -22,7 +22,7 @@
 static const struct rte_pci_id pci_sdp_vf_map[] = {
 	{
 		RTE_PCI_DEVICE(PCI_VENDOR_ID_CAVIUM,
-			       PCI_DEVID_OCTEONTX2_EP_VF)
+			       PCI_DEVID_OCTEONTX2_EP_RAW_VF)
 	},
 	{
 		.vendor_id = 0,
@@ -109,8 +109,8 @@ sdp_chip_specific_setup(struct sdp_device *sdpvf)
 	int ret;
 
 	switch (dev_id) {
-	case PCI_DEVID_OCTEONTX2_EP_VF:
-		sdpvf->chip_id = PCI_DEVID_OCTEONTX2_EP_VF;
+	case PCI_DEVID_OCTEONTX2_EP_RAW_VF:
+		sdpvf->chip_id = PCI_DEVID_OCTEONTX2_EP_RAW_VF;
 		ret = sdp_vf_setup_device(sdpvf);
 
 		break;
Signature · 1 line
2.17.1
#2 lore raw

Re: [dpdk-dev] [PATCH v2 02/11] net/octeontx_ep: add ethdev probe and remove

Quoted 36 lines · Nalla Pradeep

add basic PCIe ethdev probe and remove.

---
 drivers/common/octeontx2/otx2_common.h    |  5 +-
 drivers/net/octeontx_ep/meson.build       | 13 +++++
 drivers/net/octeontx_ep/otx_ep_common.h   | 14 +++++
 drivers/net/octeontx_ep/otx_ep_ethdev.c   | 62 +++++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_vf.h       |  9 ++++
 drivers/raw/octeontx2_ep/otx2_ep_rawdev.c |  6 +--
 6 files changed, 105 insertions(+), 4 deletions(-)
 create mode 100644 drivers/net/octeontx_ep/otx_ep_common.h
 create mode 100644 drivers/net/octeontx_ep/otx_ep_vf.h
drivers/common/octeontx2/otx2_common.h +4 -1
index b6779f7104..cd52e098e6 100644
@@ -136,7 +136,10 @@ extern int otx2_logtype_ree;
 #define PCI_DEVID_OCTEONTX2_RVU_CPT_VF         0xA0FE
 #define PCI_DEVID_OCTEONTX2_RVU_AF_VF          0xA0f8
 #define PCI_DEVID_OCTEONTX2_DPI_VF             0xA081
-#define PCI_DEVID_OCTEONTX2_EP_VF              0xB203 /* OCTEON TX2 EP mode */
+#define PCI_DEVID_OCTEONTX2_EP_NET_VF          0xB203 /* OCTEON TX2 EP mode */
+/* OCTEON TX2 98xx EP mode */
+#define PCI_DEVID_CN98XX_EP_NET_VF             0xB103
+#define PCI_DEVID_OCTEONTX2_EP_RAW_VF          0xB204 /* OCTEON TX2 EP mode */
 #define PCI_DEVID_OCTEONTX2_RVU_SDP_PF         0xA0f6
 #define PCI_DEVID_OCTEONTX2_RVU_SDP_VF         0xA0f7
 #define PCI_DEVID_OCTEONTX2_RVU_REE_PF         0xA0f4
drivers/net/octeontx_ep/meson.build +0 -0
index 83ffbad7b6..06663de4e2 100644

drivers/net/octeontx_ep/meson.build sources = files( · line 13

Quoted 8 lines
drivers/net/octeontx_ep/meson.build +5 -0
@@ -6,3 +6,16 @@ sources = files(
                'otx_ep_ethdev.c',
                )
 
+extra_flags = []
+# This integrated controller runs only on a arm64 machine, remove 32bit warnings
+if not dpdk_conf.get('RTE_ARCH_64')
+        extra_flags += ['-Wno-int-to-pointer-cast', '-Wno-pointer-to-int-cast']
+endif

This was from net/octeontx2 driver due to NPA complication. Please check, Is this really required
as this driver can run in x86 32bit mode unlike net/octeontx2.

#3 lore raw

Re: [dpdk-dev] [PATCH v2 02/11] net/octeontx_ep: add ethdev probe and remove

In reply to Nalla Pradeep
Quoted 3 lines · Nalla Pradeep

add basic PCIe ethdev probe and remove.

<...>

drivers/common/octeontx2/otx2_common.h extern int otx2_logtype_ree; · line 139

Quoted 6 lines
drivers/common/octeontx2/otx2_common.h +1 -1
@@ -136,7 +136,10 @@ extern int otx2_logtype_ree;
  #define PCI_DEVID_OCTEONTX2_RVU_CPT_VF		0xA0FE
  #define PCI_DEVID_OCTEONTX2_RVU_AF_VF		0xA0f8
  #define PCI_DEVID_OCTEONTX2_DPI_VF		0xA081
-#define PCI_DEVID_OCTEONTX2_EP_VF		0xB203 /* OCTEON TX2 EP mode */
+#define PCI_DEVID_OCTEONTX2_EP_NET_VF		0xB203 /* OCTEON TX2 EP mode */

You can considering doing this rename on its own patch, to reduce the noise for the actual patch.

<...>

drivers/net/octeontx_ep/meson.build sources = files( · line 13

Quoted 10 lines
drivers/net/octeontx_ep/meson.build +6 -0
+++ b/drivers/net/octeontx_ep/meson.build
@@ -6,3 +6,16 @@ sources = files(
                 'otx_ep_ethdev.c',
                 )
 
+extra_flags = []
+# This integrated controller runs only on a arm64 machine, remove 32bit warnings
+if not dpdk_conf.get('RTE_ARCH_64')
+        extra_flags += ['-Wno-int-to-pointer-cast', '-Wno-pointer-to-int-cast']
+endif

There is almost any code at this stage, are above compiler flags really needed? Can you add then only when they are really needed?

<...>

drivers/net/octeontx_ep/otx_ep_ethdev.c line 8

Quoted 11 lines
drivers/net/octeontx_ep/otx_ep_ethdev.c +5 -0
@@ -1,3 +1,65 @@
  /* SPDX-License-Identifier: BSD-3-Clause
   * Copyright(C) 2020 Marvell.
   */
+
+#include <rte_ethdev_pci.h>
+#include <rte_malloc.h>
+#include <rte_io.h>
+

Are all these headers needed, no io or mem allocation yet, can you please add them as they are needed?

<...>

drivers/net/octeontx_ep/otx_ep_ethdev.c line 8

Quoted 10 lines
drivers/net/octeontx_ep/otx_ep_ethdev.c +9 -0
+++ b/drivers/net/octeontx_ep/otx_ep_vf.h
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2020 Marvell.
+ */
+#ifndef _OTX_EP_VF_H_
+#define _OTX_EP_VF_H_
+
+#define PCI_DEVID_OCTEONTX_EP_VF 0xa303
+

Why this PCI device id defined different place than all the others did, won't it be easier to keep them all in same place?

#4 lore raw

Re: [dpdk-dev] [EXT] Re: [PATCH v2 02/11] net/octeontx_ep: add ethdev probe and remove

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, January 26, 2021 8:57 PM
To: Pradeep Kumar Nalla <[email protected]>; Jerin Jacob Kollanukkaran <[email protected]>; Nithin Kumar Dabilpuram <[email protected]>; Radha Chintakuntla <[email protected]>; Veerasenareddy Burru <[email protected]>
Cc: [email protected]; Satananda Burla <[email protected]>
Subject: [EXT] Re: [dpdk-dev] [PATCH v2 02/11] net/octeontx_ep: add ethdev probe and remove

External Email

----------------------------------------------------------------------

Quoted 3 lines · Nalla Pradeep

add basic PCIe ethdev probe and remove.

<...>

drivers/common/octeontx2/otx2_common.h extern int otx2_logtype_ree; · line 139

Quoted 6 lines
drivers/common/octeontx2/otx2_common.h +1 -1
@@ -136,7 +136,10 @@ extern int otx2_logtype_ree;
  #define PCI_DEVID_OCTEONTX2_RVU_CPT_VF		0xA0FE
  #define PCI_DEVID_OCTEONTX2_RVU_AF_VF		0xA0f8
  #define PCI_DEVID_OCTEONTX2_DPI_VF		0xA081
-#define PCI_DEVID_OCTEONTX2_EP_VF		0xB203 /* OCTEON TX2 EP mode */
+#define PCI_DEVID_OCTEONTX2_EP_NET_VF		0xB203 /* OCTEON TX2 EP mode */

You can considering doing this rename on its own patch, to reduce the noise for the actual patch.

<...>

drivers/net/octeontx_ep/meson.build sources = files( · line 13

Quoted 10 lines
drivers/net/octeontx_ep/meson.build +6 -0
+++ b/drivers/net/octeontx_ep/meson.build
@@ -6,3 +6,16 @@ sources = files(
                 'otx_ep_ethdev.c',
                 )
 
+extra_flags = []
+# This integrated controller runs only on a arm64 machine, remove 
+32bit warnings if not dpdk_conf.get('RTE_ARCH_64')
+        extra_flags += ['-Wno-int-to-pointer-cast', 
+'-Wno-pointer-to-int-cast'] endif

There is almost any code at this stage, are above compiler flags really needed? Can you add then only when they are really needed?

<...>

drivers/net/octeontx_ep/otx_ep_ethdev.c line 8

Quoted 11 lines
drivers/net/octeontx_ep/otx_ep_ethdev.c +5 -0
@@ -1,3 +1,65 @@
  /* SPDX-License-Identifier: BSD-3-Clause
   * Copyright(C) 2020 Marvell.
   */
+
+#include <rte_ethdev_pci.h>
+#include <rte_malloc.h>
+#include <rte_io.h>
+

Are all these headers needed, no io or mem allocation yet, can you please add them as they are needed?

<...>

Quoted 11 lines
drivers/net/octeontx_ep/otx_ep_ethdev.c +9 -0
+++ b/drivers/net/octeontx_ep/otx_ep_vf.h
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2020 Marvell.
+ */
+#ifndef _OTX_EP_VF_H_
+#define _OTX_EP_VF_H_
+
+#define PCI_DEVID_OCTEONTX_EP_VF 0xa303
+
Quoted 1 line

Why this PCI device id defined different place than all the others did, won't it be easier to keep them all in same >place?

This device id is from octeontx family, whereas rest all are from octeontx2 family. All the device ids of octeontx2 family are maintained in drivers/common/octeontx2/otx2_common.h and this particular octeon tx device will be in drivers/net/octeontx_ep/otx_ep_vf.h

#5 lore raw

PATCH v2 3/11 net/octeontx_ep: add device init and uninit

In reply to Nalla Pradeep

Add basic init and uninit function which includes
initializing fields of ethdev private structure.

---
 drivers/net/octeontx_ep/otx_ep_common.h | 19 +++++-
 drivers/net/octeontx_ep/otx_ep_ethdev.c | 88 +++++++++++++++++++++++--
 2 files changed, 101 insertions(+), 6 deletions(-)
drivers/net/octeontx_ep/otx_ep_common.h +18 -1
index 3fa2de9ab3..1c31ea8de2 100644
@@ -4,11 +4,28 @@
 #ifndef _OTX_EP_COMMON_H_
 #define _OTX_EP_COMMON_H_
 
+#define otx_ep_printf(level, fmt, args...)		\
+	rte_log(RTE_LOG_ ## level, RTE_LOGTYPE_PMD,		\
+		 fmt, ##args)
+
+#define otx_ep_info(fmt, args...)				\
+	otx_ep_printf(INFO, fmt, ##args)
+
+#define otx_ep_err(fmt, args...)				\
+	otx_ep_printf(ERR, fmt, ##args)
+
+#define otx_ep_dbg(fmt, args...)				\
+	otx_ep_printf(DEBUG, fmt, ##args)
+
 /* OTX_EP EP VF device data structure */
 struct otx_ep_device {
 	/* PCI device pointer */
 	struct rte_pci_device *pdev;
-
+	uint16_t chip_id;
 	struct rte_eth_dev *eth_dev;
+	int port_id;
+	/* Memory mapped h/w address */
+	uint8_t *hw_addr;
+	int port_configured;
 };
 #endif  /* _OTX_EP_COMMON_H_ */
drivers/net/octeontx_ep/otx_ep_ethdev.c +83 -5

110 lines not on this page · raw message

Signature · 1 line
2.17.1
#6 lore raw

Re: [dpdk-dev] [PATCH v2 03/11] net/octeontx_ep: add device init and uninit

Quoted 15 lines · Nalla Pradeep

Add basic init and uninit function which includes
initializing fields of ethdev private structure.

---
 drivers/net/octeontx_ep/otx_ep_common.h | 19 +++++-
 drivers/net/octeontx_ep/otx_ep_ethdev.c | 88 +++++++++++++++++++++++--
 2 files changed, 101 insertions(+), 6 deletions(-)
drivers/net/octeontx_ep/otx_ep_common.h +0 -0
index 3fa2de9ab3..1c31ea8de2 100644

drivers/net/octeontx_ep/otx_ep_common.h line 8

Quoted 5 lines
drivers/net/octeontx_ep/otx_ep_common.h +2 -0
@@ -4,11 +4,28 @@
 #ifndef _OTX_EP_COMMON_H_
 #define _OTX_EP_COMMON_H_
 
+#define otx_ep_printf(level, fmt, args...)             \
+       rte_log(RTE_LOG_ ## level, RTE_LOGTYPE_PMD,             \

Use dynamic log scheme.

#7 lore raw

Re: [dpdk-dev] [PATCH v2 03/11] net/octeontx_ep: add device init and uninit

In reply to Nalla Pradeep
Quoted 4 lines · Nalla Pradeep

Add basic init and uninit function which includes
initializing fields of ethdev private structure.

<...>

ep/otx_ep_common.h

drivers/net/octeontx_ep/otx_ep_common.h line 9

Quoted 8 lines

+++ b/drivers/net/octeontx_ep/otx_ep_common.h

drivers/net/octeontx_ep/otx_ep_common.h +3 -0
@@ -4,11 +4,28 @@
  #ifndef _OTX_EP_COMMON_H_
  #define _OTX_EP_COMMON_H_
 
+#define otx_ep_printf(level, fmt, args...)		\
+	rte_log(RTE_LOG_ ## level, RTE_LOGTYPE_PMD,		\
+		 fmt, ##args)

Can you please register a new type specific to PMD, instead of using the 'RTE_LOGTYPE_PMD'?

<...>

Quoted 12 lines
drivers/net/octeontx_ep/otx_ep_ethdev.c +12 -0
+static int
+otx_ep_chip_specific_setup(struct otx_ep_device *otx_epvf)
+{
+	struct rte_pci_device *pdev = otx_epvf->pdev;
+	uint32_t dev_id = pdev->id.device_id;
+	int ret;
+
+	switch (dev_id) {
+	case PCI_DEVID_OCTEONTX_EP_VF:
+		otx_epvf->chip_id = dev_id;
+		break;
+	case PCI_DEVID_OCTEONTX2_EP_NET_VF:

drivers/net/octeontx_ep/otx_ep_ethdev.c line 35

Quoted 10 lines
drivers/net/octeontx_ep/otx_ep_ethdev.c +10 -0
+	case PCI_DEVID_CN98XX_EP_NET_VF:
+		otx_epvf->chip_id = dev_id;
+		break;
+	default:
+		otx_ep_err("Unsupported device\n");
+		ret = -EINVAL;
+	}
+
+	if (!ret)
+		otx_ep_info("OTX_EP dev_id[%d]\n", dev_id);

'ret' may be used uninitialized here. (I see it is fixed in later patches, but please fix here too)

<...>

Quoted 7 lines
drivers/net/octeontx_ep/otx_ep_ethdev.c +7 -0
+
+	return ret;
+}
+
+/* OTX_EP VF device initialization */
+static int
+otx_epdev_init(struct otx_ep_device *otx_epvf)

drivers/net/octeontx_ep/otx_ep_ethdev.c line 52

Quoted 10 lines
drivers/net/octeontx_ep/otx_ep_ethdev.c +10 -0
+{
+	if (otx_ep_chip_specific_setup(otx_epvf)) {
+		otx_ep_err("Chip specific setup failed\n");
+		goto setup_fail;
+	}
+
+	return 0;
+
+setup_fail:
+	return -ENOMEM;

Is 'NOMEM' correct return type, there seems nothing related to the memory.

Quoted 5 lines
drivers/net/octeontx_ep/otx_ep_ethdev.c +2 -0
+}
+
  static int
  otx_ep_eth_dev_uninit(struct rte_eth_dev *eth_dev)

drivers/net/octeontx_ep/otx_ep_ethdev.c line 65

Quoted 10 lines
drivers/net/octeontx_ep/otx_ep_ethdev.c +8 -1
  {
-	RTE_SET_USED(eth_dev);
+	struct otx_ep_device *otx_epvf = OTX_EP_DEV(eth_dev);
+
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		return 0;
+	otx_epvf->port_configured = 0;
+
+	if (eth_dev->data->mac_addrs != NULL)
+		rte_free(eth_dev->data->mac_addrs);

After 'otx_ep_eth_dev_uninit()' the 'rte_eth_dev_release_port()' is called:
rte_eth_dev_pci_generic_remove
dev_uninit()
rte_eth_dev_release_port()

'rte_eth_dev_pci_generic_remove()' also frees the 'eth_dev->data->mac_addrs' leading double free.

You can either free yourself and explicitly set the pointer to NULL, or relay the freeing of it to the 'rte_eth_dev_pci_generic_remove()'.

Quoted 9 lines
drivers/net/octeontx_ep/otx_ep_ethdev.c +2 -2
-	return -ENODEV;
+	return 0;
  }
 
  static int
  otx_ep_eth_dev_init(struct rte_eth_dev *eth_dev)
  {
-	RTE_SET_USED(eth_dev);
+	struct rte_pci_device *pdev = RTE_ETH_DEV_TO_PCI(eth_dev);

drivers/net/octeontx_ep/otx_ep_ethdev.c line 82

Quoted 10 lines
drivers/net/octeontx_ep/otx_ep_ethdev.c +8 -1
+	struct otx_ep_device *otx_epvf = OTX_EP_DEV(eth_dev);
+	unsigned char vf_mac_addr[RTE_ETHER_ADDR_LEN];
 
-	return -ENODEV;
+	/* Single process support */
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		return 0;
+
+	rte_eth_copy_pci_info(eth_dev, pdev);
+

'rte_eth_copy_pci_info()' already done before this point, as:
rte_eth_dev_pci_generic_probe
rte_eth_dev_pci_allocate
rte_eth_copy_pci_info

Can you please double check is the copying again required?

drivers/net/octeontx_ep/otx_ep_ethdev.c line 89

Quoted 7 lines
drivers/net/octeontx_ep/otx_ep_ethdev.c +7 -0
+	if (pdev->mem_resource[0].addr) {
+		otx_ep_info("OTX_EP BAR0 is mapped:\n");
+	} else {
+		otx_ep_err("OTX_EP: Failed to map device BARs\n");
+		otx_ep_err("BAR0 %p\n", pdev->mem_resource[0].addr);
+		return -ENODEV;
+	}

Why do you need to check if BAR0 is mapped or not, when it can be unmapped?

drivers/net/octeontx_ep/otx_ep_ethdev.c line 98

Quoted 9 lines
drivers/net/octeontx_ep/otx_ep_ethdev.c +9 -0
+	otx_epvf->eth_dev = eth_dev;
+	otx_epvf->port_id = eth_dev->data->port_id;
+	eth_dev->data->mac_addrs = rte_zmalloc("otx_ep", RTE_ETHER_ADDR_LEN, 0);
+	if (eth_dev->data->mac_addrs == NULL) {
+		otx_ep_err("MAC addresses memory allocation failed\n");
+		return -ENOMEM;
+	}
+	rte_eth_random_addr(vf_mac_addr);
+	memcpy(eth_dev->data->mac_addrs, vf_mac_addr, RTE_ETHER_ADDR_LEN);

You can use 'rte_ether_addr_copy()' to copy mac.

drivers/net/octeontx_ep/otx_ep_ethdev.c line 103

Quoted 5 lines
drivers/net/octeontx_ep/otx_ep_ethdev.c +5 -0
+	otx_epvf->hw_addr = pdev->mem_resource[0].addr;
+	otx_epvf->pdev = pdev;
+
+	otx_epdev_init(otx_epvf);
+	otx_epvf->port_configured = 0;

Is 'port_configured' used? It seems not checked at all.

drivers/net/octeontx_ep/otx_ep_ethdev.c otx_ep_eth_dev_pci_remove(struct rte_pci_device *pci_dev) · line 45

Quoted 10 lines
drivers/net/octeontx_ep/otx_ep_ethdev.c +2 -1
+
+	return 0;
  }
 
  static int
@@ -42,7 +121,6 @@ otx_ep_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
  					      otx_ep_eth_dev_uninit);
  }
 
-

Please fix these kind of things in the original patch that introduces it.

Quoted 4 lines
drivers/net/octeontx_ep/otx_ep_ethdev.c +0 -0
  /* Set of PCI devices this driver supports */
  static const struct rte_pci_id pci_id_otx_ep_map[] = {
  	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, PCI_DEVID_OCTEONTX_EP_VF) },
#8 lore raw

PATCH v2 4/11 net/octeontx_ep: Added basic device setup.

In reply to Nalla Pradeep

Functions to setup device, basic IQ and OQ registers are added.

---
 drivers/net/octeontx_ep/meson.build     |   2 +
 drivers/net/octeontx_ep/otx2_ep_vf.c    | 138 +++++++++++++++++++++
 drivers/net/octeontx_ep/otx2_ep_vf.h    |  11 ++
 drivers/net/octeontx_ep/otx_ep_common.h |  92 ++++++++++++++
 drivers/net/octeontx_ep/otx_ep_ethdev.c |  10 ++
 drivers/net/octeontx_ep/otx_ep_vf.c     | 154 ++++++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_vf.h     |  33 +++++
 7 files changed, 440 insertions(+)
 create mode 100644 drivers/net/octeontx_ep/otx2_ep_vf.c
 create mode 100644 drivers/net/octeontx_ep/otx2_ep_vf.h
 create mode 100644 drivers/net/octeontx_ep/otx_ep_vf.c
drivers/net/octeontx_ep/meson.build +2 -0
index 06663de4e2..7c43c077cf 100644
@@ -4,6 +4,8 @@
 
 sources = files(
                'otx_ep_ethdev.c',
+               'otx_ep_vf.c',
+               'otx2_ep_vf.c',
                )
 
 extra_flags = []
drivers/net/octeontx_ep/otx2_ep_vf.c new file +138 -0

138 lines not on this page · raw message

drivers/net/octeontx_ep/otx2_ep_vf.h new file +11 -0
new file mode 100644
index 0000000000..0d7c6e8e17
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2020 Marvell.
+ */
+#ifndef _OTX2_EP_VF_H_
+#define _OTX2_EP_VF_H_
+
+int
+otx2_ep_vf_setup_device(struct otx_ep_device *sdpvf);
+
+#endif /*_OTX2_EP_VF_H_ */
+
drivers/net/octeontx_ep/otx_ep_common.h +92 -0

113 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_ethdev.c +10 -0
index a1afdfab67..53e79d70ae 100644
@@ -9,6 +9,7 @@
 #include "otx2_common.h"
 #include "otx_ep_common.h"
 #include "otx_ep_vf.h"
+#include "otx2_ep_vf.h"
 
 #define OTX_EP_DEV(_eth_dev)            ((_eth_dev)->data->dev_private)
 static int
@@ -21,10 +22,12 @@ otx_ep_chip_specific_setup(struct otx_ep_device *otx_epvf)
 	switch (dev_id) {
 	case PCI_DEVID_OCTEONTX_EP_VF:
 		otx_epvf->chip_id = dev_id;
+		ret = otx_ep_vf_setup_device(otx_epvf);
 		break;
 	case PCI_DEVID_OCTEONTX2_EP_NET_VF:
 	case PCI_DEVID_CN98XX_EP_NET_VF:
 		otx_epvf->chip_id = dev_id;
+		ret = otx2_ep_vf_setup_device(otx_epvf);
 		break;
 	default:
 		otx_ep_err("Unsupported device\n");
@@ -46,6 +49,13 @@ otx_epdev_init(struct otx_ep_device *otx_epvf)
 		goto setup_fail;
 	}
 
+	if (otx_epvf->fn_list.setup_device_regs(otx_epvf)) {
+		otx_ep_err("Failed to configure device registers\n");
+		goto setup_fail;
+	}
+
+	otx_ep_info("OTX_EP Device is Ready\n");
+
 	return 0;
 
 setup_fail:
drivers/net/octeontx_ep/otx_ep_vf.c new file +154 -0

154 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_vf.h +33 -0
index 0498dd0cf5..5366297ee8 100644
@@ -4,6 +4,39 @@
 #ifndef _OTX_EP_VF_H_
 #define _OTX_EP_VF_H_
 
+#define OTX_EP_RING_OFFSET                (0x1ull << 17)
+
+/* OTX_EP VF IQ Registers */
+#define OTX_EP_R_IN_CONTROL_START         (0x10000)
+#define OTX_EP_R_IN_CONTROL(ring)  \
+	(OTX_EP_R_IN_CONTROL_START + ((ring) * OTX_EP_RING_OFFSET))
+
+/* OTX_EP VF IQ Masks */
+#define OTX_EP_R_IN_CTL_RPVF_MASK       (0xF)
+#define	OTX_EP_R_IN_CTL_RPVF_POS        (48)
+
+#define OTX_EP_R_IN_CTL_IDLE            (0x1ull << 28)
+#define OTX_EP_R_IN_CTL_RDSIZE          (0x3ull << 25) /* Setting to max(4) */
+#define OTX_EP_R_IN_CTL_IS_64B          (0x1ull << 24)
+#define OTX_EP_R_IN_CTL_ESR             (0x1ull << 1)
+/* OTX_EP VF OQ Registers */
+#define OTX_EP_R_OUT_CONTROL_START           (0x10150)
+#define OTX_EP_R_OUT_CONTROL(ring)    \
+	(OTX_EP_R_OUT_CONTROL_START + ((ring) * OTX_EP_RING_OFFSET))
+/* OTX_EP VF OQ Masks */
+#define OTX_EP_R_OUT_CTL_ES_I         (1ull << 34)
+#define OTX_EP_R_OUT_CTL_NSR_I        (1ull << 33)
+#define OTX_EP_R_OUT_CTL_ROR_I        (1ull << 32)
+#define OTX_EP_R_OUT_CTL_ES_D         (1ull << 30)
+#define OTX_EP_R_OUT_CTL_NSR_D        (1ull << 29)
+#define OTX_EP_R_OUT_CTL_ROR_D        (1ull << 28)
+#define OTX_EP_R_OUT_CTL_ES_P         (1ull << 26)
+#define OTX_EP_R_OUT_CTL_NSR_P        (1ull << 25)
+#define OTX_EP_R_OUT_CTL_ROR_P        (1ull << 24)
+#define OTX_EP_R_OUT_CTL_IMODE        (1ull << 23)
+
 #define PCI_DEVID_OCTEONTX_EP_VF 0xa303
 
+int
+otx_ep_vf_setup_device(struct otx_ep_device *otx_ep);
 #endif /*_OTX_EP_VF_H_ */
Signature · 1 line
2.17.1
#9 lore raw

Re: [dpdk-dev] [PATCH v2 04/11] net/octeontx_ep: Added basic device setup.

Quoted 59 lines · Nalla Pradeep

Functions to setup device, basic IQ and OQ registers are added.

---
 drivers/net/octeontx_ep/meson.build     |   2 +
 drivers/net/octeontx_ep/otx2_ep_vf.c    | 138 +++++++++++++++++++++
 drivers/net/octeontx_ep/otx2_ep_vf.h    |  11 ++
 drivers/net/octeontx_ep/otx_ep_common.h |  92 ++++++++++++++
 drivers/net/octeontx_ep/otx_ep_ethdev.c |  10 ++
 drivers/net/octeontx_ep/otx_ep_vf.c     | 154 ++++++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_vf.h     |  33 +++++
 7 files changed, 440 insertions(+)
 create mode 100644 drivers/net/octeontx_ep/otx2_ep_vf.c
 create mode 100644 drivers/net/octeontx_ep/otx2_ep_vf.h
 create mode 100644 drivers/net/octeontx_ep/otx_ep_vf.c
drivers/net/octeontx_ep/meson.build +2 -0
index 06663de4e2..7c43c077cf 100644
@@ -4,6 +4,8 @@
 
 sources = files(
                'otx_ep_ethdev.c',
+               'otx_ep_vf.c',
+               'otx2_ep_vf.c',
                )
 
 extra_flags = []
drivers/net/octeontx_ep/otx2_ep_vf.c new file +23 -0
new file mode 100644
index 0000000000..e03d39f7dc
@@ -0,0 +1,138 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2020 Marvell.
+ */
+
+#include "otx2_common.h"
+#include "otx_ep_common.h"
+#include "otx2_ep_vf.h"
+
+static void
+otx2_vf_setup_global_iq_reg(struct otx_ep_device *otx_ep, int q_no)
+{
+       volatile uint64_t reg_val = 0ull;
+
+       /* Select ES, RO, NS, RDSIZE,DPTR Format#0 for IQs
+        * IS_64B is by default enabled.
+        */
+       reg_val = otx2_read64(otx_ep->hw_addr + SDP_VF_R_IN_CONTROL(q_no));
+
+       reg_val |= SDP_VF_R_IN_CTL_RDSIZE;
+       reg_val |= SDP_VF_R_IN_CTL_IS_64B;
+       reg_val |= SDP_VF_R_IN_CTL_ESR;
+
+       otx2_write64(reg_val, otx_ep->hw_addr + SDP_VF_R_IN_CONTROL(q_no));

drivers/net/octeontx_ep/otx2_ep_vf.c line 33

Quoted 10 lines
drivers/net/octeontx_ep/otx2_ep_vf.c new file +10 -0
+}
+
+static void
+otx2_vf_setup_global_oq_reg(struct otx_ep_device *otx_ep, int q_no)
+{
+       volatile uint64_t reg_val = 0ull;
+
+       reg_val = otx2_read64(otx_ep->hw_addr + SDP_VF_R_OUT_CONTROL(q_no));
+
+#if defined(BUFPTR_ONLY_MODE)

Use devargs instead of compile-time flags.

Quoted 4 lines
drivers/net/octeontx_ep/otx2_ep_vf.c new file +4 -0
+       reg_val &= ~(SDP_VF_R_OUT_CTL_IMODE);
+#else
+       reg_val |= (SDP_VF_R_OUT_CTL_IMODE);
+#endif
#10 lore raw

Re: [dpdk-dev] [PATCH v2 04/11] net/octeontx_ep: Added basic device setup.

In reply to Nalla Pradeep
Quoted 2 lines · Nalla Pradeep

Functions to setup device, basic IQ and OQ registers are added.

As the patch title can you please start with lowercase after module, and do not use the final '.',
if you run './devtools/check-git-log.sh' script it will highlight these kind of issues, can you please be sure all are addressed in next version.

Also it would helpful to clarify all abbreviations used in the commit log, like IQ and OQ used above, it is helpul if you can write the long version for the fist time they are used like, Output Queue (OQ).

Quoted 1 line

<...>

drivers/net/octeontx_ep/otx2_ep_vf.c line 37

Quoted 12 lines
drivers/net/octeontx_ep/otx2_ep_vf.c new file +12 -0
+static void
+otx2_vf_setup_global_oq_reg(struct otx_ep_device *otx_ep, int q_no)
+{
+	volatile uint64_t reg_val = 0ull;
+
+	reg_val = otx2_read64(otx_ep->hw_addr + SDP_VF_R_OUT_CONTROL(q_no));
+
+#if defined(BUFPTR_ONLY_MODE)
+	reg_val &= ~(SDP_VF_R_OUT_CTL_IMODE);
+#else
+	reg_val |= (SDP_VF_R_OUT_CTL_IMODE);
+#endif

Where this macro, BUFPTR_ONLY_MODE, is defined, using macros like this can lead to the dead code, can you please either remove this or rename with RTE_ prefix and document it?

<...>

drivers/net/octeontx_ep/otx2_ep_vf.c line 122

Quoted 11 lines
drivers/net/octeontx_ep/otx2_ep_vf.c new file +11 -0
+int
+otx2_ep_vf_setup_device(struct otx_ep_device *otx_ep)
+{
+	uint64_t reg_val = 0ull;
+
+	/* If application doesn't provide its conf, use driver default conf */
+	if (otx_ep->conf == NULL) {
+		otx_ep->conf = otx2_ep_get_defconf(otx_ep);
+		if (otx_ep->conf == NULL) {
+			otx2_err("SDP VF default config not found");
+			return -ENOMEM;

Similar comment as previous, please prefer ENOMEM error type when there is a problem with memory. There are multiple occurance of returning ENOMEM.

<...>

Quoted 14 lines
drivers/net/octeontx_ep/otx_ep_ethdev.c +2 -0
@@ -21,10 +22,12 @@ otx_ep_chip_specific_setup(struct otx_ep_device *otx_epvf)
  	switch (dev_id) {
  	case PCI_DEVID_OCTEONTX_EP_VF:
  		otx_epvf->chip_id = dev_id;
+		ret = otx_ep_vf_setup_device(otx_epvf);
  		break;
  	case PCI_DEVID_OCTEONTX2_EP_NET_VF:
  	case PCI_DEVID_CN98XX_EP_NET_VF:
  		otx_epvf->chip_id = dev_id;
+		ret = otx2_ep_vf_setup_device(otx_epvf);
  		break;
  	default:
  		otx_ep_err("Unsupported device\n");

drivers/net/octeontx_ep/otx_ep_ethdev.c otx_epdev_init(struct otx_ep_device *otx_epvf) · line 55

Quoted 7 lines
drivers/net/octeontx_ep/otx_ep_ethdev.c +4 -0
@@ -46,6 +49,13 @@ otx_epdev_init(struct otx_ep_device *otx_epvf)
  		goto setup_fail;
  	}
 
+	if (otx_epvf->fn_list.setup_device_regs(otx_epvf)) {
+		otx_ep_err("Failed to configure device registers\n");
+		goto setup_fail;
+	}

So both otx & otx2 devices are supported via function pointers, out of curiosity how different the implementations are, since both are implementing same spec as far as I understand.

#11 lore raw

PATCH v2 5/11 net/octeontx_ep: Add dev info get and configure

In reply to Nalla Pradeep

Add device information get and device configure operations.

---
 drivers/net/octeontx_ep/otx_ep_common.h | 16 +++++
 drivers/net/octeontx_ep/otx_ep_ethdev.c | 89 ++++++++++++++++++++++++-
 drivers/net/octeontx_ep/otx_ep_rxtx.h   | 10 +++
 3 files changed, 112 insertions(+), 3 deletions(-)
 create mode 100644 drivers/net/octeontx_ep/otx_ep_rxtx.h
drivers/net/octeontx_ep/otx_ep_common.h +16 -0
index 4ec7638219..f3a08cdfa4 100644
@@ -7,9 +7,12 @@
 #define OTX_EP_MAX_RINGS_PER_VF        (8)
 #define OTX_EP_CFG_IO_QUEUES        OTX_EP_MAX_RINGS_PER_VF
 #define OTX_EP_64BYTE_INSTR         (64)
+#define OTX_EP_MIN_IQ_DESCRIPTORS   (128)
+#define OTX_EP_MIN_OQ_DESCRIPTORS   (128)
 #define OTX_EP_MAX_IQ_DESCRIPTORS   (8192)
 #define OTX_EP_MAX_OQ_DESCRIPTORS   (8192)
 #define OTX_EP_OQ_BUF_SIZE          (2048)
+#define OTX_EP_MIN_RX_BUF_SIZE      (64)
 
 #define OTX_EP_OQ_INFOPTR_MODE      (0)
 #define OTX_EP_OQ_REFIL_THRESHOLD   (16)
@@ -112,6 +115,10 @@ struct otx_ep_device {
 
 	struct otx_ep_fn_list fn_list;
 
+	uint32_t max_tx_queues;
+
+	uint32_t max_rx_queues;
+
 	/* SR-IOV info */
 	struct otx_ep_sriov_info sriov_info;
 
@@ -119,5 +126,14 @@ struct otx_ep_device {
 	const struct otx_ep_config *conf;
 
 	int port_configured;
+
+	uint64_t rx_offloads;
+
+	uint64_t tx_offloads;
 };
+
+#define OTX_EP_MAX_PKT_SZ 64000U
+
+#define OTX_EP_MAX_MAC_ADDRS 1
+
 #endif  /* _OTX_EP_COMMON_H_ */
drivers/net/octeontx_ep/otx_ep_ethdev.c +86 -3

114 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_rxtx.h new file +10 -0
new file mode 100644
index 0000000000..269ecbe1a7
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2020 Marvell.
+ */
+
+#ifndef _OTX_EP_RXTX_H_
+#define _OTX_EP_RXTX_H_
+
+#define OTX_EP_RXD_ALIGN 1
+#define OTX_EP_TXD_ALIGN 1
+#endif
Signature · 1 line
2.17.1
#12 lore raw

Re: [dpdk-dev] [PATCH v2 05/11] net/octeontx_ep: Add dev info get and configure

Quoted 3 lines · Nalla Pradeep

Add device information get and device configure operations.

<...>

drivers/net/octeontx_ep/otx_ep_ethdev.c line 42

Quoted 13 lines
drivers/net/octeontx_ep/otx_ep_ethdev.c +13 -0
+static int
+otx_ep_dev_info_get(struct rte_eth_dev *eth_dev,
+		    struct rte_eth_dev_info *devinfo)
+{
+	struct otx_ep_device *otx_epvf;
+	struct rte_pci_device *pdev;
+	uint32_t dev_id;
+
+	otx_epvf = OTX_EP_DEV(eth_dev);
+	pdev = otx_epvf->pdev;
+	dev_id = pdev->id.device_id;
+
+	devinfo->speed_capa = ETH_LINK_SPEED_10G;

Is it always 10G independent from the device type and PHY?

Also can you please update the featutes file, octeontx_ep.ini, as the same patch features are added. For example the 'Speed capabilities' feature can be set as P (partially supported) with this patch.

drivers/net/octeontx_ep/otx_ep_ethdev.c line 54

Quoted 12 lines
drivers/net/octeontx_ep/otx_ep_ethdev.c +12 -0
+	devinfo->max_rx_queues = otx_epvf->max_rx_queues;
+	devinfo->max_tx_queues = otx_epvf->max_tx_queues;
+
+	devinfo->min_rx_bufsize = OTX_EP_MIN_RX_BUF_SIZE;
+	if (dev_id == PCI_DEVID_OCTEONTX_EP_VF ||
+	    dev_id == PCI_DEVID_OCTEONTX2_EP_NET_VF ||
+	    dev_id == PCI_DEVID_CN98XX_EP_NET_VF) {
+		devinfo->max_rx_pktlen = OTX_EP_MAX_PKT_SZ;
+		devinfo->rx_offload_capa = DEV_RX_OFFLOAD_JUMBO_FRAME;
+		devinfo->rx_offload_capa |= DEV_RX_OFFLOAD_SCATTER;
+		devinfo->tx_offload_capa = DEV_TX_OFFLOAD_MULTI_SEGS;
+	}

The above list seems all the devices this driver probes, is there a reason to check for them?

<...>

Quoted 6 lines
drivers/net/octeontx_ep/otx_ep_ethdev.c +6 -0
+static int
+otx_ep_dev_configure(struct rte_eth_dev *eth_dev)
+{
+	struct otx_ep_device *otx_epvf = OTX_EP_DEV(eth_dev);
+	struct rte_eth_dev_data *data = eth_dev->data;
+	struct rte_eth_rxmode *rxmode;

drivers/net/octeontx_ep/otx_ep_ethdev.c otx_epdev_init(struct otx_ep_device *otx_epvf) · line 129

Quoted 10 lines
drivers/net/octeontx_ep/otx_ep_ethdev.c +10 -0
+	struct rte_eth_txmode *txmode;
+	struct rte_eth_conf *conf;
+	uint32_t ethdev_queues;
+
+	conf = &data->dev_conf;
+	rxmode = &conf->rxmode;
+	txmode = &conf->txmode;
+	ethdev_queues = (uint32_t)(otx_epvf->sriov_info.rings_per_vf);
+	if (eth_dev->data->nb_rx_queues > ethdev_queues ||
+	    eth_dev->data->nb_tx_queues > ethdev_queues) {

In dev_info, 'max_rx_queues' & 'max_tx_queues' set by 'otx_epvf->max_rx_queues' & 'otx_epvf->max_tx_queues' respectively, but here they are checked against 'otx_epvf->sriov_info.rings_per_vf' are they same values? Or should dev_info chaged to set correct limits?

#13 lore raw

Re: [dpdk-dev] [EXT] Re: [PATCH v2 05/11] net/octeontx_ep: Add dev info get and configure

-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, January 26, 2021 9:01 PM
To: Pradeep Kumar Nalla <[email protected]>; Radha Chintakuntla <[email protected]>; Veerasenareddy Burru <[email protected]>
Cc: Jerin Jacob Kollanukkaran <[email protected]>; [email protected]; Satananda Burla <[email protected]>
Subject: [EXT] Re: [dpdk-dev] [PATCH v2 05/11] net/octeontx_ep: Add dev info get and configure

External Email

----------------------------------------------------------------------

Quoted 3 lines · Nalla Pradeep

Add device information get and device configure operations.

<...>

Quoted 13 lines
drivers/net/octeontx_ep/otx_ep_ethdev.c +12 -0
+static int
+otx_ep_dev_info_get(struct rte_eth_dev *eth_dev,
+		    struct rte_eth_dev_info *devinfo) {
+	struct otx_ep_device *otx_epvf;
+	struct rte_pci_device *pdev;
+	uint32_t dev_id;
+
+	otx_epvf = OTX_EP_DEV(eth_dev);
+	pdev = otx_epvf->pdev;
+	dev_id = pdev->id.device_id;
+
+	devinfo->speed_capa = ETH_LINK_SPEED_10G;
Quoted 1 line

Is it always 10G independent from the device type and PHY?

Right now it is fixed for 10G. When communication infrastructure is incorporated with PF, will get information from PF.

Quoted 6 lines

Also can you please update the featutes file, octeontx_ep.ini, as the same patch features are >added. For example the 'Speed capabilities' feature can be set as P (partially
supported) with this patch.

drivers/net/octeontx_ep/otx_ep_ethdev.c +2 -0
+	devinfo->max_rx_queues = otx_epvf->max_rx_queues;
+	devinfo->max_tx_queues = otx_epvf->max_tx_queues;

drivers/net/octeontx_ep/otx_ep_ethdev.c line 54

Quoted 10 lines
drivers/net/octeontx_ep/otx_ep_ethdev.c +10 -0
+
+	devinfo->min_rx_bufsize = OTX_EP_MIN_RX_BUF_SIZE;
+	if (dev_id == PCI_DEVID_OCTEONTX_EP_VF ||
+	    dev_id == PCI_DEVID_OCTEONTX2_EP_NET_VF ||
+	    dev_id == PCI_DEVID_CN98XX_EP_NET_VF) {
+		devinfo->max_rx_pktlen = OTX_EP_MAX_PKT_SZ;
+		devinfo->rx_offload_capa = DEV_RX_OFFLOAD_JUMBO_FRAME;
+		devinfo->rx_offload_capa |= DEV_RX_OFFLOAD_SCATTER;
+		devinfo->tx_offload_capa = DEV_TX_OFFLOAD_MULTI_SEGS;
+	}

The above list seems all the devices this driver probes, is there a reason to check for them?

<...>

Quoted 5 lines
drivers/net/octeontx_ep/otx_ep_ethdev.c +5 -0
+static int
+otx_ep_dev_configure(struct rte_eth_dev *eth_dev) {
+	struct otx_ep_device *otx_epvf = OTX_EP_DEV(eth_dev);
+	struct rte_eth_dev_data *data = eth_dev->data;
+	struct rte_eth_rxmode *rxmode;

drivers/net/octeontx_ep/otx_ep_ethdev.c otx_epdev_init(struct otx_ep_device *otx_epvf) · line 129

Quoted 10 lines
drivers/net/octeontx_ep/otx_ep_ethdev.c +10 -0
+	struct rte_eth_txmode *txmode;
+	struct rte_eth_conf *conf;
+	uint32_t ethdev_queues;
+
+	conf = &data->dev_conf;
+	rxmode = &conf->rxmode;
+	txmode = &conf->txmode;
+	ethdev_queues = (uint32_t)(otx_epvf->sriov_info.rings_per_vf);
+	if (eth_dev->data->nb_rx_queues > ethdev_queues ||
+	    eth_dev->data->nb_tx_queues > ethdev_queues) {

In dev_info, 'max_rx_queues' & 'max_tx_queues' set by 'otx_epvf->max_rx_queues'
& 'otx_epvf->max_tx_queues' respectively, but here they are checked against 'otx_epvf->sriov_info.rings_per_vf' are they same values? Or should dev_info chaged to set correct limits?

#14 lore raw

PATCH v2 6/11 net/octeontx_ep: Added rxq setup and release

In reply to Nalla Pradeep

Receive queue setup involves allocating memory for the queue, initializing data structure representing the queue and filling queue with receive buffers of rx descriptor count.

Receive queues are referred as droq. Hardware fills the receive buffers in queue with the packet. It can use same receive buffer (BUFPTR_ONLY_MODE) or separate buffer (INFOPTR_MODE) to fill with packet metadata. BUFPTR_ONLY_MODE is supported now.

In receive queue release, receive buffers are freed along with the receive queue.

---
 drivers/net/octeontx_ep/meson.build     |   1 +
 drivers/net/octeontx_ep/otx_ep_common.h | 160 ++++++++++++++++-
 drivers/net/octeontx_ep/otx_ep_ethdev.c | 132 ++++++++++++++
 drivers/net/octeontx_ep/otx_ep_rxtx.c   | 222 ++++++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_vf.h     |   6 +
 5 files changed, 516 insertions(+), 5 deletions(-)
 create mode 100644 drivers/net/octeontx_ep/otx_ep_rxtx.c
drivers/net/octeontx_ep/meson.build +1 -0
index 7c43c077cf..0f23c0bfe2 100644
@@ -6,6 +6,7 @@ sources = files(
                'otx_ep_ethdev.c',
                'otx_ep_vf.c',
                'otx2_ep_vf.c',
+               'otx_ep_rxtx.c',
                )
 
 extra_flags = []
drivers/net/octeontx_ep/otx_ep_common.h +155 -5

208 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_ethdev.c +132 -0

190 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_rxtx.c new file +222 -0

222 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_vf.h +6 -0
index 5366297ee8..42bb04f14f 100644
@@ -37,6 +37,12 @@
 
 #define PCI_DEVID_OCTEONTX_EP_VF 0xa303
 
+/* this is a static value set by SLI PF driver in octeon
+ * No handshake is available
+ * Change this if changing the value in SLI PF driver
+ */
+#define SDP_GBL_WMARK 0x100
+
 int
 otx_ep_vf_setup_device(struct otx_ep_device *otx_ep);
 #endif /*_OTX_EP_VF_H_ */
Signature · 1 line
2.17.1
#15 lore raw

PATCH v2 7/11 net/octeontx_ep: Added tx queue setup and release

In reply to Nalla Pradeep

Transmit queue setup involves allocating memory for the command queue considering tx descriptor count and initializing data structure representing the queue. Transmit queue release function frees the command queue.

---
 drivers/net/octeontx_ep/otx_ep_common.h |  89 +++++++++++++++-
 drivers/net/octeontx_ep/otx_ep_ethdev.c |  81 ++++++++++++++
 drivers/net/octeontx_ep/otx_ep_rxtx.c   | 135 ++++++++++++++++++++++++
 3 files changed, 303 insertions(+), 2 deletions(-)
drivers/net/octeontx_ep/otx_ep_common.h +87 -2
index 291bd3a7c6..661e8e4c55 100644
@@ -42,7 +42,21 @@
 	rte_write64(val, ((base_addr) + off)); \
 	}
 
-struct otx_ep_device;
+/* OTX_EP IQ request list */
+struct otx_ep_instr_list {
+	void *buf;
+	uint32_t reqtype;
+};
+#define OTX_EP_IQREQ_LIST_SIZE	(sizeof(struct otx_ep_instr_list))
+
+/* Input Queue statistics. Each input queue has four stats fields. */
+struct otx_ep_iq_stats {
+	uint64_t instr_posted; /* Instructions posted to this queue. */
+	uint64_t instr_processed; /* Instructions processed in this queue. */
+	uint64_t instr_dropped; /* Instructions that could not be processed */
+	uint64_t tx_pkts;
+	uint64_t tx_bytes;
+};
 
 /* Structure to define the configuration attributes for each Input queue. */
 struct otx_ep_iq_config {
@@ -56,6 +70,66 @@ struct otx_ep_iq_config {
 	uint32_t pending_list_size;
 };
 
+/** The instruction (input) queue.
+ *  The input queue is used to post raw (instruction) mode data or packet data
+ *  to OCTEON TX2 device from the host. Each IQ of a OTX_EP EP VF device has one
+ *  such structure to represent it.
+ */
+struct otx_ep_instr_queue {
+	struct otx_ep_device *otx_ep_dev;
+
+	uint32_t q_no;
+	uint32_t pkt_in_done;
+
+	/* Flag for 64 byte commands. */
+	uint32_t iqcmd_64B:1;
+	uint32_t rsvd:17;
+	uint32_t status:8;
+
+	/* Number of  descriptors in this ring. */
+	uint32_t nb_desc;
+
+	/* Input ring index, where the driver should write the next packet */
+	uint32_t host_write_index;
+
+	/* Input ring index, where the OCTEON TX2 should read the next packet */
+	uint32_t otx_read_index;
+
+	uint32_t reset_instr_cnt;
+
+	/** This index aids in finding the window in the queue where OCTEON TX2
+	 *  has read the commands.
+	 */
+	uint32_t flush_index;
+
+	/* This keeps track of the instructions pending in this queue. */
+	uint64_t instr_pending;
+
+	/* Pointer to the Virtual Base addr of the input ring. */
+	uint8_t *base_addr;
+
+	/* This IQ request list */
+	struct otx_ep_instr_list *req_list;
+
+	/* OTX_EP doorbell register for the ring. */
+	void *doorbell_reg;
+
+	/* OTX_EP instruction count register for this ring. */
+	void *inst_cnt_reg;
+
+	/* Number of instructions pending to be posted to OCTEON TX2. */
+	uint32_t fill_cnt;
+
+	/* Statistics for this input queue. */
+	struct otx_ep_iq_stats stats;
+
+	/* DMA mapped base address of the input descriptor ring. */
+	uint64_t base_addr_dma;
+
+	/* Memory zone */
+	const struct rte_memzone *iq_mz;
+};
+
 /** Descriptor format.
  *  The descriptor ring is made of descriptors which have 2 64-bit values:
  *  -# Physical (bus) address of the data buffer.
@@ -218,6 +292,7 @@ struct otx_ep_config {
 
 /* Required functions for each VF device */
 struct otx_ep_fn_list {
+	void (*setup_iq_regs)(struct otx_ep_device *otx_ep, uint32_t q_no);
 	void (*setup_oq_regs)(struct otx_ep_device *otx_ep, uint32_t q_no);
 
 	int (*setup_device_regs)(struct otx_ep_device *otx_ep);
@@ -256,6 +331,12 @@ struct otx_ep_device {
 
 	uint32_t max_rx_queues;
 
+	/* Num IQs */
+	uint32_t nb_tx_queues;
+
+	/* The input instruction queues */
+	struct otx_ep_instr_queue *instr_queue[OTX_EP_MAX_IOQS_PER_VF];
+
 	/* Num OQs */
 	uint32_t nb_rx_queues;
 
@@ -278,12 +359,16 @@ struct otx_ep_device {
 	uint64_t tx_offloads;
 };
 
+int otx_ep_setup_iqs(struct otx_ep_device *otx_ep, uint32_t iq_no,
+		     int num_descs, unsigned int socket_id);
+int otx_ep_delete_iqs(struct otx_ep_device *otx_ep, uint32_t iq_no);
+
 int otx_ep_setup_oqs(struct otx_ep_device *otx_ep, int oq_no, int num_descs,
 		     int desc_size, struct rte_mempool *mpool,
 		     unsigned int socket_id);
 int otx_ep_delete_oqs(struct otx_ep_device *otx_ep, uint32_t oq_no);
-#define OTX_EP_MAX_PKT_SZ 64000U
 
+#define OTX_EP_MAX_PKT_SZ 64000U
 #define OTX_EP_MAX_MAC_ADDRS 1
 
 #endif  /* _OTX_EP_COMMON_H_ */
drivers/net/octeontx_ep/otx_ep_ethdev.c +81 -0

98 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_rxtx.c +135 -0

141 lines not on this page · raw message

Signature · 1 line
2.17.1
#16 lore raw

PATCH v2 8/11 net/octeontx_ep: Setting up iq and oq registers

In reply to Nalla Pradeep

Configuring hardware registers with command queue(iq) and droq(oq) parameters.

---
 drivers/net/octeontx_ep/otx2_ep_vf.c    | 124 ++++++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_common.h |  65 +++++++++++++
 drivers/net/octeontx_ep/otx_ep_vf.c     | 124 ++++++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_vf.h     |  53 ++++++++++
 4 files changed, 366 insertions(+)
drivers/net/octeontx_ep/otx2_ep_vf.c +124 -0
index e03d39f7dc..77850bcc7d 100644
@@ -78,6 +78,127 @@ otx2_vf_setup_device_regs(struct otx_ep_device *otx_ep)
 	return 0;
 }
 
+static void
+otx2_vf_setup_iq_regs(struct otx_ep_device *otx_ep, uint32_t iq_no)
+{
+	struct otx_ep_instr_queue *iq = otx_ep->instr_queue[iq_no];
+	volatile uint64_t reg_val = 0ull;
+
+	reg_val = otx2_read64(otx_ep->hw_addr + SDP_VF_R_IN_CONTROL(iq_no));
+
+	/* Wait till IDLE to set to 1, not supposed to configure BADDR
+	 * as long as IDLE is 0
+	 */
+	if (!(reg_val & SDP_VF_R_IN_CTL_IDLE)) {
+		do {
+			reg_val = otx2_read64(otx_ep->hw_addr +
+					      SDP_VF_R_IN_CONTROL(iq_no));
+		} while (!(reg_val & SDP_VF_R_IN_CTL_IDLE));
+	}
+
+	/* Write the start of the input queue's ring and its size  */
+	otx2_write64(iq->base_addr_dma, otx_ep->hw_addr +
+		     SDP_VF_R_IN_INSTR_BADDR(iq_no));
+	otx2_write64(iq->nb_desc, otx_ep->hw_addr +
+		     SDP_VF_R_IN_INSTR_RSIZE(iq_no));
+
+	/* Remember the doorbell & instruction count register addr
+	 * for this queue
+	 */
+	iq->doorbell_reg = (uint8_t *)otx_ep->hw_addr +
+			   SDP_VF_R_IN_INSTR_DBELL(iq_no);
+	iq->inst_cnt_reg = (uint8_t *)otx_ep->hw_addr +
+			   SDP_VF_R_IN_CNTS(iq_no);
+
+	otx_ep_dbg("InstQ[%d]:dbell reg @ 0x%p instcnt_reg @ 0x%p",
+		   iq_no, iq->doorbell_reg, iq->inst_cnt_reg);
+
+	do {
+		reg_val = rte_read32(iq->inst_cnt_reg);
+		rte_write32(reg_val, iq->inst_cnt_reg);
+	} while (reg_val != 0);
+
+	/* IN INTR_THRESHOLD is set to max(FFFFFFFF) which disable the IN INTR
+	 * to raise
+	 */
+	otx2_write64(0x3FFFFFFFFFFFFFUL,
+		     otx_ep->hw_addr + SDP_VF_R_IN_INT_LEVELS(iq_no));
+}
+
+static void
+otx2_vf_setup_oq_regs(struct otx_ep_device *otx_ep, uint32_t oq_no)
+{
+	volatile uint64_t reg_val = 0ull;
+	uint64_t oq_ctl = 0ull;
+	struct otx_ep_droq *droq = otx_ep->droq[oq_no];
+
+	/* Wait on IDLE to set to 1, supposed to configure BADDR
+	 * as log as IDLE is 0
+	 */
+	reg_val = otx2_read64(otx_ep->hw_addr + SDP_VF_R_OUT_CONTROL(oq_no));
+
+	while (!(reg_val & SDP_VF_R_OUT_CTL_IDLE)) {
+		reg_val = otx2_read64(otx_ep->hw_addr +
+				      SDP_VF_R_OUT_CONTROL(oq_no));
+	}
+
+	otx2_write64(droq->desc_ring_dma, otx_ep->hw_addr +
+		     SDP_VF_R_OUT_SLIST_BADDR(oq_no));
+	otx2_write64(droq->nb_desc, otx_ep->hw_addr +
+		     SDP_VF_R_OUT_SLIST_RSIZE(oq_no));
+
+	oq_ctl = otx2_read64(otx_ep->hw_addr + SDP_VF_R_OUT_CONTROL(oq_no));
+
+	/* Clear the ISIZE and BSIZE (22-0) */
+	oq_ctl &= ~(0x7fffffull);
+
+	/* Populate the BSIZE (15-0) */
+	oq_ctl |= (droq->buffer_size & 0xffff);
+
+#ifndef BUFPTR_ONLY_MODE
+	/* Populate ISIZE(22-16) */
+	oq_ctl |= ((OTX_EP_RH_SIZE << 16) & 0x7fffff);
+#endif
+	otx2_write64(oq_ctl, otx_ep->hw_addr + SDP_VF_R_OUT_CONTROL(oq_no));
+
+	/* Mapped address of the pkt_sent and pkts_credit regs */
+	droq->pkts_sent_reg = (uint8_t *)otx_ep->hw_addr +
+			      SDP_VF_R_OUT_CNTS(oq_no);
+	droq->pkts_credit_reg = (uint8_t *)otx_ep->hw_addr +
+				SDP_VF_R_OUT_SLIST_DBELL(oq_no);
+
+	rte_write64(0x3FFFFFFFFFFFFFUL,
+		    otx_ep->hw_addr + SDP_VF_R_OUT_INT_LEVELS(oq_no));
+
+	/* Clear PKT_CNT register */
+	rte_write64(0xFFFFFFFFF, (uint8_t *)otx_ep->hw_addr +
+		    SDP_VF_R_OUT_PKT_CNT(oq_no));
+
+	/* Clear the OQ doorbell  */
+	rte_write32(0xFFFFFFFF, droq->pkts_credit_reg);
+	while ((rte_read32(droq->pkts_credit_reg) != 0ull)) {
+		rte_write32(0xFFFFFFFF, droq->pkts_credit_reg);
+		rte_delay_ms(1);
+	}
+	otx_ep_dbg("SDP_R[%d]_credit:%x", oq_no,
+		   rte_read32(droq->pkts_credit_reg));
+
+	/* Clear the OQ_OUT_CNTS doorbell  */
+	reg_val = rte_read32(droq->pkts_sent_reg);
+	rte_write32((uint32_t)reg_val, droq->pkts_sent_reg);
+
+	otx_ep_dbg("SDP_R[%d]_sent: %x", oq_no,
+		   rte_read32(droq->pkts_sent_reg));
+
+	while (((rte_read32(droq->pkts_sent_reg)) != 0ull)) {
+		reg_val = rte_read32(droq->pkts_sent_reg);
+		rte_write32((uint32_t)reg_val, droq->pkts_sent_reg);
+		rte_delay_ms(1);
+	}
+	otx_ep_dbg("SDP_R[%d]_sent: %x", oq_no,
+		   rte_read32(droq->pkts_sent_reg));
+}
+
 static const struct otx_ep_config default_otx2_ep_conf = {
 	/* IQ attributes */
 	.iq                        = {
@@ -132,6 +253,9 @@ otx2_ep_vf_setup_device(struct otx_ep_device *otx_ep)
 
 	otx2_info("SDP RPVF: %d", otx_ep->sriov_info.rings_per_vf);
 
+	otx_ep->fn_list.setup_iq_regs       = otx2_vf_setup_iq_regs;
+	otx_ep->fn_list.setup_oq_regs       = otx2_vf_setup_oq_regs;
+
 	otx_ep->fn_list.setup_device_regs   = otx2_vf_setup_device_regs;
 
 	return 0;
drivers/net/octeontx_ep/otx_ep_common.h +65 -0

89 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_vf.c +124 -0

136 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_vf.h +53 -0

76 lines not on this page · raw message

Signature · 1 line
2.17.1
#17 lore raw

Re: [dpdk-dev] [PATCH v2 08/11] net/octeontx_ep: Setting up iq and oq registers

Quoted 3 lines · Nalla Pradeep

Configuring hardware registers with command queue(iq) and droq(oq) parameters.

Can you please elaborate what functionalit is configured, registers setup is not clear on its own?

Quoted 1 line

<...>

Quoted 44 lines
drivers/net/octeontx_ep/otx2_ep_vf.c +44 -0
+static void
+otx2_vf_setup_oq_regs(struct otx_ep_device *otx_ep, uint32_t oq_no)
+{
+	volatile uint64_t reg_val = 0ull;
+	uint64_t oq_ctl = 0ull;
+	struct otx_ep_droq *droq = otx_ep->droq[oq_no];
+
+	/* Wait on IDLE to set to 1, supposed to configure BADDR
+	 * as log as IDLE is 0
+	 */
+	reg_val = otx2_read64(otx_ep->hw_addr + SDP_VF_R_OUT_CONTROL(oq_no));
+
+	while (!(reg_val & SDP_VF_R_OUT_CTL_IDLE)) {
+		reg_val = otx2_read64(otx_ep->hw_addr +
+				      SDP_VF_R_OUT_CONTROL(oq_no));
+	}
+
+	otx2_write64(droq->desc_ring_dma, otx_ep->hw_addr +
+		     SDP_VF_R_OUT_SLIST_BADDR(oq_no));
+	otx2_write64(droq->nb_desc, otx_ep->hw_addr +
+		     SDP_VF_R_OUT_SLIST_RSIZE(oq_no));
+
+	oq_ctl = otx2_read64(otx_ep->hw_addr + SDP_VF_R_OUT_CONTROL(oq_no));
+
+	/* Clear the ISIZE and BSIZE (22-0) */
+	oq_ctl &= ~(0x7fffffull);
+
+	/* Populate the BSIZE (15-0) */
+	oq_ctl |= (droq->buffer_size & 0xffff);
+
+#ifndef BUFPTR_ONLY_MODE
+	/* Populate ISIZE(22-16) */
+	oq_ctl |= ((OTX_EP_RH_SIZE << 16) & 0x7fffff);
+#endif
+	otx2_write64(oq_ctl, otx_ep->hw_addr + SDP_VF_R_OUT_CONTROL(oq_no));
+
+	/* Mapped address of the pkt_sent and pkts_credit regs */
+	droq->pkts_sent_reg = (uint8_t *)otx_ep->hw_addr +
+			      SDP_VF_R_OUT_CNTS(oq_no);
+	droq->pkts_credit_reg = (uint8_t *)otx_ep->hw_addr +
+				SDP_VF_R_OUT_SLIST_DBELL(oq_no);
+
+	rte_write64(0x3FFFFFFFFFFFFFUL,
+		    otx_ep->hw_addr + SDP_VF_R_OUT_INT_LEVELS(oq_no));

drivers/net/octeontx_ep/otx2_ep_vf.c otx2_vf_setup_device_regs(struct otx_ep_device *otx_ep) · line 181

Quoted 10 lines
drivers/net/octeontx_ep/otx2_ep_vf.c +10 -0
+
+	/* Clear PKT_CNT register */
+	rte_write64(0xFFFFFFFFF, (uint8_t *)otx_ep->hw_addr +
+		    SDP_VF_R_OUT_PKT_CNT(oq_no));
+
+	/* Clear the OQ doorbell  */
+	rte_write32(0xFFFFFFFF, droq->pkts_credit_reg);
+	while ((rte_read32(droq->pkts_credit_reg) != 0ull)) {
+		rte_write32(0xFFFFFFFF, droq->pkts_credit_reg);
+		rte_delay_ms(1);

There are multiple hardcoded values in this function, better to convert to defines as much as possible.

<...>

drivers/net/octeontx_ep/otx_ep_vf.h line 10

Quoted 8 lines
drivers/net/octeontx_ep/otx_ep_vf.h +4 -0
@@ -4,13 +4,38 @@
  #ifndef _OTX_EP_VF_H_
  #define _OTX_EP_VF_H_
 
+
+
+
+

extra space?

#18 lore raw

PATCH v2 9/11 net/octeontx_ep: Added dev start and stop

In reply to Nalla Pradeep

Dev start and stop operations are added. To accomplish this internal functions to enable or disable io queues are incorporated.

---
 drivers/net/octeontx_ep/otx2_ep_vf.c    | 107 ++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_common.h |  11 ++
 drivers/net/octeontx_ep/otx_ep_ethdev.c |  48 +++++++++
 drivers/net/octeontx_ep/otx_ep_vf.c     | 128 ++++++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_vf.h     |   4 +
 5 files changed, 298 insertions(+)
drivers/net/octeontx_ep/otx2_ep_vf.c +107 -0
index 77850bcc7d..036bd6766c 100644
@@ -199,6 +199,104 @@ otx2_vf_setup_oq_regs(struct otx_ep_device *otx_ep, uint32_t oq_no)
 		   rte_read32(droq->pkts_sent_reg));
 }
 
+static int
+otx2_vf_enable_iq(struct otx_ep_device *otx_ep, uint32_t q_no)
+{
+	uint64_t loop = SDP_VF_BUSY_LOOP_COUNT;
+	uint64_t reg_val = 0ull;
+
+	/* Resetting doorbells during IQ enabling also to handle abrupt
+	 * guest reboot. IQ reset does not clear the doorbells.
+	 */
+	otx2_write64(0xFFFFFFFF, otx_ep->hw_addr +
+		     SDP_VF_R_IN_INSTR_DBELL(q_no));
+
+	while (((otx2_read64(otx_ep->hw_addr +
+		 SDP_VF_R_IN_INSTR_DBELL(q_no))) != 0ull) && loop--) {
+		rte_delay_ms(1);
+	}
+
+	if (!loop) {
+		otx_ep_err("INSTR DBELL not coming back to 0\n");
+		return -EIO;
+	}
+
+	reg_val = otx2_read64(otx_ep->hw_addr + SDP_VF_R_IN_ENABLE(q_no));
+	reg_val |= 0x1ull;
+
+	otx2_write64(reg_val, otx_ep->hw_addr + SDP_VF_R_IN_ENABLE(q_no));
+
+	otx2_info("IQ[%d] enable done", q_no);
+
+	return 0;
+}
+
+static int
+otx2_vf_enable_oq(struct otx_ep_device *otx_ep, uint32_t q_no)
+{
+	uint64_t reg_val = 0ull;
+
+	reg_val = otx2_read64(otx_ep->hw_addr + SDP_VF_R_OUT_ENABLE(q_no));
+	reg_val |= 0x1ull;
+	otx2_write64(reg_val, otx_ep->hw_addr + SDP_VF_R_OUT_ENABLE(q_no));
+
+	otx2_info("OQ[%d] enable done", q_no);
+
+	return 0;
+}
+
+static int
+otx2_vf_enable_io_queues(struct otx_ep_device *otx_ep)
+{
+	uint32_t q_no = 0;
+	int ret;
+
+	for (q_no = 0; q_no < otx_ep->nb_tx_queues; q_no++) {
+		ret = otx2_vf_enable_iq(otx_ep, q_no);
+		if (ret)
+			return ret;
+	}
+
+	for (q_no = 0; q_no < otx_ep->nb_rx_queues; q_no++)
+		otx2_vf_enable_oq(otx_ep, q_no);
+
+	return 0;
+}
+
+static void
+otx2_vf_disable_iq(struct otx_ep_device *otx_ep, uint32_t q_no)
+{
+	uint64_t reg_val = 0ull;
+
+	/* Reset the doorbell register for this Input Queue. */
+	reg_val = otx2_read64(otx_ep->hw_addr + SDP_VF_R_IN_ENABLE(q_no));
+	reg_val &= ~0x1ull;
+
+	otx2_write64(reg_val, otx_ep->hw_addr + SDP_VF_R_IN_ENABLE(q_no));
+}
+
+static void
+otx2_vf_disable_oq(struct otx_ep_device *otx_ep, uint32_t q_no)
+{
+	volatile uint64_t reg_val = 0ull;
+
+	reg_val = otx2_read64(otx_ep->hw_addr + SDP_VF_R_OUT_ENABLE(q_no));
+	reg_val &= ~0x1ull;
+
+	otx2_write64(reg_val, otx_ep->hw_addr + SDP_VF_R_OUT_ENABLE(q_no));
+}
+
+static void
+otx2_vf_disable_io_queues(struct otx_ep_device *otx_ep)
+{
+	uint32_t q_no = 0;
+
+	for (q_no = 0; q_no < otx_ep->sriov_info.rings_per_vf; q_no++) {
+		otx2_vf_disable_iq(otx_ep, q_no);
+		otx2_vf_disable_oq(otx_ep, q_no);
+	}
+}
+
 static const struct otx_ep_config default_otx2_ep_conf = {
 	/* IQ attributes */
 	.iq                        = {
@@ -258,5 +356,14 @@ otx2_ep_vf_setup_device(struct otx_ep_device *otx_ep)
 
 	otx_ep->fn_list.setup_device_regs   = otx2_vf_setup_device_regs;
 
+	otx_ep->fn_list.enable_io_queues    = otx2_vf_enable_io_queues;
+	otx_ep->fn_list.disable_io_queues   = otx2_vf_disable_io_queues;
+
+	otx_ep->fn_list.enable_iq           = otx2_vf_enable_iq;
+	otx_ep->fn_list.disable_iq          = otx2_vf_disable_iq;
+
+	otx_ep->fn_list.enable_oq           = otx2_vf_enable_oq;
+	otx_ep->fn_list.disable_oq          = otx2_vf_disable_oq;
+
 	return 0;
 }
drivers/net/octeontx_ep/otx_ep_common.h +11 -0
index 966e87a417..27a85d9b99 100644
@@ -19,6 +19,8 @@
 #define OTX_EP_PCI_RING_ALIGN   65536
 #define SDP_PKIND 40
 #define SDP_OTX2_PKIND 57
+#define OTX_EP_BUSY_LOOP_COUNT      (10000)
+
 #define OTX_EP_MAX_IOQS_PER_VF 8
 #define otx_ep_printf(level, fmt, args...)		\
 	rte_log(RTE_LOG_ ## level, RTE_LOGTYPE_PMD,		\
@@ -362,7 +364,14 @@ struct otx_ep_fn_list {
 
 	int (*setup_device_regs)(struct otx_ep_device *otx_ep);
 
+	int (*enable_io_queues)(struct otx_ep_device *otx_ep);
 	void (*disable_io_queues)(struct otx_ep_device *otx_ep);
+
+	int (*enable_iq)(struct otx_ep_device *otx_ep, uint32_t q_no);
+	void (*disable_iq)(struct otx_ep_device *otx_ep, uint32_t q_no);
+
+	int (*enable_oq)(struct otx_ep_device *otx_ep, uint32_t q_no);
+	void (*disable_oq)(struct otx_ep_device *otx_ep, uint32_t q_no);
 };
 
 /* SRIOV information */
@@ -417,6 +426,8 @@ struct otx_ep_device {
 	/* Device configuration */
 	const struct otx_ep_config *conf;
 
+	int started;
+
 	int port_configured;
 
 	uint64_t rx_offloads;
drivers/net/octeontx_ep/otx_ep_ethdev.c +48 -0

66 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_vf.c +128 -0

139 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_vf.h +4 -0
index 50a61352a2..fa08141b2b 100644
@@ -12,6 +12,7 @@
 
 /* OTX_EP VF IQ Registers */
 #define OTX_EP_R_IN_CONTROL_START         (0x10000)
+#define OTX_EP_R_IN_ENABLE_START          (0x10010)
 #define OTX_EP_R_IN_INSTR_BADDR_START     (0x10020)
 #define OTX_EP_R_IN_INSTR_RSIZE_START     (0x10030)
 #define OTX_EP_R_IN_INSTR_DBELL_START     (0x10040)
@@ -21,6 +22,9 @@
 #define OTX_EP_R_IN_CONTROL(ring)  \
 	(OTX_EP_R_IN_CONTROL_START + ((ring) * OTX_EP_RING_OFFSET))
 
+#define OTX_EP_R_IN_ENABLE(ring)   \
+	(OTX_EP_R_IN_ENABLE_START + ((ring) * OTX_EP_RING_OFFSET))
+
 #define OTX_EP_R_IN_INSTR_BADDR(ring)   \
 	(OTX_EP_R_IN_INSTR_BADDR_START + ((ring) * OTX_EP_RING_OFFSET))
 
Signature · 1 line
2.17.1
#19 lore raw

Re: [dpdk-dev] [PATCH v2 09/11] net/octeontx_ep: Added dev start and stop

Quoted 4 lines · Nalla Pradeep

Dev start and stop operations are added. To accomplish this internal functions to enable or disable io queues are incorporated.

<...>

Quoted 17 lines
drivers/net/octeontx_ep/otx_ep_ethdev.c +17 -0
+static int
+otx_ep_dev_start(struct rte_eth_dev *eth_dev)
+{
+	struct otx_ep_device *otx_epvf;
+	unsigned int q;
+	int ret;
+
+	otx_epvf = (struct otx_ep_device *)OTX_EP_DEV(eth_dev);
+	/* Enable IQ/OQ for this device */
+	ret = otx_epvf->fn_list.enable_io_queues(otx_epvf);
+	if (ret) {
+		otx_ep_err("IOQ enable failed\n");
+		return ret;
+	}
+
+	for (q = 0; q < otx_epvf->nb_rx_queues; q++) {
+		rte_write32(otx_epvf->droq[q]->nb_desc,

drivers/net/octeontx_ep/otx_ep_ethdev.c otx_ep_dev_info_get(struct rte_eth_dev *eth_dev, · line 90

Quoted 10 lines
drivers/net/octeontx_ep/otx_ep_ethdev.c +10 -0
+			    otx_epvf->droq[q]->pkts_credit_reg);
+
+		rte_wmb();
+		otx_ep_info("OQ[%d] dbells [%d]\n", q,
+		rte_read32(otx_epvf->droq[q]->pkts_credit_reg));
+	}
+
+	otx_epvf->started = 1;
+
+	rte_wmb();

is this memory barrier required, isn't the one in the loop should be enough? And no ones seems reading the 'started'.

Quoted 5 lines
drivers/net/octeontx_ep/otx_ep_ethdev.c +5 -0
+	otx_ep_info("dev started\n");
+
+	return 0;
+}
+

<...>

#20 lore raw

PATCH v2 10/11 net/octeontx_ep: Receive data path function added

In reply to Nalla Pradeep

Function to deliver packets from DROQ to application is added. It also fills DROQ with receive buffers timely such that device can fill them with incoming packets.

---
 drivers/net/octeontx_ep/otx_ep_common.h |   3 +
 drivers/net/octeontx_ep/otx_ep_ethdev.c |   3 +
 drivers/net/octeontx_ep/otx_ep_rxtx.c   | 297 +++++++++++++++++++++++-
 drivers/net/octeontx_ep/otx_ep_rxtx.h   |  12 +-
 4 files changed, 313 insertions(+), 2 deletions(-)
drivers/net/octeontx_ep/otx_ep_common.h +3 -0
index 27a85d9b99..22598f9969 100644
@@ -22,6 +22,9 @@
 #define OTX_EP_BUSY_LOOP_COUNT      (10000)
 
 #define OTX_EP_MAX_IOQS_PER_VF 8
+
+#define OTX_CUST_DATA_LEN 0
+
 #define otx_ep_printf(level, fmt, args...)		\
 	rte_log(RTE_LOG_ ## level, RTE_LOGTYPE_PMD,		\
 		 fmt, ##args)
drivers/net/octeontx_ep/otx_ep_ethdev.c +3 -0
index e617e7b80c..23899bc129 100644
@@ -151,6 +151,7 @@ otx_epdev_init(struct otx_ep_device *otx_epvf)
 		goto setup_fail;
 	}
 
+	otx_epvf->eth_dev->rx_pkt_burst = &otx_ep_recv_pkts;
 	ethdev_queues = (uint32_t)(otx_epvf->sriov_info.rings_per_vf);
 	otx_epvf->max_rx_queues = ethdev_queues;
 	otx_epvf->max_tx_queues = ethdev_queues;
@@ -411,6 +412,8 @@ otx_ep_eth_dev_uninit(struct rte_eth_dev *eth_dev)
 		rte_free(eth_dev->data->mac_addrs);
 
 	eth_dev->dev_ops = NULL;
+	eth_dev->rx_pkt_burst = NULL;
+	eth_dev->tx_pkt_burst = NULL;
 
 	return 0;
 }
drivers/net/octeontx_ep/otx_ep_rxtx.c +296 -1

318 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_rxtx.h +11 -1
index 269ecbe1a7..669446fa4a 100644
@@ -7,4 +7,14 @@
 
 #define OTX_EP_RXD_ALIGN 1
 #define OTX_EP_TXD_ALIGN 1
-#endif
+#define OTX_EP_MAX_DELAYED_PKT_RETRIES 10000
+static inline uint32_t
+otx_ep_incr_index(uint32_t index, uint32_t count, uint32_t max)
+{
+	return ((index + count) & (max - 1));
+}
+uint16_t
+otx_ep_recv_pkts(void *rx_queue,
+		  struct rte_mbuf **rx_pkts,
+		  uint16_t budget);
+#endif /* _OTX_EP_RXTX_H_ */
Signature · 1 line
2.17.1
#21 lore raw

Re: [dpdk-dev] [PATCH v2 10/11] net/octeontx_ep: Receive data path function added

Quoted 5 lines · Nalla Pradeep

Function to deliver packets from DROQ to application is added. It also fills DROQ with receive buffers timely such that device can fill them with incoming packets.

<...>

drivers/net/octeontx_ep/otx_ep_rxtx.c otx_ep_init_droq(struct otx_ep_device *otx_ep, uint32_t q_no, · line 337

Quoted 7 lines
drivers/net/octeontx_ep/otx_ep_rxtx.c +2 -1
@@ -327,7 +333,8 @@ otx_ep_init_droq(struct otx_ep_device *otx_ep, uint32_t q_no,
  /* OQ configuration and setup */
  int
  otx_ep_setup_oqs(struct otx_ep_device *otx_ep, int oq_no, int num_descs,
-	       int desc_size, struct rte_mempool *mpool, unsigned int socket_id)
+		 int desc_size, struct rte_mempool *mpool,
+		 unsigned int socket_id)

Again can you please fix these were it is first introduced?

<...>

Quoted 30 lines
drivers/net/octeontx_ep/otx_ep_rxtx.c +30 -0
+/* Check for response arrival from OCTEON TX2
+ * returns number of requests completed
+ */
+uint16_t
+otx_ep_recv_pkts(void *rx_queue,
+		  struct rte_mbuf **rx_pkts,
+		  uint16_t budget)
+{
+	struct otx_ep_droq *droq = rx_queue;
+	struct otx_ep_device *otx_ep;
+	struct rte_mbuf *oq_pkt;
+
+	uint32_t pkts = 0;
+	uint32_t new_pkts = 0;
+	int next_fetch;
+
+	otx_ep = droq->otx_ep_dev;
+
+	if (droq->pkts_pending > budget) {
+		new_pkts = budget;
+	} else {
+		new_pkts = droq->pkts_pending;
+		new_pkts += otx_ep_check_droq_pkts(droq);
+		if (new_pkts > budget)
+			new_pkts = budget;
+	}
+	if (!new_pkts) {
+		/* otx_ep_dbg("Zero new_pkts:%d\n", new_pkts); */
+		goto update_credit; /* No pkts at this moment */
+	}

drivers/net/octeontx_ep/otx_ep_rxtx.c otx_ep_setup_oqs(struct otx_ep_device *otx_ep, int oq_no, int num_descs, · line 609

Quoted 10 lines
drivers/net/octeontx_ep/otx_ep_rxtx.c +10 -0
+
+	/* otx_ep_dbg("Received new_pkts = %d\n", new_pkts); */
+
+	for (pkts = 0; pkts < new_pkts; pkts++) {
+		/* Push the received pkt to application */
+		next_fetch = (pkts == new_pkts - 1) ? 0 : 1;
+		oq_pkt = otx_ep_droq_read_packet(otx_ep, droq, next_fetch);
+		if (!oq_pkt) {
+			otx_ep_err("DROQ read pkt failed pending %lu last_pkt_count %lu new_pkts %d.\n",
+				   droq->pkts_pending, droq->last_pkt_count,

Both 'pkts_pending' & 'last_pkt_count' are 64bit and using '%lu' format specifier breaks the build for 32bit:

error: format ‘%lu’ expects argument of type ‘long unsigned int’, but
argument 4 has type ‘uint64_t’ {aka ‘long long unsigned int’} [-Werror=format=]

Can you please use 'PRIu64' instead?

#22 lore raw

PATCH v2 11/11 net/octeontx_ep: Transmit data path function added

In reply to Nalla Pradeep

1. Packet transmit function for both otx and otx2 are added.
2. Flushing transmit(command) queue when pending commands are more than maximum allowed value (currently 16).
3. Scatter gather support if the packet spans multiple buffers.

---
 drivers/net/octeontx_ep/otx2_ep_vf.h    |  19 +
 drivers/net/octeontx_ep/otx_ep_common.h |  51 +++
 drivers/net/octeontx_ep/otx_ep_ethdev.c |   5 +
 drivers/net/octeontx_ep/otx_ep_rxtx.c   | 448 +++++++++++++++++++++++-
 drivers/net/octeontx_ep/otx_ep_rxtx.h   |  26 ++
 drivers/net/octeontx_ep/otx_ep_vf.h     |  68 ++++
 6 files changed, 615 insertions(+), 2 deletions(-)
drivers/net/octeontx_ep/otx2_ep_vf.h +19 -0
index 0d7c6e8e17..9f37ab8728 100644
@@ -7,5 +7,24 @@
 int
 otx2_ep_vf_setup_device(struct otx_ep_device *sdpvf);
 
+struct otx2_ep_instr_64B {
+	/* Pointer where the input data is available. */
+	uint64_t dptr;
+
+	/* OTX_EP Instruction Header. */
+	union otx_ep_instr_ih ih;
+
+	/** Pointer where the response for a RAW mode packet
+	 * will be written by OCTEON TX.
+	 */
+	uint64_t rptr;
+
+	/* Input Request Header. */
+	union otx_ep_instr_irh irh;
+
+	/* Additional headers available in a 64-byte instruction. */
+	uint64_t exhdr[4];
+};
+
 #endif /*_OTX2_EP_VF_H_ */
 
drivers/net/octeontx_ep/otx_ep_common.h +51 -0

73 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_ethdev.c +5 -0
index 23899bc129..a0296db1f6 100644
@@ -152,6 +152,11 @@ otx_epdev_init(struct otx_ep_device *otx_epvf)
 	}
 
 	otx_epvf->eth_dev->rx_pkt_burst = &otx_ep_recv_pkts;
+	if (otx_epvf->chip_id == PCI_DEVID_OCTEONTX_EP_VF)
+		otx_epvf->eth_dev->tx_pkt_burst = &otx_ep_xmit_pkts;
+	else if (otx_epvf->chip_id == PCI_DEVID_OCTEONTX2_EP_NET_VF ||
+		 otx_epvf->chip_id == PCI_DEVID_CN98XX_EP_NET_VF)
+		otx_epvf->eth_dev->tx_pkt_burst = &otx2_ep_xmit_pkts;
 	ethdev_queues = (uint32_t)(otx_epvf->sriov_info.rings_per_vf);
 	otx_epvf->max_rx_queues = ethdev_queues;
 	otx_epvf->max_tx_queues = ethdev_queues;
drivers/net/octeontx_ep/otx_ep_rxtx.c +446 -2

460 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_rxtx.h +26 -0
index 669446fa4a..09172ecd68 100644
@@ -5,15 +5,41 @@
 #ifndef _OTX_EP_RXTX_H_
 #define _OTX_EP_RXTX_H_
 
+#include <rte_byteorder.h>
+
 #define OTX_EP_RXD_ALIGN 1
 #define OTX_EP_TXD_ALIGN 1
+
+#define OTX_EP_IQ_SEND_FAILED      (-1)
+#define OTX_EP_IQ_SEND_SUCCESS     (0)
+
 #define OTX_EP_MAX_DELAYED_PKT_RETRIES 10000
+
+#define OTX_EP_FSZ 28
+#define OTX2_EP_FSZ 24
+#define OTX_EP_MAX_INSTR 16
+
+static inline void
+otx_ep_swap_8B_data(uint64_t *data, uint32_t blocks)
+{
+	/* Swap 8B blocks */
+	while (blocks) {
+		*data = rte_bswap64(*data);
+		blocks--;
+		data++;
+	}
+}
+
 static inline uint32_t
 otx_ep_incr_index(uint32_t index, uint32_t count, uint32_t max)
 {
 	return ((index + count) & (max - 1));
 }
 uint16_t
+otx_ep_xmit_pkts(void *tx_queue, struct rte_mbuf **pkts, uint16_t nb_pkts);
+uint16_t
+otx2_ep_xmit_pkts(void *tx_queue, struct rte_mbuf **pkts, uint16_t nb_pkts);
+uint16_t
 otx_ep_recv_pkts(void *rx_queue,
 		  struct rte_mbuf **rx_pkts,
 		  uint16_t budget);
drivers/net/octeontx_ep/otx_ep_vf.h +68 -0

74 lines not on this page · raw message

Signature · 1 line
2.17.1
#23 lore raw

Re: [dpdk-dev] [PATCH v2 11/11] net/octeontx_ep: Transmit data path function added

Quoted 6 lines · Nalla Pradeep

1. Packet transmit function for both otx and otx2 are added.
2. Flushing transmit(command) queue when pending commands are more than maximum allowed value (currently 16).
3. Scatter gather support if the packet spans multiple buffers.

<...>

Quoted 12 lines
drivers/net/octeontx_ep/otx_ep_rxtx.c +12 -0
+uint16_t
+otx_ep_xmit_pkts(void *tx_queue, struct rte_mbuf **pkts, uint16_t nb_pkts)
+{
+	struct otx_ep_instr_64B iqcmd;
+	struct otx_ep_instr_queue *iq;
+	struct otx_ep_device *otx_ep;
+	struct rte_mbuf *m;
+
+	uint32_t iqreq_type, sgbuf_sz;
+	int dbell, index, count = 0;
+	unsigned int pkt_len, i;
+	int gather, gsz;

drivers/net/octeontx_ep/otx_ep_rxtx.c otx_ep_setup_oqs(struct otx_ep_device *otx_ep, int oq_no, int num_descs, · line 542

Quoted 10 lines
drivers/net/octeontx_ep/otx_ep_rxtx.c +10 -0
+	void *iqreq_buf;
+	uint64_t dptr;
+
+	iq = (struct otx_ep_instr_queue *)tx_queue;
+	otx_ep = iq->otx_ep_dev;
+
+	/* if (!otx_ep->started || !otx_ep->linkup) {
+	 *	goto xmit_fail;
+	 * }
+	 */

Please drop the commented out code.

Quoted 78 lines
drivers/net/octeontx_ep/otx_ep_rxtx.c +78 -0
+
+	iqcmd.ih.u64 = 0;
+	iqcmd.pki_ih3.u64 = 0;
+	iqcmd.irh.u64 = 0;
+
+	/* ih invars */
+	iqcmd.ih.s.fsz = OTX_EP_FSZ;
+	iqcmd.ih.s.pkind = otx_ep->pkind; /* The SDK decided PKIND value */
+
+	/* pki ih3 invars */
+	iqcmd.pki_ih3.s.w = 1;
+	iqcmd.pki_ih3.s.utt = 1;
+	iqcmd.pki_ih3.s.tagtype = ORDERED_TAG;
+	/* sl will be sizeof(pki_ih3) */
+	iqcmd.pki_ih3.s.sl = OTX_EP_FSZ + OTX_CUST_DATA_LEN;
+
+	/* irh invars */
+	iqcmd.irh.s.opcode = OTX_EP_NW_PKT_OP;
+
+	for (i = 0; i < nb_pkts; i++) {
+		m = pkts[i];
+		if (m->nb_segs == 1) {
+			/* dptr */
+			dptr = rte_mbuf_data_iova(m);
+			pkt_len = rte_pktmbuf_data_len(m);
+			iqreq_buf = m;
+			iqreq_type = OTX_EP_REQTYPE_NORESP_NET;
+			gather = 0;
+			gsz = 0;
+		} else {
+			struct otx_ep_buf_free_info *finfo;
+			int j, frags, num_sg;
+
+			if (!(otx_ep->tx_offloads & DEV_TX_OFFLOAD_MULTI_SEGS))
+				goto xmit_fail;
+
+			finfo = (struct otx_ep_buf_free_info *)rte_malloc(NULL,
+							sizeof(*finfo), 0);
+			if (finfo == NULL) {
+				otx_ep_err("free buffer alloc failed\n");
+				goto xmit_fail;
+			}
+			num_sg = (m->nb_segs + 3) / 4;
+			sgbuf_sz = sizeof(struct otx_ep_sg_entry) * num_sg;
+			finfo->g.sg =
+				rte_zmalloc(NULL, sgbuf_sz, OTX_EP_SG_ALIGN);
+			if (finfo->g.sg == NULL) {
+				rte_free(finfo);
+				otx_ep_err("sg entry alloc failed\n");
+				goto xmit_fail;
+			}
+			gather = 1;
+			gsz = m->nb_segs;
+			finfo->g.num_sg = num_sg;
+			finfo->g.sg[0].ptr[0] = rte_mbuf_data_iova(m);
+			set_sg_size(&finfo->g.sg[0], m->data_len, 0);
+			pkt_len = m->data_len;
+			finfo->mbuf = m;
+
+			frags = m->nb_segs - 1;
+			j = 1;
+			m = m->next;
+			while (frags--) {
+				finfo->g.sg[(j >> 2)].ptr[(j & 3)] =
+						rte_mbuf_data_iova(m);
+				set_sg_size(&finfo->g.sg[(j >> 2)],
+						m->data_len, (j & 3));
+				pkt_len += m->data_len;
+				j++;
+				m = m->next;
+			}
+			dptr = rte_mem_virt2iova(finfo->g.sg);
+			iqreq_buf = finfo;
+			iqreq_type = OTX_EP_REQTYPE_NORESP_GATHER;
+			if (pkt_len > OTX_EP_MAX_PKT_SZ) {
+				rte_free(finfo->g.sg);
+				rte_free(finfo);
+				otx_ep_err("failed\n");

drivers/net/octeontx_ep/otx_ep_rxtx.c otx_ep_setup_oqs(struct otx_ep_device *otx_ep, int oq_no, int num_descs, · line 630

Quoted 10 lines
drivers/net/octeontx_ep/otx_ep_rxtx.c +10 -0
+				goto xmit_fail;
+			}
+		}
+		/* ih vars */
+		iqcmd.ih.s.tlen = pkt_len + iqcmd.ih.s.fsz;
+		iqcmd.ih.s.gather = gather;
+		iqcmd.ih.s.gsz = gsz;
+		/* PKI_IH3 vars */
+		/* irh vars */
+		/* irh.rlenssz = ; */

Ditto.

drivers/net/octeontx_ep/otx_ep_rxtx.c otx_ep_setup_oqs(struct otx_ep_device *otx_ep, int oq_no, int num_descs, · line 636

Quoted 6 lines
drivers/net/octeontx_ep/otx_ep_rxtx.c +6 -0
+
+		iqcmd.dptr = dptr;
+		/* Swap FSZ(front data) here, to avoid swapping on
+		 * OCTEON TX side rprt is not used so not swapping
+		 */
+		/* otx_ep_swap_8B_data(&iqcmd.rptr, 1); */

ditto

<...>

drivers/net/octeontx_ep/otx_ep_vf.h line 170

Quoted 3 lines
drivers/net/octeontx_ep/otx_ep_vf.h +3 -0
+};
+#define OTX_EP_64B_INSTR_SIZE	(sizeof(otx_ep_instr_64B))
+

Is this macro used at all?

#24 lore raw
In reply to Nalla Pradeep
Quoted 16 lines · Nalla Pradeep

Adding bare minimum PMD library and doc build infrastructure and claim the maintainership for octeontx end point PMD.

---
 MAINTAINERS                              |  9 +++++++
 doc/guides/nics/features/octeontx_ep.ini |  8 ++++++
 doc/guides/nics/index.rst                |  1 +
 doc/guides/nics/octeontx_ep.rst          | 32 ++++++++++++++++++++++++
 drivers/net/meson.build                  |  1 +
 drivers/net/octeontx_ep/meson.build      |  8 ++++++
 drivers/net/octeontx_ep/otx_ep_ethdev.c  |  3 +++
 drivers/net/octeontx_ep/version.map      |  4 +++
 8 files changed, 66 insertions(+)

doc/guides/nics/octeontx_ep.rst line 30

Quoted 4 lines
doc/guides/nics/octeontx_ep.rst new file +4 -0
+
+The following options may be modified in the ``config`` file.
+
+- ``CONFIG_RTE_LIBRTE_OCTEONTX_EP_PMD`` (default ``y``)

Stale stuff. Not valid for meson.

Quoted 20 lines
(quoted diff) +2 -0
+
+  Toggle compilation of the ``librte_pmd_octeontx_ep`` driver.
drivers/net/meson.build +1 -0
index 4948500aef..007f6d889b 100644
@@ -39,6 +39,7 @@ drivers = ['af_packet',
        'null',
        'octeontx',
        'octeontx2',
+       'octeontx_ep',
        'pcap',
        'pfe',
        'qede',
drivers/net/octeontx_ep/meson.build new file +0 -0
new file mode 100644
index 0000000000..83ffbad7b6

drivers/net/octeontx_ep/meson.build line 2

Quoted 2 lines
drivers/net/octeontx_ep/meson.build new file +2 -0
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(C) 2020 Marvell.

Change the copyright to 2021

Quoted 21 lines
drivers/net/octeontx_ep/meson.build new file +6 -0
+#
+
+sources = files(
+               'otx_ep_ethdev.c',
+               )
+
drivers/net/octeontx_ep/otx_ep_ethdev.c new file +3 -0
new file mode 100644
index 0000000000..2b2d684a0b
@@ -0,0 +1,3 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2020 Marvell.
+ */
drivers/net/octeontx_ep/version.map new file +0 -0
new file mode 100644
index 0000000000..f4db678dd5

drivers/net/octeontx_ep/version.map line 1

Quoted 1 line
drivers/net/octeontx_ep/version.map new file +1 -0
@@ -0,0 +1,4 @@
+DPDK_20.0 {

21

Quoted 6 lines
drivers/net/octeontx_ep/version.map new file +3 -1
+
+        local: *;
+};
--

2.17.1

#25 lore raw
In reply to Nalla Pradeep
Quoted 4 lines · Nalla Pradeep

Adding bare minimum PMD library and doc build infrastructure and claim the maintainership for octeontx end point PMD.

<...>

doc/guides/nics/features/octeontx_ep.ini line 7

Quoted 8 lines
doc/guides/nics/features/octeontx_ep.ini new file +7 -0
@@ -0,0 +1,8 @@
+;
+; Supported features of the 'octeontx_ep' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Linux VFIO           = Y

This feature name has been updated, can you please rebase on top of latest next-net for it.

Also can you please set the supported architectures.

<...>

doc/guides/nics/octeontx_ep.rst line 12

Quoted 13 lines
doc/guides/nics/octeontx_ep.rst new file +12 -0
@@ -0,0 +1,32 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(C) 2020 Marvell.
+
+OCTEON TX EP Poll Mode driver
+===========================
+
+The OCTEON TX EP ETHDEV PMD (**librte_pmd_octeontx_ep**) provides poll mode
+ethdev driver support for the virtual functions (VF) of **Marvell OCTEON TX2**
+and **Cavium OCTEON TX** families of adapters in SR-IOV context.
+
+More information can be found at `Marvell Official Website
+<https://www.marvell.com/embedded-processors/infrastructure-processors>`_.

This link leads to a very generic product page, is there a way to provide the link for the product this driver is for?

doc/guides/nics/octeontx_ep.rst line 18

Quoted 6 lines
doc/guides/nics/octeontx_ep.rst new file +6 -0
+
+Features
+--------
+
+Features of the OCTEON TX EP Ethdev PMD are:
+

Above 'Features' block can be added when a featre is added.

doc/guides/nics/octeontx_ep.rst line 24

Quoted 6 lines
doc/guides/nics/octeontx_ep.rst new file +6 -0
+
+Prerequisites
+-------------
+
+See :doc:`../platform/octeontx2` and `../platform/octeontx` for setup information.
+

Since this is a VF driver, there must be a dependency to the PF driver, can you please provide more details on the PF driver.
As far as I understand both octeontx & octeontx2 are supported but please give more details about dependency. I assume there must be some host drivers for the endpoint PF, etc..

doc/guides/nics/octeontx_ep.rst line 32

Quoted 8 lines
doc/guides/nics/octeontx_ep.rst new file +8 -0
+Compile time Config Options
+---------------------------
+
+The following options may be modified in the ``config`` file.
+
+- ``CONFIG_RTE_LIBRTE_OCTEONTX_EP_PMD`` (default ``y``)
+
+  Toggle compilation of the ``librte_pmd_octeontx_ep`` driver.

I think the config option is not more exists, please drop it.

<...>

drivers/net/octeontx_ep/version.map line 1

Quoted 3 lines

+++ b/drivers/net/octeontx_ep/version.map

drivers/net/octeontx_ep/version.map new file +1 -0
@@ -0,0 +1,4 @@
+DPDK_20.0 {

It should be 'DPDK_21'

Quoted 4 lines
drivers/net/octeontx_ep/version.map new file +3 -0
+
+        local: *;
+};
#26 lore raw
In reply to Nalla Pradeep
Quoted 4 lines · Nalla Pradeep

Adding bare minimum PMD library and doc build infrastructure and claim the maintainership for octeontx end point PMD.

For the series,

First of all sorry for the late review, I put some comments on some patches.

Overall the set looks clean, there seems no major issue, I hope changes can be done on time for -rc2.

If there is a timing concern for updates, I am OK to postpone some parts to -rc3 as long as they are committed to be completed for -rc3, let say like for adding dynamic logging support etc...

Please be aware of the 32bit build error, details in the relative patch.

Thanks,
ferruh

#27 lore raw

PATCH v5 1/11 net/octeontx_ep: add build and doc infrastructure

In reply to Nalla Pradeep

Adding bare minimum PMD library and doc build infrastructure and claim the maintainership for octeontx end point PMD.

---
 MAINTAINERS                              |  9 ++++++++
 doc/guides/nics/features/octeontx_ep.ini | 10 +++++++++
 doc/guides/nics/index.rst                |  1 +
 doc/guides/nics/octeontx_ep.rst          | 27 ++++++++++++++++++++++++
 drivers/net/meson.build                  |  1 +
 drivers/net/octeontx_ep/meson.build      |  8 +++++++
 drivers/net/octeontx_ep/otx_ep_ethdev.c  |  3 +++
 drivers/net/octeontx_ep/version.map      |  3 +++
 8 files changed, 62 insertions(+)
 create mode 100644 doc/guides/nics/features/octeontx_ep.ini
 create mode 100644 doc/guides/nics/octeontx_ep.rst
 create mode 100644 drivers/net/octeontx_ep/meson.build
 create mode 100644 drivers/net/octeontx_ep/otx_ep_ethdev.c
 create mode 100644 drivers/net/octeontx_ep/version.map
MAINTAINERS +9 -0
index 1a12916f5..2c589ffca 100644
@@ -763,6 +763,15 @@ T: git://dpdk.org/next/dpdk-next-crypto
 F: drivers/common/octeontx2/otx2_sec*
 F: drivers/net/octeontx2/otx2_ethdev_sec*
 
+Marvell OCTEON TX EP - endpoint
+M: Nalla Pradeep <[email protected]>
+M: Radha Mohan Chintakuntla <[email protected]>
+M: Veerasenareddy Burru <[email protected]>
+T: git://dpdk.org/next/dpdk-next-net-mrvl
+F: drivers/net/octeontx_ep/
+F: doc/guides/nics/features/octeontx_ep.ini
+F: doc/guides/nics/octeontx_ep.rst
+
 Mellanox mlx4
 M: Matan Azrad <[email protected]>
 M: Shahaf Shuler <[email protected]>
doc/guides/nics/features/octeontx_ep.ini new file +10 -0
new file mode 100644
index 000000000..660fbc287
@@ -0,0 +1,10 @@
+;
+; Supported features of the 'octeontx_ep' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+SR-IOV               = Y
+Linux                = Y
+x86-64               = Y
+Usage doc            = Y
doc/guides/nics/index.rst +1 -0
index 344361775..799697caf 100644
@@ -50,6 +50,7 @@ Network Interface Controller Drivers
     null
     octeontx
     octeontx2
+    octeontx_ep
     pfe
     qede
     sfc_efx
doc/guides/nics/octeontx_ep.rst new file +27 -0
new file mode 100644
index 000000000..766a4a6b1
@@ -0,0 +1,27 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(C) 2021 Marvell.
+
+OCTEON TX EP Poll Mode driver
+===========================
+
+The OCTEON TX EP ETHDEV PMD (**librte_pmd_octeontx_ep**) provides poll mode
+ethdev driver support for the virtual functions (VF) of **Marvell OCTEON TX2**
+and **Cavium OCTEON TX** families of adapters in SR-IOV context.
+
+More information can be found at `Marvell Official Website
+<https://www.marvell.com/content/dam/marvell/en/public-collateral/embedded-processors/marvell-liquidio-III-solutions-brief.pdf>`_.
+
+
+Prerequisites
+-------------
+
+This driver relies on external kernel PF driver for resources allocations
+and initialization. The following dependencies are not part of DPDK and
+must be installed separately:
+
+- **Kernel module**
+  This module, octeon_drv, drives the physical function, initializes hardware,
+  allocates resources such as number of VFs, input/output queues for itself and
+  the number of i/o queues each VF can use.
+
+See :doc:`../platform/octeontx2` for SDP interface information which provides PCIe endpoint support for a remote host.
drivers/net/meson.build +1 -0
index 4cbca9641..fb9ff05a1 100644
@@ -39,6 +39,7 @@ drivers = ['af_packet',
 	'null',
 	'octeontx',
 	'octeontx2',
+	'octeontx_ep',
 	'pcap',
 	'pfe',
 	'qede',
drivers/net/octeontx_ep/meson.build new file +8 -0
new file mode 100644
index 000000000..2ef2222d2
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(C) 2021 Marvell.
+#
+
+sources = files(
+               'otx_ep_ethdev.c',
+               )
+
drivers/net/octeontx_ep/otx_ep_ethdev.c new file +3 -0
new file mode 100644
index 000000000..603023b0d
@@ -0,0 +1,3 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
drivers/net/octeontx_ep/version.map new file +3 -0
new file mode 100644
index 000000000..6e4fb220a
@@ -0,0 +1,3 @@
+DPDK_21 {
+        local: *;
+};
Signature · 1 line
2.17.1
#28 lore raw

v5 cover Octeon Tx/Tx2 Endpoint pmd

In reply to Nalla Pradeep

This patch set contains PMD with minimal set of operations that can drive both Octeon Tx and Tx2 in endpoint.

v2:
Fixed review comments from sburla at marvell
v3:
Fixed review comments from jerinj at marvell
v4:
Fixed MAITAINERS file
v5:
Fixed review comments from Ferruh yigit at intel

Nalla Pradeep (11):
net/octeontx_ep: add build and doc infrastructure net/octeontx_ep: add ethdev probe and remove net/octeontx_ep: add device init and uninit net/octeontx_ep: added basic device setup net/octeontx_ep: add dev info get and configure net/octeontx_ep: added rxq setup and release net/octeontx_ep: added tx queue setup and release net/octeontx_ep: setting up iq and oq registers net/octeontx_ep: added dev start and stop net/octeontx_ep: receive data path function added net/octeontx_ep: transmit data path function added

 MAINTAINERS                               |    9 +
 doc/guides/nics/features/octeontx_ep.ini  |   11 +
 doc/guides/nics/index.rst                 |    1 +
 doc/guides/nics/octeontx_ep.rst           |   27 +
 drivers/common/octeontx2/otx2_common.h    |    5 +-
 drivers/net/meson.build                   |    1 +
 drivers/net/octeontx_ep/meson.build       |   13 +
 drivers/net/octeontx_ep/otx2_ep_vf.c      |  358 +++++++
 drivers/net/octeontx_ep/otx2_ep_vf.h      |   30 +
 drivers/net/octeontx_ep/otx_ep_common.h   |  506 ++++++++++
 drivers/net/octeontx_ep/otx_ep_ethdev.c   |  466 +++++++++
 drivers/net/octeontx_ep/otx_ep_rxtx.c     | 1074 +++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_rxtx.h     |   46 +
 drivers/net/octeontx_ep/otx_ep_vf.c       |  396 ++++++++
 drivers/net/octeontx_ep/otx_ep_vf.h       |  168 ++++
 drivers/net/octeontx_ep/version.map       |    3 +
 drivers/raw/octeontx2_ep/otx2_ep_rawdev.c |    6 +-
 17 files changed, 3116 insertions(+), 4 deletions(-)
 create mode 100644 doc/guides/nics/features/octeontx_ep.ini
 create mode 100644 doc/guides/nics/octeontx_ep.rst
 create mode 100644 drivers/net/octeontx_ep/meson.build
 create mode 100644 drivers/net/octeontx_ep/otx2_ep_vf.c
 create mode 100644 drivers/net/octeontx_ep/otx2_ep_vf.h
 create mode 100644 drivers/net/octeontx_ep/otx_ep_common.h
 create mode 100644 drivers/net/octeontx_ep/otx_ep_ethdev.c
 create mode 100644 drivers/net/octeontx_ep/otx_ep_rxtx.c
 create mode 100644 drivers/net/octeontx_ep/otx_ep_rxtx.h
 create mode 100644 drivers/net/octeontx_ep/otx_ep_vf.c
 create mode 100644 drivers/net/octeontx_ep/otx_ep_vf.h
 create mode 100644 drivers/net/octeontx_ep/version.map
Signature · 1 line
2.17.1
#29 lore raw

v6 cover Octeon Tx/Tx2 Endpoint pmd

v2:
Fixed review comments from sburla at marvell
v3:
Fixed review comments from jerinj at marvell
v4:
Fixed MAITAINERS file
v5:
Fixed review comments from Ferruh yigit at intel
v6:
Created separate patch for octeontx_ep raw driver changes. Used pmd specific log types instead of 'RTE_LOGTYPE_PMD' Used proper function return values.

Nalla Pradeep (12):
raw/octeontx_ep: changed device id net/octeontx_ep: add build and doc infrastructure net/octeontx_ep: add ethdev probe and remove net/octeontx_ep: add device init and uninit net/octeontx_ep: added basic device setup net/octeontx_ep: add dev info get and configure net/octeontx_ep: added rxq setup and release net/octeontx_ep: added tx queue setup and release net/octeontx_ep: setting up iq and oq registers net/octeontx_ep: added dev start and stop net/octeontx_ep: receive data path function added net/octeontx_ep: transmit data path function added

 MAINTAINERS                               |    9 +
 doc/guides/nics/features/octeontx_ep.ini  |   11 +
 doc/guides/nics/index.rst                 |    1 +
 doc/guides/nics/octeontx_ep.rst           |   27 +
 drivers/common/octeontx2/otx2_common.h    |    5 +-
 drivers/net/meson.build                   |    1 +
 drivers/net/octeontx_ep/meson.build       |   13 +
 drivers/net/octeontx_ep/otx2_ep_vf.c      |  358 +++++++
 drivers/net/octeontx_ep/otx2_ep_vf.h      |   30 +
 drivers/net/octeontx_ep/otx_ep_common.h   |  510 ++++++++++
 drivers/net/octeontx_ep/otx_ep_ethdev.c   |  468 +++++++++
 drivers/net/octeontx_ep/otx_ep_rxtx.c     | 1064 +++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_rxtx.h     |   46 +
 drivers/net/octeontx_ep/otx_ep_vf.c       |  396 ++++++++
 drivers/net/octeontx_ep/otx_ep_vf.h       |  168 ++++
 drivers/net/octeontx_ep/version.map       |    3 +
 drivers/raw/octeontx2_ep/otx2_ep_rawdev.c |    6 +-
 17 files changed, 3112 insertions(+), 4 deletions(-)
 create mode 100644 doc/guides/nics/features/octeontx_ep.ini
 create mode 100644 doc/guides/nics/octeontx_ep.rst
 create mode 100644 drivers/net/octeontx_ep/meson.build
 create mode 100644 drivers/net/octeontx_ep/otx2_ep_vf.c
 create mode 100644 drivers/net/octeontx_ep/otx2_ep_vf.h
 create mode 100644 drivers/net/octeontx_ep/otx_ep_common.h
 create mode 100644 drivers/net/octeontx_ep/otx_ep_ethdev.c
 create mode 100644 drivers/net/octeontx_ep/otx_ep_rxtx.c
 create mode 100644 drivers/net/octeontx_ep/otx_ep_rxtx.h
 create mode 100644 drivers/net/octeontx_ep/otx_ep_vf.c
 create mode 100644 drivers/net/octeontx_ep/otx_ep_vf.h
 create mode 100644 drivers/net/octeontx_ep/version.map
Signature · 1 line
2.17.1
#30 lore raw

v7 cover Octeon Tx/Tx2 Endpoint pmd

v2:
Fixed review comments from sburla at marvell
v3:
Fixed review comments from jerinj at marvell
v4:
Fixed MAITAINERS file
v5:
Fixed review comments from Ferruh yigit at intel
v6:
Created separate patch for octeontx_ep raw driver changes. Used pmd specific log types instead of 'RTE_LOGTYPE_PMD' Used proper function return values.
v7:
Fixed dynamic logging.

Nalla Pradeep (12):
raw/octeontx_ep: changed device id net/octeontx_ep: add build and doc infrastructure net/octeontx_ep: add ethdev probe and remove net/octeontx_ep: add device init and uninit net/octeontx_ep: added basic device setup net/octeontx_ep: add dev info get and configure net/octeontx_ep: added rxq setup and release net/octeontx_ep: added tx queue setup and release net/octeontx_ep: setting up iq and oq registers net/octeontx_ep: added dev start and stop net/octeontx_ep: receive data path function added net/octeontx_ep: transmit data path function added

 MAINTAINERS                               |    9 +
 doc/guides/nics/features/octeontx_ep.ini  |   11 +
 doc/guides/nics/index.rst                 |    1 +
 doc/guides/nics/octeontx_ep.rst           |   27 +
 drivers/common/octeontx2/otx2_common.h    |    5 +-
 drivers/net/meson.build                   |    1 +
 drivers/net/octeontx_ep/meson.build       |   13 +
 drivers/net/octeontx_ep/otx2_ep_vf.c      |  358 +++++++
 drivers/net/octeontx_ep/otx2_ep_vf.h      |   30 +
 drivers/net/octeontx_ep/otx_ep_common.h   |  508 ++++++++++
 drivers/net/octeontx_ep/otx_ep_ethdev.c   |  466 +++++++++
 drivers/net/octeontx_ep/otx_ep_rxtx.c     | 1064 +++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_rxtx.h     |   46 +
 drivers/net/octeontx_ep/otx_ep_vf.c       |  396 ++++++++
 drivers/net/octeontx_ep/otx_ep_vf.h       |  168 ++++
 drivers/net/octeontx_ep/version.map       |    3 +
 drivers/raw/octeontx2_ep/otx2_ep_rawdev.c |    6 +-
 17 files changed, 3108 insertions(+), 4 deletions(-)
 create mode 100644 doc/guides/nics/features/octeontx_ep.ini
 create mode 100644 doc/guides/nics/octeontx_ep.rst
 create mode 100644 drivers/net/octeontx_ep/meson.build
 create mode 100644 drivers/net/octeontx_ep/otx2_ep_vf.c
 create mode 100644 drivers/net/octeontx_ep/otx2_ep_vf.h
 create mode 100644 drivers/net/octeontx_ep/otx_ep_common.h
 create mode 100644 drivers/net/octeontx_ep/otx_ep_ethdev.c
 create mode 100644 drivers/net/octeontx_ep/otx_ep_rxtx.c
 create mode 100644 drivers/net/octeontx_ep/otx_ep_rxtx.h
 create mode 100644 drivers/net/octeontx_ep/otx_ep_vf.c
 create mode 100644 drivers/net/octeontx_ep/otx_ep_vf.h
 create mode 100644 drivers/net/octeontx_ep/version.map
Signature · 1 line
2.17.1
Reviewed-by on the v7 series
#31 lore raw

Re: [dpdk-dev] [PATCH v7 00/12] Octeon Tx/Tx2 Endpoint pmd

Quoted 15 lines · Nalla Pradeep

v2:
Fixed review comments from sburla at marvell
v3:
Fixed review comments from jerinj at marvell
v4:
Fixed MAITAINERS file
v5:
Fixed review comments from Ferruh yigit at intel
v6:
Created separate patch for octeontx_ep raw driver changes. Used pmd specific log types instead of 'RTE_LOGTYPE_PMD' Used proper function return values.
v7:
Fixed dynamic logging.

Quoted 14 lines

Nalla Pradeep (12):
raw/octeontx_ep: changed device id net/octeontx_ep: add build and doc infrastructure net/octeontx_ep: add ethdev probe and remove net/octeontx_ep: add device init and uninit net/octeontx_ep: added basic device setup net/octeontx_ep: add dev info get and configure net/octeontx_ep: added rxq setup and release net/octeontx_ep: added tx queue setup and release net/octeontx_ep: setting up iq and oq registers net/octeontx_ep: added dev start and stop net/octeontx_ep: receive data path function added net/octeontx_ep: transmit data path function added

For series,

Series applied to dpdk-next-net/main, thanks.

I have put a few comment related to '%l" log format specifiers, all "%ll.*[xud]" format specifiers can be eliminated unless the variable is really "long [long] ...". I think a new version not required for this, and better to get the series for -rc2, but can you please send a patch to cleanup, preferably before the -rc3?

Thanks,
ferruh

#32 lore raw

PATCH v7 1/12 raw/octeontx_ep: changed device id

In reply to Nalla Pradeep

Device id to be probed by octeontx_ep raw device pmd is changed from B203 to B204. B203 is for octeontx_ep net device pmd to probe.

---
 drivers/common/octeontx2/otx2_common.h    | 3 ++-
 drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 6 +++---
 2 files changed, 5 insertions(+), 4 deletions(-)
drivers/common/octeontx2/otx2_common.h +2 -1
index b6779f710..4938fb295 100644
@@ -136,7 +136,8 @@ extern int otx2_logtype_ree;
 #define PCI_DEVID_OCTEONTX2_RVU_CPT_VF		0xA0FE
 #define PCI_DEVID_OCTEONTX2_RVU_AF_VF		0xA0f8
 #define PCI_DEVID_OCTEONTX2_DPI_VF		0xA081
-#define PCI_DEVID_OCTEONTX2_EP_VF		0xB203 /* OCTEON TX2 EP mode */
+#define PCI_DEVID_OCTEONTX2_EP_NET_VF		0xB203 /* OCTEON TX2 EP mode */
+#define PCI_DEVID_OCTEONTX2_EP_RAW_VF		0xB204 /* OCTEON TX2 EP mode */
 #define PCI_DEVID_OCTEONTX2_RVU_SDP_PF		0xA0f6
 #define PCI_DEVID_OCTEONTX2_RVU_SDP_VF		0xA0f7
 #define PCI_DEVID_OCTEONTX2_RVU_REE_PF		0xA0f4
drivers/raw/octeontx2_ep/otx2_ep_rawdev.c +3 -3
index 2b78a7941..b2ccdda83 100644
@@ -22,7 +22,7 @@
 static const struct rte_pci_id pci_sdp_vf_map[] = {
 	{
 		RTE_PCI_DEVICE(PCI_VENDOR_ID_CAVIUM,
-			       PCI_DEVID_OCTEONTX2_EP_VF)
+			       PCI_DEVID_OCTEONTX2_EP_RAW_VF)
 	},
 	{
 		.vendor_id = 0,
@@ -109,8 +109,8 @@ sdp_chip_specific_setup(struct sdp_device *sdpvf)
 	int ret;
 
 	switch (dev_id) {
-	case PCI_DEVID_OCTEONTX2_EP_VF:
-		sdpvf->chip_id = PCI_DEVID_OCTEONTX2_EP_VF;
+	case PCI_DEVID_OCTEONTX2_EP_RAW_VF:
+		sdpvf->chip_id = PCI_DEVID_OCTEONTX2_EP_RAW_VF;
 		ret = sdp_vf_setup_device(sdpvf);
 
 		break;
Signature · 1 line
2.17.1
Acked-by Radha Mohan Chintakuntla on v7 1/12
#33 lore raw

Re: [dpdk-dev] [PATCH v7 01/12] raw/octeontx_ep: changed device id

Quoted 49 lines · Nalla Pradeep

Device id to be probed by octeontx_ep raw device pmd is changed from B203 to B204. B203 is for octeontx_ep net device pmd to probe.

---
 drivers/common/octeontx2/otx2_common.h    | 3 ++-
 drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 6 +++---
 2 files changed, 5 insertions(+), 4 deletions(-)
drivers/common/octeontx2/otx2_common.h +2 -1
index b6779f710..4938fb295 100644
@@ -136,7 +136,8 @@ extern int otx2_logtype_ree;
 #define PCI_DEVID_OCTEONTX2_RVU_CPT_VF         0xA0FE
 #define PCI_DEVID_OCTEONTX2_RVU_AF_VF          0xA0f8
 #define PCI_DEVID_OCTEONTX2_DPI_VF             0xA081
-#define PCI_DEVID_OCTEONTX2_EP_VF              0xB203 /* OCTEON TX2 EP mode */
+#define PCI_DEVID_OCTEONTX2_EP_NET_VF          0xB203 /* OCTEON TX2 EP mode */
+#define PCI_DEVID_OCTEONTX2_EP_RAW_VF          0xB204 /* OCTEON TX2 EP mode */
 #define PCI_DEVID_OCTEONTX2_RVU_SDP_PF         0xA0f6
 #define PCI_DEVID_OCTEONTX2_RVU_SDP_VF         0xA0f7
 #define PCI_DEVID_OCTEONTX2_RVU_REE_PF         0xA0f4
drivers/raw/octeontx2_ep/otx2_ep_rawdev.c +3 -4
index 2b78a7941..b2ccdda83 100644
@@ -22,7 +22,7 @@
 static const struct rte_pci_id pci_sdp_vf_map[] = {
        {
                RTE_PCI_DEVICE(PCI_VENDOR_ID_CAVIUM,
-                              PCI_DEVID_OCTEONTX2_EP_VF)
+                              PCI_DEVID_OCTEONTX2_EP_RAW_VF)
        },
        {
                .vendor_id = 0,
@@ -109,8 +109,8 @@ sdp_chip_specific_setup(struct sdp_device *sdpvf)
        int ret;
 
        switch (dev_id) {
-       case PCI_DEVID_OCTEONTX2_EP_VF:
-               sdpvf->chip_id = PCI_DEVID_OCTEONTX2_EP_VF;
+       case PCI_DEVID_OCTEONTX2_EP_RAW_VF:
+               sdpvf->chip_id = PCI_DEVID_OCTEONTX2_EP_RAW_VF;
                ret = sdp_vf_setup_device(sdpvf);
 
                break;
--
Quoted 2 lines

2.17.1

#34 lore raw

PATCH v7 2/12 net/octeontx_ep: add build and doc infrastructure

In reply to Nalla Pradeep

Adding bare minimum PMD library and doc build infrastructure and claim the maintainership for octeontx end point PMD.

---
 MAINTAINERS                              |  9 ++++++++
 doc/guides/nics/features/octeontx_ep.ini | 10 +++++++++
 doc/guides/nics/index.rst                |  1 +
 doc/guides/nics/octeontx_ep.rst          | 27 ++++++++++++++++++++++++
 drivers/net/meson.build                  |  1 +
 drivers/net/octeontx_ep/meson.build      |  8 +++++++
 drivers/net/octeontx_ep/otx_ep_ethdev.c  |  3 +++
 drivers/net/octeontx_ep/version.map      |  3 +++
 8 files changed, 62 insertions(+)
 create mode 100644 doc/guides/nics/features/octeontx_ep.ini
 create mode 100644 doc/guides/nics/octeontx_ep.rst
 create mode 100644 drivers/net/octeontx_ep/meson.build
 create mode 100644 drivers/net/octeontx_ep/otx_ep_ethdev.c
 create mode 100644 drivers/net/octeontx_ep/version.map
MAINTAINERS +9 -0
index 1a12916f5..2c589ffca 100644
@@ -763,6 +763,15 @@ T: git://dpdk.org/next/dpdk-next-crypto
 F: drivers/common/octeontx2/otx2_sec*
 F: drivers/net/octeontx2/otx2_ethdev_sec*
 
+Marvell OCTEON TX EP - endpoint
+M: Nalla Pradeep <[email protected]>
+M: Radha Mohan Chintakuntla <[email protected]>
+M: Veerasenareddy Burru <[email protected]>
+T: git://dpdk.org/next/dpdk-next-net-mrvl
+F: drivers/net/octeontx_ep/
+F: doc/guides/nics/features/octeontx_ep.ini
+F: doc/guides/nics/octeontx_ep.rst
+
 Mellanox mlx4
 M: Matan Azrad <[email protected]>
 M: Shahaf Shuler <[email protected]>
doc/guides/nics/features/octeontx_ep.ini new file +10 -0
new file mode 100644
index 000000000..660fbc287
@@ -0,0 +1,10 @@
+;
+; Supported features of the 'octeontx_ep' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+SR-IOV               = Y
+Linux                = Y
+x86-64               = Y
+Usage doc            = Y
doc/guides/nics/index.rst +1 -0
index 344361775..799697caf 100644
@@ -50,6 +50,7 @@ Network Interface Controller Drivers
     null
     octeontx
     octeontx2
+    octeontx_ep
     pfe
     qede
     sfc_efx
doc/guides/nics/octeontx_ep.rst new file +27 -0
new file mode 100644
index 000000000..766a4a6b1
@@ -0,0 +1,27 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(C) 2021 Marvell.
+
+OCTEON TX EP Poll Mode driver
+===========================
+
+The OCTEON TX EP ETHDEV PMD (**librte_pmd_octeontx_ep**) provides poll mode
+ethdev driver support for the virtual functions (VF) of **Marvell OCTEON TX2**
+and **Cavium OCTEON TX** families of adapters in SR-IOV context.
+
+More information can be found at `Marvell Official Website
+<https://www.marvell.com/content/dam/marvell/en/public-collateral/embedded-processors/marvell-liquidio-III-solutions-brief.pdf>`_.
+
+
+Prerequisites
+-------------
+
+This driver relies on external kernel PF driver for resources allocations
+and initialization. The following dependencies are not part of DPDK and
+must be installed separately:
+
+- **Kernel module**
+  This module, octeon_drv, drives the physical function, initializes hardware,
+  allocates resources such as number of VFs, input/output queues for itself and
+  the number of i/o queues each VF can use.
+
+See :doc:`../platform/octeontx2` for SDP interface information which provides PCIe endpoint support for a remote host.
drivers/net/meson.build +1 -0
index 4cbca9641..fb9ff05a1 100644
@@ -39,6 +39,7 @@ drivers = ['af_packet',
 	'null',
 	'octeontx',
 	'octeontx2',
+	'octeontx_ep',
 	'pcap',
 	'pfe',
 	'qede',
drivers/net/octeontx_ep/meson.build new file +8 -0
new file mode 100644
index 000000000..2ef2222d2
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(C) 2021 Marvell.
+#
+
+sources = files(
+               'otx_ep_ethdev.c',
+               )
+
drivers/net/octeontx_ep/otx_ep_ethdev.c new file +3 -0
new file mode 100644
index 000000000..603023b0d
@@ -0,0 +1,3 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
drivers/net/octeontx_ep/version.map new file +3 -0
new file mode 100644
index 000000000..6e4fb220a
@@ -0,0 +1,3 @@
+DPDK_21 {
+        local: *;
+};
Signature · 1 line
2.17.1
#35 lore raw

PATCH v7 3/12 net/octeontx_ep: add ethdev probe and remove

In reply to Nalla Pradeep

add basic PCIe ethdev probe and remove.

---
 drivers/common/octeontx2/otx2_common.h  |  2 +
 drivers/net/octeontx_ep/meson.build     |  2 +
 drivers/net/octeontx_ep/otx_ep_common.h | 14 ++++++
 drivers/net/octeontx_ep/otx_ep_ethdev.c | 57 +++++++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_vf.h     |  9 ++++
 5 files changed, 84 insertions(+)
 create mode 100644 drivers/net/octeontx_ep/otx_ep_common.h
 create mode 100644 drivers/net/octeontx_ep/otx_ep_vf.h
drivers/common/octeontx2/otx2_common.h +2 -0
index 4938fb295..cd52e098e 100644
@@ -137,6 +137,8 @@ extern int otx2_logtype_ree;
 #define PCI_DEVID_OCTEONTX2_RVU_AF_VF		0xA0f8
 #define PCI_DEVID_OCTEONTX2_DPI_VF		0xA081
 #define PCI_DEVID_OCTEONTX2_EP_NET_VF		0xB203 /* OCTEON TX2 EP mode */
+/* OCTEON TX2 98xx EP mode */
+#define PCI_DEVID_CN98XX_EP_NET_VF		0xB103
 #define PCI_DEVID_OCTEONTX2_EP_RAW_VF		0xB204 /* OCTEON TX2 EP mode */
 #define PCI_DEVID_OCTEONTX2_RVU_SDP_PF		0xA0f6
 #define PCI_DEVID_OCTEONTX2_RVU_SDP_VF		0xA0f7
drivers/net/octeontx_ep/meson.build +2 -0
index 2ef2222d2..73e04b0be 100644
@@ -2,7 +2,9 @@
 # Copyright(C) 2021 Marvell.
 #
 
+deps += ['common_octeontx2']
 sources = files(
                'otx_ep_ethdev.c',
                )
 
+includes += include_directories('../../common/octeontx2')
drivers/net/octeontx_ep/otx_ep_common.h new file +14 -0
new file mode 100644
index 000000000..35ea99a79
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+#ifndef _OTX_EP_COMMON_H_
+#define _OTX_EP_COMMON_H_
+
+/* OTX_EP EP VF device data structure */
+struct otx_ep_device {
+	/* PCI device pointer */
+	struct rte_pci_device *pdev;
+
+	struct rte_eth_dev *eth_dev;
+};
+#endif  /* _OTX_EP_COMMON_H_ */
drivers/net/octeontx_ep/otx_ep_ethdev.c +57 -0

60 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_vf.h new file +9 -0
new file mode 100644
index 000000000..e88b40971
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+#ifndef _OTX_EP_VF_H_
+#define _OTX_EP_VF_H_
+
+#define PCI_DEVID_OCTEONTX_EP_VF 0xa303
+
+#endif /*_OTX_EP_VF_H_ */
Signature · 1 line
2.17.1
#36 lore raw

PATCH v7 4/12 net/octeontx_ep: add device init and uninit

In reply to Nalla Pradeep

Add basic init and uninit function which includes
initializing fields of ethdev private structure.

---
 drivers/net/octeontx_ep/otx_ep_common.h | 22 +++++++-
 drivers/net/octeontx_ep/otx_ep_ethdev.c | 72 +++++++++++++++++++++++--
 2 files changed, 88 insertions(+), 6 deletions(-)
drivers/net/octeontx_ep/otx_ep_common.h +21 -1
index 35ea99a79..9bf14540b 100644
@@ -4,11 +4,31 @@
 #ifndef _OTX_EP_COMMON_H_
 #define _OTX_EP_COMMON_H_
 
+#define otx_ep_info(fmt, args...)				\
+	rte_log(RTE_LOG_INFO, otx_net_ep_logtype,		\
+		"%s():%u " fmt "\n",				\
+		__func__, __LINE__, ##args)
+
+#define otx_ep_err(fmt, args...)				\
+	rte_log(RTE_LOG_ERR, otx_net_ep_logtype,		\
+		"%s():%u " fmt "\n",				\
+		__func__, __LINE__, ##args)
+
+#define otx_ep_dbg(fmt, args...)				\
+	rte_log(RTE_LOG_DEBUG, otx_net_ep_logtype,		\
+		"%s():%u " fmt "\n",				\
+		__func__, __LINE__, ##args)
+
 /* OTX_EP EP VF device data structure */
 struct otx_ep_device {
 	/* PCI device pointer */
 	struct rte_pci_device *pdev;
-
+	uint16_t chip_id;
 	struct rte_eth_dev *eth_dev;
+	int port_id;
+	/* Memory mapped h/w address */
+	uint8_t *hw_addr;
 };
+
+extern int otx_net_ep_logtype;
 #endif  /* _OTX_EP_COMMON_H_ */
drivers/net/octeontx_ep/otx_ep_ethdev.c +67 -5

90 lines not on this page · raw message

Signature · 1 line
2.17.1
#37 lore raw

PATCH v7 5/12 net/octeontx_ep: added basic device setup

In reply to Nalla Pradeep

Functions to setup device, basic input queue and output queue registers are added.

---
 drivers/net/octeontx_ep/meson.build     |   2 +
 drivers/net/octeontx_ep/otx2_ep_vf.c    | 131 +++++++++++++++++++++
 drivers/net/octeontx_ep/otx2_ep_vf.h    |  11 ++
 drivers/net/octeontx_ep/otx_ep_common.h |  92 +++++++++++++++
 drivers/net/octeontx_ep/otx_ep_ethdev.c |   7 ++
 drivers/net/octeontx_ep/otx_ep_vf.c     | 148 ++++++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_vf.h     |  33 ++++++
 7 files changed, 424 insertions(+)
 create mode 100644 drivers/net/octeontx_ep/otx2_ep_vf.c
 create mode 100644 drivers/net/octeontx_ep/otx2_ep_vf.h
 create mode 100644 drivers/net/octeontx_ep/otx_ep_vf.c
drivers/net/octeontx_ep/meson.build +2 -0
index 73e04b0be..8cd2e76d1 100644
@@ -5,6 +5,8 @@
 deps += ['common_octeontx2']
 sources = files(
                'otx_ep_ethdev.c',
+               'otx_ep_vf.c',
+               'otx2_ep_vf.c',
                )
 
 includes += include_directories('../../common/octeontx2')
drivers/net/octeontx_ep/otx2_ep_vf.c new file +131 -0

131 lines not on this page · raw message

drivers/net/octeontx_ep/otx2_ep_vf.h new file +11 -0
new file mode 100644
index 000000000..191fee426
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+#ifndef _OTX2_EP_VF_H_
+#define _OTX2_EP_VF_H_
+
+int
+otx2_ep_vf_setup_device(struct otx_ep_device *sdpvf);
+
+#endif /*_OTX2_EP_VF_H_ */
+
drivers/net/octeontx_ep/otx_ep_common.h +92 -0

113 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_ethdev.c +7 -0
index c672021e8..feb1335dd 100644
@@ -7,6 +7,7 @@
 #include "otx2_common.h"
 #include "otx_ep_common.h"
 #include "otx_ep_vf.h"
+#include "otx2_ep_vf.h"
 
 #define OTX_EP_DEV(_eth_dev)            ((_eth_dev)->data->dev_private)
 static int
@@ -19,10 +20,12 @@ otx_ep_chip_specific_setup(struct otx_ep_device *otx_epvf)
 	switch (dev_id) {
 	case PCI_DEVID_OCTEONTX_EP_VF:
 		otx_epvf->chip_id = dev_id;
+		ret = otx_ep_vf_setup_device(otx_epvf);
 		break;
 	case PCI_DEVID_OCTEONTX2_EP_NET_VF:
 	case PCI_DEVID_CN98XX_EP_NET_VF:
 		otx_epvf->chip_id = dev_id;
+		ret = otx2_ep_vf_setup_device(otx_epvf);
 		break;
 	default:
 		otx_ep_err("Unsupported device\n");
@@ -47,6 +50,10 @@ otx_epdev_init(struct otx_ep_device *otx_epvf)
 		goto setup_fail;
 	}
 
+	otx_epvf->fn_list.setup_device_regs(otx_epvf);
+
+	otx_ep_info("OTX_EP Device is Ready\n");
+
 setup_fail:
 	return ret;
 }
drivers/net/octeontx_ep/otx_ep_vf.c new file +148 -0

148 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_vf.h +33 -0
index e88b40971..c5741a3f1 100644
@@ -4,6 +4,39 @@
 #ifndef _OTX_EP_VF_H_
 #define _OTX_EP_VF_H_
 
+#define OTX_EP_RING_OFFSET                (0x1ull << 17)
+
+/* OTX_EP VF IQ Registers */
+#define OTX_EP_R_IN_CONTROL_START         (0x10000)
+#define OTX_EP_R_IN_CONTROL(ring)  \
+	(OTX_EP_R_IN_CONTROL_START + ((ring) * OTX_EP_RING_OFFSET))
+
+/* OTX_EP VF IQ Masks */
+#define OTX_EP_R_IN_CTL_RPVF_MASK       (0xF)
+#define	OTX_EP_R_IN_CTL_RPVF_POS        (48)
+
+#define OTX_EP_R_IN_CTL_IDLE            (0x1ull << 28)
+#define OTX_EP_R_IN_CTL_RDSIZE          (0x3ull << 25) /* Setting to max(4) */
+#define OTX_EP_R_IN_CTL_IS_64B          (0x1ull << 24)
+#define OTX_EP_R_IN_CTL_ESR             (0x1ull << 1)
+/* OTX_EP VF OQ Registers */
+#define OTX_EP_R_OUT_CONTROL_START           (0x10150)
+#define OTX_EP_R_OUT_CONTROL(ring)    \
+	(OTX_EP_R_OUT_CONTROL_START + ((ring) * OTX_EP_RING_OFFSET))
+/* OTX_EP VF OQ Masks */
+#define OTX_EP_R_OUT_CTL_ES_I         (1ull << 34)
+#define OTX_EP_R_OUT_CTL_NSR_I        (1ull << 33)
+#define OTX_EP_R_OUT_CTL_ROR_I        (1ull << 32)
+#define OTX_EP_R_OUT_CTL_ES_D         (1ull << 30)
+#define OTX_EP_R_OUT_CTL_NSR_D        (1ull << 29)
+#define OTX_EP_R_OUT_CTL_ROR_D        (1ull << 28)
+#define OTX_EP_R_OUT_CTL_ES_P         (1ull << 26)
+#define OTX_EP_R_OUT_CTL_NSR_P        (1ull << 25)
+#define OTX_EP_R_OUT_CTL_ROR_P        (1ull << 24)
+#define OTX_EP_R_OUT_CTL_IMODE        (1ull << 23)
+
 #define PCI_DEVID_OCTEONTX_EP_VF 0xa303
 
+int
+otx_ep_vf_setup_device(struct otx_ep_device *otx_ep);
 #endif /*_OTX_EP_VF_H_ */
Signature · 1 line
2.17.1
#38 lore raw

PATCH v7 6/12 net/octeontx_ep: add dev info get and configure

In reply to Nalla Pradeep

Add device information get and device configure operations.

---
 doc/guides/nics/features/octeontx_ep.ini |  1 +
 drivers/net/octeontx_ep/otx_ep_common.h  | 14 ++++
 drivers/net/octeontx_ep/otx_ep_ethdev.c  | 81 +++++++++++++++++++++++-
 drivers/net/octeontx_ep/otx_ep_rxtx.h    | 10 +++
 4 files changed, 105 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/octeontx_ep/otx_ep_rxtx.h
doc/guides/nics/features/octeontx_ep.ini +1 -0
index 660fbc287..d1453f5be 100644
@@ -4,6 +4,7 @@
 ; Refer to default.ini for the full list of available PMD features.
 ;
 [Features]
+Speed capabilities   = P
 SR-IOV               = Y
 Linux                = Y
 x86-64               = Y
drivers/net/octeontx_ep/otx_ep_common.h +14 -0
index c138c2dc7..4588a2936 100644
@@ -7,9 +7,12 @@
 #define OTX_EP_MAX_RINGS_PER_VF        (8)
 #define OTX_EP_CFG_IO_QUEUES        OTX_EP_MAX_RINGS_PER_VF
 #define OTX_EP_64BYTE_INSTR         (64)
+#define OTX_EP_MIN_IQ_DESCRIPTORS   (128)
+#define OTX_EP_MIN_OQ_DESCRIPTORS   (128)
 #define OTX_EP_MAX_IQ_DESCRIPTORS   (8192)
 #define OTX_EP_MAX_OQ_DESCRIPTORS   (8192)
 #define OTX_EP_OQ_BUF_SIZE          (2048)
+#define OTX_EP_MIN_RX_BUF_SIZE      (64)
 
 #define OTX_EP_OQ_INFOPTR_MODE      (0)
 #define OTX_EP_OQ_REFIL_THRESHOLD   (16)
@@ -115,12 +118,23 @@ struct otx_ep_device {
 
 	struct otx_ep_fn_list fn_list;
 
+	uint32_t max_tx_queues;
+
+	uint32_t max_rx_queues;
+
 	/* SR-IOV info */
 	struct otx_ep_sriov_info sriov_info;
 
 	/* Device configuration */
 	const struct otx_ep_config *conf;
+
+	uint64_t rx_offloads;
+
+	uint64_t tx_offloads;
 };
 
+#define OTX_EP_MAX_PKT_SZ 64000U
+#define OTX_EP_MAX_MAC_ADDRS 1
+
 extern int otx_net_ep_logtype;
 #endif  /* _OTX_EP_COMMON_H_ */
drivers/net/octeontx_ep/otx_ep_ethdev.c +80 -1

112 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_rxtx.h new file +10 -0
new file mode 100644
index 000000000..9779e96b6
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+
+#ifndef _OTX_EP_RXTX_H_
+#define _OTX_EP_RXTX_H_
+
+#define OTX_EP_RXD_ALIGN 1
+#define OTX_EP_TXD_ALIGN 1
+#endif
Signature · 1 line
2.17.1
#39 lore raw

PATCH v7 7/12 net/octeontx_ep: added rxq setup and release

In reply to Nalla Pradeep

Receive queue setup involves allocating memory for the queue, initializing data structure representing the queue and filling queue with receive buffers of rx descriptor count. Receive queues are referred as droq. Hardware fills the receive buffers in queue with the packet.

In receive queue release, receive buffers are freed along with the receive queue.

---
 drivers/net/octeontx_ep/meson.build     |   1 +
 drivers/net/octeontx_ep/otx_ep_common.h | 150 ++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_ethdev.c | 127 +++++++++++++-
 drivers/net/octeontx_ep/otx_ep_rxtx.c   | 222 ++++++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_vf.h     |   6 +
 5 files changed, 505 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/octeontx_ep/otx_ep_rxtx.c
drivers/net/octeontx_ep/meson.build +1 -0
index 8cd2e76d1..a8436f35f 100644
@@ -7,6 +7,7 @@ sources = files(
                'otx_ep_ethdev.c',
                'otx_ep_vf.c',
                'otx2_ep_vf.c',
+               'otx_ep_rxtx.c',
                )
 
 includes += include_directories('../../common/octeontx2')
drivers/net/octeontx_ep/otx_ep_common.h +150 -0

193 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_ethdev.c +126 -1

164 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_rxtx.c new file +222 -0

222 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_vf.h +6 -0
index c5741a3f1..d17c87909 100644
@@ -37,6 +37,12 @@
 
 #define PCI_DEVID_OCTEONTX_EP_VF 0xa303
 
+/* this is a static value set by SLI PF driver in octeon
+ * No handshake is available
+ * Change this if changing the value in SLI PF driver
+ */
+#define SDP_GBL_WMARK 0x100
+
 int
 otx_ep_vf_setup_device(struct otx_ep_device *otx_ep);
 #endif /*_OTX_EP_VF_H_ */
Signature · 1 line
2.17.1
#40 lore raw

Re: [dpdk-dev] [PATCH v7 07/12] net/octeontx_ep: added rxq setup and release

Quoted 9 lines · Nalla Pradeep

Receive queue setup involves allocating memory for the queue, initializing data structure representing the queue and filling queue with receive buffers of rx descriptor count. Receive queues are referred as droq. Hardware fills the receive buffers in queue with the packet.

In receive queue release, receive buffers are freed along with the receive queue.

<...>

drivers/net/octeontx_ep/otx_ep_rxtx.c line 163

Quoted 3 lines
drivers/net/octeontx_ep/otx_ep_rxtx.c new file +3 -0
+
+	otx_ep_dbg("OQ[%d]: desc_ring: virt: 0x%p, dma: %lx\n",
+		    q_no, droq->desc_ring, (unsigned long)droq->desc_ring_dma);

'desc_ring_dma' type is 'size_t', and the format specifier for it is '%zx', using correct specifier removes the need to cast.

#41 lore raw

PATCH v7 8/12 net/octeontx_ep: added tx queue setup and release

In reply to Nalla Pradeep

Transmit queue setup involves allocating memory for the command queue considering tx descriptor count and initializing data structure representing the queue. Transmit queue release function frees the command queue.

---
 drivers/net/octeontx_ep/otx_ep_common.h |  88 +++++++++++++++-
 drivers/net/octeontx_ep/otx_ep_ethdev.c |  81 +++++++++++++++
 drivers/net/octeontx_ep/otx_ep_rxtx.c   | 133 ++++++++++++++++++++++++
 3 files changed, 301 insertions(+), 1 deletion(-)
drivers/net/octeontx_ep/otx_ep_common.h +87 -1
index b31a6c675..493dbf8e1 100644
@@ -45,7 +45,21 @@
 	rte_write64(val, ((base_addr) + off)); \
 	}
 
-struct otx_ep_device;
+/* OTX_EP IQ request list */
+struct otx_ep_instr_list {
+	void *buf;
+	uint32_t reqtype;
+};
+#define OTX_EP_IQREQ_LIST_SIZE	(sizeof(struct otx_ep_instr_list))
+
+/* Input Queue statistics. Each input queue has four stats fields. */
+struct otx_ep_iq_stats {
+	uint64_t instr_posted; /* Instructions posted to this queue. */
+	uint64_t instr_processed; /* Instructions processed in this queue. */
+	uint64_t instr_dropped; /* Instructions that could not be processed */
+	uint64_t tx_pkts;
+	uint64_t tx_bytes;
+};
 
 /* Structure to define the configuration attributes for each Input queue. */
 struct otx_ep_iq_config {
@@ -59,6 +73,66 @@ struct otx_ep_iq_config {
 	uint32_t pending_list_size;
 };
 
+/** The instruction (input) queue.
+ *  The input queue is used to post raw (instruction) mode data or packet data
+ *  to OCTEON TX2 device from the host. Each IQ of a OTX_EP EP VF device has one
+ *  such structure to represent it.
+ */
+struct otx_ep_instr_queue {
+	struct otx_ep_device *otx_ep_dev;
+
+	uint32_t q_no;
+	uint32_t pkt_in_done;
+
+	/* Flag for 64 byte commands. */
+	uint32_t iqcmd_64B:1;
+	uint32_t rsvd:17;
+	uint32_t status:8;
+
+	/* Number of  descriptors in this ring. */
+	uint32_t nb_desc;
+
+	/* Input ring index, where the driver should write the next packet */
+	uint32_t host_write_index;
+
+	/* Input ring index, where the OCTEON TX2 should read the next packet */
+	uint32_t otx_read_index;
+
+	uint32_t reset_instr_cnt;
+
+	/** This index aids in finding the window in the queue where OCTEON TX2
+	 *  has read the commands.
+	 */
+	uint32_t flush_index;
+
+	/* This keeps track of the instructions pending in this queue. */
+	uint64_t instr_pending;
+
+	/* Pointer to the Virtual Base addr of the input ring. */
+	uint8_t *base_addr;
+
+	/* This IQ request list */
+	struct otx_ep_instr_list *req_list;
+
+	/* OTX_EP doorbell register for the ring. */
+	void *doorbell_reg;
+
+	/* OTX_EP instruction count register for this ring. */
+	void *inst_cnt_reg;
+
+	/* Number of instructions pending to be posted to OCTEON TX2. */
+	uint32_t fill_cnt;
+
+	/* Statistics for this input queue. */
+	struct otx_ep_iq_stats stats;
+
+	/* DMA mapped base address of the input descriptor ring. */
+	uint64_t base_addr_dma;
+
+	/* Memory zone */
+	const struct rte_memzone *iq_mz;
+};
+
 /** Descriptor format.
  *  The descriptor ring is made of descriptors which have 2 64-bit values:
  *  -# Physical (bus) address of the data buffer.
@@ -229,6 +303,8 @@ struct otx_ep_sriov_info {
 
 /* Required functions for each VF device */
 struct otx_ep_fn_list {
+	void (*setup_iq_regs)(struct otx_ep_device *otx_ep, uint32_t q_no);
+
 	void (*setup_oq_regs)(struct otx_ep_device *otx_ep, uint32_t q_no);
 
 	void (*setup_device_regs)(struct otx_ep_device *otx_ep);
@@ -258,6 +334,12 @@ struct otx_ep_device {
 
 	uint32_t max_rx_queues;
 
+	/* Num IQs */
+	uint32_t nb_tx_queues;
+
+	/* The input instruction queues */
+	struct otx_ep_instr_queue *instr_queue[OTX_EP_MAX_IOQS_PER_VF];
+
 	/* Num OQs */
 	uint32_t nb_rx_queues;
 
@@ -278,6 +360,10 @@ struct otx_ep_device {
 	uint64_t tx_offloads;
 };
 
+int otx_ep_setup_iqs(struct otx_ep_device *otx_ep, uint32_t iq_no,
+		     int num_descs, unsigned int socket_id);
+int otx_ep_delete_iqs(struct otx_ep_device *otx_ep, uint32_t iq_no);
+
 int otx_ep_setup_oqs(struct otx_ep_device *otx_ep, int oq_no, int num_descs,
 		     int desc_size, struct rte_mempool *mpool,
 		     unsigned int socket_id);
drivers/net/octeontx_ep/otx_ep_ethdev.c +81 -0

98 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_rxtx.c +133 -0

139 lines not on this page · raw message

Signature · 1 line
2.17.1
#42 lore raw

Re: [dpdk-dev] [PATCH v7 08/12] net/octeontx_ep: added tx queue setup and release

Quoted 6 lines · Nalla Pradeep

Transmit queue setup involves allocating memory for the command queue considering tx descriptor count and initializing data structure representing the queue. Transmit queue release function frees the command queue.

<...>

drivers/net/octeontx_ep/otx_ep_rxtx.c otx_ep_dmazone_free(const struct rte_memzone *mz) · line 116

Quoted 3 lines
drivers/net/octeontx_ep/otx_ep_rxtx.c +3 -0
+
+	otx_ep_info("IQ[%d]: base: %p basedma: %lx count: %d\n",
+		     iq_no, iq->base_addr, (unsigned long)iq->base_addr_dma,

'base_addr_dma' type is 'uint64_t', but isn't "unsigned long" 4 btyes in 32 bit? Better to use PRIx64 for 'uint64_t' instead of '%lx', and using it removes the need to cast.

#43 lore raw

PATCH v7 9/12 net/octeontx_ep: setting up iq and oq registers

In reply to Nalla Pradeep

Configuring hardware registers with command queue(iq) and driver output queue(oq) parameters.
List of parameters configured for IQ after making sure it is idle
1. Base address
2. Instruction size
3. Disabling interrupts for fastpath

List of parameters configured for OQ after making sure it is idle
1. Base address
2. Output buffer size
3. Clear output queue doorbell
4. Disable interrupts for fastpath

---
 drivers/net/octeontx_ep/otx2_ep_vf.c    | 120 ++++++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_common.h |  72 ++++++++++++++
 drivers/net/octeontx_ep/otx_ep_vf.c     | 120 ++++++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_vf.h     |  49 ++++++++++
 4 files changed, 361 insertions(+)
drivers/net/octeontx_ep/otx2_ep_vf.c +120 -0
index 6368ddc80..84de89ef7 100644
@@ -71,6 +71,123 @@ otx2_vf_setup_device_regs(struct otx_ep_device *otx_ep)
 	otx2_vf_setup_global_output_regs(otx_ep);
 }
 
+static void
+otx2_vf_setup_iq_regs(struct otx_ep_device *otx_ep, uint32_t iq_no)
+{
+	struct otx_ep_instr_queue *iq = otx_ep->instr_queue[iq_no];
+	volatile uint64_t reg_val = 0ull;
+
+	reg_val = otx2_read64(otx_ep->hw_addr + SDP_VF_R_IN_CONTROL(iq_no));
+
+	/* Wait till IDLE to set to 1, not supposed to configure BADDR
+	 * as long as IDLE is 0
+	 */
+	if (!(reg_val & SDP_VF_R_IN_CTL_IDLE)) {
+		do {
+			reg_val = otx2_read64(otx_ep->hw_addr +
+					      SDP_VF_R_IN_CONTROL(iq_no));
+		} while (!(reg_val & SDP_VF_R_IN_CTL_IDLE));
+	}
+
+	/* Write the start of the input queue's ring and its size  */
+	otx2_write64(iq->base_addr_dma, otx_ep->hw_addr +
+		     SDP_VF_R_IN_INSTR_BADDR(iq_no));
+	otx2_write64(iq->nb_desc, otx_ep->hw_addr +
+		     SDP_VF_R_IN_INSTR_RSIZE(iq_no));
+
+	/* Remember the doorbell & instruction count register addr
+	 * for this queue
+	 */
+	iq->doorbell_reg = (uint8_t *)otx_ep->hw_addr +
+			   SDP_VF_R_IN_INSTR_DBELL(iq_no);
+	iq->inst_cnt_reg = (uint8_t *)otx_ep->hw_addr +
+			   SDP_VF_R_IN_CNTS(iq_no);
+
+	otx_ep_dbg("InstQ[%d]:dbell reg @ 0x%p instcnt_reg @ 0x%p",
+		   iq_no, iq->doorbell_reg, iq->inst_cnt_reg);
+
+	do {
+		reg_val = rte_read32(iq->inst_cnt_reg);
+		rte_write32(reg_val, iq->inst_cnt_reg);
+	} while (reg_val != 0);
+
+	/* IN INTR_THRESHOLD is set to max(FFFFFFFF) which disable the IN INTR
+	 * to raise
+	 */
+	otx2_write64(OTX_EP_CLEAR_SDP_IN_INT_LVLS,
+		     otx_ep->hw_addr + SDP_VF_R_IN_INT_LEVELS(iq_no));
+}
+
+static void
+otx2_vf_setup_oq_regs(struct otx_ep_device *otx_ep, uint32_t oq_no)
+{
+	volatile uint64_t reg_val = 0ull;
+	uint64_t oq_ctl = 0ull;
+	struct otx_ep_droq *droq = otx_ep->droq[oq_no];
+
+	/* Wait on IDLE to set to 1, supposed to configure BADDR
+	 * as log as IDLE is 0
+	 */
+	reg_val = otx2_read64(otx_ep->hw_addr + SDP_VF_R_OUT_CONTROL(oq_no));
+
+	while (!(reg_val & SDP_VF_R_OUT_CTL_IDLE)) {
+		reg_val = otx2_read64(otx_ep->hw_addr +
+				      SDP_VF_R_OUT_CONTROL(oq_no));
+	}
+
+	otx2_write64(droq->desc_ring_dma, otx_ep->hw_addr +
+		     SDP_VF_R_OUT_SLIST_BADDR(oq_no));
+	otx2_write64(droq->nb_desc, otx_ep->hw_addr +
+		     SDP_VF_R_OUT_SLIST_RSIZE(oq_no));
+
+	oq_ctl = otx2_read64(otx_ep->hw_addr + SDP_VF_R_OUT_CONTROL(oq_no));
+
+	/* Clear the ISIZE and BSIZE (22-0) */
+	oq_ctl &= ~(OTX_EP_CLEAR_ISIZE_BSIZE);
+
+	/* Populate the BSIZE (15-0) */
+	oq_ctl |= (droq->buffer_size & OTX_EP_DROQ_BUFSZ_MASK);
+
+	otx2_write64(oq_ctl, otx_ep->hw_addr + SDP_VF_R_OUT_CONTROL(oq_no));
+
+	/* Mapped address of the pkt_sent and pkts_credit regs */
+	droq->pkts_sent_reg = (uint8_t *)otx_ep->hw_addr +
+			      SDP_VF_R_OUT_CNTS(oq_no);
+	droq->pkts_credit_reg = (uint8_t *)otx_ep->hw_addr +
+				SDP_VF_R_OUT_SLIST_DBELL(oq_no);
+
+	rte_write64(OTX_EP_CLEAR_OUT_INT_LVLS,
+		    otx_ep->hw_addr + SDP_VF_R_OUT_INT_LEVELS(oq_no));
+
+	/* Clear PKT_CNT register */
+	rte_write64(OTX_EP_CLEAR_SDP_OUT_PKT_CNT, (uint8_t *)otx_ep->hw_addr +
+		    SDP_VF_R_OUT_PKT_CNT(oq_no));
+
+	/* Clear the OQ doorbell  */
+	rte_write32(OTX_EP_CLEAR_SLIST_DBELL, droq->pkts_credit_reg);
+	while ((rte_read32(droq->pkts_credit_reg) != 0ull)) {
+		rte_write32(OTX_EP_CLEAR_SLIST_DBELL, droq->pkts_credit_reg);
+		rte_delay_ms(1);
+	}
+	otx_ep_dbg("SDP_R[%d]_credit:%x", oq_no,
+		   rte_read32(droq->pkts_credit_reg));
+
+	/* Clear the OQ_OUT_CNTS doorbell  */
+	reg_val = rte_read32(droq->pkts_sent_reg);
+	rte_write32((uint32_t)reg_val, droq->pkts_sent_reg);
+
+	otx_ep_dbg("SDP_R[%d]_sent: %x", oq_no,
+		   rte_read32(droq->pkts_sent_reg));
+
+	while (((rte_read32(droq->pkts_sent_reg)) != 0ull)) {
+		reg_val = rte_read32(droq->pkts_sent_reg);
+		rte_write32((uint32_t)reg_val, droq->pkts_sent_reg);
+		rte_delay_ms(1);
+	}
+	otx_ep_dbg("SDP_R[%d]_sent: %x", oq_no,
+		   rte_read32(droq->pkts_sent_reg));
+}
+
 static const struct otx_ep_config default_otx2_ep_conf = {
 	/* IQ attributes */
 	.iq                        = {
@@ -125,6 +242,9 @@ otx2_ep_vf_setup_device(struct otx_ep_device *otx_ep)
 
 	otx2_info("SDP RPVF: %d", otx_ep->sriov_info.rings_per_vf);
 
+	otx_ep->fn_list.setup_iq_regs       = otx2_vf_setup_iq_regs;
+	otx_ep->fn_list.setup_oq_regs       = otx2_vf_setup_oq_regs;
+
 	otx_ep->fn_list.setup_device_regs   = otx2_vf_setup_device_regs;
 
 	return 0;
drivers/net/octeontx_ep/otx_ep_common.h +72 -0

102 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_vf.c +120 -0

132 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_vf.h +49 -0

68 lines not on this page · raw message

Signature · 1 line
2.17.1
#44 lore raw

PATCH v7 10/12 net/octeontx_ep: added dev start and stop

In reply to Nalla Pradeep

Dev start and stop operations are added. To accomplish this internal functions to enable or disable io queues are incorporated.

---
 drivers/net/octeontx_ep/otx2_ep_vf.c    | 107 ++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_common.h |   8 ++
 drivers/net/octeontx_ep/otx_ep_ethdev.c |  44 ++++++++
 drivers/net/octeontx_ep/otx_ep_vf.c     | 128 ++++++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_vf.h     |   4 +
 5 files changed, 291 insertions(+)
drivers/net/octeontx_ep/otx2_ep_vf.c +107 -0
index 84de89ef7..64cd8731d 100644
@@ -188,6 +188,104 @@ otx2_vf_setup_oq_regs(struct otx_ep_device *otx_ep, uint32_t oq_no)
 		   rte_read32(droq->pkts_sent_reg));
 }
 
+static int
+otx2_vf_enable_iq(struct otx_ep_device *otx_ep, uint32_t q_no)
+{
+	uint64_t loop = SDP_VF_BUSY_LOOP_COUNT;
+	uint64_t reg_val = 0ull;
+
+	/* Resetting doorbells during IQ enabling also to handle abrupt
+	 * guest reboot. IQ reset does not clear the doorbells.
+	 */
+	otx2_write64(0xFFFFFFFF, otx_ep->hw_addr +
+		     SDP_VF_R_IN_INSTR_DBELL(q_no));
+
+	while (((otx2_read64(otx_ep->hw_addr +
+		 SDP_VF_R_IN_INSTR_DBELL(q_no))) != 0ull) && loop--) {
+		rte_delay_ms(1);
+	}
+
+	if (!loop) {
+		otx_ep_err("INSTR DBELL not coming back to 0\n");
+		return -EIO;
+	}
+
+	reg_val = otx2_read64(otx_ep->hw_addr + SDP_VF_R_IN_ENABLE(q_no));
+	reg_val |= 0x1ull;
+
+	otx2_write64(reg_val, otx_ep->hw_addr + SDP_VF_R_IN_ENABLE(q_no));
+
+	otx2_info("IQ[%d] enable done", q_no);
+
+	return 0;
+}
+
+static int
+otx2_vf_enable_oq(struct otx_ep_device *otx_ep, uint32_t q_no)
+{
+	uint64_t reg_val = 0ull;
+
+	reg_val = otx2_read64(otx_ep->hw_addr + SDP_VF_R_OUT_ENABLE(q_no));
+	reg_val |= 0x1ull;
+	otx2_write64(reg_val, otx_ep->hw_addr + SDP_VF_R_OUT_ENABLE(q_no));
+
+	otx2_info("OQ[%d] enable done", q_no);
+
+	return 0;
+}
+
+static int
+otx2_vf_enable_io_queues(struct otx_ep_device *otx_ep)
+{
+	uint32_t q_no = 0;
+	int ret;
+
+	for (q_no = 0; q_no < otx_ep->nb_tx_queues; q_no++) {
+		ret = otx2_vf_enable_iq(otx_ep, q_no);
+		if (ret)
+			return ret;
+	}
+
+	for (q_no = 0; q_no < otx_ep->nb_rx_queues; q_no++)
+		otx2_vf_enable_oq(otx_ep, q_no);
+
+	return 0;
+}
+
+static void
+otx2_vf_disable_iq(struct otx_ep_device *otx_ep, uint32_t q_no)
+{
+	uint64_t reg_val = 0ull;
+
+	/* Reset the doorbell register for this Input Queue. */
+	reg_val = otx2_read64(otx_ep->hw_addr + SDP_VF_R_IN_ENABLE(q_no));
+	reg_val &= ~0x1ull;
+
+	otx2_write64(reg_val, otx_ep->hw_addr + SDP_VF_R_IN_ENABLE(q_no));
+}
+
+static void
+otx2_vf_disable_oq(struct otx_ep_device *otx_ep, uint32_t q_no)
+{
+	volatile uint64_t reg_val = 0ull;
+
+	reg_val = otx2_read64(otx_ep->hw_addr + SDP_VF_R_OUT_ENABLE(q_no));
+	reg_val &= ~0x1ull;
+
+	otx2_write64(reg_val, otx_ep->hw_addr + SDP_VF_R_OUT_ENABLE(q_no));
+}
+
+static void
+otx2_vf_disable_io_queues(struct otx_ep_device *otx_ep)
+{
+	uint32_t q_no = 0;
+
+	for (q_no = 0; q_no < otx_ep->sriov_info.rings_per_vf; q_no++) {
+		otx2_vf_disable_iq(otx_ep, q_no);
+		otx2_vf_disable_oq(otx_ep, q_no);
+	}
+}
+
 static const struct otx_ep_config default_otx2_ep_conf = {
 	/* IQ attributes */
 	.iq                        = {
@@ -247,5 +345,14 @@ otx2_ep_vf_setup_device(struct otx_ep_device *otx_ep)
 
 	otx_ep->fn_list.setup_device_regs   = otx2_vf_setup_device_regs;
 
+	otx_ep->fn_list.enable_io_queues    = otx2_vf_enable_io_queues;
+	otx_ep->fn_list.disable_io_queues   = otx2_vf_disable_io_queues;
+
+	otx_ep->fn_list.enable_iq           = otx2_vf_enable_iq;
+	otx_ep->fn_list.disable_iq          = otx2_vf_disable_iq;
+
+	otx_ep->fn_list.enable_oq           = otx2_vf_enable_oq;
+	otx_ep->fn_list.disable_oq          = otx2_vf_disable_oq;
+
 	return 0;
 }
drivers/net/octeontx_ep/otx_ep_common.h +8 -0
index 25d18834b..cb42e3de0 100644
@@ -19,6 +19,7 @@
 #define OTX_EP_PCI_RING_ALIGN   65536
 #define SDP_PKIND 40
 #define SDP_OTX2_PKIND 57
+#define OTX_EP_BUSY_LOOP_COUNT      (10000)
 #define OTX_EP_MAX_IOQS_PER_VF 8
 
 #define otx_ep_info(fmt, args...)				\
@@ -374,7 +375,14 @@ struct otx_ep_fn_list {
 
 	void (*setup_device_regs)(struct otx_ep_device *otx_ep);
 
+	int (*enable_io_queues)(struct otx_ep_device *otx_ep);
 	void (*disable_io_queues)(struct otx_ep_device *otx_ep);
+
+	int (*enable_iq)(struct otx_ep_device *otx_ep, uint32_t q_no);
+	void (*disable_iq)(struct otx_ep_device *otx_ep, uint32_t q_no);
+
+	int (*enable_oq)(struct otx_ep_device *otx_ep, uint32_t q_no);
+	void (*disable_oq)(struct otx_ep_device *otx_ep, uint32_t q_no);
 };
 
 /* OTX_EP EP VF device data structure */
drivers/net/octeontx_ep/otx_ep_ethdev.c +44 -0

62 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_vf.c +128 -0

139 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_vf.h +4 -0
index c6115d37c..f05843557 100644
@@ -8,6 +8,7 @@
 
 /* OTX_EP VF IQ Registers */
 #define OTX_EP_R_IN_CONTROL_START         (0x10000)
+#define OTX_EP_R_IN_ENABLE_START          (0x10010)
 #define OTX_EP_R_IN_INSTR_BADDR_START     (0x10020)
 #define OTX_EP_R_IN_INSTR_RSIZE_START     (0x10030)
 #define OTX_EP_R_IN_INSTR_DBELL_START     (0x10040)
@@ -17,6 +18,9 @@
 #define OTX_EP_R_IN_CONTROL(ring)  \
 	(OTX_EP_R_IN_CONTROL_START + ((ring) * OTX_EP_RING_OFFSET))
 
+#define OTX_EP_R_IN_ENABLE(ring)   \
+	(OTX_EP_R_IN_ENABLE_START + ((ring) * OTX_EP_RING_OFFSET))
+
 #define OTX_EP_R_IN_INSTR_BADDR(ring)   \
 	(OTX_EP_R_IN_INSTR_BADDR_START + ((ring) * OTX_EP_RING_OFFSET))
 
Signature · 1 line
2.17.1
#45 lore raw

PATCH v7 11/12 net/octeontx_ep: receive data path function added

In reply to Nalla Pradeep

Function to deliver packets from DROQ to application is added. It also fills DROQ with receive buffers timely such that device can fill them with incoming packets.

---
 drivers/net/octeontx_ep/otx_ep_common.h |   1 +
 drivers/net/octeontx_ep/otx_ep_ethdev.c |   3 +
 drivers/net/octeontx_ep/otx_ep_rxtx.c   | 286 ++++++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_rxtx.h   |  12 +-
 4 files changed, 301 insertions(+), 1 deletion(-)
drivers/net/octeontx_ep/otx_ep_common.h +1 -0
index cb42e3de0..b9184c1d7 100644
@@ -21,6 +21,7 @@
 #define SDP_OTX2_PKIND 57
 #define OTX_EP_BUSY_LOOP_COUNT      (10000)
 #define OTX_EP_MAX_IOQS_PER_VF 8
+#define OTX_CUST_DATA_LEN 0
 
 #define otx_ep_info(fmt, args...)				\
 	rte_log(RTE_LOG_INFO, otx_net_ep_logtype,		\
drivers/net/octeontx_ep/otx_ep_ethdev.c +3 -0
index 84dd1e96a..a21496dc3 100644
@@ -136,6 +136,7 @@ otx_epdev_init(struct otx_ep_device *otx_epvf)
 
 	otx_epvf->fn_list.setup_device_regs(otx_epvf);
 
+	otx_epvf->eth_dev->rx_pkt_burst = &otx_ep_recv_pkts;
 	ethdev_queues = (uint32_t)(otx_epvf->sriov_info.rings_per_vf);
 	otx_epvf->max_rx_queues = ethdev_queues;
 	otx_epvf->max_tx_queues = ethdev_queues;
@@ -382,6 +383,8 @@ otx_ep_eth_dev_uninit(struct rte_eth_dev *eth_dev)
 	otx_epdev_exit(eth_dev);
 
 	eth_dev->dev_ops = NULL;
+	eth_dev->rx_pkt_burst = NULL;
+	eth_dev->tx_pkt_burst = NULL;
 
 	return 0;
 }
drivers/net/octeontx_ep/otx_ep_rxtx.c +286 -0

301 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_rxtx.h +11 -1
index 9779e96b6..d8b411459 100644
@@ -7,4 +7,14 @@
 
 #define OTX_EP_RXD_ALIGN 1
 #define OTX_EP_TXD_ALIGN 1
-#endif
+#define OTX_EP_MAX_DELAYED_PKT_RETRIES 10000
+static inline uint32_t
+otx_ep_incr_index(uint32_t index, uint32_t count, uint32_t max)
+{
+	return ((index + count) & (max - 1));
+}
+uint16_t
+otx_ep_recv_pkts(void *rx_queue,
+		  struct rte_mbuf **rx_pkts,
+		  uint16_t budget);
+#endif /* _OTX_EP_RXTX_H_ */
Signature · 1 line
2.17.1
#46 lore raw

PATCH v7 12/12 net/octeontx_ep: transmit data path function added

In reply to Nalla Pradeep

1. Packet transmit function for both otx and otx2 are added.
2. Flushing transmit(command) queue when pending commands are more than maximum allowed value (currently 16).
3. Scatter gather support if the packet spans multiple buffers.

---
 drivers/net/octeontx_ep/otx2_ep_vf.h    |  19 ++
 drivers/net/octeontx_ep/otx_ep_common.h |  51 +++
 drivers/net/octeontx_ep/otx_ep_ethdev.c |   5 +
 drivers/net/octeontx_ep/otx_ep_rxtx.c   | 423 ++++++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_rxtx.h   |  26 ++
 drivers/net/octeontx_ep/otx_ep_vf.h     |  67 ++++
 6 files changed, 591 insertions(+)
drivers/net/octeontx_ep/otx2_ep_vf.h +19 -0
index 191fee426..5e5aefbc1 100644
@@ -7,5 +7,24 @@
 int
 otx2_ep_vf_setup_device(struct otx_ep_device *sdpvf);
 
+struct otx2_ep_instr_64B {
+	/* Pointer where the input data is available. */
+	uint64_t dptr;
+
+	/* OTX_EP Instruction Header. */
+	union otx_ep_instr_ih ih;
+
+	/** Pointer where the response for a RAW mode packet
+	 * will be written by OCTEON TX.
+	 */
+	uint64_t rptr;
+
+	/* Input Request Header. */
+	union otx_ep_instr_irh irh;
+
+	/* Additional headers available in a 64-byte instruction. */
+	uint64_t exhdr[4];
+};
+
 #endif /*_OTX2_EP_VF_H_ */
 
drivers/net/octeontx_ep/otx_ep_common.h +51 -0

74 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_ethdev.c +5 -0
index a21496dc3..a533e6d5f 100644
@@ -137,6 +137,11 @@ otx_epdev_init(struct otx_ep_device *otx_epvf)
 	otx_epvf->fn_list.setup_device_regs(otx_epvf);
 
 	otx_epvf->eth_dev->rx_pkt_burst = &otx_ep_recv_pkts;
+	if (otx_epvf->chip_id == PCI_DEVID_OCTEONTX_EP_VF)
+		otx_epvf->eth_dev->tx_pkt_burst = &otx_ep_xmit_pkts;
+	else if (otx_epvf->chip_id == PCI_DEVID_OCTEONTX2_EP_NET_VF ||
+		 otx_epvf->chip_id == PCI_DEVID_CN98XX_EP_NET_VF)
+		otx_epvf->eth_dev->tx_pkt_burst = &otx2_ep_xmit_pkts;
 	ethdev_queues = (uint32_t)(otx_epvf->sriov_info.rings_per_vf);
 	otx_epvf->max_rx_queues = ethdev_queues;
 	otx_epvf->max_tx_queues = ethdev_queues;
drivers/net/octeontx_ep/otx_ep_rxtx.c +423 -0

429 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_rxtx.h +26 -0
index d8b411459..1527d350b 100644
@@ -5,15 +5,41 @@
 #ifndef _OTX_EP_RXTX_H_
 #define _OTX_EP_RXTX_H_
 
+#include <rte_byteorder.h>
+
 #define OTX_EP_RXD_ALIGN 1
 #define OTX_EP_TXD_ALIGN 1
+
+#define OTX_EP_IQ_SEND_FAILED      (-1)
+#define OTX_EP_IQ_SEND_SUCCESS     (0)
+
 #define OTX_EP_MAX_DELAYED_PKT_RETRIES 10000
+
+#define OTX_EP_FSZ 28
+#define OTX2_EP_FSZ 24
+#define OTX_EP_MAX_INSTR 16
+
+static inline void
+otx_ep_swap_8B_data(uint64_t *data, uint32_t blocks)
+{
+	/* Swap 8B blocks */
+	while (blocks) {
+		*data = rte_bswap64(*data);
+		blocks--;
+		data++;
+	}
+}
+
 static inline uint32_t
 otx_ep_incr_index(uint32_t index, uint32_t count, uint32_t max)
 {
 	return ((index + count) & (max - 1));
 }
 uint16_t
+otx_ep_xmit_pkts(void *tx_queue, struct rte_mbuf **pkts, uint16_t nb_pkts);
+uint16_t
+otx2_ep_xmit_pkts(void *tx_queue, struct rte_mbuf **pkts, uint16_t nb_pkts);
+uint16_t
 otx_ep_recv_pkts(void *rx_queue,
 		  struct rte_mbuf **rx_pkts,
 		  uint16_t budget);
drivers/net/octeontx_ep/otx_ep_vf.h +67 -0

73 lines not on this page · raw message

Signature · 1 line
2.17.1
#47 lore raw

PATCH v6 1/12 raw/octeontx_ep: changed device id

In reply to Nalla Pradeep

Device id to be probed by octeontx_ep raw device pmd is changed from B203 to B204. B203 is for octeontx_ep net device pmd to probe.

---
 drivers/common/octeontx2/otx2_common.h    | 3 ++-
 drivers/raw/octeontx2_ep/otx2_ep_rawdev.c | 6 +++---
 2 files changed, 5 insertions(+), 4 deletions(-)
drivers/common/octeontx2/otx2_common.h +2 -1
index b6779f710..4938fb295 100644
@@ -136,7 +136,8 @@ extern int otx2_logtype_ree;
 #define PCI_DEVID_OCTEONTX2_RVU_CPT_VF		0xA0FE
 #define PCI_DEVID_OCTEONTX2_RVU_AF_VF		0xA0f8
 #define PCI_DEVID_OCTEONTX2_DPI_VF		0xA081
-#define PCI_DEVID_OCTEONTX2_EP_VF		0xB203 /* OCTEON TX2 EP mode */
+#define PCI_DEVID_OCTEONTX2_EP_NET_VF		0xB203 /* OCTEON TX2 EP mode */
+#define PCI_DEVID_OCTEONTX2_EP_RAW_VF		0xB204 /* OCTEON TX2 EP mode */
 #define PCI_DEVID_OCTEONTX2_RVU_SDP_PF		0xA0f6
 #define PCI_DEVID_OCTEONTX2_RVU_SDP_VF		0xA0f7
 #define PCI_DEVID_OCTEONTX2_RVU_REE_PF		0xA0f4
drivers/raw/octeontx2_ep/otx2_ep_rawdev.c +3 -3
index 2b78a7941..b2ccdda83 100644
@@ -22,7 +22,7 @@
 static const struct rte_pci_id pci_sdp_vf_map[] = {
 	{
 		RTE_PCI_DEVICE(PCI_VENDOR_ID_CAVIUM,
-			       PCI_DEVID_OCTEONTX2_EP_VF)
+			       PCI_DEVID_OCTEONTX2_EP_RAW_VF)
 	},
 	{
 		.vendor_id = 0,
@@ -109,8 +109,8 @@ sdp_chip_specific_setup(struct sdp_device *sdpvf)
 	int ret;
 
 	switch (dev_id) {
-	case PCI_DEVID_OCTEONTX2_EP_VF:
-		sdpvf->chip_id = PCI_DEVID_OCTEONTX2_EP_VF;
+	case PCI_DEVID_OCTEONTX2_EP_RAW_VF:
+		sdpvf->chip_id = PCI_DEVID_OCTEONTX2_EP_RAW_VF;
 		ret = sdp_vf_setup_device(sdpvf);
 
 		break;
Signature · 1 line
2.17.1
#48 lore raw

PATCH v6 2/12 net/octeontx_ep: add build and doc infrastructure

In reply to Nalla Pradeep

Adding bare minimum PMD library and doc build infrastructure and claim the maintainership for octeontx end point PMD.

---
 MAINTAINERS                              |  9 ++++++++
 doc/guides/nics/features/octeontx_ep.ini | 10 +++++++++
 doc/guides/nics/index.rst                |  1 +
 doc/guides/nics/octeontx_ep.rst          | 27 ++++++++++++++++++++++++
 drivers/net/meson.build                  |  1 +
 drivers/net/octeontx_ep/meson.build      |  8 +++++++
 drivers/net/octeontx_ep/otx_ep_ethdev.c  |  3 +++
 drivers/net/octeontx_ep/version.map      |  3 +++
 8 files changed, 62 insertions(+)
 create mode 100644 doc/guides/nics/features/octeontx_ep.ini
 create mode 100644 doc/guides/nics/octeontx_ep.rst
 create mode 100644 drivers/net/octeontx_ep/meson.build
 create mode 100644 drivers/net/octeontx_ep/otx_ep_ethdev.c
 create mode 100644 drivers/net/octeontx_ep/version.map
MAINTAINERS +9 -0
index 1a12916f5..2c589ffca 100644
@@ -763,6 +763,15 @@ T: git://dpdk.org/next/dpdk-next-crypto
 F: drivers/common/octeontx2/otx2_sec*
 F: drivers/net/octeontx2/otx2_ethdev_sec*
 
+Marvell OCTEON TX EP - endpoint
+M: Nalla Pradeep <[email protected]>
+M: Radha Mohan Chintakuntla <[email protected]>
+M: Veerasenareddy Burru <[email protected]>
+T: git://dpdk.org/next/dpdk-next-net-mrvl
+F: drivers/net/octeontx_ep/
+F: doc/guides/nics/features/octeontx_ep.ini
+F: doc/guides/nics/octeontx_ep.rst
+
 Mellanox mlx4
 M: Matan Azrad <[email protected]>
 M: Shahaf Shuler <[email protected]>
doc/guides/nics/features/octeontx_ep.ini new file +10 -0
new file mode 100644
index 000000000..660fbc287
@@ -0,0 +1,10 @@
+;
+; Supported features of the 'octeontx_ep' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+SR-IOV               = Y
+Linux                = Y
+x86-64               = Y
+Usage doc            = Y
doc/guides/nics/index.rst +1 -0
index 344361775..799697caf 100644
@@ -50,6 +50,7 @@ Network Interface Controller Drivers
     null
     octeontx
     octeontx2
+    octeontx_ep
     pfe
     qede
     sfc_efx
doc/guides/nics/octeontx_ep.rst new file +27 -0
new file mode 100644
index 000000000..766a4a6b1
@@ -0,0 +1,27 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(C) 2021 Marvell.
+
+OCTEON TX EP Poll Mode driver
+===========================
+
+The OCTEON TX EP ETHDEV PMD (**librte_pmd_octeontx_ep**) provides poll mode
+ethdev driver support for the virtual functions (VF) of **Marvell OCTEON TX2**
+and **Cavium OCTEON TX** families of adapters in SR-IOV context.
+
+More information can be found at `Marvell Official Website
+<https://www.marvell.com/content/dam/marvell/en/public-collateral/embedded-processors/marvell-liquidio-III-solutions-brief.pdf>`_.
+
+
+Prerequisites
+-------------
+
+This driver relies on external kernel PF driver for resources allocations
+and initialization. The following dependencies are not part of DPDK and
+must be installed separately:
+
+- **Kernel module**
+  This module, octeon_drv, drives the physical function, initializes hardware,
+  allocates resources such as number of VFs, input/output queues for itself and
+  the number of i/o queues each VF can use.
+
+See :doc:`../platform/octeontx2` for SDP interface information which provides PCIe endpoint support for a remote host.
drivers/net/meson.build +1 -0
index 4cbca9641..fb9ff05a1 100644
@@ -39,6 +39,7 @@ drivers = ['af_packet',
 	'null',
 	'octeontx',
 	'octeontx2',
+	'octeontx_ep',
 	'pcap',
 	'pfe',
 	'qede',
drivers/net/octeontx_ep/meson.build new file +8 -0
new file mode 100644
index 000000000..2ef2222d2
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(C) 2021 Marvell.
+#
+
+sources = files(
+               'otx_ep_ethdev.c',
+               )
+
drivers/net/octeontx_ep/otx_ep_ethdev.c new file +3 -0
new file mode 100644
index 000000000..603023b0d
@@ -0,0 +1,3 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
drivers/net/octeontx_ep/version.map new file +3 -0
new file mode 100644
index 000000000..6e4fb220a
@@ -0,0 +1,3 @@
+DPDK_21 {
+        local: *;
+};
Signature · 1 line
2.17.1
#49 lore raw

PATCH v6 3/12 net/octeontx_ep: add ethdev probe and remove

In reply to Nalla Pradeep

add basic PCIe ethdev probe and remove.

---
 drivers/common/octeontx2/otx2_common.h  |  2 +
 drivers/net/octeontx_ep/meson.build     |  2 +
 drivers/net/octeontx_ep/otx_ep_common.h | 14 +++++++
 drivers/net/octeontx_ep/otx_ep_ethdev.c | 56 +++++++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_vf.h     |  9 ++++
 5 files changed, 83 insertions(+)
 create mode 100644 drivers/net/octeontx_ep/otx_ep_common.h
 create mode 100644 drivers/net/octeontx_ep/otx_ep_vf.h
drivers/common/octeontx2/otx2_common.h +2 -0
index 4938fb295..cd52e098e 100644
@@ -137,6 +137,8 @@ extern int otx2_logtype_ree;
 #define PCI_DEVID_OCTEONTX2_RVU_AF_VF		0xA0f8
 #define PCI_DEVID_OCTEONTX2_DPI_VF		0xA081
 #define PCI_DEVID_OCTEONTX2_EP_NET_VF		0xB203 /* OCTEON TX2 EP mode */
+/* OCTEON TX2 98xx EP mode */
+#define PCI_DEVID_CN98XX_EP_NET_VF		0xB103
 #define PCI_DEVID_OCTEONTX2_EP_RAW_VF		0xB204 /* OCTEON TX2 EP mode */
 #define PCI_DEVID_OCTEONTX2_RVU_SDP_PF		0xA0f6
 #define PCI_DEVID_OCTEONTX2_RVU_SDP_VF		0xA0f7
drivers/net/octeontx_ep/meson.build +2 -0
index 2ef2222d2..73e04b0be 100644
@@ -2,7 +2,9 @@
 # Copyright(C) 2021 Marvell.
 #
 
+deps += ['common_octeontx2']
 sources = files(
                'otx_ep_ethdev.c',
                )
 
+includes += include_directories('../../common/octeontx2')
drivers/net/octeontx_ep/otx_ep_common.h new file +14 -0
new file mode 100644
index 000000000..35ea99a79
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+#ifndef _OTX_EP_COMMON_H_
+#define _OTX_EP_COMMON_H_
+
+/* OTX_EP EP VF device data structure */
+struct otx_ep_device {
+	/* PCI device pointer */
+	struct rte_pci_device *pdev;
+
+	struct rte_eth_dev *eth_dev;
+};
+#endif  /* _OTX_EP_COMMON_H_ */
drivers/net/octeontx_ep/otx_ep_ethdev.c +56 -0

59 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_vf.h new file +9 -0
new file mode 100644
index 000000000..e88b40971
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+#ifndef _OTX_EP_VF_H_
+#define _OTX_EP_VF_H_
+
+#define PCI_DEVID_OCTEONTX_EP_VF 0xa303
+
+#endif /*_OTX_EP_VF_H_ */
Signature · 1 line
2.17.1
#50 lore raw

PATCH v6 4/12 net/octeontx_ep: add device init and uninit

In reply to Nalla Pradeep

Add basic init and uninit function which includes
initializing fields of ethdev private structure.

---
 drivers/net/octeontx_ep/otx_ep_common.h | 24 +++++++-
 drivers/net/octeontx_ep/otx_ep_ethdev.c | 75 +++++++++++++++++++++++--
 2 files changed, 93 insertions(+), 6 deletions(-)
drivers/net/octeontx_ep/otx_ep_common.h +23 -1
index 35ea99a79..1324eb144 100644
@@ -4,11 +4,33 @@
 #ifndef _OTX_EP_COMMON_H_
 #define _OTX_EP_COMMON_H_
 
+#define otx_ep_info(fmt, args...)				\
+	rte_log(RTE_LOG_DEBUG, otx_net_ep_loginfo,		\
+		"%s():%u " fmt "\n",				\
+		__func__, __LINE__, ##args)
+
+#define otx_ep_err(fmt, args...)				\
+	rte_log(RTE_LOG_DEBUG, otx_net_ep_logerr,		\
+		"%s():%u " fmt "\n",				\
+		__func__, __LINE__, ##args)
+
+#define otx_ep_dbg(fmt, args...)				\
+	rte_log(RTE_LOG_DEBUG, otx_net_ep_logdbg,		\
+		"%s():%u " fmt "\n",				\
+		__func__, __LINE__, ##args)
+
 /* OTX_EP EP VF device data structure */
 struct otx_ep_device {
 	/* PCI device pointer */
 	struct rte_pci_device *pdev;
-
+	uint16_t chip_id;
 	struct rte_eth_dev *eth_dev;
+	int port_id;
+	/* Memory mapped h/w address */
+	uint8_t *hw_addr;
 };
+
+extern int otx_net_ep_logdbg;
+extern int otx_net_ep_logerr;
+extern int otx_net_ep_loginfo;
 #endif  /* _OTX_EP_COMMON_H_ */
drivers/net/octeontx_ep/otx_ep_ethdev.c +70 -5

99 lines not on this page · raw message

Signature · 1 line
2.17.1
#51 lore raw

Re: [dpdk-dev] [PATCH v6 04/12] net/octeontx_ep: add device init and uninit

Quoted 4 lines · Nalla Pradeep

Add basic init and uninit function which includes
initializing fields of ethdev private structure.

<...>

drivers/net/octeontx_ep/otx_ep_ethdev.c otx_ep_eth_dev_pci_remove(struct rte_pci_device *pci_dev) · line 107

Quoted 5 lines
drivers/net/octeontx_ep/otx_ep_ethdev.c +1 -0
@@ -43,6 +104,7 @@ otx_ep_eth_dev_pci_remove(struct rte_pci_device *pci_dev)
  /* Set of PCI devices this driver supports */
  static const struct rte_pci_id pci_id_otx_ep_map[] = {
  	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, PCI_DEVID_OCTEONTX_EP_VF) },
+	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, PCI_DEVID_OCTEONTX2_EP_NET_VF) },

Can you please move this to 3/12 where 'pci_id_otx_ep_map' is introduced?

drivers/net/octeontx_ep/otx_ep_ethdev.c static struct rte_pci_driver rte_otx_ep_pmd = { · line 124

Quoted 11 lines
drivers/net/octeontx_ep/otx_ep_ethdev.c +3 -0
  	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, PCI_DEVID_CN98XX_EP_NET_VF) },
  	{ .vendor_id = 0, /* sentinel */ }
  };
@@ -57,3 +119,6 @@ static struct rte_pci_driver rte_otx_ep_pmd = {
  RTE_PMD_REGISTER_PCI(net_otx_ep, rte_otx_ep_pmd);
  RTE_PMD_REGISTER_PCI_TABLE(net_otx_ep, pci_id_otx_ep_map);
  RTE_PMD_REGISTER_KMOD_DEP(net_otx_ep, "* igb_uio | vfio-pci");
+RTE_LOG_REGISTER(otx_net_ep_logdbg, pmd.net.octeontx_ep, DEBUG);
+RTE_LOG_REGISTER(otx_net_ep_logerr, pmd.net.octeontx_ep, ERR);
+RTE_LOG_REGISTER(otx_net_ep_loginfo, pmd.net.octeontx_ep, INFO);

This is wrong. You should register single logtype, as done in v5, and use for various log levels.

Please make the default log level for registered logtype 'NOTICE' (again as done in v5)

The macros 'otx_ep_info', 'otx_ep_err' & 'otx_ep_dbg' should share same logtype.

#52 lore raw

PATCH v6 5/12 net/octeontx_ep: added basic device setup

In reply to Nalla Pradeep

Functions to setup device, basic input queue and output queue registers are added.

---
 drivers/net/octeontx_ep/meson.build     |   2 +
 drivers/net/octeontx_ep/otx2_ep_vf.c    | 131 +++++++++++++++++++++
 drivers/net/octeontx_ep/otx2_ep_vf.h    |  11 ++
 drivers/net/octeontx_ep/otx_ep_common.h |  92 +++++++++++++++
 drivers/net/octeontx_ep/otx_ep_ethdev.c |   7 ++
 drivers/net/octeontx_ep/otx_ep_vf.c     | 148 ++++++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_vf.h     |  33 ++++++
 7 files changed, 424 insertions(+)
 create mode 100644 drivers/net/octeontx_ep/otx2_ep_vf.c
 create mode 100644 drivers/net/octeontx_ep/otx2_ep_vf.h
 create mode 100644 drivers/net/octeontx_ep/otx_ep_vf.c
drivers/net/octeontx_ep/meson.build +2 -0
index 73e04b0be..8cd2e76d1 100644
@@ -5,6 +5,8 @@
 deps += ['common_octeontx2']
 sources = files(
                'otx_ep_ethdev.c',
+               'otx_ep_vf.c',
+               'otx2_ep_vf.c',
                )
 
 includes += include_directories('../../common/octeontx2')
drivers/net/octeontx_ep/otx2_ep_vf.c new file +131 -0

131 lines not on this page · raw message

drivers/net/octeontx_ep/otx2_ep_vf.h new file +11 -0
new file mode 100644
index 000000000..191fee426
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+#ifndef _OTX2_EP_VF_H_
+#define _OTX2_EP_VF_H_
+
+int
+otx2_ep_vf_setup_device(struct otx_ep_device *sdpvf);
+
+#endif /*_OTX2_EP_VF_H_ */
+
drivers/net/octeontx_ep/otx_ep_common.h +92 -0

113 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_ethdev.c +7 -0
index 2c457134e..2da68aac3 100644
@@ -7,6 +7,7 @@
 #include "otx2_common.h"
 #include "otx_ep_common.h"
 #include "otx_ep_vf.h"
+#include "otx2_ep_vf.h"
 
 #define OTX_EP_DEV(_eth_dev)            ((_eth_dev)->data->dev_private)
 static int
@@ -19,10 +20,12 @@ otx_ep_chip_specific_setup(struct otx_ep_device *otx_epvf)
 	switch (dev_id) {
 	case PCI_DEVID_OCTEONTX_EP_VF:
 		otx_epvf->chip_id = dev_id;
+		ret = otx_ep_vf_setup_device(otx_epvf);
 		break;
 	case PCI_DEVID_OCTEONTX2_EP_NET_VF:
 	case PCI_DEVID_CN98XX_EP_NET_VF:
 		otx_epvf->chip_id = dev_id;
+		ret = otx2_ep_vf_setup_device(otx_epvf);
 		break;
 	default:
 		otx_ep_err("Unsupported device\n");
@@ -47,6 +50,10 @@ otx_epdev_init(struct otx_ep_device *otx_epvf)
 		goto setup_fail;
 	}
 
+	otx_epvf->fn_list.setup_device_regs(otx_epvf);
+
+	otx_ep_info("OTX_EP Device is Ready\n");
+
 setup_fail:
 	return ret;
 }
drivers/net/octeontx_ep/otx_ep_vf.c new file +148 -0

148 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_vf.h +33 -0
index e88b40971..c5741a3f1 100644
@@ -4,6 +4,39 @@
 #ifndef _OTX_EP_VF_H_
 #define _OTX_EP_VF_H_
 
+#define OTX_EP_RING_OFFSET                (0x1ull << 17)
+
+/* OTX_EP VF IQ Registers */
+#define OTX_EP_R_IN_CONTROL_START         (0x10000)
+#define OTX_EP_R_IN_CONTROL(ring)  \
+	(OTX_EP_R_IN_CONTROL_START + ((ring) * OTX_EP_RING_OFFSET))
+
+/* OTX_EP VF IQ Masks */
+#define OTX_EP_R_IN_CTL_RPVF_MASK       (0xF)
+#define	OTX_EP_R_IN_CTL_RPVF_POS        (48)
+
+#define OTX_EP_R_IN_CTL_IDLE            (0x1ull << 28)
+#define OTX_EP_R_IN_CTL_RDSIZE          (0x3ull << 25) /* Setting to max(4) */
+#define OTX_EP_R_IN_CTL_IS_64B          (0x1ull << 24)
+#define OTX_EP_R_IN_CTL_ESR             (0x1ull << 1)
+/* OTX_EP VF OQ Registers */
+#define OTX_EP_R_OUT_CONTROL_START           (0x10150)
+#define OTX_EP_R_OUT_CONTROL(ring)    \
+	(OTX_EP_R_OUT_CONTROL_START + ((ring) * OTX_EP_RING_OFFSET))
+/* OTX_EP VF OQ Masks */
+#define OTX_EP_R_OUT_CTL_ES_I         (1ull << 34)
+#define OTX_EP_R_OUT_CTL_NSR_I        (1ull << 33)
+#define OTX_EP_R_OUT_CTL_ROR_I        (1ull << 32)
+#define OTX_EP_R_OUT_CTL_ES_D         (1ull << 30)
+#define OTX_EP_R_OUT_CTL_NSR_D        (1ull << 29)
+#define OTX_EP_R_OUT_CTL_ROR_D        (1ull << 28)
+#define OTX_EP_R_OUT_CTL_ES_P         (1ull << 26)
+#define OTX_EP_R_OUT_CTL_NSR_P        (1ull << 25)
+#define OTX_EP_R_OUT_CTL_ROR_P        (1ull << 24)
+#define OTX_EP_R_OUT_CTL_IMODE        (1ull << 23)
+
 #define PCI_DEVID_OCTEONTX_EP_VF 0xa303
 
+int
+otx_ep_vf_setup_device(struct otx_ep_device *otx_ep);
 #endif /*_OTX_EP_VF_H_ */
Signature · 1 line
2.17.1
#53 lore raw

PATCH v6 6/12 net/octeontx_ep: add dev info get and configure

In reply to Nalla Pradeep

Add device information get and device configure operations.

---
 doc/guides/nics/features/octeontx_ep.ini |  1 +
 drivers/net/octeontx_ep/otx_ep_common.h  | 14 ++++
 drivers/net/octeontx_ep/otx_ep_ethdev.c  | 81 +++++++++++++++++++++++-
 drivers/net/octeontx_ep/otx_ep_rxtx.h    | 10 +++
 4 files changed, 105 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/octeontx_ep/otx_ep_rxtx.h
doc/guides/nics/features/octeontx_ep.ini +1 -0
index 660fbc287..d1453f5be 100644
@@ -4,6 +4,7 @@
 ; Refer to default.ini for the full list of available PMD features.
 ;
 [Features]
+Speed capabilities   = P
 SR-IOV               = Y
 Linux                = Y
 x86-64               = Y
drivers/net/octeontx_ep/otx_ep_common.h +14 -0
index 9fe909751..e7c055090 100644
@@ -7,9 +7,12 @@
 #define OTX_EP_MAX_RINGS_PER_VF        (8)
 #define OTX_EP_CFG_IO_QUEUES        OTX_EP_MAX_RINGS_PER_VF
 #define OTX_EP_64BYTE_INSTR         (64)
+#define OTX_EP_MIN_IQ_DESCRIPTORS   (128)
+#define OTX_EP_MIN_OQ_DESCRIPTORS   (128)
 #define OTX_EP_MAX_IQ_DESCRIPTORS   (8192)
 #define OTX_EP_MAX_OQ_DESCRIPTORS   (8192)
 #define OTX_EP_OQ_BUF_SIZE          (2048)
+#define OTX_EP_MIN_RX_BUF_SIZE      (64)
 
 #define OTX_EP_OQ_INFOPTR_MODE      (0)
 #define OTX_EP_OQ_REFIL_THRESHOLD   (16)
@@ -115,13 +118,24 @@ struct otx_ep_device {
 
 	struct otx_ep_fn_list fn_list;
 
+	uint32_t max_tx_queues;
+
+	uint32_t max_rx_queues;
+
 	/* SR-IOV info */
 	struct otx_ep_sriov_info sriov_info;
 
 	/* Device configuration */
 	const struct otx_ep_config *conf;
+
+	uint64_t rx_offloads;
+
+	uint64_t tx_offloads;
 };
 
+#define OTX_EP_MAX_PKT_SZ 64000U
+#define OTX_EP_MAX_MAC_ADDRS 1
+
 extern int otx_net_ep_logdbg;
 extern int otx_net_ep_logerr;
 extern int otx_net_ep_loginfo;
drivers/net/octeontx_ep/otx_ep_ethdev.c +80 -1

112 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_rxtx.h new file +10 -0
new file mode 100644
index 000000000..9779e96b6
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+
+#ifndef _OTX_EP_RXTX_H_
+#define _OTX_EP_RXTX_H_
+
+#define OTX_EP_RXD_ALIGN 1
+#define OTX_EP_TXD_ALIGN 1
+#endif
Signature · 1 line
2.17.1
#54 lore raw

PATCH v6 7/12 net/octeontx_ep: added rxq setup and release

In reply to Nalla Pradeep

Receive queue setup involves allocating memory for the queue, initializing data structure representing the queue and filling queue with receive buffers of rx descriptor count. Receive queues are referred as droq. Hardware fills the receive buffers in queue with the packet.

In receive queue release, receive buffers are freed along with the receive queue.

---
 drivers/net/octeontx_ep/meson.build     |   1 +
 drivers/net/octeontx_ep/otx_ep_common.h | 150 ++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_ethdev.c | 127 +++++++++++++-
 drivers/net/octeontx_ep/otx_ep_rxtx.c   | 223 ++++++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_vf.h     |   6 +
 5 files changed, 506 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/octeontx_ep/otx_ep_rxtx.c
drivers/net/octeontx_ep/meson.build +1 -0
index 8cd2e76d1..a8436f35f 100644
@@ -7,6 +7,7 @@ sources = files(
                'otx_ep_ethdev.c',
                'otx_ep_vf.c',
                'otx2_ep_vf.c',
+               'otx_ep_rxtx.c',
                )
 
 includes += include_directories('../../common/octeontx2')
drivers/net/octeontx_ep/otx_ep_common.h +150 -0

193 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_ethdev.c +126 -1

164 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_rxtx.c new file +223 -0

223 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_vf.h +6 -0
index c5741a3f1..d17c87909 100644
@@ -37,6 +37,12 @@
 
 #define PCI_DEVID_OCTEONTX_EP_VF 0xa303
 
+/* this is a static value set by SLI PF driver in octeon
+ * No handshake is available
+ * Change this if changing the value in SLI PF driver
+ */
+#define SDP_GBL_WMARK 0x100
+
 int
 otx_ep_vf_setup_device(struct otx_ep_device *otx_ep);
 #endif /*_OTX_EP_VF_H_ */
Signature · 1 line
2.17.1
#55 lore raw

PATCH v6 8/12 net/octeontx_ep: added tx queue setup and release

In reply to Nalla Pradeep

Transmit queue setup involves allocating memory for the command queue considering tx descriptor count and initializing data structure representing the queue. Transmit queue release function frees the command queue.

---
 drivers/net/octeontx_ep/otx_ep_common.h |  88 +++++++++++++++-
 drivers/net/octeontx_ep/otx_ep_ethdev.c |  81 +++++++++++++++
 drivers/net/octeontx_ep/otx_ep_rxtx.c   | 133 ++++++++++++++++++++++++
 3 files changed, 301 insertions(+), 1 deletion(-)
drivers/net/octeontx_ep/otx_ep_common.h +87 -1
index 1d7766497..fbacb190f 100644
@@ -45,7 +45,21 @@
 	rte_write64(val, ((base_addr) + off)); \
 	}
 
-struct otx_ep_device;
+/* OTX_EP IQ request list */
+struct otx_ep_instr_list {
+	void *buf;
+	uint32_t reqtype;
+};
+#define OTX_EP_IQREQ_LIST_SIZE	(sizeof(struct otx_ep_instr_list))
+
+/* Input Queue statistics. Each input queue has four stats fields. */
+struct otx_ep_iq_stats {
+	uint64_t instr_posted; /* Instructions posted to this queue. */
+	uint64_t instr_processed; /* Instructions processed in this queue. */
+	uint64_t instr_dropped; /* Instructions that could not be processed */
+	uint64_t tx_pkts;
+	uint64_t tx_bytes;
+};
 
 /* Structure to define the configuration attributes for each Input queue. */
 struct otx_ep_iq_config {
@@ -59,6 +73,66 @@ struct otx_ep_iq_config {
 	uint32_t pending_list_size;
 };
 
+/** The instruction (input) queue.
+ *  The input queue is used to post raw (instruction) mode data or packet data
+ *  to OCTEON TX2 device from the host. Each IQ of a OTX_EP EP VF device has one
+ *  such structure to represent it.
+ */
+struct otx_ep_instr_queue {
+	struct otx_ep_device *otx_ep_dev;
+
+	uint32_t q_no;
+	uint32_t pkt_in_done;
+
+	/* Flag for 64 byte commands. */
+	uint32_t iqcmd_64B:1;
+	uint32_t rsvd:17;
+	uint32_t status:8;
+
+	/* Number of  descriptors in this ring. */
+	uint32_t nb_desc;
+
+	/* Input ring index, where the driver should write the next packet */
+	uint32_t host_write_index;
+
+	/* Input ring index, where the OCTEON TX2 should read the next packet */
+	uint32_t otx_read_index;
+
+	uint32_t reset_instr_cnt;
+
+	/** This index aids in finding the window in the queue where OCTEON TX2
+	 *  has read the commands.
+	 */
+	uint32_t flush_index;
+
+	/* This keeps track of the instructions pending in this queue. */
+	uint64_t instr_pending;
+
+	/* Pointer to the Virtual Base addr of the input ring. */
+	uint8_t *base_addr;
+
+	/* This IQ request list */
+	struct otx_ep_instr_list *req_list;
+
+	/* OTX_EP doorbell register for the ring. */
+	void *doorbell_reg;
+
+	/* OTX_EP instruction count register for this ring. */
+	void *inst_cnt_reg;
+
+	/* Number of instructions pending to be posted to OCTEON TX2. */
+	uint32_t fill_cnt;
+
+	/* Statistics for this input queue. */
+	struct otx_ep_iq_stats stats;
+
+	/* DMA mapped base address of the input descriptor ring. */
+	uint64_t base_addr_dma;
+
+	/* Memory zone */
+	const struct rte_memzone *iq_mz;
+};
+
 /** Descriptor format.
  *  The descriptor ring is made of descriptors which have 2 64-bit values:
  *  -# Physical (bus) address of the data buffer.
@@ -229,6 +303,8 @@ struct otx_ep_sriov_info {
 
 /* Required functions for each VF device */
 struct otx_ep_fn_list {
+	void (*setup_iq_regs)(struct otx_ep_device *otx_ep, uint32_t q_no);
+
 	void (*setup_oq_regs)(struct otx_ep_device *otx_ep, uint32_t q_no);
 
 	void (*setup_device_regs)(struct otx_ep_device *otx_ep);
@@ -258,6 +334,12 @@ struct otx_ep_device {
 
 	uint32_t max_rx_queues;
 
+	/* Num IQs */
+	uint32_t nb_tx_queues;
+
+	/* The input instruction queues */
+	struct otx_ep_instr_queue *instr_queue[OTX_EP_MAX_IOQS_PER_VF];
+
 	/* Num OQs */
 	uint32_t nb_rx_queues;
 
@@ -278,6 +360,10 @@ struct otx_ep_device {
 	uint64_t tx_offloads;
 };
 
+int otx_ep_setup_iqs(struct otx_ep_device *otx_ep, uint32_t iq_no,
+		     int num_descs, unsigned int socket_id);
+int otx_ep_delete_iqs(struct otx_ep_device *otx_ep, uint32_t iq_no);
+
 int otx_ep_setup_oqs(struct otx_ep_device *otx_ep, int oq_no, int num_descs,
 		     int desc_size, struct rte_mempool *mpool,
 		     unsigned int socket_id);
drivers/net/octeontx_ep/otx_ep_ethdev.c +81 -0

98 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_rxtx.c +133 -0

139 lines not on this page · raw message

Signature · 1 line
2.17.1
#56 lore raw

PATCH v6 9/12 net/octeontx_ep: setting up iq and oq registers

In reply to Nalla Pradeep

Configuring hardware registers with command queue(iq) and driver output queue(oq) parameters.
List of parameters configured for IQ after making sure it is idle
1. Base address
2. Instruction size
3. Disabling interrupts for fastpath

List of parameters configured for OQ after making sure it is idle
1. Base address
2. Output buffer size
3. Clear output queue doorbell
4. Disable interrupts for fastpath

---
 drivers/net/octeontx_ep/otx2_ep_vf.c    | 120 ++++++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_common.h |  72 ++++++++++++++
 drivers/net/octeontx_ep/otx_ep_vf.c     | 120 ++++++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_vf.h     |  49 ++++++++++
 4 files changed, 361 insertions(+)
drivers/net/octeontx_ep/otx2_ep_vf.c +120 -0
index 6368ddc80..84de89ef7 100644
@@ -71,6 +71,123 @@ otx2_vf_setup_device_regs(struct otx_ep_device *otx_ep)
 	otx2_vf_setup_global_output_regs(otx_ep);
 }
 
+static void
+otx2_vf_setup_iq_regs(struct otx_ep_device *otx_ep, uint32_t iq_no)
+{
+	struct otx_ep_instr_queue *iq = otx_ep->instr_queue[iq_no];
+	volatile uint64_t reg_val = 0ull;
+
+	reg_val = otx2_read64(otx_ep->hw_addr + SDP_VF_R_IN_CONTROL(iq_no));
+
+	/* Wait till IDLE to set to 1, not supposed to configure BADDR
+	 * as long as IDLE is 0
+	 */
+	if (!(reg_val & SDP_VF_R_IN_CTL_IDLE)) {
+		do {
+			reg_val = otx2_read64(otx_ep->hw_addr +
+					      SDP_VF_R_IN_CONTROL(iq_no));
+		} while (!(reg_val & SDP_VF_R_IN_CTL_IDLE));
+	}
+
+	/* Write the start of the input queue's ring and its size  */
+	otx2_write64(iq->base_addr_dma, otx_ep->hw_addr +
+		     SDP_VF_R_IN_INSTR_BADDR(iq_no));
+	otx2_write64(iq->nb_desc, otx_ep->hw_addr +
+		     SDP_VF_R_IN_INSTR_RSIZE(iq_no));
+
+	/* Remember the doorbell & instruction count register addr
+	 * for this queue
+	 */
+	iq->doorbell_reg = (uint8_t *)otx_ep->hw_addr +
+			   SDP_VF_R_IN_INSTR_DBELL(iq_no);
+	iq->inst_cnt_reg = (uint8_t *)otx_ep->hw_addr +
+			   SDP_VF_R_IN_CNTS(iq_no);
+
+	otx_ep_dbg("InstQ[%d]:dbell reg @ 0x%p instcnt_reg @ 0x%p",
+		   iq_no, iq->doorbell_reg, iq->inst_cnt_reg);
+
+	do {
+		reg_val = rte_read32(iq->inst_cnt_reg);
+		rte_write32(reg_val, iq->inst_cnt_reg);
+	} while (reg_val != 0);
+
+	/* IN INTR_THRESHOLD is set to max(FFFFFFFF) which disable the IN INTR
+	 * to raise
+	 */
+	otx2_write64(OTX_EP_CLEAR_SDP_IN_INT_LVLS,
+		     otx_ep->hw_addr + SDP_VF_R_IN_INT_LEVELS(iq_no));
+}
+
+static void
+otx2_vf_setup_oq_regs(struct otx_ep_device *otx_ep, uint32_t oq_no)
+{
+	volatile uint64_t reg_val = 0ull;
+	uint64_t oq_ctl = 0ull;
+	struct otx_ep_droq *droq = otx_ep->droq[oq_no];
+
+	/* Wait on IDLE to set to 1, supposed to configure BADDR
+	 * as log as IDLE is 0
+	 */
+	reg_val = otx2_read64(otx_ep->hw_addr + SDP_VF_R_OUT_CONTROL(oq_no));
+
+	while (!(reg_val & SDP_VF_R_OUT_CTL_IDLE)) {
+		reg_val = otx2_read64(otx_ep->hw_addr +
+				      SDP_VF_R_OUT_CONTROL(oq_no));
+	}
+
+	otx2_write64(droq->desc_ring_dma, otx_ep->hw_addr +
+		     SDP_VF_R_OUT_SLIST_BADDR(oq_no));
+	otx2_write64(droq->nb_desc, otx_ep->hw_addr +
+		     SDP_VF_R_OUT_SLIST_RSIZE(oq_no));
+
+	oq_ctl = otx2_read64(otx_ep->hw_addr + SDP_VF_R_OUT_CONTROL(oq_no));
+
+	/* Clear the ISIZE and BSIZE (22-0) */
+	oq_ctl &= ~(OTX_EP_CLEAR_ISIZE_BSIZE);
+
+	/* Populate the BSIZE (15-0) */
+	oq_ctl |= (droq->buffer_size & OTX_EP_DROQ_BUFSZ_MASK);
+
+	otx2_write64(oq_ctl, otx_ep->hw_addr + SDP_VF_R_OUT_CONTROL(oq_no));
+
+	/* Mapped address of the pkt_sent and pkts_credit regs */
+	droq->pkts_sent_reg = (uint8_t *)otx_ep->hw_addr +
+			      SDP_VF_R_OUT_CNTS(oq_no);
+	droq->pkts_credit_reg = (uint8_t *)otx_ep->hw_addr +
+				SDP_VF_R_OUT_SLIST_DBELL(oq_no);
+
+	rte_write64(OTX_EP_CLEAR_OUT_INT_LVLS,
+		    otx_ep->hw_addr + SDP_VF_R_OUT_INT_LEVELS(oq_no));
+
+	/* Clear PKT_CNT register */
+	rte_write64(OTX_EP_CLEAR_SDP_OUT_PKT_CNT, (uint8_t *)otx_ep->hw_addr +
+		    SDP_VF_R_OUT_PKT_CNT(oq_no));
+
+	/* Clear the OQ doorbell  */
+	rte_write32(OTX_EP_CLEAR_SLIST_DBELL, droq->pkts_credit_reg);
+	while ((rte_read32(droq->pkts_credit_reg) != 0ull)) {
+		rte_write32(OTX_EP_CLEAR_SLIST_DBELL, droq->pkts_credit_reg);
+		rte_delay_ms(1);
+	}
+	otx_ep_dbg("SDP_R[%d]_credit:%x", oq_no,
+		   rte_read32(droq->pkts_credit_reg));
+
+	/* Clear the OQ_OUT_CNTS doorbell  */
+	reg_val = rte_read32(droq->pkts_sent_reg);
+	rte_write32((uint32_t)reg_val, droq->pkts_sent_reg);
+
+	otx_ep_dbg("SDP_R[%d]_sent: %x", oq_no,
+		   rte_read32(droq->pkts_sent_reg));
+
+	while (((rte_read32(droq->pkts_sent_reg)) != 0ull)) {
+		reg_val = rte_read32(droq->pkts_sent_reg);
+		rte_write32((uint32_t)reg_val, droq->pkts_sent_reg);
+		rte_delay_ms(1);
+	}
+	otx_ep_dbg("SDP_R[%d]_sent: %x", oq_no,
+		   rte_read32(droq->pkts_sent_reg));
+}
+
 static const struct otx_ep_config default_otx2_ep_conf = {
 	/* IQ attributes */
 	.iq                        = {
@@ -125,6 +242,9 @@ otx2_ep_vf_setup_device(struct otx_ep_device *otx_ep)
 
 	otx2_info("SDP RPVF: %d", otx_ep->sriov_info.rings_per_vf);
 
+	otx_ep->fn_list.setup_iq_regs       = otx2_vf_setup_iq_regs;
+	otx_ep->fn_list.setup_oq_regs       = otx2_vf_setup_oq_regs;
+
 	otx_ep->fn_list.setup_device_regs   = otx2_vf_setup_device_regs;
 
 	return 0;
drivers/net/octeontx_ep/otx_ep_common.h +72 -0

102 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_vf.c +120 -0

132 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_vf.h +49 -0

68 lines not on this page · raw message

Signature · 1 line
2.17.1
#57 lore raw

PATCH v6 10/12 net/octeontx_ep: added dev start and stop

In reply to Nalla Pradeep

Dev start and stop operations are added. To accomplish this internal functions to enable or disable io queues are incorporated.

---
 drivers/net/octeontx_ep/otx2_ep_vf.c    | 107 ++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_common.h |   8 ++
 drivers/net/octeontx_ep/otx_ep_ethdev.c |  44 ++++++++
 drivers/net/octeontx_ep/otx_ep_vf.c     | 128 ++++++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_vf.h     |   4 +
 5 files changed, 291 insertions(+)
drivers/net/octeontx_ep/otx2_ep_vf.c +107 -0
index 84de89ef7..64cd8731d 100644
@@ -188,6 +188,104 @@ otx2_vf_setup_oq_regs(struct otx_ep_device *otx_ep, uint32_t oq_no)
 		   rte_read32(droq->pkts_sent_reg));
 }
 
+static int
+otx2_vf_enable_iq(struct otx_ep_device *otx_ep, uint32_t q_no)
+{
+	uint64_t loop = SDP_VF_BUSY_LOOP_COUNT;
+	uint64_t reg_val = 0ull;
+
+	/* Resetting doorbells during IQ enabling also to handle abrupt
+	 * guest reboot. IQ reset does not clear the doorbells.
+	 */
+	otx2_write64(0xFFFFFFFF, otx_ep->hw_addr +
+		     SDP_VF_R_IN_INSTR_DBELL(q_no));
+
+	while (((otx2_read64(otx_ep->hw_addr +
+		 SDP_VF_R_IN_INSTR_DBELL(q_no))) != 0ull) && loop--) {
+		rte_delay_ms(1);
+	}
+
+	if (!loop) {
+		otx_ep_err("INSTR DBELL not coming back to 0\n");
+		return -EIO;
+	}
+
+	reg_val = otx2_read64(otx_ep->hw_addr + SDP_VF_R_IN_ENABLE(q_no));
+	reg_val |= 0x1ull;
+
+	otx2_write64(reg_val, otx_ep->hw_addr + SDP_VF_R_IN_ENABLE(q_no));
+
+	otx2_info("IQ[%d] enable done", q_no);
+
+	return 0;
+}
+
+static int
+otx2_vf_enable_oq(struct otx_ep_device *otx_ep, uint32_t q_no)
+{
+	uint64_t reg_val = 0ull;
+
+	reg_val = otx2_read64(otx_ep->hw_addr + SDP_VF_R_OUT_ENABLE(q_no));
+	reg_val |= 0x1ull;
+	otx2_write64(reg_val, otx_ep->hw_addr + SDP_VF_R_OUT_ENABLE(q_no));
+
+	otx2_info("OQ[%d] enable done", q_no);
+
+	return 0;
+}
+
+static int
+otx2_vf_enable_io_queues(struct otx_ep_device *otx_ep)
+{
+	uint32_t q_no = 0;
+	int ret;
+
+	for (q_no = 0; q_no < otx_ep->nb_tx_queues; q_no++) {
+		ret = otx2_vf_enable_iq(otx_ep, q_no);
+		if (ret)
+			return ret;
+	}
+
+	for (q_no = 0; q_no < otx_ep->nb_rx_queues; q_no++)
+		otx2_vf_enable_oq(otx_ep, q_no);
+
+	return 0;
+}
+
+static void
+otx2_vf_disable_iq(struct otx_ep_device *otx_ep, uint32_t q_no)
+{
+	uint64_t reg_val = 0ull;
+
+	/* Reset the doorbell register for this Input Queue. */
+	reg_val = otx2_read64(otx_ep->hw_addr + SDP_VF_R_IN_ENABLE(q_no));
+	reg_val &= ~0x1ull;
+
+	otx2_write64(reg_val, otx_ep->hw_addr + SDP_VF_R_IN_ENABLE(q_no));
+}
+
+static void
+otx2_vf_disable_oq(struct otx_ep_device *otx_ep, uint32_t q_no)
+{
+	volatile uint64_t reg_val = 0ull;
+
+	reg_val = otx2_read64(otx_ep->hw_addr + SDP_VF_R_OUT_ENABLE(q_no));
+	reg_val &= ~0x1ull;
+
+	otx2_write64(reg_val, otx_ep->hw_addr + SDP_VF_R_OUT_ENABLE(q_no));
+}
+
+static void
+otx2_vf_disable_io_queues(struct otx_ep_device *otx_ep)
+{
+	uint32_t q_no = 0;
+
+	for (q_no = 0; q_no < otx_ep->sriov_info.rings_per_vf; q_no++) {
+		otx2_vf_disable_iq(otx_ep, q_no);
+		otx2_vf_disable_oq(otx_ep, q_no);
+	}
+}
+
 static const struct otx_ep_config default_otx2_ep_conf = {
 	/* IQ attributes */
 	.iq                        = {
@@ -247,5 +345,14 @@ otx2_ep_vf_setup_device(struct otx_ep_device *otx_ep)
 
 	otx_ep->fn_list.setup_device_regs   = otx2_vf_setup_device_regs;
 
+	otx_ep->fn_list.enable_io_queues    = otx2_vf_enable_io_queues;
+	otx_ep->fn_list.disable_io_queues   = otx2_vf_disable_io_queues;
+
+	otx_ep->fn_list.enable_iq           = otx2_vf_enable_iq;
+	otx_ep->fn_list.disable_iq          = otx2_vf_disable_iq;
+
+	otx_ep->fn_list.enable_oq           = otx2_vf_enable_oq;
+	otx_ep->fn_list.disable_oq          = otx2_vf_disable_oq;
+
 	return 0;
 }
drivers/net/octeontx_ep/otx_ep_common.h +8 -0
index 409093179..e0ce37ef4 100644
@@ -19,6 +19,7 @@
 #define OTX_EP_PCI_RING_ALIGN   65536
 #define SDP_PKIND 40
 #define SDP_OTX2_PKIND 57
+#define OTX_EP_BUSY_LOOP_COUNT      (10000)
 #define OTX_EP_MAX_IOQS_PER_VF 8
 
 #define otx_ep_info(fmt, args...)				\
@@ -374,7 +375,14 @@ struct otx_ep_fn_list {
 
 	void (*setup_device_regs)(struct otx_ep_device *otx_ep);
 
+	int (*enable_io_queues)(struct otx_ep_device *otx_ep);
 	void (*disable_io_queues)(struct otx_ep_device *otx_ep);
+
+	int (*enable_iq)(struct otx_ep_device *otx_ep, uint32_t q_no);
+	void (*disable_iq)(struct otx_ep_device *otx_ep, uint32_t q_no);
+
+	int (*enable_oq)(struct otx_ep_device *otx_ep, uint32_t q_no);
+	void (*disable_oq)(struct otx_ep_device *otx_ep, uint32_t q_no);
 };
 
 /* OTX_EP EP VF device data structure */
drivers/net/octeontx_ep/otx_ep_ethdev.c +44 -0

62 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_vf.c +128 -0

139 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_vf.h +4 -0
index c6115d37c..f05843557 100644
@@ -8,6 +8,7 @@
 
 /* OTX_EP VF IQ Registers */
 #define OTX_EP_R_IN_CONTROL_START         (0x10000)
+#define OTX_EP_R_IN_ENABLE_START          (0x10010)
 #define OTX_EP_R_IN_INSTR_BADDR_START     (0x10020)
 #define OTX_EP_R_IN_INSTR_RSIZE_START     (0x10030)
 #define OTX_EP_R_IN_INSTR_DBELL_START     (0x10040)
@@ -17,6 +18,9 @@
 #define OTX_EP_R_IN_CONTROL(ring)  \
 	(OTX_EP_R_IN_CONTROL_START + ((ring) * OTX_EP_RING_OFFSET))
 
+#define OTX_EP_R_IN_ENABLE(ring)   \
+	(OTX_EP_R_IN_ENABLE_START + ((ring) * OTX_EP_RING_OFFSET))
+
 #define OTX_EP_R_IN_INSTR_BADDR(ring)   \
 	(OTX_EP_R_IN_INSTR_BADDR_START + ((ring) * OTX_EP_RING_OFFSET))
 
Signature · 1 line
2.17.1
#58 lore raw

PATCH v6 11/12 net/octeontx_ep: receive data path function added

In reply to Nalla Pradeep

Function to deliver packets from DROQ to application is added. It also fills DROQ with receive buffers timely such that device can fill them with incoming packets.

---
 drivers/net/octeontx_ep/otx_ep_common.h |   1 +
 drivers/net/octeontx_ep/otx_ep_ethdev.c |   3 +
 drivers/net/octeontx_ep/otx_ep_rxtx.c   | 287 +++++++++++++++++++++++-
 drivers/net/octeontx_ep/otx_ep_rxtx.h   |  12 +-
 4 files changed, 301 insertions(+), 2 deletions(-)
drivers/net/octeontx_ep/otx_ep_common.h +1 -0
index e0ce37ef4..e6618029c 100644
@@ -21,6 +21,7 @@
 #define SDP_OTX2_PKIND 57
 #define OTX_EP_BUSY_LOOP_COUNT      (10000)
 #define OTX_EP_MAX_IOQS_PER_VF 8
+#define OTX_CUST_DATA_LEN 0
 
 #define otx_ep_info(fmt, args...)				\
 	rte_log(RTE_LOG_DEBUG, otx_net_ep_loginfo,		\
drivers/net/octeontx_ep/otx_ep_ethdev.c +3 -0
index f53c98132..1e4a206cd 100644
@@ -136,6 +136,7 @@ otx_epdev_init(struct otx_ep_device *otx_epvf)
 
 	otx_epvf->fn_list.setup_device_regs(otx_epvf);
 
+	otx_epvf->eth_dev->rx_pkt_burst = &otx_ep_recv_pkts;
 	ethdev_queues = (uint32_t)(otx_epvf->sriov_info.rings_per_vf);
 	otx_epvf->max_rx_queues = ethdev_queues;
 	otx_epvf->max_tx_queues = ethdev_queues;
@@ -382,6 +383,8 @@ otx_ep_eth_dev_uninit(struct rte_eth_dev *eth_dev)
 	otx_epdev_exit(eth_dev);
 
 	eth_dev->dev_ops = NULL;
+	eth_dev->rx_pkt_burst = NULL;
+	eth_dev->tx_pkt_burst = NULL;
 
 	return 0;
 }
drivers/net/octeontx_ep/otx_ep_rxtx.c +286 -1

308 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_rxtx.h +11 -1
index 9779e96b6..d8b411459 100644
@@ -7,4 +7,14 @@
 
 #define OTX_EP_RXD_ALIGN 1
 #define OTX_EP_TXD_ALIGN 1
-#endif
+#define OTX_EP_MAX_DELAYED_PKT_RETRIES 10000
+static inline uint32_t
+otx_ep_incr_index(uint32_t index, uint32_t count, uint32_t max)
+{
+	return ((index + count) & (max - 1));
+}
+uint16_t
+otx_ep_recv_pkts(void *rx_queue,
+		  struct rte_mbuf **rx_pkts,
+		  uint16_t budget);
+#endif /* _OTX_EP_RXTX_H_ */
Signature · 1 line
2.17.1
#59 lore raw

Re: [dpdk-dev] [PATCH v6 11/12] net/octeontx_ep: receive data path function added

Quoted 5 lines · Nalla Pradeep

Function to deliver packets from DROQ to application is added. It also fills DROQ with receive buffers timely such that device can fill them with incoming packets.

<...>

drivers/net/octeontx_ep/otx_ep_rxtx.c otx_ep_droq_setup_ring_buffers(struct otx_ep_droq *droq) · line 250

Quoted 7 lines
drivers/net/octeontx_ep/otx_ep_rxtx.c +0 -1
@@ -240,7 +246,6 @@ otx_ep_droq_setup_ring_buffers(struct otx_ep_droq *droq)
  		if (buf == NULL) {
  			otx_ep_err("OQ buffer alloc failed\n");
  			droq->stats.rx_alloc_failure++;
-			/* otx_ep_droq_destroy_ring_buffers(droq);*/
  			return -ENOMEM;
  		}

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

#60 lore raw

PATCH v6 12/12 net/octeontx_ep: transmit data path function added

In reply to Nalla Pradeep

1. Packet transmit function for both otx and otx2 are added.
2. Flushing transmit(command) queue when pending commands are more than maximum allowed value (currently 16).
3. Scatter gather support if the packet spans multiple buffers.

---
 drivers/net/octeontx_ep/otx2_ep_vf.h    |  19 ++
 drivers/net/octeontx_ep/otx_ep_common.h |  51 +++
 drivers/net/octeontx_ep/otx_ep_ethdev.c |   5 +
 drivers/net/octeontx_ep/otx_ep_rxtx.c   | 423 ++++++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_rxtx.h   |  26 ++
 drivers/net/octeontx_ep/otx_ep_vf.h     |  67 ++++
 6 files changed, 591 insertions(+)
drivers/net/octeontx_ep/otx2_ep_vf.h +19 -0
index 191fee426..5e5aefbc1 100644
@@ -7,5 +7,24 @@
 int
 otx2_ep_vf_setup_device(struct otx_ep_device *sdpvf);
 
+struct otx2_ep_instr_64B {
+	/* Pointer where the input data is available. */
+	uint64_t dptr;
+
+	/* OTX_EP Instruction Header. */
+	union otx_ep_instr_ih ih;
+
+	/** Pointer where the response for a RAW mode packet
+	 * will be written by OCTEON TX.
+	 */
+	uint64_t rptr;
+
+	/* Input Request Header. */
+	union otx_ep_instr_irh irh;
+
+	/* Additional headers available in a 64-byte instruction. */
+	uint64_t exhdr[4];
+};
+
 #endif /*_OTX2_EP_VF_H_ */
 
drivers/net/octeontx_ep/otx_ep_common.h +51 -0

74 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_ethdev.c +5 -0
index 1e4a206cd..82a81c6e4 100644
@@ -137,6 +137,11 @@ otx_epdev_init(struct otx_ep_device *otx_epvf)
 	otx_epvf->fn_list.setup_device_regs(otx_epvf);
 
 	otx_epvf->eth_dev->rx_pkt_burst = &otx_ep_recv_pkts;
+	if (otx_epvf->chip_id == PCI_DEVID_OCTEONTX_EP_VF)
+		otx_epvf->eth_dev->tx_pkt_burst = &otx_ep_xmit_pkts;
+	else if (otx_epvf->chip_id == PCI_DEVID_OCTEONTX2_EP_NET_VF ||
+		 otx_epvf->chip_id == PCI_DEVID_CN98XX_EP_NET_VF)
+		otx_epvf->eth_dev->tx_pkt_burst = &otx2_ep_xmit_pkts;
 	ethdev_queues = (uint32_t)(otx_epvf->sriov_info.rings_per_vf);
 	otx_epvf->max_rx_queues = ethdev_queues;
 	otx_epvf->max_tx_queues = ethdev_queues;
drivers/net/octeontx_ep/otx_ep_rxtx.c +423 -0

429 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_rxtx.h +26 -0
index d8b411459..1527d350b 100644
@@ -5,15 +5,41 @@
 #ifndef _OTX_EP_RXTX_H_
 #define _OTX_EP_RXTX_H_
 
+#include <rte_byteorder.h>
+
 #define OTX_EP_RXD_ALIGN 1
 #define OTX_EP_TXD_ALIGN 1
+
+#define OTX_EP_IQ_SEND_FAILED      (-1)
+#define OTX_EP_IQ_SEND_SUCCESS     (0)
+
 #define OTX_EP_MAX_DELAYED_PKT_RETRIES 10000
+
+#define OTX_EP_FSZ 28
+#define OTX2_EP_FSZ 24
+#define OTX_EP_MAX_INSTR 16
+
+static inline void
+otx_ep_swap_8B_data(uint64_t *data, uint32_t blocks)
+{
+	/* Swap 8B blocks */
+	while (blocks) {
+		*data = rte_bswap64(*data);
+		blocks--;
+		data++;
+	}
+}
+
 static inline uint32_t
 otx_ep_incr_index(uint32_t index, uint32_t count, uint32_t max)
 {
 	return ((index + count) & (max - 1));
 }
 uint16_t
+otx_ep_xmit_pkts(void *tx_queue, struct rte_mbuf **pkts, uint16_t nb_pkts);
+uint16_t
+otx2_ep_xmit_pkts(void *tx_queue, struct rte_mbuf **pkts, uint16_t nb_pkts);
+uint16_t
 otx_ep_recv_pkts(void *rx_queue,
 		  struct rte_mbuf **rx_pkts,
 		  uint16_t budget);
drivers/net/octeontx_ep/otx_ep_vf.h +67 -0

73 lines not on this page · raw message

Signature · 1 line
2.17.1
#61 lore raw

PATCH v5 2/11 net/octeontx_ep: add ethdev probe and remove

In reply to Nalla Pradeep

add basic PCIe ethdev probe and remove.

---
 drivers/common/octeontx2/otx2_common.h    |  3 ++
 drivers/net/octeontx_ep/meson.build       |  2 +
 drivers/net/octeontx_ep/otx_ep_common.h   | 14 ++++++
 drivers/net/octeontx_ep/otx_ep_ethdev.c   | 56 +++++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_vf.h       |  9 ++++
 drivers/raw/octeontx2_ep/otx2_ep_rawdev.c |  6 +--
 6 files changed, 87 insertions(+), 3 deletions(-)
 create mode 100644 drivers/net/octeontx_ep/otx_ep_common.h
 create mode 100644 drivers/net/octeontx_ep/otx_ep_vf.h
drivers/common/octeontx2/otx2_common.h +3 -0
index b6779f710..96021eda2 100644
@@ -137,6 +137,9 @@ extern int otx2_logtype_ree;
 #define PCI_DEVID_OCTEONTX2_RVU_AF_VF		0xA0f8
 #define PCI_DEVID_OCTEONTX2_DPI_VF		0xA081
 #define PCI_DEVID_OCTEONTX2_EP_VF		0xB203 /* OCTEON TX2 EP mode */
+/* OCTEON TX2 98xx EP mode */
+#define PCI_DEVID_CN98XX_EP_NET_VF		0xB103
+#define PCI_DEVID_OCTEONTX2_EP_RAW_VF		0xB204 /* OCTEON TX2 EP mode */
 #define PCI_DEVID_OCTEONTX2_RVU_SDP_PF		0xA0f6
 #define PCI_DEVID_OCTEONTX2_RVU_SDP_VF		0xA0f7
 #define PCI_DEVID_OCTEONTX2_RVU_REE_PF		0xA0f4
drivers/net/octeontx_ep/meson.build +2 -0
index 2ef2222d2..73e04b0be 100644
@@ -2,7 +2,9 @@
 # Copyright(C) 2021 Marvell.
 #
 
+deps += ['common_octeontx2']
 sources = files(
                'otx_ep_ethdev.c',
                )
 
+includes += include_directories('../../common/octeontx2')
drivers/net/octeontx_ep/otx_ep_common.h new file +14 -0
new file mode 100644
index 000000000..35ea99a79
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+#ifndef _OTX_EP_COMMON_H_
+#define _OTX_EP_COMMON_H_
+
+/* OTX_EP EP VF device data structure */
+struct otx_ep_device {
+	/* PCI device pointer */
+	struct rte_pci_device *pdev;
+
+	struct rte_eth_dev *eth_dev;
+};
+#endif  /* _OTX_EP_COMMON_H_ */
drivers/net/octeontx_ep/otx_ep_ethdev.c +56 -0

59 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_vf.h new file +9 -0
new file mode 100644
index 000000000..e88b40971
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+#ifndef _OTX_EP_VF_H_
+#define _OTX_EP_VF_H_
+
+#define PCI_DEVID_OCTEONTX_EP_VF 0xa303
+
+#endif /*_OTX_EP_VF_H_ */
drivers/raw/octeontx2_ep/otx2_ep_rawdev.c +3 -3
index 2b78a7941..b2ccdda83 100644
@@ -22,7 +22,7 @@
 static const struct rte_pci_id pci_sdp_vf_map[] = {
 	{
 		RTE_PCI_DEVICE(PCI_VENDOR_ID_CAVIUM,
-			       PCI_DEVID_OCTEONTX2_EP_VF)
+			       PCI_DEVID_OCTEONTX2_EP_RAW_VF)
 	},
 	{
 		.vendor_id = 0,
@@ -109,8 +109,8 @@ sdp_chip_specific_setup(struct sdp_device *sdpvf)
 	int ret;
 
 	switch (dev_id) {
-	case PCI_DEVID_OCTEONTX2_EP_VF:
-		sdpvf->chip_id = PCI_DEVID_OCTEONTX2_EP_VF;
+	case PCI_DEVID_OCTEONTX2_EP_RAW_VF:
+		sdpvf->chip_id = PCI_DEVID_OCTEONTX2_EP_RAW_VF;
 		ret = sdp_vf_setup_device(sdpvf);
 
 		break;
Signature · 1 line
2.17.1
#62 lore raw

PATCH v5 3/11 net/octeontx_ep: add device init and uninit

In reply to Nalla Pradeep

Add basic init and uninit function which includes
initializing fields of ethdev private structure.

---
 drivers/common/octeontx2/otx2_common.h  |  2 +-
 drivers/net/octeontx_ep/otx_ep_common.h | 19 ++++++-
 drivers/net/octeontx_ep/otx_ep_ethdev.c | 72 +++++++++++++++++++++++--
 3 files changed, 86 insertions(+), 7 deletions(-)
drivers/common/octeontx2/otx2_common.h +1 -1
index 96021eda2..cd52e098e 100644
@@ -136,7 +136,7 @@ extern int otx2_logtype_ree;
 #define PCI_DEVID_OCTEONTX2_RVU_CPT_VF		0xA0FE
 #define PCI_DEVID_OCTEONTX2_RVU_AF_VF		0xA0f8
 #define PCI_DEVID_OCTEONTX2_DPI_VF		0xA081
-#define PCI_DEVID_OCTEONTX2_EP_VF		0xB203 /* OCTEON TX2 EP mode */
+#define PCI_DEVID_OCTEONTX2_EP_NET_VF		0xB203 /* OCTEON TX2 EP mode */
 /* OCTEON TX2 98xx EP mode */
 #define PCI_DEVID_CN98XX_EP_NET_VF		0xB103
 #define PCI_DEVID_OCTEONTX2_EP_RAW_VF		0xB204 /* OCTEON TX2 EP mode */
drivers/net/octeontx_ep/otx_ep_common.h +18 -1
index 35ea99a79..0d6484c87 100644
@@ -4,11 +4,28 @@
 #ifndef _OTX_EP_COMMON_H_
 #define _OTX_EP_COMMON_H_
 
+#define otx_ep_info(fmt, args...)				\
+	RTE_LOG(INFO, PMD, fmt "\n", ## args)
+
+#define otx_ep_err(fmt, args...)				\
+	RTE_LOG(ERR, PMD, "%s():%u " fmt "\n",			\
+		__func__, __LINE__, ## args)
+
+#define otx_ep_dbg(fmt, args...)				\
+	rte_log(RTE_LOG_DEBUG, otx_net_ep_logtype,		\
+		"%s():%u " fmt "\n",				\
+		__func__, __LINE__, ##args)
+
 /* OTX_EP EP VF device data structure */
 struct otx_ep_device {
 	/* PCI device pointer */
 	struct rte_pci_device *pdev;
-
+	uint16_t chip_id;
 	struct rte_eth_dev *eth_dev;
+	int port_id;
+	/* Memory mapped h/w address */
+	uint8_t *hw_addr;
 };
+
+extern int otx_net_ep_logtype;
 #endif  /* _OTX_EP_COMMON_H_ */
drivers/net/octeontx_ep/otx_ep_ethdev.c +67 -5

93 lines not on this page · raw message

Signature · 1 line
2.17.1
#63 lore raw

Re: [dpdk-dev] [PATCH v5 03/11] net/octeontx_ep: add device init and uninit

Quoted 15 lines · Nalla Pradeep

Add basic init and uninit function which includes
initializing fields of ethdev private structure.

---
  drivers/common/octeontx2/otx2_common.h  |  2 +-
  drivers/net/octeontx_ep/otx_ep_common.h | 19 ++++++-
  drivers/net/octeontx_ep/otx_ep_ethdev.c | 72 +++++++++++++++++++++++--
  3 files changed, 86 insertions(+), 7 deletions(-)
drivers/common/octeontx2/otx2_common.h +0 -0
index 96021eda2..cd52e098e 100644

drivers/common/octeontx2/otx2_common.h extern int otx2_logtype_ree; · line 139

Quoted 5 lines
drivers/common/octeontx2/otx2_common.h +1 -1
@@ -136,7 +136,7 @@ extern int otx2_logtype_ree;
  #define PCI_DEVID_OCTEONTX2_RVU_CPT_VF		0xA0FE
  #define PCI_DEVID_OCTEONTX2_RVU_AF_VF		0xA0f8
  #define PCI_DEVID_OCTEONTX2_DPI_VF		0xA081
-#define PCI_DEVID_OCTEONTX2_EP_VF		0xB203 /* OCTEON TX2 EP mode */
+#define PCI_DEVID_OCTEONTX2_EP_NET_VF		0xB203 /* OCTEON TX2 EP mode */

Hi Nalla,

Can you prepare a patch as a first patch of your series, that
1) renames 'PCI_DEVID_OCTEONTX2_EP_VF' -> 'PCI_DEVID_OCTEONTX2_EP_NET_VF'
2) adds 'PCI_DEVID_OCTEONTX2_EP_RAW_VF'

And does required driver changes for above.

Since that change requires update in the existing driver, 'raw/octeontx2_ep', better to get it out of way before 'net/octeontx_ep' changes, instead of spreading this into the 'net/octeontx_ep' patches.

What do you think?

Quoted 8 lines
drivers/common/octeontx2/otx2_common.h +0 -0
  /* OCTEON TX2 98xx EP mode */
  #define PCI_DEVID_CN98XX_EP_NET_VF		0xB103
  #define PCI_DEVID_OCTEONTX2_EP_RAW_VF		0xB204 /* OCTEON TX2 EP mode */
drivers/net/octeontx_ep/otx_ep_common.h +0 -0
index 35ea99a79..0d6484c87 100644

drivers/net/octeontx_ep/otx_ep_common.h line 12

Quoted 9 lines
drivers/net/octeontx_ep/otx_ep_common.h +6 -0
@@ -4,11 +4,28 @@
  #ifndef _OTX_EP_COMMON_H_
  #define _OTX_EP_COMMON_H_
 
+#define otx_ep_info(fmt, args...)				\
+	RTE_LOG(INFO, PMD, fmt "\n", ## args)
+
+#define otx_ep_err(fmt, args...)				\
+	RTE_LOG(ERR, PMD, "%s():%u " fmt "\n",			\
+		__func__, __LINE__, ## args)

Below is using new log type, 'otx_net_ep_logtype', but why above two, 'info' & 'err' types continue to use 'RTE_LOGTYPE_PMD'? Can you switch them to new log type please?

drivers/net/octeontx_ep/otx_ep_common.h line 18

Quoted 6 lines
drivers/net/octeontx_ep/otx_ep_common.h +6 -0
+
+#define otx_ep_dbg(fmt, args...)				\
+	rte_log(RTE_LOG_DEBUG, otx_net_ep_logtype,		\
+		"%s():%u " fmt "\n",				\
+		__func__, __LINE__, ##args)
+

I think you need to move 'RTE_LOG_REGISTER' into this patch, that macro creates the 'otx_net_ep_logtype' logtype variable. Currently that macro is in next patch.

<...>

Quoted 11 lines
drivers/net/octeontx_ep/otx_ep_common.h +7 -1
  static int
  otx_ep_eth_dev_init(struct rte_eth_dev *eth_dev)
  {
-	RTE_SET_USED(eth_dev);
+	struct rte_pci_device *pdev = RTE_ETH_DEV_TO_PCI(eth_dev);
+	struct otx_ep_device *otx_epvf = OTX_EP_DEV(eth_dev);
+	struct rte_ether_addr vf_mac_addr;
+
+	/* Single process support */
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		return 0;

drivers/net/octeontx_ep/otx_ep_common.h

Quoted 10 lines
drivers/net/octeontx_ep/otx_ep_common.h +10 -0
+
+	otx_epvf->eth_dev = eth_dev;
+	otx_epvf->port_id = eth_dev->data->port_id;
+	eth_dev->data->mac_addrs = rte_zmalloc("otx_ep", RTE_ETHER_ADDR_LEN, 0);
+	if (eth_dev->data->mac_addrs == NULL) {
+		otx_ep_err("MAC addresses memory allocation failed\n");
+		return -ENOMEM;
+	}
+	rte_eth_random_addr(vf_mac_addr.addr_bytes);
+	rte_ether_addr_copy(eth_dev->data->mac_addrs, &vf_mac_addr);

The API is 'rte_ether_addr_copy(from, to)', _unfortunately it is reverse of the more standard (dst, src) order_, can parameters be used wrong above?

#64 lore raw

PATCH v5 4/11 net/octeontx_ep: added basic device setup

In reply to Nalla Pradeep

Functions to setup device, basic input queue and output queue registers are added.

---
 drivers/net/octeontx_ep/meson.build     |   2 +
 drivers/net/octeontx_ep/otx2_ep_vf.c    | 131 +++++++++++++++++++++
 drivers/net/octeontx_ep/otx2_ep_vf.h    |  11 ++
 drivers/net/octeontx_ep/otx_ep_common.h |  92 +++++++++++++++
 drivers/net/octeontx_ep/otx_ep_ethdev.c |   8 ++
 drivers/net/octeontx_ep/otx_ep_vf.c     | 148 ++++++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_vf.h     |  33 ++++++
 7 files changed, 425 insertions(+)
 create mode 100644 drivers/net/octeontx_ep/otx2_ep_vf.c
 create mode 100644 drivers/net/octeontx_ep/otx2_ep_vf.h
 create mode 100644 drivers/net/octeontx_ep/otx_ep_vf.c
drivers/net/octeontx_ep/meson.build +2 -0
index 73e04b0be..8cd2e76d1 100644
@@ -5,6 +5,8 @@
 deps += ['common_octeontx2']
 sources = files(
                'otx_ep_ethdev.c',
+               'otx_ep_vf.c',
+               'otx2_ep_vf.c',
                )
 
 includes += include_directories('../../common/octeontx2')
drivers/net/octeontx_ep/otx2_ep_vf.c new file +131 -0

131 lines not on this page · raw message

drivers/net/octeontx_ep/otx2_ep_vf.h new file +11 -0
new file mode 100644
index 000000000..191fee426
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+#ifndef _OTX2_EP_VF_H_
+#define _OTX2_EP_VF_H_
+
+int
+otx2_ep_vf_setup_device(struct otx_ep_device *sdpvf);
+
+#endif /*_OTX2_EP_VF_H_ */
+
drivers/net/octeontx_ep/otx_ep_common.h +92 -0

113 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_ethdev.c +8 -0
index 07cf07464..ccd2d027d 100644
@@ -7,6 +7,7 @@
 #include "otx2_common.h"
 #include "otx_ep_common.h"
 #include "otx_ep_vf.h"
+#include "otx2_ep_vf.h"
 
 #define OTX_EP_DEV(_eth_dev)            ((_eth_dev)->data->dev_private)
 static int
@@ -19,10 +20,12 @@ otx_ep_chip_specific_setup(struct otx_ep_device *otx_epvf)
 	switch (dev_id) {
 	case PCI_DEVID_OCTEONTX_EP_VF:
 		otx_epvf->chip_id = dev_id;
+		ret = otx_ep_vf_setup_device(otx_epvf);
 		break;
 	case PCI_DEVID_OCTEONTX2_EP_NET_VF:
 	case PCI_DEVID_CN98XX_EP_NET_VF:
 		otx_epvf->chip_id = dev_id;
+		ret = otx2_ep_vf_setup_device(otx_epvf);
 		break;
 	default:
 		otx_ep_err("Unsupported device\n");
@@ -47,6 +50,10 @@ otx_epdev_init(struct otx_ep_device *otx_epvf)
 		goto setup_fail;
 	}
 
+	otx_epvf->fn_list.setup_device_regs(otx_epvf);
+
+	otx_ep_info("OTX_EP Device is Ready\n");
+
 setup_fail:
 	return ret;
 }
@@ -119,3 +126,4 @@ static struct rte_pci_driver rte_otx_ep_pmd = {
 RTE_PMD_REGISTER_PCI(net_otx_ep, rte_otx_ep_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_otx_ep, pci_id_otx_ep_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_otx_ep, "* igb_uio | vfio-pci");
+RTE_LOG_REGISTER(otx_net_ep_logtype, pmd.net.octeontx_ep, NOTICE);
drivers/net/octeontx_ep/otx_ep_vf.c new file +148 -0

148 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_vf.h +33 -0
index e88b40971..c5741a3f1 100644
@@ -4,6 +4,39 @@
 #ifndef _OTX_EP_VF_H_
 #define _OTX_EP_VF_H_
 
+#define OTX_EP_RING_OFFSET                (0x1ull << 17)
+
+/* OTX_EP VF IQ Registers */
+#define OTX_EP_R_IN_CONTROL_START         (0x10000)
+#define OTX_EP_R_IN_CONTROL(ring)  \
+	(OTX_EP_R_IN_CONTROL_START + ((ring) * OTX_EP_RING_OFFSET))
+
+/* OTX_EP VF IQ Masks */
+#define OTX_EP_R_IN_CTL_RPVF_MASK       (0xF)
+#define	OTX_EP_R_IN_CTL_RPVF_POS        (48)
+
+#define OTX_EP_R_IN_CTL_IDLE            (0x1ull << 28)
+#define OTX_EP_R_IN_CTL_RDSIZE          (0x3ull << 25) /* Setting to max(4) */
+#define OTX_EP_R_IN_CTL_IS_64B          (0x1ull << 24)
+#define OTX_EP_R_IN_CTL_ESR             (0x1ull << 1)
+/* OTX_EP VF OQ Registers */
+#define OTX_EP_R_OUT_CONTROL_START           (0x10150)
+#define OTX_EP_R_OUT_CONTROL(ring)    \
+	(OTX_EP_R_OUT_CONTROL_START + ((ring) * OTX_EP_RING_OFFSET))
+/* OTX_EP VF OQ Masks */
+#define OTX_EP_R_OUT_CTL_ES_I         (1ull << 34)
+#define OTX_EP_R_OUT_CTL_NSR_I        (1ull << 33)
+#define OTX_EP_R_OUT_CTL_ROR_I        (1ull << 32)
+#define OTX_EP_R_OUT_CTL_ES_D         (1ull << 30)
+#define OTX_EP_R_OUT_CTL_NSR_D        (1ull << 29)
+#define OTX_EP_R_OUT_CTL_ROR_D        (1ull << 28)
+#define OTX_EP_R_OUT_CTL_ES_P         (1ull << 26)
+#define OTX_EP_R_OUT_CTL_NSR_P        (1ull << 25)
+#define OTX_EP_R_OUT_CTL_ROR_P        (1ull << 24)
+#define OTX_EP_R_OUT_CTL_IMODE        (1ull << 23)
+
 #define PCI_DEVID_OCTEONTX_EP_VF 0xa303
 
+int
+otx_ep_vf_setup_device(struct otx_ep_device *otx_ep);
 #endif /*_OTX_EP_VF_H_ */
Signature · 1 line
2.17.1
#65 lore raw

PATCH v5 5/11 net/octeontx_ep: add dev info get and configure

In reply to Nalla Pradeep

Add device information get and device configure operations.

---
 doc/guides/nics/features/octeontx_ep.ini |  1 +
 drivers/net/octeontx_ep/otx_ep_common.h  | 15 +++++
 drivers/net/octeontx_ep/otx_ep_ethdev.c  | 81 +++++++++++++++++++++++-
 drivers/net/octeontx_ep/otx_ep_rxtx.h    | 10 +++
 4 files changed, 106 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/octeontx_ep/otx_ep_rxtx.h
doc/guides/nics/features/octeontx_ep.ini +1 -0
index 660fbc287..d1453f5be 100644
@@ -4,6 +4,7 @@
 ; Refer to default.ini for the full list of available PMD features.
 ;
 [Features]
+Speed capabilities   = P
 SR-IOV               = Y
 Linux                = Y
 x86-64               = Y
drivers/net/octeontx_ep/otx_ep_common.h +15 -0
index 8a268dc1a..28a512445 100644
@@ -7,9 +7,12 @@
 #define OTX_EP_MAX_RINGS_PER_VF        (8)
 #define OTX_EP_CFG_IO_QUEUES        OTX_EP_MAX_RINGS_PER_VF
 #define OTX_EP_64BYTE_INSTR         (64)
+#define OTX_EP_MIN_IQ_DESCRIPTORS   (128)
+#define OTX_EP_MIN_OQ_DESCRIPTORS   (128)
 #define OTX_EP_MAX_IQ_DESCRIPTORS   (8192)
 #define OTX_EP_MAX_OQ_DESCRIPTORS   (8192)
 #define OTX_EP_OQ_BUF_SIZE          (2048)
+#define OTX_EP_MIN_RX_BUF_SIZE      (64)
 
 #define OTX_EP_OQ_INFOPTR_MODE      (0)
 #define OTX_EP_OQ_REFIL_THRESHOLD   (16)
@@ -112,12 +115,24 @@ struct otx_ep_device {
 
 	struct otx_ep_fn_list fn_list;
 
+	uint32_t max_tx_queues;
+
+	uint32_t max_rx_queues;
+
 	/* SR-IOV info */
 	struct otx_ep_sriov_info sriov_info;
 
 	/* Device configuration */
 	const struct otx_ep_config *conf;
+
+	uint64_t rx_offloads;
+
+	uint64_t tx_offloads;
 };
 
+#define OTX_EP_MAX_PKT_SZ 64000U
+
+#define OTX_EP_MAX_MAC_ADDRS 1
+
 extern int otx_net_ep_logtype;
 #endif  /* _OTX_EP_COMMON_H_ */
drivers/net/octeontx_ep/otx_ep_ethdev.c +80 -1

112 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_rxtx.h new file +10 -0
new file mode 100644
index 000000000..9779e96b6
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+
+#ifndef _OTX_EP_RXTX_H_
+#define _OTX_EP_RXTX_H_
+
+#define OTX_EP_RXD_ALIGN 1
+#define OTX_EP_TXD_ALIGN 1
+#endif
Signature · 1 line
2.17.1
#66 lore raw

Re: [dpdk-dev] [PATCH v5 05/11] net/octeontx_ep: add dev info get and configure

Quoted 3 lines · Nalla Pradeep

Add device information get and device configure operations.

<...>

Quoted 6 lines
drivers/net/octeontx_ep/otx_ep_ethdev.c +6 -0
+static int
+otx_ep_dev_configure(struct rte_eth_dev *eth_dev)
+{
+	struct otx_ep_device *otx_epvf = OTX_EP_DEV(eth_dev);
+	struct rte_eth_dev_data *data = eth_dev->data;
+	struct rte_eth_rxmode *rxmode;

drivers/net/octeontx_ep/otx_ep_ethdev.c otx_epdev_init(struct otx_ep_device *otx_epvf) · line 122

Quoted 10 lines
drivers/net/octeontx_ep/otx_ep_ethdev.c +10 -0
+	struct rte_eth_txmode *txmode;
+	struct rte_eth_conf *conf;
+
+	conf = &data->dev_conf;
+	rxmode = &conf->rxmode;
+	txmode = &conf->txmode;
+	if (eth_dev->data->nb_rx_queues > otx_epvf->max_rx_queues ||
+	    eth_dev->data->nb_tx_queues > otx_epvf->max_tx_queues) {
+		otx_ep_err("invalid num queues\n");
+		return -ENOMEM;

I can see there are a few more 'ENOMEM' return are remaining, can you please scan all code for improper return value usage?

#67 lore raw

PATCH v5 6/11 net/octeontx_ep: added rxq setup and release

In reply to Nalla Pradeep

Receive queue setup involves allocating memory for the queue, initializing data structure representing the queue and filling queue with receive buffers of rx descriptor count. Receive queues are referred as droq. Hardware fills the receive buffers in queue with the packet.

In receive queue release, receive buffers are freed along with the receive queue.

---
 drivers/net/octeontx_ep/meson.build     |   1 +
 drivers/net/octeontx_ep/otx_ep_common.h | 149 ++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_ethdev.c | 127 +++++++++++++-
 drivers/net/octeontx_ep/otx_ep_rxtx.c   | 223 ++++++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_vf.h     |   6 +
 5 files changed, 505 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/octeontx_ep/otx_ep_rxtx.c
drivers/net/octeontx_ep/meson.build +1 -0
index 8cd2e76d1..a8436f35f 100644
@@ -7,6 +7,7 @@ sources = files(
                'otx_ep_ethdev.c',
                'otx_ep_vf.c',
                'otx2_ep_vf.c',
+               'otx_ep_rxtx.c',
                )
 
 includes += include_directories('../../common/octeontx2')
drivers/net/octeontx_ep/otx_ep_common.h +149 -0

192 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_ethdev.c +126 -1

164 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_rxtx.c new file +223 -0

223 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_vf.h +6 -0
index c5741a3f1..d17c87909 100644
@@ -37,6 +37,12 @@
 
 #define PCI_DEVID_OCTEONTX_EP_VF 0xa303
 
+/* this is a static value set by SLI PF driver in octeon
+ * No handshake is available
+ * Change this if changing the value in SLI PF driver
+ */
+#define SDP_GBL_WMARK 0x100
+
 int
 otx_ep_vf_setup_device(struct otx_ep_device *otx_ep);
 #endif /*_OTX_EP_VF_H_ */
Signature · 1 line
2.17.1
#68 lore raw

PATCH v5 7/11 net/octeontx_ep: added tx queue setup and release

In reply to Nalla Pradeep

Transmit queue setup involves allocating memory for the command queue considering tx descriptor count and initializing data structure representing the queue. Transmit queue release function frees the command queue.

---
 drivers/net/octeontx_ep/otx_ep_common.h |  90 +++++++++++++++-
 drivers/net/octeontx_ep/otx_ep_ethdev.c |  81 +++++++++++++++
 drivers/net/octeontx_ep/otx_ep_rxtx.c   | 133 ++++++++++++++++++++++++
 3 files changed, 302 insertions(+), 2 deletions(-)
drivers/net/octeontx_ep/otx_ep_common.h +88 -2
index cbd7784d6..18189b152 100644
@@ -42,7 +42,21 @@
 	rte_write64(val, ((base_addr) + off)); \
 	}
 
-struct otx_ep_device;
+/* OTX_EP IQ request list */
+struct otx_ep_instr_list {
+	void *buf;
+	uint32_t reqtype;
+};
+#define OTX_EP_IQREQ_LIST_SIZE	(sizeof(struct otx_ep_instr_list))
+
+/* Input Queue statistics. Each input queue has four stats fields. */
+struct otx_ep_iq_stats {
+	uint64_t instr_posted; /* Instructions posted to this queue. */
+	uint64_t instr_processed; /* Instructions processed in this queue. */
+	uint64_t instr_dropped; /* Instructions that could not be processed */
+	uint64_t tx_pkts;
+	uint64_t tx_bytes;
+};
 
 /* Structure to define the configuration attributes for each Input queue. */
 struct otx_ep_iq_config {
@@ -56,6 +70,66 @@ struct otx_ep_iq_config {
 	uint32_t pending_list_size;
 };
 
+/** The instruction (input) queue.
+ *  The input queue is used to post raw (instruction) mode data or packet data
+ *  to OCTEON TX2 device from the host. Each IQ of a OTX_EP EP VF device has one
+ *  such structure to represent it.
+ */
+struct otx_ep_instr_queue {
+	struct otx_ep_device *otx_ep_dev;
+
+	uint32_t q_no;
+	uint32_t pkt_in_done;
+
+	/* Flag for 64 byte commands. */
+	uint32_t iqcmd_64B:1;
+	uint32_t rsvd:17;
+	uint32_t status:8;
+
+	/* Number of  descriptors in this ring. */
+	uint32_t nb_desc;
+
+	/* Input ring index, where the driver should write the next packet */
+	uint32_t host_write_index;
+
+	/* Input ring index, where the OCTEON TX2 should read the next packet */
+	uint32_t otx_read_index;
+
+	uint32_t reset_instr_cnt;
+
+	/** This index aids in finding the window in the queue where OCTEON TX2
+	 *  has read the commands.
+	 */
+	uint32_t flush_index;
+
+	/* This keeps track of the instructions pending in this queue. */
+	uint64_t instr_pending;
+
+	/* Pointer to the Virtual Base addr of the input ring. */
+	uint8_t *base_addr;
+
+	/* This IQ request list */
+	struct otx_ep_instr_list *req_list;
+
+	/* OTX_EP doorbell register for the ring. */
+	void *doorbell_reg;
+
+	/* OTX_EP instruction count register for this ring. */
+	void *inst_cnt_reg;
+
+	/* Number of instructions pending to be posted to OCTEON TX2. */
+	uint32_t fill_cnt;
+
+	/* Statistics for this input queue. */
+	struct otx_ep_iq_stats stats;
+
+	/* DMA mapped base address of the input descriptor ring. */
+	uint64_t base_addr_dma;
+
+	/* Memory zone */
+	const struct rte_memzone *iq_mz;
+};
+
 /** Descriptor format.
  *  The descriptor ring is made of descriptors which have 2 64-bit values:
  *  -# Physical (bus) address of the data buffer.
@@ -226,6 +300,8 @@ struct otx_ep_sriov_info {
 
 /* Required functions for each VF device */
 struct otx_ep_fn_list {
+	void (*setup_iq_regs)(struct otx_ep_device *otx_ep, uint32_t q_no);
+
 	void (*setup_oq_regs)(struct otx_ep_device *otx_ep, uint32_t q_no);
 
 	void (*setup_device_regs)(struct otx_ep_device *otx_ep);
@@ -255,6 +331,12 @@ struct otx_ep_device {
 
 	uint32_t max_rx_queues;
 
+	/* Num IQs */
+	uint32_t nb_tx_queues;
+
+	/* The input instruction queues */
+	struct otx_ep_instr_queue *instr_queue[OTX_EP_MAX_IOQS_PER_VF];
+
 	/* Num OQs */
 	uint32_t nb_rx_queues;
 
@@ -275,12 +357,16 @@ struct otx_ep_device {
 	uint64_t tx_offloads;
 };
 
+int otx_ep_setup_iqs(struct otx_ep_device *otx_ep, uint32_t iq_no,
+		     int num_descs, unsigned int socket_id);
+int otx_ep_delete_iqs(struct otx_ep_device *otx_ep, uint32_t iq_no);
+
 int otx_ep_setup_oqs(struct otx_ep_device *otx_ep, int oq_no, int num_descs,
 		     int desc_size, struct rte_mempool *mpool,
 		     unsigned int socket_id);
 int otx_ep_delete_oqs(struct otx_ep_device *otx_ep, uint32_t oq_no);
-#define OTX_EP_MAX_PKT_SZ 64000U
 
+#define OTX_EP_MAX_PKT_SZ 64000U
 #define OTX_EP_MAX_MAC_ADDRS 1
 
 extern int otx_net_ep_logtype;
drivers/net/octeontx_ep/otx_ep_ethdev.c +81 -0

98 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_rxtx.c +133 -0

139 lines not on this page · raw message

Signature · 1 line
2.17.1
#69 lore raw

Re: [dpdk-dev] [PATCH v5 07/11] net/octeontx_ep: added tx queue setup and release

Quoted 6 lines · Nalla Pradeep

Transmit queue setup involves allocating memory for the command queue considering tx descriptor count and initializing data structure representing the queue. Transmit queue release function frees the command queue.

<...>

Quoted 5 lines
drivers/net/octeontx_ep/otx_ep_common.h +1 -0
@@ -275,12 +357,16 @@ struct otx_ep_device {
  	uint64_t tx_offloads;
  };
 
+int otx_ep_setup_iqs(struct otx_ep_device *otx_ep, uint32_t iq_no,

drivers/net/octeontx_ep/otx_ep_common.h struct otx_ep_device { · line 369

Quoted 10 lines
drivers/net/octeontx_ep/otx_ep_common.h +4 -1
+		     int num_descs, unsigned int socket_id);
+int otx_ep_delete_iqs(struct otx_ep_device *otx_ep, uint32_t iq_no);
+
  int otx_ep_setup_oqs(struct otx_ep_device *otx_ep, int oq_no, int num_descs,
  		     int desc_size, struct rte_mempool *mpool,
  		     unsigned int socket_id);
  int otx_ep_delete_oqs(struct otx_ep_device *otx_ep, uint32_t oq_no);
-#define OTX_EP_MAX_PKT_SZ 64000U
 
+#define OTX_EP_MAX_PKT_SZ 64000U

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

#70 lore raw

PATCH v5 8/11 net/octeontx_ep: setting up iq and oq registers

In reply to Nalla Pradeep

Configuring hardware registers with command queue(iq) and driver output queue(oq) parameters.
List of parameters configured for IQ after making sure it is idle
1. Base address
2. Instruction size
3. Disabling interrupts for fastpath

List of parameters configured for OQ after making sure it is idle
1. Base address
2. Output buffer size
3. Clear output queue doorbell
4. Disable interrupts for fastpath

---
 drivers/net/octeontx_ep/otx2_ep_vf.c    | 120 ++++++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_common.h |  72 ++++++++++++++
 drivers/net/octeontx_ep/otx_ep_vf.c     | 120 ++++++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_vf.h     |  49 ++++++++++
 4 files changed, 361 insertions(+)
drivers/net/octeontx_ep/otx2_ep_vf.c +120 -0
index 6368ddc80..84de89ef7 100644
@@ -71,6 +71,123 @@ otx2_vf_setup_device_regs(struct otx_ep_device *otx_ep)
 	otx2_vf_setup_global_output_regs(otx_ep);
 }
 
+static void
+otx2_vf_setup_iq_regs(struct otx_ep_device *otx_ep, uint32_t iq_no)
+{
+	struct otx_ep_instr_queue *iq = otx_ep->instr_queue[iq_no];
+	volatile uint64_t reg_val = 0ull;
+
+	reg_val = otx2_read64(otx_ep->hw_addr + SDP_VF_R_IN_CONTROL(iq_no));
+
+	/* Wait till IDLE to set to 1, not supposed to configure BADDR
+	 * as long as IDLE is 0
+	 */
+	if (!(reg_val & SDP_VF_R_IN_CTL_IDLE)) {
+		do {
+			reg_val = otx2_read64(otx_ep->hw_addr +
+					      SDP_VF_R_IN_CONTROL(iq_no));
+		} while (!(reg_val & SDP_VF_R_IN_CTL_IDLE));
+	}
+
+	/* Write the start of the input queue's ring and its size  */
+	otx2_write64(iq->base_addr_dma, otx_ep->hw_addr +
+		     SDP_VF_R_IN_INSTR_BADDR(iq_no));
+	otx2_write64(iq->nb_desc, otx_ep->hw_addr +
+		     SDP_VF_R_IN_INSTR_RSIZE(iq_no));
+
+	/* Remember the doorbell & instruction count register addr
+	 * for this queue
+	 */
+	iq->doorbell_reg = (uint8_t *)otx_ep->hw_addr +
+			   SDP_VF_R_IN_INSTR_DBELL(iq_no);
+	iq->inst_cnt_reg = (uint8_t *)otx_ep->hw_addr +
+			   SDP_VF_R_IN_CNTS(iq_no);
+
+	otx_ep_dbg("InstQ[%d]:dbell reg @ 0x%p instcnt_reg @ 0x%p",
+		   iq_no, iq->doorbell_reg, iq->inst_cnt_reg);
+
+	do {
+		reg_val = rte_read32(iq->inst_cnt_reg);
+		rte_write32(reg_val, iq->inst_cnt_reg);
+	} while (reg_val != 0);
+
+	/* IN INTR_THRESHOLD is set to max(FFFFFFFF) which disable the IN INTR
+	 * to raise
+	 */
+	otx2_write64(OTX_EP_CLEAR_SDP_IN_INT_LVLS,
+		     otx_ep->hw_addr + SDP_VF_R_IN_INT_LEVELS(iq_no));
+}
+
+static void
+otx2_vf_setup_oq_regs(struct otx_ep_device *otx_ep, uint32_t oq_no)
+{
+	volatile uint64_t reg_val = 0ull;
+	uint64_t oq_ctl = 0ull;
+	struct otx_ep_droq *droq = otx_ep->droq[oq_no];
+
+	/* Wait on IDLE to set to 1, supposed to configure BADDR
+	 * as log as IDLE is 0
+	 */
+	reg_val = otx2_read64(otx_ep->hw_addr + SDP_VF_R_OUT_CONTROL(oq_no));
+
+	while (!(reg_val & SDP_VF_R_OUT_CTL_IDLE)) {
+		reg_val = otx2_read64(otx_ep->hw_addr +
+				      SDP_VF_R_OUT_CONTROL(oq_no));
+	}
+
+	otx2_write64(droq->desc_ring_dma, otx_ep->hw_addr +
+		     SDP_VF_R_OUT_SLIST_BADDR(oq_no));
+	otx2_write64(droq->nb_desc, otx_ep->hw_addr +
+		     SDP_VF_R_OUT_SLIST_RSIZE(oq_no));
+
+	oq_ctl = otx2_read64(otx_ep->hw_addr + SDP_VF_R_OUT_CONTROL(oq_no));
+
+	/* Clear the ISIZE and BSIZE (22-0) */
+	oq_ctl &= ~(OTX_EP_CLEAR_ISIZE_BSIZE);
+
+	/* Populate the BSIZE (15-0) */
+	oq_ctl |= (droq->buffer_size & OTX_EP_DROQ_BUFSZ_MASK);
+
+	otx2_write64(oq_ctl, otx_ep->hw_addr + SDP_VF_R_OUT_CONTROL(oq_no));
+
+	/* Mapped address of the pkt_sent and pkts_credit regs */
+	droq->pkts_sent_reg = (uint8_t *)otx_ep->hw_addr +
+			      SDP_VF_R_OUT_CNTS(oq_no);
+	droq->pkts_credit_reg = (uint8_t *)otx_ep->hw_addr +
+				SDP_VF_R_OUT_SLIST_DBELL(oq_no);
+
+	rte_write64(OTX_EP_CLEAR_OUT_INT_LVLS,
+		    otx_ep->hw_addr + SDP_VF_R_OUT_INT_LEVELS(oq_no));
+
+	/* Clear PKT_CNT register */
+	rte_write64(OTX_EP_CLEAR_SDP_OUT_PKT_CNT, (uint8_t *)otx_ep->hw_addr +
+		    SDP_VF_R_OUT_PKT_CNT(oq_no));
+
+	/* Clear the OQ doorbell  */
+	rte_write32(OTX_EP_CLEAR_SLIST_DBELL, droq->pkts_credit_reg);
+	while ((rte_read32(droq->pkts_credit_reg) != 0ull)) {
+		rte_write32(OTX_EP_CLEAR_SLIST_DBELL, droq->pkts_credit_reg);
+		rte_delay_ms(1);
+	}
+	otx_ep_dbg("SDP_R[%d]_credit:%x", oq_no,
+		   rte_read32(droq->pkts_credit_reg));
+
+	/* Clear the OQ_OUT_CNTS doorbell  */
+	reg_val = rte_read32(droq->pkts_sent_reg);
+	rte_write32((uint32_t)reg_val, droq->pkts_sent_reg);
+
+	otx_ep_dbg("SDP_R[%d]_sent: %x", oq_no,
+		   rte_read32(droq->pkts_sent_reg));
+
+	while (((rte_read32(droq->pkts_sent_reg)) != 0ull)) {
+		reg_val = rte_read32(droq->pkts_sent_reg);
+		rte_write32((uint32_t)reg_val, droq->pkts_sent_reg);
+		rte_delay_ms(1);
+	}
+	otx_ep_dbg("SDP_R[%d]_sent: %x", oq_no,
+		   rte_read32(droq->pkts_sent_reg));
+}
+
 static const struct otx_ep_config default_otx2_ep_conf = {
 	/* IQ attributes */
 	.iq                        = {
@@ -125,6 +242,9 @@ otx2_ep_vf_setup_device(struct otx_ep_device *otx_ep)
 
 	otx2_info("SDP RPVF: %d", otx_ep->sriov_info.rings_per_vf);
 
+	otx_ep->fn_list.setup_iq_regs       = otx2_vf_setup_iq_regs;
+	otx_ep->fn_list.setup_oq_regs       = otx2_vf_setup_oq_regs;
+
 	otx_ep->fn_list.setup_device_regs   = otx2_vf_setup_device_regs;
 
 	return 0;
drivers/net/octeontx_ep/otx_ep_common.h +72 -0

102 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_vf.c +120 -0

132 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_vf.h +49 -0

68 lines not on this page · raw message

Signature · 1 line
2.17.1
#71 lore raw

PATCH v5 9/11 net/octeontx_ep: added dev start and stop

In reply to Nalla Pradeep

Dev start and stop operations are added. To accomplish this internal functions to enable or disable io queues are incorporated.

---
 drivers/net/octeontx_ep/otx2_ep_vf.c    | 107 ++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_common.h |   8 ++
 drivers/net/octeontx_ep/otx_ep_ethdev.c |  44 ++++++++
 drivers/net/octeontx_ep/otx_ep_vf.c     | 128 ++++++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_vf.h     |   4 +
 5 files changed, 291 insertions(+)
drivers/net/octeontx_ep/otx2_ep_vf.c +107 -0
index 84de89ef7..64cd8731d 100644
@@ -188,6 +188,104 @@ otx2_vf_setup_oq_regs(struct otx_ep_device *otx_ep, uint32_t oq_no)
 		   rte_read32(droq->pkts_sent_reg));
 }
 
+static int
+otx2_vf_enable_iq(struct otx_ep_device *otx_ep, uint32_t q_no)
+{
+	uint64_t loop = SDP_VF_BUSY_LOOP_COUNT;
+	uint64_t reg_val = 0ull;
+
+	/* Resetting doorbells during IQ enabling also to handle abrupt
+	 * guest reboot. IQ reset does not clear the doorbells.
+	 */
+	otx2_write64(0xFFFFFFFF, otx_ep->hw_addr +
+		     SDP_VF_R_IN_INSTR_DBELL(q_no));
+
+	while (((otx2_read64(otx_ep->hw_addr +
+		 SDP_VF_R_IN_INSTR_DBELL(q_no))) != 0ull) && loop--) {
+		rte_delay_ms(1);
+	}
+
+	if (!loop) {
+		otx_ep_err("INSTR DBELL not coming back to 0\n");
+		return -EIO;
+	}
+
+	reg_val = otx2_read64(otx_ep->hw_addr + SDP_VF_R_IN_ENABLE(q_no));
+	reg_val |= 0x1ull;
+
+	otx2_write64(reg_val, otx_ep->hw_addr + SDP_VF_R_IN_ENABLE(q_no));
+
+	otx2_info("IQ[%d] enable done", q_no);
+
+	return 0;
+}
+
+static int
+otx2_vf_enable_oq(struct otx_ep_device *otx_ep, uint32_t q_no)
+{
+	uint64_t reg_val = 0ull;
+
+	reg_val = otx2_read64(otx_ep->hw_addr + SDP_VF_R_OUT_ENABLE(q_no));
+	reg_val |= 0x1ull;
+	otx2_write64(reg_val, otx_ep->hw_addr + SDP_VF_R_OUT_ENABLE(q_no));
+
+	otx2_info("OQ[%d] enable done", q_no);
+
+	return 0;
+}
+
+static int
+otx2_vf_enable_io_queues(struct otx_ep_device *otx_ep)
+{
+	uint32_t q_no = 0;
+	int ret;
+
+	for (q_no = 0; q_no < otx_ep->nb_tx_queues; q_no++) {
+		ret = otx2_vf_enable_iq(otx_ep, q_no);
+		if (ret)
+			return ret;
+	}
+
+	for (q_no = 0; q_no < otx_ep->nb_rx_queues; q_no++)
+		otx2_vf_enable_oq(otx_ep, q_no);
+
+	return 0;
+}
+
+static void
+otx2_vf_disable_iq(struct otx_ep_device *otx_ep, uint32_t q_no)
+{
+	uint64_t reg_val = 0ull;
+
+	/* Reset the doorbell register for this Input Queue. */
+	reg_val = otx2_read64(otx_ep->hw_addr + SDP_VF_R_IN_ENABLE(q_no));
+	reg_val &= ~0x1ull;
+
+	otx2_write64(reg_val, otx_ep->hw_addr + SDP_VF_R_IN_ENABLE(q_no));
+}
+
+static void
+otx2_vf_disable_oq(struct otx_ep_device *otx_ep, uint32_t q_no)
+{
+	volatile uint64_t reg_val = 0ull;
+
+	reg_val = otx2_read64(otx_ep->hw_addr + SDP_VF_R_OUT_ENABLE(q_no));
+	reg_val &= ~0x1ull;
+
+	otx2_write64(reg_val, otx_ep->hw_addr + SDP_VF_R_OUT_ENABLE(q_no));
+}
+
+static void
+otx2_vf_disable_io_queues(struct otx_ep_device *otx_ep)
+{
+	uint32_t q_no = 0;
+
+	for (q_no = 0; q_no < otx_ep->sriov_info.rings_per_vf; q_no++) {
+		otx2_vf_disable_iq(otx_ep, q_no);
+		otx2_vf_disable_oq(otx_ep, q_no);
+	}
+}
+
 static const struct otx_ep_config default_otx2_ep_conf = {
 	/* IQ attributes */
 	.iq                        = {
@@ -247,5 +345,14 @@ otx2_ep_vf_setup_device(struct otx_ep_device *otx_ep)
 
 	otx_ep->fn_list.setup_device_regs   = otx2_vf_setup_device_regs;
 
+	otx_ep->fn_list.enable_io_queues    = otx2_vf_enable_io_queues;
+	otx_ep->fn_list.disable_io_queues   = otx2_vf_disable_io_queues;
+
+	otx_ep->fn_list.enable_iq           = otx2_vf_enable_iq;
+	otx_ep->fn_list.disable_iq          = otx2_vf_disable_iq;
+
+	otx_ep->fn_list.enable_oq           = otx2_vf_enable_oq;
+	otx_ep->fn_list.disable_oq          = otx2_vf_disable_oq;
+
 	return 0;
 }
drivers/net/octeontx_ep/otx_ep_common.h +8 -0
index 1a9f8a049..8c07a13e8 100644
@@ -19,6 +19,7 @@
 #define OTX_EP_PCI_RING_ALIGN   65536
 #define SDP_PKIND 40
 #define SDP_OTX2_PKIND 57
+#define OTX_EP_BUSY_LOOP_COUNT      (10000)
 #define OTX_EP_MAX_IOQS_PER_VF 8
 
 #define otx_ep_info(fmt, args...)				\
@@ -371,7 +372,14 @@ struct otx_ep_fn_list {
 
 	void (*setup_device_regs)(struct otx_ep_device *otx_ep);
 
+	int (*enable_io_queues)(struct otx_ep_device *otx_ep);
 	void (*disable_io_queues)(struct otx_ep_device *otx_ep);
+
+	int (*enable_iq)(struct otx_ep_device *otx_ep, uint32_t q_no);
+	void (*disable_iq)(struct otx_ep_device *otx_ep, uint32_t q_no);
+
+	int (*enable_oq)(struct otx_ep_device *otx_ep, uint32_t q_no);
+	void (*disable_oq)(struct otx_ep_device *otx_ep, uint32_t q_no);
 };
 
 /* OTX_EP EP VF device data structure */
drivers/net/octeontx_ep/otx_ep_ethdev.c +44 -0

62 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_vf.c +128 -0

139 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_vf.h +4 -0
index c6115d37c..f05843557 100644
@@ -8,6 +8,7 @@
 
 /* OTX_EP VF IQ Registers */
 #define OTX_EP_R_IN_CONTROL_START         (0x10000)
+#define OTX_EP_R_IN_ENABLE_START          (0x10010)
 #define OTX_EP_R_IN_INSTR_BADDR_START     (0x10020)
 #define OTX_EP_R_IN_INSTR_RSIZE_START     (0x10030)
 #define OTX_EP_R_IN_INSTR_DBELL_START     (0x10040)
@@ -17,6 +18,9 @@
 #define OTX_EP_R_IN_CONTROL(ring)  \
 	(OTX_EP_R_IN_CONTROL_START + ((ring) * OTX_EP_RING_OFFSET))
 
+#define OTX_EP_R_IN_ENABLE(ring)   \
+	(OTX_EP_R_IN_ENABLE_START + ((ring) * OTX_EP_RING_OFFSET))
+
 #define OTX_EP_R_IN_INSTR_BADDR(ring)   \
 	(OTX_EP_R_IN_INSTR_BADDR_START + ((ring) * OTX_EP_RING_OFFSET))
 
Signature · 1 line
2.17.1
#72 lore raw

PATCH v5 10/11 net/octeontx_ep: receive data path function added

In reply to Nalla Pradeep

Function to deliver packets from DROQ to application is added. It also fills DROQ with receive buffers timely such that device can fill them with incoming packets.

---
 drivers/net/octeontx_ep/otx_ep_common.h |   2 +
 drivers/net/octeontx_ep/otx_ep_ethdev.c |   3 +
 drivers/net/octeontx_ep/otx_ep_rxtx.c   | 286 +++++++++++++++++++++++-
 drivers/net/octeontx_ep/otx_ep_rxtx.h   |  12 +-
 4 files changed, 301 insertions(+), 2 deletions(-)
drivers/net/octeontx_ep/otx_ep_common.h +2 -0
index 8c07a13e8..039e3e064 100644
@@ -22,6 +22,8 @@
 #define OTX_EP_BUSY_LOOP_COUNT      (10000)
 #define OTX_EP_MAX_IOQS_PER_VF 8
 
+#define OTX_CUST_DATA_LEN 0
+
 #define otx_ep_info(fmt, args...)				\
 	RTE_LOG(INFO, PMD, fmt "\n", ## args)
 
drivers/net/octeontx_ep/otx_ep_ethdev.c +3 -0
index ccf717b71..cee03a495 100644
@@ -136,6 +136,7 @@ otx_epdev_init(struct otx_ep_device *otx_epvf)
 
 	otx_epvf->fn_list.setup_device_regs(otx_epvf);
 
+	otx_epvf->eth_dev->rx_pkt_burst = &otx_ep_recv_pkts;
 	ethdev_queues = (uint32_t)(otx_epvf->sriov_info.rings_per_vf);
 	otx_epvf->max_rx_queues = ethdev_queues;
 	otx_epvf->max_tx_queues = ethdev_queues;
@@ -382,6 +383,8 @@ otx_ep_eth_dev_uninit(struct rte_eth_dev *eth_dev)
 	otx_epdev_exit(eth_dev);
 
 	eth_dev->dev_ops = NULL;
+	eth_dev->rx_pkt_burst = NULL;
+	eth_dev->tx_pkt_burst = NULL;
 
 	return 0;
 }
drivers/net/octeontx_ep/otx_ep_rxtx.c +285 -1

307 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_rxtx.h +11 -1
index 9779e96b6..d8b411459 100644
@@ -7,4 +7,14 @@
 
 #define OTX_EP_RXD_ALIGN 1
 #define OTX_EP_TXD_ALIGN 1
-#endif
+#define OTX_EP_MAX_DELAYED_PKT_RETRIES 10000
+static inline uint32_t
+otx_ep_incr_index(uint32_t index, uint32_t count, uint32_t max)
+{
+	return ((index + count) & (max - 1));
+}
+uint16_t
+otx_ep_recv_pkts(void *rx_queue,
+		  struct rte_mbuf **rx_pkts,
+		  uint16_t budget);
+#endif /* _OTX_EP_RXTX_H_ */
Signature · 1 line
2.17.1
#73 lore raw

Re: [dpdk-dev] [PATCH v5 10/11] net/octeontx_ep: receive data path function added

Quoted 5 lines · Nalla Pradeep

Function to deliver packets from DROQ to application is added. It also fills DROQ with receive buffers timely such that device can fill them with incoming packets.

<...>

Quoted 29 lines
drivers/net/octeontx_ep/otx_ep_rxtx.c +29 -0
+/* Check for response arrival from OCTEON TX2
+ * returns number of requests completed
+ */
+uint16_t
+otx_ep_recv_pkts(void *rx_queue,
+		  struct rte_mbuf **rx_pkts,
+		  uint16_t budget)
+{
+	struct otx_ep_droq *droq = rx_queue;
+	struct otx_ep_device *otx_ep;
+	struct rte_mbuf *oq_pkt;
+
+	uint32_t pkts = 0;
+	uint32_t new_pkts = 0;
+	int next_fetch;
+
+	otx_ep = droq->otx_ep_dev;
+
+	if (droq->pkts_pending > budget) {
+		new_pkts = budget;
+	} else {
+		new_pkts = droq->pkts_pending;
+		new_pkts += otx_ep_check_droq_pkts(droq);
+		if (new_pkts > budget)
+			new_pkts = budget;
+	}
+
+	if (!new_pkts)
+		goto update_credit; /* No pkts at this moment */

drivers/net/octeontx_ep/otx_ep_rxtx.c otx_ep_setup_oqs(struct otx_ep_device *otx_ep, int oq_no, int num_descs, · line 603

Quoted 10 lines
drivers/net/octeontx_ep/otx_ep_rxtx.c +10 -0
+
+	for (pkts = 0; pkts < new_pkts; pkts++) {
+		/* Push the received pkt to application */
+		next_fetch = (pkts == new_pkts - 1) ? 0 : 1;
+		oq_pkt = otx_ep_droq_read_packet(otx_ep, droq, next_fetch);
+		if (!oq_pkt) {
+			otx_ep_err("DROQ read pkt failed pending %" PRIu64
+				    "last_pkt_count %" PRIu64 "new_pkts %d.\n",
+				    droq->pkts_pending, droq->last_pkt_count,
+				    new_pkts);

The format specifier seems fixed, but in a second thought, are you sure that you want to add logging into a fast path? Even if it doesn't log anything it will consume cycles, and if it logs it will impact the datapath a lot.

There is a 'RTE_LOG_DP' macro for datapath, you may consider using it.

#74 lore raw

PATCH v5 11/11 net/octeontx_ep: transmit data path function added

In reply to Nalla Pradeep

1. Packet transmit function for both otx and otx2 are added.
2. Flushing transmit(command) queue when pending commands are more than maximum allowed value (currently 16).
3. Scatter gather support if the packet spans multiple buffers.

---
 drivers/net/octeontx_ep/otx2_ep_vf.h    |  19 ++
 drivers/net/octeontx_ep/otx_ep_common.h |  51 +++
 drivers/net/octeontx_ep/otx_ep_ethdev.c |   5 +
 drivers/net/octeontx_ep/otx_ep_rxtx.c   | 434 ++++++++++++++++++++++++
 drivers/net/octeontx_ep/otx_ep_rxtx.h   |  26 ++
 drivers/net/octeontx_ep/otx_ep_vf.h     |  67 ++++
 6 files changed, 602 insertions(+)
drivers/net/octeontx_ep/otx2_ep_vf.h +19 -0
index 191fee426..5e5aefbc1 100644
@@ -7,5 +7,24 @@
 int
 otx2_ep_vf_setup_device(struct otx_ep_device *sdpvf);
 
+struct otx2_ep_instr_64B {
+	/* Pointer where the input data is available. */
+	uint64_t dptr;
+
+	/* OTX_EP Instruction Header. */
+	union otx_ep_instr_ih ih;
+
+	/** Pointer where the response for a RAW mode packet
+	 * will be written by OCTEON TX.
+	 */
+	uint64_t rptr;
+
+	/* Input Request Header. */
+	union otx_ep_instr_irh irh;
+
+	/* Additional headers available in a 64-byte instruction. */
+	uint64_t exhdr[4];
+};
+
 #endif /*_OTX2_EP_VF_H_ */
 
drivers/net/octeontx_ep/otx_ep_common.h +51 -0

74 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_ethdev.c +5 -0
index cee03a495..6167a9c4b 100644
@@ -137,6 +137,11 @@ otx_epdev_init(struct otx_ep_device *otx_epvf)
 	otx_epvf->fn_list.setup_device_regs(otx_epvf);
 
 	otx_epvf->eth_dev->rx_pkt_burst = &otx_ep_recv_pkts;
+	if (otx_epvf->chip_id == PCI_DEVID_OCTEONTX_EP_VF)
+		otx_epvf->eth_dev->tx_pkt_burst = &otx_ep_xmit_pkts;
+	else if (otx_epvf->chip_id == PCI_DEVID_OCTEONTX2_EP_NET_VF ||
+		 otx_epvf->chip_id == PCI_DEVID_CN98XX_EP_NET_VF)
+		otx_epvf->eth_dev->tx_pkt_burst = &otx2_ep_xmit_pkts;
 	ethdev_queues = (uint32_t)(otx_epvf->sriov_info.rings_per_vf);
 	otx_epvf->max_rx_queues = ethdev_queues;
 	otx_epvf->max_tx_queues = ethdev_queues;
drivers/net/octeontx_ep/otx_ep_rxtx.c +434 -0

440 lines not on this page · raw message

drivers/net/octeontx_ep/otx_ep_rxtx.h +26 -0
index d8b411459..1527d350b 100644
@@ -5,15 +5,41 @@
 #ifndef _OTX_EP_RXTX_H_
 #define _OTX_EP_RXTX_H_
 
+#include <rte_byteorder.h>
+
 #define OTX_EP_RXD_ALIGN 1
 #define OTX_EP_TXD_ALIGN 1
+
+#define OTX_EP_IQ_SEND_FAILED      (-1)
+#define OTX_EP_IQ_SEND_SUCCESS     (0)
+
 #define OTX_EP_MAX_DELAYED_PKT_RETRIES 10000
+
+#define OTX_EP_FSZ 28
+#define OTX2_EP_FSZ 24
+#define OTX_EP_MAX_INSTR 16
+
+static inline void
+otx_ep_swap_8B_data(uint64_t *data, uint32_t blocks)
+{
+	/* Swap 8B blocks */
+	while (blocks) {
+		*data = rte_bswap64(*data);
+		blocks--;
+		data++;
+	}
+}
+
 static inline uint32_t
 otx_ep_incr_index(uint32_t index, uint32_t count, uint32_t max)
 {
 	return ((index + count) & (max - 1));
 }
 uint16_t
+otx_ep_xmit_pkts(void *tx_queue, struct rte_mbuf **pkts, uint16_t nb_pkts);
+uint16_t
+otx2_ep_xmit_pkts(void *tx_queue, struct rte_mbuf **pkts, uint16_t nb_pkts);
+uint16_t
 otx_ep_recv_pkts(void *rx_queue,
 		  struct rte_mbuf **rx_pkts,
 		  uint16_t budget);
drivers/net/octeontx_ep/otx_ep_vf.h +67 -0

73 lines not on this page · raw message

Signature · 1 line
2.17.1
#75 lore raw

Re: [dpdk-dev] [PATCH v5 11/11] net/octeontx_ep: transmit data path function added

Quoted 6 lines · Nalla Pradeep

1. Packet transmit function for both otx and otx2 are added.
2. Flushing transmit(command) queue when pending commands are more than maximum allowed value (currently 16).
3. Scatter gather support if the packet spans multiple buffers.

<...>

drivers/net/octeontx_ep/otx_ep_rxtx.c otx_ep_setup_oqs(struct otx_ep_device *otx_ep, int oq_no, int num_descs, · line 762

Quoted 11 lines
drivers/net/octeontx_ep/otx_ep_rxtx.c +11 -0
+		/* ih vars */
+		iqcmd2.ih.s.tlen = pkt_len + iqcmd2.ih.s.fsz;
+		iqcmd2.ih.s.gather = gather;
+		iqcmd2.ih.s.gsz = gsz;
+		/* irh vars */
+		/* irh.rlenssz = ; */
+		iqcmd2.dptr = dptr;
+		/* Swap FSZ(front data) here, to avoid swapping on
+		 * OCTEON TX side rptr is not used so not swapping.
+		 */
+		/* otx_ep_swap_8B_data(&iqcmd2.rptr, 1); */

More commented out code seems remaining, can you please clean all?