Hi Krishna. On Sun, Jul 22, 2007 at 02:35:25PM +0530, Krishna Kumar ([EMAIL PROTECTED]) wrote: > diff -ruNp org/net/core/dev.c rev2/net/core/dev.c > --- org/net/core/dev.c 2007-07-20 07:49:28.000000000 +0530 > +++ rev2/net/core/dev.c 2007-07-21 23:08:33.000000000 +0530 > @@ -875,6 +875,48 @@ void netdev_state_change(struct net_devi > } > } > > +/* > + * dev_change_tx_batching - Enable or disable batching for a driver that > + * supports batching. > + */ > +int dev_change_tx_batching(struct net_device *dev, unsigned long > new_batch_skb) > +{ > + int ret; > + > + if (!dev->hard_start_xmit_batch) { > + /* Driver doesn't support skb batching */ > + ret = -ENOTSUPP; > + goto out; > + } > + > + /* Handle invalid argument */ > + if (new_batch_skb < 0) { > + ret = -EINVAL; > + goto out; > + } > + > + ret = 0; > + > + /* Check if new value is same as the current */ > + if (!!(dev->features & NETIF_F_BATCH_ON) == !!new_batch_skb) > + goto out;
o_O Scratched head for too long before understood what it means :) > + spin_lock(&dev->queue_lock); > + if (new_batch_skb) { > + dev->features |= NETIF_F_BATCH_ON; > + dev->tx_queue_len >>= 1; > + } else { > + if (!skb_queue_empty(&dev->skb_blist)) > + skb_queue_purge(&dev->skb_blist); > + dev->features &= ~NETIF_F_BATCH_ON; > + dev->tx_queue_len <<= 1; > + } > + spin_unlock(&dev->queue_lock); Hmm, should this also stop interrupts? -- Evgeniy Polyakov - 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