diff options
author | Somnath Kotur <somnath.kotur@broadcom.com> | 2019-10-31 08:07:47 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-11-01 00:48:11 +0300 |
commit | 9b9eb518e3383d94c8b81ff403d524f2cee5b6b9 (patch) | |
tree | a8268509c42ca0976f21c00eda74aa66b4a3eb49 /drivers/net/ethernet/broadcom/bnxt/bnxt_tc.h | |
parent | 08f8280e8788202a67a359952cd436707f8789bd (diff) | |
download | linux-9b9eb518e3383d94c8b81ff403d524f2cee5b6b9.tar.xz |
bnxt_en: Add support for NAT(L3/L4 rewrite)
Provides support for modifying L3/L4 Header parameters to support NAT.
Sets the appropriate fields/bits in cfa_flow_alloc cmd.
Sample cmd for offloading an IPv4 flow with SNAT:
ovs-ofctl add-flow ovsbr0 "ip,nw_src=192.168.201.44 \
actions=mod_nw_src:203.31.220.144,output:p7p1"
Replace 'nw_src' with 'nw_dst' in above cmd for DNAT with IPv4
Sample cmd for offloading an IPv4 flow with SNAPT:
ovs-ofctl add-flow ovsbr0 "ip,nw_src=192.168.201.44 \
actions=mod_nw_src:203.31.220.144, mod_tp_src:6789,output:p7p1"
Similar to DNAT, replace 'tp_src' with 'tp_dst' for offloading flow
with DNAPT
Sample cmd for offloading an IPv6 flow with SNAT:
ovs-ofctl add-flow ovsbr0 "ipv6, ipv6_src=2001:5c0:9168::2/64 \
actions=load:0x1->NXM_NX_IPV6_SRC[0..63], \
load:0x20010db801920000->NXM_NX_IPV6_SRC[64..127],output:p7p1"
Replace 'SRC' with DST' above for IPv6 DNAT
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom/bnxt/bnxt_tc.h')
-rw-r--r-- | drivers/net/ethernet/broadcom/bnxt/bnxt_tc.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.h index 6d0d4857992b..286754903543 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.h @@ -78,6 +78,7 @@ struct bnxt_tc_actions { #define BNXT_TC_ACTION_FLAG_TUNNEL_ENCAP BIT(6) #define BNXT_TC_ACTION_FLAG_TUNNEL_DECAP BIT(7) #define BNXT_TC_ACTION_FLAG_L2_REWRITE BIT(8) +#define BNXT_TC_ACTION_FLAG_NAT_XLATE BIT(9) u16 dst_fid; struct net_device *dst_dev; @@ -89,7 +90,15 @@ struct bnxt_tc_actions { #define PEDIT_OFFSET_SMAC_LAST_4_BYTES 0x8 __be16 l2_rewrite_dmac[3]; __be16 l2_rewrite_smac[3]; - + struct { + bool src_xlate; /* true => translate src, + * false => translate dst + * Mutually exclusive, i.e cannot set both + */ + bool l3_is_ipv4; /* false means L3 is ipv6 */ + struct bnxt_tc_l3_key l3; + struct bnxt_tc_l4_key l4; + } nat; }; struct bnxt_tc_flow { |