Skip to content

Commit 290974d

Browse files
pjvuurendavem330
authored andcommitted
nfp: flower: ensure TCP flags can be placed in IPv6 frame
Previously we did not ensure tcp flags have a place to be stored when using IPv6. We correct this by including IPv6 key layer when we match tcp flags and the IPv6 key layer has not been included already. Fixes: 07e1671 ("nfp: flower: refactor shared ip header in match offload") Signed-off-by: Pieter Jansen van Vuuren <[email protected]> Reviewed-by: Jakub Kicinski <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6cbe721 commit 290974d

File tree

1 file changed

+22
-6
lines changed
  • drivers/net/ethernet/netronome/nfp/flower

1 file changed

+22
-6
lines changed

drivers/net/ethernet/netronome/nfp/flower/offload.c

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -345,13 +345,29 @@ nfp_flower_calculate_key_layers(struct nfp_app *app,
345345
!(tcp_flags & (TCPHDR_FIN | TCPHDR_SYN | TCPHDR_RST)))
346346
return -EOPNOTSUPP;
347347

348-
/* We need to store TCP flags in the IPv4 key space, thus
349-
* we need to ensure we include a IPv4 key layer if we have
350-
* not done so already.
348+
/* We need to store TCP flags in the either the IPv4 or IPv6 key
349+
* space, thus we need to ensure we include a IPv4/IPv6 key
350+
* layer if we have not done so already.
351351
*/
352-
if (!(key_layer & NFP_FLOWER_LAYER_IPV4)) {
353-
key_layer |= NFP_FLOWER_LAYER_IPV4;
354-
key_size += sizeof(struct nfp_flower_ipv4);
352+
if (!key_basic)
353+
return -EOPNOTSUPP;
354+
355+
if (!(key_layer & NFP_FLOWER_LAYER_IPV4) &&
356+
!(key_layer & NFP_FLOWER_LAYER_IPV6)) {
357+
switch (key_basic->n_proto) {
358+
case cpu_to_be16(ETH_P_IP):
359+
key_layer |= NFP_FLOWER_LAYER_IPV4;
360+
key_size += sizeof(struct nfp_flower_ipv4);
361+
break;
362+
363+
case cpu_to_be16(ETH_P_IPV6):
364+
key_layer |= NFP_FLOWER_LAYER_IPV6;
365+
key_size += sizeof(struct nfp_flower_ipv6);
366+
break;
367+
368+
default:
369+
return -EOPNOTSUPP;
370+
}
355371
}
356372
}
357373

0 commit comments

Comments
 (0)