aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2013-01-17 03:39:33 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2013-02-16 02:03:07 -0500
commit4c696ca9fbabc5f94a3c6db7f009e73f0ef21831 (patch)
tree484e09d062ef3eb0234a434df1e5d965cb45101b
parent5348c9dbf379dc5b70e3a6a4f2f79c2c43720b37 (diff)
ixgbe: Add support for set_channels ethtool operation
This change adds support for the ethtool set_channels operation. Since the ixgbe driver has to support DCB as well as the other modes the assumption I made here is that the number of channels in DCB modes refers to the number of queues per traffic class, not the number of queues total. CC: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
index cba27c63ebb3..7349a8b4a534 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
@@ -2802,6 +2802,43 @@ static void ixgbe_get_channels(struct net_device *dev,
2802 ch->combined_count = adapter->ring_feature[RING_F_FDIR].indices; 2802 ch->combined_count = adapter->ring_feature[RING_F_FDIR].indices;
2803} 2803}
2804 2804
2805static int ixgbe_set_channels(struct net_device *dev,
2806 struct ethtool_channels *ch)
2807{
2808 struct ixgbe_adapter *adapter = netdev_priv(dev);
2809 unsigned int count = ch->combined_count;
2810
2811 /* verify they are not requesting separate vectors */
2812 if (!count || ch->rx_count || ch->tx_count)
2813 return -EINVAL;
2814
2815 /* verify other_count has not changed */
2816 if (ch->other_count != NON_Q_VECTORS)
2817 return -EINVAL;
2818
2819 /* verify the number of channels does not exceed hardware limits */
2820 if (count > ixgbe_max_channels(adapter))
2821 return -EINVAL;
2822
2823 /* update feature limits from largest to smallest supported values */
2824 adapter->ring_feature[RING_F_FDIR].limit = count;
2825
2826 /* cap RSS limit at 16 */
2827 if (count > IXGBE_MAX_RSS_INDICES)
2828 count = IXGBE_MAX_RSS_INDICES;
2829 adapter->ring_feature[RING_F_RSS].limit = count;
2830
2831#ifdef IXGBE_FCOE
2832 /* cap FCoE limit at 8 */
2833 if (count > IXGBE_FCRETA_SIZE)
2834 count = IXGBE_FCRETA_SIZE;
2835 adapter->ring_feature[RING_F_FCOE].limit = count;
2836
2837#endif
2838 /* use setup TC to update any traffic class queue mapping */
2839 return ixgbe_setup_tc(dev, netdev_get_num_tc(dev));
2840}
2841
2805static const struct ethtool_ops ixgbe_ethtool_ops = { 2842static const struct ethtool_ops ixgbe_ethtool_ops = {
2806 .get_settings = ixgbe_get_settings, 2843 .get_settings = ixgbe_get_settings,
2807 .set_settings = ixgbe_set_settings, 2844 .set_settings = ixgbe_set_settings,
@@ -2831,6 +2868,7 @@ static const struct ethtool_ops ixgbe_ethtool_ops = {
2831 .get_rxnfc = ixgbe_get_rxnfc, 2868 .get_rxnfc = ixgbe_get_rxnfc,
2832 .set_rxnfc = ixgbe_set_rxnfc, 2869 .set_rxnfc = ixgbe_set_rxnfc,
2833 .get_channels = ixgbe_get_channels, 2870 .get_channels = ixgbe_get_channels,
2871 .set_channels = ixgbe_set_channels,
2834 .get_ts_info = ixgbe_get_ts_info, 2872 .get_ts_info = ixgbe_get_ts_info,
2835}; 2873};
2836 2874