diff options
author | Merav Sicron <meravs@broadcom.com> | 2012-06-19 03:48:30 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-06-19 17:34:35 -0400 |
commit | 0e8d2ec5c6ccf74dbe40216bb62d82c2f73fe836 (patch) | |
tree | 31b45583729304dbc7bd7cc3d94a8fec9f23b7c1 /drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | |
parent | 60aa0509056616afe9d66cf0fcd290589395032c (diff) |
bnx2x: Add support for ethtool -L
Add support for ethtool -L/-l for setting and getting the number of RSS queues.
The 'combined' field is used as we don't support separate IRQ for Rx and Tx.
Signed-off-by: Merav Sicron <meravs@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c')
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c index af84ebdeed7a..70c0881ce5a0 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | |||
@@ -2796,6 +2796,84 @@ static int bnx2x_set_rxfh_indir(struct net_device *dev, const u32 *indir) | |||
2796 | return bnx2x_config_rss_eth(bp, false); | 2796 | return bnx2x_config_rss_eth(bp, false); |
2797 | } | 2797 | } |
2798 | 2798 | ||
2799 | /** | ||
2800 | * bnx2x_get_channels - gets the number of RSS queues. | ||
2801 | * | ||
2802 | * @dev: net device | ||
2803 | * @channels: returns the number of max / current queues | ||
2804 | */ | ||
2805 | static void bnx2x_get_channels(struct net_device *dev, | ||
2806 | struct ethtool_channels *channels) | ||
2807 | { | ||
2808 | struct bnx2x *bp = netdev_priv(dev); | ||
2809 | |||
2810 | channels->max_combined = BNX2X_MAX_RSS_COUNT(bp); | ||
2811 | channels->combined_count = BNX2X_NUM_ETH_QUEUES(bp); | ||
2812 | } | ||
2813 | |||
2814 | /** | ||
2815 | * bnx2x_change_num_queues - change the number of RSS queues. | ||
2816 | * | ||
2817 | * @bp: bnx2x private structure | ||
2818 | * | ||
2819 | * Re-configure interrupt mode to get the new number of MSI-X | ||
2820 | * vectors and re-add NAPI objects. | ||
2821 | */ | ||
2822 | static void bnx2x_change_num_queues(struct bnx2x *bp, int num_rss) | ||
2823 | { | ||
2824 | bnx2x_del_all_napi(bp); | ||
2825 | bnx2x_disable_msi(bp); | ||
2826 | BNX2X_NUM_QUEUES(bp) = num_rss + NON_ETH_CONTEXT_USE; | ||
2827 | bnx2x_set_int_mode(bp); | ||
2828 | bnx2x_add_all_napi(bp); | ||
2829 | } | ||
2830 | |||
2831 | /** | ||
2832 | * bnx2x_set_channels - sets the number of RSS queues. | ||
2833 | * | ||
2834 | * @dev: net device | ||
2835 | * @channels: includes the number of queues requested | ||
2836 | */ | ||
2837 | static int bnx2x_set_channels(struct net_device *dev, | ||
2838 | struct ethtool_channels *channels) | ||
2839 | { | ||
2840 | struct bnx2x *bp = netdev_priv(dev); | ||
2841 | |||
2842 | |||
2843 | DP(BNX2X_MSG_ETHTOOL, | ||
2844 | "set-channels command parameters: rx = %d, tx = %d, other = %d, combined = %d\n", | ||
2845 | channels->rx_count, channels->tx_count, channels->other_count, | ||
2846 | channels->combined_count); | ||
2847 | |||
2848 | /* We don't support separate rx / tx channels. | ||
2849 | * We don't allow setting 'other' channels. | ||
2850 | */ | ||
2851 | if (channels->rx_count || channels->tx_count || channels->other_count | ||
2852 | || (channels->combined_count == 0) || | ||
2853 | (channels->combined_count > BNX2X_MAX_RSS_COUNT(bp))) { | ||
2854 | DP(BNX2X_MSG_ETHTOOL, "command parameters not supported\n"); | ||
2855 | return -EINVAL; | ||
2856 | } | ||
2857 | |||
2858 | /* Check if there was a change in the active parameters */ | ||
2859 | if (channels->combined_count == BNX2X_NUM_ETH_QUEUES(bp)) { | ||
2860 | DP(BNX2X_MSG_ETHTOOL, "No change in active parameters\n"); | ||
2861 | return 0; | ||
2862 | } | ||
2863 | |||
2864 | /* Set the requested number of queues in bp context. | ||
2865 | * Note that the actual number of queues created during load may be | ||
2866 | * less than requested if memory is low. | ||
2867 | */ | ||
2868 | if (unlikely(!netif_running(dev))) { | ||
2869 | bnx2x_change_num_queues(bp, channels->combined_count); | ||
2870 | return 0; | ||
2871 | } | ||
2872 | bnx2x_nic_unload(bp, UNLOAD_NORMAL); | ||
2873 | bnx2x_change_num_queues(bp, channels->combined_count); | ||
2874 | return bnx2x_nic_load(bp, LOAD_NORMAL); | ||
2875 | } | ||
2876 | |||
2799 | static const struct ethtool_ops bnx2x_ethtool_ops = { | 2877 | static const struct ethtool_ops bnx2x_ethtool_ops = { |
2800 | .get_settings = bnx2x_get_settings, | 2878 | .get_settings = bnx2x_get_settings, |
2801 | .set_settings = bnx2x_set_settings, | 2879 | .set_settings = bnx2x_set_settings, |
@@ -2827,6 +2905,8 @@ static const struct ethtool_ops bnx2x_ethtool_ops = { | |||
2827 | .get_rxfh_indir_size = bnx2x_get_rxfh_indir_size, | 2905 | .get_rxfh_indir_size = bnx2x_get_rxfh_indir_size, |
2828 | .get_rxfh_indir = bnx2x_get_rxfh_indir, | 2906 | .get_rxfh_indir = bnx2x_get_rxfh_indir, |
2829 | .set_rxfh_indir = bnx2x_set_rxfh_indir, | 2907 | .set_rxfh_indir = bnx2x_set_rxfh_indir, |
2908 | .get_channels = bnx2x_get_channels, | ||
2909 | .set_channels = bnx2x_set_channels, | ||
2830 | .get_eee = bnx2x_get_eee, | 2910 | .get_eee = bnx2x_get_eee, |
2831 | .set_eee = bnx2x_set_eee, | 2911 | .set_eee = bnx2x_set_eee, |
2832 | }; | 2912 | }; |