From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 921AD43782; Mon, 25 Dec 2023 04:05:48 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7D1F1402DF; Mon, 25 Dec 2023 04:05:48 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id D2DE940297 for ; Mon, 25 Dec 2023 04:05: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=1703473546; x=1735009546; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HwcBUt0tTr+pfGA3fdMPx07BLCOSi6bbiWzZi/OT3B0=; b=Fx6kGp9heqj5SjaqSwz3SfnKrsO4TFqKOTSmnbvHZOUFKRMpTBoF9M+f 4FO1LxNCFSoOOv/s7naw7D8wFtj5ylcuhKo02GujVY5qDuxmwJUx4DTT5 8X5YRU2ZmMzpqpq5eQ/4TYLalls1olBV6NFUnxchEENScP60VpS/rku8a 1nwiphFFhoB7UZJDUURvzqa/ercCA4ALaekytedtHrTJrc3xhO3ooaTaz N3/XnLMbcdrXWi71CtXL00c0Vc4GTWF52qxcNQkUYSBqv+lYNzVJ+CnJB jKmF77asEXa4q/PFX0YtgJPGl3svidNaprwz3MfGZ00JoHUTWFINz3F9o w==; X-IronPort-AV: E=McAfee;i="6600,9927,10934"; a="482438908" X-IronPort-AV: E=Sophos;i="6.04,302,1695711600"; d="scan'208";a="482438908" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Dec 2023 19:05:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10934"; a="950887781" X-IronPort-AV: E=Sophos;i="6.04,302,1695711600"; d="scan'208";a="950887781" Received: from unknown (HELO zhichao-dpdk..) ([10.239.252.103]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Dec 2023 19:05:43 -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 v4 2/3] net/iavf: support Tx LLDP on AVX512 Date: Mon, 25 Dec 2023 11:14:50 +0800 Message-Id: <20231225031451.4002181-3-zhichaox.zeng@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231225031451.4002181-1-zhichaox.zeng@intel.com> References: <20231221072827.1808983-1-zhichaox.zeng@intel.com> <20231225031451.4002181-1-zhichaox.zeng@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 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 | 19 +++++++++++++++++++ drivers/net/iavf/iavf_rxtx_vec_common.h | 5 +++++ 4 files changed, 32 insertions(+) diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index 736db21ea4..8e147ad6b1 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -4054,6 +4054,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 960618205c..4e25aa9000 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 @@ -755,6 +756,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..045cb7fd11 100644 --- a/drivers/net/iavf/iavf_rxtx_vec_avx512.c +++ b/drivers/net/iavf/iavf_rxtx_vec_avx512.c @@ -2206,6 +2206,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, + rte_pmd_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 +2262,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], + rte_pmd_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 +2278,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], + rte_pmd_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 +2532,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..e4432d1473 100644 --- a/drivers/net/iavf/iavf_rxtx_vec_common.h +++ b/drivers/net/iavf/iavf_rxtx_vec_common.h @@ -249,6 +249,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 -- 2.34.1