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
914 * @flow_type: Type of flow to be affected, e.g. %TCP_V4_FLOW914 * @flow_type: Type of flow to be affected, e.g. %TCP_V4_FLOW
915 * @data: Command-dependent value915 * @data: Command-dependent value
916 * @fs: Flow classification rule916 * @fs: Flow classification rule
917 * @rss_context: RSS context to be affected
917 * @rule_cnt: Number of rules to be affected918 * @rule_cnt: Number of rules to be affected
918 * @rule_locs: Array of used rule locations919 * @rule_locs: Array of used rule locations
919 *920 *
920 * For %ETHTOOL_GRXFH and %ETHTOOL_SRXFH, @data is a bitmask indicating921 * For %ETHTOOL_GRXFH and %ETHTOOL_SRXFH, @data is a bitmask indicating
921 * the fields included in the flow hash, e.g. %RXH_IP_SRC. The following922 * 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.
923 *926 *
924 * For %ETHTOOL_GRXRINGS, @data is set to the number of RX rings/queues927 * For %ETHTOOL_GRXRINGS, @data is set to the number of RX rings/queues
925 * on return.928 * on return.
@@ -931,7 +934,9 @@ static inline __u64 ethtool_get_flow_spec_ring_vf(__u64 ring_cookie) · 5 unmodified lines
931 * set in @data then special location values should not be used.934 * set in @data then special location values should not be used.
932 *935 *
933 * For %ETHTOOL_GRXCLSRULE, @fs.@location specifies the location of an936 * 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.
935 *940 *
936 * For %ETHTOOL_GRXCLSRLALL, @rule_cnt specifies the array size of the941 * For %ETHTOOL_GRXCLSRLALL, @rule_cnt specifies the array size of the
937 * user buffer for @rule_locs on entry. On return, @data is the size942 * 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
942 * For %ETHTOOL_SRXCLSRLINS, @fs specifies the rule to add or update.947 * For %ETHTOOL_SRXCLSRLINS, @fs specifies the rule to add or update.
943 * @fs.@location either specifies the location to use or is a special948 * @fs.@location either specifies the location to use or is a special
944 * location value with %RX_CLS_LOC_SPECIAL flag set. On return,949 * 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.
946 *955 *
947 * For %ETHTOOL_SRXCLSRLDEL, @fs.@location specifies the location of an956 * For %ETHTOOL_SRXCLSRLDEL, @fs.@location specifies the location of an
948 * existing rule on entry.957 * existing rule on entry.
@@ -963,7 +972,10 @@ struct ethtool_rxnfc { · 14 unmodified lines
963 __u32 flow_type;972 __u32 flow_type;
964 __u64 data;973 __u64 data;
965 struct ethtool_rx_flow_spec fs;974 struct ethtool_rx_flow_spec fs;
966 __u32 rule_cnt;975 union {
976 __u32 rule_cnt;
977 __u32 rss_context;
978 };
967 __u32 rule_locs[0];979 __u32 rule_locs[0];
968};980};
969 981
@@ -990,7 +1002,11 @@ struct ethtool_rxfh_indir { · 20 unmodified lines
990/**1002/**
991 * struct ethtool_rxfh - command to get/set RX flow hash indir or/and hash key.1003 * struct ethtool_rxfh - command to get/set RX flow hash indir or/and hash key.
992 * @cmd: Specific command number - %ETHTOOL_GRSSH or %ETHTOOL_SRSSH1004 * @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.
994 * @indir_size: On entry, the array size of the user buffer for the1010 * @indir_size: On entry, the array size of the user buffer for the
995 * indirection table, which may be zero, or (for %ETHTOOL_SRSSH),1011 * indirection table, which may be zero, or (for %ETHTOOL_SRSSH),
996 * %ETH_RXFH_INDIR_NO_CHANGE. On return from %ETHTOOL_GRSSH,1012 * %ETH_RXFH_INDIR_NO_CHANGE. On return from %ETHTOOL_GRSSH,
@@ -1009,7 +1025,8 @@ struct ethtool_rxfh_indir { · 12 unmodified lines
1009 * size should be returned. For %ETHTOOL_SRSSH, an @indir_size of1025 * size should be returned. For %ETHTOOL_SRSSH, an @indir_size of
1010 * %ETH_RXFH_INDIR_NO_CHANGE means that indir table setting is not requested1026 * %ETH_RXFH_INDIR_NO_CHANGE means that indir table setting is not requested
1011 * and a @indir_size of zero means the indir table should be reset to default1027 * 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.
1013 */1030 */
1014struct ethtool_rxfh {1031struct ethtool_rxfh {
1015 __u32 cmd;1032 __u32 cmd;
@@ -1021,6 +1038,7 @@ struct ethtool_rxfh { · 5 unmodified lines
1021 __u32 rsvd32;1038 __u32 rsvd32;
1022 __u32 rss_config[0];1039 __u32 rss_config[0];
1023};1040};
1041#define ETH_RXFH_CONTEXT_ALLOC 0xffffffff
1024#define ETH_RXFH_INDIR_NO_CHANGE 0xffffffff1042#define ETH_RXFH_INDIR_NO_CHANGE 0xffffffff
1025 1043
1026/**1044/**
@@ -1635,6 +1653,8 @@ static inline int ethtool_validate_duplex(__u8 duplex) · 608 unmodified lines
1635/* Flag to enable additional fields in struct ethtool_rx_flow_spec */1653/* Flag to enable additional fields in struct ethtool_rx_flow_spec */
1636#define FLOW_EXT 0x800000001654#define FLOW_EXT 0x80000000
1637#define FLOW_MAC_EXT 0x400000001655#define FLOW_MAC_EXT 0x40000000
1656/* Flag to enable RSS spreading of traffic matching rule (nfc only) */
1657#define FLOW_RSS 0x20000000
1638 1658
1639/* L3-L4 network traffic flow hash options */1659/* L3-L4 network traffic flow hash options */
1640#define RXH_L2DA (1 << 1)1660#define RXH_L2DA (1 << 1)