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 ACFAB43807; Wed, 3 Jan 2024 08:37:29 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9B4F940608; Wed, 3 Jan 2024 08:37:29 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 52A714013F for ; Wed, 3 Jan 2024 08:37:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1704267447; x=1735803447; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=O6icR4NmJhWWrpJdREwTzRTCEmdI7uzczdebWWRNdt8=; b=AddbbJFLvpWUOAjQAXsrBGIEvnWj+p3WRuqI3T2/Z9lcQc0RYjCHgrz+ tf6/LHn2wncSjiBYihOc0UA2Y6K4xP1oCDCJ22q6lLuuyyzSR2xn5aReW G8Vafmcq//mjZj2JJpMZiCDmeNX9ckECR/YvddK/9PdWUr9+UXA/tlqFq SiFHB5BJbKSnAzEBBaePpOmODKYfvt7IyI4rKGinL/VsgDj7V7O2OkrnW +Ola0UCU8pw252PZF86srFcJpaMn6wsswLzFN7lF5+pTvQ74MnPQuwPqA rGAILCOe7ECcgMaryGjRYaXlwUO3EiiwtTj4uojSCMRLV9s+IxtDTaDTI w==; X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="387428603" X-IronPort-AV: E=Sophos;i="6.04,327,1695711600"; d="scan'208";a="387428603" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jan 2024 23:37:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="779913022" X-IronPort-AV: E=Sophos;i="6.04,327,1695711600"; d="scan'208";a="779913022" Received: from unknown (HELO zhichao-dpdk..) ([10.239.252.103]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jan 2024 23:37:24 -0800 From: Zhichao Zeng To: dev@dpdk.org Cc: qi.z.zhang@intel.com, Zhichao Zeng , Jingjing Wu , Beilei Xing Subject: [PATCH v6 1/3] net/iavf: support Tx LLDP on scalar Date: Wed, 3 Jan 2024 15:47:19 +0800 Message-Id: <20240103074721.832061-2-zhichaox.zeng@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240103074721.832061-1-zhichaox.zeng@intel.com> References: <20231228032211.1127554-1-zhichaox.zeng@intel.com> <20240103074721.832061-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 mbuf dynfield IAVF_TX_LLDP_DYNFIELD to determine whether or not to fill the SWTCH_UPLINK bit in the Tx context descriptor to transmit LLDP packet. Signed-off-by: Zhichao Zeng --- drivers/net/iavf/iavf_ethdev.c | 5 +++++ drivers/net/iavf/iavf_rxtx.c | 13 +++++++++++-- drivers/net/iavf/iavf_rxtx.h | 8 ++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index d1edb0dd5c..ef34246d36 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -41,6 +41,7 @@ #define IAVF_NO_POLL_ON_LINK_DOWN_ARG "no-poll-on-link-down" uint64_t iavf_timestamp_dynflag; int iavf_timestamp_dynfield_offset = -1; +int rte_pmd_iavf_tx_lldp_dynfield_offset = -1; static const char * const iavf_valid_args[] = { IAVF_PROTO_XTR_ARG, @@ -1017,6 +1018,10 @@ iavf_dev_start(struct rte_eth_dev *dev) } } + /* Check Tx LLDP dynfield */ + rte_pmd_iavf_tx_lldp_dynfield_offset = + rte_mbuf_dynfield_lookup(IAVF_TX_LLDP_DYNFIELD, NULL); + if (iavf_init_queues(dev) != 0) { PMD_DRV_LOG(ERR, "failed to do Queue init"); return -1; diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index f19aa14646..4329809d1d 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -2418,8 +2418,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 +2428,10 @@ 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_CHECK_TX_LLDP(mb)) + return 1; + return 0; } @@ -2446,6 +2451,10 @@ iavf_fill_ctx_desc_cmd_field(volatile uint64_t *field, struct rte_mbuf *m, << IAVF_TXD_CTX_QW1_CMD_SHIFT; } + if (IAVF_CHECK_TX_LLDP(m)) + cmd |= IAVF_TX_CTX_DESC_SWTCH_UPLINK + << IAVF_TXD_CTX_QW1_CMD_SHIFT; + *field |= cmd; } @@ -2826,7 +2835,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/iavf_rxtx.h b/drivers/net/iavf/iavf_rxtx.h index f432f9d956..25df517bc6 100644 --- a/drivers/net/iavf/iavf_rxtx.h +++ b/drivers/net/iavf/iavf_rxtx.h @@ -107,8 +107,16 @@ #define IAVF_MAX_DATA_PER_TXD \ (IAVF_TXD_QW1_TX_BUF_SZ_MASK >> IAVF_TXD_QW1_TX_BUF_SZ_SHIFT) +#define IAVF_TX_LLDP_DYNFIELD "intel_pmd_dynfield_tx_lldp" +#define IAVF_CHECK_TX_LLDP(m) \ + ((rte_pmd_iavf_tx_lldp_dynfield_offset > 0) && \ + (*RTE_MBUF_DYNFIELD((m), \ + rte_pmd_iavf_tx_lldp_dynfield_offset, \ + uint8_t *))) + extern uint64_t iavf_timestamp_dynflag; extern int iavf_timestamp_dynfield_offset; +extern int rte_pmd_iavf_tx_lldp_dynfield_offset; /** * Rx Flex Descriptors -- 2.34.1