aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/igb/igb_ethtool.c
diff options
context:
space:
mode:
authorLaura Mihaela Vasilescu <laura.vasilescu@rosedu.org>2013-10-01 07:33:56 -0400
committerDavid S. Miller <davem@davemloft.net>2013-10-01 12:49:49 -0400
commit907b7835799f741bf80e18b635555dc332ca9863 (patch)
tree2d3875ece19dab6d8bf7b37d73296aac03875f1b /drivers/net/ethernet/intel/igb/igb_ethtool.c
parenta4e979a27db3eb77e286dbe484e96c0c9c986e83 (diff)
igb: Add ethtool support to configure number of channels
This patch adds the ethtool callbacks necessary to configure the number of RSS queues. The maximum number of queues is in accordance with the datasheets. Signed-off-by: Laura Mihaela Vasilescu <laura.vasilescu@rosedu.org> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/intel/igb/igb_ethtool.c')
-rw-r--r--drivers/net/ethernet/intel/igb/igb_ethtool.c84
1 files changed, 84 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c
index e4c77c041d37..c8f65e5e6d10 100644
--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
+++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
@@ -2874,6 +2874,88 @@ static int igb_set_rxfh_indir(struct net_device *netdev, const u32 *indir)
2874 return 0; 2874 return 0;
2875} 2875}
2876 2876
2877static unsigned int igb_max_channels(struct igb_adapter *adapter)
2878{
2879 struct e1000_hw *hw = &adapter->hw;
2880 unsigned int max_combined = 0;
2881
2882 switch (hw->mac.type) {
2883 case e1000_i211:
2884 max_combined = IGB_MAX_RX_QUEUES_I211;
2885 break;
2886 case e1000_82575:
2887 case e1000_i210:
2888 max_combined = IGB_MAX_RX_QUEUES_82575;
2889 break;
2890 case e1000_i350:
2891 if (!!adapter->vfs_allocated_count) {
2892 max_combined = 1;
2893 break;
2894 }
2895 /* fall through */
2896 case e1000_82576:
2897 if (!!adapter->vfs_allocated_count) {
2898 max_combined = 2;
2899 break;
2900 }
2901 /* fall through */
2902 case e1000_82580:
2903 case e1000_i354:
2904 default:
2905 max_combined = IGB_MAX_RX_QUEUES;
2906 break;
2907 }
2908
2909 return max_combined;
2910}
2911
2912static void igb_get_channels(struct net_device *netdev,
2913 struct ethtool_channels *ch)
2914{
2915 struct igb_adapter *adapter = netdev_priv(netdev);
2916
2917 /* Report maximum channels */
2918 ch->max_combined = igb_max_channels(adapter);
2919
2920 /* Report info for other vector */
2921 if (adapter->msix_entries) {
2922 ch->max_other = NON_Q_VECTORS;
2923 ch->other_count = NON_Q_VECTORS;
2924 }
2925
2926 ch->combined_count = adapter->rss_queues;
2927}
2928
2929static int igb_set_channels(struct net_device *netdev,
2930 struct ethtool_channels *ch)
2931{
2932 struct igb_adapter *adapter = netdev_priv(netdev);
2933 unsigned int count = ch->combined_count;
2934
2935 /* Verify they are not requesting separate vectors */
2936 if (!count || ch->rx_count || ch->tx_count)
2937 return -EINVAL;
2938
2939 /* Verify other_count is valid and has not been changed */
2940 if (ch->other_count != NON_Q_VECTORS)
2941 return -EINVAL;
2942
2943 /* Verify the number of channels doesn't exceed hw limits */
2944 if (count > igb_max_channels(adapter))
2945 return -EINVAL;
2946
2947 if (count != adapter->rss_queues) {
2948 adapter->rss_queues = count;
2949
2950 /* Hardware has to reinitialize queues and interrupts to
2951 * match the new configuration.
2952 */
2953 return igb_reinit_queues(adapter);
2954 }
2955
2956 return 0;
2957}
2958
2877static const struct ethtool_ops igb_ethtool_ops = { 2959static const struct ethtool_ops igb_ethtool_ops = {
2878 .get_settings = igb_get_settings, 2960 .get_settings = igb_get_settings,
2879 .set_settings = igb_set_settings, 2961 .set_settings = igb_set_settings,
@@ -2910,6 +2992,8 @@ static const struct ethtool_ops igb_ethtool_ops = {
2910 .get_rxfh_indir_size = igb_get_rxfh_indir_size, 2992 .get_rxfh_indir_size = igb_get_rxfh_indir_size,
2911 .get_rxfh_indir = igb_get_rxfh_indir, 2993 .get_rxfh_indir = igb_get_rxfh_indir,
2912 .set_rxfh_indir = igb_set_rxfh_indir, 2994 .set_rxfh_indir = igb_set_rxfh_indir,
2995 .get_channels = igb_get_channels,
2996 .set_channels = igb_set_channels,
2913 .begin = igb_ethtool_begin, 2997 .begin = igb_ethtool_begin,
2914 .complete = igb_ethtool_complete, 2998 .complete = igb_ethtool_complete,
2915}; 2999};