Skip to content

Commit 0e32ff0

Browse files
Michal Swiatkowskianguy11
authored andcommitted
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: 9e30098 ("ice: VXLAN and Geneve TC support") Signed-off-by: Michal Swiatkowski <[email protected]> Tested-by: Sandeep Penigalapati <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 28dc1b8 commit 0e32ff0

File tree

1 file changed

+10
-17
lines changed

1 file changed

+10
-17
lines changed

drivers/net/ethernet/intel/ice/ice_tc_lib.c

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -74,21 +74,13 @@ static enum ice_protocol_type ice_proto_type_from_ipv6(bool inner)
7474
return inner ? ICE_IPV6_IL : ICE_IPV6_OFOS;
7575
}
7676

77-
static enum ice_protocol_type
78-
ice_proto_type_from_l4_port(bool inner, u16 ip_proto)
77+
static enum ice_protocol_type ice_proto_type_from_l4_port(u16 ip_proto)
7978
{
80-
if (inner) {
81-
switch (ip_proto) {
82-
case IPPROTO_UDP:
83-
return ICE_UDP_ILOS;
84-
}
85-
} else {
86-
switch (ip_proto) {
87-
case IPPROTO_TCP:
88-
return ICE_TCP_IL;
89-
case IPPROTO_UDP:
90-
return ICE_UDP_OF;
91-
}
79+
switch (ip_proto) {
80+
case IPPROTO_TCP:
81+
return ICE_TCP_IL;
82+
case IPPROTO_UDP:
83+
return ICE_UDP_ILOS;
9284
}
9385

9486
return 0;
@@ -191,8 +183,9 @@ ice_tc_fill_tunnel_outer(u32 flags, struct ice_tc_flower_fltr *fltr,
191183
i++;
192184
}
193185

194-
if (flags & ICE_TC_FLWR_FIELD_ENC_DEST_L4_PORT) {
195-
list[i].type = ice_proto_type_from_l4_port(false, hdr->l3_key.ip_proto);
186+
if ((flags & ICE_TC_FLWR_FIELD_ENC_DEST_L4_PORT) &&
187+
hdr->l3_key.ip_proto == IPPROTO_UDP) {
188+
list[i].type = ICE_UDP_OF;
196189
list[i].h_u.l4_hdr.dst_port = hdr->l4_key.dst_port;
197190
list[i].m_u.l4_hdr.dst_port = hdr->l4_mask.dst_port;
198191
i++;
@@ -317,7 +310,7 @@ ice_tc_fill_rules(struct ice_hw *hw, u32 flags,
317310
ICE_TC_FLWR_FIELD_SRC_L4_PORT)) {
318311
struct ice_tc_l4_hdr *l4_key, *l4_mask;
319312

320-
list[i].type = ice_proto_type_from_l4_port(inner, headers->l3_key.ip_proto);
313+
list[i].type = ice_proto_type_from_l4_port(headers->l3_key.ip_proto);
321314
l4_key = &headers->l4_key;
322315
l4_mask = &headers->l4_mask;
323316

0 commit comments

Comments
 (0)