This patch add more tunnel type defination 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>
---
drivers/net/ice/base/ice_protocol_type.h | 4 ++++
drivers/net/ice/base/ice_switch.c | 40 ++++++++++++++++++++++++++++++++
drivers/net/ice/base/ice_switch.h | 4 ++++
3 files changed, 48 insertions(+)
On 6/9/2020 12:59 PM, Qi Zhang wrote:
> This patch add more tunnel type defination ipv4/ipv6 packet,
's/defination/definition/'
> 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>
<...>
@@ -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,
@@ -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);
@@ -16,6 +16,10 @@
#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