Commit 0e32ff02 authored by Michal Swiatkowski's avatar Michal Swiatkowski Committed by Tony Nguyen

ice: fix choosing UDP header type

In tunnels packet there can be two UDP headers:
- outer which for hw should be mark as ICE_UDP_OF
- inner which for hw should be mark as ICE_UDP_ILOS or as ICE_TCP_IL if
  inner header is of TCP type

In none tunnels packet header can be:
- UDP, which for hw should be mark as ICE_UDP_ILOS
- TCP, which for hw should be mark as ICE_TCP_IL

Change incorrect ICE_UDP_OF for none tunnel packets to ICE_UDP_ILOS.
ICE_UDP_OF is incorrect for none tunnel packets and setting it leads to
error from hw while adding this kind of recipe.

In summary, for tunnel outer port type should always be set to
ICE_UDP_OF, for none tunnel outer and tunnel inner it should always be
set to ICE_UDP_ILOS.

Fixes: 9e300987 ("ice: VXLAN and Geneve TC support")
Signed-off-by: default avatarMichal Swiatkowski <michal.swiatkowski@linux.intel.com>
Tested-by: default avatarSandeep Penigalapati <sandeep.penigalapati@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
parent 28dc1b86
...@@ -74,21 +74,13 @@ static enum ice_protocol_type ice_proto_type_from_ipv6(bool inner) ...@@ -74,21 +74,13 @@ static enum ice_protocol_type ice_proto_type_from_ipv6(bool inner)
return inner ? ICE_IPV6_IL : ICE_IPV6_OFOS; return inner ? ICE_IPV6_IL : ICE_IPV6_OFOS;
} }
static enum ice_protocol_type static enum ice_protocol_type ice_proto_type_from_l4_port(u16 ip_proto)
ice_proto_type_from_l4_port(bool inner, u16 ip_proto)
{ {
if (inner) { switch (ip_proto) {
switch (ip_proto) { case IPPROTO_TCP:
case IPPROTO_UDP: return ICE_TCP_IL;
return ICE_UDP_ILOS; case IPPROTO_UDP:
} return ICE_UDP_ILOS;
} else {
switch (ip_proto) {
case IPPROTO_TCP:
return ICE_TCP_IL;
case IPPROTO_UDP:
return ICE_UDP_OF;
}
} }
return 0; return 0;
...@@ -191,8 +183,9 @@ ice_tc_fill_tunnel_outer(u32 flags, struct ice_tc_flower_fltr *fltr, ...@@ -191,8 +183,9 @@ ice_tc_fill_tunnel_outer(u32 flags, struct ice_tc_flower_fltr *fltr,
i++; i++;
} }
if (flags & ICE_TC_FLWR_FIELD_ENC_DEST_L4_PORT) { if ((flags & ICE_TC_FLWR_FIELD_ENC_DEST_L4_PORT) &&
list[i].type = ice_proto_type_from_l4_port(false, hdr->l3_key.ip_proto); hdr->l3_key.ip_proto == IPPROTO_UDP) {
list[i].type = ICE_UDP_OF;
list[i].h_u.l4_hdr.dst_port = hdr->l4_key.dst_port; list[i].h_u.l4_hdr.dst_port = hdr->l4_key.dst_port;
list[i].m_u.l4_hdr.dst_port = hdr->l4_mask.dst_port; list[i].m_u.l4_hdr.dst_port = hdr->l4_mask.dst_port;
i++; i++;
...@@ -317,7 +310,7 @@ ice_tc_fill_rules(struct ice_hw *hw, u32 flags, ...@@ -317,7 +310,7 @@ ice_tc_fill_rules(struct ice_hw *hw, u32 flags,
ICE_TC_FLWR_FIELD_SRC_L4_PORT)) { ICE_TC_FLWR_FIELD_SRC_L4_PORT)) {
struct ice_tc_l4_hdr *l4_key, *l4_mask; struct ice_tc_l4_hdr *l4_key, *l4_mask;
list[i].type = ice_proto_type_from_l4_port(inner, headers->l3_key.ip_proto); list[i].type = ice_proto_type_from_l4_port(headers->l3_key.ip_proto);
l4_key = &headers->l4_key; l4_key = &headers->l4_key;
l4_mask = &headers->l4_mask; l4_mask = &headers->l4_mask;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment