d7cf3b
From ac4c40ab13bbd42145331766f74c3928bc9e6d51 Mon Sep 17 00:00:00 2001
d7cf3b
From: Edward Cree <ecree@solarflare.com>
d7cf3b
Date: Fri, 9 Mar 2018 15:03:46 +0000
d7cf3b
Subject: [PATCH 15/18] ethtool-copy.h: sync with net-next
d7cf3b
d7cf3b
This covers kernel changes up to commit 84a1d9c48200,
d7cf3b
    net: ethtool: extend RXNFC API to support RSS spreading of filter matches
d7cf3b
d7cf3b
Signed-off-by: Edward Cree <ecree@solarflare.com>
d7cf3b
Signed-off-by: John W. Linville <linville@tuxdriver.com>
d7cf3b
(cherry picked from commit 23b2e3b14405221b564c5dd6d7bf48c48e3db2c8)
d7cf3b
---
d7cf3b
 ethtool-copy.h | 32 ++++++++++++++++++++++++++------
d7cf3b
 1 file changed, 26 insertions(+), 6 deletions(-)
d7cf3b
d7cf3b
diff --git a/ethtool-copy.h b/ethtool-copy.h
d7cf3b
index f4e7bb2..8cc61e9 100644
d7cf3b
--- a/ethtool-copy.h
d7cf3b
+++ b/ethtool-copy.h
d7cf3b
@@ -912,12 +912,15 @@ static __inline__ __u64 ethtool_get_flow_spec_ring_vf(__u64 ring_cookie)
d7cf3b
  * @flow_type: Type of flow to be affected, e.g. %TCP_V4_FLOW
d7cf3b
  * @data: Command-dependent value
d7cf3b
  * @fs: Flow classification rule
d7cf3b
+ * @rss_context: RSS context to be affected
d7cf3b
  * @rule_cnt: Number of rules to be affected
d7cf3b
  * @rule_locs: Array of used rule locations
d7cf3b
  *
d7cf3b
  * For %ETHTOOL_GRXFH and %ETHTOOL_SRXFH, @data is a bitmask indicating
d7cf3b
  * the fields included in the flow hash, e.g. %RXH_IP_SRC.  The following
d7cf3b
- * structure fields must not be used.
d7cf3b
+ * structure fields must not be used, except that if @flow_type includes
d7cf3b
+ * the %FLOW_RSS flag, then @rss_context determines which RSS context to
d7cf3b
+ * act on.
d7cf3b
  *
d7cf3b
  * For %ETHTOOL_GRXRINGS, @data is set to the number of RX rings/queues
d7cf3b
  * on return.
d7cf3b
@@ -929,7 +932,9 @@ static __inline__ __u64 ethtool_get_flow_spec_ring_vf(__u64 ring_cookie)
d7cf3b
  * set in @data then special location values should not be used.
d7cf3b
  *
d7cf3b
  * For %ETHTOOL_GRXCLSRULE, @fs.@location specifies the location of an
d7cf3b
- * existing rule on entry and @fs contains the rule on return.
d7cf3b
+ * existing rule on entry and @fs contains the rule on return; if
d7cf3b
+ * @fs.@flow_type includes the %FLOW_RSS flag, then @rss_context is
d7cf3b
+ * filled with the RSS context ID associated with the rule.
d7cf3b
  *
d7cf3b
  * For %ETHTOOL_GRXCLSRLALL, @rule_cnt specifies the array size of the
d7cf3b
  * user buffer for @rule_locs on entry.  On return, @data is the size
d7cf3b
@@ -940,7 +945,11 @@ static __inline__ __u64 ethtool_get_flow_spec_ring_vf(__u64 ring_cookie)
d7cf3b
  * For %ETHTOOL_SRXCLSRLINS, @fs specifies the rule to add or update.
d7cf3b
  * @fs.@location either specifies the location to use or is a special
d7cf3b
  * location value with %RX_CLS_LOC_SPECIAL flag set.  On return,
d7cf3b
- * @fs.@location is the actual rule location.
d7cf3b
+ * @fs.@location is the actual rule location.  If @fs.@flow_type
d7cf3b
+ * includes the %FLOW_RSS flag, @rss_context is the RSS context ID to
d7cf3b
+ * use for flow spreading traffic which matches this rule.  The value
d7cf3b
+ * from the rxfh indirection table will be added to @fs.@ring_cookie
d7cf3b
+ * to choose which ring to deliver to.
d7cf3b
  *
d7cf3b
  * For %ETHTOOL_SRXCLSRLDEL, @fs.@location specifies the location of an
d7cf3b
  * existing rule on entry.
d7cf3b
@@ -961,7 +970,10 @@ struct ethtool_rxnfc {
d7cf3b
 	__u32				flow_type;
d7cf3b
 	__u64				data;
d7cf3b
 	struct ethtool_rx_flow_spec	fs;
d7cf3b
-	__u32				rule_cnt;
d7cf3b
+	union {
d7cf3b
+		__u32			rule_cnt;
d7cf3b
+		__u32			rss_context;
d7cf3b
+	};
d7cf3b
 	__u32				rule_locs[0];
d7cf3b
 };
d7cf3b
 
d7cf3b
@@ -988,7 +1000,11 @@ struct ethtool_rxfh_indir {
d7cf3b
 /**
d7cf3b
  * struct ethtool_rxfh - command to get/set RX flow hash indir or/and hash key.
d7cf3b
  * @cmd: Specific command number - %ETHTOOL_GRSSH or %ETHTOOL_SRSSH
d7cf3b
- * @rss_context: RSS context identifier.
d7cf3b
+ * @rss_context: RSS context identifier.  Context 0 is the default for normal
d7cf3b
+ *	traffic; other contexts can be referenced as the destination for RX flow
d7cf3b
+ *	classification rules.  %ETH_RXFH_CONTEXT_ALLOC is used with command
d7cf3b
+ *	%ETHTOOL_SRSSH to allocate a new RSS context; on return this field will
d7cf3b
+ *	contain the ID of the newly allocated context.
d7cf3b
  * @indir_size: On entry, the array size of the user buffer for the
d7cf3b
  *	indirection table, which may be zero, or (for %ETHTOOL_SRSSH),
d7cf3b
  *	%ETH_RXFH_INDIR_NO_CHANGE.  On return from %ETHTOOL_GRSSH,
d7cf3b
@@ -1007,7 +1023,8 @@ struct ethtool_rxfh_indir {
d7cf3b
  * size should be returned.  For %ETHTOOL_SRSSH, an @indir_size of
d7cf3b
  * %ETH_RXFH_INDIR_NO_CHANGE means that indir table setting is not requested
d7cf3b
  * and a @indir_size of zero means the indir table should be reset to default
d7cf3b
- * values. An hfunc of zero means that hash function setting is not requested.
d7cf3b
+ * values (if @rss_context == 0) or that the RSS context should be deleted.
d7cf3b
+ * An hfunc of zero means that hash function setting is not requested.
d7cf3b
  */
d7cf3b
 struct ethtool_rxfh {
d7cf3b
 	__u32   cmd;
d7cf3b
@@ -1019,6 +1036,7 @@ struct ethtool_rxfh {
d7cf3b
 	__u32	rsvd32;
d7cf3b
 	__u32   rss_config[0];
d7cf3b
 };
d7cf3b
+#define ETH_RXFH_CONTEXT_ALLOC		0xffffffff
d7cf3b
 #define ETH_RXFH_INDIR_NO_CHANGE	0xffffffff
d7cf3b
 
d7cf3b
 /**
d7cf3b
@@ -1633,6 +1651,8 @@ static __inline__ int ethtool_validate_duplex(__u8 duplex)
d7cf3b
 /* Flag to enable additional fields in struct ethtool_rx_flow_spec */
d7cf3b
 #define	FLOW_EXT	0x80000000
d7cf3b
 #define	FLOW_MAC_EXT	0x40000000
d7cf3b
+/* Flag to enable RSS spreading of traffic matching rule (nfc only) */
d7cf3b
+#define	FLOW_RSS	0x20000000
d7cf3b
 
d7cf3b
 /* L3-L4 network traffic flow hash options */
d7cf3b
 #define	RXH_L2DA	(1 << 1)
d7cf3b
-- 
d7cf3b
1.8.3.1
d7cf3b