Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 May 2018 20:39:04 +0000 (UTC)
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r333472 - head/sys/dev/cxgbe
Message-ID:  <201805102039.w4AKd4x7010899@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: np
Date: Thu May 10 20:39:04 2018
New Revision: 333472
URL: https://svnweb.freebsd.org/changeset/base/333472

Log:
  cxgbe(4): Add fields to support configuration of hardware NAT and
  swapmac (SMAC/DMAC switcheroo) from userspace.
  
  Sponsored by:	Chelsio Communications

Modified:
  head/sys/dev/cxgbe/t4_ioctl.h

Modified: head/sys/dev/cxgbe/t4_ioctl.h
==============================================================================
--- head/sys/dev/cxgbe/t4_ioctl.h	Thu May 10 20:27:12 2018	(r333471)
+++ head/sys/dev/cxgbe/t4_ioctl.h	Thu May 10 20:39:04 2018	(r333472)
@@ -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,10 +221,19 @@ 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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201805102039.w4AKd4x7010899>