From patchwork Wed Dec 20 09:32:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhichao Zeng X-Patchwork-Id: 135382 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: 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]) by inbox.dpdk.org (Postfix) with ESMTP id 5063343719; Wed, 20 Dec 2023 10:23:49 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3FD9840689; Wed, 20 Dec 2023 10:23:49 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by mails.dpdk.org (Postfix) with ESMTP id 1A1E840266 for ; Wed, 20 Dec 2023 10:23:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1703064227; x=1734600227; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=b2HI+Iq2Bzp6kO6hdAwl7/TXd/gKA6mU1TRMtLYf8sE=; b=PiVWzu/e22O8SLq1Gph0rbTYSShWMrmF8vll6KegNWJIOQWnGm8L3eBf FyeIZV8C8Pd8g+JKxDVnfrbqEzuLhl+zkVwL6usLqWGbTixL9HdD2qDDM mjn2Hl9WIWHNsdG1NfeXGB1IpBK1GB4W/MIS4VJPw8+9Batx9n2MXTTjG pF9kBXkQxk4L2zeWMK0b5EYpCi52XlRwQYDlSBBAYHIG6GH1RM8LjRHRX DbxaBMyVAE1RGqLgdHuXAN8OgD6OPfsXy4O31k4vets7k05JZZMWLv+Uy ls1YpoZFuWthlpBGQeKhON/SfP/ricKst/q9dO3kAWfMEF61u0l1Gc8YB w==; X-IronPort-AV: E=McAfee;i="6600,9927,10929"; a="3007923" X-IronPort-AV: E=Sophos;i="6.04,291,1695711600"; d="scan'208";a="3007923" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2023 01:23:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10929"; a="769525119" X-IronPort-AV: E=Sophos;i="6.04,291,1695711600"; d="scan'208";a="769525119" Received: from unknown (HELO zhichao-dpdk..) ([10.239.252.103]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2023 01:23:43 -0800 From: Zhichao Zeng To: dev@dpdk.org Cc: qi.z.zhang@intel.com, Zhichao Zeng , Jingjing Wu , Beilei Xing Subject: [PATCH v3 1/3] net/iavf: support Tx LLDP on scalar Date: Wed, 20 Dec 2023 17:32:37 +0800 Message-Id: <20231220093239.1148174-2-zhichaox.zeng@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231220093239.1148174-1-zhichaox.zeng@intel.com> References: <20231214065857.2142565-1-zhichaox.zeng@intel.com> <20231220093239.1148174-1-zhichaox.zeng@intel.com> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This patch adds an mbuf dynfield IAVF_TX_LLDP_DYNFIELD to determine whether or not to fill the SWTCH_UPLINK bit in the Tx context descriptor to send LLDP packet. Signed-off-by: Zhichao Zeng --- drivers/net/iavf/iavf_rxtx.c | 18 ++++++++++++++++-- drivers/net/iavf/rte_pmd_iavf.h | 4 ++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index f19aa14646..2ecd8637c5 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -85,6 +85,8 @@ uint64_t rte_pmd_ifd_dynflag_proto_xtr_tcp_mask; uint64_t rte_pmd_ifd_dynflag_proto_xtr_ip_offset_mask; uint64_t rte_pmd_ifd_dynflag_proto_xtr_ipsec_crypto_said_mask; +int iavf_tx_lldp_dynfield_offset = -1; + uint8_t iavf_proto_xtr_type_to_rxdid(uint8_t flex_type) { @@ -2418,8 +2420,9 @@ iavf_xmit_cleanup(struct iavf_tx_queue *txq) /* Check if the context descriptor is needed for TX offloading */ static inline uint16_t -iavf_calc_context_desc(uint64_t flags, uint8_t vlan_flag) +iavf_calc_context_desc(struct rte_mbuf *mb, uint8_t vlan_flag) { + uint64_t flags = mb->ol_flags; if (flags & (RTE_MBUF_F_TX_TCP_SEG | RTE_MBUF_F_TX_UDP_SEG | RTE_MBUF_F_TX_TUNNEL_MASK | RTE_MBUF_F_TX_OUTER_IP_CKSUM | RTE_MBUF_F_TX_OUTER_UDP_CKSUM)) @@ -2427,6 +2430,12 @@ iavf_calc_context_desc(uint64_t flags, uint8_t vlan_flag) if (flags & RTE_MBUF_F_TX_VLAN && vlan_flag & IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2) return 1; + + if (iavf_tx_lldp_dynfield_offset == + rte_mbuf_dynfield_lookup(IAVF_TX_LLDP_DYNFIELD, NULL)) + if (*RTE_MBUF_DYNFIELD(mb, + iavf_tx_lldp_dynfield_offset, uint8_t *) > 0) + return 1; return 0; } @@ -2446,6 +2455,11 @@ iavf_fill_ctx_desc_cmd_field(volatile uint64_t *field, struct rte_mbuf *m, << IAVF_TXD_CTX_QW1_CMD_SHIFT; } + if (*RTE_MBUF_DYNFIELD(m, + iavf_tx_lldp_dynfield_offset, uint8_t *) > 0) + cmd |= IAVF_TX_CTX_DESC_SWTCH_UPLINK + << IAVF_TXD_CTX_QW1_CMD_SHIFT; + *field |= cmd; } @@ -2826,7 +2840,7 @@ iavf_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) nb_desc_data = mb->nb_segs; nb_desc_ctx = - iavf_calc_context_desc(mb->ol_flags, txq->vlan_flag); + iavf_calc_context_desc(mb, txq->vlan_flag); nb_desc_ipsec = !!(mb->ol_flags & RTE_MBUF_F_TX_SEC_OFFLOAD); /** diff --git a/drivers/net/iavf/rte_pmd_iavf.h b/drivers/net/iavf/rte_pmd_iavf.h index 56d453fc4c..7d888ce6bd 100644 --- a/drivers/net/iavf/rte_pmd_iavf.h +++ b/drivers/net/iavf/rte_pmd_iavf.h @@ -23,6 +23,8 @@ extern "C" { #endif +#define IAVF_TX_LLDP_DYNFIELD "intel_pmd_dynfield_tx_lldp" + /** * The supported network flexible descriptor's extraction metadata format. */ @@ -95,6 +97,8 @@ extern uint64_t rte_pmd_ifd_dynflag_proto_xtr_tcp_mask; extern uint64_t rte_pmd_ifd_dynflag_proto_xtr_ip_offset_mask; extern uint64_t rte_pmd_ifd_dynflag_proto_xtr_ipsec_crypto_said_mask; +extern int iavf_tx_lldp_dynfield_offset; + /** * The mbuf dynamic field pointer for flexible descriptor's extraction metadata. */ From patchwork Wed Dec 20 09:32:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhichao Zeng X-Patchwork-Id: 135383 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: 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]) by inbox.dpdk.org (Postfix) with ESMTP id 2059543719; Wed, 20 Dec 2023 10:23:53 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5419A42E84; Wed, 20 Dec 2023 10:23:52 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by mails.dpdk.org (Postfix) with ESMTP id E97F842E84 for ; Wed, 20 Dec 2023 10:23:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1703064230; x=1734600230; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5LftSbsUMjoJ+AHkpe/DcaiUOLAy807ChE0A4d+dBTE=; b=c7Iaw/dBUxs7ClTiXdm+YREYS/pzRGvtnPaBsED9uIavABRi8svGG2Dd mdRbPT0Ccpa9VdaFi1imhVtDS51owY/GiurBccm2nzdyxxRqwEMPLt+YH 4y7Ub9PvMaoWP4Mha68+FmNXkCUOk86wn9QxJ7ICCzF/7HtkuC64baHq8 KyHIK4I7Vy5a22xq4etE2o3J61lrZyoJqZtVxU1i4+OqX9socbSMoL8Mw JvM9NPl02ibw+4JJnKTAXtKcuO5F0IDA8m7nOQ80GFC98Bv5vnr/JbLcB Jkjm/JWRuv/l2pQrFzQAsmqe6SpjemmMiNA4eaRVr2WiWpBRZ5XV4Ok5X g==; X-IronPort-AV: E=McAfee;i="6600,9927,10929"; a="3007936" X-IronPort-AV: E=Sophos;i="6.04,291,1695711600"; d="scan'208";a="3007936" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2023 01:23:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10929"; a="769525139" X-IronPort-AV: E=Sophos;i="6.04,291,1695711600"; d="scan'208";a="769525139" Received: from unknown (HELO zhichao-dpdk..) ([10.239.252.103]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2023 01:23:46 -0800 From: Zhichao Zeng To: dev@dpdk.org Cc: qi.z.zhang@intel.com, Zhichao Zeng , Jingjing Wu , Beilei Xing , Bruce Richardson , Konstantin Ananyev Subject: [PATCH v3 2/3] net/iavf: support Tx LLDP on AVX512 Date: Wed, 20 Dec 2023 17:32:38 +0800 Message-Id: <20231220093239.1148174-3-zhichaox.zeng@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231220093239.1148174-1-zhichaox.zeng@intel.com> References: <20231214065857.2142565-1-zhichaox.zeng@intel.com> <20231220093239.1148174-1-zhichaox.zeng@intel.com> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This patch adds an avx512 ctx Tx path that supports context descriptor, filling in the SWTCH_UPLINK bit based on mbuf dynfield IAVF_TX_LLDP_DYNFIELD to support sending LLDP packet. Signed-off-by: Zhichao Zeng --- drivers/net/iavf/iavf_rxtx.c | 5 +++++ drivers/net/iavf/iavf_rxtx.h | 3 +++ drivers/net/iavf/iavf_rxtx_vec_avx512.c | 20 ++++++++++++++++++++ drivers/net/iavf/iavf_rxtx_vec_common.h | 6 ++++++ 4 files changed, 34 insertions(+) diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index 2ecd8637c5..90a2d19c05 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -4053,6 +4053,11 @@ iavf_set_tx_function(struct rte_eth_dev *dev) dev->tx_pkt_prepare = iavf_prep_pkts; PMD_DRV_LOG(DEBUG, "Using AVX512 OFFLOAD Vector Tx (port %d).", dev->data->port_id); + } else if (check_ret == IAVF_VECTOR_CTX_PATH) { + dev->tx_pkt_burst = iavf_xmit_pkts_vec_avx512_ctx; + dev->tx_pkt_prepare = iavf_prep_pkts; + PMD_DRV_LOG(DEBUG, "Using AVX512 CONTEXT Vector Tx (port %d).", + dev->data->port_id); } else { dev->tx_pkt_burst = iavf_xmit_pkts_vec_avx512_ctx_offload; dev->tx_pkt_prepare = iavf_prep_pkts; diff --git a/drivers/net/iavf/iavf_rxtx.h b/drivers/net/iavf/iavf_rxtx.h index f432f9d956..ee52864915 100644 --- a/drivers/net/iavf/iavf_rxtx.h +++ b/drivers/net/iavf/iavf_rxtx.h @@ -66,6 +66,7 @@ #define IAVF_VECTOR_PATH 0 #define IAVF_VECTOR_OFFLOAD_PATH 1 #define IAVF_VECTOR_CTX_OFFLOAD_PATH 2 +#define IAVF_VECTOR_CTX_PATH 3 #define DEFAULT_TX_RS_THRESH 32 #define DEFAULT_TX_FREE_THRESH 32 @@ -752,6 +753,8 @@ uint16_t iavf_xmit_pkts_vec_avx512_offload(void *tx_queue, uint16_t nb_pkts); uint16_t iavf_xmit_pkts_vec_avx512_ctx_offload(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts); +uint16_t iavf_xmit_pkts_vec_avx512_ctx(void *tx_queue, struct rte_mbuf **tx_pkts, + uint16_t nb_pkts); int iavf_txq_vec_setup_avx512(struct iavf_tx_queue *txq); uint8_t iavf_proto_xtr_type_to_rxdid(uint8_t xtr_type); diff --git a/drivers/net/iavf/iavf_rxtx_vec_avx512.c b/drivers/net/iavf/iavf_rxtx_vec_avx512.c index 7a7df6d258..3ae5e4973c 100644 --- a/drivers/net/iavf/iavf_rxtx_vec_avx512.c +++ b/drivers/net/iavf/iavf_rxtx_vec_avx512.c @@ -2,6 +2,7 @@ * Copyright(c) 2020 Intel Corporation */ +#include "rte_pmd_iavf.h" #include "iavf_rxtx_vec_common.h" #include @@ -2206,6 +2207,10 @@ ctx_vtx1(volatile struct iavf_tx_desc *txdp, struct rte_mbuf *pkt, low_ctx_qw |= (uint64_t)pkt->vlan_tci << IAVF_TXD_CTX_QW0_L2TAG2_PARAM; } } + if (*RTE_MBUF_DYNFIELD(pkt, + iavf_tx_lldp_dynfield_offset, uint8_t *) > 0) + high_ctx_qw |= IAVF_TX_CTX_DESC_SWTCH_UPLINK + << IAVF_TXD_CTX_QW1_CMD_SHIFT; uint64_t high_data_qw = (IAVF_TX_DESC_DTYPE_DATA | ((uint64_t)flags << IAVF_TXD_QW1_CMD_SHIFT) | ((uint64_t)pkt->data_len << IAVF_TXD_QW1_TX_BUF_SZ_SHIFT)); @@ -2258,6 +2263,10 @@ ctx_vtx(volatile struct iavf_tx_desc *txdp, (uint64_t)pkt[1]->vlan_tci << IAVF_TXD_QW1_L2TAG1_SHIFT; } } + if (*RTE_MBUF_DYNFIELD(pkt[1], + iavf_tx_lldp_dynfield_offset, uint8_t *) > 0) + hi_ctx_qw1 |= IAVF_TX_CTX_DESC_SWTCH_UPLINK + << IAVF_TXD_CTX_QW1_CMD_SHIFT; if (pkt[0]->ol_flags & RTE_MBUF_F_TX_VLAN) { if (vlan_flag & IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2) { @@ -2270,6 +2279,10 @@ ctx_vtx(volatile struct iavf_tx_desc *txdp, (uint64_t)pkt[0]->vlan_tci << IAVF_TXD_QW1_L2TAG1_SHIFT; } } + if (*RTE_MBUF_DYNFIELD(pkt[0], + iavf_tx_lldp_dynfield_offset, uint8_t *) > 0) + hi_ctx_qw0 |= IAVF_TX_CTX_DESC_SWTCH_UPLINK + << IAVF_TXD_CTX_QW1_CMD_SHIFT; if (offload) { iavf_txd_enable_offload(pkt[1], &hi_data_qw1); @@ -2520,3 +2533,10 @@ iavf_xmit_pkts_vec_avx512_ctx_offload(void *tx_queue, struct rte_mbuf **tx_pkts, { return iavf_xmit_pkts_vec_avx512_ctx_cmn(tx_queue, tx_pkts, nb_pkts, true); } + +uint16_t +iavf_xmit_pkts_vec_avx512_ctx(void *tx_queue, struct rte_mbuf **tx_pkts, + uint16_t nb_pkts) +{ + return iavf_xmit_pkts_vec_avx512_ctx_cmn(tx_queue, tx_pkts, nb_pkts, false); +} diff --git a/drivers/net/iavf/iavf_rxtx_vec_common.h b/drivers/net/iavf/iavf_rxtx_vec_common.h index e18cdc3f11..a453d55335 100644 --- a/drivers/net/iavf/iavf_rxtx_vec_common.h +++ b/drivers/net/iavf/iavf_rxtx_vec_common.h @@ -10,6 +10,7 @@ #include "iavf.h" #include "iavf_rxtx.h" +#include "rte_pmd_iavf.h" #ifndef __INTEL_COMPILER #pragma GCC diagnostic ignored "-Wcast-qual" @@ -249,6 +250,11 @@ iavf_tx_vec_queue_default(struct iavf_tx_queue *txq) if (txq->offloads & IAVF_TX_NO_VECTOR_FLAGS) return -1; + if (rte_mbuf_dynfield_lookup(IAVF_TX_LLDP_DYNFIELD, NULL) > 0) { + txq->use_ctx = 1; + return IAVF_VECTOR_CTX_PATH; + } + /** * Vlan tci needs to be inserted via ctx desc, if the vlan_flag is L2TAG2. * Tunneling parameters and other fields need be configured in ctx desc From patchwork Wed Dec 20 09:32:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhichao Zeng X-Patchwork-Id: 135384 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: 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]) by inbox.dpdk.org (Postfix) with ESMTP id 5605D43719; Wed, 20 Dec 2023 10:24:00 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CF73342E99; Wed, 20 Dec 2023 10:23:54 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by mails.dpdk.org (Postfix) with ESMTP id 19E8742E8D for ; Wed, 20 Dec 2023 10:23:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1703064233; x=1734600233; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SKuGi+jww/a2iY7tx4yA6O2J5PAM+GPuQK7oJbr/k9I=; b=eCYoCvmAo+HtzlPx7F2gCP0/J/F6IvfMnhd7f6vbO9kqrvPHQ7WUKjA0 8uG4DST9Ymf18AOJ/KRN6FS+BjbI19RYarmTRuJoGngstNSbY7SJzGGFo WwKyFvJuoW0AcFOED+K3uyUtEXHpGrys/8xqrxV0DoD7a3J+pYoN3tRVS j6EGo1M7ryN5W9GryenDW4nvTmXvFo5hM6r9+znZVAb3i+gk5vLqyx/6e +ioo3UJtuVuANoYzDl4t8m4vLaIdiqrUMr3FHy/UQPStKQl9iVBl86QV8 vGgk+eOZsjxJRdpce6Jq07BI1e/R2ivjCxfxqU4XI89ADDbkl+/gbRTEB w==; X-IronPort-AV: E=McAfee;i="6600,9927,10929"; a="3007950" X-IronPort-AV: E=Sophos;i="6.04,291,1695711600"; d="scan'208";a="3007950" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2023 01:23:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10929"; a="769525168" X-IronPort-AV: E=Sophos;i="6.04,291,1695711600"; d="scan'208";a="769525168" Received: from unknown (HELO zhichao-dpdk..) ([10.239.252.103]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2023 01:23:50 -0800 From: Zhichao Zeng To: dev@dpdk.org Cc: qi.z.zhang@intel.com, Zhichao Zeng , Jingjing Wu , Beilei Xing Subject: [PATCH v3 3/3] net/iavf: add Tx LLDP command Date: Wed, 20 Dec 2023 17:32:39 +0800 Message-Id: <20231220093239.1148174-4-zhichaox.zeng@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231220093239.1148174-1-zhichaox.zeng@intel.com> References: <20231214065857.2142565-1-zhichaox.zeng@intel.com> <20231220093239.1148174-1-zhichaox.zeng@intel.com> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This patch adds an IAVF testpmd command "set tx lldp on|off" which will register an mbuf dynfield IAVF_TX_LLDP_DYNFIELD to indicate the need to send LLDP packet. Currently, it only supports turning on. For avx512, need to close the Tx port first, then "set tx lldp on", and reopen the port to select correct Tx path. Signed-off-by: Zhichao Zeng --- doc/guides/rel_notes/release_24_03.rst | 3 + drivers/net/iavf/iavf_testpmd.c | 80 ++++++++++++++++++++++++++ drivers/net/iavf/meson.build | 3 + 3 files changed, 86 insertions(+) create mode 100644 drivers/net/iavf/iavf_testpmd.c diff --git a/doc/guides/rel_notes/release_24_03.rst b/doc/guides/rel_notes/release_24_03.rst index 6f8ad27808..f94e18c33a 100644 --- a/doc/guides/rel_notes/release_24_03.rst +++ b/doc/guides/rel_notes/release_24_03.rst @@ -55,6 +55,9 @@ New Features Also, make sure to start the actual text at the margin. ======================================================= +* **Updated Intel iavf driver.** + + * Added support for Tx LLDP packet on scalar and avx512. Removed Items ------------- diff --git a/drivers/net/iavf/iavf_testpmd.c b/drivers/net/iavf/iavf_testpmd.c new file mode 100644 index 0000000000..3c4c2e7c3c --- /dev/null +++ b/drivers/net/iavf/iavf_testpmd.c @@ -0,0 +1,80 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2016 Intel Corporation. + */ + +#include + +#include + +#include +#include + +#include "testpmd.h" +#include "iavf_log.h" + +struct cmd_enable_tx_lldp_result { + cmdline_fixed_string_t set; + cmdline_fixed_string_t tx; + cmdline_fixed_string_t lldp; + cmdline_fixed_string_t what; +}; + +static cmdline_parse_token_string_t cmd_enable_tx_lldp_set = + TOKEN_STRING_INITIALIZER(struct cmd_enable_tx_lldp_result, + set, "set"); +static cmdline_parse_token_string_t cmd_enable_tx_lldp_tx = + TOKEN_STRING_INITIALIZER(struct cmd_enable_tx_lldp_result, + tx, "tx"); +static cmdline_parse_token_string_t cmd_enable_tx_lldp_lldp = + TOKEN_STRING_INITIALIZER(struct cmd_enable_tx_lldp_result, + lldp, "lldp"); +static cmdline_parse_token_string_t cmd_enable_tx_lldp_what = + TOKEN_STRING_INITIALIZER(struct cmd_enable_tx_lldp_result, + what, "on#off"); + +static void +cmd_enable_tx_lldp_parsed(void *parsed_result, + __rte_unused struct cmdline *cl, __rte_unused void *data) +{ + struct cmd_enable_tx_lldp_result *res = parsed_result; + const struct rte_mbuf_dynfield iavf_tx_lldp_dynfield = { + .name = IAVF_TX_LLDP_DYNFIELD, + .size = sizeof(uint8_t), + .align = __alignof__(uint8_t), + .flags = 0 + }; + + if (strcmp(res->what, "on") == 0) { + iavf_tx_lldp_dynfield_offset = + rte_mbuf_dynfield_register(&iavf_tx_lldp_dynfield); + PMD_DRV_LOG(DEBUG, "iavf_tx_lldp_dynfield_offset: %d", + iavf_tx_lldp_dynfield_offset); + if (iavf_tx_lldp_dynfield_offset < 0) + PMD_DRV_LOG(ERR, "rte mbuf dynfield register failed"); + } +} + +static cmdline_parse_inst_t cmd_enable_tx_lldp = { + .f = cmd_enable_tx_lldp_parsed, + .data = NULL, + .help_str = "set iavf tx lldp on|off", + .tokens = { + (void *)&cmd_enable_tx_lldp_set, + (void *)&cmd_enable_tx_lldp_tx, + (void *)&cmd_enable_tx_lldp_lldp, + (void *)&cmd_enable_tx_lldp_what, + NULL, + }, +}; + +static struct testpmd_driver_commands iavf_cmds = { + .commands = { + { + &cmd_enable_tx_lldp, + "set tx lldp (on|off)\n" + " Set iavf Tx lldp packet(currently only supported on)\n\n", + }, + { NULL, NULL }, + }, +}; +TESTPMD_ADD_DRIVER_COMMANDS(iavf_cmds) diff --git a/drivers/net/iavf/meson.build b/drivers/net/iavf/meson.build index a6ce2725c3..83aebd5596 100644 --- a/drivers/net/iavf/meson.build +++ b/drivers/net/iavf/meson.build @@ -8,6 +8,9 @@ endif cflags += ['-Wno-strict-aliasing'] includes += include_directories('../../common/iavf') + +testpmd_sources = files('iavf_testpmd.c') + deps += ['common_iavf', 'security', 'cryptodev'] sources = files(