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 3D24FA0547; Thu, 29 Apr 2021 12:33:52 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EECA241194; Thu, 29 Apr 2021 12:33:51 +0200 (CEST) Received: from smtpbgeu1.qq.com (smtpbgeu1.qq.com [52.59.177.22]) by mails.dpdk.org (Postfix) with ESMTP id B46D441125 for ; Thu, 29 Apr 2021 12:33:50 +0200 (CEST) X-QQ-mid: bizesmtp32t1619692426tsj81dem Received: from jiawenwu.trustnetic.com (unknown [183.129.236.74]) by esmtp6.qq.com (ESMTP) with id ; Thu, 29 Apr 2021 18:33:46 +0800 (CST) X-QQ-SSF: 01400000002000D0E000000A0000000 X-QQ-FEAT: XIEqvPtYnoGAeQNyFfwH/oKKUaH2Gy+5DDR0UPKWuQvA601P+3y9BtDbpcJ0W 9Q9WqXT7oqP34uaH3cUkQZ27KlhJmM0jEHxCuVt5tTJY5Rdw/hFT9qfpE2RnezjNNh+A0Y5 oZcGX0s+nlzwl6VafDgd8Hm4xDXGPdpoc4p6k7NgdqP41h/X157y2hxt34j9DsinuBNe/D8 KTh+MHaUfjgAudX5bfl/9n9QcTftKazSG8DoC5Y0yql/XetgdRDYXieZRI8mHNbaEhs2939 igR1IMBnjeDZb3Qyp6t0mlANrkHZmF5oDblofza+jGx+jHdp/+QSmIIXNSjtGi3nkPeEySa Fn1/dy2Ijb209DvA7mM6XGJc4803ef5JyqsySnG X-QQ-GoodBg: 2 From: Jiawen Wu To: dev@dpdk.org Cc: Jiawen Wu Date: Thu, 29 Apr 2021 18:33:33 +0800 Message-Id: <20210429103335.23060-4-jiawenwu@trustnetic.com> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20210429103335.23060-1-jiawenwu@trustnetic.com> References: <20210429103335.23060-1-jiawenwu@trustnetic.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:trustnetic.com:qybgforeign:qybgforeign7 X-QQ-Bgrelay: 1 Subject: [dpdk-dev] [PATCH v2 3/5] net/txgbe: support VXLAN-GPE 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 Sender: "dev" Support VXLAN-GPE in udp tunnel port add and delete. Fix to parsing packet type to pass hardware checksum. Signed-off-by: Jiawen Wu --- doc/guides/rel_notes/release_21_05.rst | 1 + drivers/net/txgbe/txgbe_ethdev.c | 20 ++++++++++++++++++-- drivers/net/txgbe/txgbe_ptypes.c | 24 ++++++++++++------------ drivers/net/txgbe/txgbe_rxtx.c | 6 ++++-- 4 files changed, 35 insertions(+), 16 deletions(-) diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst index b3224dc332..a090ff3560 100644 --- a/doc/guides/rel_notes/release_21_05.rst +++ b/doc/guides/rel_notes/release_21_05.rst @@ -179,6 +179,7 @@ New Features * Added support for txgbevf PMD. * Support device arguments to handle AN training for backplane NICs. + * Added support for VXLAN-GPE. * **Enabled vmxnet3 PMD on Windows.** diff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c index 3d6d356102..ddf8a18ac5 100644 --- a/drivers/net/txgbe/txgbe_ethdev.c +++ b/drivers/net/txgbe/txgbe_ethdev.c @@ -5020,7 +5020,6 @@ txgbe_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, break; } wr32(hw, TXGBE_VXLANPORT, udp_tunnel->udp_port); - wr32(hw, TXGBE_VXLANPORTGPE, udp_tunnel->udp_port); break; case RTE_TUNNEL_TYPE_GENEVE: if (udp_tunnel->udp_port == 0) { @@ -5038,6 +5037,14 @@ txgbe_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, } wr32(hw, TXGBE_TEREDOPORT, udp_tunnel->udp_port); break; + case RTE_TUNNEL_TYPE_VXLAN_GPE: + if (udp_tunnel->udp_port == 0) { + PMD_DRV_LOG(ERR, "Add VxLAN port 0 is not allowed."); + ret = -EINVAL; + break; + } + wr32(hw, TXGBE_VXLANPORTGPE, udp_tunnel->udp_port); + break; default: PMD_DRV_LOG(ERR, "Invalid tunnel type"); ret = -EINVAL; @@ -5071,7 +5078,6 @@ txgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, break; } wr32(hw, TXGBE_VXLANPORT, 0); - wr32(hw, TXGBE_VXLANPORTGPE, 0); break; case RTE_TUNNEL_TYPE_GENEVE: cur_port = (uint16_t)rd32(hw, TXGBE_GENEVEPORT); @@ -5093,6 +5099,16 @@ txgbe_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, } wr32(hw, TXGBE_TEREDOPORT, 0); break; + case RTE_TUNNEL_TYPE_VXLAN_GPE: + cur_port = (uint16_t)rd32(hw, TXGBE_VXLANPORTGPE); + if (cur_port != udp_tunnel->udp_port) { + PMD_DRV_LOG(ERR, "Port %u does not exist.", + udp_tunnel->udp_port); + ret = -EINVAL; + break; + } + wr32(hw, TXGBE_VXLANPORTGPE, 0); + break; default: PMD_DRV_LOG(ERR, "Invalid tunnel type"); ret = -EINVAL; diff --git a/drivers/net/txgbe/txgbe_ptypes.c b/drivers/net/txgbe/txgbe_ptypes.c index 7009f20821..957b03631a 100644 --- a/drivers/net/txgbe/txgbe_ptypes.c +++ b/drivers/net/txgbe/txgbe_ptypes.c @@ -102,17 +102,17 @@ static u32 txgbe_ptype_lookup[TXGBE_PTID_MAX] __rte_cache_aligned = { TPTE(0x8C, ETHER, IPV4, NONE, IP, NONE, IPV6, TCP), TPTE(0x8D, ETHER, IPV4, NONE, IP, NONE, IPV6, SCTP), /* IPv4 -> GRE/Teredo/VXLAN -> NONE/IPv4/IPv6 */ - TPTE(0x90, ETHER, IPV4, NONE, GRENAT, NONE, NONE, NONE), - TPTE(0x91, ETHER, IPV4, NONE, GRENAT, NONE, IPV4, FRAG), - TPTE(0x92, ETHER, IPV4, NONE, GRENAT, NONE, IPV4, NONFRAG), - TPTE(0x93, ETHER, IPV4, NONE, GRENAT, NONE, IPV4, UDP), - TPTE(0x94, ETHER, IPV4, NONE, GRENAT, NONE, IPV4, TCP), - TPTE(0x95, ETHER, IPV4, NONE, GRENAT, NONE, IPV4, SCTP), - TPTE(0x99, ETHER, IPV4, NONE, GRENAT, NONE, IPV6, FRAG), - TPTE(0x9A, ETHER, IPV4, NONE, GRENAT, NONE, IPV6, NONFRAG), - TPTE(0x9B, ETHER, IPV4, NONE, GRENAT, NONE, IPV6, UDP), - TPTE(0x9C, ETHER, IPV4, NONE, GRENAT, NONE, IPV6, TCP), - TPTE(0x9D, ETHER, IPV4, NONE, GRENAT, NONE, IPV6, SCTP), + TPTE(0x90, ETHER, IPV4, NONE, VXLAN_GPE, NONE, NONE, NONE), + TPTE(0x91, ETHER, IPV4, NONE, VXLAN_GPE, NONE, IPV4, FRAG), + TPTE(0x92, ETHER, IPV4, NONE, VXLAN_GPE, NONE, IPV4, NONFRAG), + TPTE(0x93, ETHER, IPV4, NONE, VXLAN_GPE, NONE, IPV4, UDP), + TPTE(0x94, ETHER, IPV4, NONE, VXLAN_GPE, NONE, IPV4, TCP), + TPTE(0x95, ETHER, IPV4, NONE, VXLAN_GPE, NONE, IPV4, SCTP), + TPTE(0x99, ETHER, IPV4, NONE, VXLAN_GPE, NONE, IPV6, FRAG), + TPTE(0x9A, ETHER, IPV4, NONE, VXLAN_GPE, NONE, IPV6, NONFRAG), + TPTE(0x9B, ETHER, IPV4, NONE, VXLAN_GPE, NONE, IPV6, UDP), + TPTE(0x9C, ETHER, IPV4, NONE, VXLAN_GPE, NONE, IPV6, TCP), + TPTE(0x9D, ETHER, IPV4, NONE, VXLAN_GPE, NONE, IPV6, SCTP), /* IPv4 -> GRE/Teredo/VXLAN -> MAC -> NONE/IPv4/IPv6 */ TPTE(0xA0, ETHER, IPV4, NONE, GRENAT, ETHER, NONE, NONE), TPTE(0xA1, ETHER, IPV4, NONE, GRENAT, ETHER, IPV4, FRAG), @@ -320,10 +320,10 @@ txgbe_encode_ptype_tunnel(u32 ptype) ptid |= TXGBE_PTID_TUN_EI; break; case RTE_PTYPE_TUNNEL_GRE: + case RTE_PTYPE_TUNNEL_VXLAN_GPE: ptid |= TXGBE_PTID_TUN_EIG; break; case RTE_PTYPE_TUNNEL_VXLAN: - case RTE_PTYPE_TUNNEL_VXLAN_GPE: case RTE_PTYPE_TUNNEL_NVGRE: case RTE_PTYPE_TUNNEL_GENEVE: case RTE_PTYPE_TUNNEL_GRENAT: diff --git a/drivers/net/txgbe/txgbe_rxtx.c b/drivers/net/txgbe/txgbe_rxtx.c index a70bf0b9c6..8dd1a6ce4a 100644 --- a/drivers/net/txgbe/txgbe_rxtx.c +++ b/drivers/net/txgbe/txgbe_rxtx.c @@ -58,6 +58,7 @@ static const u64 TXGBE_TX_OFFLOAD_MASK = (PKT_TX_IP_CKSUM | PKT_TX_TCP_SEG | PKT_TX_TUNNEL_MASK | PKT_TX_OUTER_IP_CKSUM | + PKT_TX_OUTER_UDP_CKSUM | #ifdef RTE_LIB_SECURITY PKT_TX_SEC_OFFLOAD | #endif @@ -389,6 +390,7 @@ txgbe_set_xmit_ctx(struct txgbe_tx_queue *txq, /* for non UDP / GRE tunneling, set to 0b */ break; case PKT_TX_TUNNEL_VXLAN: + case PKT_TX_TUNNEL_VXLAN_GPE: case PKT_TX_TUNNEL_GENEVE: tunnel_seed |= TXGBE_TXD_ETYPE_UDP; break; @@ -580,7 +582,6 @@ tx_desc_ol_flags_to_ptid(uint64_t oflags, uint32_t ptype) ptype |= RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4 | RTE_PTYPE_TUNNEL_VXLAN_GPE; - ptype |= RTE_PTYPE_INNER_L2_ETHER; break; case PKT_TX_TUNNEL_IPIP: case PKT_TX_TUNNEL_IP: @@ -2220,7 +2221,8 @@ txgbe_get_tx_port_offloads(struct rte_eth_dev *dev) tx_offload_capa |= DEV_TX_OFFLOAD_MACSEC_INSERT; - tx_offload_capa |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; + tx_offload_capa |= DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM | + DEV_TX_OFFLOAD_OUTER_UDP_CKSUM; #ifdef RTE_LIB_SECURITY if (dev->security_ctx) -- 2.21.0.windows.1