get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/135616/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 135616,
    "url": "http://patches.dpdk.org/api/patches/135616/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20231227101655.799560-1-mingjinx.ye@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20231227101655.799560-1-mingjinx.ye@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20231227101655.799560-1-mingjinx.ye@intel.com",
    "date": "2023-12-27T10:16:54",
    "name": "[v4,1/2] net/iavf: add diagnostic support in TX path",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "226801a0b54b6704b676c12676d63c6b641e7ace",
    "submitter": {
        "id": 2862,
        "url": "http://patches.dpdk.org/api/people/2862/?format=api",
        "name": "Mingjin Ye",
        "email": "mingjinx.ye@intel.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20231227101655.799560-1-mingjinx.ye@intel.com/mbox/",
    "series": [
        {
            "id": 30675,
            "url": "http://patches.dpdk.org/api/series/30675/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=30675",
            "date": "2023-12-27T10:16:54",
            "name": "[v4,1/2] net/iavf: add diagnostic support in TX path",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/30675/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/135616/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/135616/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id A1F1D437A9;\n\tWed, 27 Dec 2023 11:33:55 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 11DC6402D1;\n\tWed, 27 Dec 2023 11:33:55 +0100 (CET)",
            "from mgamail.intel.com (mgamail.intel.com [198.175.65.10])\n by mails.dpdk.org (Postfix) with ESMTP id CC88D402A1\n for <dev@dpdk.org>; Wed, 27 Dec 2023 11:33:52 +0100 (CET)",
            "from orviesa001.jf.intel.com ([10.64.159.141])\n by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 27 Dec 2023 02:32:28 -0800",
            "from unknown (HELO localhost.localdomain) ([10.239.252.253])\n by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 27 Dec 2023 02:32:26 -0800"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1703673233; x=1735209233;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=Z6VqIsk3BUs83DRstlbnZ9eyUJmVVO/5sue5WEcDrcM=;\n b=lf/TrDguVPdnToIlwWRocsoDqhIAzUdeuQo7FubZMsWMT/m+YwqSzcuh\n gDeBcNQdFfKwEQ/D1Otw3kVt5/wczDOUpNU2BVvNPfyQe9bI58s7zh/qW\n 8B97piaTdz0cjgcyrZq+S2GfnmkDyNiYoRDj/uG7d/6uCgo/xzqd0ZSxy\n WLauLQshGqPUHaqg0UuLh7UUt0KUQFjwyCGh+nQDH4/wWNFc19r32QQGU\n thizgsj3ffGMnTa0oEmsDQ1pw9mm9fu6xRtvp5Q0h1iqWyb2EsPteOgxK\n Z3KJ9iS282rQJKkQZl1A1EMNAR1+5UeNwFkwMhJWpaHPuMaZJL2eMa8mq g==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6600,9927,10935\"; a=\"9827851\"",
            "E=Sophos;i=\"6.04,308,1695711600\";\n   d=\"scan'208\";a=\"9827851\"",
            "E=Sophos;i=\"6.04,308,1695711600\"; d=\"scan'208\";a=\"26541796\""
        ],
        "X-ExtLoop1": "1",
        "From": "Mingjin Ye <mingjinx.ye@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "qiming.yang@intel.com, Mingjin Ye <mingjinx.ye@intel.com>,\n Jingjing Wu <jingjing.wu@intel.com>, Beilei Xing <beilei.xing@intel.com>",
        "Subject": "[PATCH v4 1/2] net/iavf: add diagnostic support in TX path",
        "Date": "Wed, 27 Dec 2023 10:16:54 +0000",
        "Message-Id": "<20231227101655.799560-1-mingjinx.ye@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20231226100713.680088-1-mingjinx.ye@intel.com>",
        "References": "<20231226100713.680088-1-mingjinx.ye@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "The only way to enable diagnostics for TX paths is to modify the\napplication source code. Making it difficult to diagnose faults.\n\nIn this patch, the devarg option \"mbuf_check\" is introduced and the\nparameters are configured to enable the corresponding diagnostics.\n\nsupported cases: mbuf, size, segment, offload, strict.\n 1. mbuf: check for corrupted mbuf.\n 2. size: check min/max packet length according to hw spec.\n 3. segment: check number of mbuf segments not exceed hw limitation.\n 4. offload: check any unsupported offload flag.\n 5. strict: check protocol headers.\n\nparameter format: mbuf_check=[mbuf,<case1>,<case2>]\neg: dpdk-testpmd -a 0000:81:01.0,mbuf_check=[mbuf,size] -- -i\n\nSigned-off-by: Mingjin Ye <mingjinx.ye@intel.com>\n---\nv2: Remove call chain.\n---\nv3: Optimisation implementation.\n---\nv4: Fix Windows os compilation error.\n---\n drivers/net/iavf/iavf.h        |  25 +++++-\n drivers/net/iavf/iavf_ethdev.c |  70 +++++++++++++++++\n drivers/net/iavf/iavf_rxtx.c   | 138 ++++++++++++++++++++++++++++++++-\n drivers/net/iavf/iavf_rxtx.h   |   5 ++\n 4 files changed, 234 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h\nindex 10868f2c30..b81329bb56 100644\n--- a/drivers/net/iavf/iavf.h\n+++ b/drivers/net/iavf/iavf.h\n@@ -113,9 +113,14 @@ struct iavf_ipsec_crypto_stats {\n \t} ierrors;\n };\n \n+struct iavf_mbuf_stats {\n+\tuint64_t tx_pkt_errors;\n+};\n+\n struct iavf_eth_xstats {\n \tstruct virtchnl_eth_stats eth_stats;\n \tstruct iavf_ipsec_crypto_stats ips_stats;\n+\tstruct iavf_mbuf_stats mbuf_stats;\n };\n \n /* Structure that defines a VSI, associated with a adapter. */\n@@ -309,10 +314,27 @@ struct iavf_devargs {\n \tuint32_t watchdog_period;\n \tint auto_reset;\n \tint no_poll_on_link_down;\n+\tint mbuf_check;\n };\n \n struct iavf_security_ctx;\n \n+#define IAVF_MBUF_CHECK_F_TX_MBUF        (1ULL << 0)\n+#define IAVF_MBUF_CHECK_F_TX_SIZE        (1ULL << 1)\n+#define IAVF_MBUF_CHECK_F_TX_SEGMENT     (1ULL << 2)\n+#define IAVF_MBUF_CHECK_F_TX_OFFLOAD     (1ULL << 3)\n+#define IAVF_MBUF_CHECK_F_TX_STRICT      (1ULL << 4)\n+\n+enum iavf_tx_pkt_burst_type {\n+\tIAVF_PKT_BURST_DEFAULT\t\t= 0,\n+\tIAVF_PKT_BURST_VEC\t\t= 1,\n+\tIAVF_PKT_BURST_VEC_AVX2\t\t= 2,\n+\tIAVF_PKT_BURST_VEC_AVX2_OFFLOAD\t= 3,\n+\tIAVF_PKT_BURST_VEC_AVX512\t= 4,\n+\tIAVF_PKT_BURST_VEC_AVX512_OFFLOAD\t= 5,\n+\tIAVF_PKT_BURST_VEC_AVX512_CTX_OFFLOAD\t= 6,\n+};\n+\n /* Structure to store private data for each VF instance. */\n struct iavf_adapter {\n \tstruct iavf_hw hw;\n@@ -329,7 +351,8 @@ struct iavf_adapter {\n \tbool closed;\n \tbool no_poll;\n \teth_rx_burst_t rx_pkt_burst;\n-\teth_tx_burst_t tx_pkt_burst;\n+\tenum iavf_tx_pkt_burst_type tx_burst_type;\n+\tuint64_t mc_flags; /* mbuf check flags. */\n \tuint16_t fdir_ref_cnt;\n \tstruct iavf_devargs devargs;\n };\ndiff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c\nindex d1edb0dd5c..5398d2783f 100644\n--- a/drivers/net/iavf/iavf_ethdev.c\n+++ b/drivers/net/iavf/iavf_ethdev.c\n@@ -13,6 +13,7 @@\n #include <inttypes.h>\n #include <rte_byteorder.h>\n #include <rte_common.h>\n+#include <rte_os_shim.h>\n \n #include <rte_interrupts.h>\n #include <rte_debug.h>\n@@ -39,6 +40,8 @@\n #define IAVF_RESET_WATCHDOG_ARG    \"watchdog_period\"\n #define IAVF_ENABLE_AUTO_RESET_ARG \"auto_reset\"\n #define IAVF_NO_POLL_ON_LINK_DOWN_ARG \"no-poll-on-link-down\"\n+#define IAVF_MBUF_CHECK_ARG       \"mbuf_check\"\n+\n uint64_t iavf_timestamp_dynflag;\n int iavf_timestamp_dynfield_offset = -1;\n \n@@ -48,6 +51,7 @@ static const char * const iavf_valid_args[] = {\n \tIAVF_RESET_WATCHDOG_ARG,\n \tIAVF_ENABLE_AUTO_RESET_ARG,\n \tIAVF_NO_POLL_ON_LINK_DOWN_ARG,\n+\tIAVF_MBUF_CHECK_ARG,\n \tNULL\n };\n \n@@ -174,6 +178,7 @@ static const struct rte_iavf_xstats_name_off rte_iavf_stats_strings[] = {\n \t{\"tx_broadcast_packets\", _OFF_OF(eth_stats.tx_broadcast)},\n \t{\"tx_dropped_packets\", _OFF_OF(eth_stats.tx_discards)},\n \t{\"tx_error_packets\", _OFF_OF(eth_stats.tx_errors)},\n+\t{\"tx_mbuf_error_packets\", _OFF_OF(mbuf_stats.tx_pkt_errors)},\n \n \t{\"inline_ipsec_crypto_ipackets\", _OFF_OF(ips_stats.icount)},\n \t{\"inline_ipsec_crypto_ibytes\", _OFF_OF(ips_stats.ibytes)},\n@@ -1881,6 +1886,8 @@ static int iavf_dev_xstats_get(struct rte_eth_dev *dev,\n {\n \tint ret;\n \tunsigned int i;\n+\tstruct iavf_tx_queue *txq;\n+\tuint64_t mbuf_errors = 0;\n \tstruct iavf_adapter *adapter =\n \t\tIAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);\n \tstruct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);\n@@ -1904,6 +1911,15 @@ static int iavf_dev_xstats_get(struct rte_eth_dev *dev,\n \tif (iavf_ipsec_crypto_supported(adapter))\n \t\tiavf_dev_update_ipsec_xstats(dev, &iavf_xtats.ips_stats);\n \n+\tif (adapter->devargs.mbuf_check) {\n+\t\tfor (i = 0; i < dev->data->nb_tx_queues; i++) {\n+\t\t\ttxq = dev->data->tx_queues[i];\n+\t\t\tmbuf_errors += __atomic_load_n(&txq->mbuf_errors,\n+\t\t\t\t__ATOMIC_RELAXED);\n+\t\t}\n+\t\tiavf_xtats.mbuf_stats.tx_pkt_errors = mbuf_errors;\n+\t}\n+\n \t/* loop over xstats array and values from pstats */\n \tfor (i = 0; i < IAVF_NB_XSTATS; i++) {\n \t\txstats[i].id = i;\n@@ -2286,6 +2302,52 @@ iavf_parse_watchdog_period(__rte_unused const char *key, const char *value, void\n \treturn 0;\n }\n \n+static int\n+iavf_parse_mbuf_check(__rte_unused const char *key, const char *value, void *args)\n+{\n+\tchar *cur;\n+\tchar *tmp;\n+\tint str_len;\n+\tint valid_len;\n+\n+\tint ret = 0;\n+\tuint64_t *mc_flags = args;\n+\tchar *str2 = strdup(value);\n+\tif (str2 == NULL)\n+\t\treturn -1;\n+\n+\tstr_len = strlen(str2);\n+\tif (str2[0] == '[' && str2[str_len - 1] == ']') {\n+\t\tif (str_len < 3) {\n+\t\t\tret = -1;\n+\t\t\tgoto mdd_end;\n+\t\t}\n+\t\tvalid_len = str_len - 2;\n+\t\tmemmove(str2, str2 + 1, valid_len);\n+\t\tmemset(str2 + valid_len, '\\0', 2);\n+\t}\n+\tcur = strtok_r(str2, \",\", &tmp);\n+\twhile (cur != NULL) {\n+\t\tif (!strcmp(cur, \"mbuf\"))\n+\t\t\t*mc_flags |= IAVF_MBUF_CHECK_F_TX_MBUF;\n+\t\telse if (!strcmp(cur, \"size\"))\n+\t\t\t*mc_flags |= IAVF_MBUF_CHECK_F_TX_SIZE;\n+\t\telse if (!strcmp(cur, \"segment\"))\n+\t\t\t*mc_flags |= IAVF_MBUF_CHECK_F_TX_SEGMENT;\n+\t\telse if (!strcmp(cur, \"offload\"))\n+\t\t\t*mc_flags |= IAVF_MBUF_CHECK_F_TX_OFFLOAD;\n+\t\telse if (!strcmp(cur, \"strict\"))\n+\t\t\t*mc_flags |= IAVF_MBUF_CHECK_F_TX_STRICT;\n+\t\telse\n+\t\t\tPMD_DRV_LOG(ERR, \"Unsupported mdd check type: %s\", cur);\n+\t\tcur = strtok_r(NULL, \",\", &tmp);\n+\t}\n+\n+mdd_end:\n+\tfree(str2);\n+\treturn ret;\n+}\n+\n static int iavf_parse_devargs(struct rte_eth_dev *dev)\n {\n \tstruct iavf_adapter *ad =\n@@ -2340,6 +2402,14 @@ static int iavf_parse_devargs(struct rte_eth_dev *dev)\n \t\tgoto bail;\n \t}\n \n+\tret = rte_kvargs_process(kvlist, IAVF_MBUF_CHECK_ARG,\n+\t\t\t\t &iavf_parse_mbuf_check, &ad->mc_flags);\n+\tif (ret)\n+\t\tgoto bail;\n+\n+\tif (ad->mc_flags)\n+\t\tad->devargs.mbuf_check = 1;\n+\n \tret = rte_kvargs_process(kvlist, IAVF_ENABLE_AUTO_RESET_ARG,\n \t\t\t\t &parse_bool, &ad->devargs.auto_reset);\n \tif (ret)\ndiff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c\nindex f19aa14646..7fa84e9f0e 100644\n--- a/drivers/net/iavf/iavf_rxtx.c\n+++ b/drivers/net/iavf/iavf_rxtx.c\n@@ -425,6 +425,23 @@ struct iavf_txq_ops iavf_txq_release_mbufs_ops[] = {\n \n };\n \n+static const\n+struct iavf_tx_burst_ops iavf_tx_pkt_burst_ops[] = {\n+\t[IAVF_PKT_BURST_DEFAULT].tx_pkt_burst = iavf_xmit_pkts,\n+#ifdef RTE_ARCH_X86\n+\t[IAVF_PKT_BURST_VEC].tx_pkt_burst = iavf_xmit_pkts_vec,\n+\t[IAVF_PKT_BURST_VEC_AVX2].tx_pkt_burst = iavf_xmit_pkts_vec_avx2,\n+\t[IAVF_PKT_BURST_VEC_AVX2_OFFLOAD].tx_pkt_burst = iavf_xmit_pkts_vec_avx2_offload,\n+#ifdef CC_AVX512_SUPPORT\n+\t[IAVF_PKT_BURST_VEC_AVX512].tx_pkt_burst = iavf_xmit_pkts_vec_avx512,\n+\t[IAVF_PKT_BURST_VEC_AVX512_OFFLOAD].tx_pkt_burst =\n+\t\tiavf_xmit_pkts_vec_avx512_offload,\n+\t[IAVF_PKT_BURST_VEC_AVX512_CTX_OFFLOAD].tx_pkt_burst =\n+\t\tiavf_xmit_pkts_vec_avx512_ctx_offload,\n+#endif\n+#endif\n+};\n+\n static inline void\n iavf_rxd_to_pkt_fields_by_comms_ovs(__rte_unused struct iavf_rx_queue *rxq,\n \t\t\t\t    struct rte_mbuf *mb,\n@@ -3629,6 +3646,103 @@ iavf_check_mbuf(struct rte_mbuf *m)\n \treturn check_ether_type(&info, m);\n }\n \n+/* Tx mbuf check */\n+static uint16_t\n+iavf_xmit_pkts_check(void *tx_queue, struct rte_mbuf **tx_pkts,\n+\t      uint16_t nb_pkts)\n+{\n+\tuint16_t idx;\n+\tuint64_t ol_flags;\n+\tstruct rte_mbuf *mb;\n+\tuint16_t good_pkts = nb_pkts;\n+\tconst char *reason = NULL;\n+\tbool pkt_error = false;\n+\tstruct iavf_tx_queue *txq = tx_queue;\n+\tstruct iavf_adapter *adapter = txq->vsi->adapter;\n+\tenum iavf_tx_pkt_burst_type tx_burst_type =\n+\t\ttxq->vsi->adapter->tx_burst_type;\n+\n+\tfor (idx = 0; idx < nb_pkts; idx++) {\n+\t\tmb = tx_pkts[idx];\n+\t\tol_flags = mb->ol_flags;\n+\n+\t\tif ((adapter->mc_flags & IAVF_MBUF_CHECK_F_TX_MBUF) &&\n+\t\t\t(rte_mbuf_check(mb, 1, &reason) != 0)) {\n+\t\t\tPMD_TX_LOG(ERR, \"INVALID mbuf: %s\\n\", reason);\n+\t\t\tpkt_error = true;\n+\t\t\tbreak;\n+\t\t}\n+\n+\t\tif ((adapter->mc_flags & IAVF_MBUF_CHECK_F_TX_SIZE) &&\n+\t\t\t(mb->data_len < IAVF_TX_MIN_PKT_LEN ||\n+\t\t\tmb->data_len > adapter->vf.max_pkt_len)) {\n+\t\t\tPMD_TX_LOG(ERR, \"INVALID mbuf: data_len (%u) is out \"\n+\t\t\t\"of range, reasonable range (%d - %u)\\n\", mb->data_len,\n+\t\t\tIAVF_TX_MIN_PKT_LEN, adapter->vf.max_pkt_len);\n+\t\t\tpkt_error = true;\n+\t\t\tbreak;\n+\t\t}\n+\n+\t\tif (adapter->mc_flags & IAVF_MBUF_CHECK_F_TX_SEGMENT) {\n+\t\t\t/* Check condition for nb_segs > IAVF_TX_MAX_MTU_SEG. */\n+\t\t\tif (!(ol_flags & (RTE_MBUF_F_TX_TCP_SEG | RTE_MBUF_F_TX_UDP_SEG))) {\n+\t\t\t\tif (mb->nb_segs > IAVF_TX_MAX_MTU_SEG) {\n+\t\t\t\t\tPMD_TX_LOG(ERR, \"INVALID mbuf: nb_segs (%d) exceeds \"\n+\t\t\t\t\t\"HW limit, maximum allowed value is %d\\n\", mb->nb_segs,\n+\t\t\t\t\tIAVF_TX_MAX_MTU_SEG);\n+\t\t\t\t\tpkt_error = true;\n+\t\t\t\t\tbreak;\n+\t\t\t\t}\n+\t\t\t} else if ((mb->tso_segsz < IAVF_MIN_TSO_MSS) ||\n+\t\t\t\t(mb->tso_segsz > IAVF_MAX_TSO_MSS)) {\n+\t\t\t\t/* MSS outside the range are considered malicious */\n+\t\t\t\tPMD_TX_LOG(ERR, \"INVALID mbuf: tso_segsz (%u) is out \"\n+\t\t\t\t\"of range, reasonable range (%d - %u)\\n\", mb->tso_segsz,\n+\t\t\t\tIAVF_MIN_TSO_MSS, IAVF_MAX_TSO_MSS);\n+\t\t\t\tpkt_error = true;\n+\t\t\t\tbreak;\n+\t\t\t} else if (mb->nb_segs > txq->nb_tx_desc) {\n+\t\t\t\tPMD_TX_LOG(ERR, \"INVALID mbuf: nb_segs out \"\n+\t\t\t\t\"of ring length\\n\");\n+\t\t\t\tpkt_error = true;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t}\n+\n+\t\tif (adapter->mc_flags & IAVF_MBUF_CHECK_F_TX_OFFLOAD) {\n+\t\t\tif (ol_flags & IAVF_TX_OFFLOAD_NOTSUP_MASK) {\n+\t\t\t\tPMD_TX_LOG(ERR, \"INVALID mbuf: TX offload \"\n+\t\t\t\t\"is not supported\\n\");\n+\t\t\t\tpkt_error = true;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\n+\t\t\tif (!rte_validate_tx_offload(mb)) {\n+\t\t\t\tPMD_TX_LOG(ERR, \"INVALID mbuf: TX offload \"\n+\t\t\t\t\"setup error\\n\");\n+\t\t\t\tpkt_error = true;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t}\n+\n+\t\tif (adapter->mc_flags & IAVF_MBUF_CHECK_F_TX_STRICT &&\n+\t\t\tiavf_check_mbuf(mb)) {\n+\t\t\tpkt_error = true;\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+\n+\tif (pkt_error) {\n+\t\t__atomic_fetch_add(&txq->mbuf_errors, 1, __ATOMIC_RELAXED);\n+\t\tgood_pkts = idx;\n+\t\tif (good_pkts == 0)\n+\t\t\treturn 0;\n+\t}\n+\n+\treturn iavf_tx_pkt_burst_ops[tx_burst_type].tx_pkt_burst(tx_queue,\n+\t\t\t\t\t\t\t\ttx_pkts, good_pkts);\n+}\n+\n /* TX prep functions */\n uint16_t\n iavf_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts,\n@@ -3724,10 +3838,13 @@ iavf_xmit_pkts_no_poll(void *tx_queue, struct rte_mbuf **tx_pkts,\n \t\t\t\tuint16_t nb_pkts)\n {\n \tstruct iavf_tx_queue *txq = tx_queue;\n+\tenum iavf_tx_pkt_burst_type tx_burst_type =\n+\t\ttxq->vsi->adapter->tx_burst_type;\n+\n \tif (!txq->vsi || txq->vsi->adapter->no_poll)\n \t\treturn 0;\n \n-\treturn txq->vsi->adapter->tx_pkt_burst(tx_queue,\n+\treturn iavf_tx_pkt_burst_ops[tx_burst_type].tx_pkt_burst(tx_queue,\n \t\t\t\t\t\t\t\ttx_pkts, nb_pkts);\n }\n \n@@ -3975,6 +4092,8 @@ iavf_set_tx_function(struct rte_eth_dev *dev)\n {\n \tstruct iavf_adapter *adapter =\n \t\tIAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);\n+\tenum iavf_tx_pkt_burst_type tx_burst_type;\n+\tint mbuf_check = adapter->devargs.mbuf_check;\n \tint no_poll_on_link_down = adapter->devargs.no_poll_on_link_down;\n #ifdef RTE_ARCH_X86\n \tstruct iavf_tx_queue *txq;\n@@ -4011,10 +4130,12 @@ iavf_set_tx_function(struct rte_eth_dev *dev)\n \t\t\tPMD_DRV_LOG(DEBUG, \"Using Vector Tx (port %d).\",\n \t\t\t\t    dev->data->port_id);\n \t\t\tdev->tx_pkt_burst = iavf_xmit_pkts_vec;\n+\t\t\ttx_burst_type = IAVF_PKT_BURST_VEC;\n \t\t}\n \t\tif (use_avx2) {\n \t\t\tif (check_ret == IAVF_VECTOR_PATH) {\n \t\t\t\tdev->tx_pkt_burst = iavf_xmit_pkts_vec_avx2;\n+\t\t\t\ttx_burst_type = IAVF_PKT_BURST_VEC_AVX2;\n \t\t\t\tPMD_DRV_LOG(DEBUG, \"Using AVX2 Vector Tx (port %d).\",\n \t\t\t\t\t    dev->data->port_id);\n \t\t\t} else if (check_ret == IAVF_VECTOR_CTX_OFFLOAD_PATH) {\n@@ -4023,6 +4144,7 @@ iavf_set_tx_function(struct rte_eth_dev *dev)\n \t\t\t\tgoto normal;\n \t\t\t} else {\n \t\t\t\tdev->tx_pkt_burst = iavf_xmit_pkts_vec_avx2_offload;\n+\t\t\t\ttx_burst_type = IAVF_PKT_BURST_VEC_AVX2_OFFLOAD;\n \t\t\t\tdev->tx_pkt_prepare = iavf_prep_pkts;\n \t\t\t\tPMD_DRV_LOG(DEBUG, \"Using AVX2 OFFLOAD Vector Tx (port %d).\",\n \t\t\t\t\t    dev->data->port_id);\n@@ -4032,15 +4154,18 @@ iavf_set_tx_function(struct rte_eth_dev *dev)\n \t\tif (use_avx512) {\n \t\t\tif (check_ret == IAVF_VECTOR_PATH) {\n \t\t\t\tdev->tx_pkt_burst = iavf_xmit_pkts_vec_avx512;\n+\t\t\t\ttx_burst_type = IAVF_PKT_BURST_VEC_AVX512;\n \t\t\t\tPMD_DRV_LOG(DEBUG, \"Using AVX512 Vector Tx (port %d).\",\n \t\t\t\t\t    dev->data->port_id);\n \t\t\t} else if (check_ret == IAVF_VECTOR_OFFLOAD_PATH) {\n \t\t\t\tdev->tx_pkt_burst = iavf_xmit_pkts_vec_avx512_offload;\n+\t\t\t\ttx_burst_type = IAVF_PKT_BURST_VEC_AVX512_OFFLOAD;\n \t\t\t\tdev->tx_pkt_prepare = iavf_prep_pkts;\n \t\t\t\tPMD_DRV_LOG(DEBUG, \"Using AVX512 OFFLOAD Vector Tx (port %d).\",\n \t\t\t\t\t    dev->data->port_id);\n \t\t\t} else {\n \t\t\t\tdev->tx_pkt_burst = iavf_xmit_pkts_vec_avx512_ctx_offload;\n+\t\t\t\ttx_burst_type = IAVF_PKT_BURST_VEC_AVX512_CTX_OFFLOAD;\n \t\t\t\tdev->tx_pkt_prepare = iavf_prep_pkts;\n \t\t\t\tPMD_DRV_LOG(DEBUG, \"Using AVX512 CONTEXT OFFLOAD Vector Tx (port %d).\",\n \t\t\t\t\t    dev->data->port_id);\n@@ -4063,8 +4188,11 @@ iavf_set_tx_function(struct rte_eth_dev *dev)\n \t\t}\n \n \t\tif (no_poll_on_link_down) {\n-\t\t\tadapter->tx_pkt_burst = dev->tx_pkt_burst;\n+\t\t\tadapter->tx_burst_type = tx_burst_type;\n \t\t\tdev->tx_pkt_burst = iavf_xmit_pkts_no_poll;\n+\t\t} else if (mbuf_check) {\n+\t\t\tadapter->tx_burst_type = tx_burst_type;\n+\t\t\tdev->tx_pkt_burst = iavf_xmit_pkts_check;\n \t\t}\n \t\treturn;\n \t}\n@@ -4074,11 +4202,15 @@ iavf_set_tx_function(struct rte_eth_dev *dev)\n \tPMD_DRV_LOG(DEBUG, \"Using Basic Tx callback (port=%d).\",\n \t\t    dev->data->port_id);\n \tdev->tx_pkt_burst = iavf_xmit_pkts;\n+\ttx_burst_type = IAVF_PKT_BURST_DEFAULT;\n \tdev->tx_pkt_prepare = iavf_prep_pkts;\n \n \tif (no_poll_on_link_down) {\n-\t\tadapter->tx_pkt_burst = dev->tx_pkt_burst;\n+\t\tadapter->tx_burst_type = tx_burst_type;\n \t\tdev->tx_pkt_burst = iavf_xmit_pkts_no_poll;\n+\t} else if (mbuf_check) {\n+\t\tadapter->tx_burst_type = tx_burst_type;\n+\t\tdev->tx_pkt_burst = iavf_xmit_pkts_check;\n \t}\n }\n \ndiff --git a/drivers/net/iavf/iavf_rxtx.h b/drivers/net/iavf/iavf_rxtx.h\nindex f432f9d956..a4128ff7a3 100644\n--- a/drivers/net/iavf/iavf_rxtx.h\n+++ b/drivers/net/iavf/iavf_rxtx.h\n@@ -203,6 +203,9 @@ struct iavf_txq_ops {\n \tvoid (*release_mbufs)(struct iavf_tx_queue *txq);\n };\n \n+struct iavf_tx_burst_ops {\n+\teth_tx_burst_t tx_pkt_burst;\n+};\n \n struct iavf_rx_queue_stats {\n \tuint64_t reserved;\n@@ -297,6 +300,8 @@ struct iavf_tx_queue {\n \tuint16_t next_rs;              /* next to check DD,  for VPMD */\n \tuint16_t ipsec_crypto_pkt_md_offset;\n \n+\tuint64_t mbuf_errors;\n+\n \tbool q_set;                    /* if rx queue has been configured */\n \tbool tx_deferred_start;        /* don't start this queue in dev start */\n \tconst struct iavf_txq_ops *ops;\n",
    "prefixes": [
        "v4",
        "1/2"
    ]
}