Skip to content

Commit e8e0bd6

Browse files
pieterj-xilinxdavem330
authored andcommitted
sfc: extend pedit add action to handle decrement ipv6 hop limit
Extend the pedit add actions to handle this case for ipv6. Similar to ipv4 dec ttl, decrementing ipv6 hop limit can be achieved by adding 0xff to the hop limit field. Co-developed-by: Edward Cree <[email protected]> Signed-off-by: Edward Cree <[email protected]> Signed-off-by: Pieter Jansen van Vuuren <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 64848f0 commit e8e0bd6

File tree

1 file changed

+25
-0
lines changed
  • drivers/net/ethernet/sfc

1 file changed

+25
-0
lines changed

drivers/net/ethernet/sfc/tc.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,6 +1084,31 @@ static int efx_tc_pedit_add(struct efx_nic *efx, struct efx_tc_action_set *act,
10841084
break;
10851085
}
10861086
break;
1087+
case FLOW_ACT_MANGLE_HDR_TYPE_IP6:
1088+
switch (fa->mangle.offset) {
1089+
case round_down(offsetof(struct ipv6hdr, hop_limit), 4):
1090+
/* check that pedit applies to hoplimit only */
1091+
if (fa->mangle.mask != EFX_TC_HDR_TYPE_HLIMIT_MASK)
1092+
break;
1093+
1094+
/* Adding 0xff is equivalent to decrementing the hoplimit.
1095+
* Other added values are not supported.
1096+
*/
1097+
if ((fa->mangle.val >> 24) != U8_MAX)
1098+
break;
1099+
1100+
/* check that we do not decrement hoplimit twice */
1101+
if (!efx_tc_flower_action_order_ok(act,
1102+
EFX_TC_AO_DEC_TTL)) {
1103+
NL_SET_ERR_MSG_MOD(extack, "Unsupported: multiple dec ttl");
1104+
return -EOPNOTSUPP;
1105+
}
1106+
act->do_ttl_dec = 1;
1107+
return 0;
1108+
default:
1109+
break;
1110+
}
1111+
break;
10871112
default:
10881113
break;
10891114
}

0 commit comments

Comments
 (0)