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 440EF43782; Mon, 25 Dec 2023 04:05:43 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 31D06402D1; Mon, 25 Dec 2023 04:05:43 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 171BA40297 for ; Mon, 25 Dec 2023 04:05:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1703473542; x=1735009542; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gU5bPg6RnSJQ7q4X4MEmvDVs5oTX4hud8T67VFYcUlU=; b=PUzBqeLaHSu5oTAapwMhjYWoekwc0qr09U4/0xa2fambRArJc1Cgh8Zq canQxSTjkVkQVgFP1kVLQNqCSkF2UcHcradKCNte7fBOcorT0/Vb8tWQv wVHhAR3eaFtlFGcIk8DhSUKg0rnkR7kKSm3thyhHL2r0q9ZLtrCBhIBD5 DTLZtqFx0nTg6ts/i60+i7ZupirEXtu7KVDVe1Y0uGTz/ZFWPZ0UmV2zH HOXLcV5/TyqYstEphcGB0gaNdPKaiwjFbbZfVbdh8NyTI3dVc2kCo26wP nkFVMkx+aVu6Z1ndRDKbw+qgqjRyHU41i+E9+ja4MSU7HpeYdE3luqti4 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10934"; a="482438904" X-IronPort-AV: E=Sophos;i="6.04,302,1695711600"; d="scan'208";a="482438904" 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:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10934"; a="950887762" X-IronPort-AV: E=Sophos;i="6.04,302,1695711600"; d="scan'208";a="950887762" 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:38 -0800 From: Zhichao Zeng To: dev@dpdk.org Cc: qi.z.zhang@intel.com, Zhichao Zeng , Jingjing Wu , Beilei Xing Subject: [PATCH v4 1/3] net/iavf: support Tx LLDP on scalar Date: Mon, 25 Dec 2023 11:14:49 +0800 Message-Id: <20231225031451.4002181-2-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 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 | 19 +++++++++++++++++-- drivers/net/iavf/iavf_rxtx.h | 3 +++ drivers/net/iavf/rte_pmd_iavf.h | 3 +++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index f19aa14646..736db21ea4 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -85,6 +85,9 @@ 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; +/* Offset of mbuf dynamic field for transmitting LLDP packet */ +int rte_pmd_iavf_tx_lldp_dynfield_offset = -1; + uint8_t iavf_proto_xtr_type_to_rxdid(uint8_t flex_type) { @@ -2418,8 +2421,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 +2431,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 (rte_pmd_iavf_tx_lldp_dynfield_offset == + rte_mbuf_dynfield_lookup(IAVF_TX_LLDP_DYNFIELD, NULL)) + if (*RTE_MBUF_DYNFIELD(mb, + rte_pmd_iavf_tx_lldp_dynfield_offset, uint8_t *) > 0) + return 1; return 0; } @@ -2446,6 +2456,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, + rte_pmd_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 +2841,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..960618205c 100644 --- a/drivers/net/iavf/iavf_rxtx.h +++ b/drivers/net/iavf/iavf_rxtx.h @@ -107,8 +107,11 @@ #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" + extern uint64_t iavf_timestamp_dynflag; extern int iavf_timestamp_dynfield_offset; +extern int rte_pmd_iavf_tx_lldp_dynfield_offset; /** * Rx Flex Descriptors diff --git a/drivers/net/iavf/rte_pmd_iavf.h b/drivers/net/iavf/rte_pmd_iavf.h index 56d453fc4c..07d961eaff 100644 --- a/drivers/net/iavf/rte_pmd_iavf.h +++ b/drivers/net/iavf/rte_pmd_iavf.h @@ -95,6 +95,9 @@ 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; +/* Offset of mbuf dynamic field for transmitting LLDP packet */ +extern int rte_pmd_iavf_tx_lldp_dynfield_offset; + /** * The mbuf dynamic field pointer for flexible descriptor's extraction metadata. */ -- 2.34.1