Add ethtool support to enable/disable batching. Signed-off-by: Krishna Kumar <[EMAIL PROTECTED]> --- include/linux/ethtool.h | 2 ++ include/linux/netdevice.h | 2 ++ net/core/ethtool.c | 26 ++++++++++++++++++++++++++ 3 files changed, 30 insertions(+)
diff -ruNp ORG/include/linux/ethtool.h NEW/include/linux/ethtool.h --- ORG/include/linux/ethtool.h 2007-08-06 08:25:37.000000000 +0530 +++ NEW/include/linux/ethtool.h 2007-08-07 13:11:19.000000000 +0530 @@ -410,6 +410,8 @@ struct ethtool_ops { #define ETHTOOL_SUFO 0x00000022 /* Set UFO enable (ethtool_value) */ #define ETHTOOL_GGSO 0x00000023 /* Get GSO enable (ethtool_value) */ #define ETHTOOL_SGSO 0x00000024 /* Set GSO enable (ethtool_value) */ +#define ETHTOOL_GBATCH 0x00000024 /* Get Batch (ethtool_value) */ +#define ETHTOOL_SBATCH 0x00000025 /* Set Batch (ethtool_value) */ /* compatibility with older code */ #define SPARC_ETH_GSET ETHTOOL_GSET diff -ruNp ORG/include/linux/netdevice.h NEW/include/linux/netdevice.h --- ORG/include/linux/netdevice.h 2007-08-06 08:25:37.000000000 +0530 +++ NEW/include/linux/netdevice.h 2007-08-07 13:11:19.000000000 +0530 @@ -1112,6 +1112,8 @@ extern void dev_set_promiscuity(struct extern void dev_set_allmulti(struct net_device *dev, int inc); extern void netdev_state_change(struct net_device *dev); extern void netdev_features_change(struct net_device *dev); +extern int dev_change_tx_batch_skb(struct net_device *dev, + unsigned long new_batch_skb); /* Load a device via the kmod */ extern void dev_load(const char *name); extern void dev_mcast_init(void); diff -ruNp ORG/net/core/ethtool.c NEW/net/core/ethtool.c --- ORG/net/core/ethtool.c 2007-08-06 08:25:40.000000000 +0530 +++ NEW/net/core/ethtool.c 2007-08-07 13:11:19.000000000 +0530 @@ -638,6 +638,25 @@ static int ethtool_set_gso(struct net_de return 0; } +static int ethtool_get_batch(struct net_device *dev, char __user *useraddr) +{ + struct ethtool_value edata = { ETHTOOL_GBATCH }; + + edata.data = dev->skb_blist != NULL; + if (copy_to_user(useraddr, &edata, sizeof(edata))) + return -EFAULT; + return 0; +} + +static int ethtool_set_gso(struct net_device *dev, char __user *useraddr) +{ + struct ethtool_value edata; + + if (copy_from_user(&edata, useraddr, sizeof(edata))) + return -EFAULT; + return dev_change_tx_batch_skb(dev, edata.data); +} + static int ethtool_self_test(struct net_device *dev, char __user *useraddr) { struct ethtool_test test; @@ -817,6 +836,7 @@ int dev_ethtool(struct ifreq *ifr) case ETHTOOL_GPERMADDR: case ETHTOOL_GUFO: case ETHTOOL_GGSO: + case ETHTOOL_GBATCH: break; default: if (!capable(CAP_NET_ADMIN)) @@ -935,6 +955,12 @@ int dev_ethtool(struct ifreq *ifr) case ETHTOOL_SGSO: rc = ethtool_set_gso(dev, useraddr); break; + case ETHTOOL_GBATCH: + rc = ethtool_get_batch(dev, useraddr); + break; + case ETHTOOL_SBATCH: + rc = ethtool_set_batch(dev, useraddr); + break; default: rc = -EOPNOTSUPP; } - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html