Skip to contentSkip to conversation

Marvell CNXK Ethdev Driver

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

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

PATCH v3 52/62 net/cnxk: add get register operation

In reply to Nithin Dabilpuram

From: Satha Rao <[email protected]>

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

---
 doc/guides/nics/cnxk.rst              |  1 +
 doc/guides/nics/features/cnxk.ini     |  1 +
 doc/guides/nics/features/cnxk_vec.ini |  1 +
 doc/guides/nics/features/cnxk_vf.ini  |  1 +
 drivers/net/cnxk/cnxk_ethdev.c        |  1 +
 drivers/net/cnxk/cnxk_ethdev.h        |  4 ++++
 drivers/net/cnxk/cnxk_ethdev_ops.c    | 25 +++++++++++++++++++++++++
 7 files changed, 34 insertions(+)
doc/guides/nics/cnxk.rst +1 -0
index cc71b22..e561321 100644
@@ -32,6 +32,7 @@ Features of the CNXK Ethdev PMD are:
 - MTU update
 - Scatter-Gather IO support
 - Vector Poll mode driver
+- Debug utilities - Context dump and error interrupt support
 - Support Rx interrupt
 
 Prerequisites
doc/guides/nics/features/cnxk.ini +1 -0
index d43b1c4..246caf9 100644
@@ -37,6 +37,7 @@ Stats per queue      = Y
 Extended stats       = Y
 FW version           = Y
 Module EEPROM dump   = Y
+Registers dump       = Y
 Linux                = Y
 ARMv8                = Y
 Usage doc            = Y
doc/guides/nics/features/cnxk_vec.ini +1 -0
index 6b9ce2d..65ee8ba 100644
@@ -35,6 +35,7 @@ Stats per queue      = Y
 Extended stats       = Y
 FW version           = Y
 Module EEPROM dump   = Y
+Registers dump       = Y
 Linux                = Y
 ARMv8                = Y
 Usage doc            = Y
doc/guides/nics/features/cnxk_vf.ini +1 -0
index 5629d07..00bde9b 100644
@@ -32,6 +32,7 @@ Stats per queue      = Y
 Extended stats       = Y
 FW version           = Y
 Module EEPROM dump   = Y
+Registers dump       = Y
 Linux                = Y
 ARMv8                = Y
 Usage doc            = Y
drivers/net/cnxk/cnxk_ethdev.c +1 -0
index 284c8f4..cb0dd45 100644
@@ -1215,6 +1215,7 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
 	.txq_info_get = cnxk_nix_txq_info_get,
 	.tx_done_cleanup = cnxk_nix_tx_done_cleanup,
 	.flow_ops_get = cnxk_nix_flow_ops_get,
+	.get_reg = cnxk_nix_dev_get_reg,
 };
 
 static int
drivers/net/cnxk/cnxk_ethdev.h +4 -0
index a25be8a..d51a6d7 100644
@@ -328,6 +328,10 @@ void *cnxk_nix_fastpath_lookup_mem_get(void);
 int cnxk_ethdev_parse_devargs(struct rte_devargs *devargs,
 			      struct cnxk_eth_dev *dev);
 
+/* Debug */
+int cnxk_nix_dev_get_reg(struct rte_eth_dev *eth_dev,
+			 struct rte_dev_reg_info *regs);
+
 /* Inlines */
 static __rte_always_inline uint64_t
 cnxk_pktmbuf_detach(struct rte_mbuf *m)
drivers/net/cnxk/cnxk_ethdev_ops.c +25 -0
index 4e863e2..27d5dc0 100644
@@ -697,3 +697,28 @@ cnxk_nix_tx_done_cleanup(void *txq, uint32_t free_cnt)
 
 	return 0;
 }
+
+int
+cnxk_nix_dev_get_reg(struct rte_eth_dev *eth_dev, struct rte_dev_reg_info *regs)
+{
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	struct roc_nix *nix = &dev->nix;
+	uint64_t *data = regs->data;
+	int rc = -ENOTSUP;
+
+	if (data == NULL) {
+		rc = roc_nix_lf_get_reg_count(nix);
+		if (rc > 0) {
+			regs->length = rc;
+			regs->width = 8;
+			rc = 0;
+		}
+		return rc;
+	}
+
+	if (!regs->length ||
+	    regs->length == (uint32_t)roc_nix_lf_get_reg_count(nix))
+		return roc_nix_lf_reg_dump(nix, data);
+
+	return rc;
+}
Signature · 1 line
2.8.4
#181 lore raw

PATCH v3 53/62 net/cnxk: support for RSS in rte flow

In reply to Nithin Dabilpuram

From: Satheesh Paul <[email protected]>

Added support for RSS action in rte flow code based on ROC.

---
 doc/guides/nics/features/cnxk.ini |  1 +
 drivers/net/cnxk/cnxk_rte_flow.c  | 74 ++++++++++++++++++++++++++++++++++-----
 2 files changed, 67 insertions(+), 8 deletions(-)
doc/guides/nics/features/cnxk.ini +1 -0
index 246caf9..eba4107 100644
@@ -75,5 +75,6 @@ flag                 = Y
 pf                   = Y
 port_id              = Y
 queue                = Y
+rss                  = Y
 security             = Y
 vf                   = Y
drivers/net/cnxk/cnxk_rte_flow.c +66 -8

124 lines not on this page · raw message

Signature · 1 line
2.8.4
#182 lore raw

PATCH v3 54/62 net/cnxk: register callback to get PTP status

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

Once PTP status is changed at H/W i.e. enable/disable then it is propagated to user via registered callback.

So corresponding callback is registered to get PTP status.

---
 drivers/net/cnxk/cn10k_ethdev.c    | 87 ++++++++++++++++++++++++++++++++++++--
 drivers/net/cnxk/cn10k_rx.h        |  1 +
 drivers/net/cnxk/cn9k_ethdev.c     | 73 ++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cn9k_rx.h         |  1 +
 drivers/net/cnxk/cnxk_ethdev.c     |  2 +-
 drivers/net/cnxk/cnxk_ethdev.h     |  5 +++
 drivers/net/cnxk/cnxk_ethdev_ops.c |  2 +
 7 files changed, 166 insertions(+), 5 deletions(-)
drivers/net/cnxk/cn10k_ethdev.c +83 -4
index 0396ff6..bddb7fb 100644
@@ -268,6 +268,76 @@ cn10k_nix_configure(struct rte_eth_dev *eth_dev)
 	return 0;
 }
 
+/* Function to enable ptp config for VFs */
+static void
+nix_ptp_enable_vf(struct rte_eth_dev *eth_dev)
+{
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+
+	if (nix_recalc_mtu(eth_dev))
+		plt_err("Failed to set MTU size for ptp");
+
+	dev->scalar_ena = true;
+	dev->rx_offload_flags |= NIX_RX_OFFLOAD_TSTAMP_F;
+
+	/* Setting up the function pointers as per new offload flags */
+	cn10k_eth_set_rx_function(eth_dev);
+	cn10k_eth_set_tx_function(eth_dev);
+}
+
+static uint16_t
+nix_ptp_vf_burst(void *queue, struct rte_mbuf **mbufs, uint16_t pkts)
+{
+	struct cn10k_eth_rxq *rxq = queue;
+	struct cnxk_eth_rxq_sp *rxq_sp;
+	struct rte_eth_dev *eth_dev;
+
+	RTE_SET_USED(mbufs);
+	RTE_SET_USED(pkts);
+
+	rxq_sp = cnxk_eth_rxq_to_sp(rxq);
+	eth_dev = rxq_sp->dev->eth_dev;
+	nix_ptp_enable_vf(eth_dev);
+
+	return 0;
+}
+
+static int
+cn10k_nix_ptp_info_update_cb(struct roc_nix *nix, bool ptp_en)
+{
+	struct cnxk_eth_dev *dev = (struct cnxk_eth_dev *)nix;
+	struct rte_eth_dev *eth_dev;
+	struct cn10k_eth_rxq *rxq;
+	int i;
+
+	if (!dev)
+		return -EINVAL;
+
+	eth_dev = dev->eth_dev;
+	if (!eth_dev)
+		return -EINVAL;
+
+	dev->ptp_en = ptp_en;
+
+	for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
+		rxq = eth_dev->data->rx_queues[i];
+		rxq->mbuf_initializer = cnxk_nix_rxq_mbuf_setup(dev);
+	}
+
+	if (roc_nix_is_vf_or_sdp(nix) && !(roc_nix_is_sdp(nix)) &&
+	    !(roc_nix_is_lbk(nix))) {
+		/* In case of VF, setting of MTU cannot be done directly in this
+		 * function as this is running as part of MBOX request(PF->VF)
+		 * and MTU setting also requires MBOX message to be
+		 * sent(VF->PF)
+		 */
+		eth_dev->rx_pkt_burst = nix_ptp_vf_burst;
+		rte_mb();
+	}
+
+	return 0;
+}
+
 static int
 cn10k_nix_dev_start(struct rte_eth_dev *eth_dev)
 {
@@ -333,6 +403,7 @@ static int
 cn10k_nix_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 {
 	struct rte_eth_dev *eth_dev;
+	struct cnxk_eth_dev *dev;
 	int rc;
 
 	if (RTE_CACHE_LINE_SIZE != 64) {
@@ -354,15 +425,23 @@ cn10k_nix_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 	if (rc)
 		return rc;
 
+	/* Find eth dev allocated */
+	eth_dev = rte_eth_dev_allocated(pci_dev->device.name);
+	if (!eth_dev)
+		return -ENOENT;
+
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
-		eth_dev = rte_eth_dev_allocated(pci_dev->device.name);
-		if (!eth_dev)
-			return -ENOENT;
-
 		/* Setup callbacks for secondary process */
 		cn10k_eth_set_tx_function(eth_dev);
 		cn10k_eth_set_rx_function(eth_dev);
+		return 0;
 	}
+
+	dev = cnxk_eth_pmd_priv(eth_dev);
+
+	/* Register up msg callbacks for PTP information */
+	roc_nix_ptp_info_cb_register(&dev->nix, cn10k_nix_ptp_info_update_cb);
+
 	return 0;
 }
 
drivers/net/cnxk/cn10k_rx.h +1 -0
index 7bb9dd8..29ee0ac 100644
@@ -12,6 +12,7 @@
 #define NIX_RX_OFFLOAD_PTYPE_F	     BIT(1)
 #define NIX_RX_OFFLOAD_CHECKSUM_F    BIT(2)
 #define NIX_RX_OFFLOAD_MARK_UPDATE_F BIT(3)
+#define NIX_RX_OFFLOAD_TSTAMP_F	     BIT(4)
 
 /* Flags to control cqe_to_mbuf conversion function.
  * Defining it from backwards to denote its been
drivers/net/cnxk/cn9k_ethdev.c +73 -0

85 lines not on this page · raw message

drivers/net/cnxk/cn9k_rx.h +1 -0
index bc04f5c..f4b3282 100644
@@ -13,6 +13,7 @@
 #define NIX_RX_OFFLOAD_PTYPE_F	     BIT(1)
 #define NIX_RX_OFFLOAD_CHECKSUM_F    BIT(2)
 #define NIX_RX_OFFLOAD_MARK_UPDATE_F BIT(3)
+#define NIX_RX_OFFLOAD_TSTAMP_F	     BIT(4)
 
 /* Flags to control cqe_to_mbuf conversion function.
  * Defining it from backwards to denote its been
drivers/net/cnxk/cnxk_ethdev.c +1 -1
index cb0dd45..094f1cb 100644
@@ -59,7 +59,7 @@ nix_enable_mseg_on_jumbo(struct cnxk_eth_rxq_sp *rxq)
 	}
 }
 
-static int
+int
 nix_recalc_mtu(struct rte_eth_dev *eth_dev)
 {
 	struct rte_eth_dev_data *data = eth_dev->data;
drivers/net/cnxk/cnxk_ethdev.h +5 -0
index d51a6d7..1c41dcb 100644
@@ -100,6 +100,7 @@
 /* Default mark value used when none is provided. */
 #define CNXK_FLOW_ACTION_FLAG_DEFAULT 0xffff
 
+#define CNXK_NIX_TIMESYNC_RX_OFFSET 8
 #define PTYPE_NON_TUNNEL_WIDTH	  16
 #define PTYPE_TUNNEL_WIDTH	  12
 #define PTYPE_NON_TUNNEL_ARRAY_SZ BIT(PTYPE_NON_TUNNEL_WIDTH)
@@ -153,6 +154,7 @@ struct cnxk_eth_dev {
 	uint16_t flags;
 	uint8_t ptype_disable;
 	bool scalar_ena;
+	bool ptp_en;
 
 	/* Pointer back to rte */
 	struct rte_eth_dev *eth_dev;
@@ -332,6 +334,9 @@ int cnxk_ethdev_parse_devargs(struct rte_devargs *devargs,
 int cnxk_nix_dev_get_reg(struct rte_eth_dev *eth_dev,
 			 struct rte_dev_reg_info *regs);
 
+/* Other private functions */
+int nix_recalc_mtu(struct rte_eth_dev *eth_dev);
+
 /* Inlines */
 static __rte_always_inline uint64_t
 cnxk_pktmbuf_detach(struct rte_mbuf *m)
drivers/net/cnxk/cnxk_ethdev_ops.c +2 -0
index 27d5dc0..30222e6 100644
@@ -385,6 +385,8 @@ cnxk_nix_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
 	int rc = -EINVAL;
 	uint32_t buffsz;
 
+	frame_size += CNXK_NIX_TIMESYNC_RX_OFFSET * dev->ptp_en;
+
 	/* Check if MTU is within the allowed range */
 	if ((frame_size - RTE_ETHER_CRC_LEN) < NIX_MIN_HW_FRS) {
 		plt_err("MTU is lesser than minimum");
Signature · 1 line
2.8.4
#183 lore raw

PATCH v3 55/62 net/cnxk: add base PTP timesync support

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

Base PTP timesync support is added for cn9k and cn10k platforms.

---
 drivers/net/cnxk/cn10k_ethdev.c  |  31 +++++
 drivers/net/cnxk/cn10k_ethdev.h  |   1 +
 drivers/net/cnxk/cn10k_rx.c      |  32 ++---
 drivers/net/cnxk/cn10k_rx.h      |  61 +++++++---
 drivers/net/cnxk/cn10k_rx_mseg.c |   2 +-
 drivers/net/cnxk/cn10k_rx_vec.c  |   5 +-
 drivers/net/cnxk/cn10k_tx.c      |  28 +++--
 drivers/net/cnxk/cn10k_tx.h      | 193 +++++++++++++++++++++++------
 drivers/net/cnxk/cn10k_tx_mseg.c |   2 +-
 drivers/net/cnxk/cn10k_tx_vec.c  |   3 +-
 drivers/net/cnxk/cn9k_ethdev.c   |  34 +++++-
 drivers/net/cnxk/cn9k_ethdev.h   |   1 +
 drivers/net/cnxk/cn9k_rx.c       |  32 ++---
 drivers/net/cnxk/cn9k_rx.h       |  61 +++++++---
 drivers/net/cnxk/cn9k_rx_mseg.c  |   2 +-
 drivers/net/cnxk/cn9k_rx_vec.c   |   5 +-
 drivers/net/cnxk/cn9k_tx.c       |  28 +++--
 drivers/net/cnxk/cn9k_tx.h       | 253 ++++++++++++++++++++++++++++-----------
 drivers/net/cnxk/cn9k_tx_mseg.c  |   2 +-
 drivers/net/cnxk/cn9k_tx_vec.c   |   3 +-
 drivers/net/cnxk/cnxk_ethdev.c   |  36 +++++-
 drivers/net/cnxk/cnxk_ethdev.h   |  64 +++++++++-
 drivers/net/cnxk/cnxk_ptp.c      | 169 ++++++++++++++++++++++++++
 drivers/net/cnxk/meson.build     |   1 +
 24 files changed, 834 insertions(+), 215 deletions(-)
 create mode 100644 drivers/net/cnxk/cnxk_ptp.c
drivers/net/cnxk/cn10k_ethdev.c +31 -0
index bddb7fb..5e0de13 100644
@@ -30,6 +30,9 @@ nix_rx_offload_flags(struct rte_eth_dev *eth_dev)
 	if (dev->rx_offloads & DEV_RX_OFFLOAD_SCATTER)
 		flags |= NIX_RX_MULTI_SEG_F;
 
+	if ((dev->rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP))
+		flags |= NIX_RX_OFFLOAD_TSTAMP_F;
+
 	if (!dev->ptype_disable)
 		flags |= NIX_RX_OFFLOAD_PTYPE_F;
 
@@ -95,6 +98,9 @@ nix_tx_offload_flags(struct rte_eth_dev *eth_dev)
 		flags |= (NIX_TX_OFFLOAD_TSO_F | NIX_TX_OFFLOAD_OL3_OL4_CSUM_F |
 			  NIX_TX_OFFLOAD_L3_L4_CSUM_F);
 
+	if ((dev->rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP))
+		flags |= NIX_TX_OFFLOAD_TSTAMP_F;
+
 	return flags;
 }
 
@@ -121,6 +127,7 @@ nix_form_default_desc(struct cnxk_eth_dev *dev, struct cn10k_eth_txq *txq,
 {
 	struct nix_send_ext_s *send_hdr_ext;
 	union nix_send_hdr_w0_u send_hdr_w0;
+	struct nix_send_mem_s *send_mem;
 	union nix_send_sg_s sg_w0;
 
 	RTE_SET_USED(dev);
@@ -136,6 +143,22 @@ nix_form_default_desc(struct cnxk_eth_dev *dev, struct cn10k_eth_txq *txq,
 
 		send_hdr_ext = (struct nix_send_ext_s *)&txq->cmd[0];
 		send_hdr_ext->w0.subdc = NIX_SUBDC_EXT;
+		if (dev->tx_offload_flags & NIX_TX_OFFLOAD_TSTAMP_F) {
+			/* Default: one seg packet would have:
+			 * 2(HDR) + 2(EXT) + 1(SG) + 1(IOVA) + 2(MEM)
+			 * => 8/2 - 1 = 3
+			 */
+			send_hdr_w0.sizem1 = 3;
+			send_hdr_ext->w0.tstmp = 1;
+
+			/* To calculate the offset for send_mem,
+			 * send_hdr->w0.sizem1 * 2
+			 */
+			send_mem = (struct nix_send_mem_s *)(txq->cmd + 2);
+			send_mem->w0.subdc = NIX_SUBDC_MEM;
+			send_mem->w0.alg = NIX_SENDMEMALG_SETTSTMP;
+			send_mem->addr = dev->tstamp.tx_tstamp_iova;
+		}
 	} else {
 		/* 2(HDR) + 1(SG) + 1(IOVA) = 4/2 - 1 = 1 */
 		send_hdr_w0.sizem1 = 1;
@@ -221,6 +244,7 @@ cn10k_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 	rxq->wdata = cq->wdata;
 	rxq->head = cq->head;
 	rxq->qmask = cq->qmask;
+	rxq->tstamp = &dev->tstamp;
 
 	/* Data offset from data to start of mbuf is first_skip */
 	rxq->data_off = rq->first_skip;
@@ -342,6 +366,7 @@ static int
 cn10k_nix_dev_start(struct rte_eth_dev *eth_dev)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	struct roc_nix *nix = &dev->nix;
 	int rc;
 
 	/* Common eth dev start */
@@ -349,6 +374,12 @@ cn10k_nix_dev_start(struct rte_eth_dev *eth_dev)
 	if (rc)
 		return rc;
 
+	/* Update VF about data off shifted by 8 bytes if PTP already
+	 * enabled in PF owning this VF
+	 */
+	if (dev->ptp_en && (!roc_nix_is_pf(nix) && (!roc_nix_is_sdp(nix))))
+		nix_ptp_enable_vf(eth_dev);
+
 	/* Setting up the rx[tx]_offload_flags due to change
 	 * in rx[tx]_offloads.
 	 */
drivers/net/cnxk/cn10k_ethdev.h +1 -0
index d39ca31..8b6e0f2 100644
@@ -31,6 +31,7 @@ struct cn10k_eth_rxq {
 	uint32_t available;
 	uint16_t data_off;
 	uint16_t rq;
+	struct cnxk_timesync_info *tstamp;
 } __plt_cache_aligned;
 
 /* Rx and Tx routines */
drivers/net/cnxk/cn10k_rx.c +18 -14
index 0598111..c9744e2 100644
@@ -5,7 +5,7 @@
 #include "cn10k_ethdev.h"
 #include "cn10k_rx.h"
 
-#define R(name, f3, f2, f1, f0, flags)					       \
+#define R(name, f4, f3, f2, f1, f0, flags)				       \
 	uint16_t __rte_noinline __rte_hot cn10k_nix_recv_pkts_##name(	       \
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
@@ -17,12 +17,13 @@ NIX_RX_FASTPATH_MODES
 
 static inline void
 pick_rx_func(struct rte_eth_dev *eth_dev,
-	     const eth_rx_burst_t rx_burst[2][2][2][2])
+	     const eth_rx_burst_t rx_burst[2][2][2][2][2])
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
-	/* [MARK] [CKSUM] [PTYPE] [RSS] */
+	/* [TSP] [MARK] [CKSUM] [PTYPE] [RSS] */
 	eth_dev->rx_pkt_burst = rx_burst
+		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_TSTAMP_F)]
 		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_MARK_UPDATE_F)]
 		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_CHECKSUM_F)]
 		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_PTYPE_F)]
@@ -34,31 +35,34 @@ cn10k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
-	const eth_rx_burst_t nix_eth_rx_burst[2][2][2][2] = {
-#define R(name, f3, f2, f1, f0, flags)					      \
-	[f3][f2][f1][f0] = cn10k_nix_recv_pkts_##name,
+	const eth_rx_burst_t nix_eth_rx_burst[2][2][2][2][2] = {
+#define R(name, f4, f3, f2, f1, f0, flags)				       \
+	[f4][f3][f2][f1][f0] = cn10k_nix_recv_pkts_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const eth_rx_burst_t nix_eth_rx_burst_mseg[2][2][2][2] = {
-#define R(name, f3, f2, f1, f0, flags)					      \
-	[f3][f2][f1][f0] = cn10k_nix_recv_pkts_mseg_##name,
+	const eth_rx_burst_t nix_eth_rx_burst_mseg[2][2][2][2][2] = {
+#define R(name, f4, f3, f2, f1, f0, flags)				       \
+	[f4][f3][f2][f1][f0] = cn10k_nix_recv_pkts_mseg_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const eth_rx_burst_t nix_eth_rx_vec_burst[2][2][2][2] = {
-#define R(name, f3, f2, f1, f0, flags)					      \
-	[f3][f2][f1][f0] = cn10k_nix_recv_pkts_vec_##name,
+	const eth_rx_burst_t nix_eth_rx_vec_burst[2][2][2][2][2] = {
+#define R(name, f4, f3, f2, f1, f0, flags)				       \
+	[f4][f3][f2][f1][f0] = cn10k_nix_recv_pkts_vec_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	if (dev->scalar_ena)
+	/* For PTP enabled, scalar rx function should be chosen as most of the
+	 * PTP apps are implemented to rx burst 1 pkt.
+	 */
+	if (dev->scalar_ena || dev->rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP)
 		pick_rx_func(eth_dev, nix_eth_rx_burst);
 	else
 		pick_rx_func(eth_dev, nix_eth_rx_vec_burst);
@@ -69,6 +73,6 @@ cn10k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
 	/* Copy multi seg version with no offload for tear down sequence */
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
 		dev->rx_pkt_burst_no_offload =
-			nix_eth_rx_burst_mseg[0][0][0][0];
+			nix_eth_rx_burst_mseg[0][0][0][0][0];
 	rte_mb();
 }
drivers/net/cnxk/cn10k_rx.h +42 -19

81 lines not on this page · raw message

drivers/net/cnxk/cn10k_rx_mseg.c +1 -1
index 9d283f7..b67d21f 100644
@@ -5,7 +5,7 @@
 #include "cn10k_ethdev.h"
 #include "cn10k_rx.h"
 
-#define R(name, f3, f2, f1, f0, flags)                                         \
+#define R(name, f4, f3, f2, f1, f0, flags)                                     \
 	uint16_t __rte_noinline __rte_hot cn10k_nix_recv_pkts_mseg_##name(     \
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
drivers/net/cnxk/cn10k_rx_vec.c +4 -1
index 0fa079c..1330235 100644
@@ -5,12 +5,15 @@
 #include "cn10k_ethdev.h"
 #include "cn10k_rx.h"
 
-#define R(name, f3, f2, f1, f0, flags)					       \
+#define R(name, f4, f3, f2, f1, f0, flags)				       \
 	uint16_t __rte_noinline __rte_hot				       \
 		cn10k_nix_recv_pkts_vec_##name(void *rx_queue,                 \
 					       struct rte_mbuf **rx_pkts,      \
 					       uint16_t pkts)                  \
 	{                                                                      \
+		/* TSTMP is not supported by vector */                         \
+		if ((flags) & NIX_RX_OFFLOAD_TSTAMP_F)                         \
+			return 0;                                              \
 		return cn10k_nix_recv_pkts_vector(rx_queue, rx_pkts, pkts,     \
 						  (flags));		       \
 	}
drivers/net/cnxk/cn10k_tx.c +15 -13
index e6eb101..18694dc 100644
@@ -5,7 +5,7 @@
 #include "cn10k_ethdev.h"
 #include "cn10k_tx.h"
 
-#define T(name, f4, f3, f2, f1, f0, sz, flags)				       \
+#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
 	uint16_t __rte_noinline __rte_hot cn10k_nix_xmit_pkts_##name(	       \
 		void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t pkts)      \
 	{                                                                      \
@@ -24,12 +24,13 @@ NIX_TX_FASTPATH_MODES
 
 static inline void
 pick_tx_func(struct rte_eth_dev *eth_dev,
-	     const eth_tx_burst_t tx_burst[2][2][2][2][2])
+	     const eth_tx_burst_t tx_burst[2][2][2][2][2][2])
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
-	/* [TSO] [NOFF] [VLAN] [OL3_OL4_CSUM] [IL3_IL4_CSUM] */
+	/* [TSP] [TSO] [NOFF] [VLAN] [OL3_OL4_CSUM] [IL3_IL4_CSUM] */
 	eth_dev->tx_pkt_burst = tx_burst
+		[!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_TSTAMP_F)]
 		[!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_TSO_F)]
 		[!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_MBUF_NOFF_F)]
 		[!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_VLAN_QINQ_F)]
@@ -42,25 +43,25 @@ cn10k_eth_set_tx_function(struct rte_eth_dev *eth_dev)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
-	const eth_tx_burst_t nix_eth_tx_burst[2][2][2][2][2] = {
-#define T(name, f4, f3, f2, f1, f0, sz, flags)                         \
-	[f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_##name,
+	const eth_tx_burst_t nix_eth_tx_burst[2][2][2][2][2][2] = {
+#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
+	[f5][f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_##name,
 
 		NIX_TX_FASTPATH_MODES
 #undef T
 	};
 
-	const eth_tx_burst_t nix_eth_tx_burst_mseg[2][2][2][2][2] = {
-#define T(name, f4, f3, f2, f1, f0, sz, flags)				\
-	[f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_mseg_##name,
+	const eth_tx_burst_t nix_eth_tx_burst_mseg[2][2][2][2][2][2] = {
+#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
+	[f5][f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_mseg_##name,
 
 		NIX_TX_FASTPATH_MODES
 #undef T
 	};
 
-	const eth_tx_burst_t nix_eth_tx_vec_burst[2][2][2][2][2] = {
-#define T(name, f4, f3, f2, f1, f0, sz, flags)                         \
-	[f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_vec_##name,
+	const eth_tx_burst_t nix_eth_tx_vec_burst[2][2][2][2][2][2] = {
+#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
+	[f5][f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_vec_##name,
 
 		NIX_TX_FASTPATH_MODES
 #undef T
@@ -68,7 +69,8 @@ cn10k_eth_set_tx_function(struct rte_eth_dev *eth_dev)
 
 	if (dev->scalar_ena ||
 	    (dev->tx_offload_flags &
-	     (NIX_TX_OFFLOAD_VLAN_QINQ_F | NIX_TX_OFFLOAD_TSO_F)))
+	     (NIX_TX_OFFLOAD_VLAN_QINQ_F | NIX_TX_OFFLOAD_TSTAMP_F |
+	      NIX_TX_OFFLOAD_TSO_F)))
 		pick_tx_func(eth_dev, nix_eth_tx_burst);
 	else
 		pick_tx_func(eth_dev, nix_eth_tx_vec_burst);
drivers/net/cnxk/cn10k_tx.h +154 -39

275 lines not on this page · raw message

drivers/net/cnxk/cn10k_tx_mseg.c +1 -1
index 6ae6907..33f6754 100644
@@ -5,7 +5,7 @@
 #include "cn10k_ethdev.h"
 #include "cn10k_tx.h"
 
-#define T(name, f4, f3, f2, f1, f0, sz, flags)				       \
+#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
 	uint16_t __rte_noinline __rte_hot				       \
 		cn10k_nix_xmit_pkts_mseg_##name(void *tx_queue,                \
 						struct rte_mbuf **tx_pkts,     \
drivers/net/cnxk/cn10k_tx_vec.c +2 -1
index 42baeb5..7453f3b 100644
@@ -5,7 +5,7 @@
 #include "cn10k_ethdev.h"
 #include "cn10k_tx.h"
 
-#define T(name, f4, f3, f2, f1, f0, sz, flags)				       \
+#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
 	uint16_t __rte_noinline __rte_hot				       \
 		cn10k_nix_xmit_pkts_vec_##name(void *tx_queue,                 \
 					       struct rte_mbuf **tx_pkts,      \
@@ -15,6 +15,7 @@
 									       \
 		/* VLAN, TSTMP, TSO is not supported by vec */                 \
 		if ((flags) & NIX_TX_OFFLOAD_VLAN_QINQ_F ||		       \
+		    (flags) & NIX_TX_OFFLOAD_TSTAMP_F ||		       \
 		    (flags) & NIX_TX_OFFLOAD_TSO_F)			       \
 			return 0;                                              \
 		return cn10k_nix_xmit_pkts_vector(tx_queue, tx_pkts, pkts, cmd,\
drivers/net/cnxk/cn9k_ethdev.c +32 -2
index fc3054d..924b747 100644
@@ -30,6 +30,9 @@ nix_rx_offload_flags(struct rte_eth_dev *eth_dev)
 	if (dev->rx_offloads & DEV_RX_OFFLOAD_SCATTER)
 		flags |= NIX_RX_MULTI_SEG_F;
 
+	if ((dev->rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP))
+		flags |= NIX_RX_OFFLOAD_TSTAMP_F;
+
 	if (!dev->ptype_disable)
 		flags |= NIX_RX_OFFLOAD_PTYPE_F;
 
@@ -95,6 +98,9 @@ nix_tx_offload_flags(struct rte_eth_dev *eth_dev)
 		flags |= (NIX_TX_OFFLOAD_TSO_F | NIX_TX_OFFLOAD_OL3_OL4_CSUM_F |
 			  NIX_TX_OFFLOAD_L3_L4_CSUM_F);
 
+	if ((dev->rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP))
+		flags |= NIX_TX_OFFLOAD_TSTAMP_F;
+
 	return flags;
 }
 
@@ -121,10 +127,9 @@ nix_form_default_desc(struct cnxk_eth_dev *dev, struct cn9k_eth_txq *txq,
 {
 	struct nix_send_ext_s *send_hdr_ext;
 	struct nix_send_hdr_s *send_hdr;
+	struct nix_send_mem_s *send_mem;
 	union nix_send_sg_s *sg;
 
-	RTE_SET_USED(dev);
-
 	/* Initialize the fields based on basic single segment packet */
 	memset(&txq->cmd, 0, sizeof(txq->cmd));
 
@@ -135,6 +140,23 @@ nix_form_default_desc(struct cnxk_eth_dev *dev, struct cn9k_eth_txq *txq,
 
 		send_hdr_ext = (struct nix_send_ext_s *)&txq->cmd[2];
 		send_hdr_ext->w0.subdc = NIX_SUBDC_EXT;
+		if (dev->tx_offload_flags & NIX_TX_OFFLOAD_TSTAMP_F) {
+			/* Default: one seg packet would have:
+			 * 2(HDR) + 2(EXT) + 1(SG) + 1(IOVA) + 2(MEM)
+			 * => 8/2 - 1 = 3
+			 */
+			send_hdr->w0.sizem1 = 3;
+			send_hdr_ext->w0.tstmp = 1;
+
+			/* To calculate the offset for send_mem,
+			 * send_hdr->w0.sizem1 * 2
+			 */
+			send_mem = (struct nix_send_mem_s *)
+				(txq->cmd + (send_hdr->w0.sizem1 << 1));
+			send_mem->w0.cn9k.subdc = NIX_SUBDC_MEM;
+			send_mem->w0.cn9k.alg = NIX_SENDMEMALG_SETTSTMP;
+			send_mem->addr = dev->tstamp.tx_tstamp_iova;
+		}
 		sg = (union nix_send_sg_s *)&txq->cmd[4];
 	} else {
 		send_hdr = (struct nix_send_hdr_s *)&txq->cmd[0];
@@ -219,6 +241,7 @@ cn9k_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 	rxq->wdata = cq->wdata;
 	rxq->head = cq->head;
 	rxq->qmask = cq->qmask;
+	rxq->tstamp = &dev->tstamp;
 
 	/* Data offset from data to start of mbuf is first_skip */
 	rxq->data_off = rq->first_skip;
@@ -351,6 +374,7 @@ static int
 cn9k_nix_dev_start(struct rte_eth_dev *eth_dev)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	struct roc_nix *nix = &dev->nix;
 	int rc;
 
 	/* Common eth dev start */
@@ -358,6 +382,12 @@ cn9k_nix_dev_start(struct rte_eth_dev *eth_dev)
 	if (rc)
 		return rc;
 
+	/* Update VF about data off shifted by 8 bytes if PTP already
+	 * enabled in PF owning this VF
+	 */
+	if (dev->ptp_en && (!roc_nix_is_pf(nix) && (!roc_nix_is_sdp(nix))))
+		nix_ptp_enable_vf(eth_dev);
+
 	/* Setting up the rx[tx]_offload_flags due to change
 	 * in rx[tx]_offloads.
 	 */
drivers/net/cnxk/cn9k_ethdev.h +1 -0
index b92f3fc..f481b3a 100644
@@ -29,6 +29,7 @@ struct cn9k_eth_rxq {
 	uint32_t qmask;
 	uint32_t available;
 	uint16_t rq;
+	struct cnxk_timesync_info *tstamp;
 } __plt_cache_aligned;
 
 /* Rx and Tx routines */
drivers/net/cnxk/cn9k_rx.c +18 -14
index 01eb21f..a15428d 100644
@@ -5,7 +5,7 @@
 #include "cn9k_ethdev.h"
 #include "cn9k_rx.h"
 
-#define R(name, f3, f2, f1, f0, flags)					       \
+#define R(name, f4, f3, f2, f1, f0, flags)				       \
 	uint16_t __rte_noinline __rte_hot cn9k_nix_recv_pkts_##name(	       \
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
@@ -17,12 +17,13 @@ NIX_RX_FASTPATH_MODES
 
 static inline void
 pick_rx_func(struct rte_eth_dev *eth_dev,
-	     const eth_rx_burst_t rx_burst[2][2][2][2])
+	     const eth_rx_burst_t rx_burst[2][2][2][2][2])
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
-	/* [MARK] [CKSUM] [PTYPE] [RSS] */
+	/* [TSP] [MARK] [CKSUM] [PTYPE] [RSS] */
 	eth_dev->rx_pkt_burst = rx_burst
+		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_TSTAMP_F)]
 		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_MARK_UPDATE_F)]
 		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_CHECKSUM_F)]
 		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_PTYPE_F)]
@@ -34,31 +35,34 @@ cn9k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
-	const eth_rx_burst_t nix_eth_rx_burst[2][2][2][2] = {
-#define R(name, f3, f2, f1, f0, flags)					\
-	[f3][f2][f1][f0] = cn9k_nix_recv_pkts_##name,
+	const eth_rx_burst_t nix_eth_rx_burst[2][2][2][2][2] = {
+#define R(name, f4, f3, f2, f1, f0, flags)				       \
+	[f4][f3][f2][f1][f0] = cn9k_nix_recv_pkts_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const eth_rx_burst_t nix_eth_rx_burst_mseg[2][2][2][2] = {
-#define R(name, f3, f2, f1, f0, flags)					\
-	[f3][f2][f1][f0] = cn9k_nix_recv_pkts_mseg_##name,
+	const eth_rx_burst_t nix_eth_rx_burst_mseg[2][2][2][2][2] = {
+#define R(name, f4, f3, f2, f1, f0, flags)				       \
+	[f4][f3][f2][f1][f0] = cn9k_nix_recv_pkts_mseg_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const eth_rx_burst_t nix_eth_rx_vec_burst[2][2][2][2] = {
-#define R(name, f3, f2, f1, f0, flags)					\
-	[f3][f2][f1][f0] = cn9k_nix_recv_pkts_vec_##name,
+	const eth_rx_burst_t nix_eth_rx_vec_burst[2][2][2][2][2] = {
+#define R(name, f4, f3, f2, f1, f0, flags)				       \
+	[f4][f3][f2][f1][f0] = cn9k_nix_recv_pkts_vec_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	if (dev->scalar_ena)
+	/* For PTP enabled, scalar rx function should be chosen as most of the
+	 * PTP apps are implemented to rx burst 1 pkt.
+	 */
+	if (dev->scalar_ena || dev->rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP)
 		pick_rx_func(eth_dev, nix_eth_rx_burst);
 	else
 		pick_rx_func(eth_dev, nix_eth_rx_vec_burst);
@@ -69,6 +73,6 @@ cn9k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
 	/* Copy multi seg version with no offload for tear down sequence */
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
 		dev->rx_pkt_burst_no_offload =
-			nix_eth_rx_burst_mseg[0][0][0][0];
+			nix_eth_rx_burst_mseg[0][0][0][0][0];
 	rte_mb();
 }
drivers/net/cnxk/cn9k_rx.h +42 -19

81 lines not on this page · raw message

drivers/net/cnxk/cn9k_rx_mseg.c +1 -1
index 6ad8c1d..3b26962 100644
@@ -5,7 +5,7 @@
 #include "cn9k_ethdev.h"
 #include "cn9k_rx.h"
 
-#define R(name, f3, f2, f1, f0, flags)                                         \
+#define R(name, f4, f3, f2, f1, f0, flags)                                     \
 	uint16_t __rte_noinline __rte_hot cn9k_nix_recv_pkts_mseg_##name(      \
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
drivers/net/cnxk/cn9k_rx_vec.c +4 -1
index 997177f..b19c7f3 100644
@@ -5,10 +5,13 @@
 #include "cn9k_ethdev.h"
 #include "cn9k_rx.h"
 
-#define R(name, f3, f2, f1, f0, flags)                                         \
+#define R(name, f4, f3, f2, f1, f0, flags)				       \
 	uint16_t __rte_noinline __rte_hot cn9k_nix_recv_pkts_vec_##name(       \
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
+		/* TSTMP is not supported by vector */                         \
+		if ((flags) & NIX_RX_OFFLOAD_TSTAMP_F)                         \
+			return 0;                                              \
 		return cn9k_nix_recv_pkts_vector(rx_queue, rx_pkts, pkts,      \
 						 (flags));                     \
 	}
drivers/net/cnxk/cn9k_tx.c +15 -13
index 2ff9720..b802606 100644
@@ -5,7 +5,7 @@
 #include "cn9k_ethdev.h"
 #include "cn9k_tx.h"
 
-#define T(name, f4, f3, f2, f1, f0, sz, flags)				       \
+#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
 	uint16_t __rte_noinline __rte_hot cn9k_nix_xmit_pkts_##name(	       \
 		void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t pkts)      \
 	{                                                                      \
@@ -23,12 +23,13 @@ NIX_TX_FASTPATH_MODES
 
 static inline void
 pick_tx_func(struct rte_eth_dev *eth_dev,
-	     const eth_tx_burst_t tx_burst[2][2][2][2][2])
+	     const eth_tx_burst_t tx_burst[2][2][2][2][2][2])
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
-	/* [TSO] [NOFF] [VLAN] [OL3_OL4_CSUM] [IL3_IL4_CSUM] */
+	/* [TS] [TSO] [NOFF] [VLAN] [OL3_OL4_CSUM] [IL3_IL4_CSUM] */
 	eth_dev->tx_pkt_burst = tx_burst
+		[!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_TSTAMP_F)]
 		[!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_TSO_F)]
 		[!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_MBUF_NOFF_F)]
 		[!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_VLAN_QINQ_F)]
@@ -41,25 +42,25 @@ cn9k_eth_set_tx_function(struct rte_eth_dev *eth_dev)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
-	const eth_tx_burst_t nix_eth_tx_burst[2][2][2][2][2] = {
-#define T(name, f4, f3, f2, f1, f0, sz, flags)				       \
-	[f4][f3][f2][f1][f0] = cn9k_nix_xmit_pkts_##name,
+	const eth_tx_burst_t nix_eth_tx_burst[2][2][2][2][2][2] = {
+#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
+	[f5][f4][f3][f2][f1][f0] = cn9k_nix_xmit_pkts_##name,
 
 		NIX_TX_FASTPATH_MODES
 #undef T
 	};
 
-	const eth_tx_burst_t nix_eth_tx_burst_mseg[2][2][2][2][2] = {
-#define T(name, f4, f3, f2, f1, f0, sz, flags)				       \
-	[f4][f3][f2][f1][f0] = cn9k_nix_xmit_pkts_mseg_##name,
+	const eth_tx_burst_t nix_eth_tx_burst_mseg[2][2][2][2][2][2] = {
+#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
+	[f5][f4][f3][f2][f1][f0] = cn9k_nix_xmit_pkts_mseg_##name,
 
 		NIX_TX_FASTPATH_MODES
 #undef T
 	};
 
-	const eth_tx_burst_t nix_eth_tx_vec_burst[2][2][2][2][2] = {
-#define T(name, f4, f3, f2, f1, f0, sz, flags)				       \
-	[f4][f3][f2][f1][f0] = cn9k_nix_xmit_pkts_vec_##name,
+	const eth_tx_burst_t nix_eth_tx_vec_burst[2][2][2][2][2][2] = {
+#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
+	[f5][f4][f3][f2][f1][f0] = cn9k_nix_xmit_pkts_vec_##name,
 
 		NIX_TX_FASTPATH_MODES
 #undef T
@@ -67,7 +68,8 @@ cn9k_eth_set_tx_function(struct rte_eth_dev *eth_dev)
 
 	if (dev->scalar_ena ||
 	    (dev->tx_offload_flags &
-	     (NIX_TX_OFFLOAD_VLAN_QINQ_F | NIX_TX_OFFLOAD_TSO_F)))
+	     (NIX_TX_OFFLOAD_VLAN_QINQ_F | NIX_TX_OFFLOAD_TSTAMP_F |
+	      NIX_TX_OFFLOAD_TSO_F)))
 		pick_tx_func(eth_dev, nix_eth_tx_burst);
 	else
 		pick_tx_func(eth_dev, nix_eth_tx_vec_burst);
drivers/net/cnxk/cn9k_tx.h +182 -71

303 lines not on this page · raw message

drivers/net/cnxk/cn9k_tx_mseg.c +1 -1
index 65c5f36..f3c427c 100644
@@ -5,7 +5,7 @@
 #include "cn9k_ethdev.h"
 #include "cn9k_tx.h"
 
-#define T(name, f4, f3, f2, f1, f0, sz, flags)				       \
+#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
 	uint16_t __rte_noinline __rte_hot				       \
 		cn9k_nix_xmit_pkts_mseg_##name(void *tx_queue,                 \
 					       struct rte_mbuf **tx_pkts,      \
drivers/net/cnxk/cn9k_tx_vec.c +2 -1
index 21ffc2c..a6e7c9e 100644
@@ -5,7 +5,7 @@
 #include "cn9k_ethdev.h"
 #include "cn9k_tx.h"
 
-#define T(name, f4, f3, f2, f1, f0, sz, flags)				       \
+#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
 	uint16_t __rte_noinline __rte_hot				       \
 		cn9k_nix_xmit_pkts_vec_##name(void *tx_queue,                  \
 					      struct rte_mbuf **tx_pkts,       \
@@ -15,6 +15,7 @@
 									       \
 		/* VLAN, TSTMP, TSO is not supported by vec */                 \
 		if ((flags) & NIX_TX_OFFLOAD_VLAN_QINQ_F ||		       \
+		    (flags) & NIX_TX_OFFLOAD_TSTAMP_F ||		       \
 		    (flags) & NIX_TX_OFFLOAD_TSO_F)			       \
 			return 0;                                              \
 		return cn9k_nix_xmit_pkts_vector(tx_queue, tx_pkts, pkts, cmd, \
drivers/net/cnxk/cnxk_ethdev.c +34 -2
index 094f1cb..71d567a 100644
@@ -150,7 +150,8 @@ cnxk_nix_rxq_mbuf_setup(struct cnxk_eth_dev *dev)
 				 offsetof(struct rte_mbuf, data_off) !=
 			 6);
 	mb_def.nb_segs = 1;
-	mb_def.data_off = RTE_PKTMBUF_HEADROOM;
+	mb_def.data_off = RTE_PKTMBUF_HEADROOM +
+			  (dev->ptp_en * CNXK_NIX_TIMESYNC_RX_OFFSET);
 	mb_def.port = port_id;
 	rte_mbuf_refcnt_set(&mb_def, 1);
 
@@ -356,6 +357,18 @@ cnxk_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 	eth_dev->data->rx_queues[qid] = rxq_sp + 1;
 	eth_dev->data->rx_queue_state[qid] = RTE_ETH_QUEUE_STATE_STOPPED;
 
+	/* Calculating delta and freq mult between PTP HI clock and tsc.
+	 * These are needed in deriving raw clock value from tsc counter.
+	 * read_clock eth op returns raw clock value.
+	 */
+	if ((dev->rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP) || dev->ptp_en) {
+		rc = cnxk_nix_tsc_convert(dev);
+		if (rc) {
+			plt_err("Failed to calculate delta and freq mult");
+			goto rq_fini;
+		}
+	}
+
 	return 0;
 rq_fini:
 	rc |= roc_nix_rq_fini(rq);
@@ -1112,7 +1125,7 @@ cnxk_nix_dev_start(struct rte_eth_dev *eth_dev)
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 	int rc, i;
 
-	if (eth_dev->data->nb_rx_queues != 0) {
+	if (eth_dev->data->nb_rx_queues != 0 && !dev->ptp_en) {
 		rc = nix_recalc_mtu(eth_dev);
 		if (rc)
 			return rc;
@@ -1157,6 +1170,25 @@ cnxk_nix_dev_start(struct rte_eth_dev *eth_dev)
 		}
 	}
 
+	/* Enable PTP if it is requested by the user or already
+	 * enabled on PF owning this VF
+	 */
+	memset(&dev->tstamp, 0, sizeof(struct cnxk_timesync_info));
+	if ((dev->rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP) || dev->ptp_en)
+		cnxk_eth_dev_ops.timesync_enable(eth_dev);
+	else
+		cnxk_eth_dev_ops.timesync_disable(eth_dev);
+
+	if (dev->rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP) {
+		rc = rte_mbuf_dyn_rx_timestamp_register
+			(&dev->tstamp.tstamp_dynfield_offset,
+			 &dev->tstamp.rx_tstamp_dynflag);
+		if (rc != 0) {
+			plt_err("Failed to register Rx timestamp field/flag");
+			goto rx_disable;
+		}
+	}
+
 	cnxk_nix_toggle_flag_link_cfg(dev, false);
 
 	return 0;
drivers/net/cnxk/cnxk_ethdev.h +63 -1

105 lines not on this page · raw message

drivers/net/cnxk/cnxk_ptp.c new file +169 -0

169 lines not on this page · raw message

drivers/net/cnxk/meson.build +1 -0
index df953fd..2071d0d 100644
@@ -13,6 +13,7 @@ sources = files('cnxk_ethdev.c',
 		'cnxk_ethdev_devargs.c',
 		'cnxk_link.c',
 		'cnxk_lookup.c',
+		'cnxk_ptp.c',
 		'cnxk_rte_flow.c',
 		'cnxk_stats.c')
 
Signature · 1 line
2.8.4
#184 lore raw

PATCH v3 56/62 net/cnxk: add timesync enable/disable operations

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

Patch implements timesync enable/disable operations for cn9k and cn10k platforms.

---
 drivers/net/cnxk/cn10k_ethdev.c | 50 +++++++++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cn9k_ethdev.c  | 50 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 100 insertions(+)
drivers/net/cnxk/cn10k_ethdev.c +50 -0
index 5e0de13..b079edb 100644
@@ -363,6 +363,54 @@ cn10k_nix_ptp_info_update_cb(struct roc_nix *nix, bool ptp_en)
 }
 
 static int
+cn10k_nix_timesync_enable(struct rte_eth_dev *eth_dev)
+{
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	int i, rc;
+
+	rc = cnxk_nix_timesync_enable(eth_dev);
+	if (rc)
+		return rc;
+
+	dev->rx_offload_flags |= NIX_RX_OFFLOAD_TSTAMP_F;
+	dev->tx_offload_flags |= NIX_TX_OFFLOAD_TSTAMP_F;
+
+	for (i = 0; i < eth_dev->data->nb_tx_queues; i++)
+		nix_form_default_desc(dev, eth_dev->data->tx_queues[i], i);
+
+	/* Setting up the rx[tx]_offload_flags due to change
+	 * in rx[tx]_offloads.
+	 */
+	cn10k_eth_set_rx_function(eth_dev);
+	cn10k_eth_set_tx_function(eth_dev);
+	return 0;
+}
+
+static int
+cn10k_nix_timesync_disable(struct rte_eth_dev *eth_dev)
+{
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	int i, rc;
+
+	rc = cnxk_nix_timesync_disable(eth_dev);
+	if (rc)
+		return rc;
+
+	dev->rx_offload_flags &= ~NIX_RX_OFFLOAD_TSTAMP_F;
+	dev->tx_offload_flags &= ~NIX_TX_OFFLOAD_TSTAMP_F;
+
+	for (i = 0; i < eth_dev->data->nb_tx_queues; i++)
+		nix_form_default_desc(dev, eth_dev->data->tx_queues[i], i);
+
+	/* Setting up the rx[tx]_offload_flags due to change
+	 * in rx[tx]_offloads.
+	 */
+	cn10k_eth_set_rx_function(eth_dev);
+	cn10k_eth_set_tx_function(eth_dev);
+	return 0;
+}
+
+static int
 cn10k_nix_dev_start(struct rte_eth_dev *eth_dev)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
@@ -408,6 +456,8 @@ nix_eth_dev_ops_override(void)
 	cnxk_eth_dev_ops.tx_queue_stop = cn10k_nix_tx_queue_stop;
 	cnxk_eth_dev_ops.dev_start = cn10k_nix_dev_start;
 	cnxk_eth_dev_ops.dev_ptypes_set = cn10k_nix_ptypes_set;
+	cnxk_eth_dev_ops.timesync_enable = cn10k_nix_timesync_enable;
+	cnxk_eth_dev_ops.timesync_disable = cn10k_nix_timesync_disable;
 }
 
 static void
drivers/net/cnxk/cn9k_ethdev.c +50 -0

62 lines not on this page · raw message

Signature · 1 line
2.8.4
#185 lore raw

PATCH v3 57/62 net/cnxk: add Rx/Tx timestamp read operations

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

Patch implements Rx/Tx timestamp read operations for cn9k and cn10k platforms.

---
 drivers/net/cnxk/cnxk_ethdev.c |  2 ++
 drivers/net/cnxk/cnxk_ethdev.h |  5 +++++
 drivers/net/cnxk/cnxk_ptp.c    | 38 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 45 insertions(+)
drivers/net/cnxk/cnxk_ethdev.c +2 -0
index 71d567a..0bef942 100644
@@ -1248,6 +1248,8 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
 	.tx_done_cleanup = cnxk_nix_tx_done_cleanup,
 	.flow_ops_get = cnxk_nix_flow_ops_get,
 	.get_reg = cnxk_nix_dev_get_reg,
+	.timesync_read_rx_timestamp = cnxk_nix_timesync_read_rx_timestamp,
+	.timesync_read_tx_timestamp = cnxk_nix_timesync_read_tx_timestamp,
 };
 
 static int
drivers/net/cnxk/cnxk_ethdev.h +5 -0
index de6d533..76df84a 100644
@@ -312,6 +312,11 @@ int cnxk_nix_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t qid);
 int cnxk_nix_dev_start(struct rte_eth_dev *eth_dev);
 int cnxk_nix_timesync_enable(struct rte_eth_dev *eth_dev);
 int cnxk_nix_timesync_disable(struct rte_eth_dev *eth_dev);
+int cnxk_nix_timesync_read_rx_timestamp(struct rte_eth_dev *eth_dev,
+					struct timespec *timestamp,
+					uint32_t flags);
+int cnxk_nix_timesync_read_tx_timestamp(struct rte_eth_dev *eth_dev,
+					struct timespec *timestamp);
 int cnxk_nix_tsc_convert(struct cnxk_eth_dev *dev);
 
 uint64_t cnxk_nix_rxq_mbuf_setup(struct cnxk_eth_dev *dev);
drivers/net/cnxk/cnxk_ptp.c +38 -0
index fc317965..7b00f87 100644
@@ -56,6 +56,44 @@ cnxk_nix_tsc_convert(struct cnxk_eth_dev *dev)
 }
 
 int
+cnxk_nix_timesync_read_rx_timestamp(struct rte_eth_dev *eth_dev,
+				    struct timespec *timestamp, uint32_t flags)
+{
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	struct cnxk_timesync_info *tstamp = &dev->tstamp;
+	uint64_t ns;
+
+	PLT_SET_USED(flags);
+
+	if (!tstamp->rx_ready)
+		return -EINVAL;
+
+	ns = rte_timecounter_update(&dev->rx_tstamp_tc, tstamp->rx_tstamp);
+	*timestamp = rte_ns_to_timespec(ns);
+	tstamp->rx_ready = 0;
+	return 0;
+}
+
+int
+cnxk_nix_timesync_read_tx_timestamp(struct rte_eth_dev *eth_dev,
+				    struct timespec *timestamp)
+{
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	struct cnxk_timesync_info *tstamp = &dev->tstamp;
+	uint64_t ns;
+
+	if (*tstamp->tx_tstamp == 0)
+		return -EINVAL;
+
+	ns = rte_timecounter_update(&dev->tx_tstamp_tc, *tstamp->tx_tstamp);
+	*timestamp = rte_ns_to_timespec(ns);
+	*tstamp->tx_tstamp = 0;
+	rte_wmb();
+
+	return 0;
+}
+
+int
 cnxk_nix_timesync_enable(struct rte_eth_dev *eth_dev)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
Signature · 1 line
2.8.4
#186 lore raw

PATCH v3 58/62 net/cnxk: add time read/write/adjust operations

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

Patch implements read/write/adjust time operations for cn9k and cn10k platforms.

---
 drivers/net/cnxk/cnxk_ethdev.c |  3 ++
 drivers/net/cnxk/cnxk_ethdev.h |  5 ++++
 drivers/net/cnxk/cnxk_ptp.c    | 63 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 71 insertions(+)
drivers/net/cnxk/cnxk_ethdev.c +3 -0
index 0bef942..cac8ddf 100644
@@ -1250,6 +1250,9 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
 	.get_reg = cnxk_nix_dev_get_reg,
 	.timesync_read_rx_timestamp = cnxk_nix_timesync_read_rx_timestamp,
 	.timesync_read_tx_timestamp = cnxk_nix_timesync_read_tx_timestamp,
+	.timesync_read_time = cnxk_nix_timesync_read_time,
+	.timesync_write_time = cnxk_nix_timesync_write_time,
+	.timesync_adjust_time = cnxk_nix_timesync_adjust_time,
 };
 
 static int
drivers/net/cnxk/cnxk_ethdev.h +5 -0
index 76df84a..4214365 100644
@@ -317,6 +317,11 @@ int cnxk_nix_timesync_read_rx_timestamp(struct rte_eth_dev *eth_dev,
 					uint32_t flags);
 int cnxk_nix_timesync_read_tx_timestamp(struct rte_eth_dev *eth_dev,
 					struct timespec *timestamp);
+int cnxk_nix_timesync_read_time(struct rte_eth_dev *eth_dev,
+				struct timespec *ts);
+int cnxk_nix_timesync_write_time(struct rte_eth_dev *eth_dev,
+				 const struct timespec *ts);
+int cnxk_nix_timesync_adjust_time(struct rte_eth_dev *eth_dev, int64_t delta);
 int cnxk_nix_tsc_convert(struct cnxk_eth_dev *dev);
 
 uint64_t cnxk_nix_rxq_mbuf_setup(struct cnxk_eth_dev *dev);
drivers/net/cnxk/cnxk_ptp.c +63 -0

69 lines not on this page · raw message

Signature · 1 line
2.8.4
#187 lore raw

PATCH v3 59/62 net/cnxk: add read clock operation

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

Patch implements read raw clock operation for cn9k and cn10k.

---
 doc/guides/nics/features/cnxk.ini |  2 ++
 drivers/net/cnxk/cnxk_ethdev.c    |  1 +
 drivers/net/cnxk/cnxk_ethdev.h    |  1 +
 drivers/net/cnxk/cnxk_ptp.c       | 17 +++++++++++++++++
 4 files changed, 21 insertions(+)
doc/guides/nics/features/cnxk.ini +2 -0
index eba4107..5874531 100644
@@ -32,6 +32,8 @@ L4 checksum offload  = Y
 Inner L3 checksum    = Y
 Inner L4 checksum    = Y
 Packet type parsing  = Y
+Timesync             = Y
+Timestamp offload    = Y
 Basic stats          = Y
 Stats per queue      = Y
 Extended stats       = Y
drivers/net/cnxk/cnxk_ethdev.c +1 -0
index cac8ddf..e1373cf 100644
@@ -1253,6 +1253,7 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
 	.timesync_read_time = cnxk_nix_timesync_read_time,
 	.timesync_write_time = cnxk_nix_timesync_write_time,
 	.timesync_adjust_time = cnxk_nix_timesync_adjust_time,
+	.read_clock = cnxk_nix_read_clock,
 };
 
 static int
drivers/net/cnxk/cnxk_ethdev.h +1 -0
index 4214365..fa6f16f 100644
@@ -323,6 +323,7 @@ int cnxk_nix_timesync_write_time(struct rte_eth_dev *eth_dev,
 				 const struct timespec *ts);
 int cnxk_nix_timesync_adjust_time(struct rte_eth_dev *eth_dev, int64_t delta);
 int cnxk_nix_tsc_convert(struct cnxk_eth_dev *dev);
+int cnxk_nix_read_clock(struct rte_eth_dev *eth_dev, uint64_t *clock);
 
 uint64_t cnxk_nix_rxq_mbuf_setup(struct cnxk_eth_dev *dev);
 
drivers/net/cnxk/cnxk_ptp.c +17 -0
index 52f6eb1..449489f 100644
@@ -4,6 +4,23 @@
 
 #include "cnxk_ethdev.h"
 
+int
+cnxk_nix_read_clock(struct rte_eth_dev *eth_dev, uint64_t *clock)
+{
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+
+	/* This API returns the raw PTP HI clock value. Since LFs do not
+	 * have direct access to PTP registers and it requires mbox msg
+	 * to AF for this value. In fastpath reading this value for every
+	 * packet (which involes mbox call) becomes very expensive, hence
+	 * we should be able to derive PTP HI clock value from tsc by
+	 * using freq_mult and clk_delta calculated during configure stage.
+	 */
+	*clock = (rte_get_tsc_cycles() + dev->clk_delta) * dev->clk_freq_mult;
+
+	return 0;
+}
+
 /* This function calculates two parameters "clk_freq_mult" and
  * "clk_delta" which is useful in deriving PTP HI clock from
  * timestamp counter (tsc) value.
Signature · 1 line
2.8.4
#188 lore raw

PATCH v3 60/62 net/cnxk: added RETA and RSS hash operations

In reply to Nithin Dabilpuram

From: Satha Rao <[email protected]>

This patch will implement RETA and RSS hash apis. Also added device argument to lock rx context.

---
 doc/guides/nics/features/cnxk.ini      |   2 +
 doc/guides/nics/features/cnxk_vec.ini  |   2 +
 doc/guides/nics/features/cnxk_vf.ini   |   2 +
 drivers/net/cnxk/cnxk_ethdev.c         |   4 ++
 drivers/net/cnxk/cnxk_ethdev.h         |  10 +++
 drivers/net/cnxk/cnxk_ethdev_devargs.c |   4 ++
 drivers/net/cnxk/cnxk_ethdev_ops.c     | 121 +++++++++++++++++++++++++++++++++
 7 files changed, 145 insertions(+)
doc/guides/nics/features/cnxk.ini +2 -0
index 5874531..9945af9 100644
@@ -23,6 +23,8 @@ Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
 RSS hash             = Y
+RSS key update       = Y
+RSS reta update      = Y
 Inner RSS            = Y
 Flow control         = Y
 Jumbo frame          = Y
doc/guides/nics/features/cnxk_vec.ini +2 -0
index 65ee8ba..b4b1169 100644
@@ -22,6 +22,8 @@ Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
 RSS hash             = Y
+RSS key update       = Y
+RSS reta update      = Y
 Inner RSS            = Y
 Flow control         = Y
 Jumbo frame          = Y
doc/guides/nics/features/cnxk_vf.ini +2 -0
index 00bde9b..fbc50a8 100644
@@ -19,6 +19,8 @@ Queue start/stop     = Y
 MTU update           = Y
 TSO                  = Y
 RSS hash             = Y
+RSS key update       = Y
+RSS reta update      = Y
 Inner RSS            = Y
 Jumbo frame          = Y
 Scattered Rx         = Y
drivers/net/cnxk/cnxk_ethdev.c +4 -0
index e1373cf..f49c9e6 100644
@@ -1254,6 +1254,10 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
 	.timesync_write_time = cnxk_nix_timesync_write_time,
 	.timesync_adjust_time = cnxk_nix_timesync_adjust_time,
 	.read_clock = cnxk_nix_read_clock,
+	.reta_update = cnxk_nix_reta_update,
+	.reta_query = cnxk_nix_reta_query,
+	.rss_hash_update = cnxk_nix_rss_hash_update,
+	.rss_hash_conf_get = cnxk_nix_rss_hash_conf_get,
 };
 
 static int
drivers/net/cnxk/cnxk_ethdev.h +10 -0
index fa6f16f..cd08e3a 100644
@@ -330,6 +330,16 @@ uint64_t cnxk_nix_rxq_mbuf_setup(struct cnxk_eth_dev *dev);
 /* RSS */
 uint32_t cnxk_rss_ethdev_to_nix(struct cnxk_eth_dev *dev, uint64_t ethdev_rss,
 				uint8_t rss_level);
+int cnxk_nix_reta_update(struct rte_eth_dev *eth_dev,
+			 struct rte_eth_rss_reta_entry64 *reta_conf,
+			 uint16_t reta_size);
+int cnxk_nix_reta_query(struct rte_eth_dev *eth_dev,
+			struct rte_eth_rss_reta_entry64 *reta_conf,
+			uint16_t reta_size);
+int cnxk_nix_rss_hash_update(struct rte_eth_dev *eth_dev,
+			     struct rte_eth_rss_conf *rss_conf);
+int cnxk_nix_rss_hash_conf_get(struct rte_eth_dev *eth_dev,
+			       struct rte_eth_rss_conf *rss_conf);
 
 /* Link */
 void cnxk_nix_toggle_flag_link_cfg(struct cnxk_eth_dev *dev, bool set);
drivers/net/cnxk/cnxk_ethdev_devargs.c +4 -0
index 7fd06eb..c76b628 100644
@@ -109,6 +109,7 @@ parse_switch_header_type(const char *key, const char *value, void *extra_args)
 #define CNXK_FLOW_MAX_PRIORITY	"flow_max_priority"
 #define CNXK_SWITCH_HEADER_TYPE "switch_header"
 #define CNXK_RSS_TAG_AS_XOR	"tag_as_xor"
+#define CNXK_LOCK_RX_CTX	"lock_rx_ctx"
 
 int
 cnxk_ethdev_parse_devargs(struct rte_devargs *devargs, struct cnxk_eth_dev *dev)
@@ -120,6 +121,7 @@ cnxk_ethdev_parse_devargs(struct rte_devargs *devargs, struct cnxk_eth_dev *dev)
 	uint16_t flow_max_priority = 3;
 	uint16_t rss_tag_as_xor = 0;
 	uint16_t scalar_enable = 0;
+	uint8_t lock_rx_ctx = 0;
 	struct rte_kvargs *kvlist;
 
 	if (devargs == NULL)
@@ -143,6 +145,7 @@ cnxk_ethdev_parse_devargs(struct rte_devargs *devargs, struct cnxk_eth_dev *dev)
 			   &parse_switch_header_type, &switch_header_type);
 	rte_kvargs_process(kvlist, CNXK_RSS_TAG_AS_XOR, &parse_flag,
 			   &rss_tag_as_xor);
+	rte_kvargs_process(kvlist, CNXK_LOCK_RX_CTX, &parse_flag, &lock_rx_ctx);
 	rte_kvargs_free(kvlist);
 
 null_devargs:
@@ -150,6 +153,7 @@ cnxk_ethdev_parse_devargs(struct rte_devargs *devargs, struct cnxk_eth_dev *dev)
 	dev->nix.rss_tag_as_xor = !!rss_tag_as_xor;
 	dev->nix.max_sqb_count = sqb_count;
 	dev->nix.reta_sz = reta_sz;
+	dev->nix.lock_rx_ctx = lock_rx_ctx;
 	dev->npc.flow_prealloc_size = flow_prealloc_size;
 	dev->npc.flow_max_priority = flow_max_priority;
 	dev->npc.switch_header_type = switch_header_type;
drivers/net/cnxk/cnxk_ethdev_ops.c +121 -0

124 lines not on this page · raw message

Signature · 1 line
2.8.4
#189 lore raw

PATCH v3 61/62 net/cnxk: add multicast filter support

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

Patch adds multicast filter support for cn9k and cn10k platforms.

CGX DMAC filter table(32 entries) is divided among all LMACs connected to it i.e. if CGX has 4 LMACs then each LMAC can have up to 8 filters. If CGX has 1 LMAC then it can have up to 32 filters.

Above mentioned filter table is used to install unicast and multicast DMAC address filters. Unicast filters are installed via rte_eth_dev_mac_addr_add API while multicast filters are installed via rte_eth_dev_set_mc_addr_list API.

So in total, supported MAC filters are equal to DMAC filters plus mcast filters.

---
 doc/guides/nics/features/cnxk.ini     |  1 +
 doc/guides/nics/features/cnxk_vec.ini |  1 +
 drivers/net/cnxk/cnxk_ethdev.c        |  2 ++
 drivers/net/cnxk/cnxk_ethdev.h        |  4 +++
 drivers/net/cnxk/cnxk_ethdev_ops.c    | 63 +++++++++++++++++++++++++++++++++++
 5 files changed, 71 insertions(+)
doc/guides/nics/features/cnxk.ini +1 -0
index 9945af9..c686ceb 100644
@@ -22,6 +22,7 @@ TSO                  = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
+Multicast MAC filter = Y
 RSS hash             = Y
 RSS key update       = Y
 RSS reta update      = Y
doc/guides/nics/features/cnxk_vec.ini +1 -0
index b4b1169..4c3f78e 100644
@@ -21,6 +21,7 @@ MTU update           = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
+Multicast MAC filter = Y
 RSS hash             = Y
 RSS key update       = Y
 RSS reta update      = Y
drivers/net/cnxk/cnxk_ethdev.c +2 -0
index f49c9e6..1edea35 100644
@@ -1258,6 +1258,7 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
 	.reta_query = cnxk_nix_reta_query,
 	.rss_hash_update = cnxk_nix_rss_hash_update,
 	.rss_hash_conf_get = cnxk_nix_rss_hash_conf_get,
+	.set_mc_addr_list = cnxk_nix_mc_addr_list_configure,
 };
 
 static int
@@ -1322,6 +1323,7 @@ cnxk_eth_dev_init(struct rte_eth_dev *eth_dev)
 	}
 
 	dev->max_mac_entries = max_entries;
+	dev->dmac_filter_count = 1;
 
 	/* Get mac address */
 	rc = roc_nix_npc_mac_addr_get(nix, dev->mac_addr);
drivers/net/cnxk/cnxk_ethdev.h +4 -0
index cd08e3a..c07e988 100644
@@ -162,6 +162,7 @@ struct cnxk_eth_dev {
 	uint8_t configured;
 
 	/* Max macfilter entries */
+	uint8_t dmac_filter_count;
 	uint8_t max_mac_entries;
 	bool dmac_filter_enable;
 
@@ -265,6 +266,9 @@ int cnxk_nix_probe(struct rte_pci_driver *pci_drv,
 		   struct rte_pci_device *pci_dev);
 int cnxk_nix_remove(struct rte_pci_device *pci_dev);
 int cnxk_nix_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu);
+int cnxk_nix_mc_addr_list_configure(struct rte_eth_dev *eth_dev,
+				    struct rte_ether_addr *mc_addr_set,
+				    uint32_t nb_mc_addr);
 int cnxk_nix_mac_addr_add(struct rte_eth_dev *eth_dev,
 			  struct rte_ether_addr *addr, uint32_t index,
 			  uint32_t pool);
drivers/net/cnxk/cnxk_ethdev_ops.c +63 -0

78 lines not on this page · raw message

Signature · 1 line
2.8.4
#190 lore raw

PATCH v3 62/62 net/cnxk: add marking and VLAN tagging support

In reply to Nithin Dabilpuram

From: Satheesh Paul <[email protected]>

This patch adds support for mark, flag, VLAN pop and push flow actions.

---
 doc/guides/nics/features/cnxk.ini |   5 ++
 drivers/net/cnxk/cn10k_rte_flow.c |  42 +++++++++
 drivers/net/cnxk/cn10k_rx.c       |  27 +++---
 drivers/net/cnxk/cn10k_rx.h       | 175 ++++++++++++++++++++++++++++++--------
 drivers/net/cnxk/cn10k_rx_mseg.c  |   2 +-
 drivers/net/cnxk/cn10k_rx_vec.c   |   2 +-
 drivers/net/cnxk/cn9k_rte_flow.c  |  42 +++++++++
 drivers/net/cnxk/cn9k_rx.c        |  27 +++---
 drivers/net/cnxk/cn9k_rx.h        | 175 ++++++++++++++++++++++++++++++--------
 drivers/net/cnxk/cn9k_rx_mseg.c   |   2 +-
 drivers/net/cnxk/cn9k_rx_vec.c    |   2 +-
 drivers/net/cnxk/cnxk_ethdev.c    |   1 +
 drivers/net/cnxk/cnxk_ethdev.h    |   3 +-
 drivers/net/cnxk/cnxk_rte_flow.c  |  17 ++++
 14 files changed, 423 insertions(+), 99 deletions(-)
doc/guides/nics/features/cnxk.ini +5 -0
index c686ceb..337ad24 100644
@@ -77,6 +77,11 @@ vxlan_gpe            = Y
 count                = Y
 drop                 = Y
 flag                 = Y
+mark                 = Y
+of_pop_vlan          = Y
+of_push_vlan         = Y
+of_set_vlan_pcp      = Y
+of_set_vlan_vid      = Y
 pf                   = Y
 port_id              = Y
 queue                = Y
drivers/net/cnxk/cn10k_rte_flow.c +42 -0

66 lines not on this page · raw message

drivers/net/cnxk/cn10k_rx.c +14 -13
index c9744e2..5c956c0 100644
@@ -5,7 +5,7 @@
 #include "cn10k_ethdev.h"
 #include "cn10k_rx.h"
 
-#define R(name, f4, f3, f2, f1, f0, flags)				       \
+#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
 	uint16_t __rte_noinline __rte_hot cn10k_nix_recv_pkts_##name(	       \
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
@@ -17,12 +17,13 @@ NIX_RX_FASTPATH_MODES
 
 static inline void
 pick_rx_func(struct rte_eth_dev *eth_dev,
-	     const eth_rx_burst_t rx_burst[2][2][2][2][2])
+	     const eth_rx_burst_t rx_burst[2][2][2][2][2][2])
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
-	/* [TSP] [MARK] [CKSUM] [PTYPE] [RSS] */
+	/* [VLAN] [TSP] [MARK] [CKSUM] [PTYPE] [RSS] */
 	eth_dev->rx_pkt_burst = rx_burst
+		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_VLAN_STRIP_F)]
 		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_TSTAMP_F)]
 		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_MARK_UPDATE_F)]
 		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_CHECKSUM_F)]
@@ -35,25 +36,25 @@ cn10k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
-	const eth_rx_burst_t nix_eth_rx_burst[2][2][2][2][2] = {
-#define R(name, f4, f3, f2, f1, f0, flags)				       \
-	[f4][f3][f2][f1][f0] = cn10k_nix_recv_pkts_##name,
+	const eth_rx_burst_t nix_eth_rx_burst[2][2][2][2][2][2] = {
+#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
+	[f5][f4][f3][f2][f1][f0] = cn10k_nix_recv_pkts_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const eth_rx_burst_t nix_eth_rx_burst_mseg[2][2][2][2][2] = {
-#define R(name, f4, f3, f2, f1, f0, flags)				       \
-	[f4][f3][f2][f1][f0] = cn10k_nix_recv_pkts_mseg_##name,
+	const eth_rx_burst_t nix_eth_rx_burst_mseg[2][2][2][2][2][2] = {
+#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
+	[f5][f4][f3][f2][f1][f0] = cn10k_nix_recv_pkts_mseg_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const eth_rx_burst_t nix_eth_rx_vec_burst[2][2][2][2][2] = {
-#define R(name, f4, f3, f2, f1, f0, flags)				       \
-	[f4][f3][f2][f1][f0] = cn10k_nix_recv_pkts_vec_##name,
+	const eth_rx_burst_t nix_eth_rx_vec_burst[2][2][2][2][2][2] = {
+#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
+	[f5][f4][f3][f2][f1][f0] = cn10k_nix_recv_pkts_vec_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
@@ -73,6 +74,6 @@ cn10k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
 	/* Copy multi seg version with no offload for tear down sequence */
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
 		dev->rx_pkt_burst_no_offload =
-			nix_eth_rx_burst_mseg[0][0][0][0][0];
+			nix_eth_rx_burst_mseg[0][0][0][0][0][0];
 	rte_mb();
 }
drivers/net/cnxk/cn10k_rx.h +141 -34

208 lines not on this page · raw message

drivers/net/cnxk/cn10k_rx_mseg.c +1 -1
index b67d21f..3340771 100644
@@ -5,7 +5,7 @@
 #include "cn10k_ethdev.h"
 #include "cn10k_rx.h"
 
-#define R(name, f4, f3, f2, f1, f0, flags)                                     \
+#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
 	uint16_t __rte_noinline __rte_hot cn10k_nix_recv_pkts_mseg_##name(     \
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
drivers/net/cnxk/cn10k_rx_vec.c +1 -1
index 1330235..65ffa97 100644
@@ -5,7 +5,7 @@
 #include "cn10k_ethdev.h"
 #include "cn10k_rx.h"
 
-#define R(name, f4, f3, f2, f1, f0, flags)				       \
+#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
 	uint16_t __rte_noinline __rte_hot				       \
 		cn10k_nix_recv_pkts_vec_##name(void *rx_queue,                 \
 					       struct rte_mbuf **rx_pkts,      \
drivers/net/cnxk/cn9k_rte_flow.c +42 -0

66 lines not on this page · raw message

drivers/net/cnxk/cn9k_rx.c +14 -13
index a15428d..0acedd0 100644
@@ -5,7 +5,7 @@
 #include "cn9k_ethdev.h"
 #include "cn9k_rx.h"
 
-#define R(name, f4, f3, f2, f1, f0, flags)				       \
+#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
 	uint16_t __rte_noinline __rte_hot cn9k_nix_recv_pkts_##name(	       \
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
@@ -17,12 +17,13 @@ NIX_RX_FASTPATH_MODES
 
 static inline void
 pick_rx_func(struct rte_eth_dev *eth_dev,
-	     const eth_rx_burst_t rx_burst[2][2][2][2][2])
+	     const eth_rx_burst_t rx_burst[2][2][2][2][2][2])
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
-	/* [TSP] [MARK] [CKSUM] [PTYPE] [RSS] */
+	/* [TSP] [MARK] [VLAN] [CKSUM] [PTYPE] [RSS] */
 	eth_dev->rx_pkt_burst = rx_burst
+		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_VLAN_STRIP_F)]
 		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_TSTAMP_F)]
 		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_MARK_UPDATE_F)]
 		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_CHECKSUM_F)]
@@ -35,25 +36,25 @@ cn9k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
-	const eth_rx_burst_t nix_eth_rx_burst[2][2][2][2][2] = {
-#define R(name, f4, f3, f2, f1, f0, flags)				       \
-	[f4][f3][f2][f1][f0] = cn9k_nix_recv_pkts_##name,
+	const eth_rx_burst_t nix_eth_rx_burst[2][2][2][2][2][2] = {
+#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
+	[f5][f4][f3][f2][f1][f0] = cn9k_nix_recv_pkts_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const eth_rx_burst_t nix_eth_rx_burst_mseg[2][2][2][2][2] = {
-#define R(name, f4, f3, f2, f1, f0, flags)				       \
-	[f4][f3][f2][f1][f0] = cn9k_nix_recv_pkts_mseg_##name,
+	const eth_rx_burst_t nix_eth_rx_burst_mseg[2][2][2][2][2][2] = {
+#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
+	[f5][f4][f3][f2][f1][f0] = cn9k_nix_recv_pkts_mseg_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const eth_rx_burst_t nix_eth_rx_vec_burst[2][2][2][2][2] = {
-#define R(name, f4, f3, f2, f1, f0, flags)				       \
-	[f4][f3][f2][f1][f0] = cn9k_nix_recv_pkts_vec_##name,
+	const eth_rx_burst_t nix_eth_rx_vec_burst[2][2][2][2][2][2] = {
+#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
+	[f5][f4][f3][f2][f1][f0] = cn9k_nix_recv_pkts_vec_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
@@ -73,6 +74,6 @@ cn9k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
 	/* Copy multi seg version with no offload for tear down sequence */
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
 		dev->rx_pkt_burst_no_offload =
-			nix_eth_rx_burst_mseg[0][0][0][0][0];
+			nix_eth_rx_burst_mseg[0][0][0][0][0][0];
 	rte_mb();
 }
drivers/net/cnxk/cn9k_rx.h +141 -34

208 lines not on this page · raw message

drivers/net/cnxk/cn9k_rx_mseg.c +1 -1
index 3b26962..d7e19b1 100644
@@ -5,7 +5,7 @@
 #include "cn9k_ethdev.h"
 #include "cn9k_rx.h"
 
-#define R(name, f4, f3, f2, f1, f0, flags)                                     \
+#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
 	uint16_t __rte_noinline __rte_hot cn9k_nix_recv_pkts_mseg_##name(      \
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
drivers/net/cnxk/cn9k_rx_vec.c +1 -1
index b19c7f3..e61c222 100644
@@ -5,7 +5,7 @@
 #include "cn9k_ethdev.h"
 #include "cn9k_rx.h"
 
-#define R(name, f4, f3, f2, f1, f0, flags)				       \
+#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
 	uint16_t __rte_noinline __rte_hot cn9k_nix_recv_pkts_vec_##name(       \
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
drivers/net/cnxk/cnxk_ethdev.c +1 -0
index 1edea35..93d7ec7 100644
@@ -1287,6 +1287,7 @@ cnxk_eth_dev_init(struct rte_eth_dev *eth_dev)
 
 	/* Initialize base roc nix */
 	nix->pci_dev = pci_dev;
+	nix->hw_vlan_ins = true;
 	rc = roc_nix_dev_init(nix);
 	if (rc) {
 		plt_err("Failed to initialize roc nix rc=%d", rc);
drivers/net/cnxk/cnxk_ethdev.h +2 -1
index c07e988..67b1f42 100644
@@ -76,7 +76,8 @@
 	(DEV_RX_OFFLOAD_CHECKSUM | DEV_RX_OFFLOAD_SCTP_CKSUM |                 \
 	 DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM | DEV_RX_OFFLOAD_SCATTER |            \
 	 DEV_RX_OFFLOAD_JUMBO_FRAME | DEV_RX_OFFLOAD_OUTER_UDP_CKSUM |         \
-	 DEV_RX_OFFLOAD_RSS_HASH | DEV_RX_OFFLOAD_TIMESTAMP)
+	 DEV_RX_OFFLOAD_RSS_HASH | DEV_RX_OFFLOAD_TIMESTAMP |                  \
+	 DEV_RX_OFFLOAD_VLAN_STRIP)
 
 #define RSS_IPV4_ENABLE                                                        \
 	(ETH_RSS_IPV4 | ETH_RSS_FRAG_IPV4 | ETH_RSS_NONFRAG_IPV4_UDP |         \
drivers/net/cnxk/cnxk_rte_flow.c +17 -0
index c61618a..213125b 100644
@@ -178,6 +178,23 @@ cnxk_map_actions(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,
 		case RTE_FLOW_ACTION_TYPE_SECURITY:
 			in_actions[i].type = ROC_NPC_ACTION_TYPE_SEC;
 			break;
+		case RTE_FLOW_ACTION_TYPE_OF_POP_VLAN:
+			in_actions[i].type = ROC_NPC_ACTION_TYPE_VLAN_STRIP;
+			break;
+		case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID:
+			in_actions[i].type = ROC_NPC_ACTION_TYPE_VLAN_INSERT;
+			in_actions[i].conf = actions->conf;
+			break;
+		case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN:
+			in_actions[i].type =
+				ROC_NPC_ACTION_TYPE_VLAN_ETHTYPE_INSERT;
+			in_actions[i].conf = actions->conf;
+			break;
+		case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP:
+			in_actions[i].type =
+				ROC_NPC_ACTION_TYPE_VLAN_PCP_INSERT;
+			in_actions[i].conf = actions->conf;
+			break;
 		default:
 			plt_npc_dbg("Action is not supported = %d",
 				    actions->type);
Signature · 1 line
2.8.4
#191 lore raw
In reply to Nithin Dabilpuram
Quoted 4 lines · Nithin Dabilpuram

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

Looks good to me in general, a couple of final comments

1) Build issue with RHEL 7 (gcc 4.8)
http://mails.dpdk.org/archives/test-report/2021-June/199620.html

2) Shorten git subject messages( for explicit "add" etc) Example:

From:
net/cnxk: add DMAC filter support

to:
net/cnxk: support DMAC filter

3) Add Cc: [email protected] for following patch common/cnxk: fix batch alloc completion poll logic

4) Fix following camel case

CHECK:CAMELCASE: Avoid CamelCase: <roc_model_is_cn96_Ax> #92: FILE: drivers/net/cnxk/cnxk_ethdev.c:122:
+ if (roc_model_is_cn96_Ax() &&

5) Replace INTERNAL in drivers/net/cnxk/version.map

6) Add [rte_flow items] and [rte_flow actions] in
doc/guides/nics/features/cnxk_vec.ini and
doc/guides/nics/features/cnxk_vf.ini

#192 lore raw

v4 cover Marvell CNXK Ethdev Driver

In reply to Nithin Dabilpuram

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

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

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

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

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

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

Satheesh Paul (6):
common/cnxk: add support to dump flow entries common/cnxk: support for mark and flag flow actions common/cnxk: support for VLAN push and pop flow actions net/cnxk: add flow ops get operation
net/cnxk: support for RSS in rte flow net/cnxk: support marking and VLAN tagging

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

--

v4:
- Fixed build issue with gcc 4.8
- Shortened subject lines of few commits
- Removed camel case for model API
- Updated rte_flow features in cnxk_vec.ini and cnxk_vf.ini
- Added CC stable to "fix batch alloc.." patch
- Squashed cn98xx flow create related common patch to VLAN push and pop flow actions patch.
- Changed INTERNAL to DPDK_21 in version.map

v3:
- Updated release notes
- Removed RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS flag and add support for queue stats in xstats
- Fixed issue with LSO format indices
- Removed mbox sync changes patch from this series
- Fixed documentation issues
- Removed repetitive code in fast path SIMD
- Optimize cn10k LMTST logic
- Make rte_flow_create implementation specific
to handle VLAN Stripping and MARK actions/offloads
- Use rte_atomic_thread_fence() instead of rte_rmb()
- Handle other comments from Jerin.
- Merged rte flow dump API patch to flow ops get patch
- Added marking and vlan tagging support.
- Fixed some checkpatch and git check log issues.

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

 MAINTAINERS                             |    5 +-
 doc/guides/nics/cnxk.rst                |  232 +++++
 doc/guides/nics/features/cnxk.ini       |   90 ++
 doc/guides/nics/features/cnxk_vec.ini   |   86 ++
 doc/guides/nics/features/cnxk_vf.ini    |   82 ++
 doc/guides/nics/index.rst               |    1 +
 doc/guides/platform/cnxk.rst            |    3 +
 doc/guides/rel_notes/release_21_08.rst  |    5 +
 drivers/common/cnxk/hw/npc.h            |    2 +
 drivers/common/cnxk/meson.build         |    1 +
 drivers/common/cnxk/roc_api.h           |    2 +
 drivers/common/cnxk/roc_dev.c           |   98 +-
 drivers/common/cnxk/roc_dev_priv.h      |    1 +
 drivers/common/cnxk/roc_mbox.h          |    3 +
 drivers/common/cnxk/roc_model.h         |   12 +-
 drivers/common/cnxk/roc_nix.h           |   39 +-
 drivers/common/cnxk/roc_nix_queue.c     |   52 +
 drivers/common/cnxk/roc_nix_rss.c       |   51 +-
 drivers/common/cnxk/roc_nix_tm_utils.c  |   86 +-
 drivers/common/cnxk/roc_npa.c           |   10 +-
 drivers/common/cnxk/roc_npa.h           |   35 +-
 drivers/common/cnxk/roc_npc.c           |  296 +++++-
 drivers/common/cnxk/roc_npc.h           |   39 +-
 drivers/common/cnxk/roc_npc_mcam.c      |    2 +-
 drivers/common/cnxk/roc_npc_mcam_dump.c |  611 ++++++++++++
 drivers/common/cnxk/roc_npc_priv.h      |    3 +-
 drivers/common/cnxk/roc_npc_utils.c     |    4 +
 drivers/common/cnxk/roc_platform.h      |   13 +
 drivers/common/cnxk/version.map         |    7 +
 drivers/net/cnxk/cn10k_ethdev.c         |  551 +++++++++++
 drivers/net/cnxk/cn10k_ethdev.h         |   41 +
 drivers/net/cnxk/cn10k_rte_flow.c       |   72 ++
 drivers/net/cnxk/cn10k_rte_flow.h       |   17 +
 drivers/net/cnxk/cn10k_rx.c             |   79 ++
 drivers/net/cnxk/cn10k_rx.h             |  653 +++++++++++++
 drivers/net/cnxk/cn10k_rx_mseg.c        |   17 +
 drivers/net/cnxk/cn10k_rx_vec.c         |   22 +
 drivers/net/cnxk/cn10k_tx.c             |   82 ++
 drivers/net/cnxk/cn10k_tx.h             | 1605 +++++++++++++++++++++++++++++++
 drivers/net/cnxk/cn10k_tx_mseg.c        |   25 +
 drivers/net/cnxk/cn10k_tx_vec.c         |   26 +
 drivers/net/cnxk/cn9k_ethdev.c          |  574 +++++++++++
 drivers/net/cnxk/cn9k_ethdev.h          |   39 +
 drivers/net/cnxk/cn9k_rte_flow.c        |   72 ++
 drivers/net/cnxk/cn9k_rte_flow.h        |   17 +
 drivers/net/cnxk/cn9k_rx.c              |   79 ++
 drivers/net/cnxk/cn9k_rx.h              |  655 +++++++++++++
 drivers/net/cnxk/cn9k_rx_mseg.c         |   17 +
 drivers/net/cnxk/cn9k_rx_vec.c          |   20 +
 drivers/net/cnxk/cn9k_tx.c              |   81 ++
 drivers/net/cnxk/cn9k_tx.h              | 1436 +++++++++++++++++++++++++++
 drivers/net/cnxk/cn9k_tx_mseg.c         |   25 +
 drivers/net/cnxk/cn9k_tx_vec.c          |   26 +
 drivers/net/cnxk/cnxk_ethdev.c          | 1540 +++++++++++++++++++++++++++++
 drivers/net/cnxk/cnxk_ethdev.h          |  495 ++++++++++
 drivers/net/cnxk/cnxk_ethdev_devargs.c  |  173 ++++
 drivers/net/cnxk/cnxk_ethdev_ops.c      |  912 ++++++++++++++++++
 drivers/net/cnxk/cnxk_link.c            |  113 +++
 drivers/net/cnxk/cnxk_lookup.c          |  326 +++++++
 drivers/net/cnxk/cnxk_ptp.c             |  287 ++++++
 drivers/net/cnxk/cnxk_rte_flow.c        |  433 +++++++++
 drivers/net/cnxk/cnxk_rte_flow.h        |   27 +
 drivers/net/cnxk/cnxk_stats.c           |  320 ++++++
 drivers/net/cnxk/meson.build            |   48 +
 drivers/net/cnxk/version.map            |    3 +
 drivers/net/meson.build                 |    1 +
 66 files changed, 12678 insertions(+), 102 deletions(-)
 create mode 100644 doc/guides/nics/cnxk.rst
 create mode 100644 doc/guides/nics/features/cnxk.ini
 create mode 100644 doc/guides/nics/features/cnxk_vec.ini
 create mode 100644 doc/guides/nics/features/cnxk_vf.ini
 create mode 100644 drivers/common/cnxk/roc_npc_mcam_dump.c
 create mode 100644 drivers/net/cnxk/cn10k_ethdev.c
 create mode 100644 drivers/net/cnxk/cn10k_ethdev.h
 create mode 100644 drivers/net/cnxk/cn10k_rte_flow.c
 create mode 100644 drivers/net/cnxk/cn10k_rte_flow.h
 create mode 100644 drivers/net/cnxk/cn10k_rx.c
 create mode 100644 drivers/net/cnxk/cn10k_rx.h
 create mode 100644 drivers/net/cnxk/cn10k_rx_mseg.c
 create mode 100644 drivers/net/cnxk/cn10k_rx_vec.c
 create mode 100644 drivers/net/cnxk/cn10k_tx.c
 create mode 100644 drivers/net/cnxk/cn10k_tx.h
 create mode 100644 drivers/net/cnxk/cn10k_tx_mseg.c
 create mode 100644 drivers/net/cnxk/cn10k_tx_vec.c
 create mode 100644 drivers/net/cnxk/cn9k_ethdev.c
 create mode 100644 drivers/net/cnxk/cn9k_ethdev.h
 create mode 100644 drivers/net/cnxk/cn9k_rte_flow.c
 create mode 100644 drivers/net/cnxk/cn9k_rte_flow.h
 create mode 100644 drivers/net/cnxk/cn9k_rx.c
 create mode 100644 drivers/net/cnxk/cn9k_rx.h
 create mode 100644 drivers/net/cnxk/cn9k_rx_mseg.c
 create mode 100644 drivers/net/cnxk/cn9k_rx_vec.c
 create mode 100644 drivers/net/cnxk/cn9k_tx.c
 create mode 100644 drivers/net/cnxk/cn9k_tx.h
 create mode 100644 drivers/net/cnxk/cn9k_tx_mseg.c
 create mode 100644 drivers/net/cnxk/cn9k_tx_vec.c
 create mode 100644 drivers/net/cnxk/cnxk_ethdev.c
 create mode 100644 drivers/net/cnxk/cnxk_ethdev.h
 create mode 100644 drivers/net/cnxk/cnxk_ethdev_devargs.c
 create mode 100644 drivers/net/cnxk/cnxk_ethdev_ops.c
 create mode 100644 drivers/net/cnxk/cnxk_link.c
 create mode 100644 drivers/net/cnxk/cnxk_lookup.c
 create mode 100644 drivers/net/cnxk/cnxk_ptp.c
 create mode 100644 drivers/net/cnxk/cnxk_rte_flow.c
 create mode 100644 drivers/net/cnxk/cnxk_rte_flow.h
 create mode 100644 drivers/net/cnxk/cnxk_stats.c
 create mode 100644 drivers/net/cnxk/meson.build
 create mode 100644 drivers/net/cnxk/version.map
Signature · 1 line
2.8.4
#193 lore raw

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

From: Satha Rao <[email protected]>

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

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

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

82 lines not on this page · raw message

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

101 lines not on this page · raw message

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

PATCH v4 2/62 common/cnxk: fix batch alloc completion poll logic

In reply to Nithin Dabilpuram

From: Jerin Jacob <[email protected]>

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

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

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

PATCH v4 3/62 common/cnxk: add support to dump flow entries

In reply to Nithin Dabilpuram

From: Satheesh Paul <[email protected]>

Add NPC support API to dump created flow entries.

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

611 lines not on this page · raw message

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

PATCH v4 4/62 common/cnxk: support for mark and flag flow actions

In reply to Nithin Dabilpuram

From: Satheesh Paul <[email protected]>

Add roc API to get mark action.

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

PATCH v4 5/62 common/cnxk: allocate lmt region in userspace

In reply to Nithin Dabilpuram

From: Harman Kalra <[email protected]>

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

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

150 lines not on this page · raw message

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

PATCH v4 6/62 common/cnxk: add provision to enable RED on RQ

In reply to Nithin Dabilpuram

From: Satha Rao <[email protected]>

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

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

74 lines not on this page · raw message

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

PATCH v4 7/62 common/cnxk: change model API to not use camel case

In reply to Nithin Dabilpuram

Change model check API's to not use Camel case in function names.

---
 drivers/common/cnxk/roc_model.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/common/cnxk/roc_model.h +3 -3
index fb774ac..5aaad53 100644
@@ -88,19 +88,19 @@ roc_model_is_cn10k(void)
 }
 
 static inline uint64_t
-roc_model_is_cn96_A0(void)
+roc_model_is_cn96_a0(void)
 {
 	return roc_model->flag & ROC_MODEL_CN96xx_A0;
 }
 
 static inline uint64_t
-roc_model_is_cn96_Ax(void)
+roc_model_is_cn96_ax(void)
 {
 	return (roc_model->flag & ROC_MODEL_CN96xx_Ax);
 }
 
 static inline uint64_t
-roc_model_is_cn95_A0(void)
+roc_model_is_cn95_a0(void)
 {
 	return roc_model->flag & ROC_MODEL_CNF95xx_A0;
 }
Signature · 1 line
2.8.4
#200 lore raw

PATCH v4 8/62 common/cnxk: support for VLAN push and pop flow actions

In reply to Nithin Dabilpuram

From: Satheesh Paul <[email protected]>

Add roc API to configure VLAN tag addition and removal.

This patch also adds 98xx support for increased MCAM entries for rte flow.

---
 drivers/common/cnxk/roc_model.h    |   6 +
 drivers/common/cnxk/roc_npc.c      | 257 ++++++++++++++++++++++++++++++++++---
 drivers/common/cnxk/roc_npc.h      |  24 ++++
 drivers/common/cnxk/roc_npc_mcam.c |   2 +-
 drivers/common/cnxk/roc_npc_priv.h |   1 +
 drivers/common/cnxk/version.map    |   2 +
 6 files changed, 276 insertions(+), 16 deletions(-)
drivers/common/cnxk/roc_model.h +6 -0
index 5aaad53..c1d11b7 100644
@@ -88,6 +88,12 @@ roc_model_is_cn10k(void)
 }
 
 static inline uint64_t
+roc_model_is_cn98xx(void)
+{
+	return (roc_model->flag & ROC_MODEL_CN98xx_A0);
+}
+
+static inline uint64_t
 roc_model_is_cn96_a0(void)
 {
 	return roc_model->flag & ROC_MODEL_CN96xx_A0;
drivers/common/cnxk/roc_npc.c +242 -15

327 lines not on this page · raw message

drivers/common/cnxk/roc_npc.h +24 -0
index cf6f732..2c0a536 100644
@@ -62,6 +62,10 @@ enum roc_npc_action_type {
 	ROC_NPC_ACTION_TYPE_COUNT = (1 << 9),
 	ROC_NPC_ACTION_TYPE_PF = (1 << 10),
 	ROC_NPC_ACTION_TYPE_VF = (1 << 11),
+	ROC_NPC_ACTION_TYPE_VLAN_STRIP = (1 << 12),
+	ROC_NPC_ACTION_TYPE_VLAN_INSERT = (1 << 13),
+	ROC_NPC_ACTION_TYPE_VLAN_ETHTYPE_INSERT = (1 << 14),
+	ROC_NPC_ACTION_TYPE_VLAN_PCP_INSERT = (1 << 15),
 };
 
 struct roc_npc_action {
@@ -83,6 +87,18 @@ struct roc_npc_action_queue {
 	uint16_t index; /**< Queue index to use. */
 };
 
+struct roc_npc_action_of_push_vlan {
+	uint16_t ethertype; /**< EtherType. */
+};
+
+struct roc_npc_action_of_set_vlan_vid {
+	uint16_t vlan_vid; /**< VLAN id. */
+};
+
+struct roc_npc_action_of_set_vlan_pcp {
+	uint8_t vlan_pcp; /**< VLAN priority. */
+};
+
 struct roc_npc_attr {
 	uint32_t priority;	/**< Rule priority level within group. */
 	uint32_t ingress : 1;	/**< Rule applies to ingress traffic. */
@@ -107,6 +123,7 @@ struct roc_npc_flow {
 	uint64_t mcam_mask[ROC_NPC_MAX_MCAM_WIDTH_DWORDS];
 	uint64_t npc_action;
 	uint64_t vtag_action;
+	bool vtag_insert_enabled;
 #define ROC_NPC_MAX_FLOW_PATTERNS 32
 	struct roc_npc_flow_dump_data dump_data[ROC_NPC_MAX_FLOW_PATTERNS];
 	uint16_t num_patterns;
@@ -138,6 +155,10 @@ enum roc_npc_intf {
 	ROC_NPC_INTF_MAX = 2,
 };
 
+enum flow_vtag_cfg_dir { VTAG_TX, VTAG_RX };
+#define ROC_ETHER_TYPE_VLAN 0x8100 /**< IEEE 802.1Q VLAN tagging. */
+#define ROC_ETHER_TYPE_QINQ 0x88A8 /**< IEEE 802.1ad QinQ tagging. */
+
 struct roc_npc {
 	struct roc_nix *roc_nix;
 	uint8_t switch_header_type;
@@ -199,4 +220,7 @@ void __roc_api roc_npc_flow_mcam_dump(FILE *file, struct roc_npc *roc_npc,
 int __roc_api roc_npc_mark_actions_get(struct roc_npc *roc_npc);
 int __roc_api roc_npc_mark_actions_sub_return(struct roc_npc *roc_npc,
 					      uint32_t count);
+int __roc_api roc_npc_vtag_actions_get(struct roc_npc *roc_npc);
+int __roc_api roc_npc_vtag_actions_sub_return(struct roc_npc *roc_npc,
+					      uint32_t count);
 #endif /* _ROC_NPC_H_ */
drivers/common/cnxk/roc_npc_mcam.c +1 -1
index ff0676d..8ccaaad 100644
@@ -546,7 +546,7 @@ npc_mcam_alloc_and_write(struct npc *npc, struct roc_npc_flow *flow,
 	 *
 	 * Second approach is used now.
 	 */
-	req->entry_data.vtag_action = 0ULL;
+	req->entry_data.vtag_action = flow->vtag_action;
 
 	for (idx = 0; idx < ROC_NPC_MAX_MCAM_WIDTH_DWORDS; idx++) {
 		req->entry_data.kw[idx] = flow->mcam_data[idx];
drivers/common/cnxk/roc_npc_priv.h +1 -0
index 961583b..484c3ae 100644
@@ -350,6 +350,7 @@ struct npc {
 	uint16_t flow_max_priority;		/* Max priority for flow */
 	uint16_t switch_header_type; /* Suppprted switch header type */
 	uint32_t mark_actions;	     /* Number of mark actions */
+	uint32_t vtag_actions;	     /* vtag insert/strip actions */
 	uint16_t pf_func;	     /* pf_func of device */
 	npc_dxcfg_t prx_dxcfg;	     /* intf, lid, lt, extract */
 	npc_fxcfg_t prx_fxcfg;	     /* Flag extract */
drivers/common/cnxk/version.map +2 -0
index 554459b..8a5c839 100644
@@ -167,6 +167,8 @@ INTERNAL {
 	roc_npc_init;
 	roc_npc_mark_actions_get;
 	roc_npc_mark_actions_sub_return;
+	roc_npc_vtag_actions_get;
+	roc_npc_vtag_actions_sub_return;
 	roc_npc_mcam_alloc_entries;
 	roc_npc_mcam_alloc_entry;
 	roc_npc_mcam_clear_counter;
Signature · 1 line
2.8.4
#201 lore raw

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

In reply to Nithin Dabilpuram

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

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

218 lines not on this page · raw message

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

57 lines not on this page · raw message

drivers/net/cnxk/meson.build new file +14 -0
new file mode 100644
index 0000000..7dd4bca
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(C) 2021 Marvell.
+#
+
+if not dpdk_conf.get('RTE_ARCH_64')
+	build = false
+	reason = 'only supported on 64-bit'
+	subdir_done()
+endif
+
+sources = files('cnxk_ethdev.c')
+
+deps += ['bus_pci', 'cryptodev', 'eventdev', 'security']
+deps += ['common_cnxk', 'mempool_cnxk']
drivers/net/cnxk/version.map new file +3 -0
new file mode 100644
index 0000000..4a76d1d
@@ -0,0 +1,3 @@
+DPDK_21 {
+	local: *;
+};
drivers/net/meson.build +1 -0
index c8b5ce2..5b066fd 100644
@@ -12,6 +12,7 @@ drivers = [
         'bnx2x',
         'bnxt',
         'bonding',
+	'cnxk',
         'cxgbe',
         'dpaa',
         'dpaa2',
Signature · 1 line
2.8.4
#202 lore raw

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

23/06/2021 06:46, Nithin Dabilpuram:

drivers/net/meson.build drivers = [ · line 18

Quoted 10 lines
drivers/net/meson.build +1 -0
@@ -12,6 +12,7 @@ drivers = [
         'bnx2x',
         'bnxt',
         'bonding',
+       'cnxk',
         'cxgbe',
         'dpaa',
         'dpaa2',

Wrong indent spotted with devtools/check-meson.py
Will fix while applying if no serious issue.

#203 lore raw

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

In reply to Nithin Dabilpuram

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

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

82 lines not on this page · raw message

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

54 lines not on this page · raw message

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

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

In reply to Nithin Dabilpuram

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

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

166 lines not on this page · raw message

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

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

In reply to Nithin Dabilpuram

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

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

71 lines not on this page · raw message

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

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

In reply to Nithin Dabilpuram

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

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

57 lines not on this page · raw message

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

592 lines not on this page · raw message

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

118 lines not on this page · raw message

Signature · 1 line
2.8.4
#207 lore raw

PATCH v4 14/62 net/cnxk: support link status update

In reply to Nithin Dabilpuram

Add link status update callback to get current
link status.

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

102 lines not on this page · raw message

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

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

In reply to Nithin Dabilpuram

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

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

56 lines not on this page · raw message

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

56 lines not on this page · raw message

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

184 lines not on this page · raw message

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

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

In reply to Nithin Dabilpuram

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

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

84 lines not on this page · raw message

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

82 lines not on this page · raw message

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

110 lines not on this page · raw message

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

PATCH v4 17/62 net/cnxk: support packet type

In reply to Nithin Dabilpuram

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

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

326 lines not on this page · raw message

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

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

In reply to Nithin Dabilpuram

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

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

104 lines not on this page · raw message

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

PATCH v4 19/62 net/cnxk: add Rx burst for cn9k

In reply to Nithin Dabilpuram

From: Jerin Jacob <[email protected]>

Add Rx burst scalar version for CN9K.

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

46 lines not on this page · raw message

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

243 lines not on this page · raw message

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

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

In reply to Nithin Dabilpuram

Add Rx burst multi-segmented version for CN9K.

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

79 lines not on this page · raw message

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

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

In reply to Nithin Dabilpuram

From: Jerin Jacob <[email protected]>

Add Rx burst vector version for CN9K.

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

239 lines not on this page · raw message

drivers/net/cnxk/cn9k_rx_vec.c new file +17 -0
new file mode 100644
index 0000000..997177f
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+
+#include "cn9k_ethdev.h"
+#include "cn9k_rx.h"
+
+#define R(name, f3, f2, f1, f0, flags)                                         \
+	uint16_t __rte_noinline __rte_hot cn9k_nix_recv_pkts_vec_##name(       \
+		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
+	{                                                                      \
+		return cn9k_nix_recv_pkts_vector(rx_queue, rx_pkts, pkts,      \
+						 (flags));                     \
+	}
+
+NIX_RX_FASTPATH_MODES
+#undef R
drivers/net/cnxk/meson.build +10 -1
index 5bfab21..9aba7d4 100644
@@ -17,9 +17,18 @@ sources = files('cnxk_ethdev.c',
 # CN9K
 sources += files('cn9k_ethdev.c',
 		 'cn9k_rx.c',
-		 'cn9k_rx_mseg.c')
+		 'cn9k_rx_mseg.c',
+		 'cn9k_rx_vec.c')
 # CN10K
 sources += files('cn10k_ethdev.c')
 
 deps += ['bus_pci', 'cryptodev', 'eventdev', 'security']
 deps += ['common_cnxk', 'mempool_cnxk']
+
+# Allow implicit vector conversions
+extra_flags = ['-flax-vector-conversions']
+foreach flag: extra_flags
+	if cc.has_argument(flag)
+		cflags += flag
+	endif
+endforeach
Signature · 1 line
2.8.4
#215 lore raw

PATCH v4 22/62 net/cnxk: add Tx burst for cn9k

In reply to Nithin Dabilpuram

From: Jerin Jacob <[email protected]>

Add Tx burst scalar version for CN9K.

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

53 lines not on this page · raw message

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

429 lines not on this page · raw message

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

81 lines not on this page · raw message

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

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

In reply to Nithin Dabilpuram

Add Tx burst multi-segment version for CN9K.

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

168 lines not on this page · raw message

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

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

In reply to Nithin Dabilpuram

Add Tx burst vector version for CN9K.

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

761 lines not on this page · raw message

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

PATCH v4 25/62 net/cnxk: add Rx burst for cn10k

In reply to Nithin Dabilpuram

From: Jerin Jacob <[email protected]>

Add Rx burst support for CN10K SoC.

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

45 lines not on this page · raw message

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

242 lines not on this page · raw message

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

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

In reply to Nithin Dabilpuram

Add Rx burst multi-segment version for CN10K.

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

75 lines not on this page · raw message

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

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

In reply to Nithin Dabilpuram

From: Jerin Jacob <[email protected]>

Add Rx burst vector version for CN10K.

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

240 lines not on this page · raw message

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

PATCH v4 28/62 net/cnxk: add Tx burst for cn10k

In reply to Nithin Dabilpuram

From: Jerin Jacob <[email protected]>

Add Tx burst scalar version for CN10K.

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

54 lines not on this page · raw message

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

501 lines not on this page · raw message

drivers/net/cnxk/meson.build +4 -3
index 6748e9c..b1ba824 100644
@@ -26,13 +26,14 @@ sources += files('cn9k_ethdev.c',
 sources += files('cn10k_ethdev.c',
 		 'cn10k_rx.c',
 		 'cn10k_rx_mseg.c',
-		 'cn10k_rx_vec.c')
+		 'cn10k_rx_vec.c',
+		 'cn10k_tx.c')
 
 deps += ['bus_pci', 'cryptodev', 'eventdev', 'security']
 deps += ['common_cnxk', 'mempool_cnxk']
 
-# Allow implicit vector conversions
-extra_flags = ['-flax-vector-conversions']
+# Allow implicit vector conversions and strict aliasing warning
+extra_flags = ['-flax-vector-conversions', '-Wno-strict-aliasing']
 foreach flag: extra_flags
 	if cc.has_argument(flag)
 		cflags += flag
Signature · 1 line
2.8.4
#222 lore raw

PATCH v4 29/62 net/cnxk: add Tx multi-segment version for cn10k

In reply to Nithin Dabilpuram

Add Tx burst multi-segment version for CN10K.

---
 drivers/net/cnxk/cn10k_tx.c      |  18 ++++-
 drivers/net/cnxk/cn10k_tx.h      | 171 +++++++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cn10k_tx_mseg.c |  25 ++++++
 drivers/net/cnxk/meson.build     |   3 +-
 4 files changed, 215 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/cnxk/cn10k_tx_mseg.c
drivers/net/cnxk/cn10k_tx.c +17 -1
index 13c605f..9803002 100644
@@ -40,6 +40,8 @@ pick_tx_func(struct rte_eth_dev *eth_dev,
 void
 cn10k_eth_set_tx_function(struct rte_eth_dev *eth_dev)
 {
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+
 	const eth_tx_burst_t nix_eth_tx_burst[2][2][2][2][2] = {
 #define T(name, f4, f3, f2, f1, f0, sz, flags)                         \
 	[f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_##name,
@@ -48,7 +50,21 @@ cn10k_eth_set_tx_function(struct rte_eth_dev *eth_dev)
 #undef T
 	};
 
-	pick_tx_func(eth_dev, nix_eth_tx_burst);
+	const eth_tx_burst_t nix_eth_tx_burst_mseg[2][2][2][2][2] = {
+#define T(name, f4, f3, f2, f1, f0, sz, flags)				\
+	[f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_mseg_##name,
+
+		NIX_TX_FASTPATH_MODES
+#undef T
+	};
+
+	if (dev->scalar_ena ||
+	    (dev->tx_offload_flags &
+	     (NIX_TX_OFFLOAD_VLAN_QINQ_F | NIX_TX_OFFLOAD_TSO_F)))
+		pick_tx_func(eth_dev, nix_eth_tx_burst);
+
+	if (dev->tx_offloads & DEV_TX_OFFLOAD_MULTI_SEGS)
+		pick_tx_func(eth_dev, nix_eth_tx_burst_mseg);
 
 	rte_mb();
 }
drivers/net/cnxk/cn10k_tx.h +171 -0

189 lines not on this page · raw message

drivers/net/cnxk/cn10k_tx_mseg.c new file +25 -0
new file mode 100644
index 0000000..6ae6907
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+
+#include "cn10k_ethdev.h"
+#include "cn10k_tx.h"
+
+#define T(name, f4, f3, f2, f1, f0, sz, flags)				       \
+	uint16_t __rte_noinline __rte_hot				       \
+		cn10k_nix_xmit_pkts_mseg_##name(void *tx_queue,                \
+						struct rte_mbuf **tx_pkts,     \
+						uint16_t pkts)                 \
+	{                                                                      \
+		uint64_t cmd[(sz)];                                            \
+									       \
+		/* For TSO inner checksum is a must */                         \
+		if (((flags) & NIX_TX_OFFLOAD_TSO_F) &&			       \
+		    !((flags) & NIX_TX_OFFLOAD_L3_L4_CSUM_F))		       \
+			return 0;                                              \
+		return cn10k_nix_xmit_pkts_mseg(tx_queue, tx_pkts, pkts, cmd,  \
+						(flags) | NIX_TX_MULTI_SEG_F); \
+	}
+
+NIX_TX_FASTPATH_MODES
+#undef T
drivers/net/cnxk/meson.build +2 -1
index b1ba824..21e5676 100644
@@ -27,7 +27,8 @@ sources += files('cn10k_ethdev.c',
 		 'cn10k_rx.c',
 		 'cn10k_rx_mseg.c',
 		 'cn10k_rx_vec.c',
-		 'cn10k_tx.c')
+		 'cn10k_tx.c',
+		 'cn10k_tx_mseg.c')
 
 deps += ['bus_pci', 'cryptodev', 'eventdev', 'security']
 deps += ['common_cnxk', 'mempool_cnxk']
Signature · 1 line
2.8.4
#223 lore raw

PATCH v4 30/62 net/cnxk: add Tx vector version for cn10k

In reply to Nithin Dabilpuram

Add Tx burst vector version for CN10K.

---
 drivers/net/cnxk/cn10k_tx.c     |  10 +
 drivers/net/cnxk/cn10k_tx.h     | 815 ++++++++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cn10k_tx_vec.c |  25 ++
 drivers/net/cnxk/meson.build    |   3 +-
 4 files changed, 852 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/cnxk/cn10k_tx_vec.c
drivers/net/cnxk/cn10k_tx.c +10 -0
index 9803002..e6eb101 100644
@@ -58,10 +58,20 @@ cn10k_eth_set_tx_function(struct rte_eth_dev *eth_dev)
 #undef T
 	};
 
+	const eth_tx_burst_t nix_eth_tx_vec_burst[2][2][2][2][2] = {
+#define T(name, f4, f3, f2, f1, f0, sz, flags)                         \
+	[f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_vec_##name,
+
+		NIX_TX_FASTPATH_MODES
+#undef T
+	};
+
 	if (dev->scalar_ena ||
 	    (dev->tx_offload_flags &
 	     (NIX_TX_OFFLOAD_VLAN_QINQ_F | NIX_TX_OFFLOAD_TSO_F)))
 		pick_tx_func(eth_dev, nix_eth_tx_burst);
+	else
+		pick_tx_func(eth_dev, nix_eth_tx_vec_burst);
 
 	if (dev->tx_offloads & DEV_TX_OFFLOAD_MULTI_SEGS)
 		pick_tx_func(eth_dev, nix_eth_tx_burst_mseg);
drivers/net/cnxk/cn10k_tx.h +815 -0

851 lines not on this page · raw message

drivers/net/cnxk/cn10k_tx_vec.c new file +25 -0
new file mode 100644
index 0000000..42baeb5
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+
+#include "cn10k_ethdev.h"
+#include "cn10k_tx.h"
+
+#define T(name, f4, f3, f2, f1, f0, sz, flags)				       \
+	uint16_t __rte_noinline __rte_hot				       \
+		cn10k_nix_xmit_pkts_vec_##name(void *tx_queue,                 \
+					       struct rte_mbuf **tx_pkts,      \
+					       uint16_t pkts)                  \
+	{                                                                      \
+		uint64_t cmd[sz];                                              \
+									       \
+		/* VLAN, TSTMP, TSO is not supported by vec */                 \
+		if ((flags) & NIX_TX_OFFLOAD_VLAN_QINQ_F ||		       \
+		    (flags) & NIX_TX_OFFLOAD_TSO_F)			       \
+			return 0;                                              \
+		return cn10k_nix_xmit_pkts_vector(tx_queue, tx_pkts, pkts, cmd,\
+						  (flags));                    \
+	}
+
+NIX_TX_FASTPATH_MODES
+#undef T
drivers/net/cnxk/meson.build +2 -1
index 21e5676..8f32dc7 100644
@@ -28,7 +28,8 @@ sources += files('cn10k_ethdev.c',
 		 'cn10k_rx_mseg.c',
 		 'cn10k_rx_vec.c',
 		 'cn10k_tx.c',
-		 'cn10k_tx_mseg.c')
+		 'cn10k_tx_mseg.c',
+		 'cn10k_tx_vec.c')
 
 deps += ['bus_pci', 'cryptodev', 'eventdev', 'security']
 deps += ['common_cnxk', 'mempool_cnxk']
Signature · 1 line
2.8.4
#224 lore raw

PATCH v4 31/62 net/cnxk: add device start and stop operations

In reply to Nithin Dabilpuram

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

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

160 lines not on this page · raw message

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

163 lines not on this page · raw message

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

102 lines not on this page · raw message

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

PATCH v4 32/62 net/cnxk: add MAC address set ops

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

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

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

PATCH v4 33/62 net/cnxk: add MTU set device operation

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

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

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

69 lines not on this page · raw message

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

86 lines not on this page · raw message

Signature · 1 line
2.8.4
#227 lore raw

PATCH v4 34/62 net/cnxk: add promiscuous mode enable and disable

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

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

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

59 lines not on this page · raw message

Signature · 1 line
2.8.4
#228 lore raw

PATCH v4 35/62 net/cnxk: support DMAC filter

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

DMAC filter support is added for cn9k and cn10k platforms.

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

64 lines not on this page · raw message

Signature · 1 line
2.8.4
#229 lore raw

PATCH v4 36/62 net/cnxk: add all multicast enable/disable ethops

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

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

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

PATCH v4 37/62 net/cnxk: add Rx/Tx burst mode get ops

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

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

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

133 lines not on this page · raw message

Signature · 1 line
2.8.4
#231 lore raw

PATCH v4 38/62 net/cnxk: add flow ctrl set/get ops

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

Patch implements set and get operations for flow control.

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

104 lines not on this page · raw message

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

107 lines not on this page · raw message

Signature · 1 line
2.8.4
#232 lore raw

PATCH v4 39/62 net/cnxk: add link up/down operations

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

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

---
 drivers/net/cnxk/cnxk_ethdev.c     |  4 +++-
 drivers/net/cnxk/cnxk_ethdev.h     |  4 ++++
 drivers/net/cnxk/cnxk_ethdev_ops.c | 47 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 54 insertions(+), 1 deletion(-)
drivers/net/cnxk/cnxk_ethdev.c +3 -1
index abca49b..a18d1d5 100644
@@ -975,7 +975,7 @@ cnxk_nix_configure(struct rte_eth_dev *eth_dev)
 	return rc;
 }
 
-static int
+int
 cnxk_nix_tx_queue_start(struct rte_eth_dev *eth_dev, uint16_t qid)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
@@ -1189,6 +1189,8 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
 	.tx_burst_mode_get = cnxk_nix_tx_burst_mode_get,
 	.flow_ctrl_get = cnxk_nix_flow_ctrl_get,
 	.flow_ctrl_set = cnxk_nix_flow_ctrl_set,
+	.dev_set_link_up = cnxk_nix_set_link_up,
+	.dev_set_link_down = cnxk_nix_set_link_down,
 };
 
 static int
drivers/net/cnxk/cnxk_ethdev.h +4 -0
index e788a42..5e982f9 100644
@@ -251,6 +251,9 @@ int cnxk_nix_flow_ctrl_set(struct rte_eth_dev *eth_dev,
 			   struct rte_eth_fc_conf *fc_conf);
 int cnxk_nix_flow_ctrl_get(struct rte_eth_dev *eth_dev,
 			   struct rte_eth_fc_conf *fc_conf);
+int cnxk_nix_set_link_up(struct rte_eth_dev *eth_dev);
+int cnxk_nix_set_link_down(struct rte_eth_dev *eth_dev);
+
 int cnxk_nix_configure(struct rte_eth_dev *eth_dev);
 int cnxk_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 			    uint16_t nb_desc, uint16_t fp_tx_q_sz,
@@ -259,6 +262,7 @@ int cnxk_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 			    uint16_t nb_desc, uint16_t fp_rx_q_sz,
 			    const struct rte_eth_rxconf *rx_conf,
 			    struct rte_mempool *mp);
+int cnxk_nix_tx_queue_start(struct rte_eth_dev *eth_dev, uint16_t qid);
 int cnxk_nix_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t qid);
 int cnxk_nix_dev_start(struct rte_eth_dev *eth_dev);
 
drivers/net/cnxk/cnxk_ethdev_ops.c +47 -0

50 lines not on this page · raw message

Signature · 1 line
2.8.4
#233 lore raw

PATCH v4 40/62 net/cnxk: add EEPROM module info get operations

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

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

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

PATCH v4 41/62 net/cnxk: add Rx queue interrupt enable/disable ops

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

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

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

PATCH v4 42/62 net/cnxk: add validation API for mempool ops

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

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

---
 drivers/net/cnxk/cnxk_ethdev.c     |  1 +
 drivers/net/cnxk/cnxk_ethdev.h     |  1 +
 drivers/net/cnxk/cnxk_ethdev_ops.c | 11 +++++++++++
 3 files changed, 13 insertions(+)
drivers/net/cnxk/cnxk_ethdev.c +1 -0
index 1ff3afa..77bbab6 100644
@@ -1195,6 +1195,7 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
 	.get_module_eeprom = cnxk_nix_get_module_eeprom,
 	.rx_queue_intr_enable = cnxk_nix_rx_queue_intr_enable,
 	.rx_queue_intr_disable = cnxk_nix_rx_queue_intr_disable,
+	.pool_ops_supported = cnxk_nix_pool_ops_supported,
 };
 
 static int
drivers/net/cnxk/cnxk_ethdev.h +1 -0
index a01b72a..e6dac95 100644
@@ -261,6 +261,7 @@ int cnxk_nix_rx_queue_intr_enable(struct rte_eth_dev *eth_dev,
 				  uint16_t rx_queue_id);
 int cnxk_nix_rx_queue_intr_disable(struct rte_eth_dev *eth_dev,
 				   uint16_t rx_queue_id);
+int cnxk_nix_pool_ops_supported(struct rte_eth_dev *eth_dev, const char *pool);
 
 int cnxk_nix_configure(struct rte_eth_dev *eth_dev);
 int cnxk_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
drivers/net/cnxk/cnxk_ethdev_ops.c +11 -0
index 45683dd..7f46551 100644
@@ -617,3 +617,14 @@ cnxk_nix_rx_queue_intr_disable(struct rte_eth_dev *eth_dev,
 	roc_nix_rx_queue_intr_disable(&dev->nix, rx_queue_id);
 	return 0;
 }
+
+int
+cnxk_nix_pool_ops_supported(struct rte_eth_dev *eth_dev, const char *pool)
+{
+	RTE_SET_USED(eth_dev);
+
+	if (!strcmp(pool, rte_mbuf_platform_mempool_ops()))
+		return 0;
+
+	return -ENOTSUP;
+}
Signature · 1 line
2.8.4
#236 lore raw

PATCH v4 43/62 net/cnxk: add port/queue stats

In reply to Nithin Dabilpuram

From: Satha Rao <[email protected]>

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

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

85 lines not on this page · raw message

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

PATCH v4 44/62 net/cnxk: add xstats apis

In reply to Nithin Dabilpuram

From: Satha Rao <[email protected]>

Initial implementation of xstats operations.

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

244 lines not on this page · raw message

Signature · 1 line
2.8.4
#238 lore raw

PATCH v4 45/62 net/cnxk: add rxq/txq info get operations

In reply to Nithin Dabilpuram

From: Satha Rao <[email protected]>

Initial apis to get default queue information.

---
 drivers/net/cnxk/cnxk_ethdev.c     |  2 ++
 drivers/net/cnxk/cnxk_ethdev.h     |  4 ++++
 drivers/net/cnxk/cnxk_ethdev_ops.c | 30 ++++++++++++++++++++++++++++++
 3 files changed, 36 insertions(+)
drivers/net/cnxk/cnxk_ethdev.c +2 -0
index 071c293..81cd04e 100644
@@ -1204,6 +1204,8 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
 	.xstats_reset = cnxk_nix_xstats_reset,
 	.xstats_get_by_id = cnxk_nix_xstats_get_by_id,
 	.xstats_get_names_by_id = cnxk_nix_xstats_get_names_by_id,
+	.rxq_info_get = cnxk_nix_rxq_info_get,
+	.txq_info_get = cnxk_nix_txq_info_get,
 };
 
 static int
drivers/net/cnxk/cnxk_ethdev.h +4 -0
index 5a0dc13..32977eb 100644
@@ -305,6 +305,10 @@ int cnxk_nix_xstats_get_names_by_id(struct rte_eth_dev *eth_dev,
 int cnxk_nix_xstats_get_by_id(struct rte_eth_dev *eth_dev, const uint64_t *ids,
 			      uint64_t *values, unsigned int n);
 int cnxk_nix_xstats_reset(struct rte_eth_dev *eth_dev);
+void cnxk_nix_rxq_info_get(struct rte_eth_dev *eth_dev, uint16_t qid,
+			   struct rte_eth_rxq_info *qinfo);
+void cnxk_nix_txq_info_get(struct rte_eth_dev *eth_dev, uint16_t qid,
+			   struct rte_eth_txq_info *qinfo);
 
 /* Lookup configuration */
 const uint32_t *cnxk_nix_supported_ptypes_get(struct rte_eth_dev *eth_dev);
drivers/net/cnxk/cnxk_ethdev_ops.c +30 -0
index 7f46551..782f163 100644
@@ -628,3 +628,33 @@ cnxk_nix_pool_ops_supported(struct rte_eth_dev *eth_dev, const char *pool)
 
 	return -ENOTSUP;
 }
+
+void
+cnxk_nix_rxq_info_get(struct rte_eth_dev *eth_dev, uint16_t qid,
+		      struct rte_eth_rxq_info *qinfo)
+{
+	void *rxq = eth_dev->data->rx_queues[qid];
+	struct cnxk_eth_rxq_sp *rxq_sp = cnxk_eth_rxq_to_sp(rxq);
+
+	memset(qinfo, 0, sizeof(*qinfo));
+
+	qinfo->mp = rxq_sp->qconf.mp;
+	qinfo->scattered_rx = eth_dev->data->scattered_rx;
+	qinfo->nb_desc = rxq_sp->qconf.nb_desc;
+
+	memcpy(&qinfo->conf, &rxq_sp->qconf.conf.rx, sizeof(qinfo->conf));
+}
+
+void
+cnxk_nix_txq_info_get(struct rte_eth_dev *eth_dev, uint16_t qid,
+		      struct rte_eth_txq_info *qinfo)
+{
+	void *txq = eth_dev->data->tx_queues[qid];
+	struct cnxk_eth_txq_sp *txq_sp = cnxk_eth_txq_to_sp(txq);
+
+	memset(qinfo, 0, sizeof(*qinfo));
+
+	qinfo->nb_desc = txq_sp->qconf.nb_desc;
+
+	memcpy(&qinfo->conf, &txq_sp->qconf.conf.tx, sizeof(qinfo->conf));
+}
Signature · 1 line
2.8.4
#239 lore raw

PATCH v4 46/62 net/cnxk: add device close and reset operations

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

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

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

PATCH v4 47/62 net/cnxk: add pending Tx mbuf cleanup operation

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

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

---
 drivers/net/cnxk/cnxk_ethdev.c     |  1 +
 drivers/net/cnxk/cnxk_ethdev.h     |  1 +
 drivers/net/cnxk/cnxk_ethdev_ops.c | 10 ++++++++++
 3 files changed, 12 insertions(+)
drivers/net/cnxk/cnxk_ethdev.c +1 -0
index 24f02e6..529adf7 100644
@@ -1211,6 +1211,7 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
 	.xstats_get_names_by_id = cnxk_nix_xstats_get_names_by_id,
 	.rxq_info_get = cnxk_nix_rxq_info_get,
 	.txq_info_get = cnxk_nix_txq_info_get,
+	.tx_done_cleanup = cnxk_nix_tx_done_cleanup,
 };
 
 static int
drivers/net/cnxk/cnxk_ethdev.h +1 -0
index 32977eb..1c4403c 100644
@@ -266,6 +266,7 @@ int cnxk_nix_rx_queue_intr_enable(struct rte_eth_dev *eth_dev,
 int cnxk_nix_rx_queue_intr_disable(struct rte_eth_dev *eth_dev,
 				   uint16_t rx_queue_id);
 int cnxk_nix_pool_ops_supported(struct rte_eth_dev *eth_dev, const char *pool);
+int cnxk_nix_tx_done_cleanup(void *txq, uint32_t free_cnt);
 
 int cnxk_nix_configure(struct rte_eth_dev *eth_dev);
 int cnxk_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
drivers/net/cnxk/cnxk_ethdev_ops.c +10 -0
index 782f163..305220a 100644
@@ -658,3 +658,13 @@ cnxk_nix_txq_info_get(struct rte_eth_dev *eth_dev, uint16_t qid,
 
 	memcpy(&qinfo->conf, &txq_sp->qconf.conf.tx, sizeof(qinfo->conf));
 }
+
+/* It is a NOP for cnxk as HW frees the buffer on xmit */
+int
+cnxk_nix_tx_done_cleanup(void *txq, uint32_t free_cnt)
+{
+	RTE_SET_USED(txq);
+	RTE_SET_USED(free_cnt);
+
+	return 0;
+}
Signature · 1 line
2.8.4
#241 lore raw

PATCH v4 48/62 net/cnxk: add support to configure npc

In reply to Nithin Dabilpuram

From: Kiran Kumar K <[email protected]>

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

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

PATCH v4 49/62 net/cnxk: support initial version of rte flow

In reply to Nithin Dabilpuram

From: Kiran Kumar K <[email protected]>

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

---
 doc/guides/nics/cnxk.rst              |   7 +
 doc/guides/nics/features/cnxk.ini     |  36 ++++
 doc/guides/nics/features/cnxk_vec.ini |  36 ++++
 doc/guides/nics/features/cnxk_vf.ini  |  36 ++++
 drivers/net/cnxk/cn10k_ethdev.c       |  16 ++
 drivers/net/cnxk/cn10k_rte_flow.c     |  30 ++++
 drivers/net/cnxk/cn10k_rte_flow.h     |  17 ++
 drivers/net/cnxk/cn9k_ethdev.c        |  16 ++
 drivers/net/cnxk/cn9k_rte_flow.c      |  30 ++++
 drivers/net/cnxk/cn9k_rte_flow.h      |  17 ++
 drivers/net/cnxk/cnxk_ethdev.h        |   3 +
 drivers/net/cnxk/cnxk_rte_flow.c      | 330 ++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cnxk_rte_flow.h      |  27 +++
 drivers/net/cnxk/meson.build          |   3 +
 14 files changed, 604 insertions(+)
 create mode 100644 drivers/net/cnxk/cn10k_rte_flow.c
 create mode 100644 drivers/net/cnxk/cn10k_rte_flow.h
 create mode 100644 drivers/net/cnxk/cn9k_rte_flow.c
 create mode 100644 drivers/net/cnxk/cn9k_rte_flow.h
 create mode 100644 drivers/net/cnxk/cnxk_rte_flow.c
 create mode 100644 drivers/net/cnxk/cnxk_rte_flow.h
doc/guides/nics/cnxk.rst +7 -0
index e875e55..cc71b22 100644
@@ -24,6 +24,7 @@ Features of the CNXK Ethdev PMD are:
 - Multiple queues for TX and RX
 - Receiver Side Scaling (RSS)
 - MAC filtering
+- Generic flow API
 - Inner and Outer Checksum offload
 - Port hardware statistics
 - Link state information
@@ -208,6 +209,12 @@ CRC stripping
 The OCTEON CN9K/CN10K SoC family NICs strip the CRC for every packet being received by
 the host interface irrespective of the offload configuration.
 
+RTE Flow GRE support
+~~~~~~~~~~~~~~~~~~~~
+
+- ``RTE_FLOW_ITEM_TYPE_GRE_KEY`` works only when checksum and routing
+  bits in the GRE header are equal to 0.
+
 Debugging Options
 -----------------
 
doc/guides/nics/features/cnxk.ini +36 -0
index 192c15a..e2da5dd 100644
@@ -39,3 +39,39 @@ Module EEPROM dump   = Y
 Linux                = Y
 ARMv8                = Y
 Usage doc            = Y
+
+[rte_flow items]
+any                  = Y
+arp_eth_ipv4         = Y
+esp                  = Y
+eth                  = Y
+e_tag                = Y
+geneve               = Y
+gre                  = Y
+gre_key              = Y
+gtpc                 = Y
+gtpu                 = Y
+higig2               = Y
+icmp                 = Y
+ipv4                 = Y
+ipv6                 = Y
+ipv6_ext             = Y
+mpls                 = Y
+nvgre                = Y
+raw                  = Y
+sctp                 = Y
+tcp                  = Y
+udp                  = Y
+vlan                 = Y
+vxlan                = Y
+vxlan_gpe            = Y
+
+[rte_flow actions]
+count                = Y
+drop                 = Y
+flag                 = Y
+pf                   = Y
+port_id              = Y
+queue                = Y
+security             = Y
+vf                   = Y
doc/guides/nics/features/cnxk_vec.ini +36 -0
index e990480..89a3c37 100644
@@ -37,3 +37,39 @@ Module EEPROM dump   = Y
 Linux                = Y
 ARMv8                = Y
 Usage doc            = Y
+
+[rte_flow items]
+any                  = Y
+arp_eth_ipv4         = Y
+esp                  = Y
+eth                  = Y
+e_tag                = Y
+geneve               = Y
+gre                  = Y
+gre_key              = Y
+gtpc                 = Y
+gtpu                 = Y
+higig2               = Y
+icmp                 = Y
+ipv4                 = Y
+ipv6                 = Y
+ipv6_ext             = Y
+mpls                 = Y
+nvgre                = Y
+raw                  = Y
+sctp                 = Y
+tcp                  = Y
+udp                  = Y
+vlan                 = Y
+vxlan                = Y
+vxlan_gpe            = Y
+
+[rte_flow actions]
+count                = Y
+drop                 = Y
+flag                 = Y
+pf                   = Y
+port_id              = Y
+queue                = Y
+security             = Y
+vf                   = Y
doc/guides/nics/features/cnxk_vf.ini +36 -0
index 3a4417c..b0e469f 100644
@@ -34,3 +34,39 @@ Module EEPROM dump   = Y
 Linux                = Y
 ARMv8                = Y
 Usage doc            = Y
+
+[rte_flow items]
+any                  = Y
+arp_eth_ipv4         = Y
+esp                  = Y
+eth                  = Y
+e_tag                = Y
+geneve               = Y
+gre                  = Y
+gre_key              = Y
+gtpc                 = Y
+gtpu                 = Y
+higig2               = Y
+icmp                 = Y
+ipv4                 = Y
+ipv6                 = Y
+ipv6_ext             = Y
+mpls                 = Y
+nvgre                = Y
+raw                  = Y
+sctp                 = Y
+tcp                  = Y
+udp                  = Y
+vlan                 = Y
+vxlan                = Y
+vxlan_gpe            = Y
+
+[rte_flow actions]
+count                = Y
+drop                 = Y
+flag                 = Y
+pf                   = Y
+port_id              = Y
+queue                = Y
+security             = Y
+vf                   = Y
drivers/net/cnxk/cn10k_ethdev.c +16 -0
index 5ff36bb..0396ff6 100644
@@ -2,6 +2,7 @@
  * Copyright(C) 2021 Marvell.
  */
 #include "cn10k_ethdev.h"
+#include "cn10k_rte_flow.h"
 #include "cn10k_rx.h"
 #include "cn10k_tx.h"
 
@@ -308,6 +309,20 @@ nix_eth_dev_ops_override(void)
 	cnxk_eth_dev_ops.dev_ptypes_set = cn10k_nix_ptypes_set;
 }
 
+static void
+npc_flow_ops_override(void)
+{
+	static int init_once;
+
+	if (init_once)
+		return;
+	init_once = 1;
+
+	/* Update platform specific ops */
+	cnxk_flow_ops.create = cn10k_flow_create;
+	cnxk_flow_ops.destroy = cn10k_flow_destroy;
+}
+
 static int
 cn10k_nix_remove(struct rte_pci_device *pci_dev)
 {
@@ -332,6 +347,7 @@ cn10k_nix_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 	}
 
 	nix_eth_dev_ops_override();
+	npc_flow_ops_override();
 
 	/* Common probe */
 	rc = cnxk_nix_probe(pci_drv, pci_dev);
drivers/net/cnxk/cn10k_rte_flow.c new file +30 -0
new file mode 100644
index 0000000..65893cc
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2020 Marvell.
+ */
+#include <cnxk_rte_flow.h>
+#include "cn10k_rte_flow.h"
+#include "cn10k_ethdev.h"
+
+struct rte_flow *
+cn10k_flow_create(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,
+		  const struct rte_flow_item pattern[],
+		  const struct rte_flow_action actions[],
+		  struct rte_flow_error *error)
+{
+	struct roc_npc_flow *flow;
+
+	flow = cnxk_flow_create(eth_dev, attr, pattern, actions, error);
+	if (!flow)
+		return NULL;
+
+	return (struct rte_flow *)flow;
+}
+
+int
+cn10k_flow_destroy(struct rte_eth_dev *eth_dev, struct rte_flow *rte_flow,
+		   struct rte_flow_error *error)
+{
+	struct roc_npc_flow *flow = (struct roc_npc_flow *)rte_flow;
+
+	return cnxk_flow_destroy(eth_dev, flow, error);
+}
drivers/net/cnxk/cn10k_rte_flow.h new file +17 -0
new file mode 100644
index 0000000..f64fcf2
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2020 Marvell.
+ */
+#ifndef __CN10K_RTE_FLOW_H__
+#define __CN10K_RTE_FLOW_H__
+
+#include <rte_flow_driver.h>
+
+struct rte_flow *cn10k_flow_create(struct rte_eth_dev *dev,
+				   const struct rte_flow_attr *attr,
+				   const struct rte_flow_item pattern[],
+				   const struct rte_flow_action actions[],
+				   struct rte_flow_error *error);
+int cn10k_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow,
+		       struct rte_flow_error *error);
+
+#endif /* __CN10K_RTE_FLOW_H__ */
drivers/net/cnxk/cn9k_ethdev.c +16 -0
index 2157dca..cf9f7c7 100644
@@ -2,6 +2,7 @@
  * Copyright(C) 2021 Marvell.
  */
 #include "cn9k_ethdev.h"
+#include "cn9k_rte_flow.h"
 #include "cn9k_rx.h"
 #include "cn9k_tx.h"
 
@@ -317,6 +318,20 @@ nix_eth_dev_ops_override(void)
 	cnxk_eth_dev_ops.dev_ptypes_set = cn9k_nix_ptypes_set;
 }
 
+static void
+npc_flow_ops_override(void)
+{
+	static int init_once;
+
+	if (init_once)
+		return;
+	init_once = 1;
+
+	/* Update platform specific ops */
+	cnxk_flow_ops.create = cn9k_flow_create;
+	cnxk_flow_ops.destroy = cn9k_flow_destroy;
+}
+
 static int
 cn9k_nix_remove(struct rte_pci_device *pci_dev)
 {
@@ -342,6 +357,7 @@ cn9k_nix_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 	}
 
 	nix_eth_dev_ops_override();
+	npc_flow_ops_override();
 
 	/* Common probe */
 	rc = cnxk_nix_probe(pci_drv, pci_dev);
drivers/net/cnxk/cn9k_rte_flow.c new file +30 -0
new file mode 100644
index 0000000..24e1b92
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2020 Marvell.
+ */
+#include <cnxk_rte_flow.h>
+#include "cn9k_ethdev.h"
+#include "cn9k_rte_flow.h"
+
+struct rte_flow *
+cn9k_flow_create(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,
+		 const struct rte_flow_item pattern[],
+		 const struct rte_flow_action actions[],
+		 struct rte_flow_error *error)
+{
+	struct roc_npc_flow *flow;
+
+	flow = cnxk_flow_create(eth_dev, attr, pattern, actions, error);
+	if (!flow)
+		return NULL;
+
+	return (struct rte_flow *)flow;
+}
+
+int
+cn9k_flow_destroy(struct rte_eth_dev *eth_dev, struct rte_flow *rte_flow,
+		  struct rte_flow_error *error)
+{
+	struct roc_npc_flow *flow = (struct roc_npc_flow *)rte_flow;
+
+	return cnxk_flow_destroy(eth_dev, flow, error);
+}
drivers/net/cnxk/cn9k_rte_flow.h new file +17 -0
new file mode 100644
index 0000000..43d59e1
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2020 Marvell.
+ */
+#ifndef __CN9K_RTE_FLOW_H__
+#define __CN9K_RTE_FLOW_H__
+
+#include <rte_flow_driver.h>
+
+struct rte_flow *cn9k_flow_create(struct rte_eth_dev *dev,
+				  const struct rte_flow_attr *attr,
+				  const struct rte_flow_item pattern[],
+				  const struct rte_flow_action actions[],
+				  struct rte_flow_error *error);
+int cn9k_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow,
+		      struct rte_flow_error *error);
+
+#endif /* __CN9K_RTE_FLOW_H__ */
drivers/net/cnxk/cnxk_ethdev.h +3 -0
index 4879ef9..b7869b4 100644
@@ -233,6 +233,9 @@ cnxk_eth_txq_to_sp(void *__txq)
 /* Common ethdev ops */
 extern struct eth_dev_ops cnxk_eth_dev_ops;
 
+/* Common flow ops */
+extern struct rte_flow_ops cnxk_flow_ops;
+
 /* Ops */
 int cnxk_nix_probe(struct rte_pci_driver *pci_drv,
 		   struct rte_pci_device *pci_dev);
drivers/net/cnxk/cnxk_rte_flow.c new file +330 -0

330 lines not on this page · raw message

drivers/net/cnxk/cnxk_rte_flow.h new file +27 -0
new file mode 100644
index 0000000..bb23629
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+#ifndef __CNXK_RTE_FLOW_H__
+#define __CNXK_RTE_FLOW_H__
+
+#include <rte_flow_driver.h>
+#include <rte_malloc.h>
+
+#include "cnxk_ethdev.h"
+#include "roc_api.h"
+#include "roc_npc_priv.h"
+
+struct cnxk_rte_flow_term_info {
+	uint16_t item_type;
+	uint16_t item_size;
+};
+
+struct roc_npc_flow *cnxk_flow_create(struct rte_eth_dev *dev,
+				      const struct rte_flow_attr *attr,
+				      const struct rte_flow_item pattern[],
+				      const struct rte_flow_action actions[],
+				      struct rte_flow_error *error);
+int cnxk_flow_destroy(struct rte_eth_dev *dev, struct roc_npc_flow *flow,
+		      struct rte_flow_error *error);
+
+#endif /* __CNXK_RTE_FLOW_H__ */
drivers/net/cnxk/meson.build +3 -0
index 7d711a2..df953fd 100644
@@ -13,10 +13,12 @@ sources = files('cnxk_ethdev.c',
 		'cnxk_ethdev_devargs.c',
 		'cnxk_link.c',
 		'cnxk_lookup.c',
+		'cnxk_rte_flow.c',
 		'cnxk_stats.c')
 
 # CN9K
 sources += files('cn9k_ethdev.c',
+		 'cn9k_rte_flow.c',
 		 'cn9k_rx.c',
 		 'cn9k_rx_mseg.c',
 		 'cn9k_rx_vec.c',
@@ -25,6 +27,7 @@ sources += files('cn9k_ethdev.c',
 		 'cn9k_tx_vec.c')
 # CN10K
 sources += files('cn10k_ethdev.c',
+		 'cn10k_rte_flow.c',
 		 'cn10k_rx.c',
 		 'cn10k_rx_mseg.c',
 		 'cn10k_rx_vec.c',
Signature · 1 line
2.8.4
#243 lore raw

Re: [dpdk-dev] [PATCH v4 49/62] net/cnxk: support initial version of rte flow

23/06/2021 06:46, Nithin Dabilpuram:

Quoted 4 lines

From: Kiran Kumar K <[email protected]>

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

flow_destroy?

Quoted 3 lines

flow_flush, flow_query, flow_isolate.

[...]

Quoted 16 lines
doc/guides/nics/features/cnxk.ini +10 -0
@@ -39,3 +39,39 @@ Module EEPROM dump   = Y
 Linux                = Y
 ARMv8                = Y
 Usage doc            = Y
+
+[rte_flow items]
+any                  = Y
+arp_eth_ipv4         = Y
+esp                  = Y
+eth                  = Y
+e_tag                = Y
+geneve               = Y
+gre                  = Y
+gre_key              = Y

doc/guides/nics/features/cnxk.ini Module EEPROM dump = Y · line 61

Quoted 10 lines
doc/guides/nics/features/cnxk.ini +10 -0
+gtpc                 = Y
+gtpu                 = Y
+higig2               = Y
+icmp                 = Y
+ipv4                 = Y
+ipv6                 = Y
+ipv6_ext             = Y
+mpls                 = Y
+nvgre                = Y
+raw                  = Y

raw item not found in PMD code.

doc/guides/nics/features/cnxk.ini Module EEPROM dump = Y · line 74

Quoted 13 lines
doc/guides/nics/features/cnxk.ini +13 -0
+sctp                 = Y
+tcp                  = Y
+udp                  = Y
+vlan                 = Y
+vxlan                = Y
+vxlan_gpe            = Y
+
+[rte_flow actions]
+count                = Y
+drop                 = Y
+flag                 = Y
+pf                   = Y
+port_id              = Y

port_id action not found in PMD code.

doc/guides/nics/features/cnxk.ini Module EEPROM dump = Y · line 77

Quoted 3 lines
doc/guides/nics/features/cnxk.ini +3 -0
+queue                = Y
+security             = Y
+vf                   = Y

I will remove raw and port_id while applying.

#244 lore raw

Re: [dpdk-dev] [PATCH v4 49/62] net/cnxk: support initial version of rte flow

Quoted 57 lines · Thomas Monjalon

23/06/2021 06:46, Nithin Dabilpuram:

Quoted 4 lines

From: Kiran Kumar K <[email protected]>

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

flow_destroy?

Quoted 3 lines

flow_flush, flow_query, flow_isolate.

[...]

Quoted 16 lines
doc/guides/nics/features/cnxk.ini +10 -0
@@ -39,3 +39,39 @@ Module EEPROM dump   = Y
 Linux                = Y
 ARMv8                = Y
 Usage doc            = Y
+
+[rte_flow items]
+any                  = Y
+arp_eth_ipv4         = Y
+esp                  = Y
+eth                  = Y
+e_tag                = Y
+geneve               = Y
+gre                  = Y
+gre_key              = Y

doc/guides/nics/features/cnxk.ini Module EEPROM dump = Y · line 61

Quoted 10 lines
doc/guides/nics/features/cnxk.ini +10 -0
+gtpc                 = Y
+gtpu                 = Y
+higig2               = Y
+icmp                 = Y
+ipv4                 = Y
+ipv6                 = Y
+ipv6_ext             = Y
+mpls                 = Y
+nvgre                = Y
+raw                  = Y

raw item not found in PMD code.

doc/guides/nics/features/cnxk.ini Module EEPROM dump = Y · line 74

Quoted 13 lines
doc/guides/nics/features/cnxk.ini +13 -0
+sctp                 = Y
+tcp                  = Y
+udp                  = Y
+vlan                 = Y
+vxlan                = Y
+vxlan_gpe            = Y
+
+[rte_flow actions]
+count                = Y
+drop                 = Y
+flag                 = Y
+pf                   = Y
+port_id              = Y

port_id action not found in PMD code.

Quoted 5 lines

doc/guides/nics/features/cnxk.ini Module EEPROM dump = Y · line 77

Quoted 3 lines
doc/guides/nics/features/cnxk.ini +3 -0
+queue                = Y
+security             = Y
+vf                   = Y

I will remove raw and port_id while applying.

Ack, thanks.

Quoted 3 lines
#245 lore raw

PATCH v4 50/62 net/cnxk: add flow ops get operation

In reply to Nithin Dabilpuram

From: Satheesh Paul <[email protected]>

This patch adds flow ops get operation to enable rte_flow_ops.A

This patch also add support for flow dev dump API. Every flow rule added will be dumped in the below format.

MCAM Index:1881
Interface :NIX-RX (0)
Priority :1
NPC RX Action:0X00000000404001

	ActionOp:NIX_RX_ACTIONOP_UCAST (1)
	PF_FUNC: 0X400
	RQ Index:0X004
	Match Id:0000
	Flow Key Alg:0
NPC RX VTAG Action:0X00000000008100
	VTAG0:relptr:0
	lid:0X1
	type:0
Patterns:
	NPC_PARSE_NIBBLE_CHAN:000
	NPC_PARSE_NIBBLE_LA_LTYPE:LA_ETHER
	NPC_PARSE_NIBBLE_LB_LTYPE:NONE
	NPC_PARSE_NIBBLE_LC_LTYPE:LC_IP
	NPC_PARSE_NIBBLE_LD_LTYPE:LD_TCP
	NPC_PARSE_NIBBLE_LE_LTYPE:NONE
	LA_ETHER, hdr offset:0, len:0X6, key offset:0X8,\
		Data:0X4AE124FC7FFF, Mask:0XFFFFFFFFFFFF
	LA_ETHER, hdr offset:0XC, len:0X2, key offset:0X4, Data:0XCA5A,\
		Mask:0XFFFF
	LC_IP, hdr offset:0XC, len:0X8, key offset:0X10,\
		Data:0X0A01010300000000, Mask:0XFFFFFFFF00000000
	LD_TCP, hdr offset:0, len:0X4, key offset:0X18, Data:0X03450000,\
		Mask:0XFFFF0000
MCAM Raw Data :
	DW0     :0000CA5A01202000
	DW0_Mask:0000FFFF0FF0F000
	DW1     :00004AE124FC7FFF
	DW1_Mask:0000FFFFFFFFFFFF
	DW2     :0A01010300000000
	DW2_Mask:FFFFFFFF00000000
	DW3     :0000000003450000
	DW3_Mask:00000000FFFF0000
	DW4     :0000000000000000
	DW4_Mask:0000000000000000
	DW5     :0000000000000000
	DW5_Mask:0000000000000000
	DW6     :0000000000000000
	DW6_Mask:0000000000000000
---
 drivers/common/cnxk/roc_npc.c      |  2 ++
 drivers/net/cnxk/cnxk_ethdev.c     |  3 +++
 drivers/net/cnxk/cnxk_ethdev.h     |  3 ++-
 drivers/net/cnxk/cnxk_ethdev_ops.c | 10 ++++++++++
 drivers/net/cnxk/cnxk_rte_flow.c   | 28 ++++++++++++++++++++++++++++
 5 files changed, 45 insertions(+), 1 deletion(-)
drivers/common/cnxk/roc_npc.c +2 -0
index 8a76823..aff4eef 100644
@@ -1009,6 +1009,8 @@ roc_npc_flow_create(struct roc_npc *roc_npc, const struct roc_npc_attr *attr,
 	struct npc_flow_list *list;
 	int rc;
 
+	npc->channel = roc_npc->channel;
+
 	flow = plt_zmalloc(sizeof(*flow), 0);
 	if (flow == NULL) {
 		*errcode = NPC_ERR_NO_MEM;
drivers/net/cnxk/cnxk_ethdev.c +3 -0
index 7088e67..d863810 100644
@@ -819,6 +819,8 @@ cnxk_nix_configure(struct rte_eth_dev *eth_dev)
 		goto fail_configure;
 	}
 
+	dev->npc.channel = roc_nix_get_base_chan(nix);
+
 	nb_rxq = data->nb_rx_queues;
 	nb_txq = data->nb_tx_queues;
 	rc = -ENOMEM;
@@ -1223,6 +1225,7 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
 	.rxq_info_get = cnxk_nix_rxq_info_get,
 	.txq_info_get = cnxk_nix_txq_info_get,
 	.tx_done_cleanup = cnxk_nix_tx_done_cleanup,
+	.flow_ops_get = cnxk_nix_flow_ops_get,
 };
 
 static int
drivers/net/cnxk/cnxk_ethdev.h +2 -1
index b7869b4..07c87ea 100644
@@ -273,7 +273,8 @@ int cnxk_nix_rx_queue_intr_disable(struct rte_eth_dev *eth_dev,
 				   uint16_t rx_queue_id);
 int cnxk_nix_pool_ops_supported(struct rte_eth_dev *eth_dev, const char *pool);
 int cnxk_nix_tx_done_cleanup(void *txq, uint32_t free_cnt);
-
+int cnxk_nix_flow_ops_get(struct rte_eth_dev *eth_dev,
+			  const struct rte_flow_ops **ops);
 int cnxk_nix_configure(struct rte_eth_dev *eth_dev);
 int cnxk_nix_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 			    uint16_t nb_desc, uint16_t fp_tx_q_sz,
drivers/net/cnxk/cnxk_ethdev_ops.c +10 -0
index 305220a..36ca750 100644
@@ -300,6 +300,16 @@ cnxk_nix_flow_ctrl_set(struct rte_eth_dev *eth_dev,
 }
 
 int
+cnxk_nix_flow_ops_get(struct rte_eth_dev *eth_dev,
+		      const struct rte_flow_ops **ops)
+{
+	RTE_SET_USED(eth_dev);
+
+	*ops = &cnxk_flow_ops;
+	return 0;
+}
+
+int
 cnxk_nix_mac_addr_set(struct rte_eth_dev *eth_dev, struct rte_ether_addr *addr)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
drivers/net/cnxk/cnxk_rte_flow.c +28 -0
index 1695d4f..2dee19e 100644
@@ -322,9 +322,37 @@ cnxk_flow_isolate(struct rte_eth_dev *eth_dev __rte_unused,
 	return -rte_errno;
 }
 
+static int
+cnxk_flow_dev_dump(struct rte_eth_dev *eth_dev, struct rte_flow *flow,
+		   FILE *file, struct rte_flow_error *error)
+{
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	struct roc_npc *npc = &dev->npc;
+
+	if (file == NULL) {
+		rte_flow_error_set(error, EINVAL,
+				   RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
+				   "Invalid file");
+		return -rte_errno;
+	}
+
+	if (flow != NULL) {
+		rte_flow_error_set(error, EINVAL,
+				   RTE_FLOW_ERROR_TYPE_HANDLE,
+				   NULL,
+				   "Invalid argument");
+		return -EINVAL;
+	}
+
+	roc_npc_flow_dump(file, npc);
+
+	return 0;
+}
+
 struct rte_flow_ops cnxk_flow_ops = {
 	.validate = cnxk_flow_validate,
 	.flush = cnxk_flow_flush,
 	.query = cnxk_flow_query,
 	.isolate = cnxk_flow_isolate,
+	.dev_dump = cnxk_flow_dev_dump,
 };
Signature · 1 line
2.8.4
#246 lore raw

PATCH v4 51/62 net/cnxk: add ethdev firmware version get

In reply to Nithin Dabilpuram

From: Satha Rao <[email protected]>

Add callback to get ethdev firmware version.

---
 doc/guides/nics/features/cnxk.ini     |  1 +
 doc/guides/nics/features/cnxk_vec.ini |  1 +
 doc/guides/nics/features/cnxk_vf.ini  |  1 +
 drivers/net/cnxk/cnxk_ethdev.c        |  1 +
 drivers/net/cnxk/cnxk_ethdev.h        |  2 ++
 drivers/net/cnxk/cnxk_ethdev_ops.c    | 19 +++++++++++++++++++
 6 files changed, 25 insertions(+)
doc/guides/nics/features/cnxk.ini +1 -0
index e2da5dd..d43b1c4 100644
@@ -35,6 +35,7 @@ Packet type parsing  = Y
 Basic stats          = Y
 Stats per queue      = Y
 Extended stats       = Y
+FW version           = Y
 Module EEPROM dump   = Y
 Linux                = Y
 ARMv8                = Y
doc/guides/nics/features/cnxk_vec.ini +1 -0
index 89a3c37..8fb54d4 100644
@@ -33,6 +33,7 @@ Packet type parsing  = Y
 Basic stats          = Y
 Stats per queue      = Y
 Extended stats       = Y
+FW version           = Y
 Module EEPROM dump   = Y
 Linux                = Y
 ARMv8                = Y
doc/guides/nics/features/cnxk_vf.ini +1 -0
index b0e469f..2da2252 100644
@@ -30,6 +30,7 @@ Packet type parsing  = Y
 Basic stats          = Y
 Stats per queue      = Y
 Extended stats       = Y
+FW version           = Y
 Module EEPROM dump   = Y
 Linux                = Y
 ARMv8                = Y
drivers/net/cnxk/cnxk_ethdev.c +1 -0
index d863810..26e4ddf 100644
@@ -1222,6 +1222,7 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
 	.xstats_reset = cnxk_nix_xstats_reset,
 	.xstats_get_by_id = cnxk_nix_xstats_get_by_id,
 	.xstats_get_names_by_id = cnxk_nix_xstats_get_names_by_id,
+	.fw_version_get = cnxk_nix_fw_version_get,
 	.rxq_info_get = cnxk_nix_rxq_info_get,
 	.txq_info_get = cnxk_nix_txq_info_get,
 	.tx_done_cleanup = cnxk_nix_tx_done_cleanup,
drivers/net/cnxk/cnxk_ethdev.h +2 -0
index 07c87ea..a25be8a 100644
@@ -313,6 +313,8 @@ int cnxk_nix_xstats_get_names_by_id(struct rte_eth_dev *eth_dev,
 int cnxk_nix_xstats_get_by_id(struct rte_eth_dev *eth_dev, const uint64_t *ids,
 			      uint64_t *values, unsigned int n);
 int cnxk_nix_xstats_reset(struct rte_eth_dev *eth_dev);
+int cnxk_nix_fw_version_get(struct rte_eth_dev *eth_dev, char *fw_version,
+			    size_t fw_size);
 void cnxk_nix_rxq_info_get(struct rte_eth_dev *eth_dev, uint16_t qid,
 			   struct rte_eth_rxq_info *qinfo);
 void cnxk_nix_txq_info_get(struct rte_eth_dev *eth_dev, uint16_t qid,
drivers/net/cnxk/cnxk_ethdev_ops.c +19 -0
index 36ca750..228c624 100644
@@ -639,6 +639,25 @@ cnxk_nix_pool_ops_supported(struct rte_eth_dev *eth_dev, const char *pool)
 	return -ENOTSUP;
 }
 
+int
+cnxk_nix_fw_version_get(struct rte_eth_dev *eth_dev, char *fw_version,
+			size_t fw_size)
+{
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	const char *str = roc_npc_profile_name_get(&dev->npc);
+	uint32_t size = strlen(str) + 1;
+
+	if (fw_size > size)
+		fw_size = size;
+
+	rte_strlcpy(fw_version, str, fw_size);
+
+	if (fw_size < size)
+		return size;
+
+	return 0;
+}
+
 void
 cnxk_nix_rxq_info_get(struct rte_eth_dev *eth_dev, uint16_t qid,
 		      struct rte_eth_rxq_info *qinfo)
Signature · 1 line
2.8.4
#247 lore raw

PATCH v4 52/62 net/cnxk: add get register operation

In reply to Nithin Dabilpuram

From: Satha Rao <[email protected]>

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

---
 doc/guides/nics/cnxk.rst              |  1 +
 doc/guides/nics/features/cnxk.ini     |  1 +
 doc/guides/nics/features/cnxk_vec.ini |  1 +
 doc/guides/nics/features/cnxk_vf.ini  |  1 +
 drivers/net/cnxk/cnxk_ethdev.c        |  1 +
 drivers/net/cnxk/cnxk_ethdev.h        |  4 ++++
 drivers/net/cnxk/cnxk_ethdev_ops.c    | 25 +++++++++++++++++++++++++
 7 files changed, 34 insertions(+)
doc/guides/nics/cnxk.rst +1 -0
index cc71b22..e561321 100644
@@ -32,6 +32,7 @@ Features of the CNXK Ethdev PMD are:
 - MTU update
 - Scatter-Gather IO support
 - Vector Poll mode driver
+- Debug utilities - Context dump and error interrupt support
 - Support Rx interrupt
 
 Prerequisites
doc/guides/nics/features/cnxk.ini +1 -0
index d43b1c4..246caf9 100644
@@ -37,6 +37,7 @@ Stats per queue      = Y
 Extended stats       = Y
 FW version           = Y
 Module EEPROM dump   = Y
+Registers dump       = Y
 Linux                = Y
 ARMv8                = Y
 Usage doc            = Y
doc/guides/nics/features/cnxk_vec.ini +1 -0
index 8fb54d4..6c6aeb0 100644
@@ -35,6 +35,7 @@ Stats per queue      = Y
 Extended stats       = Y
 FW version           = Y
 Module EEPROM dump   = Y
+Registers dump       = Y
 Linux                = Y
 ARMv8                = Y
 Usage doc            = Y
doc/guides/nics/features/cnxk_vf.ini +1 -0
index 2da2252..8ec326a 100644
@@ -32,6 +32,7 @@ Stats per queue      = Y
 Extended stats       = Y
 FW version           = Y
 Module EEPROM dump   = Y
+Registers dump       = Y
 Linux                = Y
 ARMv8                = Y
 Usage doc            = Y
drivers/net/cnxk/cnxk_ethdev.c +1 -0
index 26e4ddf..b76442d 100644
@@ -1227,6 +1227,7 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
 	.txq_info_get = cnxk_nix_txq_info_get,
 	.tx_done_cleanup = cnxk_nix_tx_done_cleanup,
 	.flow_ops_get = cnxk_nix_flow_ops_get,
+	.get_reg = cnxk_nix_dev_get_reg,
 };
 
 static int
drivers/net/cnxk/cnxk_ethdev.h +4 -0
index a25be8a..d51a6d7 100644
@@ -328,6 +328,10 @@ void *cnxk_nix_fastpath_lookup_mem_get(void);
 int cnxk_ethdev_parse_devargs(struct rte_devargs *devargs,
 			      struct cnxk_eth_dev *dev);
 
+/* Debug */
+int cnxk_nix_dev_get_reg(struct rte_eth_dev *eth_dev,
+			 struct rte_dev_reg_info *regs);
+
 /* Inlines */
 static __rte_always_inline uint64_t
 cnxk_pktmbuf_detach(struct rte_mbuf *m)
drivers/net/cnxk/cnxk_ethdev_ops.c +25 -0
index 228c624..c879b25 100644
@@ -697,3 +697,28 @@ cnxk_nix_tx_done_cleanup(void *txq, uint32_t free_cnt)
 
 	return 0;
 }
+
+int
+cnxk_nix_dev_get_reg(struct rte_eth_dev *eth_dev, struct rte_dev_reg_info *regs)
+{
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	struct roc_nix *nix = &dev->nix;
+	uint64_t *data = regs->data;
+	int rc = -ENOTSUP;
+
+	if (data == NULL) {
+		rc = roc_nix_lf_get_reg_count(nix);
+		if (rc > 0) {
+			regs->length = rc;
+			regs->width = 8;
+			rc = 0;
+		}
+		return rc;
+	}
+
+	if (!regs->length ||
+	    regs->length == (uint32_t)roc_nix_lf_get_reg_count(nix))
+		return roc_nix_lf_reg_dump(nix, data);
+
+	return rc;
+}
Signature · 1 line
2.8.4
#248 lore raw

PATCH v4 53/62 net/cnxk: support for RSS in rte flow

In reply to Nithin Dabilpuram

From: Satheesh Paul <[email protected]>

Added support for RSS action in rte flow code based on ROC.

---
 doc/guides/nics/features/cnxk.ini     |  1 +
 doc/guides/nics/features/cnxk_vec.ini |  1 +
 doc/guides/nics/features/cnxk_vf.ini  |  1 +
 drivers/net/cnxk/cnxk_rte_flow.c      | 74 +++++++++++++++++++++++++++++++----
 4 files changed, 69 insertions(+), 8 deletions(-)
doc/guides/nics/features/cnxk.ini +1 -0
index 246caf9..eba4107 100644
@@ -75,5 +75,6 @@ flag                 = Y
 pf                   = Y
 port_id              = Y
 queue                = Y
+rss                  = Y
 security             = Y
 vf                   = Y
doc/guides/nics/features/cnxk_vec.ini +1 -0
index 6c6aeb0..4871fac 100644
@@ -73,5 +73,6 @@ flag                 = Y
 pf                   = Y
 port_id              = Y
 queue                = Y
+rss                  = Y
 security             = Y
 vf                   = Y
doc/guides/nics/features/cnxk_vf.ini +1 -0
index 8ec326a..81ee7cc 100644
@@ -70,5 +70,6 @@ flag                 = Y
 pf                   = Y
 port_id              = Y
 queue                = Y
+rss                  = Y
 security             = Y
 vf                   = Y
drivers/net/cnxk/cnxk_rte_flow.c +66 -8

124 lines not on this page · raw message

Signature · 1 line
2.8.4
#249 lore raw

PATCH v4 54/62 net/cnxk: register callback to get PTP status

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

Once PTP status is changed at H/W i.e. enable/disable then it is propagated to user via registered callback.

So corresponding callback is registered to get PTP status.

---
 drivers/net/cnxk/cn10k_ethdev.c    | 87 ++++++++++++++++++++++++++++++++++++--
 drivers/net/cnxk/cn10k_rx.h        |  1 +
 drivers/net/cnxk/cn9k_ethdev.c     | 73 ++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cn9k_rx.h         |  1 +
 drivers/net/cnxk/cnxk_ethdev.c     |  2 +-
 drivers/net/cnxk/cnxk_ethdev.h     |  5 +++
 drivers/net/cnxk/cnxk_ethdev_ops.c |  2 +
 7 files changed, 166 insertions(+), 5 deletions(-)
drivers/net/cnxk/cn10k_ethdev.c +83 -4
index 0396ff6..bddb7fb 100644
@@ -268,6 +268,76 @@ cn10k_nix_configure(struct rte_eth_dev *eth_dev)
 	return 0;
 }
 
+/* Function to enable ptp config for VFs */
+static void
+nix_ptp_enable_vf(struct rte_eth_dev *eth_dev)
+{
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+
+	if (nix_recalc_mtu(eth_dev))
+		plt_err("Failed to set MTU size for ptp");
+
+	dev->scalar_ena = true;
+	dev->rx_offload_flags |= NIX_RX_OFFLOAD_TSTAMP_F;
+
+	/* Setting up the function pointers as per new offload flags */
+	cn10k_eth_set_rx_function(eth_dev);
+	cn10k_eth_set_tx_function(eth_dev);
+}
+
+static uint16_t
+nix_ptp_vf_burst(void *queue, struct rte_mbuf **mbufs, uint16_t pkts)
+{
+	struct cn10k_eth_rxq *rxq = queue;
+	struct cnxk_eth_rxq_sp *rxq_sp;
+	struct rte_eth_dev *eth_dev;
+
+	RTE_SET_USED(mbufs);
+	RTE_SET_USED(pkts);
+
+	rxq_sp = cnxk_eth_rxq_to_sp(rxq);
+	eth_dev = rxq_sp->dev->eth_dev;
+	nix_ptp_enable_vf(eth_dev);
+
+	return 0;
+}
+
+static int
+cn10k_nix_ptp_info_update_cb(struct roc_nix *nix, bool ptp_en)
+{
+	struct cnxk_eth_dev *dev = (struct cnxk_eth_dev *)nix;
+	struct rte_eth_dev *eth_dev;
+	struct cn10k_eth_rxq *rxq;
+	int i;
+
+	if (!dev)
+		return -EINVAL;
+
+	eth_dev = dev->eth_dev;
+	if (!eth_dev)
+		return -EINVAL;
+
+	dev->ptp_en = ptp_en;
+
+	for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
+		rxq = eth_dev->data->rx_queues[i];
+		rxq->mbuf_initializer = cnxk_nix_rxq_mbuf_setup(dev);
+	}
+
+	if (roc_nix_is_vf_or_sdp(nix) && !(roc_nix_is_sdp(nix)) &&
+	    !(roc_nix_is_lbk(nix))) {
+		/* In case of VF, setting of MTU cannot be done directly in this
+		 * function as this is running as part of MBOX request(PF->VF)
+		 * and MTU setting also requires MBOX message to be
+		 * sent(VF->PF)
+		 */
+		eth_dev->rx_pkt_burst = nix_ptp_vf_burst;
+		rte_mb();
+	}
+
+	return 0;
+}
+
 static int
 cn10k_nix_dev_start(struct rte_eth_dev *eth_dev)
 {
@@ -333,6 +403,7 @@ static int
 cn10k_nix_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 {
 	struct rte_eth_dev *eth_dev;
+	struct cnxk_eth_dev *dev;
 	int rc;
 
 	if (RTE_CACHE_LINE_SIZE != 64) {
@@ -354,15 +425,23 @@ cn10k_nix_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 	if (rc)
 		return rc;
 
+	/* Find eth dev allocated */
+	eth_dev = rte_eth_dev_allocated(pci_dev->device.name);
+	if (!eth_dev)
+		return -ENOENT;
+
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
-		eth_dev = rte_eth_dev_allocated(pci_dev->device.name);
-		if (!eth_dev)
-			return -ENOENT;
-
 		/* Setup callbacks for secondary process */
 		cn10k_eth_set_tx_function(eth_dev);
 		cn10k_eth_set_rx_function(eth_dev);
+		return 0;
 	}
+
+	dev = cnxk_eth_pmd_priv(eth_dev);
+
+	/* Register up msg callbacks for PTP information */
+	roc_nix_ptp_info_cb_register(&dev->nix, cn10k_nix_ptp_info_update_cb);
+
 	return 0;
 }
 
drivers/net/cnxk/cn10k_rx.h +1 -0
index 7bb9dd8..29ee0ac 100644
@@ -12,6 +12,7 @@
 #define NIX_RX_OFFLOAD_PTYPE_F	     BIT(1)
 #define NIX_RX_OFFLOAD_CHECKSUM_F    BIT(2)
 #define NIX_RX_OFFLOAD_MARK_UPDATE_F BIT(3)
+#define NIX_RX_OFFLOAD_TSTAMP_F	     BIT(4)
 
 /* Flags to control cqe_to_mbuf conversion function.
  * Defining it from backwards to denote its been
drivers/net/cnxk/cn9k_ethdev.c +73 -0

85 lines not on this page · raw message

drivers/net/cnxk/cn9k_rx.h +1 -0
index bc04f5c..f4b3282 100644
@@ -13,6 +13,7 @@
 #define NIX_RX_OFFLOAD_PTYPE_F	     BIT(1)
 #define NIX_RX_OFFLOAD_CHECKSUM_F    BIT(2)
 #define NIX_RX_OFFLOAD_MARK_UPDATE_F BIT(3)
+#define NIX_RX_OFFLOAD_TSTAMP_F	     BIT(4)
 
 /* Flags to control cqe_to_mbuf conversion function.
  * Defining it from backwards to denote its been
drivers/net/cnxk/cnxk_ethdev.c +1 -1
index b76442d..522f7ec 100644
@@ -59,7 +59,7 @@ nix_enable_mseg_on_jumbo(struct cnxk_eth_rxq_sp *rxq)
 	}
 }
 
-static int
+int
 nix_recalc_mtu(struct rte_eth_dev *eth_dev)
 {
 	struct rte_eth_dev_data *data = eth_dev->data;
drivers/net/cnxk/cnxk_ethdev.h +5 -0
index d51a6d7..1c41dcb 100644
@@ -100,6 +100,7 @@
 /* Default mark value used when none is provided. */
 #define CNXK_FLOW_ACTION_FLAG_DEFAULT 0xffff
 
+#define CNXK_NIX_TIMESYNC_RX_OFFSET 8
 #define PTYPE_NON_TUNNEL_WIDTH	  16
 #define PTYPE_TUNNEL_WIDTH	  12
 #define PTYPE_NON_TUNNEL_ARRAY_SZ BIT(PTYPE_NON_TUNNEL_WIDTH)
@@ -153,6 +154,7 @@ struct cnxk_eth_dev {
 	uint16_t flags;
 	uint8_t ptype_disable;
 	bool scalar_ena;
+	bool ptp_en;
 
 	/* Pointer back to rte */
 	struct rte_eth_dev *eth_dev;
@@ -332,6 +334,9 @@ int cnxk_ethdev_parse_devargs(struct rte_devargs *devargs,
 int cnxk_nix_dev_get_reg(struct rte_eth_dev *eth_dev,
 			 struct rte_dev_reg_info *regs);
 
+/* Other private functions */
+int nix_recalc_mtu(struct rte_eth_dev *eth_dev);
+
 /* Inlines */
 static __rte_always_inline uint64_t
 cnxk_pktmbuf_detach(struct rte_mbuf *m)
drivers/net/cnxk/cnxk_ethdev_ops.c +2 -0
index c879b25..91de6b7 100644
@@ -385,6 +385,8 @@ cnxk_nix_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
 	int rc = -EINVAL;
 	uint32_t buffsz;
 
+	frame_size += CNXK_NIX_TIMESYNC_RX_OFFSET * dev->ptp_en;
+
 	/* Check if MTU is within the allowed range */
 	if ((frame_size - RTE_ETHER_CRC_LEN) < NIX_MIN_HW_FRS) {
 		plt_err("MTU is lesser than minimum");
Signature · 1 line
2.8.4
#250 lore raw

PATCH v4 55/62 net/cnxk: support base PTP timesync

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

Base PTP timesync support is added for cn9k and cn10k platforms.

---
 drivers/net/cnxk/cn10k_ethdev.c  |  31 +++++
 drivers/net/cnxk/cn10k_ethdev.h  |   1 +
 drivers/net/cnxk/cn10k_rx.c      |  32 ++---
 drivers/net/cnxk/cn10k_rx.h      |  61 +++++++---
 drivers/net/cnxk/cn10k_rx_mseg.c |   2 +-
 drivers/net/cnxk/cn10k_rx_vec.c  |   5 +-
 drivers/net/cnxk/cn10k_tx.c      |  28 +++--
 drivers/net/cnxk/cn10k_tx.h      | 193 +++++++++++++++++++++++------
 drivers/net/cnxk/cn10k_tx_mseg.c |   2 +-
 drivers/net/cnxk/cn10k_tx_vec.c  |   3 +-
 drivers/net/cnxk/cn9k_ethdev.c   |  34 +++++-
 drivers/net/cnxk/cn9k_ethdev.h   |   1 +
 drivers/net/cnxk/cn9k_rx.c       |  32 ++---
 drivers/net/cnxk/cn9k_rx.h       |  61 +++++++---
 drivers/net/cnxk/cn9k_rx_mseg.c  |   2 +-
 drivers/net/cnxk/cn9k_rx_vec.c   |   5 +-
 drivers/net/cnxk/cn9k_tx.c       |  28 +++--
 drivers/net/cnxk/cn9k_tx.h       | 253 ++++++++++++++++++++++++++++-----------
 drivers/net/cnxk/cn9k_tx_mseg.c  |   2 +-
 drivers/net/cnxk/cn9k_tx_vec.c   |   3 +-
 drivers/net/cnxk/cnxk_ethdev.c   |  36 +++++-
 drivers/net/cnxk/cnxk_ethdev.h   |  64 +++++++++-
 drivers/net/cnxk/cnxk_ptp.c      | 169 ++++++++++++++++++++++++++
 drivers/net/cnxk/meson.build     |   1 +
 24 files changed, 834 insertions(+), 215 deletions(-)
 create mode 100644 drivers/net/cnxk/cnxk_ptp.c
drivers/net/cnxk/cn10k_ethdev.c +31 -0
index bddb7fb..5e0de13 100644
@@ -30,6 +30,9 @@ nix_rx_offload_flags(struct rte_eth_dev *eth_dev)
 	if (dev->rx_offloads & DEV_RX_OFFLOAD_SCATTER)
 		flags |= NIX_RX_MULTI_SEG_F;
 
+	if ((dev->rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP))
+		flags |= NIX_RX_OFFLOAD_TSTAMP_F;
+
 	if (!dev->ptype_disable)
 		flags |= NIX_RX_OFFLOAD_PTYPE_F;
 
@@ -95,6 +98,9 @@ nix_tx_offload_flags(struct rte_eth_dev *eth_dev)
 		flags |= (NIX_TX_OFFLOAD_TSO_F | NIX_TX_OFFLOAD_OL3_OL4_CSUM_F |
 			  NIX_TX_OFFLOAD_L3_L4_CSUM_F);
 
+	if ((dev->rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP))
+		flags |= NIX_TX_OFFLOAD_TSTAMP_F;
+
 	return flags;
 }
 
@@ -121,6 +127,7 @@ nix_form_default_desc(struct cnxk_eth_dev *dev, struct cn10k_eth_txq *txq,
 {
 	struct nix_send_ext_s *send_hdr_ext;
 	union nix_send_hdr_w0_u send_hdr_w0;
+	struct nix_send_mem_s *send_mem;
 	union nix_send_sg_s sg_w0;
 
 	RTE_SET_USED(dev);
@@ -136,6 +143,22 @@ nix_form_default_desc(struct cnxk_eth_dev *dev, struct cn10k_eth_txq *txq,
 
 		send_hdr_ext = (struct nix_send_ext_s *)&txq->cmd[0];
 		send_hdr_ext->w0.subdc = NIX_SUBDC_EXT;
+		if (dev->tx_offload_flags & NIX_TX_OFFLOAD_TSTAMP_F) {
+			/* Default: one seg packet would have:
+			 * 2(HDR) + 2(EXT) + 1(SG) + 1(IOVA) + 2(MEM)
+			 * => 8/2 - 1 = 3
+			 */
+			send_hdr_w0.sizem1 = 3;
+			send_hdr_ext->w0.tstmp = 1;
+
+			/* To calculate the offset for send_mem,
+			 * send_hdr->w0.sizem1 * 2
+			 */
+			send_mem = (struct nix_send_mem_s *)(txq->cmd + 2);
+			send_mem->w0.subdc = NIX_SUBDC_MEM;
+			send_mem->w0.alg = NIX_SENDMEMALG_SETTSTMP;
+			send_mem->addr = dev->tstamp.tx_tstamp_iova;
+		}
 	} else {
 		/* 2(HDR) + 1(SG) + 1(IOVA) = 4/2 - 1 = 1 */
 		send_hdr_w0.sizem1 = 1;
@@ -221,6 +244,7 @@ cn10k_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 	rxq->wdata = cq->wdata;
 	rxq->head = cq->head;
 	rxq->qmask = cq->qmask;
+	rxq->tstamp = &dev->tstamp;
 
 	/* Data offset from data to start of mbuf is first_skip */
 	rxq->data_off = rq->first_skip;
@@ -342,6 +366,7 @@ static int
 cn10k_nix_dev_start(struct rte_eth_dev *eth_dev)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	struct roc_nix *nix = &dev->nix;
 	int rc;
 
 	/* Common eth dev start */
@@ -349,6 +374,12 @@ cn10k_nix_dev_start(struct rte_eth_dev *eth_dev)
 	if (rc)
 		return rc;
 
+	/* Update VF about data off shifted by 8 bytes if PTP already
+	 * enabled in PF owning this VF
+	 */
+	if (dev->ptp_en && (!roc_nix_is_pf(nix) && (!roc_nix_is_sdp(nix))))
+		nix_ptp_enable_vf(eth_dev);
+
 	/* Setting up the rx[tx]_offload_flags due to change
 	 * in rx[tx]_offloads.
 	 */
drivers/net/cnxk/cn10k_ethdev.h +1 -0
index d39ca31..8b6e0f2 100644
@@ -31,6 +31,7 @@ struct cn10k_eth_rxq {
 	uint32_t available;
 	uint16_t data_off;
 	uint16_t rq;
+	struct cnxk_timesync_info *tstamp;
 } __plt_cache_aligned;
 
 /* Rx and Tx routines */
drivers/net/cnxk/cn10k_rx.c +18 -14
index 0598111..c9744e2 100644
@@ -5,7 +5,7 @@
 #include "cn10k_ethdev.h"
 #include "cn10k_rx.h"
 
-#define R(name, f3, f2, f1, f0, flags)					       \
+#define R(name, f4, f3, f2, f1, f0, flags)				       \
 	uint16_t __rte_noinline __rte_hot cn10k_nix_recv_pkts_##name(	       \
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
@@ -17,12 +17,13 @@ NIX_RX_FASTPATH_MODES
 
 static inline void
 pick_rx_func(struct rte_eth_dev *eth_dev,
-	     const eth_rx_burst_t rx_burst[2][2][2][2])
+	     const eth_rx_burst_t rx_burst[2][2][2][2][2])
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
-	/* [MARK] [CKSUM] [PTYPE] [RSS] */
+	/* [TSP] [MARK] [CKSUM] [PTYPE] [RSS] */
 	eth_dev->rx_pkt_burst = rx_burst
+		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_TSTAMP_F)]
 		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_MARK_UPDATE_F)]
 		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_CHECKSUM_F)]
 		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_PTYPE_F)]
@@ -34,31 +35,34 @@ cn10k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
-	const eth_rx_burst_t nix_eth_rx_burst[2][2][2][2] = {
-#define R(name, f3, f2, f1, f0, flags)					      \
-	[f3][f2][f1][f0] = cn10k_nix_recv_pkts_##name,
+	const eth_rx_burst_t nix_eth_rx_burst[2][2][2][2][2] = {
+#define R(name, f4, f3, f2, f1, f0, flags)				       \
+	[f4][f3][f2][f1][f0] = cn10k_nix_recv_pkts_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const eth_rx_burst_t nix_eth_rx_burst_mseg[2][2][2][2] = {
-#define R(name, f3, f2, f1, f0, flags)					      \
-	[f3][f2][f1][f0] = cn10k_nix_recv_pkts_mseg_##name,
+	const eth_rx_burst_t nix_eth_rx_burst_mseg[2][2][2][2][2] = {
+#define R(name, f4, f3, f2, f1, f0, flags)				       \
+	[f4][f3][f2][f1][f0] = cn10k_nix_recv_pkts_mseg_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const eth_rx_burst_t nix_eth_rx_vec_burst[2][2][2][2] = {
-#define R(name, f3, f2, f1, f0, flags)					      \
-	[f3][f2][f1][f0] = cn10k_nix_recv_pkts_vec_##name,
+	const eth_rx_burst_t nix_eth_rx_vec_burst[2][2][2][2][2] = {
+#define R(name, f4, f3, f2, f1, f0, flags)				       \
+	[f4][f3][f2][f1][f0] = cn10k_nix_recv_pkts_vec_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	if (dev->scalar_ena)
+	/* For PTP enabled, scalar rx function should be chosen as most of the
+	 * PTP apps are implemented to rx burst 1 pkt.
+	 */
+	if (dev->scalar_ena || dev->rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP)
 		pick_rx_func(eth_dev, nix_eth_rx_burst);
 	else
 		pick_rx_func(eth_dev, nix_eth_rx_vec_burst);
@@ -69,6 +73,6 @@ cn10k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
 	/* Copy multi seg version with no offload for tear down sequence */
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
 		dev->rx_pkt_burst_no_offload =
-			nix_eth_rx_burst_mseg[0][0][0][0];
+			nix_eth_rx_burst_mseg[0][0][0][0][0];
 	rte_mb();
 }
drivers/net/cnxk/cn10k_rx.h +42 -19

81 lines not on this page · raw message

drivers/net/cnxk/cn10k_rx_mseg.c +1 -1
index 9d283f7..b67d21f 100644
@@ -5,7 +5,7 @@
 #include "cn10k_ethdev.h"
 #include "cn10k_rx.h"
 
-#define R(name, f3, f2, f1, f0, flags)                                         \
+#define R(name, f4, f3, f2, f1, f0, flags)                                     \
 	uint16_t __rte_noinline __rte_hot cn10k_nix_recv_pkts_mseg_##name(     \
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
drivers/net/cnxk/cn10k_rx_vec.c +4 -1
index 0fa079c..1330235 100644
@@ -5,12 +5,15 @@
 #include "cn10k_ethdev.h"
 #include "cn10k_rx.h"
 
-#define R(name, f3, f2, f1, f0, flags)					       \
+#define R(name, f4, f3, f2, f1, f0, flags)				       \
 	uint16_t __rte_noinline __rte_hot				       \
 		cn10k_nix_recv_pkts_vec_##name(void *rx_queue,                 \
 					       struct rte_mbuf **rx_pkts,      \
 					       uint16_t pkts)                  \
 	{                                                                      \
+		/* TSTMP is not supported by vector */                         \
+		if ((flags) & NIX_RX_OFFLOAD_TSTAMP_F)                         \
+			return 0;                                              \
 		return cn10k_nix_recv_pkts_vector(rx_queue, rx_pkts, pkts,     \
 						  (flags));		       \
 	}
drivers/net/cnxk/cn10k_tx.c +15 -13
index e6eb101..18694dc 100644
@@ -5,7 +5,7 @@
 #include "cn10k_ethdev.h"
 #include "cn10k_tx.h"
 
-#define T(name, f4, f3, f2, f1, f0, sz, flags)				       \
+#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
 	uint16_t __rte_noinline __rte_hot cn10k_nix_xmit_pkts_##name(	       \
 		void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t pkts)      \
 	{                                                                      \
@@ -24,12 +24,13 @@ NIX_TX_FASTPATH_MODES
 
 static inline void
 pick_tx_func(struct rte_eth_dev *eth_dev,
-	     const eth_tx_burst_t tx_burst[2][2][2][2][2])
+	     const eth_tx_burst_t tx_burst[2][2][2][2][2][2])
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
-	/* [TSO] [NOFF] [VLAN] [OL3_OL4_CSUM] [IL3_IL4_CSUM] */
+	/* [TSP] [TSO] [NOFF] [VLAN] [OL3_OL4_CSUM] [IL3_IL4_CSUM] */
 	eth_dev->tx_pkt_burst = tx_burst
+		[!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_TSTAMP_F)]
 		[!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_TSO_F)]
 		[!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_MBUF_NOFF_F)]
 		[!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_VLAN_QINQ_F)]
@@ -42,25 +43,25 @@ cn10k_eth_set_tx_function(struct rte_eth_dev *eth_dev)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
-	const eth_tx_burst_t nix_eth_tx_burst[2][2][2][2][2] = {
-#define T(name, f4, f3, f2, f1, f0, sz, flags)                         \
-	[f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_##name,
+	const eth_tx_burst_t nix_eth_tx_burst[2][2][2][2][2][2] = {
+#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
+	[f5][f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_##name,
 
 		NIX_TX_FASTPATH_MODES
 #undef T
 	};
 
-	const eth_tx_burst_t nix_eth_tx_burst_mseg[2][2][2][2][2] = {
-#define T(name, f4, f3, f2, f1, f0, sz, flags)				\
-	[f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_mseg_##name,
+	const eth_tx_burst_t nix_eth_tx_burst_mseg[2][2][2][2][2][2] = {
+#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
+	[f5][f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_mseg_##name,
 
 		NIX_TX_FASTPATH_MODES
 #undef T
 	};
 
-	const eth_tx_burst_t nix_eth_tx_vec_burst[2][2][2][2][2] = {
-#define T(name, f4, f3, f2, f1, f0, sz, flags)                         \
-	[f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_vec_##name,
+	const eth_tx_burst_t nix_eth_tx_vec_burst[2][2][2][2][2][2] = {
+#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)                             \
+	[f5][f4][f3][f2][f1][f0] = cn10k_nix_xmit_pkts_vec_##name,
 
 		NIX_TX_FASTPATH_MODES
 #undef T
@@ -68,7 +69,8 @@ cn10k_eth_set_tx_function(struct rte_eth_dev *eth_dev)
 
 	if (dev->scalar_ena ||
 	    (dev->tx_offload_flags &
-	     (NIX_TX_OFFLOAD_VLAN_QINQ_F | NIX_TX_OFFLOAD_TSO_F)))
+	     (NIX_TX_OFFLOAD_VLAN_QINQ_F | NIX_TX_OFFLOAD_TSTAMP_F |
+	      NIX_TX_OFFLOAD_TSO_F)))
 		pick_tx_func(eth_dev, nix_eth_tx_burst);
 	else
 		pick_tx_func(eth_dev, nix_eth_tx_vec_burst);
drivers/net/cnxk/cn10k_tx.h +154 -39

275 lines not on this page · raw message

drivers/net/cnxk/cn10k_tx_mseg.c +1 -1
index 6ae6907..33f6754 100644
@@ -5,7 +5,7 @@
 #include "cn10k_ethdev.h"
 #include "cn10k_tx.h"
 
-#define T(name, f4, f3, f2, f1, f0, sz, flags)				       \
+#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
 	uint16_t __rte_noinline __rte_hot				       \
 		cn10k_nix_xmit_pkts_mseg_##name(void *tx_queue,                \
 						struct rte_mbuf **tx_pkts,     \
drivers/net/cnxk/cn10k_tx_vec.c +2 -1
index 42baeb5..7453f3b 100644
@@ -5,7 +5,7 @@
 #include "cn10k_ethdev.h"
 #include "cn10k_tx.h"
 
-#define T(name, f4, f3, f2, f1, f0, sz, flags)				       \
+#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
 	uint16_t __rte_noinline __rte_hot				       \
 		cn10k_nix_xmit_pkts_vec_##name(void *tx_queue,                 \
 					       struct rte_mbuf **tx_pkts,      \
@@ -15,6 +15,7 @@
 									       \
 		/* VLAN, TSTMP, TSO is not supported by vec */                 \
 		if ((flags) & NIX_TX_OFFLOAD_VLAN_QINQ_F ||		       \
+		    (flags) & NIX_TX_OFFLOAD_TSTAMP_F ||		       \
 		    (flags) & NIX_TX_OFFLOAD_TSO_F)			       \
 			return 0;                                              \
 		return cn10k_nix_xmit_pkts_vector(tx_queue, tx_pkts, pkts, cmd,\
drivers/net/cnxk/cn9k_ethdev.c +32 -2
index 63b13eb..0d63604 100644
@@ -30,6 +30,9 @@ nix_rx_offload_flags(struct rte_eth_dev *eth_dev)
 	if (dev->rx_offloads & DEV_RX_OFFLOAD_SCATTER)
 		flags |= NIX_RX_MULTI_SEG_F;
 
+	if ((dev->rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP))
+		flags |= NIX_RX_OFFLOAD_TSTAMP_F;
+
 	if (!dev->ptype_disable)
 		flags |= NIX_RX_OFFLOAD_PTYPE_F;
 
@@ -95,6 +98,9 @@ nix_tx_offload_flags(struct rte_eth_dev *eth_dev)
 		flags |= (NIX_TX_OFFLOAD_TSO_F | NIX_TX_OFFLOAD_OL3_OL4_CSUM_F |
 			  NIX_TX_OFFLOAD_L3_L4_CSUM_F);
 
+	if ((dev->rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP))
+		flags |= NIX_TX_OFFLOAD_TSTAMP_F;
+
 	return flags;
 }
 
@@ -121,10 +127,9 @@ nix_form_default_desc(struct cnxk_eth_dev *dev, struct cn9k_eth_txq *txq,
 {
 	struct nix_send_ext_s *send_hdr_ext;
 	struct nix_send_hdr_s *send_hdr;
+	struct nix_send_mem_s *send_mem;
 	union nix_send_sg_s *sg;
 
-	RTE_SET_USED(dev);
-
 	/* Initialize the fields based on basic single segment packet */
 	memset(&txq->cmd, 0, sizeof(txq->cmd));
 
@@ -135,6 +140,23 @@ nix_form_default_desc(struct cnxk_eth_dev *dev, struct cn9k_eth_txq *txq,
 
 		send_hdr_ext = (struct nix_send_ext_s *)&txq->cmd[2];
 		send_hdr_ext->w0.subdc = NIX_SUBDC_EXT;
+		if (dev->tx_offload_flags & NIX_TX_OFFLOAD_TSTAMP_F) {
+			/* Default: one seg packet would have:
+			 * 2(HDR) + 2(EXT) + 1(SG) + 1(IOVA) + 2(MEM)
+			 * => 8/2 - 1 = 3
+			 */
+			send_hdr->w0.sizem1 = 3;
+			send_hdr_ext->w0.tstmp = 1;
+
+			/* To calculate the offset for send_mem,
+			 * send_hdr->w0.sizem1 * 2
+			 */
+			send_mem = (struct nix_send_mem_s *)
+				(txq->cmd + (send_hdr->w0.sizem1 << 1));
+			send_mem->w0.cn9k.subdc = NIX_SUBDC_MEM;
+			send_mem->w0.cn9k.alg = NIX_SENDMEMALG_SETTSTMP;
+			send_mem->addr = dev->tstamp.tx_tstamp_iova;
+		}
 		sg = (union nix_send_sg_s *)&txq->cmd[4];
 	} else {
 		send_hdr = (struct nix_send_hdr_s *)&txq->cmd[0];
@@ -219,6 +241,7 @@ cn9k_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 	rxq->wdata = cq->wdata;
 	rxq->head = cq->head;
 	rxq->qmask = cq->qmask;
+	rxq->tstamp = &dev->tstamp;
 
 	/* Data offset from data to start of mbuf is first_skip */
 	rxq->data_off = rq->first_skip;
@@ -351,6 +374,7 @@ static int
 cn9k_nix_dev_start(struct rte_eth_dev *eth_dev)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	struct roc_nix *nix = &dev->nix;
 	int rc;
 
 	/* Common eth dev start */
@@ -358,6 +382,12 @@ cn9k_nix_dev_start(struct rte_eth_dev *eth_dev)
 	if (rc)
 		return rc;
 
+	/* Update VF about data off shifted by 8 bytes if PTP already
+	 * enabled in PF owning this VF
+	 */
+	if (dev->ptp_en && (!roc_nix_is_pf(nix) && (!roc_nix_is_sdp(nix))))
+		nix_ptp_enable_vf(eth_dev);
+
 	/* Setting up the rx[tx]_offload_flags due to change
 	 * in rx[tx]_offloads.
 	 */
drivers/net/cnxk/cn9k_ethdev.h +1 -0
index f8344e3..3d4a206 100644
@@ -29,6 +29,7 @@ struct cn9k_eth_rxq {
 	uint32_t qmask;
 	uint32_t available;
 	uint16_t rq;
+	struct cnxk_timesync_info *tstamp;
 } __plt_cache_aligned;
 
 /* Rx and Tx routines */
drivers/net/cnxk/cn9k_rx.c +18 -14
index 01eb21f..a15428d 100644
@@ -5,7 +5,7 @@
 #include "cn9k_ethdev.h"
 #include "cn9k_rx.h"
 
-#define R(name, f3, f2, f1, f0, flags)					       \
+#define R(name, f4, f3, f2, f1, f0, flags)				       \
 	uint16_t __rte_noinline __rte_hot cn9k_nix_recv_pkts_##name(	       \
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
@@ -17,12 +17,13 @@ NIX_RX_FASTPATH_MODES
 
 static inline void
 pick_rx_func(struct rte_eth_dev *eth_dev,
-	     const eth_rx_burst_t rx_burst[2][2][2][2])
+	     const eth_rx_burst_t rx_burst[2][2][2][2][2])
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
-	/* [MARK] [CKSUM] [PTYPE] [RSS] */
+	/* [TSP] [MARK] [CKSUM] [PTYPE] [RSS] */
 	eth_dev->rx_pkt_burst = rx_burst
+		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_TSTAMP_F)]
 		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_MARK_UPDATE_F)]
 		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_CHECKSUM_F)]
 		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_PTYPE_F)]
@@ -34,31 +35,34 @@ cn9k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
-	const eth_rx_burst_t nix_eth_rx_burst[2][2][2][2] = {
-#define R(name, f3, f2, f1, f0, flags)					\
-	[f3][f2][f1][f0] = cn9k_nix_recv_pkts_##name,
+	const eth_rx_burst_t nix_eth_rx_burst[2][2][2][2][2] = {
+#define R(name, f4, f3, f2, f1, f0, flags)				       \
+	[f4][f3][f2][f1][f0] = cn9k_nix_recv_pkts_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const eth_rx_burst_t nix_eth_rx_burst_mseg[2][2][2][2] = {
-#define R(name, f3, f2, f1, f0, flags)					\
-	[f3][f2][f1][f0] = cn9k_nix_recv_pkts_mseg_##name,
+	const eth_rx_burst_t nix_eth_rx_burst_mseg[2][2][2][2][2] = {
+#define R(name, f4, f3, f2, f1, f0, flags)				       \
+	[f4][f3][f2][f1][f0] = cn9k_nix_recv_pkts_mseg_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const eth_rx_burst_t nix_eth_rx_vec_burst[2][2][2][2] = {
-#define R(name, f3, f2, f1, f0, flags)					\
-	[f3][f2][f1][f0] = cn9k_nix_recv_pkts_vec_##name,
+	const eth_rx_burst_t nix_eth_rx_vec_burst[2][2][2][2][2] = {
+#define R(name, f4, f3, f2, f1, f0, flags)				       \
+	[f4][f3][f2][f1][f0] = cn9k_nix_recv_pkts_vec_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	if (dev->scalar_ena)
+	/* For PTP enabled, scalar rx function should be chosen as most of the
+	 * PTP apps are implemented to rx burst 1 pkt.
+	 */
+	if (dev->scalar_ena || dev->rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP)
 		pick_rx_func(eth_dev, nix_eth_rx_burst);
 	else
 		pick_rx_func(eth_dev, nix_eth_rx_vec_burst);
@@ -69,6 +73,6 @@ cn9k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
 	/* Copy multi seg version with no offload for tear down sequence */
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
 		dev->rx_pkt_burst_no_offload =
-			nix_eth_rx_burst_mseg[0][0][0][0];
+			nix_eth_rx_burst_mseg[0][0][0][0][0];
 	rte_mb();
 }
drivers/net/cnxk/cn9k_rx.h +42 -19

81 lines not on this page · raw message

drivers/net/cnxk/cn9k_rx_mseg.c +1 -1
index 6ad8c1d..3b26962 100644
@@ -5,7 +5,7 @@
 #include "cn9k_ethdev.h"
 #include "cn9k_rx.h"
 
-#define R(name, f3, f2, f1, f0, flags)                                         \
+#define R(name, f4, f3, f2, f1, f0, flags)                                     \
 	uint16_t __rte_noinline __rte_hot cn9k_nix_recv_pkts_mseg_##name(      \
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
drivers/net/cnxk/cn9k_rx_vec.c +4 -1
index 997177f..b19c7f3 100644
@@ -5,10 +5,13 @@
 #include "cn9k_ethdev.h"
 #include "cn9k_rx.h"
 
-#define R(name, f3, f2, f1, f0, flags)                                         \
+#define R(name, f4, f3, f2, f1, f0, flags)				       \
 	uint16_t __rte_noinline __rte_hot cn9k_nix_recv_pkts_vec_##name(       \
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
+		/* TSTMP is not supported by vector */                         \
+		if ((flags) & NIX_RX_OFFLOAD_TSTAMP_F)                         \
+			return 0;                                              \
 		return cn9k_nix_recv_pkts_vector(rx_queue, rx_pkts, pkts,      \
 						 (flags));                     \
 	}
drivers/net/cnxk/cn9k_tx.c +15 -13
index 2ff9720..b802606 100644
@@ -5,7 +5,7 @@
 #include "cn9k_ethdev.h"
 #include "cn9k_tx.h"
 
-#define T(name, f4, f3, f2, f1, f0, sz, flags)				       \
+#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
 	uint16_t __rte_noinline __rte_hot cn9k_nix_xmit_pkts_##name(	       \
 		void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t pkts)      \
 	{                                                                      \
@@ -23,12 +23,13 @@ NIX_TX_FASTPATH_MODES
 
 static inline void
 pick_tx_func(struct rte_eth_dev *eth_dev,
-	     const eth_tx_burst_t tx_burst[2][2][2][2][2])
+	     const eth_tx_burst_t tx_burst[2][2][2][2][2][2])
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
-	/* [TSO] [NOFF] [VLAN] [OL3_OL4_CSUM] [IL3_IL4_CSUM] */
+	/* [TS] [TSO] [NOFF] [VLAN] [OL3_OL4_CSUM] [IL3_IL4_CSUM] */
 	eth_dev->tx_pkt_burst = tx_burst
+		[!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_TSTAMP_F)]
 		[!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_TSO_F)]
 		[!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_MBUF_NOFF_F)]
 		[!!(dev->tx_offload_flags & NIX_TX_OFFLOAD_VLAN_QINQ_F)]
@@ -41,25 +42,25 @@ cn9k_eth_set_tx_function(struct rte_eth_dev *eth_dev)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
-	const eth_tx_burst_t nix_eth_tx_burst[2][2][2][2][2] = {
-#define T(name, f4, f3, f2, f1, f0, sz, flags)				       \
-	[f4][f3][f2][f1][f0] = cn9k_nix_xmit_pkts_##name,
+	const eth_tx_burst_t nix_eth_tx_burst[2][2][2][2][2][2] = {
+#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
+	[f5][f4][f3][f2][f1][f0] = cn9k_nix_xmit_pkts_##name,
 
 		NIX_TX_FASTPATH_MODES
 #undef T
 	};
 
-	const eth_tx_burst_t nix_eth_tx_burst_mseg[2][2][2][2][2] = {
-#define T(name, f4, f3, f2, f1, f0, sz, flags)				       \
-	[f4][f3][f2][f1][f0] = cn9k_nix_xmit_pkts_mseg_##name,
+	const eth_tx_burst_t nix_eth_tx_burst_mseg[2][2][2][2][2][2] = {
+#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
+	[f5][f4][f3][f2][f1][f0] = cn9k_nix_xmit_pkts_mseg_##name,
 
 		NIX_TX_FASTPATH_MODES
 #undef T
 	};
 
-	const eth_tx_burst_t nix_eth_tx_vec_burst[2][2][2][2][2] = {
-#define T(name, f4, f3, f2, f1, f0, sz, flags)				       \
-	[f4][f3][f2][f1][f0] = cn9k_nix_xmit_pkts_vec_##name,
+	const eth_tx_burst_t nix_eth_tx_vec_burst[2][2][2][2][2][2] = {
+#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
+	[f5][f4][f3][f2][f1][f0] = cn9k_nix_xmit_pkts_vec_##name,
 
 		NIX_TX_FASTPATH_MODES
 #undef T
@@ -67,7 +68,8 @@ cn9k_eth_set_tx_function(struct rte_eth_dev *eth_dev)
 
 	if (dev->scalar_ena ||
 	    (dev->tx_offload_flags &
-	     (NIX_TX_OFFLOAD_VLAN_QINQ_F | NIX_TX_OFFLOAD_TSO_F)))
+	     (NIX_TX_OFFLOAD_VLAN_QINQ_F | NIX_TX_OFFLOAD_TSTAMP_F |
+	      NIX_TX_OFFLOAD_TSO_F)))
 		pick_tx_func(eth_dev, nix_eth_tx_burst);
 	else
 		pick_tx_func(eth_dev, nix_eth_tx_vec_burst);
drivers/net/cnxk/cn9k_tx.h +182 -71

303 lines not on this page · raw message

drivers/net/cnxk/cn9k_tx_mseg.c +1 -1
index 65c5f36..f3c427c 100644
@@ -5,7 +5,7 @@
 #include "cn9k_ethdev.h"
 #include "cn9k_tx.h"
 
-#define T(name, f4, f3, f2, f1, f0, sz, flags)				       \
+#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
 	uint16_t __rte_noinline __rte_hot				       \
 		cn9k_nix_xmit_pkts_mseg_##name(void *tx_queue,                 \
 					       struct rte_mbuf **tx_pkts,      \
drivers/net/cnxk/cn9k_tx_vec.c +2 -1
index 21ffc2c..a6e7c9e 100644
@@ -5,7 +5,7 @@
 #include "cn9k_ethdev.h"
 #include "cn9k_tx.h"
 
-#define T(name, f4, f3, f2, f1, f0, sz, flags)				       \
+#define T(name, f5, f4, f3, f2, f1, f0, sz, flags)			       \
 	uint16_t __rte_noinline __rte_hot				       \
 		cn9k_nix_xmit_pkts_vec_##name(void *tx_queue,                  \
 					      struct rte_mbuf **tx_pkts,       \
@@ -15,6 +15,7 @@
 									       \
 		/* VLAN, TSTMP, TSO is not supported by vec */                 \
 		if ((flags) & NIX_TX_OFFLOAD_VLAN_QINQ_F ||		       \
+		    (flags) & NIX_TX_OFFLOAD_TSTAMP_F ||		       \
 		    (flags) & NIX_TX_OFFLOAD_TSO_F)			       \
 			return 0;                                              \
 		return cn9k_nix_xmit_pkts_vector(tx_queue, tx_pkts, pkts, cmd, \
drivers/net/cnxk/cnxk_ethdev.c +34 -2
index 522f7ec..fc91346 100644
@@ -150,7 +150,8 @@ cnxk_nix_rxq_mbuf_setup(struct cnxk_eth_dev *dev)
 				 offsetof(struct rte_mbuf, data_off) !=
 			 6);
 	mb_def.nb_segs = 1;
-	mb_def.data_off = RTE_PKTMBUF_HEADROOM;
+	mb_def.data_off = RTE_PKTMBUF_HEADROOM +
+			  (dev->ptp_en * CNXK_NIX_TIMESYNC_RX_OFFSET);
 	mb_def.port = port_id;
 	rte_mbuf_refcnt_set(&mb_def, 1);
 
@@ -356,6 +357,18 @@ cnxk_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
 	eth_dev->data->rx_queues[qid] = rxq_sp + 1;
 	eth_dev->data->rx_queue_state[qid] = RTE_ETH_QUEUE_STATE_STOPPED;
 
+	/* Calculating delta and freq mult between PTP HI clock and tsc.
+	 * These are needed in deriving raw clock value from tsc counter.
+	 * read_clock eth op returns raw clock value.
+	 */
+	if ((dev->rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP) || dev->ptp_en) {
+		rc = cnxk_nix_tsc_convert(dev);
+		if (rc) {
+			plt_err("Failed to calculate delta and freq mult");
+			goto rq_fini;
+		}
+	}
+
 	return 0;
 rq_fini:
 	rc |= roc_nix_rq_fini(rq);
@@ -1124,7 +1137,7 @@ cnxk_nix_dev_start(struct rte_eth_dev *eth_dev)
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 	int rc, i;
 
-	if (eth_dev->data->nb_rx_queues != 0) {
+	if (eth_dev->data->nb_rx_queues != 0 && !dev->ptp_en) {
 		rc = nix_recalc_mtu(eth_dev);
 		if (rc)
 			return rc;
@@ -1169,6 +1182,25 @@ cnxk_nix_dev_start(struct rte_eth_dev *eth_dev)
 		}
 	}
 
+	/* Enable PTP if it is requested by the user or already
+	 * enabled on PF owning this VF
+	 */
+	memset(&dev->tstamp, 0, sizeof(struct cnxk_timesync_info));
+	if ((dev->rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP) || dev->ptp_en)
+		cnxk_eth_dev_ops.timesync_enable(eth_dev);
+	else
+		cnxk_eth_dev_ops.timesync_disable(eth_dev);
+
+	if (dev->rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP) {
+		rc = rte_mbuf_dyn_rx_timestamp_register
+			(&dev->tstamp.tstamp_dynfield_offset,
+			 &dev->tstamp.rx_tstamp_dynflag);
+		if (rc != 0) {
+			plt_err("Failed to register Rx timestamp field/flag");
+			goto rx_disable;
+		}
+	}
+
 	cnxk_nix_toggle_flag_link_cfg(dev, false);
 
 	return 0;
drivers/net/cnxk/cnxk_ethdev.h +63 -1

105 lines not on this page · raw message

drivers/net/cnxk/cnxk_ptp.c new file +169 -0

169 lines not on this page · raw message

drivers/net/cnxk/meson.build +1 -0
index df953fd..2071d0d 100644
@@ -13,6 +13,7 @@ sources = files('cnxk_ethdev.c',
 		'cnxk_ethdev_devargs.c',
 		'cnxk_link.c',
 		'cnxk_lookup.c',
+		'cnxk_ptp.c',
 		'cnxk_rte_flow.c',
 		'cnxk_stats.c')
 
Signature · 1 line
2.8.4
#251 lore raw

PATCH v4 56/62 net/cnxk: add timesync enable/disable operations

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

Patch implements timesync enable/disable operations for cn9k and cn10k platforms.

---
 drivers/net/cnxk/cn10k_ethdev.c | 50 +++++++++++++++++++++++++++++++++++++++++
 drivers/net/cnxk/cn9k_ethdev.c  | 50 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 100 insertions(+)
drivers/net/cnxk/cn10k_ethdev.c +50 -0
index 5e0de13..b079edb 100644
@@ -363,6 +363,54 @@ cn10k_nix_ptp_info_update_cb(struct roc_nix *nix, bool ptp_en)
 }
 
 static int
+cn10k_nix_timesync_enable(struct rte_eth_dev *eth_dev)
+{
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	int i, rc;
+
+	rc = cnxk_nix_timesync_enable(eth_dev);
+	if (rc)
+		return rc;
+
+	dev->rx_offload_flags |= NIX_RX_OFFLOAD_TSTAMP_F;
+	dev->tx_offload_flags |= NIX_TX_OFFLOAD_TSTAMP_F;
+
+	for (i = 0; i < eth_dev->data->nb_tx_queues; i++)
+		nix_form_default_desc(dev, eth_dev->data->tx_queues[i], i);
+
+	/* Setting up the rx[tx]_offload_flags due to change
+	 * in rx[tx]_offloads.
+	 */
+	cn10k_eth_set_rx_function(eth_dev);
+	cn10k_eth_set_tx_function(eth_dev);
+	return 0;
+}
+
+static int
+cn10k_nix_timesync_disable(struct rte_eth_dev *eth_dev)
+{
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	int i, rc;
+
+	rc = cnxk_nix_timesync_disable(eth_dev);
+	if (rc)
+		return rc;
+
+	dev->rx_offload_flags &= ~NIX_RX_OFFLOAD_TSTAMP_F;
+	dev->tx_offload_flags &= ~NIX_TX_OFFLOAD_TSTAMP_F;
+
+	for (i = 0; i < eth_dev->data->nb_tx_queues; i++)
+		nix_form_default_desc(dev, eth_dev->data->tx_queues[i], i);
+
+	/* Setting up the rx[tx]_offload_flags due to change
+	 * in rx[tx]_offloads.
+	 */
+	cn10k_eth_set_rx_function(eth_dev);
+	cn10k_eth_set_tx_function(eth_dev);
+	return 0;
+}
+
+static int
 cn10k_nix_dev_start(struct rte_eth_dev *eth_dev)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
@@ -408,6 +456,8 @@ nix_eth_dev_ops_override(void)
 	cnxk_eth_dev_ops.tx_queue_stop = cn10k_nix_tx_queue_stop;
 	cnxk_eth_dev_ops.dev_start = cn10k_nix_dev_start;
 	cnxk_eth_dev_ops.dev_ptypes_set = cn10k_nix_ptypes_set;
+	cnxk_eth_dev_ops.timesync_enable = cn10k_nix_timesync_enable;
+	cnxk_eth_dev_ops.timesync_disable = cn10k_nix_timesync_disable;
 }
 
 static void
drivers/net/cnxk/cn9k_ethdev.c +50 -0

62 lines not on this page · raw message

Signature · 1 line
2.8.4
#252 lore raw

PATCH v4 57/62 net/cnxk: add Rx/Tx timestamp read operations

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

Patch implements Rx/Tx timestamp read operations for cn9k and cn10k platforms.

---
 drivers/net/cnxk/cnxk_ethdev.c |  2 ++
 drivers/net/cnxk/cnxk_ethdev.h |  5 +++++
 drivers/net/cnxk/cnxk_ptp.c    | 38 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 45 insertions(+)
drivers/net/cnxk/cnxk_ethdev.c +2 -0
index fc91346..cb583b4 100644
@@ -1260,6 +1260,8 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
 	.tx_done_cleanup = cnxk_nix_tx_done_cleanup,
 	.flow_ops_get = cnxk_nix_flow_ops_get,
 	.get_reg = cnxk_nix_dev_get_reg,
+	.timesync_read_rx_timestamp = cnxk_nix_timesync_read_rx_timestamp,
+	.timesync_read_tx_timestamp = cnxk_nix_timesync_read_tx_timestamp,
 };
 
 static int
drivers/net/cnxk/cnxk_ethdev.h +5 -0
index de6d533..76df84a 100644
@@ -312,6 +312,11 @@ int cnxk_nix_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t qid);
 int cnxk_nix_dev_start(struct rte_eth_dev *eth_dev);
 int cnxk_nix_timesync_enable(struct rte_eth_dev *eth_dev);
 int cnxk_nix_timesync_disable(struct rte_eth_dev *eth_dev);
+int cnxk_nix_timesync_read_rx_timestamp(struct rte_eth_dev *eth_dev,
+					struct timespec *timestamp,
+					uint32_t flags);
+int cnxk_nix_timesync_read_tx_timestamp(struct rte_eth_dev *eth_dev,
+					struct timespec *timestamp);
 int cnxk_nix_tsc_convert(struct cnxk_eth_dev *dev);
 
 uint64_t cnxk_nix_rxq_mbuf_setup(struct cnxk_eth_dev *dev);
drivers/net/cnxk/cnxk_ptp.c +38 -0
index fc317965..7b00f87 100644
@@ -56,6 +56,44 @@ cnxk_nix_tsc_convert(struct cnxk_eth_dev *dev)
 }
 
 int
+cnxk_nix_timesync_read_rx_timestamp(struct rte_eth_dev *eth_dev,
+				    struct timespec *timestamp, uint32_t flags)
+{
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	struct cnxk_timesync_info *tstamp = &dev->tstamp;
+	uint64_t ns;
+
+	PLT_SET_USED(flags);
+
+	if (!tstamp->rx_ready)
+		return -EINVAL;
+
+	ns = rte_timecounter_update(&dev->rx_tstamp_tc, tstamp->rx_tstamp);
+	*timestamp = rte_ns_to_timespec(ns);
+	tstamp->rx_ready = 0;
+	return 0;
+}
+
+int
+cnxk_nix_timesync_read_tx_timestamp(struct rte_eth_dev *eth_dev,
+				    struct timespec *timestamp)
+{
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	struct cnxk_timesync_info *tstamp = &dev->tstamp;
+	uint64_t ns;
+
+	if (*tstamp->tx_tstamp == 0)
+		return -EINVAL;
+
+	ns = rte_timecounter_update(&dev->tx_tstamp_tc, *tstamp->tx_tstamp);
+	*timestamp = rte_ns_to_timespec(ns);
+	*tstamp->tx_tstamp = 0;
+	rte_wmb();
+
+	return 0;
+}
+
+int
 cnxk_nix_timesync_enable(struct rte_eth_dev *eth_dev)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
Signature · 1 line
2.8.4
#253 lore raw

PATCH v4 58/62 net/cnxk: add time read/write/adjust operations

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

Patch implements read/write/adjust time operations for cn9k and cn10k platforms.

---
 drivers/net/cnxk/cnxk_ethdev.c |  3 ++
 drivers/net/cnxk/cnxk_ethdev.h |  5 ++++
 drivers/net/cnxk/cnxk_ptp.c    | 63 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 71 insertions(+)
drivers/net/cnxk/cnxk_ethdev.c +3 -0
index cb583b4..c8bbb7a 100644
@@ -1262,6 +1262,9 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
 	.get_reg = cnxk_nix_dev_get_reg,
 	.timesync_read_rx_timestamp = cnxk_nix_timesync_read_rx_timestamp,
 	.timesync_read_tx_timestamp = cnxk_nix_timesync_read_tx_timestamp,
+	.timesync_read_time = cnxk_nix_timesync_read_time,
+	.timesync_write_time = cnxk_nix_timesync_write_time,
+	.timesync_adjust_time = cnxk_nix_timesync_adjust_time,
 };
 
 static int
drivers/net/cnxk/cnxk_ethdev.h +5 -0
index 76df84a..4214365 100644
@@ -317,6 +317,11 @@ int cnxk_nix_timesync_read_rx_timestamp(struct rte_eth_dev *eth_dev,
 					uint32_t flags);
 int cnxk_nix_timesync_read_tx_timestamp(struct rte_eth_dev *eth_dev,
 					struct timespec *timestamp);
+int cnxk_nix_timesync_read_time(struct rte_eth_dev *eth_dev,
+				struct timespec *ts);
+int cnxk_nix_timesync_write_time(struct rte_eth_dev *eth_dev,
+				 const struct timespec *ts);
+int cnxk_nix_timesync_adjust_time(struct rte_eth_dev *eth_dev, int64_t delta);
 int cnxk_nix_tsc_convert(struct cnxk_eth_dev *dev);
 
 uint64_t cnxk_nix_rxq_mbuf_setup(struct cnxk_eth_dev *dev);
drivers/net/cnxk/cnxk_ptp.c +63 -0

69 lines not on this page · raw message

Signature · 1 line
2.8.4
#254 lore raw

PATCH v4 59/62 net/cnxk: add read clock operation

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

Patch implements read raw clock operation for cn9k and cn10k.

---
 doc/guides/nics/features/cnxk.ini |  2 ++
 drivers/net/cnxk/cnxk_ethdev.c    |  1 +
 drivers/net/cnxk/cnxk_ethdev.h    |  1 +
 drivers/net/cnxk/cnxk_ptp.c       | 17 +++++++++++++++++
 4 files changed, 21 insertions(+)
doc/guides/nics/features/cnxk.ini +2 -0
index eba4107..5874531 100644
@@ -32,6 +32,8 @@ L4 checksum offload  = Y
 Inner L3 checksum    = Y
 Inner L4 checksum    = Y
 Packet type parsing  = Y
+Timesync             = Y
+Timestamp offload    = Y
 Basic stats          = Y
 Stats per queue      = Y
 Extended stats       = Y
drivers/net/cnxk/cnxk_ethdev.c +1 -0
index c8bbb7a..b2a8f3a 100644
@@ -1265,6 +1265,7 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
 	.timesync_read_time = cnxk_nix_timesync_read_time,
 	.timesync_write_time = cnxk_nix_timesync_write_time,
 	.timesync_adjust_time = cnxk_nix_timesync_adjust_time,
+	.read_clock = cnxk_nix_read_clock,
 };
 
 static int
drivers/net/cnxk/cnxk_ethdev.h +1 -0
index 4214365..fa6f16f 100644
@@ -323,6 +323,7 @@ int cnxk_nix_timesync_write_time(struct rte_eth_dev *eth_dev,
 				 const struct timespec *ts);
 int cnxk_nix_timesync_adjust_time(struct rte_eth_dev *eth_dev, int64_t delta);
 int cnxk_nix_tsc_convert(struct cnxk_eth_dev *dev);
+int cnxk_nix_read_clock(struct rte_eth_dev *eth_dev, uint64_t *clock);
 
 uint64_t cnxk_nix_rxq_mbuf_setup(struct cnxk_eth_dev *dev);
 
drivers/net/cnxk/cnxk_ptp.c +17 -0
index 52f6eb1..449489f 100644
@@ -4,6 +4,23 @@
 
 #include "cnxk_ethdev.h"
 
+int
+cnxk_nix_read_clock(struct rte_eth_dev *eth_dev, uint64_t *clock)
+{
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+
+	/* This API returns the raw PTP HI clock value. Since LFs do not
+	 * have direct access to PTP registers and it requires mbox msg
+	 * to AF for this value. In fastpath reading this value for every
+	 * packet (which involes mbox call) becomes very expensive, hence
+	 * we should be able to derive PTP HI clock value from tsc by
+	 * using freq_mult and clk_delta calculated during configure stage.
+	 */
+	*clock = (rte_get_tsc_cycles() + dev->clk_delta) * dev->clk_freq_mult;
+
+	return 0;
+}
+
 /* This function calculates two parameters "clk_freq_mult" and
  * "clk_delta" which is useful in deriving PTP HI clock from
  * timestamp counter (tsc) value.
Signature · 1 line
2.8.4
#255 lore raw

PATCH v4 60/62 net/cnxk: added RETA and RSS hash operations

In reply to Nithin Dabilpuram

From: Satha Rao <[email protected]>

This patch will implement RETA and RSS hash apis. Also added device argument to lock rx context.

---
 doc/guides/nics/features/cnxk.ini      |   2 +
 doc/guides/nics/features/cnxk_vec.ini  |   2 +
 doc/guides/nics/features/cnxk_vf.ini   |   2 +
 drivers/net/cnxk/cnxk_ethdev.c         |   4 ++
 drivers/net/cnxk/cnxk_ethdev.h         |  10 +++
 drivers/net/cnxk/cnxk_ethdev_devargs.c |   4 ++
 drivers/net/cnxk/cnxk_ethdev_ops.c     | 121 +++++++++++++++++++++++++++++++++
 7 files changed, 145 insertions(+)
doc/guides/nics/features/cnxk.ini +2 -0
index 5874531..9945af9 100644
@@ -23,6 +23,8 @@ Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
 RSS hash             = Y
+RSS key update       = Y
+RSS reta update      = Y
 Inner RSS            = Y
 Flow control         = Y
 Jumbo frame          = Y
doc/guides/nics/features/cnxk_vec.ini +2 -0
index 4871fac..77d63c4 100644
@@ -22,6 +22,8 @@ Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
 RSS hash             = Y
+RSS key update       = Y
+RSS reta update      = Y
 Inner RSS            = Y
 Flow control         = Y
 Jumbo frame          = Y
doc/guides/nics/features/cnxk_vf.ini +2 -0
index 81ee7cc..59acfdb 100644
@@ -19,6 +19,8 @@ Queue start/stop     = Y
 MTU update           = Y
 TSO                  = Y
 RSS hash             = Y
+RSS key update       = Y
+RSS reta update      = Y
 Inner RSS            = Y
 Jumbo frame          = Y
 Scattered Rx         = Y
drivers/net/cnxk/cnxk_ethdev.c +4 -0
index b2a8f3a..abd9bf1 100644
@@ -1266,6 +1266,10 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
 	.timesync_write_time = cnxk_nix_timesync_write_time,
 	.timesync_adjust_time = cnxk_nix_timesync_adjust_time,
 	.read_clock = cnxk_nix_read_clock,
+	.reta_update = cnxk_nix_reta_update,
+	.reta_query = cnxk_nix_reta_query,
+	.rss_hash_update = cnxk_nix_rss_hash_update,
+	.rss_hash_conf_get = cnxk_nix_rss_hash_conf_get,
 };
 
 static int
drivers/net/cnxk/cnxk_ethdev.h +10 -0
index fa6f16f..cd08e3a 100644
@@ -330,6 +330,16 @@ uint64_t cnxk_nix_rxq_mbuf_setup(struct cnxk_eth_dev *dev);
 /* RSS */
 uint32_t cnxk_rss_ethdev_to_nix(struct cnxk_eth_dev *dev, uint64_t ethdev_rss,
 				uint8_t rss_level);
+int cnxk_nix_reta_update(struct rte_eth_dev *eth_dev,
+			 struct rte_eth_rss_reta_entry64 *reta_conf,
+			 uint16_t reta_size);
+int cnxk_nix_reta_query(struct rte_eth_dev *eth_dev,
+			struct rte_eth_rss_reta_entry64 *reta_conf,
+			uint16_t reta_size);
+int cnxk_nix_rss_hash_update(struct rte_eth_dev *eth_dev,
+			     struct rte_eth_rss_conf *rss_conf);
+int cnxk_nix_rss_hash_conf_get(struct rte_eth_dev *eth_dev,
+			       struct rte_eth_rss_conf *rss_conf);
 
 /* Link */
 void cnxk_nix_toggle_flag_link_cfg(struct cnxk_eth_dev *dev, bool set);
drivers/net/cnxk/cnxk_ethdev_devargs.c +4 -0
index 7fd06eb..c76b628 100644
@@ -109,6 +109,7 @@ parse_switch_header_type(const char *key, const char *value, void *extra_args)
 #define CNXK_FLOW_MAX_PRIORITY	"flow_max_priority"
 #define CNXK_SWITCH_HEADER_TYPE "switch_header"
 #define CNXK_RSS_TAG_AS_XOR	"tag_as_xor"
+#define CNXK_LOCK_RX_CTX	"lock_rx_ctx"
 
 int
 cnxk_ethdev_parse_devargs(struct rte_devargs *devargs, struct cnxk_eth_dev *dev)
@@ -120,6 +121,7 @@ cnxk_ethdev_parse_devargs(struct rte_devargs *devargs, struct cnxk_eth_dev *dev)
 	uint16_t flow_max_priority = 3;
 	uint16_t rss_tag_as_xor = 0;
 	uint16_t scalar_enable = 0;
+	uint8_t lock_rx_ctx = 0;
 	struct rte_kvargs *kvlist;
 
 	if (devargs == NULL)
@@ -143,6 +145,7 @@ cnxk_ethdev_parse_devargs(struct rte_devargs *devargs, struct cnxk_eth_dev *dev)
 			   &parse_switch_header_type, &switch_header_type);
 	rte_kvargs_process(kvlist, CNXK_RSS_TAG_AS_XOR, &parse_flag,
 			   &rss_tag_as_xor);
+	rte_kvargs_process(kvlist, CNXK_LOCK_RX_CTX, &parse_flag, &lock_rx_ctx);
 	rte_kvargs_free(kvlist);
 
 null_devargs:
@@ -150,6 +153,7 @@ cnxk_ethdev_parse_devargs(struct rte_devargs *devargs, struct cnxk_eth_dev *dev)
 	dev->nix.rss_tag_as_xor = !!rss_tag_as_xor;
 	dev->nix.max_sqb_count = sqb_count;
 	dev->nix.reta_sz = reta_sz;
+	dev->nix.lock_rx_ctx = lock_rx_ctx;
 	dev->npc.flow_prealloc_size = flow_prealloc_size;
 	dev->npc.flow_max_priority = flow_max_priority;
 	dev->npc.switch_header_type = switch_header_type;
drivers/net/cnxk/cnxk_ethdev_ops.c +121 -0

124 lines not on this page · raw message

Signature · 1 line
2.8.4
#256 lore raw

PATCH v4 61/62 net/cnxk: support multicast filter

In reply to Nithin Dabilpuram

From: Sunil Kumar Kori <[email protected]>

Patch adds multicast filter support for cn9k and cn10k platforms.

CGX DMAC filter table(32 entries) is divided among all LMACs connected to it i.e. if CGX has 4 LMACs then each LMAC can have up to 8 filters. If CGX has 1 LMAC then it can have up to 32 filters.

Above mentioned filter table is used to install unicast and multicast DMAC address filters. Unicast filters are installed via rte_eth_dev_mac_addr_add API while multicast filters are installed via rte_eth_dev_set_mc_addr_list API.

So in total, supported MAC filters are equal to DMAC filters plus mcast filters.

---
 doc/guides/nics/features/cnxk.ini     |  1 +
 doc/guides/nics/features/cnxk_vec.ini |  1 +
 drivers/net/cnxk/cnxk_ethdev.c        |  2 ++
 drivers/net/cnxk/cnxk_ethdev.h        |  4 +++
 drivers/net/cnxk/cnxk_ethdev_ops.c    | 65 +++++++++++++++++++++++++++++++++++
 5 files changed, 73 insertions(+)
doc/guides/nics/features/cnxk.ini +1 -0
index 9945af9..c686ceb 100644
@@ -22,6 +22,7 @@ TSO                  = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
+Multicast MAC filter = Y
 RSS hash             = Y
 RSS key update       = Y
 RSS reta update      = Y
doc/guides/nics/features/cnxk_vec.ini +1 -0
index 77d63c4..018d09e 100644
@@ -21,6 +21,7 @@ MTU update           = Y
 Promiscuous mode     = Y
 Allmulticast mode    = Y
 Unicast MAC filter   = Y
+Multicast MAC filter = Y
 RSS hash             = Y
 RSS key update       = Y
 RSS reta update      = Y
drivers/net/cnxk/cnxk_ethdev.c +2 -0
index abd9bf1..b7872cc 100644
@@ -1270,6 +1270,7 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
 	.reta_query = cnxk_nix_reta_query,
 	.rss_hash_update = cnxk_nix_rss_hash_update,
 	.rss_hash_conf_get = cnxk_nix_rss_hash_conf_get,
+	.set_mc_addr_list = cnxk_nix_mc_addr_list_configure,
 };
 
 static int
@@ -1334,6 +1335,7 @@ cnxk_eth_dev_init(struct rte_eth_dev *eth_dev)
 	}
 
 	dev->max_mac_entries = max_entries;
+	dev->dmac_filter_count = 1;
 
 	/* Get mac address */
 	rc = roc_nix_npc_mac_addr_get(nix, dev->mac_addr);
drivers/net/cnxk/cnxk_ethdev.h +4 -0
index cd08e3a..c07e988 100644
@@ -162,6 +162,7 @@ struct cnxk_eth_dev {
 	uint8_t configured;
 
 	/* Max macfilter entries */
+	uint8_t dmac_filter_count;
 	uint8_t max_mac_entries;
 	bool dmac_filter_enable;
 
@@ -265,6 +266,9 @@ int cnxk_nix_probe(struct rte_pci_driver *pci_drv,
 		   struct rte_pci_device *pci_dev);
 int cnxk_nix_remove(struct rte_pci_device *pci_dev);
 int cnxk_nix_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu);
+int cnxk_nix_mc_addr_list_configure(struct rte_eth_dev *eth_dev,
+				    struct rte_ether_addr *mc_addr_set,
+				    uint32_t nb_mc_addr);
 int cnxk_nix_mac_addr_add(struct rte_eth_dev *eth_dev,
 			  struct rte_ether_addr *addr, uint32_t index,
 			  uint32_t pool);
drivers/net/cnxk/cnxk_ethdev_ops.c +65 -0

80 lines not on this page · raw message

Signature · 1 line
2.8.4
#257 lore raw

PATCH v4 62/62 net/cnxk: support marking and VLAN tagging

In reply to Nithin Dabilpuram

From: Satheesh Paul <[email protected]>

This patch adds support for mark, flag, VLAN pop and push flow actions.

---
 doc/guides/nics/features/cnxk.ini     |   5 +
 doc/guides/nics/features/cnxk_vec.ini |   5 +
 doc/guides/nics/features/cnxk_vf.ini  |   5 +
 drivers/net/cnxk/cn10k_rte_flow.c     |  42 ++++++++
 drivers/net/cnxk/cn10k_rx.c           |  27 +++---
 drivers/net/cnxk/cn10k_rx.h           | 175 +++++++++++++++++++++++++++-------
 drivers/net/cnxk/cn10k_rx_mseg.c      |   2 +-
 drivers/net/cnxk/cn10k_rx_vec.c       |   2 +-
 drivers/net/cnxk/cn9k_rte_flow.c      |  42 ++++++++
 drivers/net/cnxk/cn9k_rx.c            |  27 +++---
 drivers/net/cnxk/cn9k_rx.h            | 175 +++++++++++++++++++++++++++-------
 drivers/net/cnxk/cn9k_rx_mseg.c       |   2 +-
 drivers/net/cnxk/cn9k_rx_vec.c        |   2 +-
 drivers/net/cnxk/cnxk_ethdev.c        |   1 +
 drivers/net/cnxk/cnxk_ethdev.h        |   3 +-
 drivers/net/cnxk/cnxk_rte_flow.c      |  17 ++++
 16 files changed, 433 insertions(+), 99 deletions(-)
doc/guides/nics/features/cnxk.ini +5 -0
index c686ceb..337ad24 100644
@@ -77,6 +77,11 @@ vxlan_gpe            = Y
 count                = Y
 drop                 = Y
 flag                 = Y
+mark                 = Y
+of_pop_vlan          = Y
+of_push_vlan         = Y
+of_set_vlan_pcp      = Y
+of_set_vlan_vid      = Y
 pf                   = Y
 port_id              = Y
 queue                = Y
doc/guides/nics/features/cnxk_vec.ini +5 -0
index 018d09e..d55b61e 100644
@@ -73,6 +73,11 @@ vxlan_gpe            = Y
 count                = Y
 drop                 = Y
 flag                 = Y
+mark                 = Y
+of_pop_vlan          = Y
+of_push_vlan         = Y
+of_set_vlan_pcp      = Y
+of_set_vlan_vid      = Y
 pf                   = Y
 port_id              = Y
 queue                = Y
doc/guides/nics/features/cnxk_vf.ini +5 -0
index 59acfdb..1bea00c 100644
@@ -69,6 +69,11 @@ vxlan_gpe            = Y
 count                = Y
 drop                 = Y
 flag                 = Y
+mark                 = Y
+of_pop_vlan          = Y
+of_push_vlan         = Y
+of_set_vlan_pcp      = Y
+of_set_vlan_vid      = Y
 pf                   = Y
 port_id              = Y
 queue                = Y
drivers/net/cnxk/cn10k_rte_flow.c +42 -0

66 lines not on this page · raw message

drivers/net/cnxk/cn10k_rx.c +14 -13
index c9744e2..5c956c0 100644
@@ -5,7 +5,7 @@
 #include "cn10k_ethdev.h"
 #include "cn10k_rx.h"
 
-#define R(name, f4, f3, f2, f1, f0, flags)				       \
+#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
 	uint16_t __rte_noinline __rte_hot cn10k_nix_recv_pkts_##name(	       \
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
@@ -17,12 +17,13 @@ NIX_RX_FASTPATH_MODES
 
 static inline void
 pick_rx_func(struct rte_eth_dev *eth_dev,
-	     const eth_rx_burst_t rx_burst[2][2][2][2][2])
+	     const eth_rx_burst_t rx_burst[2][2][2][2][2][2])
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
-	/* [TSP] [MARK] [CKSUM] [PTYPE] [RSS] */
+	/* [VLAN] [TSP] [MARK] [CKSUM] [PTYPE] [RSS] */
 	eth_dev->rx_pkt_burst = rx_burst
+		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_VLAN_STRIP_F)]
 		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_TSTAMP_F)]
 		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_MARK_UPDATE_F)]
 		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_CHECKSUM_F)]
@@ -35,25 +36,25 @@ cn10k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
-	const eth_rx_burst_t nix_eth_rx_burst[2][2][2][2][2] = {
-#define R(name, f4, f3, f2, f1, f0, flags)				       \
-	[f4][f3][f2][f1][f0] = cn10k_nix_recv_pkts_##name,
+	const eth_rx_burst_t nix_eth_rx_burst[2][2][2][2][2][2] = {
+#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
+	[f5][f4][f3][f2][f1][f0] = cn10k_nix_recv_pkts_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const eth_rx_burst_t nix_eth_rx_burst_mseg[2][2][2][2][2] = {
-#define R(name, f4, f3, f2, f1, f0, flags)				       \
-	[f4][f3][f2][f1][f0] = cn10k_nix_recv_pkts_mseg_##name,
+	const eth_rx_burst_t nix_eth_rx_burst_mseg[2][2][2][2][2][2] = {
+#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
+	[f5][f4][f3][f2][f1][f0] = cn10k_nix_recv_pkts_mseg_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const eth_rx_burst_t nix_eth_rx_vec_burst[2][2][2][2][2] = {
-#define R(name, f4, f3, f2, f1, f0, flags)				       \
-	[f4][f3][f2][f1][f0] = cn10k_nix_recv_pkts_vec_##name,
+	const eth_rx_burst_t nix_eth_rx_vec_burst[2][2][2][2][2][2] = {
+#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
+	[f5][f4][f3][f2][f1][f0] = cn10k_nix_recv_pkts_vec_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
@@ -73,6 +74,6 @@ cn10k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
 	/* Copy multi seg version with no offload for tear down sequence */
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
 		dev->rx_pkt_burst_no_offload =
-			nix_eth_rx_burst_mseg[0][0][0][0][0];
+			nix_eth_rx_burst_mseg[0][0][0][0][0][0];
 	rte_mb();
 }
drivers/net/cnxk/cn10k_rx.h +141 -34

208 lines not on this page · raw message

drivers/net/cnxk/cn10k_rx_mseg.c +1 -1
index b67d21f..3340771 100644
@@ -5,7 +5,7 @@
 #include "cn10k_ethdev.h"
 #include "cn10k_rx.h"
 
-#define R(name, f4, f3, f2, f1, f0, flags)                                     \
+#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
 	uint16_t __rte_noinline __rte_hot cn10k_nix_recv_pkts_mseg_##name(     \
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
drivers/net/cnxk/cn10k_rx_vec.c +1 -1
index 1330235..65ffa97 100644
@@ -5,7 +5,7 @@
 #include "cn10k_ethdev.h"
 #include "cn10k_rx.h"
 
-#define R(name, f4, f3, f2, f1, f0, flags)				       \
+#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
 	uint16_t __rte_noinline __rte_hot				       \
 		cn10k_nix_recv_pkts_vec_##name(void *rx_queue,                 \
 					       struct rte_mbuf **rx_pkts,      \
drivers/net/cnxk/cn9k_rte_flow.c +42 -0

66 lines not on this page · raw message

drivers/net/cnxk/cn9k_rx.c +14 -13
index a15428d..0acedd0 100644
@@ -5,7 +5,7 @@
 #include "cn9k_ethdev.h"
 #include "cn9k_rx.h"
 
-#define R(name, f4, f3, f2, f1, f0, flags)				       \
+#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
 	uint16_t __rte_noinline __rte_hot cn9k_nix_recv_pkts_##name(	       \
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
@@ -17,12 +17,13 @@ NIX_RX_FASTPATH_MODES
 
 static inline void
 pick_rx_func(struct rte_eth_dev *eth_dev,
-	     const eth_rx_burst_t rx_burst[2][2][2][2][2])
+	     const eth_rx_burst_t rx_burst[2][2][2][2][2][2])
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
-	/* [TSP] [MARK] [CKSUM] [PTYPE] [RSS] */
+	/* [TSP] [MARK] [VLAN] [CKSUM] [PTYPE] [RSS] */
 	eth_dev->rx_pkt_burst = rx_burst
+		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_VLAN_STRIP_F)]
 		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_TSTAMP_F)]
 		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_MARK_UPDATE_F)]
 		[!!(dev->rx_offload_flags & NIX_RX_OFFLOAD_CHECKSUM_F)]
@@ -35,25 +36,25 @@ cn9k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
 {
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 
-	const eth_rx_burst_t nix_eth_rx_burst[2][2][2][2][2] = {
-#define R(name, f4, f3, f2, f1, f0, flags)				       \
-	[f4][f3][f2][f1][f0] = cn9k_nix_recv_pkts_##name,
+	const eth_rx_burst_t nix_eth_rx_burst[2][2][2][2][2][2] = {
+#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
+	[f5][f4][f3][f2][f1][f0] = cn9k_nix_recv_pkts_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const eth_rx_burst_t nix_eth_rx_burst_mseg[2][2][2][2][2] = {
-#define R(name, f4, f3, f2, f1, f0, flags)				       \
-	[f4][f3][f2][f1][f0] = cn9k_nix_recv_pkts_mseg_##name,
+	const eth_rx_burst_t nix_eth_rx_burst_mseg[2][2][2][2][2][2] = {
+#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
+	[f5][f4][f3][f2][f1][f0] = cn9k_nix_recv_pkts_mseg_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
 	};
 
-	const eth_rx_burst_t nix_eth_rx_vec_burst[2][2][2][2][2] = {
-#define R(name, f4, f3, f2, f1, f0, flags)				       \
-	[f4][f3][f2][f1][f0] = cn9k_nix_recv_pkts_vec_##name,
+	const eth_rx_burst_t nix_eth_rx_vec_burst[2][2][2][2][2][2] = {
+#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
+	[f5][f4][f3][f2][f1][f0] = cn9k_nix_recv_pkts_vec_##name,
 
 		NIX_RX_FASTPATH_MODES
 #undef R
@@ -73,6 +74,6 @@ cn9k_eth_set_rx_function(struct rte_eth_dev *eth_dev)
 	/* Copy multi seg version with no offload for tear down sequence */
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
 		dev->rx_pkt_burst_no_offload =
-			nix_eth_rx_burst_mseg[0][0][0][0][0];
+			nix_eth_rx_burst_mseg[0][0][0][0][0][0];
 	rte_mb();
 }
drivers/net/cnxk/cn9k_rx.h +141 -34

208 lines not on this page · raw message

drivers/net/cnxk/cn9k_rx_mseg.c +1 -1
index 3b26962..d7e19b1 100644
@@ -5,7 +5,7 @@
 #include "cn9k_ethdev.h"
 #include "cn9k_rx.h"
 
-#define R(name, f4, f3, f2, f1, f0, flags)                                     \
+#define R(name, f5, f4, f3, f2, f1, f0, flags)                                 \
 	uint16_t __rte_noinline __rte_hot cn9k_nix_recv_pkts_mseg_##name(      \
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
drivers/net/cnxk/cn9k_rx_vec.c +1 -1
index b19c7f3..e61c222 100644
@@ -5,7 +5,7 @@
 #include "cn9k_ethdev.h"
 #include "cn9k_rx.h"
 
-#define R(name, f4, f3, f2, f1, f0, flags)				       \
+#define R(name, f5, f4, f3, f2, f1, f0, flags)				       \
 	uint16_t __rte_noinline __rte_hot cn9k_nix_recv_pkts_vec_##name(       \
 		void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts)      \
 	{                                                                      \
drivers/net/cnxk/cnxk_ethdev.c +1 -0
index b7872cc..7adab46 100644
@@ -1299,6 +1299,7 @@ cnxk_eth_dev_init(struct rte_eth_dev *eth_dev)
 
 	/* Initialize base roc nix */
 	nix->pci_dev = pci_dev;
+	nix->hw_vlan_ins = true;
 	rc = roc_nix_dev_init(nix);
 	if (rc) {
 		plt_err("Failed to initialize roc nix rc=%d", rc);
drivers/net/cnxk/cnxk_ethdev.h +2 -1
index c07e988..67b1f42 100644
@@ -76,7 +76,8 @@
 	(DEV_RX_OFFLOAD_CHECKSUM | DEV_RX_OFFLOAD_SCTP_CKSUM |                 \
 	 DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM | DEV_RX_OFFLOAD_SCATTER |            \
 	 DEV_RX_OFFLOAD_JUMBO_FRAME | DEV_RX_OFFLOAD_OUTER_UDP_CKSUM |         \
-	 DEV_RX_OFFLOAD_RSS_HASH | DEV_RX_OFFLOAD_TIMESTAMP)
+	 DEV_RX_OFFLOAD_RSS_HASH | DEV_RX_OFFLOAD_TIMESTAMP |                  \
+	 DEV_RX_OFFLOAD_VLAN_STRIP)
 
 #define RSS_IPV4_ENABLE                                                        \
 	(ETH_RSS_IPV4 | ETH_RSS_FRAG_IPV4 | ETH_RSS_NONFRAG_IPV4_UDP |         \
drivers/net/cnxk/cnxk_rte_flow.c +17 -0
index c61618a..213125b 100644
@@ -178,6 +178,23 @@ cnxk_map_actions(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,
 		case RTE_FLOW_ACTION_TYPE_SECURITY:
 			in_actions[i].type = ROC_NPC_ACTION_TYPE_SEC;
 			break;
+		case RTE_FLOW_ACTION_TYPE_OF_POP_VLAN:
+			in_actions[i].type = ROC_NPC_ACTION_TYPE_VLAN_STRIP;
+			break;
+		case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID:
+			in_actions[i].type = ROC_NPC_ACTION_TYPE_VLAN_INSERT;
+			in_actions[i].conf = actions->conf;
+			break;
+		case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN:
+			in_actions[i].type =
+				ROC_NPC_ACTION_TYPE_VLAN_ETHTYPE_INSERT;
+			in_actions[i].conf = actions->conf;
+			break;
+		case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP:
+			in_actions[i].type =
+				ROC_NPC_ACTION_TYPE_VLAN_PCP_INSERT;
+			in_actions[i].conf = actions->conf;
+			break;
 		default:
 			plt_npc_dbg("Action is not supported = %d",
 				    actions->type);
Signature · 1 line
2.8.4
#258 lore raw
In reply to Nithin Dabilpuram
Quoted 4 lines · Nithin Dabilpuram

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

Series applied to dpdk-next-net-mrvl/for-next-net. Thanks. Change the state to "Awaiting Upstream" for the main tree.

Quoted 227 lines

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

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

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

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

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

Satheesh Paul (6):
common/cnxk: add support to dump flow entries common/cnxk: support for mark and flag flow actions common/cnxk: support for VLAN push and pop flow actions net/cnxk: add flow ops get operation
net/cnxk: support for RSS in rte flow net/cnxk: support marking and VLAN tagging

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

--

v4:
- Fixed build issue with gcc 4.8
- Shortened subject lines of few commits
- Removed camel case for model API
- Updated rte_flow features in cnxk_vec.ini and cnxk_vf.ini
- Added CC stable to "fix batch alloc.." patch
- Squashed cn98xx flow create related common patch to VLAN push and pop flow actions patch.
- Changed INTERNAL to DPDK_21 in version.map

v3:
- Updated release notes
- Removed RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS flag and add support for queue stats in xstats
- Fixed issue with LSO format indices
- Removed mbox sync changes patch from this series
- Fixed documentation issues
- Removed repetitive code in fast path SIMD
- Optimize cn10k LMTST logic
- Make rte_flow_create implementation specific
to handle VLAN Stripping and MARK actions/offloads
- Use rte_atomic_thread_fence() instead of rte_rmb()
- Handle other comments from Jerin.
- Merged rte flow dump API patch to flow ops get patch
- Added marking and vlan tagging support.
- Fixed some checkpatch and git check log issues.

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

 MAINTAINERS                             |    5 +-
 doc/guides/nics/cnxk.rst                |  232 +++++
 doc/guides/nics/features/cnxk.ini       |   90 ++
 doc/guides/nics/features/cnxk_vec.ini   |   86 ++
 doc/guides/nics/features/cnxk_vf.ini    |   82 ++
 doc/guides/nics/index.rst               |    1 +
 doc/guides/platform/cnxk.rst            |    3 +
 doc/guides/rel_notes/release_21_08.rst  |    5 +
 drivers/common/cnxk/hw/npc.h            |    2 +
 drivers/common/cnxk/meson.build         |    1 +
 drivers/common/cnxk/roc_api.h           |    2 +
 drivers/common/cnxk/roc_dev.c           |   98 +-
 drivers/common/cnxk/roc_dev_priv.h      |    1 +
 drivers/common/cnxk/roc_mbox.h          |    3 +
 drivers/common/cnxk/roc_model.h         |   12 +-
 drivers/common/cnxk/roc_nix.h           |   39 +-
 drivers/common/cnxk/roc_nix_queue.c     |   52 +
 drivers/common/cnxk/roc_nix_rss.c       |   51 +-
 drivers/common/cnxk/roc_nix_tm_utils.c  |   86 +-
 drivers/common/cnxk/roc_npa.c           |   10 +-
 drivers/common/cnxk/roc_npa.h           |   35 +-
 drivers/common/cnxk/roc_npc.c           |  296 +++++-
 drivers/common/cnxk/roc_npc.h           |   39 +-
 drivers/common/cnxk/roc_npc_mcam.c      |    2 +-
 drivers/common/cnxk/roc_npc_mcam_dump.c |  611 ++++++++++++
 drivers/common/cnxk/roc_npc_priv.h      |    3 +-
 drivers/common/cnxk/roc_npc_utils.c     |    4 +
 drivers/common/cnxk/roc_platform.h      |   13 +
 drivers/common/cnxk/version.map         |    7 +
 drivers/net/cnxk/cn10k_ethdev.c         |  551 +++++++++++
 drivers/net/cnxk/cn10k_ethdev.h         |   41 +
 drivers/net/cnxk/cn10k_rte_flow.c       |   72 ++
 drivers/net/cnxk/cn10k_rte_flow.h       |   17 +
 drivers/net/cnxk/cn10k_rx.c             |   79 ++
 drivers/net/cnxk/cn10k_rx.h             |  653 +++++++++++++
 drivers/net/cnxk/cn10k_rx_mseg.c        |   17 +
 drivers/net/cnxk/cn10k_rx_vec.c         |   22 +
 drivers/net/cnxk/cn10k_tx.c             |   82 ++
 drivers/net/cnxk/cn10k_tx.h             | 1605 +++++++++++++++++++++++++++++++
 drivers/net/cnxk/cn10k_tx_mseg.c        |   25 +
 drivers/net/cnxk/cn10k_tx_vec.c         |   26 +
 drivers/net/cnxk/cn9k_ethdev.c          |  574 +++++++++++
 drivers/net/cnxk/cn9k_ethdev.h          |   39 +
 drivers/net/cnxk/cn9k_rte_flow.c        |   72 ++
 drivers/net/cnxk/cn9k_rte_flow.h        |   17 +
 drivers/net/cnxk/cn9k_rx.c              |   79 ++
 drivers/net/cnxk/cn9k_rx.h              |  655 +++++++++++++
 drivers/net/cnxk/cn9k_rx_mseg.c         |   17 +
 drivers/net/cnxk/cn9k_rx_vec.c          |   20 +
 drivers/net/cnxk/cn9k_tx.c              |   81 ++
 drivers/net/cnxk/cn9k_tx.h              | 1436 +++++++++++++++++++++++++++
 drivers/net/cnxk/cn9k_tx_mseg.c         |   25 +
 drivers/net/cnxk/cn9k_tx_vec.c          |   26 +
 drivers/net/cnxk/cnxk_ethdev.c          | 1540 +++++++++++++++++++++++++++++
 drivers/net/cnxk/cnxk_ethdev.h          |  495 ++++++++++
 drivers/net/cnxk/cnxk_ethdev_devargs.c  |  173 ++++
 drivers/net/cnxk/cnxk_ethdev_ops.c      |  912 ++++++++++++++++++
 drivers/net/cnxk/cnxk_link.c            |  113 +++
 drivers/net/cnxk/cnxk_lookup.c          |  326 +++++++
 drivers/net/cnxk/cnxk_ptp.c             |  287 ++++++
 drivers/net/cnxk/cnxk_rte_flow.c        |  433 +++++++++
 drivers/net/cnxk/cnxk_rte_flow.h        |   27 +
 drivers/net/cnxk/cnxk_stats.c           |  320 ++++++
 drivers/net/cnxk/meson.build            |   48 +
 drivers/net/cnxk/version.map            |    3 +
 drivers/net/meson.build                 |    1 +
 66 files changed, 12678 insertions(+), 102 deletions(-)
 create mode 100644 doc/guides/nics/cnxk.rst
 create mode 100644 doc/guides/nics/features/cnxk.ini
 create mode 100644 doc/guides/nics/features/cnxk_vec.ini
 create mode 100644 doc/guides/nics/features/cnxk_vf.ini
 create mode 100644 drivers/common/cnxk/roc_npc_mcam_dump.c
 create mode 100644 drivers/net/cnxk/cn10k_ethdev.c
 create mode 100644 drivers/net/cnxk/cn10k_ethdev.h
 create mode 100644 drivers/net/cnxk/cn10k_rte_flow.c
 create mode 100644 drivers/net/cnxk/cn10k_rte_flow.h
 create mode 100644 drivers/net/cnxk/cn10k_rx.c
 create mode 100644 drivers/net/cnxk/cn10k_rx.h
 create mode 100644 drivers/net/cnxk/cn10k_rx_mseg.c
 create mode 100644 drivers/net/cnxk/cn10k_rx_vec.c
 create mode 100644 drivers/net/cnxk/cn10k_tx.c
 create mode 100644 drivers/net/cnxk/cn10k_tx.h
 create mode 100644 drivers/net/cnxk/cn10k_tx_mseg.c
 create mode 100644 drivers/net/cnxk/cn10k_tx_vec.c
 create mode 100644 drivers/net/cnxk/cn9k_ethdev.c
 create mode 100644 drivers/net/cnxk/cn9k_ethdev.h
 create mode 100644 drivers/net/cnxk/cn9k_rte_flow.c
 create mode 100644 drivers/net/cnxk/cn9k_rte_flow.h
 create mode 100644 drivers/net/cnxk/cn9k_rx.c
 create mode 100644 drivers/net/cnxk/cn9k_rx.h
 create mode 100644 drivers/net/cnxk/cn9k_rx_mseg.c
 create mode 100644 drivers/net/cnxk/cn9k_rx_vec.c
 create mode 100644 drivers/net/cnxk/cn9k_tx.c
 create mode 100644 drivers/net/cnxk/cn9k_tx.h
 create mode 100644 drivers/net/cnxk/cn9k_tx_mseg.c
 create mode 100644 drivers/net/cnxk/cn9k_tx_vec.c
 create mode 100644 drivers/net/cnxk/cnxk_ethdev.c
 create mode 100644 drivers/net/cnxk/cnxk_ethdev.h
 create mode 100644 drivers/net/cnxk/cnxk_ethdev_devargs.c
 create mode 100644 drivers/net/cnxk/cnxk_ethdev_ops.c
 create mode 100644 drivers/net/cnxk/cnxk_link.c
 create mode 100644 drivers/net/cnxk/cnxk_lookup.c
 create mode 100644 drivers/net/cnxk/cnxk_ptp.c
 create mode 100644 drivers/net/cnxk/cnxk_rte_flow.c
 create mode 100644 drivers/net/cnxk/cnxk_rte_flow.h
 create mode 100644 drivers/net/cnxk/cnxk_stats.c
 create mode 100644 drivers/net/cnxk/meson.build
 create mode 100644 drivers/net/cnxk/version.map

--
2.8.4

#259 lore raw

25/06/2021 16:01, Jerin Jacob:

Quoted 9 lines
Quoted 4 lines · Nithin Dabilpuram

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

Series applied to dpdk-next-net-mrvl/for-next-net. Thanks. Change the state to "Awaiting Upstream" for the main tree.

I had to rework the file meson.build in every commits. Please next time, run devtools/check-meson.py (no it is not integrated in the CI yet)

Also, please take care of the uppercases in your product names.

#260 lore raw
Quoted 9 lines · Thomas Monjalon

25/06/2021 16:01, Jerin Jacob:

Quoted 7 lines
Quoted 4 lines · Nithin Dabilpuram

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

Quoted 6 lines
Quoted 2 lines

Series applied to dpdk-next-net-mrvl/for-next-net. Thanks. Change the state to "Awaiting Upstream" for the main tree.

I had to rework the file meson.build in every commits. Please next time, run devtools/check-meson.py (no it is not integrated in the CI yet)

Thanks for the info. I was not aware of this script. I will add it to my local check.

Quoted 4 lines

Also, please take care of the uppercases in your product names.

#261 lore raw
In reply to Thomas Monjalon
Quoted 8 lines · Thomas Monjalon

25/06/2021 16:01, Jerin Jacob:

Quoted 7 lines
Quoted 4 lines · Nithin Dabilpuram

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

Quoted 6 lines
Quoted 2 lines

Series applied to dpdk-next-net-mrvl/for-next-net. Thanks. Change the state to "Awaiting Upstream" for the main tree.

I had to rework the file meson.build in every commits. Please next time, run devtools/check-meson.py (no it is not integrated in the CI yet)

Sorry for the inconvenience. Missed to run this script and follow other PMD's with regards to meson.build indentation.

Quoted 4 lines

Also, please take care of the uppercases in your product names.