DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jiawen Wu <jiawenwu@trustnetic.com>
To: dev@dpdk.org
Cc: Jiawen Wu <jiawenwu@trustnetic.com>
Subject: [dpdk-dev] [PATCH v2 3/5] net/txgbe: support VXLAN-GPE
Date: Thu, 29 Apr 2021 18:33:33 +0800	[thread overview]
Message-ID: <20210429103335.23060-4-jiawenwu@trustnetic.com> (raw)
In-Reply-To: <20210429103335.23060-1-jiawenwu@trustnetic.com>

Support VXLAN-GPE in udp tunnel port add and delete.
Fix to parsing packet type to pass hardware checksum.

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
---
 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




  parent reply	other threads:[~2021-04-29 10:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-29 10:33 [dpdk-dev] [PATCH v2 0/5] Fixes and supports for txgbe Jiawen Wu
2021-04-29 10:33 ` [dpdk-dev] [PATCH v2 1/5] net/txgbe: fix RSS in QINQ Jiawen Wu
2021-04-29 14:31   ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
2021-05-06  3:33     ` Jiawen Wu
2021-04-29 10:33 ` [dpdk-dev] [PATCH v2 2/5] net/txgbe: fix VF MTU limit setting Jiawen Wu
2021-04-29 14:59   ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
2021-05-06  1:43     ` Jiawen Wu
2021-04-29 10:33 ` Jiawen Wu [this message]
2021-04-29 10:33 ` [dpdk-dev] [PATCH v2 4/5] net/txgbe: remove port representor Jiawen Wu
2021-04-29 10:33 ` [dpdk-dev] [PATCH v2 5/5] net/txgbe: add copyright owner Jiawen Wu
2021-04-29 14:59   ` Ferruh Yigit
2021-04-29 15:02 ` [dpdk-dev] [PATCH v2 0/5] Fixes and supports for txgbe Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210429103335.23060-4-jiawenwu@trustnetic.com \
    --to=jiawenwu@trustnetic.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).