Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sfc: support offloading ct(nat) action in RHS rules

If an IP address and/or L4 port for NAPT is available from a CT match,
the MAE will perform the edits; if no CT lookup has been performed for
this packet, the CT lookup did not return a match, or the matched CT
entry did not include NAPT, the action will have no effect.

Reviewed-by: Pieter Jansen van Vuuren <pieter.jansen-van-vuuren@amd.com>
Signed-off-by: Edward Cree <ecree.xilinx@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Edward Cree and committed by
David S. Miller
0c7fe3b3 38f9a08a

+12 -1
+2 -1
drivers/net/ethernet/sfc/mae.c
··· 1291 1291 size_t outlen; 1292 1292 int rc; 1293 1293 1294 - MCDI_POPULATE_DWORD_4(inbuf, MAE_ACTION_SET_ALLOC_IN_FLAGS, 1294 + MCDI_POPULATE_DWORD_5(inbuf, MAE_ACTION_SET_ALLOC_IN_FLAGS, 1295 1295 MAE_ACTION_SET_ALLOC_IN_VLAN_PUSH, act->vlan_push, 1296 1296 MAE_ACTION_SET_ALLOC_IN_VLAN_POP, act->vlan_pop, 1297 1297 MAE_ACTION_SET_ALLOC_IN_DECAP, act->decap, 1298 + MAE_ACTION_SET_ALLOC_IN_DO_NAT, act->do_nat, 1298 1299 MAE_ACTION_SET_ALLOC_IN_DO_DECR_IP_TTL, 1299 1300 act->do_ttl_dec); 1300 1301
+8
drivers/net/ethernet/sfc/tc.c
··· 2457 2457 NL_SET_ERR_MSG_MOD(extack, "Cannot offload tunnel decap action without tunnel device"); 2458 2458 rc = -EOPNOTSUPP; 2459 2459 goto release; 2460 + case FLOW_ACTION_CT: 2461 + if (fa->ct.action != TCA_CT_ACT_NAT) { 2462 + rc = -EOPNOTSUPP; 2463 + NL_SET_ERR_MSG_FMT_MOD(extack, "Can only offload CT 'nat' action in RHS rules, not %d", fa->ct.action); 2464 + goto release; 2465 + } 2466 + act->do_nat = 1; 2467 + break; 2460 2468 default: 2461 2469 NL_SET_ERR_MSG_FMT_MOD(extack, "Unhandled action %u", 2462 2470 fa->id);
+2
drivers/net/ethernet/sfc/tc.h
··· 48 48 * @vlan_push: the number of vlan headers to push 49 49 * @vlan_pop: the number of vlan headers to pop 50 50 * @decap: used to indicate a tunnel header decapsulation should take place 51 + * @do_nat: perform NAT/NPT with values returned by conntrack match 51 52 * @do_ttl_dec: used to indicate IP TTL / Hop Limit should be decremented 52 53 * @deliver: used to indicate a deliver action should take place 53 54 * @vlan_tci: tci fields for vlan push actions ··· 69 68 u16 vlan_push:2; 70 69 u16 vlan_pop:2; 71 70 u16 decap:1; 71 + u16 do_nat:1; 72 72 u16 do_ttl_dec:1; 73 73 u16 deliver:1; 74 74 __be16 vlan_tci[2];