History

net: ethtool: extend RXNFC API to support RSS spreading of filter matches

We use a two-step process to configure a filter with RSS spreading. First, the RSS context is allocated and configured using ETHTOOL_SRSSH; this returns an identifier (rss_context) which can then be passed to subsequent invocations of ETHTOOL_SRXCLSRLINS to specify that the offset from the RSS indirection table lookup should be added to the queue number (ring_cookie) when delivering the packet. Drivers for devices which can only use the indirection table entry directly (not add it to a base queue number) should reject rule insertions combining RSS with a nonzero ring_cookie.

Edward Cree committed 8 years ago

Commit 84a1d9c1 parent 571e6773 files · +80 −21Browse files

Showing the changes to include/uapi/linux (1 of 3 files). Show all

Unified · Split

include/uapi/linux/ethtool.h+26−6
@@ -914,12 +914,15 @@ static inline __u64 ethtool_get_flow_spec_ring_vf(__u64 ring_cookie) · 913 unmodified lines
914914 * @flow_type: Type of flow to be affected, e.g. %TCP_V4_FLOW
915915 * @data: Command-dependent value
916916 * @fs: Flow classification rule
917+ * @rss_context: RSS context to be affected
917918 * @rule_cnt: Number of rules to be affected
918919 * @rule_locs: Array of used rule locations
919920 *
920921 * For %ETHTOOL_GRXFH and %ETHTOOL_SRXFH, @data is a bitmask indicating
921922 * the fields included in the flow hash, e.g. %RXH_IP_SRC. The following
922− * structure fields must not be used.
923+ * structure fields must not be used, except that if @flow_type includes
924+ * the %FLOW_RSS flag, then @rss_context determines which RSS context to
925+ * act on.
923926 *
924927 * For %ETHTOOL_GRXRINGS, @data is set to the number of RX rings/queues
925928 * on return.
@@ -931,7 +934,9 @@ static inline __u64 ethtool_get_flow_spec_ring_vf(__u64 ring_cookie) · 5 unmodified lines
931934 * set in @data then special location values should not be used.
932935 *
933936 * For %ETHTOOL_GRXCLSRULE, @fs.@location specifies the location of an
934− * existing rule on entry and @fs contains the rule on return.
937+ * existing rule on entry and @fs contains the rule on return; if
938+ * @fs.@flow_type includes the %FLOW_RSS flag, then @rss_context is
939+ * filled with the RSS context ID associated with the rule.
935940 *
936941 * For %ETHTOOL_GRXCLSRLALL, @rule_cnt specifies the array size of the
937942 * user buffer for @rule_locs on entry. On return, @data is the size
@@ -942,7 +947,11 @@ static inline __u64 ethtool_get_flow_spec_ring_vf(__u64 ring_cookie) · 4 unmodified lines
942947 * For %ETHTOOL_SRXCLSRLINS, @fs specifies the rule to add or update.
943948 * @fs.@location either specifies the location to use or is a special
944949 * location value with %RX_CLS_LOC_SPECIAL flag set. On return,
945− * @fs.@location is the actual rule location.
950+ * @fs.@location is the actual rule location. If @fs.@flow_type
951+ * includes the %FLOW_RSS flag, @rss_context is the RSS context ID to
952+ * use for flow spreading traffic which matches this rule. The value
953+ * from the rxfh indirection table will be added to @fs.@ring_cookie
954+ * to choose which ring to deliver to.
946955 *
947956 * For %ETHTOOL_SRXCLSRLDEL, @fs.@location specifies the location of an
948957 * existing rule on entry.
@@ -963,7 +972,10 @@ struct ethtool_rxnfc { · 14 unmodified lines
963972 __u32 flow_type;
964973 __u64 data;
965974 struct ethtool_rx_flow_spec fs;
966− __u32 rule_cnt;
975+ union {
976+ __u32 rule_cnt;
977+ __u32 rss_context;
978+ };
967979 __u32 rule_locs[0];
968980 };
969981
@@ -990,7 +1002,11 @@ struct ethtool_rxfh_indir { · 20 unmodified lines
9901002 /**
9911003 * struct ethtool_rxfh - command to get/set RX flow hash indir or/and hash key.
9921004 * @cmd: Specific command number - %ETHTOOL_GRSSH or %ETHTOOL_SRSSH
993− * @rss_context: RSS context identifier.
1005+ * @rss_context: RSS context identifier. Context 0 is the default for normal
1006+ * traffic; other contexts can be referenced as the destination for RX flow
1007+ * classification rules. %ETH_RXFH_CONTEXT_ALLOC is used with command
1008+ * %ETHTOOL_SRSSH to allocate a new RSS context; on return this field will
1009+ * contain the ID of the newly allocated context.
9941010 * @indir_size: On entry, the array size of the user buffer for the
9951011 * indirection table, which may be zero, or (for %ETHTOOL_SRSSH),
9961012 * %ETH_RXFH_INDIR_NO_CHANGE. On return from %ETHTOOL_GRSSH,
@@ -1009,7 +1025,8 @@ struct ethtool_rxfh_indir { · 12 unmodified lines
10091025 * size should be returned. For %ETHTOOL_SRSSH, an @indir_size of
10101026 * %ETH_RXFH_INDIR_NO_CHANGE means that indir table setting is not requested
10111027 * and a @indir_size of zero means the indir table should be reset to default
1012− * values. An hfunc of zero means that hash function setting is not requested.
1028+ * values (if @rss_context == 0) or that the RSS context should be deleted.
1029+ * An hfunc of zero means that hash function setting is not requested.
10131030 */
10141031 struct ethtool_rxfh {
10151032 __u32 cmd;
@@ -1021,6 +1038,7 @@ struct ethtool_rxfh { · 5 unmodified lines
10211038 __u32 rsvd32;
10221039 __u32 rss_config[0];
10231040 };
1041+#define ETH_RXFH_CONTEXT_ALLOC 0xffffffff
10241042 #define ETH_RXFH_INDIR_NO_CHANGE 0xffffffff
10251043
10261044 /**
@@ -1635,6 +1653,8 @@ static inline int ethtool_validate_duplex(__u8 duplex) · 608 unmodified lines
16351653 /* Flag to enable additional fields in struct ethtool_rx_flow_spec */
16361654 #define FLOW_EXT 0x80000000
16371655 #define FLOW_MAC_EXT 0x40000000
1656+/* Flag to enable RSS spreading of traffic matching rule (nfc only) */
1657+#define FLOW_RSS 0x20000000
16381658
16391659 /* L3-L4 network traffic flow hash options */
16401660 #define RXH_L2DA (1 << 1)