Skip to contentSkip to conversation

net/iavf: add diagnostic support in TX path

PATCH In review Mingjin Ye 4 participants 36 messages Dec 21, 2023 – Mar 4, 2024 Network drivers

lore
Share & tools
lore

Mingjin Ye

author
#0 lore raw

PATCH 1/1 net/iavf: add diagnostic support in TX path

The only way to enable diagnostics for TX paths is to modify the application source code. Making it difficult to diagnose faults.

In this patch, the devarg option "mbuf_check" is introduced and the parameters are configured to enable the corresponding diagnostics.

supported cases: mbuf, size, segment, offload, strict.
1. mbuf: check for corrupted mbuf.
2. size: check min/max packet length according to hw spec.
3. segment: check number of mbuf segments not exceed hw limitation.
4. offload: check any unsupported offload flag.
5. strict: check protocol headers.

parameter format: mbuf_check=[mbuf,<case1>,<case2>]
eg: dpdk-testpmd -a 0000:81:01.0,mbuf_check=[mbuf,size] -- -i

---
 drivers/net/iavf/iavf.h        |  26 ++-
 drivers/net/iavf/iavf_ethdev.c |  74 ++++++++
 drivers/net/iavf/iavf_rxtx.c   | 337 +++++++++++++++++++++++++++++----
 drivers/net/iavf/iavf_rxtx.h   |   8 +
 4 files changed, 402 insertions(+), 43 deletions(-)
drivers/net/iavf/iavf.h +25 -1
index 10868f2c30..428b20b8e4 100644
@@ -113,9 +113,15 @@ struct iavf_ipsec_crypto_stats {
 	} ierrors;
 };
 
+struct iavf_mdd_stats {
+	uint64_t mdd_mbuf_err_count;
+	uint64_t mdd_pkt_err_count;
+};
+
 struct iavf_eth_xstats {
 	struct virtchnl_eth_stats eth_stats;
 	struct iavf_ipsec_crypto_stats ips_stats;
+	struct iavf_mdd_stats mdd_stats;
 };
 
 /* Structure that defines a VSI, associated with a adapter. */
@@ -299,6 +305,7 @@ enum iavf_proto_xtr_type {
 	IAVF_PROTO_XTR_MAX,
 };
 
+
 /**
  * Cache devargs parse result.
  */
@@ -309,10 +316,27 @@ struct iavf_devargs {
 	uint32_t watchdog_period;
 	int auto_reset;
 	int no_poll_on_link_down;
+	int mbuf_check;
 };
 
 struct iavf_security_ctx;
 
+struct iavf_rx_burst_elem {
+	TAILQ_ENTRY(iavf_rx_burst_elem) next;
+	eth_rx_burst_t rx_pkt_burst;
+};
+
+struct iavf_tx_burst_elem {
+	TAILQ_ENTRY(iavf_tx_burst_elem) next;
+	eth_tx_burst_t tx_pkt_burst;
+};
+
+#define IAVF_MDD_CHECK_F_TX_MBUF        (1ULL << 0)
+#define IAVF_MDD_CHECK_F_TX_SIZE        (1ULL << 1)
+#define IAVF_MDD_CHECK_F_TX_SEGMENT     (1ULL << 2)
+#define IAVF_MDD_CHECK_F_TX_OFFLOAD     (1ULL << 3)
+#define IAVF_MDD_CHECK_F_TX_STRICT      (1ULL << 4)
+
 /* Structure to store private data for each VF instance. */
 struct iavf_adapter {
 	struct iavf_hw hw;
@@ -329,7 +353,7 @@ struct iavf_adapter {
 	bool closed;
 	bool no_poll;
 	eth_rx_burst_t rx_pkt_burst;
-	eth_tx_burst_t tx_pkt_burst;
+	uint64_t mc_flags; /* mdd check flags. */
 	uint16_t fdir_ref_cnt;
 	struct iavf_devargs devargs;
 };
drivers/net/iavf/iavf_ethdev.c +74 -0

122 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.c +295 -42

542 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.h +8 -0
index f432f9d956..fa948aeb95 100644
@@ -203,6 +203,10 @@ struct iavf_txq_ops {
 	void (*release_mbufs)(struct iavf_tx_queue *txq);
 };
 
+struct iavf_pkt_burst {
+	TAILQ_HEAD(rx_pkt_burst_list, iavf_rx_burst_elem) rx_burst_list;
+	TAILQ_HEAD(tx_pkt_burst_list, iavf_tx_burst_elem) tx_burst_list;
+};
 
 struct iavf_rx_queue_stats {
 	uint64_t reserved;
@@ -297,6 +301,9 @@ struct iavf_tx_queue {
 	uint16_t next_rs;              /* next to check DD,  for VPMD */
 	uint16_t ipsec_crypto_pkt_md_offset;
 
+	uint64_t mdd_mbuf_err_count;
+	uint64_t mdd_pkt_err_count;
+
 	bool q_set;                    /* if rx queue has been configured */
 	bool tx_deferred_start;        /* don't start this queue in dev start */
 	const struct iavf_txq_ops *ops;
@@ -669,6 +676,7 @@ uint16_t iavf_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		       uint16_t nb_pkts);
 void iavf_set_rx_function(struct rte_eth_dev *dev);
 void iavf_set_tx_function(struct rte_eth_dev *dev);
+void iavf_pkt_burst_init(struct rte_eth_dev *dev);
 void iavf_dev_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
 			  struct rte_eth_rxq_info *qinfo);
 void iavf_dev_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
Signature · 1 line
2.25.1
#1 lore raw
Quoted 45 lines

-----Original Message-----
From: Mingjin Ye <[email protected]>
Sent: Thursday, December 21, 2023 6:12 PM
To: [email protected]
Cc: Yang, Qiming <[email protected]>; Ye, MingjinX <[email protected]>; Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>
Subject: [PATCH] net/iavf: add diagnostic support in TX path

The only way to enable diagnostics for TX paths is to modify the application source code. Making it difficult to diagnose faults.

In this patch, the devarg option "mbuf_check" is introduced and the parameters are configured to enable the corresponding diagnostics.

supported cases: mbuf, size, segment, offload, strict.
1. mbuf: check for corrupted mbuf.
2. size: check min/max packet length according to hw spec.
3. segment: check number of mbuf segments not exceed hw limitation.
4. offload: check any unsupported offload flag.
5. strict: check protocol headers.

parameter format: mbuf_check=[mbuf,<case1>,<case2>]
eg: dpdk-testpmd -a 0000:81:01.0,mbuf_check=[mbuf,size] -- -i

drivers/net/iavf/iavf_rxtx.c +13 -0
+
+static uint16_t
+iavf_xmit_pkts_chain(void *tx_queue, struct rte_mbuf **tx_pkts,
+uint16_t nb_pkts) {
+	struct iavf_tx_queue *txq = tx_queue;
+	struct iavf_adapter *adapter = txq->vsi->adapter;
+	struct iavf_tx_burst_elem *pos;
+	struct iavf_tx_burst_elem *save_next;
+	struct iavf_pkt_burst *item;
+	uint16_t ret;
+
+	item = &ice_rxtx_pkt_burst[adapter->dev_data->port_id];
+	RTE_TAILQ_FOREACH_SAFE(pos, &item->tx_burst_list, next,

save_next) {

drivers/net/iavf/iavf_rxtx.c iavf_recv_pkts_no_poll(void *rx_queue, struct rte_mbuf **rx_pkts, · line 3927

Quoted 2 lines
drivers/net/iavf/iavf_rxtx.c +2 -0
+		ret = pos->tx_pkt_burst(tx_queue, tx_pkts, nb_pkts);
+		if (nb_pkts != ret)

This is not correct,

Quoted 18 lines
drivers/net/iavf/iavf_rxtx.c +6 -3
+			break;
+	}
+
+	return ret;
+}
+
 
 /* choose rx function*/
@@ -3973,9 +4226,6 @@ iavf_set_rx_function(struct rte_eth_dev *dev)
 void  iavf_set_tx_function(struct rte_eth_dev *dev)  {
-	struct iavf_adapter *adapter =
-		IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
-	int no_poll_on_link_down = adapter-
 >devargs.no_poll_on_link_down;
 #ifdef RTE_ARCH_X86
 	struct iavf_tx_queue *txq;
 	int i;

drivers/net/iavf/iavf_rxtx.c iavf_set_tx_function(struct rte_eth_dev *dev) · line 4315

Quoted 8 lines
drivers/net/iavf/iavf_rxtx.c +1 -4
@@ -4062,10 +4312,7 @@ iavf_set_tx_function(struct rte_eth_dev *dev)
 #endif
 		}
 
-		if (no_poll_on_link_down) {
-			adapter->tx_pkt_burst = dev->tx_pkt_burst;
-			dev->tx_pkt_burst = iavf_xmit_pkts_no_poll;
-		}
+		iavf_set_tx_interceptors(dev);

If no_poll or diagnose mode are not enabled, why we still need to interceptor?,

Btw, its too heavy to use a chain here and I even didn't see an Rx chain implementation.

Why not simplify it as below:

adapter->tx_pkt_burst = dev->tx_pkt_burst;
if (no_poll_on_link_down)

	dev->tx_pkt_burst = iavf_xmit_pkts_no_poll;
else if (diagnose mode)
	dev->tx_pkt_burst = iavf_xmit_pkt_mdd_check.

then iavf_xmit_pkt_mdd_check, call iavf_xmit_pkts_no_poll or adapter->tx_pkt_burst

author
#2 lore raw

PATCH v2 1/1 net/iavf: add diagnostic support in TX path

In reply to Mingjin Ye

The only way to enable diagnostics for TX paths is to modify the application source code. Making it difficult to diagnose faults.

In this patch, the devarg option "mbuf_check" is introduced and the parameters are configured to enable the corresponding diagnostics.

supported cases: mbuf, size, segment, offload, strict.
1. mbuf: check for corrupted mbuf.
2. size: check min/max packet length according to hw spec.
3. segment: check number of mbuf segments not exceed hw limitation.
4. offload: check any unsupported offload flag.
5. strict: check protocol headers.

parameter format: mbuf_check=[mbuf,<case1>,<case2>]
eg: dpdk-testpmd -a 0000:81:01.0,mbuf_check=[mbuf,size] -- -i

---
v2: Remove call chain.

---
 drivers/net/iavf/iavf.h        |  25 ++++-
 drivers/net/iavf/iavf_ethdev.c |  69 ++++++++++++
 drivers/net/iavf/iavf_rxtx.c   | 186 ++++++++++++++++++++++++++-------
 drivers/net/iavf/iavf_rxtx.h   |   6 ++
 4 files changed, 246 insertions(+), 40 deletions(-)
drivers/net/iavf/iavf.h +23 -2
index 10868f2c30..ab80388422 100644
@@ -113,9 +113,14 @@ struct iavf_ipsec_crypto_stats {
 	} ierrors;
 };
 
+struct iavf_mdd_stats {
+	uint64_t tx_pkt_errors;
+};
+
 struct iavf_eth_xstats {
 	struct virtchnl_eth_stats eth_stats;
 	struct iavf_ipsec_crypto_stats ips_stats;
+	struct iavf_mdd_stats mdd_stats;
 };
 
 /* Structure that defines a VSI, associated with a adapter. */
@@ -309,10 +314,27 @@ struct iavf_devargs {
 	uint32_t watchdog_period;
 	int auto_reset;
 	int no_poll_on_link_down;
+	int mbuf_check;
 };
 
 struct iavf_security_ctx;
 
+struct iavf_rx_burst_elem {
+	TAILQ_ENTRY(iavf_rx_burst_elem) next;
+	eth_rx_burst_t rx_pkt_burst;
+};
+
+struct iavf_tx_burst_elem {
+	TAILQ_ENTRY(iavf_tx_burst_elem) next;
+	eth_tx_burst_t tx_pkt_burst;
+};
+
+#define IAVF_MDD_CHECK_F_TX_MBUF        (1ULL << 0)
+#define IAVF_MDD_CHECK_F_TX_SIZE        (1ULL << 1)
+#define IAVF_MDD_CHECK_F_TX_SEGMENT     (1ULL << 2)
+#define IAVF_MDD_CHECK_F_TX_OFFLOAD     (1ULL << 3)
+#define IAVF_MDD_CHECK_F_TX_STRICT      (1ULL << 4)
+
 /* Structure to store private data for each VF instance. */
 struct iavf_adapter {
 	struct iavf_hw hw;
@@ -328,8 +350,7 @@ struct iavf_adapter {
 	bool stopped;
 	bool closed;
 	bool no_poll;
-	eth_rx_burst_t rx_pkt_burst;
-	eth_tx_burst_t tx_pkt_burst;
+	uint64_t mc_flags; /* mdd check flags. */
 	uint16_t fdir_ref_cnt;
 	struct iavf_devargs devargs;
 };
drivers/net/iavf/iavf_ethdev.c +69 -0

111 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.c +148 -38

378 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.h +6 -0
index f432f9d956..ab95bb30c7 100644
@@ -203,6 +203,10 @@ struct iavf_txq_ops {
 	void (*release_mbufs)(struct iavf_tx_queue *txq);
 };
 
+struct iavf_pkt_burst {
+	eth_rx_burst_t rx_burst_raw;
+	eth_tx_burst_t tx_burst_raw;
+};
 
 struct iavf_rx_queue_stats {
 	uint64_t reserved;
@@ -297,6 +301,8 @@ struct iavf_tx_queue {
 	uint16_t next_rs;              /* next to check DD,  for VPMD */
 	uint16_t ipsec_crypto_pkt_md_offset;
 
+	uint64_t mdd_pkt_errors;
+
 	bool q_set;                    /* if rx queue has been configured */
 	bool tx_deferred_start;        /* don't start this queue in dev start */
 	const struct iavf_txq_ops *ops;
Signature · 1 line
2.25.1
#3 lore raw
Quoted 30 lines

-----Original Message-----
From: Mingjin Ye <[email protected]>
Sent: Friday, December 22, 2023 6:45 PM
To: [email protected]
Cc: Yang, Qiming <[email protected]>; Ye, MingjinX <[email protected]>; Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>
Subject: [PATCH v2] net/iavf: add diagnostic support in TX path

The only way to enable diagnostics for TX paths is to modify the application source code. Making it difficult to diagnose faults.

In this patch, the devarg option "mbuf_check" is introduced and the parameters are configured to enable the corresponding diagnostics.

supported cases: mbuf, size, segment, offload, strict.
1. mbuf: check for corrupted mbuf.
2. size: check min/max packet length according to hw spec.
3. segment: check number of mbuf segments not exceed hw limitation.
4. offload: check any unsupported offload flag.
5. strict: check protocol headers.

parameter format: mbuf_check=[mbuf,<case1>,<case2>]
eg: dpdk-testpmd -a 0000:81:01.0,mbuf_check=[mbuf,size] -- -i

---
v2: Remove call chain.

...

Quoted 2 lines

+static struct iavf_pkt_burst iavf_rxtx_pkt_burst[RTE_MAX_ETHPORTS];

Global array is not necessary, I assume we can get adapter with rxq->vsi->adapter.

Quoted 30 lines

+
static inline void iavf_rxd_to_pkt_fields_by_comms_ovs(__rte_unused struct iavf_rx_queue
*rxq,

drivers/net/iavf/iavf_rxtx.c +0 -1
 				    struct rte_mbuf *mb,
@@ -3394,34 +3396,34 @@ check_mbuf_len(struct offload_info *info,
 struct rte_mbuf *m)  {
 	if (m->ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) {
 		if (info->outer_l2_len != m->outer_l2_len) {
-			PMD_TX_LOG(ERR, "outer_l2_len error in mbuf.

Original "

(quoted diff) +0 -1
-			"length: %hu, calculated length: %u", m-
Quoted 1 line

outer_l2_len,

(quoted diff) +1 -0
+			PMD_DRV_LOG(ERR, "outer_l2_len error in mbuf.

Original "

(quoted diff) +1 -0
+			"length: %d, calculated length: %u", m-
Quoted 1 line

outer_l2_len,

drivers/net/iavf/iavf_rxtx.c +0 -1
 			info->outer_l2_len);
 			return -1;
 		}
 		if (info->outer_l3_len != m->outer_l3_len) {
-			PMD_TX_LOG(ERR, "outer_l3_len error in mbuf.

Original "

(quoted diff) +0 -1
-			"length: %hu,calculated length: %u", m-
Quoted 1 line

outer_l3_len,

(quoted diff) +1 -0
+			PMD_DRV_LOG(ERR, "outer_l3_len error in mbuf.

Original "

drivers/net/iavf/iavf_rxtx.c +1 -0
+			"length: %d,calculated length: %u", m->outer_l3_len,
 			info->outer_l3_len);
 			return -1;

drivers/net/iavf/iavf_rxtx.c check_mbuf_len(struct offload_info *info, struct rte_mbuf *m) · line 3416

Quoted 10 lines
drivers/net/iavf/iavf_rxtx.c +2 -2
 		}
 	}
 
 	if (info->l2_len != m->l2_len) {
-		PMD_TX_LOG(ERR, "l2_len error in mbuf. Original "
-		"length: %hu, calculated length: %u", m->l2_len,
+		PMD_DRV_LOG(ERR, "l2_len error in mbuf. Original "
+		"length: %d, calculated length: %u", m->l2_len,
 		info->l2_len);
 		return -1;

Can you explain why need to change all the log type here? basically the diagnose check is for Tx only , we don't need to touch existing Rx implementation. it could be a separate patch if you think something need to be refactor.

#4 lore raw
Quoted 42 lines

-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: 2023年12月22日 19:38
To: Ye, MingjinX <[email protected]>; [email protected]
Cc: Yang, Qiming <[email protected]>; Ye, MingjinX <[email protected]>; Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>
Subject: RE: [PATCH v2] net/iavf: add diagnostic support in TX path

Quoted 22 lines

-----Original Message-----
From: Mingjin Ye <[email protected]>
Sent: Friday, December 22, 2023 6:45 PM
To: [email protected]
Cc: Yang, Qiming <[email protected]>; Ye, MingjinX <[email protected]>; Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>
Subject: [PATCH v2] net/iavf: add diagnostic support in TX path

The only way to enable diagnostics for TX paths is to modify the application source code. Making it difficult to diagnose faults.

In this patch, the devarg option "mbuf_check" is introduced and the parameters are configured to enable the corresponding diagnostics.

supported cases: mbuf, size, segment, offload, strict.
1. mbuf: check for corrupted mbuf.
2. size: check min/max packet length according to hw spec.
3. segment: check number of mbuf segments not exceed hw limitation.
4. offload: check any unsupported offload flag.
5. strict: check protocol headers.

Quoted 6 lines

parameter format: mbuf_check=[mbuf,<case1>,<case2>]
eg: dpdk-testpmd -a 0000:81:01.0,mbuf_check=[mbuf,size] -- -i

---
v2: Remove call chain.

Quoted 7 lines

...

Quoted 2 lines

+static struct iavf_pkt_burst iavf_rxtx_pkt_burst[RTE_MAX_ETHPORTS];

Global array is not necessary, I assume we can get adapter with rxq->vsi-

Quoted 1 line

adapter.

Multi-process support to solve the problems caused by ASLR.

Quoted 35 lines
Quoted 4 lines

+
static inline void iavf_rxd_to_pkt_fields_by_comms_ovs(__rte_unused struct

iavf_rx_queue

Quoted 30 lines

*rxq,

drivers/net/iavf/iavf_rxtx.c +0 -1
 				    struct rte_mbuf *mb,
@@ -3394,34 +3396,34 @@ check_mbuf_len(struct offload_info *info,
 struct rte_mbuf *m)  {
 	if (m->ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK) {
 		if (info->outer_l2_len != m->outer_l2_len) {
-			PMD_TX_LOG(ERR, "outer_l2_len error in mbuf.

Original "

(quoted diff) +0 -1
-			"length: %hu, calculated length: %u", m-
Quoted 1 line

outer_l2_len,

(quoted diff) +1 -0
+			PMD_DRV_LOG(ERR, "outer_l2_len error in mbuf.

Original "

(quoted diff) +1 -0
+			"length: %d, calculated length: %u", m-
Quoted 1 line

outer_l2_len,

drivers/net/iavf/iavf_rxtx.c +0 -1
 			info->outer_l2_len);
 			return -1;
 		}
 		if (info->outer_l3_len != m->outer_l3_len) {
-			PMD_TX_LOG(ERR, "outer_l3_len error in mbuf.

Original "

(quoted diff) +0 -1
-			"length: %hu,calculated length: %u", m-
Quoted 1 line

outer_l3_len,

(quoted diff) +1 -0
+			PMD_DRV_LOG(ERR, "outer_l3_len error in mbuf.

Original "

drivers/net/iavf/iavf_rxtx.c +1 -0
+			"length: %d,calculated length: %u", m->outer_l3_len,
 			info->outer_l3_len);
 			return -1;
 		}
 	}
Quoted 9 lines

drivers/net/iavf/iavf_rxtx.c check_mbuf_len(struct offload_info *info, struct rte_mbuf *m) · line 3416

Quoted 7 lines
drivers/net/iavf/iavf_rxtx.c +2 -2
 	if (info->l2_len != m->l2_len) {
-		PMD_TX_LOG(ERR, "l2_len error in mbuf. Original "
-		"length: %hu, calculated length: %u", m->l2_len,
+		PMD_DRV_LOG(ERR, "l2_len error in mbuf. Original "
+		"length: %d, calculated length: %u", m->l2_len,
 		info->l2_len);
 		return -1;

Can you explain why need to change all the log type here?

PMD_TX_LOG requires the RTE_ETHDEV_DEBUG_TX macro to be configured and recompiled to output the log. Modifying PMD_DRV_LOG allows for quick debugging of operations without modifying or compiling code.

Quoted 4 lines

basically the
diagnose check is for Tx only , we don't need to touch existing Rx implementation. it could be a separate patch if you think something need to be refactor.

Restore RX Change.

Quoted 1 line
author
#5 lore raw

PATCH v3 1/1 net/iavf: add diagnostic support in TX path

In reply to Mingjin Ye

The only way to enable diagnostics for TX paths is to modify the application source code. Making it difficult to diagnose faults.

In this patch, the devarg option "mbuf_check" is introduced and the parameters are configured to enable the corresponding diagnostics.

supported cases: mbuf, size, segment, offload, strict.
1. mbuf: check for corrupted mbuf.
2. size: check min/max packet length according to hw spec.
3. segment: check number of mbuf segments not exceed hw limitation.
4. offload: check any unsupported offload flag.
5. strict: check protocol headers.

parameter format: mbuf_check=[mbuf,<case1>,<case2>]
eg: dpdk-testpmd -a 0000:81:01.0,mbuf_check=[mbuf,size] -- -i

---
v2: Remove call chain.
---
v3: Optimisation implementation.

---
 drivers/net/iavf/iavf.h        |  25 +++++-
 drivers/net/iavf/iavf_ethdev.c |  69 +++++++++++++++++
 drivers/net/iavf/iavf_rxtx.c   | 138 ++++++++++++++++++++++++++++++++-
 drivers/net/iavf/iavf_rxtx.h   |   5 ++
 4 files changed, 233 insertions(+), 4 deletions(-)
drivers/net/iavf/iavf.h +24 -1
index 10868f2c30..b81329bb56 100644
@@ -113,9 +113,14 @@ struct iavf_ipsec_crypto_stats {
 	} ierrors;
 };
 
+struct iavf_mbuf_stats {
+	uint64_t tx_pkt_errors;
+};
+
 struct iavf_eth_xstats {
 	struct virtchnl_eth_stats eth_stats;
 	struct iavf_ipsec_crypto_stats ips_stats;
+	struct iavf_mbuf_stats mbuf_stats;
 };
 
 /* Structure that defines a VSI, associated with a adapter. */
@@ -309,10 +314,27 @@ struct iavf_devargs {
 	uint32_t watchdog_period;
 	int auto_reset;
 	int no_poll_on_link_down;
+	int mbuf_check;
 };
 
 struct iavf_security_ctx;
 
+#define IAVF_MBUF_CHECK_F_TX_MBUF        (1ULL << 0)
+#define IAVF_MBUF_CHECK_F_TX_SIZE        (1ULL << 1)
+#define IAVF_MBUF_CHECK_F_TX_SEGMENT     (1ULL << 2)
+#define IAVF_MBUF_CHECK_F_TX_OFFLOAD     (1ULL << 3)
+#define IAVF_MBUF_CHECK_F_TX_STRICT      (1ULL << 4)
+
+enum iavf_tx_pkt_burst_type {
+	IAVF_PKT_BURST_DEFAULT		= 0,
+	IAVF_PKT_BURST_VEC		= 1,
+	IAVF_PKT_BURST_VEC_AVX2		= 2,
+	IAVF_PKT_BURST_VEC_AVX2_OFFLOAD	= 3,
+	IAVF_PKT_BURST_VEC_AVX512	= 4,
+	IAVF_PKT_BURST_VEC_AVX512_OFFLOAD	= 5,
+	IAVF_PKT_BURST_VEC_AVX512_CTX_OFFLOAD	= 6,
+};
+
 /* Structure to store private data for each VF instance. */
 struct iavf_adapter {
 	struct iavf_hw hw;
@@ -329,7 +351,8 @@ struct iavf_adapter {
 	bool closed;
 	bool no_poll;
 	eth_rx_burst_t rx_pkt_burst;
-	eth_tx_burst_t tx_pkt_burst;
+	enum iavf_tx_pkt_burst_type tx_burst_type;
+	uint64_t mc_flags; /* mbuf check flags. */
 	uint16_t fdir_ref_cnt;
 	struct iavf_devargs devargs;
 };
drivers/net/iavf/iavf_ethdev.c +69 -0

111 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.c +135 -3

213 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.h +5 -0
index f432f9d956..a4128ff7a3 100644
@@ -203,6 +203,9 @@ struct iavf_txq_ops {
 	void (*release_mbufs)(struct iavf_tx_queue *txq);
 };
 
+struct iavf_tx_burst_ops {
+	eth_tx_burst_t tx_pkt_burst;
+};
 
 struct iavf_rx_queue_stats {
 	uint64_t reserved;
@@ -297,6 +300,8 @@ struct iavf_tx_queue {
 	uint16_t next_rs;              /* next to check DD,  for VPMD */
 	uint16_t ipsec_crypto_pkt_md_offset;
 
+	uint64_t mbuf_errors;
+
 	bool q_set;                    /* if rx queue has been configured */
 	bool tx_deferred_start;        /* don't start this queue in dev start */
 	const struct iavf_txq_ops *ops;
Signature · 1 line
2.25.1
author
#6 lore raw

PATCH v4 1/2 net/iavf: add diagnostic support in TX path

The only way to enable diagnostics for TX paths is to modify the application source code. Making it difficult to diagnose faults.

In this patch, the devarg option "mbuf_check" is introduced and the parameters are configured to enable the corresponding diagnostics.

supported cases: mbuf, size, segment, offload, strict.
1. mbuf: check for corrupted mbuf.
2. size: check min/max packet length according to hw spec.
3. segment: check number of mbuf segments not exceed hw limitation.
4. offload: check any unsupported offload flag.
5. strict: check protocol headers.

parameter format: mbuf_check=[mbuf,<case1>,<case2>]
eg: dpdk-testpmd -a 0000:81:01.0,mbuf_check=[mbuf,size] -- -i

---
v2: Remove call chain.
---
v3: Optimisation implementation.
---
v4: Fix Windows os compilation error.

---
 drivers/net/iavf/iavf.h        |  25 +++++-
 drivers/net/iavf/iavf_ethdev.c |  70 +++++++++++++++++
 drivers/net/iavf/iavf_rxtx.c   | 138 ++++++++++++++++++++++++++++++++-
 drivers/net/iavf/iavf_rxtx.h   |   5 ++
 4 files changed, 234 insertions(+), 4 deletions(-)
drivers/net/iavf/iavf.h +24 -1
index 10868f2c30..b81329bb56 100644
@@ -113,9 +113,14 @@ struct iavf_ipsec_crypto_stats {
 	} ierrors;
 };
 
+struct iavf_mbuf_stats {
+	uint64_t tx_pkt_errors;
+};
+
 struct iavf_eth_xstats {
 	struct virtchnl_eth_stats eth_stats;
 	struct iavf_ipsec_crypto_stats ips_stats;
+	struct iavf_mbuf_stats mbuf_stats;
 };
 
 /* Structure that defines a VSI, associated with a adapter. */
@@ -309,10 +314,27 @@ struct iavf_devargs {
 	uint32_t watchdog_period;
 	int auto_reset;
 	int no_poll_on_link_down;
+	int mbuf_check;
 };
 
 struct iavf_security_ctx;
 
+#define IAVF_MBUF_CHECK_F_TX_MBUF        (1ULL << 0)
+#define IAVF_MBUF_CHECK_F_TX_SIZE        (1ULL << 1)
+#define IAVF_MBUF_CHECK_F_TX_SEGMENT     (1ULL << 2)
+#define IAVF_MBUF_CHECK_F_TX_OFFLOAD     (1ULL << 3)
+#define IAVF_MBUF_CHECK_F_TX_STRICT      (1ULL << 4)
+
+enum iavf_tx_pkt_burst_type {
+	IAVF_PKT_BURST_DEFAULT		= 0,
+	IAVF_PKT_BURST_VEC		= 1,
+	IAVF_PKT_BURST_VEC_AVX2		= 2,
+	IAVF_PKT_BURST_VEC_AVX2_OFFLOAD	= 3,
+	IAVF_PKT_BURST_VEC_AVX512	= 4,
+	IAVF_PKT_BURST_VEC_AVX512_OFFLOAD	= 5,
+	IAVF_PKT_BURST_VEC_AVX512_CTX_OFFLOAD	= 6,
+};
+
 /* Structure to store private data for each VF instance. */
 struct iavf_adapter {
 	struct iavf_hw hw;
@@ -329,7 +351,8 @@ struct iavf_adapter {
 	bool closed;
 	bool no_poll;
 	eth_rx_burst_t rx_pkt_burst;
-	eth_tx_burst_t tx_pkt_burst;
+	enum iavf_tx_pkt_burst_type tx_burst_type;
+	uint64_t mc_flags; /* mbuf check flags. */
 	uint16_t fdir_ref_cnt;
 	struct iavf_devargs devargs;
 };
drivers/net/iavf/iavf_ethdev.c +70 -0

118 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.c +135 -3

213 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.h +5 -0
index f432f9d956..a4128ff7a3 100644
@@ -203,6 +203,9 @@ struct iavf_txq_ops {
 	void (*release_mbufs)(struct iavf_tx_queue *txq);
 };
 
+struct iavf_tx_burst_ops {
+	eth_tx_burst_t tx_pkt_burst;
+};
 
 struct iavf_rx_queue_stats {
 	uint64_t reserved;
@@ -297,6 +300,8 @@ struct iavf_tx_queue {
 	uint16_t next_rs;              /* next to check DD,  for VPMD */
 	uint16_t ipsec_crypto_pkt_md_offset;
 
+	uint64_t mbuf_errors;
+
 	bool q_set;                    /* if rx queue has been configured */
 	bool tx_deferred_start;        /* don't start this queue in dev start */
 	const struct iavf_txq_ops *ops;
Signature · 1 line
2.25.1
#7 lore raw
Quoted 11 lines

-----Original Message-----
From: Mingjin Ye <[email protected]>
Sent: Wednesday, December 27, 2023 6:17 PM
To: [email protected]
Cc: Yang, Qiming <[email protected]>; Ye, MingjinX <[email protected]>; Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>
Subject: [PATCH v4 1/2] net/iavf: add diagnostic support in TX path

Quoted 5 lines

The only way to enable diagnostics for TX paths is to modify the application source code. Making it difficult to diagnose faults.

In this patch, the devarg option "mbuf_check" is introduced and the parameters are configured to enable the corresponding diagnostics.

Can you separate this patch into two?

1. introduce the tx burst type and the ops array, this actually fixed the multi-process issue, and should be backported into LTS.
2. add mbuf check for tx diagnose

Btw, please also update the document , so user can know how to use the new devarg.

author
#8 lore raw

v5 cover net/iavf: add diagnostics and fix error

In reply to Mingjin Ye

1. Fix multi-process error in Tx path.
2. Add diagnostics to Tx path.

Mingjin Ye (2):
net/iavf: fix Tx path error in multi-process
net/iavf: add diagnostic support in TX path

 doc/guides/nics/intel_vf.rst   |   4 +
 drivers/net/iavf/iavf.h        |  25 +++++-
 drivers/net/iavf/iavf_ethdev.c |  70 +++++++++++++++++
 drivers/net/iavf/iavf_rxtx.c   | 138 ++++++++++++++++++++++++++++++++-
 drivers/net/iavf/iavf_rxtx.h   |   5 ++
 5 files changed, 238 insertions(+), 4 deletions(-)
Signature · 1 line
2.25.1
author
#9 lore raw

PATCH v5 1/2 net/iavf: fix Tx path error in multi-process

In a multi-process environment, a secondary process operates on shared memory and changes the PMD transmit function pointer of the primary process, causing the primary process to send pkts without being able to find the function address, resulting in a crash.

Fixes 5b3124a0a6ef ("net/iavf: support no polling when link down")
---
 drivers/net/iavf/iavf.h      | 12 +++++++++++-
 drivers/net/iavf/iavf_rxtx.c | 34 +++++++++++++++++++++++++++++++---
 drivers/net/iavf/iavf_rxtx.h |  3 +++
 3 files changed, 45 insertions(+), 4 deletions(-)
drivers/net/iavf/iavf.h +11 -1
index 10868f2c30..4cd5bea167 100644
@@ -313,6 +313,16 @@ struct iavf_devargs {
 
 struct iavf_security_ctx;
 
+enum iavf_tx_pkt_burst_type {
+	IAVF_PKT_BURST_DEFAULT		= 0,
+	IAVF_PKT_BURST_VEC		= 1,
+	IAVF_PKT_BURST_VEC_AVX2		= 2,
+	IAVF_PKT_BURST_VEC_AVX2_OFFLOAD	= 3,
+	IAVF_PKT_BURST_VEC_AVX512	= 4,
+	IAVF_PKT_BURST_VEC_AVX512_OFFLOAD	= 5,
+	IAVF_PKT_BURST_VEC_AVX512_CTX_OFFLOAD	= 6,
+};
+
 /* Structure to store private data for each VF instance. */
 struct iavf_adapter {
 	struct iavf_hw hw;
@@ -329,7 +339,7 @@ struct iavf_adapter {
 	bool closed;
 	bool no_poll;
 	eth_rx_burst_t rx_pkt_burst;
-	eth_tx_burst_t tx_pkt_burst;
+	enum iavf_tx_pkt_burst_type tx_burst_type;
 	uint16_t fdir_ref_cnt;
 	struct iavf_devargs devargs;
 };
drivers/net/iavf/iavf_rxtx.c +31 -3
index f19aa14646..0d95447054 100644
@@ -425,6 +425,23 @@ struct iavf_txq_ops iavf_txq_release_mbufs_ops[] = {
 
 };
 
+static const
+struct iavf_tx_burst_ops iavf_tx_pkt_burst_ops[] = {
+	[IAVF_PKT_BURST_DEFAULT].tx_pkt_burst = iavf_xmit_pkts,
+#ifdef RTE_ARCH_X86
+	[IAVF_PKT_BURST_VEC].tx_pkt_burst = iavf_xmit_pkts_vec,
+	[IAVF_PKT_BURST_VEC_AVX2].tx_pkt_burst = iavf_xmit_pkts_vec_avx2,
+	[IAVF_PKT_BURST_VEC_AVX2_OFFLOAD].tx_pkt_burst = iavf_xmit_pkts_vec_avx2_offload,
+#ifdef CC_AVX512_SUPPORT
+	[IAVF_PKT_BURST_VEC_AVX512].tx_pkt_burst = iavf_xmit_pkts_vec_avx512,
+	[IAVF_PKT_BURST_VEC_AVX512_OFFLOAD].tx_pkt_burst =
+		iavf_xmit_pkts_vec_avx512_offload,
+	[IAVF_PKT_BURST_VEC_AVX512_CTX_OFFLOAD].tx_pkt_burst =
+		iavf_xmit_pkts_vec_avx512_ctx_offload,
+#endif
+#endif
+};
+
 static inline void
 iavf_rxd_to_pkt_fields_by_comms_ovs(__rte_unused struct iavf_rx_queue *rxq,
 				    struct rte_mbuf *mb,
@@ -3724,10 +3741,13 @@ iavf_xmit_pkts_no_poll(void *tx_queue, struct rte_mbuf **tx_pkts,
 				uint16_t nb_pkts)
 {
 	struct iavf_tx_queue *txq = tx_queue;
+	enum iavf_tx_pkt_burst_type tx_burst_type =
+		txq->vsi->adapter->tx_burst_type;
+
 	if (!txq->vsi || txq->vsi->adapter->no_poll)
 		return 0;
 
-	return txq->vsi->adapter->tx_pkt_burst(tx_queue,
+	return iavf_tx_pkt_burst_ops[tx_burst_type].tx_pkt_burst(tx_queue,
 								tx_pkts, nb_pkts);
 }
 
@@ -3975,6 +3995,7 @@ iavf_set_tx_function(struct rte_eth_dev *dev)
 {
 	struct iavf_adapter *adapter =
 		IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
+	enum iavf_tx_pkt_burst_type tx_burst_type;
 	int no_poll_on_link_down = adapter->devargs.no_poll_on_link_down;
 #ifdef RTE_ARCH_X86
 	struct iavf_tx_queue *txq;
@@ -4011,10 +4032,12 @@ iavf_set_tx_function(struct rte_eth_dev *dev)
 			PMD_DRV_LOG(DEBUG, "Using Vector Tx (port %d).",
 				    dev->data->port_id);
 			dev->tx_pkt_burst = iavf_xmit_pkts_vec;
+			tx_burst_type = IAVF_PKT_BURST_VEC;
 		}
 		if (use_avx2) {
 			if (check_ret == IAVF_VECTOR_PATH) {
 				dev->tx_pkt_burst = iavf_xmit_pkts_vec_avx2;
+				tx_burst_type = IAVF_PKT_BURST_VEC_AVX2;
 				PMD_DRV_LOG(DEBUG, "Using AVX2 Vector Tx (port %d).",
 					    dev->data->port_id);
 			} else if (check_ret == IAVF_VECTOR_CTX_OFFLOAD_PATH) {
@@ -4023,6 +4046,7 @@ iavf_set_tx_function(struct rte_eth_dev *dev)
 				goto normal;
 			} else {
 				dev->tx_pkt_burst = iavf_xmit_pkts_vec_avx2_offload;
+				tx_burst_type = IAVF_PKT_BURST_VEC_AVX2_OFFLOAD;
 				dev->tx_pkt_prepare = iavf_prep_pkts;
 				PMD_DRV_LOG(DEBUG, "Using AVX2 OFFLOAD Vector Tx (port %d).",
 					    dev->data->port_id);
@@ -4032,15 +4056,18 @@ iavf_set_tx_function(struct rte_eth_dev *dev)
 		if (use_avx512) {
 			if (check_ret == IAVF_VECTOR_PATH) {
 				dev->tx_pkt_burst = iavf_xmit_pkts_vec_avx512;
+				tx_burst_type = IAVF_PKT_BURST_VEC_AVX512;
 				PMD_DRV_LOG(DEBUG, "Using AVX512 Vector Tx (port %d).",
 					    dev->data->port_id);
 			} else if (check_ret == IAVF_VECTOR_OFFLOAD_PATH) {
 				dev->tx_pkt_burst = iavf_xmit_pkts_vec_avx512_offload;
+				tx_burst_type = IAVF_PKT_BURST_VEC_AVX512_OFFLOAD;
 				dev->tx_pkt_prepare = iavf_prep_pkts;
 				PMD_DRV_LOG(DEBUG, "Using AVX512 OFFLOAD Vector Tx (port %d).",
 					    dev->data->port_id);
 			} else {
 				dev->tx_pkt_burst = iavf_xmit_pkts_vec_avx512_ctx_offload;
+				tx_burst_type = IAVF_PKT_BURST_VEC_AVX512_CTX_OFFLOAD;
 				dev->tx_pkt_prepare = iavf_prep_pkts;
 				PMD_DRV_LOG(DEBUG, "Using AVX512 CONTEXT OFFLOAD Vector Tx (port %d).",
 					    dev->data->port_id);
@@ -4063,7 +4090,7 @@ iavf_set_tx_function(struct rte_eth_dev *dev)
 		}
 
 		if (no_poll_on_link_down) {
-			adapter->tx_pkt_burst = dev->tx_pkt_burst;
+			adapter->tx_burst_type = tx_burst_type;
 			dev->tx_pkt_burst = iavf_xmit_pkts_no_poll;
 		}
 		return;
@@ -4074,10 +4101,11 @@ iavf_set_tx_function(struct rte_eth_dev *dev)
 	PMD_DRV_LOG(DEBUG, "Using Basic Tx callback (port=%d).",
 		    dev->data->port_id);
 	dev->tx_pkt_burst = iavf_xmit_pkts;
+	tx_burst_type = IAVF_PKT_BURST_DEFAULT;
 	dev->tx_pkt_prepare = iavf_prep_pkts;
 
 	if (no_poll_on_link_down) {
-		adapter->tx_pkt_burst = dev->tx_pkt_burst;
+		adapter->tx_burst_type = tx_burst_type;
 		dev->tx_pkt_burst = iavf_xmit_pkts_no_poll;
 	}
 }
drivers/net/iavf/iavf_rxtx.h +3 -0
index f432f9d956..fadc931b51 100644
@@ -203,6 +203,9 @@ struct iavf_txq_ops {
 	void (*release_mbufs)(struct iavf_tx_queue *txq);
 };
 
+struct iavf_tx_burst_ops {
+	eth_tx_burst_t tx_pkt_burst;
+};
 
 struct iavf_rx_queue_stats {
 	uint64_t reserved;
Signature · 1 line
2.25.1
#10 lore raw

RE: [PATCH v5 1/2] net/iavf: fix Tx path error in multi-process

Quoted 11 lines

-----Original Message-----
From: Mingjin Ye <[email protected]>
Sent: Thursday, December 28, 2023 6:26 PM
To: [email protected]
Cc: Yang, Qiming <[email protected]>; Ye, MingjinX <[email protected]>; [email protected]; Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>
Subject: [PATCH v5 1/2] net/iavf: fix Tx path error in multi-process

Quoted 7 lines

In a multi-process environment, a secondary process operates on shared memory and changes the PMD transmit function pointer of the primary process, causing the primary process to send pkts without being able to find the function address, resulting in a crash.

Fixes 5b3124a0a6ef ("net/iavf: support no polling when link down")

Should Rx also need to be fixed? please make a complete fix.

Quoted 13 lines
---
 drivers/net/iavf/iavf.h      | 12 +++++++++++-
 drivers/net/iavf/iavf_rxtx.c | 34 +++++++++++++++++++++++++++++++---
 drivers/net/iavf/iavf_rxtx.h |  3 +++
 3 files changed, 45 insertions(+), 4 deletions(-)
drivers/net/iavf/iavf.h index renamed from drivers/net/iavf/iavf.h +0 -0

10868f2c30..4cd5bea167 100644

drivers/net/iavf/iavf.h struct iavf_devargs { · line 318

Quoted 6 lines
drivers/net/iavf/iavf.h +3 -0
@@ -313,6 +313,16 @@ struct iavf_devargs {
 
 struct iavf_security_ctx;
 
+enum iavf_tx_pkt_burst_type {
+	IAVF_PKT_BURST_DEFAULT		= 0,
+	IAVF_PKT_BURST_VEC		= 1,

Better to rename with xxx_VEC_SSE

author
#11 lore raw

v6 cover net/iavf: fix Rx/Tx burst and add diagnostics

In reply to Mingjin Ye

Fixed Rx/Tx crash in multi-process environment and added Tx diagnostic feature.

Mingjin Ye (2):
net/iavf: fix Rx/Tx burst in multi-process
net/iavf: add diagnostic support in TX path

 doc/guides/nics/intel_vf.rst   |   4 +
 drivers/net/iavf/iavf.h        |  54 ++++++-
 drivers/net/iavf/iavf_ethdev.c |  68 ++++++++
 drivers/net/iavf/iavf_rxtx.c   | 282 +++++++++++++++++++++++++++++----
 drivers/net/iavf/iavf_rxtx.h   |  10 ++
 5 files changed, 389 insertions(+), 29 deletions(-)
Signature · 1 line
2.25.1
author
#12 lore raw

PATCH v6 1/2 net/iavf: fix Rx/Tx burst in multi-process

In a multi-process environment, a secondary process operates on shared memory and changes the function pointer of the primary process, resulting in a crash when the primary process cannot find the function address during an Rx/Tx burst.

Fixes 5b3124a0a6ef ("net/iavf: support no polling when link down")

---
v2: Add fix for Rx burst.

---
 drivers/net/iavf/iavf.h      |  42 +++++++-
 drivers/net/iavf/iavf_rxtx.c | 184 ++++++++++++++++++++++++++++++-----
 drivers/net/iavf/iavf_rxtx.h |   8 ++
 3 files changed, 205 insertions(+), 29 deletions(-)
drivers/net/iavf/iavf.h +40 -2
index 10868f2c30..8db9f3d7cd 100644
@@ -313,6 +313,44 @@ struct iavf_devargs {
 
 struct iavf_security_ctx;
 
+enum iavf_rx_burst_type {
+	IAVF_RX_BURST_DEFAULT,
+	IAVF_RX_BURST_FRXD,
+	IAVF_RX_BURST_BULK_ALLOC,
+	IAVF_RX_BURST_SCATTERED,
+	IAVF_RX_BURST_SFRXD,
+	IAVF_RX_BURST_VEC_SSE,
+	IAVF_RX_BURST_VEC_AVX2,
+	IAVF_RX_BURST_VEC_AVX2_OFFLOAD,
+	IAVF_RX_BURST_VEC_SSE_FRXD,
+	IAVF_RX_BURST_VEC_AVX2_FRXD,
+	IAVF_RX_BURST_VEC_AVX2_FRXD_OFFLOAD,
+	IAVF_RX_BURST_VEC_SSE_SCATTERED,
+	IAVF_RX_BURST_VEC_AVX2_SCATTERED,
+	IAVF_RX_BURST_VEC_AVX2_SCATTERED_OFFLOAD,
+	IAVF_RX_BURST_VEC_SSE_SFLEX_RXD,
+	IAVF_RX_BURST_VEC_AVX2_SFLEX_RXD,
+	IAVF_RX_BURST_VEC_AVX2_SFRXD_OFFLOAD,
+	IAVF_RX_BURST_VEC_AVX512,
+	IAVF_RX_BURST_VEC_AVX512_OFFLOAD,
+	IAVF_RX_BURST_VEC_AVX512_FRXD,
+	IAVF_RX_BURST_VEC_AVX512_FRXD_OFFLOAD,
+	IAVF_RX_BURST_VEC_AVX512_SCATTERED,
+	IAVF_RX_BURST_VEC_AVX512_SCATTERED_OFFLOAD,
+	IAVF_RX_BURST_VEC_AVX512_SFLEX_RXD,
+	IAVF_RX_BURST_VEC_AVX512_SFRXD_OFFLOAD,
+};
+
+enum iavf_tx_burst_type {
+	IAVF_TX_BURST_DEFAULT,
+	IAVF_TX_BURST_VEC_SSE,
+	IAVF_TX_BURST_VEC_AVX2,
+	IAVF_TX_BURST_VEC_AVX2_OFFLOAD,
+	IAVF_TX_BURST_VEC_AVX512,
+	IAVF_TX_BURST_VEC_AVX512_OFFLOAD,
+	IAVF_TX_BURST_VEC_AVX512_CTX_OFFLOAD,
+};
+
 /* Structure to store private data for each VF instance. */
 struct iavf_adapter {
 	struct iavf_hw hw;
@@ -328,8 +366,8 @@ struct iavf_adapter {
 	bool stopped;
 	bool closed;
 	bool no_poll;
-	eth_rx_burst_t rx_pkt_burst;
-	eth_tx_burst_t tx_pkt_burst;
+	enum iavf_rx_burst_type rx_burst_type;
+	enum iavf_tx_burst_type tx_burst_type;
 	uint16_t fdir_ref_cnt;
 	struct iavf_devargs devargs;
 };
drivers/net/iavf/iavf_rxtx.c +157 -27

367 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.h +8 -0
index f432f9d956..42c18242db 100644
@@ -203,6 +203,14 @@ struct iavf_txq_ops {
 	void (*release_mbufs)(struct iavf_tx_queue *txq);
 };
 
+struct iavf_rx_burst_ops {
+	eth_rx_burst_t rx_pkt_burst;
+};
+
+struct iavf_tx_burst_ops {
+	eth_tx_burst_t tx_pkt_burst;
+};
+
 
 struct iavf_rx_queue_stats {
 	uint64_t reserved;
Signature · 1 line
2.25.1
#13 lore raw

RE: [PATCH v6 1/2] net/iavf: fix Rx/Tx burst in multi-process

Quoted 52 lines

-----Original Message-----
From: Mingjin Ye <[email protected]>
Sent: Friday, December 29, 2023 6:11 PM
To: [email protected]
Cc: Yang, Qiming <[email protected]>; Ye, MingjinX <[email protected]>; [email protected]; Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>
Subject: [PATCH v6 1/2] net/iavf: fix Rx/Tx burst in multi-process

In a multi-process environment, a secondary process operates on shared memory and changes the function pointer of the primary process, resulting in a crash when the primary process cannot find the function address during an Rx/Tx burst.

Fixes 5b3124a0a6ef ("net/iavf: support no polling when link down")

---
v2: Add fix for Rx burst.

---
 drivers/net/iavf/iavf.h      |  42 +++++++-
 drivers/net/iavf/iavf_rxtx.c | 184 ++++++++++++++++++++++++++++++-----
 drivers/net/iavf/iavf_rxtx.h |   8 ++
 3 files changed, 205 insertions(+), 29 deletions(-)
drivers/net/iavf/iavf.h index renamed from drivers/net/iavf/iavf.h +0 -0

10868f2c30..8db9f3d7cd 100644

drivers/net/iavf/iavf.h +16 -0
@@ -313,6 +313,44 @@ struct iavf_devargs {
 
 struct iavf_security_ctx;
 
+enum iavf_rx_burst_type {
+	IAVF_RX_BURST_DEFAULT,
+	IAVF_RX_BURST_FRXD,
+	IAVF_RX_BURST_BULK_ALLOC,
+	IAVF_RX_BURST_SCATTERED,
+	IAVF_RX_BURST_SFRXD,
+	IAVF_RX_BURST_VEC_SSE,
+	IAVF_RX_BURST_VEC_AVX2,
+	IAVF_RX_BURST_VEC_AVX2_OFFLOAD,
+	IAVF_RX_BURST_VEC_SSE_FRXD,
+	IAVF_RX_BURST_VEC_AVX2_FRXD,
+	IAVF_RX_BURST_VEC_AVX2_FRXD_OFFLOAD,
+	IAVF_RX_BURST_VEC_SSE_SCATTERED,
+	IAVF_RX_BURST_VEC_AVX2_SCATTERED,
+	IAVF_RX_BURST_VEC_AVX2_SCATTERED_OFFLOAD,
+	IAVF_RX_BURST_VEC_SSE_SFLEX_RXD,

drivers/net/iavf/iavf.h struct iavf_devargs { · line 341

Quoted 10 lines
drivers/net/iavf/iavf.h +10 -0
+	IAVF_RX_BURST_VEC_AVX2_SFLEX_RXD,
+	IAVF_RX_BURST_VEC_AVX2_SFRXD_OFFLOAD,
+	IAVF_RX_BURST_VEC_AVX512,
+	IAVF_RX_BURST_VEC_AVX512_OFFLOAD,
+	IAVF_RX_BURST_VEC_AVX512_FRXD,
+	IAVF_RX_BURST_VEC_AVX512_FRXD_OFFLOAD,
+	IAVF_RX_BURST_VEC_AVX512_SCATTERED,
+	IAVF_RX_BURST_VEC_AVX512_SCATTERED_OFFLOAD,
+	IAVF_RX_BURST_VEC_AVX512_SFLEX_RXD,
+	IAVF_RX_BURST_VEC_AVX512_SFRXD_OFFLOAD,

What is SFLEX, SFRXD, SFRXD, FRXD, please make it clear by following a consistent naming pattern.
Btw, you can consider removing BURST and VEC which didn't give any additional information if you are looking for a short name.

....

Quoted 8 lines
drivers/net/iavf/iavf.h +1 -0
@@ -3809,42 +3886,64 @@ iavf_set_rx_function(struct rte_eth_dev *dev)
 			}
 			if (use_flex) {
 				dev->rx_pkt_burst =
 iavf_recv_scattered_pkts_vec_flex_rxd;
+				rx_burst_type =
 IAVF_RX_BURST_VEC_SSE_SFLEX_RXD;
 				if (use_avx2) {

drivers/net/iavf/iavf.h iavf_set_rx_function(struct rte_eth_dev *dev) · line 3900

Quoted 10 lines
drivers/net/iavf/iavf.h +3 -2
-					if (check_ret == IAVF_VECTOR_PATH)
+					if (check_ret == IAVF_VECTOR_PATH)
 {
 						dev->rx_pkt_burst =
 
 	iavf_recv_scattered_pkts_vec_avx2_flex_rxd;
-					else
+						rx_burst_type =
+
 	IAVF_RX_BURST_VEC_AVX2_SFLEX_RXD;

As you already introduce the burst_type, its not necessary to set the function pointer for each case. Why not just
dev->rx_pkt_burst = rx_burst_ops[rx_burst_type] at last?

....

drivers/net/iavf/iavf.h iavf_set_rx_function(struct rte_eth_dev *dev) · line 3903

Quoted 3 lines
drivers/net/iavf/iavf.h +3 -0
+struct iavf_rx_burst_ops {
+	eth_rx_burst_t rx_pkt_burst;
+};

Why create a wrapper here but not just use eth_rx_burst_t directly?

author
#14 lore raw

v7 cover net/iavf: fix Rx/Tx burst and add diagnostics

In reply to Mingjin Ye

Fixed Rx/Tx crash in multi-process environment and added Tx diagnostic feature.

Mingjin Ye (2):
net/iavf: fix Rx/Tx burst in multi-process
net/iavf: add diagnostic support in TX path

 doc/guides/nics/intel_vf.rst   |   4 +
 drivers/net/iavf/iavf.h        |  54 ++++++-
 drivers/net/iavf/iavf_ethdev.c |  72 +++++++++
 drivers/net/iavf/iavf_rxtx.c   | 271 ++++++++++++++++++++++++++-------
 drivers/net/iavf/iavf_rxtx.h   |   2 +
 5 files changed, 345 insertions(+), 58 deletions(-)
Signature · 1 line
2.25.1
author
#15 lore raw

PATCH v7 1/2 net/iavf: fix Rx/Tx burst in multi-process

In a multi-process environment, a secondary process operates on shared memory and changes the function pointer of the primary process, resulting in a crash when the primary process cannot find the function address during an Rx/Tx burst.

Fixes 5b3124a0a6ef ("net/iavf: support no polling when link down")

---
v2: Add fix for Rx burst.
---
v3: fix Rx/Tx routing.

---
 drivers/net/iavf/iavf.h      |  42 ++++++++-
 drivers/net/iavf/iavf_rxtx.c | 173 +++++++++++++++++++++++------------
 2 files changed, 157 insertions(+), 58 deletions(-)
drivers/net/iavf/iavf.h +40 -2
index 10868f2c30..73a089c199 100644
@@ -313,6 +313,44 @@ struct iavf_devargs {
 
 struct iavf_security_ctx;
 
+enum iavf_rx_burst_type {
+	IAVF_RX_DEFAULT,
+	IAVF_RX_FLEX_RXD,
+	IAVF_RX_BULK_ALLOC,
+	IAVF_RX_SCATTERED,
+	IAVF_RX_SCATTERED_FLEX_RXD,
+	IAVF_RX_SSE,
+	IAVF_RX_AVX2,
+	IAVF_RX_AVX2_OFFLOAD,
+	IAVF_RX_SSE_FLEX_RXD,
+	IAVF_RX_AVX2_FLEX_RXD,
+	IAVF_RX_AVX2_FLEX_RXD_OFFLOAD,
+	IAVF_RX_SSE_SCATTERED,
+	IAVF_RX_AVX2_SCATTERED,
+	IAVF_RX_AVX2_SCATTERED_OFFLOAD,
+	IAVF_RX_SSE_SCATTERED_FLEX_RXD,
+	IAVF_RX_AVX2_SCATTERED_FLEX_RXD,
+	IAVF_RX_AVX2_SCATTERED_FLEX_RXD_OFFLOAD,
+	IAVF_RX_AVX512,
+	IAVF_RX_AVX512_OFFLOAD,
+	IAVF_RX_AVX512_FLEX_RXD,
+	IAVF_RX_AVX512_FLEX_RXD_OFFLOAD,
+	IAVF_RX_AVX512_SCATTERED,
+	IAVF_RX_AVX512_SCATTERED_OFFLOAD,
+	IAVF_RX_AVX512_SCATTERED_FLEX_RXD,
+	IAVF_RX_AVX512_SCATTERED_FLEX_RXD_OFFLOAD,
+};
+
+enum iavf_tx_burst_type {
+	IAVF_TX_DEFAULT,
+	IAVF_TX_SSE,
+	IAVF_TX_AVX2,
+	IAVF_TX_AVX2_OFFLOAD,
+	IAVF_TX_AVX512,
+	IAVF_TX_AVX512_OFFLOAD,
+	IAVF_TX_AVX512_CTX_OFFLOAD,
+};
+
 /* Structure to store private data for each VF instance. */
 struct iavf_adapter {
 	struct iavf_hw hw;
@@ -328,8 +366,8 @@ struct iavf_adapter {
 	bool stopped;
 	bool closed;
 	bool no_poll;
-	eth_rx_burst_t rx_pkt_burst;
-	eth_tx_burst_t tx_pkt_burst;
+	enum iavf_rx_burst_type rx_burst_type;
+	enum iavf_tx_burst_type tx_burst_type;
 	uint16_t fdir_ref_cnt;
 	struct iavf_devargs devargs;
 };
drivers/net/iavf/iavf_rxtx.c +117 -56

338 lines not on this page · raw message

Signature · 1 line
2.25.1
#16 lore raw

RE: [PATCH v7 1/2] net/iavf: fix Rx/Tx burst in multi-process

Quoted 94 lines

-----Original Message-----
From: Mingjin Ye <[email protected]>
Sent: Tuesday, January 2, 2024 6:52 PM
To: [email protected]
Cc: Yang, Qiming <[email protected]>; Ye, MingjinX <[email protected]>; [email protected]; Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>
Subject: [PATCH v7 1/2] net/iavf: fix Rx/Tx burst in multi-process

In a multi-process environment, a secondary process operates on shared memory and changes the function pointer of the primary process, resulting in a crash when the primary process cannot find the function address during an Rx/Tx burst.

Fixes 5b3124a0a6ef ("net/iavf: support no polling when link down")

---
v2: Add fix for Rx burst.
---
v3: fix Rx/Tx routing.

---
 drivers/net/iavf/iavf.h      |  42 ++++++++-
 drivers/net/iavf/iavf_rxtx.c | 173 +++++++++++++++++++++++------------
 2 files changed, 157 insertions(+), 58 deletions(-)
drivers/net/iavf/iavf.h index renamed from drivers/net/iavf/iavf.h +0 -0

10868f2c30..73a089c199 100644

drivers/net/iavf/iavf.h +40 -2
@@ -313,6 +313,44 @@ struct iavf_devargs {
 
 struct iavf_security_ctx;
 
+enum iavf_rx_burst_type {
+	IAVF_RX_DEFAULT,
+	IAVF_RX_FLEX_RXD,
+	IAVF_RX_BULK_ALLOC,
+	IAVF_RX_SCATTERED,
+	IAVF_RX_SCATTERED_FLEX_RXD,
+	IAVF_RX_SSE,
+	IAVF_RX_AVX2,
+	IAVF_RX_AVX2_OFFLOAD,
+	IAVF_RX_SSE_FLEX_RXD,
+	IAVF_RX_AVX2_FLEX_RXD,
+	IAVF_RX_AVX2_FLEX_RXD_OFFLOAD,
+	IAVF_RX_SSE_SCATTERED,
+	IAVF_RX_AVX2_SCATTERED,
+	IAVF_RX_AVX2_SCATTERED_OFFLOAD,
+	IAVF_RX_SSE_SCATTERED_FLEX_RXD,
+	IAVF_RX_AVX2_SCATTERED_FLEX_RXD,
+	IAVF_RX_AVX2_SCATTERED_FLEX_RXD_OFFLOAD,
+	IAVF_RX_AVX512,
+	IAVF_RX_AVX512_OFFLOAD,
+	IAVF_RX_AVX512_FLEX_RXD,
+	IAVF_RX_AVX512_FLEX_RXD_OFFLOAD,
+	IAVF_RX_AVX512_SCATTERED,
+	IAVF_RX_AVX512_SCATTERED_OFFLOAD,
+	IAVF_RX_AVX512_SCATTERED_FLEX_RXD,
+	IAVF_RX_AVX512_SCATTERED_FLEX_RXD_OFFLOAD,
+};
+
+enum iavf_tx_burst_type {
+	IAVF_TX_DEFAULT,
+	IAVF_TX_SSE,
+	IAVF_TX_AVX2,
+	IAVF_TX_AVX2_OFFLOAD,
+	IAVF_TX_AVX512,
+	IAVF_TX_AVX512_OFFLOAD,
+	IAVF_TX_AVX512_CTX_OFFLOAD,
+};
+
 /* Structure to store private data for each VF instance. */  struct iavf_adapter
 {
 	struct iavf_hw hw;
@@ -328,8 +366,8 @@ struct iavf_adapter {
 	bool stopped;
 	bool closed;
 	bool no_poll;
-	eth_rx_burst_t rx_pkt_burst;
-	eth_tx_burst_t tx_pkt_burst;
+	enum iavf_rx_burst_type rx_burst_type;
+	enum iavf_tx_burst_type tx_burst_type;
 	uint16_t fdir_ref_cnt;
 	struct iavf_devargs devargs;
 };
drivers/net/iavf/iavf_rxtx.c index renamed from drivers/net/iavf/iavf_rxtx.c +0 -0

f19aa14646..13b932ad85 100644

drivers/net/iavf/iavf_rxtx.c iavf_prep_pkts(__rte_unused void *tx_queue, · line 3712

Quoted 6 lines
drivers/net/iavf/iavf_rxtx.c +2 -0
@@ -3707,15 +3707,68 @@ iavf_prep_pkts(__rte_unused void *tx_queue,
 struct rte_mbuf **tx_pkts,
 	return i;
 }
 
+static
+const eth_rx_burst_t iavf_rx_pkt_burst_ops[] = {

Its will broke if we insert a new type without change the ops array.

It's better to explicitly initial an array with index

[IAVF_RX_DEFAULT] = iavf_recv_pkts,

....

author
#17 lore raw

PATCH v7 2/2 net/iavf: add diagnostic support in TX path

In reply to Mingjin Ye

The only way to enable diagnostics for TX paths is to modify the application source code. Making it difficult to diagnose faults.

In this patch, the devarg option "mbuf_check" is introduced and the parameters are configured to enable the corresponding diagnostics.

supported cases: mbuf, size, segment, offload.
1. mbuf: check for corrupted mbuf.
2. size: check min/max packet length according to hw spec.
3. segment: check number of mbuf segments not exceed hw limitation.
4. offload: check any unsupported offload flag.

parameter format: mbuf_check=[mbuf,<case1>,<case2>]
eg: dpdk-testpmd -a 0000:81:01.0,mbuf_check=[mbuf,size] -- -i

---
v2: Remove call chain.
---
v3: Optimisation implementation.
---
v4: Fix Windows os compilation error.
---
v5: Split Patch.
---
v6: remove strict.

---
 doc/guides/nics/intel_vf.rst   |  4 ++
 drivers/net/iavf/iavf.h        | 12 +++++
 drivers/net/iavf/iavf_ethdev.c | 72 +++++++++++++++++++++++++
 drivers/net/iavf/iavf_rxtx.c   | 98 ++++++++++++++++++++++++++++++++++
 drivers/net/iavf/iavf_rxtx.h   |  2 +
 5 files changed, 188 insertions(+)
doc/guides/nics/intel_vf.rst +4 -0
index ad08198f0f..8e39bc831c 100644
@@ -111,6 +111,10 @@ For more detail on SR-IOV, please refer to the following documents:
     by setting the ``devargs`` parameter like ``-a 18:01.0,no-poll-on-link-down=1``
     when IAVF is backed by an Intel\ |reg| E810 device or an Intel\ |reg| 700 Series Ethernet device.
 
+    Enable mbuf check for Tx diagnostics by setting the devargs parameter like
+    ``-a 18:01.0,mbuf_check=[mbuf,<case1>,<case2>]`` when IAVF is backed by an
+    Intel\ |reg| E810 device or an Intel\ |reg| 700 Series Ethernet device.
+
 The PCIE host-interface of Intel Ethernet Switch FM10000 Series VF infrastructure
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
drivers/net/iavf/iavf.h +12 -0
index 73a089c199..6535b624cb 100644
@@ -113,9 +113,14 @@ struct iavf_ipsec_crypto_stats {
 	} ierrors;
 };
 
+struct iavf_mbuf_stats {
+	uint64_t tx_pkt_errors;
+};
+
 struct iavf_eth_xstats {
 	struct virtchnl_eth_stats eth_stats;
 	struct iavf_ipsec_crypto_stats ips_stats;
+	struct iavf_mbuf_stats mbuf_stats;
 };
 
 /* Structure that defines a VSI, associated with a adapter. */
@@ -309,6 +314,7 @@ struct iavf_devargs {
 	uint32_t watchdog_period;
 	int auto_reset;
 	int no_poll_on_link_down;
+	int mbuf_check;
 };
 
 struct iavf_security_ctx;
@@ -351,6 +357,11 @@ enum iavf_tx_burst_type {
 	IAVF_TX_AVX512_CTX_OFFLOAD,
 };
 
+#define IAVF_MBUF_CHECK_F_TX_MBUF        (1ULL << 0)
+#define IAVF_MBUF_CHECK_F_TX_SIZE        (1ULL << 1)
+#define IAVF_MBUF_CHECK_F_TX_SEGMENT     (1ULL << 2)
+#define IAVF_MBUF_CHECK_F_TX_OFFLOAD     (1ULL << 3)
+
 /* Structure to store private data for each VF instance. */
 struct iavf_adapter {
 	struct iavf_hw hw;
@@ -368,6 +379,7 @@ struct iavf_adapter {
 	bool no_poll;
 	enum iavf_rx_burst_type rx_burst_type;
 	enum iavf_tx_burst_type tx_burst_type;
+	uint64_t mc_flags; /* mbuf check flags. */
 	uint16_t fdir_ref_cnt;
 	struct iavf_devargs devargs;
 };
drivers/net/iavf/iavf_ethdev.c +72 -0

126 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.c +98 -0

122 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.h +2 -0
index f432f9d956..90e7291928 100644
@@ -297,6 +297,8 @@ struct iavf_tx_queue {
 	uint16_t next_rs;              /* next to check DD,  for VPMD */
 	uint16_t ipsec_crypto_pkt_md_offset;
 
+	uint64_t mbuf_errors;
+
 	bool q_set;                    /* if rx queue has been configured */
 	bool tx_deferred_start;        /* don't start this queue in dev start */
 	const struct iavf_txq_ops *ops;
Signature · 1 line
2.25.1
#18 lore raw
Quoted 61 lines

-----Original Message-----
From: Mingjin Ye <[email protected]>
Sent: Tuesday, January 2, 2024 6:52 PM
To: [email protected]
Cc: Yang, Qiming <[email protected]>; Ye, MingjinX <[email protected]>; Wu, Wenjun1 <[email protected]>; Zhang, Yuying <[email protected]>; Xing, Beilei <[email protected]>; Su, Simei <[email protected]>; Wu, Jingjing <[email protected]>
Subject: [PATCH v7 2/2] net/iavf: add diagnostic support in TX path

The only way to enable diagnostics for TX paths is to modify the application source code. Making it difficult to diagnose faults.

In this patch, the devarg option "mbuf_check" is introduced and the parameters are configured to enable the corresponding diagnostics.

supported cases: mbuf, size, segment, offload.
1. mbuf: check for corrupted mbuf.
2. size: check min/max packet length according to hw spec.
3. segment: check number of mbuf segments not exceed hw limitation.
4. offload: check any unsupported offload flag.

parameter format: mbuf_check=[mbuf,<case1>,<case2>]
eg: dpdk-testpmd -a 0000:81:01.0,mbuf_check=[mbuf,size] -- -i

---
v2: Remove call chain.
---
v3: Optimisation implementation.
---
v4: Fix Windows os compilation error.
---
v5: Split Patch.
---
v6: remove strict.

---
 doc/guides/nics/intel_vf.rst   |  4 ++
 drivers/net/iavf/iavf.h        | 12 +++++
 drivers/net/iavf/iavf_ethdev.c | 72 +++++++++++++++++++++++++
 drivers/net/iavf/iavf_rxtx.c   | 98 ++++++++++++++++++++++++++++++++++
 drivers/net/iavf/iavf_rxtx.h   |  2 +
 5 files changed, 188 insertions(+)
doc/guides/nics/intel_vf.rst index renamed from doc/guides/nics/intel_vf.rst +0 -0

ad08198f0f..8e39bc831c 100644

doc/guides/nics/intel_vf.rst +0 -0
@@ -111,6 +111,10 @@ For more detail on SR-IOV, please refer to the

following documents:

     by setting the ``devargs`` parameter like ``-a 18:01.0,no-poll-on-link-
down=1``
     when IAVF is backed by an Intel\ |reg| E810 device or an Intel\ |reg| 700

Series Ethernet device.

+ Enable mbuf check for Tx diagnostics by setting the devargs parameter
like
+ ``-a 18:01.0,mbuf_check=[mbuf,<case1>,<case2>]`` when IAVF is backed
by an

doc/guides/nics/intel_vf.rst For more detail on SR-IOV, please refer to the following documents: · line 117

Quoted 2 lines
doc/guides/nics/intel_vf.rst +2 -0
+    Intel\ |reg| E810 device or an Intel\ |reg| 700 Series Ethernet device.
+

Please list all the options with descriptions which you already have them in the commit log. Its necessary for user to understand the detail about how to use the devarg from document.

author
#19 lore raw

v8 cover net/iavf: fix Rx/Tx burst and add diagnostics

In reply to Mingjin Ye

Fixed Rx/Tx crash in multi-process environment and added Tx diagnostic feature.

Mingjin Ye (2):
net/iavf: fix Rx/Tx burst in multi-process
net/iavf: add diagnostic support in TX path

 doc/guides/nics/intel_vf.rst   |   9 ++
 drivers/net/iavf/iavf.h        |  54 ++++++-
 drivers/net/iavf/iavf_ethdev.c |  76 +++++++++
 drivers/net/iavf/iavf_rxtx.c   | 280 ++++++++++++++++++++++++++-------
 drivers/net/iavf/iavf_rxtx.h   |   2 +
 5 files changed, 363 insertions(+), 58 deletions(-)
Signature · 1 line
2.25.1
author
#20 lore raw

PATCH v8 1/2 net/iavf: fix Rx/Tx burst in multi-process

In a multi-process environment, a secondary process operates on shared memory and changes the function pointer of the primary process, resulting in a crash when the primary process cannot find the function address during an Rx/Tx burst.

Fixes 5b3124a0a6ef ("net/iavf: support no polling when link down")

---
v2: Add fix for Rx burst.
---
v3: fix Rx/Tx routing.
---
v4: Fix the ops array.

---
 drivers/net/iavf/iavf.h      |  42 +++++++-
 drivers/net/iavf/iavf_rxtx.c | 182 ++++++++++++++++++++++++-----------
 2 files changed, 166 insertions(+), 58 deletions(-)
drivers/net/iavf/iavf.h +40 -2
index 10868f2c30..73a089c199 100644
@@ -313,6 +313,44 @@ struct iavf_devargs {
 
 struct iavf_security_ctx;
 
+enum iavf_rx_burst_type {
+	IAVF_RX_DEFAULT,
+	IAVF_RX_FLEX_RXD,
+	IAVF_RX_BULK_ALLOC,
+	IAVF_RX_SCATTERED,
+	IAVF_RX_SCATTERED_FLEX_RXD,
+	IAVF_RX_SSE,
+	IAVF_RX_AVX2,
+	IAVF_RX_AVX2_OFFLOAD,
+	IAVF_RX_SSE_FLEX_RXD,
+	IAVF_RX_AVX2_FLEX_RXD,
+	IAVF_RX_AVX2_FLEX_RXD_OFFLOAD,
+	IAVF_RX_SSE_SCATTERED,
+	IAVF_RX_AVX2_SCATTERED,
+	IAVF_RX_AVX2_SCATTERED_OFFLOAD,
+	IAVF_RX_SSE_SCATTERED_FLEX_RXD,
+	IAVF_RX_AVX2_SCATTERED_FLEX_RXD,
+	IAVF_RX_AVX2_SCATTERED_FLEX_RXD_OFFLOAD,
+	IAVF_RX_AVX512,
+	IAVF_RX_AVX512_OFFLOAD,
+	IAVF_RX_AVX512_FLEX_RXD,
+	IAVF_RX_AVX512_FLEX_RXD_OFFLOAD,
+	IAVF_RX_AVX512_SCATTERED,
+	IAVF_RX_AVX512_SCATTERED_OFFLOAD,
+	IAVF_RX_AVX512_SCATTERED_FLEX_RXD,
+	IAVF_RX_AVX512_SCATTERED_FLEX_RXD_OFFLOAD,
+};
+
+enum iavf_tx_burst_type {
+	IAVF_TX_DEFAULT,
+	IAVF_TX_SSE,
+	IAVF_TX_AVX2,
+	IAVF_TX_AVX2_OFFLOAD,
+	IAVF_TX_AVX512,
+	IAVF_TX_AVX512_OFFLOAD,
+	IAVF_TX_AVX512_CTX_OFFLOAD,
+};
+
 /* Structure to store private data for each VF instance. */
 struct iavf_adapter {
 	struct iavf_hw hw;
@@ -328,8 +366,8 @@ struct iavf_adapter {
 	bool stopped;
 	bool closed;
 	bool no_poll;
-	eth_rx_burst_t rx_pkt_burst;
-	eth_tx_burst_t tx_pkt_burst;
+	enum iavf_rx_burst_type rx_burst_type;
+	enum iavf_tx_burst_type tx_burst_type;
 	uint16_t fdir_ref_cnt;
 	struct iavf_devargs devargs;
 };
drivers/net/iavf/iavf_rxtx.c +126 -56

347 lines not on this page · raw message

Signature · 1 line
2.25.1
author
#21 lore raw

PATCH v8 2/2 net/iavf: add diagnostic support in TX path

In reply to Mingjin Ye

The only way to enable diagnostics for TX paths is to modify the application source code. Making it difficult to diagnose faults.

In this patch, the devarg option "mbuf_check" is introduced and the parameters are configured to enable the corresponding diagnostics.

supported cases: mbuf, size, segment, offload.
1. mbuf: check for corrupted mbuf.
2. size: check min/max packet length according to hw spec.
3. segment: check number of mbuf segments not exceed hw limitation.
4. offload: check any unsupported offload flag.

parameter format: mbuf_check=[mbuf,<case1>,<case2>]
eg: dpdk-testpmd -a 0000:81:01.0,mbuf_check=[mbuf,size] -- -i

---
v2: Remove call chain.
---
v3: Optimisation implementation.
---
v4: Fix Windows os compilation error.
---
v5: Split Patch.
---
v6: remove strict.
---
v7: Modify the description document.

---
 doc/guides/nics/intel_vf.rst   |  9 ++++
 drivers/net/iavf/iavf.h        | 12 +++++
 drivers/net/iavf/iavf_ethdev.c | 76 ++++++++++++++++++++++++++
 drivers/net/iavf/iavf_rxtx.c   | 98 ++++++++++++++++++++++++++++++++++
 drivers/net/iavf/iavf_rxtx.h   |  2 +
 5 files changed, 197 insertions(+)
doc/guides/nics/intel_vf.rst +9 -0
index ad08198f0f..bda6648726 100644
@@ -111,6 +111,15 @@ For more detail on SR-IOV, please refer to the following documents:
     by setting the ``devargs`` parameter like ``-a 18:01.0,no-poll-on-link-down=1``
     when IAVF is backed by an Intel\ |reg| E810 device or an Intel\ |reg| 700 Series Ethernet device.
 
+    When IAVF is backed by an Intel\ |reg| E810 device or an Intel\ |reg| 700 series Ethernet devices.
+    Set the ``devargs`` parameter ``mbuf_check`` to enable TX diagnostics. For example,
+    ``-a 18:01.0,mbuf_check=mbuf`` or ``-a 18:01.0,mbuf_check=[mbuf,size]``. Supported cases:
+
+    *   mbuf: Check for corrupted mbuf.
+    *   size: Check min/max packet length according to hw spec.
+    *   segment: Check number of mbuf segments not exceed hw limitation.
+    *   offload: Check any unsupported offload flag.
+
 The PCIE host-interface of Intel Ethernet Switch FM10000 Series VF infrastructure
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
drivers/net/iavf/iavf.h +12 -0
index 73a089c199..6535b624cb 100644
@@ -113,9 +113,14 @@ struct iavf_ipsec_crypto_stats {
 	} ierrors;
 };
 
+struct iavf_mbuf_stats {
+	uint64_t tx_pkt_errors;
+};
+
 struct iavf_eth_xstats {
 	struct virtchnl_eth_stats eth_stats;
 	struct iavf_ipsec_crypto_stats ips_stats;
+	struct iavf_mbuf_stats mbuf_stats;
 };
 
 /* Structure that defines a VSI, associated with a adapter. */
@@ -309,6 +314,7 @@ struct iavf_devargs {
 	uint32_t watchdog_period;
 	int auto_reset;
 	int no_poll_on_link_down;
+	int mbuf_check;
 };
 
 struct iavf_security_ctx;
@@ -351,6 +357,11 @@ enum iavf_tx_burst_type {
 	IAVF_TX_AVX512_CTX_OFFLOAD,
 };
 
+#define IAVF_MBUF_CHECK_F_TX_MBUF        (1ULL << 0)
+#define IAVF_MBUF_CHECK_F_TX_SIZE        (1ULL << 1)
+#define IAVF_MBUF_CHECK_F_TX_SEGMENT     (1ULL << 2)
+#define IAVF_MBUF_CHECK_F_TX_OFFLOAD     (1ULL << 3)
+
 /* Structure to store private data for each VF instance. */
 struct iavf_adapter {
 	struct iavf_hw hw;
@@ -368,6 +379,7 @@ struct iavf_adapter {
 	bool no_poll;
 	enum iavf_rx_burst_type rx_burst_type;
 	enum iavf_tx_burst_type tx_burst_type;
+	uint64_t mc_flags; /* mbuf check flags. */
 	uint16_t fdir_ref_cnt;
 	struct iavf_devargs devargs;
 };
drivers/net/iavf/iavf_ethdev.c +76 -0

130 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.c +98 -0

122 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.h +2 -0
index f432f9d956..90e7291928 100644
@@ -297,6 +297,8 @@ struct iavf_tx_queue {
 	uint16_t next_rs;              /* next to check DD,  for VPMD */
 	uint16_t ipsec_crypto_pkt_md_offset;
 
+	uint64_t mbuf_errors;
+
 	bool q_set;                    /* if rx queue has been configured */
 	bool tx_deferred_start;        /* don't start this queue in dev start */
 	const struct iavf_txq_ops *ops;
Signature · 1 line
2.25.1
author
#22 lore raw

v9 cover net/iavf: fix Rx/Tx burst and add diagnostics

Fixed Rx/Tx crash in multi-process environment and added Tx diagnostic feature.

Mingjin Ye (2):
net/iavf: fix Rx/Tx burst in multi-process
net/iavf: add diagnostic support in TX path

 doc/guides/nics/intel_vf.rst   |   9 ++
 drivers/net/iavf/iavf.h        |  55 ++++++-
 drivers/net/iavf/iavf_ethdev.c |  75 +++++++++
 drivers/net/iavf/iavf_rxtx.c   | 283 ++++++++++++++++++++++++++-------
 drivers/net/iavf/iavf_rxtx.h   |   2 +
 5 files changed, 365 insertions(+), 59 deletions(-)
Signature · 1 line
2.25.1
author
#23 lore raw

PATCH v9 1/2 net/iavf: fix Rx/Tx burst in multi-process

In a multi-process environment, a secondary process operates on shared memory and changes the function pointer of the primary process, resulting in a crash when the primary process cannot find the function address during an Rx/Tx burst.

Fixes 5b3124a0a6ef ("net/iavf: support no polling when link down")

---
v2: Add fix for Rx burst.
---
v3: fix Rx/Tx routing.
---
v4: Fix the ops array.
---
v5: rebase.

---
 drivers/net/iavf/iavf.h      |  43 +++++++-
 drivers/net/iavf/iavf_rxtx.c | 185 ++++++++++++++++++++++++-----------
 2 files changed, 169 insertions(+), 59 deletions(-)
drivers/net/iavf/iavf.h +41 -2
index d273d884f5..ab24cb02c3 100644
@@ -314,6 +314,45 @@ struct iavf_devargs {
 
 struct iavf_security_ctx;
 
+enum iavf_rx_burst_type {
+	IAVF_RX_DEFAULT,
+	IAVF_RX_FLEX_RXD,
+	IAVF_RX_BULK_ALLOC,
+	IAVF_RX_SCATTERED,
+	IAVF_RX_SCATTERED_FLEX_RXD,
+	IAVF_RX_SSE,
+	IAVF_RX_AVX2,
+	IAVF_RX_AVX2_OFFLOAD,
+	IAVF_RX_SSE_FLEX_RXD,
+	IAVF_RX_AVX2_FLEX_RXD,
+	IAVF_RX_AVX2_FLEX_RXD_OFFLOAD,
+	IAVF_RX_SSE_SCATTERED,
+	IAVF_RX_AVX2_SCATTERED,
+	IAVF_RX_AVX2_SCATTERED_OFFLOAD,
+	IAVF_RX_SSE_SCATTERED_FLEX_RXD,
+	IAVF_RX_AVX2_SCATTERED_FLEX_RXD,
+	IAVF_RX_AVX2_SCATTERED_FLEX_RXD_OFFLOAD,
+	IAVF_RX_AVX512,
+	IAVF_RX_AVX512_OFFLOAD,
+	IAVF_RX_AVX512_FLEX_RXD,
+	IAVF_RX_AVX512_FLEX_RXD_OFFLOAD,
+	IAVF_RX_AVX512_SCATTERED,
+	IAVF_RX_AVX512_SCATTERED_OFFLOAD,
+	IAVF_RX_AVX512_SCATTERED_FLEX_RXD,
+	IAVF_RX_AVX512_SCATTERED_FLEX_RXD_OFFLOAD,
+};
+
+enum iavf_tx_burst_type {
+	IAVF_TX_DEFAULT,
+	IAVF_TX_SSE,
+	IAVF_TX_AVX2,
+	IAVF_TX_AVX2_OFFLOAD,
+	IAVF_TX_AVX512,
+	IAVF_TX_AVX512_OFFLOAD,
+	IAVF_TX_AVX512_CTX,
+	IAVF_TX_AVX512_CTX_OFFLOAD,
+};
+
 /* Structure to store private data for each VF instance. */
 struct iavf_adapter {
 	struct iavf_hw hw;
@@ -329,8 +368,8 @@ struct iavf_adapter {
 	bool stopped;
 	bool closed;
 	bool no_poll;
-	eth_rx_burst_t rx_pkt_burst;
-	eth_tx_burst_t tx_pkt_burst;
+	enum iavf_rx_burst_type rx_burst_type;
+	enum iavf_tx_burst_type tx_burst_type;
 	uint16_t fdir_ref_cnt;
 	struct iavf_devargs devargs;
 };
drivers/net/iavf/iavf_rxtx.c +128 -57

354 lines not on this page · raw message

Signature · 1 line
2.25.1
author
#24 lore raw

PATCH v9 2/2 net/iavf: add diagnostic support in TX path

In reply to Mingjin Ye

The only way to enable diagnostics for TX paths is to modify the application source code. Making it difficult to diagnose faults.

In this patch, the devarg option "mbuf_check" is introduced and the parameters are configured to enable the corresponding diagnostics.

supported cases: mbuf, size, segment, offload.
1. mbuf: check for corrupted mbuf.
2. size: check min/max packet length according to hw spec.
3. segment: check number of mbuf segments not exceed hw limitation.
4. offload: check any unsupported offload flag.

parameter format: mbuf_check=[mbuf,<case1>,<case2>]
eg: dpdk-testpmd -a 0000:81:01.0,mbuf_check=[mbuf,size] -- -i

---
v2: Remove call chain.
---
v3: Optimisation implementation.
---
v4: Fix Windows os compilation error.
---
v5: Split Patch.
---
v6: remove strict.
---
v8: Modify the description document.

---
 doc/guides/nics/intel_vf.rst   |  9 ++++
 drivers/net/iavf/iavf.h        | 12 +++++
 drivers/net/iavf/iavf_ethdev.c | 75 ++++++++++++++++++++++++++
 drivers/net/iavf/iavf_rxtx.c   | 98 ++++++++++++++++++++++++++++++++++
 drivers/net/iavf/iavf_rxtx.h   |  2 +
 5 files changed, 196 insertions(+)
doc/guides/nics/intel_vf.rst +9 -0
index ce96c2e1f8..bf6936082e 100644
@@ -111,6 +111,15 @@ For more detail on SR-IOV, please refer to the following documents:
     by setting the ``devargs`` parameter like ``-a 18:01.0,no-poll-on-link-down=1``
     when IAVF is backed by an Intel\ |reg| E810 device or an Intel\ |reg| 700 Series Ethernet device.
 
+    When IAVF is backed by an Intel\ |reg| E810 device or an Intel\ |reg| 700 series Ethernet devices.
+    Set the ``devargs`` parameter ``mbuf_check`` to enable TX diagnostics. For example,
+    ``-a 18:01.0,mbuf_check=mbuf`` or ``-a 18:01.0,mbuf_check=[mbuf,size]``. Supported cases:
+
+    *   mbuf: Check for corrupted mbuf.
+    *   size: Check min/max packet length according to hw spec.
+    *   segment: Check number of mbuf segments not exceed hw limitation.
+    *   offload: Check any unsupported offload flag.
+
 The PCIE host-interface of Intel Ethernet Switch FM10000 Series VF infrastructure
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
drivers/net/iavf/iavf.h +12 -0
index ab24cb02c3..23c0496d54 100644
@@ -114,9 +114,14 @@ struct iavf_ipsec_crypto_stats {
 	} ierrors;
 };
 
+struct iavf_mbuf_stats {
+	uint64_t tx_pkt_errors;
+};
+
 struct iavf_eth_xstats {
 	struct virtchnl_eth_stats eth_stats;
 	struct iavf_ipsec_crypto_stats ips_stats;
+	struct iavf_mbuf_stats mbuf_stats;
 };
 
 /* Structure that defines a VSI, associated with a adapter. */
@@ -310,6 +315,7 @@ struct iavf_devargs {
 	uint32_t watchdog_period;
 	int auto_reset;
 	int no_poll_on_link_down;
+	int mbuf_check;
 };
 
 struct iavf_security_ctx;
@@ -353,6 +359,11 @@ enum iavf_tx_burst_type {
 	IAVF_TX_AVX512_CTX_OFFLOAD,
 };
 
+#define IAVF_MBUF_CHECK_F_TX_MBUF        (1ULL << 0)
+#define IAVF_MBUF_CHECK_F_TX_SIZE        (1ULL << 1)
+#define IAVF_MBUF_CHECK_F_TX_SEGMENT     (1ULL << 2)
+#define IAVF_MBUF_CHECK_F_TX_OFFLOAD     (1ULL << 3)
+
 /* Structure to store private data for each VF instance. */
 struct iavf_adapter {
 	struct iavf_hw hw;
@@ -370,6 +381,7 @@ struct iavf_adapter {
 	bool no_poll;
 	enum iavf_rx_burst_type rx_burst_type;
 	enum iavf_tx_burst_type tx_burst_type;
+	uint64_t mc_flags; /* mbuf check flags. */
 	uint16_t fdir_ref_cnt;
 	struct iavf_devargs devargs;
 };
drivers/net/iavf/iavf_ethdev.c +75 -0

129 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.c +98 -0

122 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.h +2 -0
index a8af263d59..7b56076d32 100644
@@ -306,6 +306,8 @@ struct iavf_tx_queue {
 	uint16_t next_rs;              /* next to check DD,  for VPMD */
 	uint16_t ipsec_crypto_pkt_md_offset;
 
+	uint64_t mbuf_errors;
+
 	bool q_set;                    /* if rx queue has been configured */
 	bool tx_deferred_start;        /* don't start this queue in dev start */
 	const struct iavf_txq_ops *ops;
Signature · 1 line
2.25.1
author
#25 lore raw

PATCH v10 1/1 net/iavf: add diagnostic support in TX path

The only way to enable diagnostics for TX paths is to modify the application source code. Making it difficult to diagnose faults.

In this patch, the devarg option "mbuf_check" is introduced and the parameters are configured to enable the corresponding diagnostics.

supported cases: mbuf, size, segment, offload.
1. mbuf: check for corrupted mbuf.
2. size: check min/max packet length according to hw spec.
3. segment: check number of mbuf segments not exceed hw limitation.
4. offload: check any unsupported offload flag.

parameter format: mbuf_check=[mbuf,<case1>,<case2>]
eg: dpdk-testpmd -a 0000:81:01.0,mbuf_check=[mbuf,size] -- -i

---
v2: Remove call chain.
---
v3: Optimisation implementation.
---
v4: Fix Windows os compilation error.
---
v5: Split Patch.
---
v6: remove strict.
---
v9: Modify the description document.
---
v10: Modify vf rst document.

---
 doc/guides/nics/intel_vf.rst   | 11 ++++
 drivers/net/iavf/iavf.h        | 12 +++++
 drivers/net/iavf/iavf_ethdev.c | 75 ++++++++++++++++++++++++++
 drivers/net/iavf/iavf_rxtx.c   | 98 ++++++++++++++++++++++++++++++++++
 drivers/net/iavf/iavf_rxtx.h   |  2 +
 5 files changed, 198 insertions(+)
doc/guides/nics/intel_vf.rst +11 -0
index ce96c2e1f8..f62bb4233c 100644
@@ -111,6 +111,17 @@ For more detail on SR-IOV, please refer to the following documents:
     by setting the ``devargs`` parameter like ``-a 18:01.0,no-poll-on-link-down=1``
     when IAVF is backed by an Intel\ |reg| E810 device or an Intel\ |reg| 700 Series Ethernet device.
 
+    When IAVF is backed by an Intel\ |reg| E810 device or an Intel\ |reg| 700 series Ethernet devices.
+    Set the ``devargs`` parameter ``mbuf_check`` to enable TX diagnostics. For example,
+    ``-a 18:01.0,mbuf_check=<case>`` or ``-a 18:01.0,mbuf_check=[<case1>,<case2>...]``. Also,
+    ``xstats_get`` can be used to get the error counts, which are collected in ``tx_mbuf_error_packets``
+    xstats. For example, ``testpmd> show port xstats all``. Supported cases:
+
+    *   mbuf: Check for corrupted mbuf.
+    *   size: Check min/max packet length according to hw spec.
+    *   segment: Check number of mbuf segments not exceed hw limitation.
+    *   offload: Check any unsupported offload flag.
+
 The PCIE host-interface of Intel Ethernet Switch FM10000 Series VF infrastructure
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
drivers/net/iavf/iavf.h +12 -0
index ab24cb02c3..23c0496d54 100644
@@ -114,9 +114,14 @@ struct iavf_ipsec_crypto_stats {
 	} ierrors;
 };
 
+struct iavf_mbuf_stats {
+	uint64_t tx_pkt_errors;
+};
+
 struct iavf_eth_xstats {
 	struct virtchnl_eth_stats eth_stats;
 	struct iavf_ipsec_crypto_stats ips_stats;
+	struct iavf_mbuf_stats mbuf_stats;
 };
 
 /* Structure that defines a VSI, associated with a adapter. */
@@ -310,6 +315,7 @@ struct iavf_devargs {
 	uint32_t watchdog_period;
 	int auto_reset;
 	int no_poll_on_link_down;
+	int mbuf_check;
 };
 
 struct iavf_security_ctx;
@@ -353,6 +359,11 @@ enum iavf_tx_burst_type {
 	IAVF_TX_AVX512_CTX_OFFLOAD,
 };
 
+#define IAVF_MBUF_CHECK_F_TX_MBUF        (1ULL << 0)
+#define IAVF_MBUF_CHECK_F_TX_SIZE        (1ULL << 1)
+#define IAVF_MBUF_CHECK_F_TX_SEGMENT     (1ULL << 2)
+#define IAVF_MBUF_CHECK_F_TX_OFFLOAD     (1ULL << 3)
+
 /* Structure to store private data for each VF instance. */
 struct iavf_adapter {
 	struct iavf_hw hw;
@@ -370,6 +381,7 @@ struct iavf_adapter {
 	bool no_poll;
 	enum iavf_rx_burst_type rx_burst_type;
 	enum iavf_tx_burst_type tx_burst_type;
+	uint64_t mc_flags; /* mbuf check flags. */
 	uint16_t fdir_ref_cnt;
 	struct iavf_devargs devargs;
 };
drivers/net/iavf/iavf_ethdev.c +75 -0

129 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.c +98 -0

122 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.h +2 -0
index a8af263d59..7b56076d32 100644
@@ -306,6 +306,8 @@ struct iavf_tx_queue {
 	uint16_t next_rs;              /* next to check DD,  for VPMD */
 	uint16_t ipsec_crypto_pkt_md_offset;
 
+	uint64_t mbuf_errors;
+
 	bool q_set;                    /* if rx queue has been configured */
 	bool tx_deferred_start;        /* don't start this queue in dev start */
 	const struct iavf_txq_ops *ops;
Signature · 1 line
2.25.1
author
#26 lore raw

PATCH v11 1/1 net/iavf: add diagnostic support in TX path

Implemented a Tx wrapper to perform a thorough check on mbufs, categorizing and counting invalid cases by types for diagnostic purposes. The count of invalid cases is accessible through xstats_get.

Also, the devarg option "mbuf_check" was introduced to configure the diagnostic parameters to enable the appropriate diagnostic features.

supported cases: mbuf, size, segment, offload.
1. mbuf: check for corrupted mbuf.
2. size: check min/max packet length according to hw spec.
3. segment: check number of mbuf segments not exceed hw limitation.
4. offload: check any unsupported offload flag.

parameter format: "mbuf_check=<case>" or "mbuf_check=[<case1>,<case2>]"
eg: dpdk-testpmd -a 0000:81:01.0,mbuf_check=[mbuf,size] -- -i

---
v2: Remove call chain.
---
v3: Optimisation implementation.
---
v4: Fix Windows os compilation error.
---
v5: Split Patch.
---
v6: remove strict.
---
v9: Modify the description document.
---
v10: Modify vf rst document.
---
v11: modify comment log.

---
 doc/guides/nics/intel_vf.rst   | 11 ++++
 drivers/net/iavf/iavf.h        | 11 ++++
 drivers/net/iavf/iavf_ethdev.c | 72 +++++++++++++++++++++++++
 drivers/net/iavf/iavf_rxtx.c   | 98 ++++++++++++++++++++++++++++++++++
 drivers/net/iavf/iavf_rxtx.h   |  2 +
 5 files changed, 194 insertions(+)
doc/guides/nics/intel_vf.rst +11 -0
index ce96c2e1f8..f62bb4233c 100644
@@ -111,6 +111,17 @@ For more detail on SR-IOV, please refer to the following documents:
     by setting the ``devargs`` parameter like ``-a 18:01.0,no-poll-on-link-down=1``
     when IAVF is backed by an Intel\ |reg| E810 device or an Intel\ |reg| 700 Series Ethernet device.
 
+    When IAVF is backed by an Intel\ |reg| E810 device or an Intel\ |reg| 700 series Ethernet devices.
+    Set the ``devargs`` parameter ``mbuf_check`` to enable TX diagnostics. For example,
+    ``-a 18:01.0,mbuf_check=<case>`` or ``-a 18:01.0,mbuf_check=[<case1>,<case2>...]``. Also,
+    ``xstats_get`` can be used to get the error counts, which are collected in ``tx_mbuf_error_packets``
+    xstats. For example, ``testpmd> show port xstats all``. Supported cases:
+
+    *   mbuf: Check for corrupted mbuf.
+    *   size: Check min/max packet length according to hw spec.
+    *   segment: Check number of mbuf segments not exceed hw limitation.
+    *   offload: Check any unsupported offload flag.
+
 The PCIE host-interface of Intel Ethernet Switch FM10000 Series VF infrastructure
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
drivers/net/iavf/iavf.h +11 -0
index ab24cb02c3..824ae4aa02 100644
@@ -114,9 +114,14 @@ struct iavf_ipsec_crypto_stats {
 	} ierrors;
 };
 
+struct iavf_mbuf_stats {
+	uint64_t tx_pkt_errors;
+};
+
 struct iavf_eth_xstats {
 	struct virtchnl_eth_stats eth_stats;
 	struct iavf_ipsec_crypto_stats ips_stats;
+	struct iavf_mbuf_stats mbuf_stats;
 };
 
 /* Structure that defines a VSI, associated with a adapter. */
@@ -310,6 +315,7 @@ struct iavf_devargs {
 	uint32_t watchdog_period;
 	int auto_reset;
 	int no_poll_on_link_down;
+	uint64_t mbuf_check;
 };
 
 struct iavf_security_ctx;
@@ -353,6 +359,11 @@ enum iavf_tx_burst_type {
 	IAVF_TX_AVX512_CTX_OFFLOAD,
 };
 
+#define IAVF_MBUF_CHECK_F_TX_MBUF        (1ULL << 0)
+#define IAVF_MBUF_CHECK_F_TX_SIZE        (1ULL << 1)
+#define IAVF_MBUF_CHECK_F_TX_SEGMENT     (1ULL << 2)
+#define IAVF_MBUF_CHECK_F_TX_OFFLOAD     (1ULL << 3)
+
 /* Structure to store private data for each VF instance. */
 struct iavf_adapter {
 	struct iavf_hw hw;
drivers/net/iavf/iavf_ethdev.c +72 -0

126 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.c +98 -0

122 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.h +2 -0
index a8af263d59..7b56076d32 100644
@@ -306,6 +306,8 @@ struct iavf_tx_queue {
 	uint16_t next_rs;              /* next to check DD,  for VPMD */
 	uint16_t ipsec_crypto_pkt_md_offset;
 
+	uint64_t mbuf_errors;
+
 	bool q_set;                    /* if rx queue has been configured */
 	bool tx_deferred_start;        /* don't start this queue in dev start */
 	const struct iavf_txq_ops *ops;
Signature · 1 line
2.25.1
author
#27 lore raw

PATCH v11 1/1 net/iavf: add diagnostic support in TX path

In reply to Mingjin Ye

Implemented a Tx wrapper to perform a thorough check on mbufs, categorizing and counting invalid cases by types for diagnostic purposes. The count of invalid cases is accessible through xstats_get.

Also, the devarg option "mbuf_check" was introduced to configure the diagnostic parameters to enable the appropriate diagnostic features.

supported cases: mbuf, size, segment, offload.
1. mbuf: check for corrupted mbuf.
2. size: check min/max packet length according to hw spec.
3. segment: check number of mbuf segments not exceed hw limitation.
4. offload: check any unsupported offload flag.

parameter format: "mbuf_check=<case>" or "mbuf_check=[<case1>,<case2>]"
eg: dpdk-testpmd -a 0000:81:01.0,mbuf_check=[mbuf,size] -- -i

---
v2: Remove call chain.
---
v3: Optimisation implementation.
---
v4: Fix Windows os compilation error.
---
v5: Split Patch.
---
v6: remove strict.
---
v9: Modify the description document.
---
v10: Modify vf rst document.
---
v11: modify comment log.

---
 doc/guides/nics/intel_vf.rst   | 11 ++++
 drivers/net/iavf/iavf.h        | 11 ++++
 drivers/net/iavf/iavf_ethdev.c | 72 +++++++++++++++++++++++++
 drivers/net/iavf/iavf_rxtx.c   | 98 ++++++++++++++++++++++++++++++++++
 drivers/net/iavf/iavf_rxtx.h   |  2 +
 5 files changed, 194 insertions(+)
doc/guides/nics/intel_vf.rst +11 -0
index ce96c2e1f8..f62bb4233c 100644
@@ -111,6 +111,17 @@ For more detail on SR-IOV, please refer to the following documents:
     by setting the ``devargs`` parameter like ``-a 18:01.0,no-poll-on-link-down=1``
     when IAVF is backed by an Intel\ |reg| E810 device or an Intel\ |reg| 700 Series Ethernet device.
 
+    When IAVF is backed by an Intel\ |reg| E810 device or an Intel\ |reg| 700 series Ethernet devices.
+    Set the ``devargs`` parameter ``mbuf_check`` to enable TX diagnostics. For example,
+    ``-a 18:01.0,mbuf_check=<case>`` or ``-a 18:01.0,mbuf_check=[<case1>,<case2>...]``. Also,
+    ``xstats_get`` can be used to get the error counts, which are collected in ``tx_mbuf_error_packets``
+    xstats. For example, ``testpmd> show port xstats all``. Supported cases:
+
+    *   mbuf: Check for corrupted mbuf.
+    *   size: Check min/max packet length according to hw spec.
+    *   segment: Check number of mbuf segments not exceed hw limitation.
+    *   offload: Check any unsupported offload flag.
+
 The PCIE host-interface of Intel Ethernet Switch FM10000 Series VF infrastructure
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
drivers/net/iavf/iavf.h +11 -0
index ab24cb02c3..824ae4aa02 100644
@@ -114,9 +114,14 @@ struct iavf_ipsec_crypto_stats {
 	} ierrors;
 };
 
+struct iavf_mbuf_stats {
+	uint64_t tx_pkt_errors;
+};
+
 struct iavf_eth_xstats {
 	struct virtchnl_eth_stats eth_stats;
 	struct iavf_ipsec_crypto_stats ips_stats;
+	struct iavf_mbuf_stats mbuf_stats;
 };
 
 /* Structure that defines a VSI, associated with a adapter. */
@@ -310,6 +315,7 @@ struct iavf_devargs {
 	uint32_t watchdog_period;
 	int auto_reset;
 	int no_poll_on_link_down;
+	uint64_t mbuf_check;
 };
 
 struct iavf_security_ctx;
@@ -353,6 +359,11 @@ enum iavf_tx_burst_type {
 	IAVF_TX_AVX512_CTX_OFFLOAD,
 };
 
+#define IAVF_MBUF_CHECK_F_TX_MBUF        (1ULL << 0)
+#define IAVF_MBUF_CHECK_F_TX_SIZE        (1ULL << 1)
+#define IAVF_MBUF_CHECK_F_TX_SEGMENT     (1ULL << 2)
+#define IAVF_MBUF_CHECK_F_TX_OFFLOAD     (1ULL << 3)
+
 /* Structure to store private data for each VF instance. */
 struct iavf_adapter {
 	struct iavf_hw hw;
drivers/net/iavf/iavf_ethdev.c +72 -0

126 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.c +98 -0

122 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.h +2 -0
index a8af263d59..7b56076d32 100644
@@ -306,6 +306,8 @@ struct iavf_tx_queue {
 	uint16_t next_rs;              /* next to check DD,  for VPMD */
 	uint16_t ipsec_crypto_pkt_md_offset;
 
+	uint64_t mbuf_errors;
+
 	bool q_set;                    /* if rx queue has been configured */
 	bool tx_deferred_start;        /* don't start this queue in dev start */
 	const struct iavf_txq_ops *ops;
Signature · 1 line
2.25.1
Acked-by on v11 1/1
#28 lore raw
Quoted 18 lines · Mingjin Ye

Implemented a Tx wrapper to perform a thorough check on mbufs, categorizing and counting invalid cases by types for diagnostic purposes. The count of invalid cases is accessible through xstats_get.

Also, the devarg option "mbuf_check" was introduced to configure the diagnostic parameters to enable the appropriate diagnostic features.

supported cases: mbuf, size, segment, offload.
1. mbuf: check for corrupted mbuf.
2. size: check min/max packet length according to hw spec.
3. segment: check number of mbuf segments not exceed hw limitation.
4. offload: check any unsupported offload flag.

parameter format: "mbuf_check=<case>" or "mbuf_check=[<case1>,<case2>]"
eg: dpdk-testpmd -a 0000:81:01.0,mbuf_check=[mbuf,size] -- -i

---

<snip>

doc/guides/nics/intel_vf.rst For more detail on SR-IOV, please refer to the following documents: · line 114

Quoted 10 lines
doc/guides/nics/intel_vf.rst +1 -0
index ce96c2e1f8..f62bb4233c 100644
@@ -111,6 +111,17 @@ For more detail on SR-IOV, please refer to the following documents:
      by setting the ``devargs`` parameter like ``-a 18:01.0,no-poll-on-link-down=1``
      when IAVF is backed by an Intel\ |reg| E810 device or an Intel\ |reg| 700 Series Ethernet device.
 
+    When IAVF is backed by an Intel\ |reg| E810 device or an Intel\ |reg| 700 series Ethernet devices.

This looks like a duplicate line of the one above it, so probably needs to be removed?

Quoted 10 lines
doc/guides/nics/intel_vf.rst +10 -0
+    Set the ``devargs`` parameter ``mbuf_check`` to enable TX diagnostics. For example,
+    ``-a 18:01.0,mbuf_check=<case>`` or ``-a 18:01.0,mbuf_check=[<case1>,<case2>...]``. Also,
+    ``xstats_get`` can be used to get the error counts, which are collected in ``tx_mbuf_error_packets``
+    xstats. For example, ``testpmd> show port xstats all``. Supported cases:
+
+    *   mbuf: Check for corrupted mbuf.
+    *   size: Check min/max packet length according to hw spec.
+    *   segment: Check number of mbuf segments not exceed hw limitation.
+    *   offload: Check any unsupported offload flag.
+

<snip>

Quoted 7 lines
doc/guides/nics/intel_vf.rst +7 -0
+
+	int ret = 0;
+	uint64_t *mc_flags = args;
+	char *str2 = strdup(value);
+	if (str2 == NULL)
+		return -1;
+

doc/guides/nics/intel_vf.rst

Quoted 10 lines
doc/guides/nics/intel_vf.rst +10 -0
+	str_len = strlen(str2);
+	if (str2[0] == '[' && str2[str_len - 1] == ']') {
+		if (str_len < 3) {
+			ret = -1;
+			goto mdd_end;
+		}
+		valid_len = str_len - 2;
+		memmove(str2, str2 + 1, valid_len);
+		memset(str2 + valid_len, '\0', 2);
+	}

I would suggest adding a comment mentioning that we're removing outer square brackets from the value. Even better would be to factor it out into a separate function, so that code for this function is not polluted with implementation details of brackets removal.

doc/guides/nics/intel_vf.rst

Quoted 12 lines
doc/guides/nics/intel_vf.rst +12 -0
+	cur = strtok_r(str2, ",", &tmp);
+	while (cur != NULL) {
+		if (!strcmp(cur, "mbuf"))
+			*mc_flags |= IAVF_MBUF_CHECK_F_TX_MBUF;
+		else if (!strcmp(cur, "size"))
+			*mc_flags |= IAVF_MBUF_CHECK_F_TX_SIZE;
+		else if (!strcmp(cur, "segment"))
+			*mc_flags |= IAVF_MBUF_CHECK_F_TX_SEGMENT;
+		else if (!strcmp(cur, "offload"))
+			*mc_flags |= IAVF_MBUF_CHECK_F_TX_OFFLOAD;
+		else
+			PMD_DRV_LOG(ERR, "Unsupported mdd check type: %s", cur);

I suspect 'mdd' is an artifact of earlier versions? What does it mean, and can the error message be made more meaningful?

Quoted 15 lines
doc/guides/nics/intel_vf.rst +8 -0
+		cur = strtok_r(NULL, ",", &tmp);
+	}
+
+mdd_end:
+	free(str2);
+	return ret;
+}
+
  static int iavf_parse_devargs(struct rte_eth_dev *dev)
  {
  	struct iavf_adapter *ad =
@@ -2344,6 +2411,11 @@ static int iavf_parse_devargs(struct rte_eth_dev *dev)
  		goto bail;
  	}
 

<snip>

doc/guides/nics/intel_vf.rst

Quoted 12 lines
doc/guides/nics/intel_vf.rst +12 -0
+		}
+	}
+
+	if (pkt_error) {
+		txq->mbuf_errors++;
+		good_pkts = idx;
+		if (good_pkts == 0)
+			return 0;
+	}
+
+	return iavf_tx_pkt_burst_ops[tx_burst_type](tx_queue,
+								tx_pkts, good_pkts);

The indentation here is a bit odd.

The above suggestions are not blocking, so overall

Signature · 2 lines
Thanks,
Anatoly
Acked-by on v11 1/1
#29 lore raw
In reply to Mingjin Ye
Quoted 26 lines · Mingjin Ye

Implemented a Tx wrapper to perform a thorough check on mbufs, categorizing and counting invalid cases by types for diagnostic purposes. The count of invalid cases is accessible through xstats_get.

Also, the devarg option "mbuf_check" was introduced to configure the diagnostic parameters to enable the appropriate diagnostic features.

supported cases: mbuf, size, segment, offload.
1. mbuf: check for corrupted mbuf.
2. size: check min/max packet length according to hw spec.
3. segment: check number of mbuf segments not exceed hw limitation.
4. offload: check any unsupported offload flag.

parameter format: "mbuf_check=<case>" or "mbuf_check=[<case1>,<case2>]"
eg: dpdk-testpmd -a 0000:81:01.0,mbuf_check=[mbuf,size] -- -i

---
v2: Remove call chain.
---
v3: Optimisation implementation.
---
v4: Fix Windows os compilation error.
---
v5: Split Patch.
---

Quoted 8 lines

v6: remove strict.
---
v9: Modify the description document.
---
v10: Modify vf rst document.
---
v11: modify comment log.
---

Signature · 2 lines
Thanks,
Anatoly
author
#30 lore raw

PATCH v12 1/1 net/iavf: add diagnostic support in TX path

In reply to Mingjin Ye

Implemented a Tx wrapper to perform a thorough check on mbufs, categorizing and counting invalid cases by types for diagnostic purposes. The count of invalid cases is accessible through xstats_get.

Also, the devarg option "mbuf_check" was introduced to configure the diagnostic parameters to enable the appropriate diagnostic features.

supported cases: mbuf, size, segment, offload.
1. mbuf: check for corrupted mbuf.
2. size: check min/max packet length according to hw spec.
3. segment: check number of mbuf segments not exceed hw limitation.
4. offload: check any unsupported offload flag.

parameter format: "mbuf_check=<case>" or "mbuf_check=[<case1>,<case2>]"
eg: dpdk-testpmd -a 0000:81:01.0,mbuf_check=[mbuf,size] -- -i

---
v2: Remove call chain.
---
v3: Optimisation implementation.
---
v4: Fix Windows os compilation error.
---
v5: Split Patch.
---
v6: remove strict.
---
v9: Modify the description document.
---
v10: Modify vf rst document.
---
v11: modify comment log.
---
v12: Fix buggy logs and add necessary notes.

---
 doc/guides/nics/intel_vf.rst   | 11 ++++
 drivers/net/iavf/iavf.h        | 11 ++++
 drivers/net/iavf/iavf_ethdev.c | 79 +++++++++++++++++++++++++++
 drivers/net/iavf/iavf_rxtx.c   | 98 ++++++++++++++++++++++++++++++++++
 drivers/net/iavf/iavf_rxtx.h   |  2 +
 5 files changed, 201 insertions(+)
doc/guides/nics/intel_vf.rst +11 -0
index ce96c2e1f8..b84ea214d4 100644
@@ -111,6 +111,17 @@ For more detail on SR-IOV, please refer to the following documents:
     by setting the ``devargs`` parameter like ``-a 18:01.0,no-poll-on-link-down=1``
     when IAVF is backed by an Intel\ |reg| E810 device or an Intel\ |reg| 700 Series Ethernet device.
 
+    When IAVF is backed by an Intel® E810 device or an Intel® 700 Series Ethernet device.
+    Set the ``devargs`` parameter ``mbuf_check`` to enable TX diagnostics. For example,
+    ``-a 18:01.0,mbuf_check=<case>`` or ``-a 18:01.0,mbuf_check=[<case1>,<case2>...]``. Also,
+    ``xstats_get`` can be used to get the error counts, which are collected in ``tx_mbuf_error_packets``
+    xstats. For example, ``testpmd> show port xstats all``. Supported cases:
+
+    *   mbuf: Check for corrupted mbuf.
+    *   size: Check min/max packet length according to hw spec.
+    *   segment: Check number of mbuf segments not exceed hw limitation.
+    *   offload: Check any unsupported offload flag.
+
 The PCIE host-interface of Intel Ethernet Switch FM10000 Series VF infrastructure
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
drivers/net/iavf/iavf.h +11 -0
index ab24cb02c3..824ae4aa02 100644
@@ -114,9 +114,14 @@ struct iavf_ipsec_crypto_stats {
 	} ierrors;
 };
 
+struct iavf_mbuf_stats {
+	uint64_t tx_pkt_errors;
+};
+
 struct iavf_eth_xstats {
 	struct virtchnl_eth_stats eth_stats;
 	struct iavf_ipsec_crypto_stats ips_stats;
+	struct iavf_mbuf_stats mbuf_stats;
 };
 
 /* Structure that defines a VSI, associated with a adapter. */
@@ -310,6 +315,7 @@ struct iavf_devargs {
 	uint32_t watchdog_period;
 	int auto_reset;
 	int no_poll_on_link_down;
+	uint64_t mbuf_check;
 };
 
 struct iavf_security_ctx;
@@ -353,6 +359,11 @@ enum iavf_tx_burst_type {
 	IAVF_TX_AVX512_CTX_OFFLOAD,
 };
 
+#define IAVF_MBUF_CHECK_F_TX_MBUF        (1ULL << 0)
+#define IAVF_MBUF_CHECK_F_TX_SIZE        (1ULL << 1)
+#define IAVF_MBUF_CHECK_F_TX_SEGMENT     (1ULL << 2)
+#define IAVF_MBUF_CHECK_F_TX_OFFLOAD     (1ULL << 3)
+
 /* Structure to store private data for each VF instance. */
 struct iavf_adapter {
 	struct iavf_hw hw;
drivers/net/iavf/iavf_ethdev.c +79 -0

133 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.c +98 -0

122 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.h +2 -0
index a8af263d59..7b56076d32 100644
@@ -306,6 +306,8 @@ struct iavf_tx_queue {
 	uint16_t next_rs;              /* next to check DD,  for VPMD */
 	uint16_t ipsec_crypto_pkt_md_offset;
 
+	uint64_t mbuf_errors;
+
 	bool q_set;                    /* if rx queue has been configured */
 	bool tx_deferred_start;        /* don't start this queue in dev start */
 	const struct iavf_txq_ops *ops;
Signature · 1 line
2.25.1
Acked-by Anatoly Burakov on v12 1/1
#31 lore raw
Quoted 13 lines · Mingjin Ye

Implemented a Tx wrapper to perform a thorough check on mbufs, categorizing and counting invalid cases by types for diagnostic purposes. The count of invalid cases is accessible through xstats_get.

Also, the devarg option "mbuf_check" was introduced to configure the diagnostic parameters to enable the appropriate diagnostic features.

supported cases: mbuf, size, segment, offload.
1. mbuf: check for corrupted mbuf.
2. size: check min/max packet length according to hw spec.
3. segment: check number of mbuf segments not exceed hw limitation.
4. offload: check any unsupported offload flag.

Quoted 5 lines

parameter format: "mbuf_check=<case>" or "mbuf_check=[<case1>,<case2>]"
eg: dpdk-testpmd -a 0000:81:01.0,mbuf_check=[mbuf,size] -- -i

---

Carrying ack from v11:

Patch applied, with some minor rework of the docs, to dpdk-next-net-intel.

Thanks,
/Bruce

#32 lore raw
Quoted 17 lines · Bruce Richardson
Quoted 16 lines · Mingjin Ye

Implemented a Tx wrapper to perform a thorough check on mbufs, categorizing and counting invalid cases by types for diagnostic purposes. The count of invalid cases is accessible through xstats_get.

Also, the devarg option "mbuf_check" was introduced to configure the diagnostic parameters to enable the appropriate diagnostic features.

supported cases: mbuf, size, segment, offload.
1. mbuf: check for corrupted mbuf.
2. size: check min/max packet length according to hw spec.
3. segment: check number of mbuf segments not exceed hw limitation.
4. offload: check any unsupported offload flag.

parameter format: "mbuf_check=<case>" or "mbuf_check=[<case1>,<case2>]"
eg: dpdk-testpmd -a 0000:81:01.0,mbuf_check=[mbuf,size] -- -i

Quoted 8 lines
Quoted 2 lines

---

Carrying ack from v11:

Patch applied, with some minor rework of the docs, to dpdk-next-net-intel.

Also updated some line wrapping following additional review. Corrected version pushed now.

/Bruce

#33 lore raw
In reply to Mingjin Ye
Quoted 57 lines

-----Original Message-----
From: Mingjin Ye <[email protected]>
Sent: Wednesday, January 3, 2024 6:11 PM
To: [email protected]
Cc: Yang, Qiming <[email protected]>; Ye, MingjinX <[email protected]>; Su, Simei <[email protected]>; Wu, Wenjun1 <[email protected]>; Zhang, Yuying <[email protected]>; Xing, Beilei <[email protected]>; Wu, Jingjing <[email protected]>
Subject: [PATCH v8 2/2] net/iavf: add diagnostic support in TX path

The only way to enable diagnostics for TX paths is to modify the application source code. Making it difficult to diagnose faults.

In this patch, the devarg option "mbuf_check" is introduced and the parameters are configured to enable the corresponding diagnostics.

supported cases: mbuf, size, segment, offload.
1. mbuf: check for corrupted mbuf.
2. size: check min/max packet length according to hw spec.
3. segment: check number of mbuf segments not exceed hw limitation.
4. offload: check any unsupported offload flag.

parameter format: mbuf_check=[mbuf,<case1>,<case2>]
eg: dpdk-testpmd -a 0000:81:01.0,mbuf_check=[mbuf,size] -- -i

---
v2: Remove call chain.
---
v3: Optimisation implementation.
---
v4: Fix Windows os compilation error.
---
v5: Split Patch.
---
v6: remove strict.
---
v7: Modify the description document.

---
 doc/guides/nics/intel_vf.rst   |  9 ++++
 drivers/net/iavf/iavf.h        | 12 +++++
 drivers/net/iavf/iavf_ethdev.c | 76 ++++++++++++++++++++++++++
 drivers/net/iavf/iavf_rxtx.c   | 98 ++++++++++++++++++++++++++++++++++
 drivers/net/iavf/iavf_rxtx.h   |  2 +
 5 files changed, 197 insertions(+)
doc/guides/nics/intel_vf.rst index renamed from doc/guides/nics/intel_vf.rst +0 -0

ad08198f0f..bda6648726 100644

doc/guides/nics/intel_vf.rst +0 -0
@@ -111,6 +111,15 @@ For more detail on SR-IOV, please refer to the

following documents:

     by setting the ``devargs`` parameter like ``-a 18:01.0,no-poll-on-link-
down=1``
     when IAVF is backed by an Intel\ |reg| E810 device or an Intel\ |reg| 700
Quoted 8 lines

Series Ethernet device.

+ When IAVF is backed by an Intel\ |reg| E810 device or an Intel\ |reg| 700
series Ethernet devices.
+ Set the ``devargs`` parameter ``mbuf_check`` to enable TX diagnostics. For
example,
+ ``-a 18:01.0,mbuf_check=mbuf`` or ``-a 18:01.0,mbuf_check=[mbuf,size]``.
Supported cases:

``-a 18:01.0,mbuf_check=<case>`` or ``-a 18:01.0,mbuf_check=[<case1>,<case2>...]``

doc/guides/nics/intel_vf.rst For more detail on SR-IOV, please refer to the following documents: · line 121

Quoted 5 lines
doc/guides/nics/intel_vf.rst +5 -0
+
+    *   mbuf: Check for corrupted mbuf.
+    *   size: Check min/max packet length according to hw spec.
+    *   segment: Check number of mbuf segments not exceed hw limitation.
+    *   offload: Check any unsupported offload flag.

please also describe how to get the error count by xstats_get, a testpmd command is suggested

Btw, PATCH 1/2 as a fix has been merged seperately, new version can only target to this patch only.

author
#34 lore raw

PATCH v6 2/2 net/iavf: add diagnostic support in TX path

In reply to Mingjin Ye

The only way to enable diagnostics for TX paths is to modify the application source code. Making it difficult to diagnose faults.

In this patch, the devarg option "mbuf_check" is introduced and the parameters are configured to enable the corresponding diagnostics.

supported cases: mbuf, size, segment, offload.
1. mbuf: check for corrupted mbuf.
2. size: check min/max packet length according to hw spec.
3. segment: check number of mbuf segments not exceed hw limitation.
4. offload: check any unsupported offload flag.

parameter format: mbuf_check=[mbuf,<case1>,<case2>]
eg: dpdk-testpmd -a 0000:81:01.0,mbuf_check=[mbuf,size] -- -i

---
v2: Remove call chain.
---
v3: Optimisation implementation.
---
v4: Fix Windows os compilation error.
---
v5: Split Patch.
---
v6: remove strict.

---
 doc/guides/nics/intel_vf.rst   |  4 ++
 drivers/net/iavf/iavf.h        | 12 +++++
 drivers/net/iavf/iavf_ethdev.c | 68 +++++++++++++++++++++++
 drivers/net/iavf/iavf_rxtx.c   | 98 ++++++++++++++++++++++++++++++++++
 drivers/net/iavf/iavf_rxtx.h   |  2 +
 5 files changed, 184 insertions(+)
doc/guides/nics/intel_vf.rst +4 -0
index ad08198f0f..8e39bc831c 100644
@@ -111,6 +111,10 @@ For more detail on SR-IOV, please refer to the following documents:
     by setting the ``devargs`` parameter like ``-a 18:01.0,no-poll-on-link-down=1``
     when IAVF is backed by an Intel\ |reg| E810 device or an Intel\ |reg| 700 Series Ethernet device.
 
+    Enable mbuf check for Tx diagnostics by setting the devargs parameter like
+    ``-a 18:01.0,mbuf_check=[mbuf,<case1>,<case2>]`` when IAVF is backed by an
+    Intel\ |reg| E810 device or an Intel\ |reg| 700 Series Ethernet device.
+
 The PCIE host-interface of Intel Ethernet Switch FM10000 Series VF infrastructure
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
drivers/net/iavf/iavf.h +12 -0
index 8db9f3d7cd..0a7053e311 100644
@@ -113,9 +113,14 @@ struct iavf_ipsec_crypto_stats {
 	} ierrors;
 };
 
+struct iavf_mbuf_stats {
+	uint64_t tx_pkt_errors;
+};
+
 struct iavf_eth_xstats {
 	struct virtchnl_eth_stats eth_stats;
 	struct iavf_ipsec_crypto_stats ips_stats;
+	struct iavf_mbuf_stats mbuf_stats;
 };
 
 /* Structure that defines a VSI, associated with a adapter. */
@@ -309,10 +314,16 @@ struct iavf_devargs {
 	uint32_t watchdog_period;
 	int auto_reset;
 	int no_poll_on_link_down;
+	int mbuf_check;
 };
 
 struct iavf_security_ctx;
 
+#define IAVF_MBUF_CHECK_F_TX_MBUF        (1ULL << 0)
+#define IAVF_MBUF_CHECK_F_TX_SIZE        (1ULL << 1)
+#define IAVF_MBUF_CHECK_F_TX_SEGMENT     (1ULL << 2)
+#define IAVF_MBUF_CHECK_F_TX_OFFLOAD     (1ULL << 3)
+
 enum iavf_rx_burst_type {
 	IAVF_RX_BURST_DEFAULT,
 	IAVF_RX_BURST_FRXD,
@@ -368,6 +379,7 @@ struct iavf_adapter {
 	bool no_poll;
 	enum iavf_rx_burst_type rx_burst_type;
 	enum iavf_tx_burst_type tx_burst_type;
+	uint64_t mc_flags; /* mbuf check flags. */
 	uint16_t fdir_ref_cnt;
 	struct iavf_devargs devargs;
 };
drivers/net/iavf/iavf_ethdev.c +68 -0

116 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.c +98 -0

122 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.h +2 -0
index 42c18242db..7c40fe51f9 100644
@@ -305,6 +305,8 @@ struct iavf_tx_queue {
 	uint16_t next_rs;              /* next to check DD,  for VPMD */
 	uint16_t ipsec_crypto_pkt_md_offset;
 
+	uint64_t mbuf_errors;
+
 	bool q_set;                    /* if rx queue has been configured */
 	bool tx_deferred_start;        /* don't start this queue in dev start */
 	const struct iavf_txq_ops *ops;
Signature · 1 line
2.25.1
author
#35 lore raw

PATCH v5 2/2 net/iavf: add diagnostic support in TX path

In reply to Mingjin Ye

The only way to enable diagnostics for TX paths is to modify the application source code. Making it difficult to diagnose faults.

In this patch, the devarg option "mbuf_check" is introduced and the parameters are configured to enable the corresponding diagnostics.

supported cases: mbuf, size, segment, offload, strict.
1. mbuf: check for corrupted mbuf.
2. size: check min/max packet length according to hw spec.
3. segment: check number of mbuf segments not exceed hw limitation.
4. offload: check any unsupported offload flag.
5. strict: check protocol headers.

parameter format: mbuf_check=[mbuf,<case1>,<case2>]
eg: dpdk-testpmd -a 0000:81:01.0,mbuf_check=[mbuf,size] -- -i

---
v2: Remove call chain.
---
v3: Optimisation implementation.
---
v4: Fix Windows os compilation error.
---
v5: Split Patch.

---
 doc/guides/nics/intel_vf.rst   |   4 ++
 drivers/net/iavf/iavf.h        |  13 +++++
 drivers/net/iavf/iavf_ethdev.c |  70 ++++++++++++++++++++++
 drivers/net/iavf/iavf_rxtx.c   | 104 +++++++++++++++++++++++++++++++++
 drivers/net/iavf/iavf_rxtx.h   |   2 +
 5 files changed, 193 insertions(+)
doc/guides/nics/intel_vf.rst +4 -0
index ad08198f0f..8e39bc831c 100644
@@ -111,6 +111,10 @@ For more detail on SR-IOV, please refer to the following documents:
     by setting the ``devargs`` parameter like ``-a 18:01.0,no-poll-on-link-down=1``
     when IAVF is backed by an Intel\ |reg| E810 device or an Intel\ |reg| 700 Series Ethernet device.
 
+    Enable mbuf check for Tx diagnostics by setting the devargs parameter like
+    ``-a 18:01.0,mbuf_check=[mbuf,<case1>,<case2>]`` when IAVF is backed by an
+    Intel\ |reg| E810 device or an Intel\ |reg| 700 Series Ethernet device.
+
 The PCIE host-interface of Intel Ethernet Switch FM10000 Series VF infrastructure
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
drivers/net/iavf/iavf.h +13 -0
index 4cd5bea167..b81329bb56 100644
@@ -113,9 +113,14 @@ struct iavf_ipsec_crypto_stats {
 	} ierrors;
 };
 
+struct iavf_mbuf_stats {
+	uint64_t tx_pkt_errors;
+};
+
 struct iavf_eth_xstats {
 	struct virtchnl_eth_stats eth_stats;
 	struct iavf_ipsec_crypto_stats ips_stats;
+	struct iavf_mbuf_stats mbuf_stats;
 };
 
 /* Structure that defines a VSI, associated with a adapter. */
@@ -309,10 +314,17 @@ struct iavf_devargs {
 	uint32_t watchdog_period;
 	int auto_reset;
 	int no_poll_on_link_down;
+	int mbuf_check;
 };
 
 struct iavf_security_ctx;
 
+#define IAVF_MBUF_CHECK_F_TX_MBUF        (1ULL << 0)
+#define IAVF_MBUF_CHECK_F_TX_SIZE        (1ULL << 1)
+#define IAVF_MBUF_CHECK_F_TX_SEGMENT     (1ULL << 2)
+#define IAVF_MBUF_CHECK_F_TX_OFFLOAD     (1ULL << 3)
+#define IAVF_MBUF_CHECK_F_TX_STRICT      (1ULL << 4)
+
 enum iavf_tx_pkt_burst_type {
 	IAVF_PKT_BURST_DEFAULT		= 0,
 	IAVF_PKT_BURST_VEC		= 1,
@@ -340,6 +352,7 @@ struct iavf_adapter {
 	bool no_poll;
 	eth_rx_burst_t rx_pkt_burst;
 	enum iavf_tx_pkt_burst_type tx_burst_type;
+	uint64_t mc_flags; /* mbuf check flags. */
 	uint16_t fdir_ref_cnt;
 	struct iavf_devargs devargs;
 };
drivers/net/iavf/iavf_ethdev.c +70 -0

118 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.c +104 -0

128 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.h +2 -0
index fadc931b51..a4128ff7a3 100644
@@ -300,6 +300,8 @@ struct iavf_tx_queue {
 	uint16_t next_rs;              /* next to check DD,  for VPMD */
 	uint16_t ipsec_crypto_pkt_md_offset;
 
+	uint64_t mbuf_errors;
+
 	bool q_set;                    /* if rx queue has been configured */
 	bool tx_deferred_start;        /* don't start this queue in dev start */
 	const struct iavf_txq_ops *ops;
Signature · 1 line
2.25.1