aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/ethtool.c
diff options
context:
space:
mode:
authoramit salecha <amit.salecha@qlogic.com>2011-04-06 21:58:42 -0400
committerDavid S. Miller <davem@davemloft.net>2011-04-13 14:31:04 -0400
commit8b5933c380fc66a6311739f9b36a812383f82141 (patch)
tree0552732a62a704756069e34cb945ee191a733332 /net/core/ethtool.c
parent6139e75f4a413bdc8f366fc11e437347be8abc59 (diff)
net: ethtool support to configure number of channels
Ethtool support to configure RX, TX and other channels. combined field in struct ethtool_channels to reflect set of channel (RX, TX or other). Other channel can be link interrupts, SR-IOV coordination etc. ETHTOOL_GCHANNELS will report max and current number of RX channels, max and current number of TX channels, max and current number of other channel or max and current number of combined channel. Number of channel can be modify upto max number of channel through ETHTOOL_SCHANNELS command. Ben Hutchings: o define 'combined' and 'other' types. Most multiqueue drivers pair up RX and TX queues so that most channels combine RX and TX work. o Please could you use a kernel-doc comment to describe the structure. Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com> Reviewed-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/ethtool.c')
-rw-r--r--net/core/ethtool.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 43ef09fedd6e..41dee2de13ad 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -1446,6 +1446,35 @@ static int ethtool_set_ringparam(struct net_device *dev, void __user *useraddr)
1446 return dev->ethtool_ops->set_ringparam(dev, &ringparam); 1446 return dev->ethtool_ops->set_ringparam(dev, &ringparam);
1447} 1447}
1448 1448
1449static noinline_for_stack int ethtool_get_channels(struct net_device *dev,
1450 void __user *useraddr)
1451{
1452 struct ethtool_channels channels = { .cmd = ETHTOOL_GCHANNELS };
1453
1454 if (!dev->ethtool_ops->get_channels)
1455 return -EOPNOTSUPP;
1456
1457 dev->ethtool_ops->get_channels(dev, &channels);
1458
1459 if (copy_to_user(useraddr, &channels, sizeof(channels)))
1460 return -EFAULT;
1461 return 0;
1462}
1463
1464static noinline_for_stack int ethtool_set_channels(struct net_device *dev,
1465 void __user *useraddr)
1466{
1467 struct ethtool_channels channels;
1468
1469 if (!dev->ethtool_ops->set_channels)
1470 return -EOPNOTSUPP;
1471
1472 if (copy_from_user(&channels, useraddr, sizeof(channels)))
1473 return -EFAULT;
1474
1475 return dev->ethtool_ops->set_channels(dev, &channels);
1476}
1477
1449static int ethtool_get_pauseparam(struct net_device *dev, void __user *useraddr) 1478static int ethtool_get_pauseparam(struct net_device *dev, void __user *useraddr)
1450{ 1479{
1451 struct ethtool_pauseparam pauseparam = { ETHTOOL_GPAUSEPARAM }; 1480 struct ethtool_pauseparam pauseparam = { ETHTOOL_GPAUSEPARAM };
@@ -2007,6 +2036,12 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
2007 case ETHTOOL_SGRO: 2036 case ETHTOOL_SGRO:
2008 rc = ethtool_set_one_feature(dev, useraddr, ethcmd); 2037 rc = ethtool_set_one_feature(dev, useraddr, ethcmd);
2009 break; 2038 break;
2039 case ETHTOOL_GCHANNELS:
2040 rc = ethtool_get_channels(dev, useraddr);
2041 break;
2042 case ETHTOOL_SCHANNELS:
2043 rc = ethtool_set_channels(dev, useraddr);
2044 break;
2010 default: 2045 default:
2011 rc = -EOPNOTSUPP; 2046 rc = -EOPNOTSUPP;
2012 } 2047 }