cxgbe(4): Add fields to support configuration of hardware NAT and

swapmac (SMAC/DMAC switcheroo) from userspace.

Sponsored by:	Chelsio Communications
This commit is contained in:
Navdeep Parhar 2018-05-10 20:39:04 +00:00
parent 09001b5c78
commit f348cdad1a

View File

@ -160,12 +160,23 @@ enum {
RSS subtable */
};
enum {
NAT_MODE_NONE = 0, /* No NAT performed */
NAT_MODE_DIP, /* NAT on Dst IP */
NAT_MODE_DIP_DP, /* NAT on Dst IP, Dst Port */
NAT_MODE_DIP_DP_SIP, /* NAT on Dst IP, Dst Port and Src IP */
NAT_MODE_DIP_DP_SP, /* NAT on Dst IP, Dst Port and Src Port */
NAT_MODE_SIP_SP, /* NAT on Src IP and Src Port */
NAT_MODE_DIP_SIP_SP, /* NAT on Dst IP, Src IP and Src Port */
NAT_MODE_ALL /* NAT on entire 4-tuple */
};
struct t4_filter_tuple {
/*
* These are always available.
*/
uint8_t sip[16]; /* source IP address (IPv4 in [3:0]) */
uint8_t dip[16]; /* destinatin IP address (IPv4 in [3:0]) */
uint8_t dip[16]; /* destination IP address (IPv4 in [3:0]) */
uint16_t sport; /* source port */
uint16_t dport; /* destination port */
@ -210,11 +221,20 @@ struct t4_filter_specification {
uint32_t eport:2; /* egress port to switch packet out */
uint32_t newdmac:1; /* rewrite destination MAC address */
uint32_t newsmac:1; /* rewrite source MAC address */
uint32_t swapmac:1; /* swap SMAC/DMAC for loopback packet */
uint32_t newvlan:2; /* rewrite VLAN Tag */
uint32_t nat_mode:3; /* NAT operation mode */
uint32_t nat_flag_chk:1;/* check TCP flags before NAT'ing */
uint32_t nat_seq_chk; /* sequence value to use for NAT check*/
uint8_t dmac[ETHER_ADDR_LEN]; /* new destination MAC address */
uint8_t smac[ETHER_ADDR_LEN]; /* new source MAC address */
uint16_t vlan; /* VLAN Tag to insert */
uint8_t nat_dip[16]; /* destination IP to use after NAT'ing */
uint8_t nat_sip[16]; /* source IP to use after NAT'ing */
uint16_t nat_dport; /* destination port to use after NAT'ing */
uint16_t nat_sport; /* source port to use after NAT'ing */
/*
* Filter rule value/mask pairs.
*/