Skip to contentSkip to conversation

net/iavf: MDD fault diagnostics support on TX paths

PATCH New Mingjin Ye 1 participant 1 message Nov 6, 2023 Network drivers

lore
Share & tools
lore

Mingjin Ye

author
#0 lore raw

PATCH 1/1 net/iavf: MDD fault diagnostics support on TX paths

When an MDD packet is detected, hardware will shutdown the queue. In a Tx path troubleshooting scenario, modifying the application code to reselect the Tx path is the only way to enable mbuf legitimacy check, which makes troubleshooting difficult.

In this patch, the devargs option "mbuf_check" is introduced and the corresponding diagnostic function is enabled by configuring MDD case.

Argument format: mbuf_check=generic,<mdd_case1>,<mdd_case2> Currently support MDD case: generic, segment, offload, careful.

---
 drivers/net/iavf/iavf.h        |  26 +++++
 drivers/net/iavf/iavf_ethdev.c |  99 ++++++++++++++++++
 drivers/net/iavf/iavf_rxtx.c   | 182 +++++++++++++++++++++++++++++++++
 drivers/net/iavf/iavf_rxtx.h   |   4 +
 4 files changed, 311 insertions(+)
drivers/net/iavf/iavf.h +26 -0
index 04774ce124..ad46fdeddd 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,13 @@ enum iavf_proto_xtr_type {
 	IAVF_PROTO_XTR_MAX,
 };
 
+enum iavf_mdd_check_type {
+	IAVF_MDD_CHECK_GENERAL,
+	IAVF_MDD_CHECK_SEGMENT,
+	IAVF_MDD_CHECK_OFFLOAD,
+	IAVF_MDD_CHECK_CAREFUL,
+};
+
 /**
  * Cache devargs parse result.
  */
@@ -308,10 +321,21 @@ struct iavf_devargs {
 	uint16_t quanta_size;
 	uint32_t watchdog_period;
 	uint8_t  auto_reset;
+	uint16_t mbuf_check;
 };
 
 struct iavf_security_ctx;
 
+struct iavf_tx_burst_element {
+	TAILQ_ENTRY(iavf_tx_burst_element) next;
+	eth_tx_burst_t tx_pkt_burst;
+};
+
+#define IAVF_MDD_CHECK_F_TX_GENERAL (1ULL << 0)
+#define IAVF_MDD_CHECK_F_TX_SEGMENT (1ULL << 1)
+#define IAVF_MDD_CHECK_F_TX_OFFLOAD (1ULL << 2)
+#define IAVF_MDD_CHECK_F_TX_CAREFUL (1ULL << 3)
+
 /* Structure to store private data for each VF instance. */
 struct iavf_adapter {
 	struct iavf_hw hw;
@@ -326,6 +350,8 @@ struct iavf_adapter {
 	uint32_t ptype_tbl[IAVF_MAX_PKT_TYPE] __rte_cache_min_aligned;
 	bool stopped;
 	bool closed;
+	uint64_t mc_flags; /* mdd check flags. */
+	TAILQ_HEAD(tx_pkt_burst_list, iavf_tx_burst_element) list_tx_pkt_burst;
 	uint16_t fdir_ref_cnt;
 	struct iavf_devargs devargs;
 };
drivers/net/iavf/iavf_ethdev.c +99 -0

147 lines not on this page · raw message

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

236 lines not on this page · raw message

drivers/net/iavf/iavf_rxtx.h +4 -0
index 605ea3f824..251e146eb5 100644
@@ -294,8 +294,12 @@ struct iavf_tx_queue {
 	uint64_t offloads;
 	uint16_t next_dd;              /* next to set RS, for VPMD */
 	uint16_t next_rs;              /* next to check DD,  for VPMD */
+	struct iavf_vsi *vsi;          /**< the VSI this queue belongs to */
 	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;
Signature · 1 line
2.25.1