net/txgbe: support VXLAN-GPE

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>
This commit is contained in:
Jiawen Wu 2021-04-29 18:33:33 +08:00 committed by Ferruh Yigit
parent 89d2a1061d
commit b950203be7
4 changed files with 35 additions and 16 deletions

View File

@ -183,6 +183,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.**

View File

@ -4995,7 +4995,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) {
@ -5013,6 +5012,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;
@ -5046,7 +5053,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);
@ -5068,6 +5074,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;

View File

@ -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:

View File

@ -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)