From: Luis R. Rodriguez Date: Sat, 1 Dec 2012 01:10:35 +0000 (-0800) Subject: compat: backport ethtool_rxfh_indir_default() X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=b27ce1c3f64db4e287ccefb51adcd61c98ebfb6b;p=openwrt%2Fstaging%2Fblogic.git compat: backport ethtool_rxfh_indir_default() This was added via commit 278bc429: mcgrof@frijol ~/linux-next (git::master)$ git describe --contains 278bc429 v3.3-rc1~182^2~191 commit 278bc4296bd64ffd1d3913b487dc8a520e423a7a Author: Ben Hutchings Date: Thu Dec 15 13:56:49 2011 +0000 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 Signed-off-by: Ben Hutchings Acked-by: Shreyas N Bhatewara Signed-off-by: David S. Miller Signed-off-by: Luis R. Rodriguez --- diff --git a/include/linux/compat-3.3.h b/include/linux/compat-3.3.h index 3cbbaceb1421..9bf97decb612 100644 --- a/include/linux/compat-3.3.h +++ b/include/linux/compat-3.3.h @@ -12,6 +12,18 @@ #include #include +/** + * ethtool_rxfh_indir_default - get default value for RX flow hash indirection + * @index: Index in RX flow hash indirection table + * @n_rx_rings: Number of RX rings to use + * + * This function provides the default policy for RX flow hash indirection. + */ +static inline u32 ethtool_rxfh_indir_default(u32 index, u32 n_rx_rings) +{ + return index % n_rx_rings; +} + #if !((LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,9) && LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) || (LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,23) && LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))) #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,37)) /* mask qdisc_cb_private_validate as RHEL6 backports this */