net/iavf: support GTPU inner IPv6 for flow director
authorJunfeng Guo <junfeng.guo@intel.com>
Fri, 26 Mar 2021 10:42:16 +0000 (10:42 +0000)
committerQi Zhang <qi.z.zhang@intel.com>
Mon, 29 Mar 2021 23:21:17 +0000 (01:21 +0200)
Support GTPU_(EH)_IPV6 inner L3 and L4 fields matching for AVF FDIR.

+------------------------------+---------------------------------+
|           Pattern            |            Input Set            |
+------------------------------+---------------------------------+
| eth/ipv4/gtpu/ipv6           | inner: src/dst ip               |
| eth/ipv4/gtpu/ipv6/udp       | inner: src/dst ip, src/dst port |
| eth/ipv4/gtpu/ipv6/tcp       | inner: src/dst ip, src/dst port |
| eth/ipv4/gtpu/eh/ipv6        | inner: src/dst ip               |
| eth/ipv4/gtpu/eh/ipv6/udp    | inner: src/dst ip, src/dst port |
| eth/ipv4/gtpu/eh/ipv6/tcp    | inner: src/dst ip, src/dst port |
| eth/ipv4/gtpu/eh(0)/ipv6     | inner: src/dst ip               |
| eth/ipv4/gtpu/eh(0)/ipv6/udp | inner: src/dst ip, src/dst port |
| eth/ipv4/gtpu/eh(0)/ipv6/tcp | inner: src/dst ip, src/dst port |
| eth/ipv4/gtpu/eh(1)/ipv6     | inner: src/dst ip               |
| eth/ipv4/gtpu/eh(1)/ipv6/udp | inner: src/dst ip, src/dst port |
| eth/ipv4/gtpu/eh(1)/ipv6/tcp | inner: src/dst ip, src/dst port |
+------------------------------+---------------------------------+

Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
drivers/net/iavf/iavf_fdir.c
drivers/net/iavf/iavf_generic_flow.h

index eb27768..62f0329 100644 (file)
        IAVF_INSET_IPV6_SRC | IAVF_INSET_IPV6_DST | \
        IAVF_INSET_GTPU_TEID)
 
+#define IAVF_FDIR_INSET_GTPU_IPV6 (\
+       IAVF_INSET_TUN_IPV6_SRC | IAVF_INSET_TUN_IPV6_DST | \
+       IAVF_INSET_TUN_IPV6_NEXT_HDR | IAVF_INSET_TUN_IPV6_TC | \
+       IAVF_INSET_TUN_IPV6_HOP_LIMIT)
+
+#define IAVF_FDIR_INSET_GTPU_IPV6_UDP (\
+       IAVF_FDIR_INSET_GTPU_IPV6 | \
+       IAVF_INSET_TUN_UDP_SRC_PORT | IAVF_INSET_TUN_UDP_DST_PORT)
+
+#define IAVF_FDIR_INSET_GTPU_IPV6_TCP (\
+       IAVF_FDIR_INSET_GTPU_IPV6 | \
+       IAVF_INSET_TUN_TCP_SRC_PORT | IAVF_INSET_TUN_TCP_DST_PORT)
+
 #define IAVF_FDIR_INSET_IPV6_GTPU_EH (\
        IAVF_INSET_IPV6_SRC | IAVF_INSET_IPV6_DST | \
        IAVF_INSET_GTPU_TEID | IAVF_INSET_GTPU_QFI)
@@ -137,10 +150,16 @@ static struct iavf_pattern_match_item iavf_fdir_pattern[] = {
        {iavf_pattern_eth_ipv4_gtpu_ipv4,        IAVF_FDIR_INSET_GTPU_IPV4,     IAVF_INSET_NONE},
        {iavf_pattern_eth_ipv4_gtpu_ipv4_udp,    IAVF_FDIR_INSET_GTPU_IPV4_UDP, IAVF_INSET_NONE},
        {iavf_pattern_eth_ipv4_gtpu_ipv4_tcp,    IAVF_FDIR_INSET_GTPU_IPV4_TCP, IAVF_INSET_NONE},
+       {iavf_pattern_eth_ipv4_gtpu_ipv6,        IAVF_FDIR_INSET_GTPU_IPV6,     IAVF_INSET_NONE},
+       {iavf_pattern_eth_ipv4_gtpu_ipv6_udp,    IAVF_FDIR_INSET_GTPU_IPV6_UDP, IAVF_INSET_NONE},
+       {iavf_pattern_eth_ipv4_gtpu_ipv6_tcp,    IAVF_FDIR_INSET_GTPU_IPV6_TCP, IAVF_INSET_NONE},
        {iavf_pattern_eth_ipv4_gtpu_eh,          IAVF_FDIR_INSET_IPV4_GTPU_EH,  IAVF_INSET_NONE},
        {iavf_pattern_eth_ipv4_gtpu_eh_ipv4,     IAVF_FDIR_INSET_GTPU_IPV4,     IAVF_INSET_NONE},
        {iavf_pattern_eth_ipv4_gtpu_eh_ipv4_udp, IAVF_FDIR_INSET_GTPU_IPV4_UDP, IAVF_INSET_NONE},
        {iavf_pattern_eth_ipv4_gtpu_eh_ipv4_tcp, IAVF_FDIR_INSET_GTPU_IPV4_TCP, IAVF_INSET_NONE},
+       {iavf_pattern_eth_ipv4_gtpu_eh_ipv6,     IAVF_FDIR_INSET_GTPU_IPV6,     IAVF_INSET_NONE},
+       {iavf_pattern_eth_ipv4_gtpu_eh_ipv6_udp, IAVF_FDIR_INSET_GTPU_IPV6_UDP, IAVF_INSET_NONE},
+       {iavf_pattern_eth_ipv4_gtpu_eh_ipv6_tcp, IAVF_FDIR_INSET_GTPU_IPV6_TCP, IAVF_INSET_NONE},
        {iavf_pattern_eth_ipv6_gtpu,             IAVF_FDIR_INSET_IPV6_GTPU,     IAVF_INSET_NONE},
        {iavf_pattern_eth_ipv6_gtpu_eh,          IAVF_FDIR_INSET_IPV6_GTPU_EH,  IAVF_INSET_NONE},
        {iavf_pattern_eth_ipv4_l2tpv3,           IAVF_FDIR_INSET_L2TPV3OIP,     IAVF_INSET_NONE},
@@ -727,6 +746,11 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad,
                                        VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT(hdr, IPV6, DST);
                                }
 
+                               if (tun_inner) {
+                                       input_set &= ~IAVF_PROT_IPV6_OUTER;
+                                       input_set |= IAVF_PROT_IPV6_INNER;
+                               }
+
                                rte_memcpy(hdr->buffer,
                                        &ipv6_spec->hdr,
                                        sizeof(ipv6_spec->hdr));
index f7bdd09..005eeb3 100644 (file)
        (IAVF_PROT_IPV4_INNER | IAVF_IP_PROTO)
 #define IAVF_INSET_TUN_IPV4_TTL \
        (IAVF_PROT_IPV4_INNER | IAVF_IP_TTL)
+#define IAVF_INSET_TUN_IPV6_SRC \
+       (IAVF_PROT_IPV6_INNER | IAVF_IP_SRC)
+#define IAVF_INSET_TUN_IPV6_DST \
+       (IAVF_PROT_IPV6_INNER | IAVF_IP_DST)
+#define IAVF_INSET_TUN_IPV6_NEXT_HDR \
+       (IAVF_PROT_IPV6_INNER | IAVF_IP_PROTO)
+#define IAVF_INSET_TUN_IPV6_HOP_LIMIT \
+       (IAVF_PROT_IPV6_INNER | IAVF_IP_TTL)
+#define IAVF_INSET_TUN_IPV6_TC \
+       (IAVF_PROT_IPV6_INNER | IAVF_IP_TOS)
 
 #define IAVF_INSET_TCP_SRC_PORT \
        (IAVF_PROT_TCP_OUTER | IAVF_SPORT)