diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2011-12-15 08:56:49 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-12-16 13:53:18 -0500 |
commit | 278bc4296bd64ffd1d3913b487dc8a520e423a7a (patch) | |
tree | 87781870cf9b96398a90fae6ebe1dae6d43d9ea4 /include/linux/ethtool.h | |
parent | 7850f63f1620512631445b901ae11cd149e7375c (diff) |
ethtool: Define and apply a default policy for RX flow hash indirection
All drivers that support modification of the RX flow hash indirection
table initialise it in the same way: RX rings are assigned to table
entries in rotation. Make that default policy explicit by having them
call a ethtool_rxfh_indir_default() function.
In the ethtool core, add support for a zero size value for
ETHTOOL_SRXFHINDIR, which resets the table to this default.
Partly-suggested-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Acked-by: Shreyas N Bhatewara <sbhatewara@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/ethtool.h')
-rw-r--r-- | include/linux/ethtool.h | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index 3b9f09d55b5c..b38bf69310ee 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h | |||
@@ -543,10 +543,15 @@ struct compat_ethtool_rxnfc { | |||
543 | /** | 543 | /** |
544 | * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection | 544 | * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection |
545 | * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR | 545 | * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR |
546 | * @size: On entry, the array size of the user buffer, which may be zero | 546 | * @size: On entry, the array size of the user buffer, which may be zero. |
547 | * for %ETHTOOL_GRXFHINDIR. On return from %ETHTOOL_GRXFHINDIR, the | 547 | * On return from %ETHTOOL_GRXFHINDIR, the array size of the hardware |
548 | * array size of the hardware indirection table. | 548 | * indirection table. |
549 | * @ring_index: RX ring/queue index for each hash value | 549 | * @ring_index: RX ring/queue index for each hash value |
550 | * | ||
551 | * For %ETHTOOL_GRXFHINDIR, a @size of zero means that only the size | ||
552 | * should be returned. For %ETHTOOL_SRXFHINDIR, a @size of zero means | ||
553 | * the table should be reset to default values. This last feature | ||
554 | * is not supported by the original implementations. | ||
550 | */ | 555 | */ |
551 | struct ethtool_rxfh_indir { | 556 | struct ethtool_rxfh_indir { |
552 | __u32 cmd; | 557 | __u32 cmd; |
@@ -750,6 +755,18 @@ struct net_device; | |||
750 | u32 ethtool_op_get_link(struct net_device *dev); | 755 | u32 ethtool_op_get_link(struct net_device *dev); |
751 | 756 | ||
752 | /** | 757 | /** |
758 | * ethtool_rxfh_indir_default - get default value for RX flow hash indirection | ||
759 | * @index: Index in RX flow hash indirection table | ||
760 | * @n_rx_rings: Number of RX rings to use | ||
761 | * | ||
762 | * This function provides the default policy for RX flow hash indirection. | ||
763 | */ | ||
764 | static inline u32 ethtool_rxfh_indir_default(u32 index, u32 n_rx_rings) | ||
765 | { | ||
766 | return index % n_rx_rings; | ||
767 | } | ||
768 | |||
769 | /** | ||
753 | * struct ethtool_ops - optional netdev operations | 770 | * struct ethtool_ops - optional netdev operations |
754 | * @get_settings: Get various device settings including Ethernet link | 771 | * @get_settings: Get various device settings including Ethernet link |
755 | * settings. The @cmd parameter is expected to have been cleared | 772 | * settings. The @cmd parameter is expected to have been cleared |