net/ice/base: add more tunnel type for IPv4 and IPv6
authorQi Zhang <qi.z.zhang@intel.com>
Mon, 15 Jun 2020 02:05:10 +0000 (10:05 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 16 Jun 2020 17:21:08 +0000 (19:21 +0200)
This patch add more tunnel type definition ipv4/ipv6 packet,
it enable tcp/udp layer of ipv4/ipv6 as L4 payload but without
L4 dst/src port number as input set for switch filter rule.

For example:
we can download a switch rule to direct ipv4 packet with specific
source and destination ip address to queue index 1.
"eth / ipv4 src is 192.168.0.1 dst is 192.168.0.2 / udp /
end actions queue index 1 / end"
this type of rule will be matched with ipv4/udp file only.

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
drivers/net/ice/base/ice_protocol_type.h
drivers/net/ice/base/ice_switch.c
drivers/net/ice/base/ice_switch.h

index 85af751..7cc44c1 100644 (file)
@@ -66,6 +66,10 @@ enum ice_sw_tunnel_type {
        ICE_SW_TUN_UDP, /* This means all "UDP" tunnel types: VXLAN-GPE, VXLAN
                         * and GENEVE
                         */
+       ICE_SW_IPV4_TCP,
+       ICE_SW_IPV4_UDP,
+       ICE_SW_IPV6_TCP,
+       ICE_SW_IPV6_UDP,
        ICE_SW_TUN_GTP,
        ICE_SW_TUN_PPPOE,
        ICE_SW_TUN_PPPOE_PAY,
index 9c7e55f..1b1693d 100644 (file)
@@ -6357,6 +6357,18 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ice_adv_rule_info *rinfo,
        case ICE_SW_TUN_IPV4_AH:
                ice_set_bit(ICE_PROFID_IPV4_AH, bm);
                return;
+       case ICE_SW_IPV4_TCP:
+               ice_set_bit(ICE_PROFID_IPV4_TCP, bm);
+               return;
+       case ICE_SW_IPV4_UDP:
+               ice_set_bit(ICE_PROFID_IPV4_UDP, bm);
+               return;
+       case ICE_SW_IPV6_TCP:
+               ice_set_bit(ICE_PROFID_IPV6_TCP, bm);
+               return;
+       case ICE_SW_IPV6_UDP:
+               ice_set_bit(ICE_PROFID_IPV6_UDP, bm);
+               return;
        case ICE_SW_TUN_AND_NON_TUN:
        default:
                prof_type = ICE_PROF_ALL;
@@ -6771,6 +6783,34 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt,
                return;
        }
 
+       if (tun_type == ICE_SW_IPV4_TCP) {
+               *pkt = dummy_tcp_packet;
+               *pkt_len = sizeof(dummy_tcp_packet);
+               *offsets = dummy_tcp_packet_offsets;
+               return;
+       }
+
+       if (tun_type == ICE_SW_IPV4_UDP) {
+               *pkt = dummy_udp_packet;
+               *pkt_len = sizeof(dummy_udp_packet);
+               *offsets = dummy_udp_packet_offsets;
+               return;
+       }
+
+       if (tun_type == ICE_SW_IPV6_TCP) {
+               *pkt = dummy_tcp_ipv6_packet;
+               *pkt_len = sizeof(dummy_tcp_ipv6_packet);
+               *offsets = dummy_tcp_ipv6_packet_offsets;
+               return;
+       }
+
+       if (tun_type == ICE_SW_IPV6_UDP) {
+               *pkt = dummy_udp_ipv6_packet;
+               *pkt_len = sizeof(dummy_udp_ipv6_packet);
+               *offsets = dummy_udp_ipv6_packet_offsets;
+               return;
+       }
+
        if (tun_type == ICE_ALL_TUNNELS) {
                *pkt = dummy_gre_udp_packet;
                *pkt_len = sizeof(dummy_gre_udp_packet);
index bd634f9..1ba85b1 100644 (file)
 #define ICE_FLTR_TX_RX (ICE_FLTR_RX | ICE_FLTR_TX)
 
 /* Switch Profile IDs for Profile related switch rules */
+#define ICE_PROFID_IPV4_TCP            4
+#define ICE_PROFID_IPV4_UDP            5
+#define ICE_PROFID_IPV6_TCP            7
+#define ICE_PROFID_IPV6_UDP            8
 #define ICE_PROFID_PPPOE_PAY           34
 #define ICE_PROFID_PPPOE_IPV4_TCP      35
 #define ICE_PROFID_PPPOE_IPV4_UDP      36