net: introduce NETDEV_CHANGE_TX_QUEUE_LEN
This patch introduces a new event - NETDEV_CHANGE_TX_QUEUE_LEN, this will be triggered when tx_queue_len. It could be used by net device who want to do some processing at that time. An example is tun who may want to resize tx array when tx_queue_len is changed. Cc: John Fastabend <john.r.fastabend@intel.com> Signed-off-by: Jason Wang <jasowang@redhat.com> Acked-by: John Fastabend <john.r.fastabend@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
bf900b3dbe
commit
08294a26e1
@ -322,7 +322,20 @@ NETDEVICE_SHOW_RW(flags, fmt_hex);
|
||||
|
||||
static int change_tx_queue_len(struct net_device *dev, unsigned long new_len)
|
||||
{
|
||||
dev->tx_queue_len = new_len;
|
||||
int res, orig_len = dev->tx_queue_len;
|
||||
|
||||
if (new_len != orig_len) {
|
||||
dev->tx_queue_len = new_len;
|
||||
res = call_netdevice_notifiers(NETDEV_CHANGE_TX_QUEUE_LEN, dev);
|
||||
res = notifier_to_errno(res);
|
||||
if (res) {
|
||||
netdev_err(dev,
|
||||
"refused to change device tx_queue_len\n");
|
||||
dev->tx_queue_len = orig_len;
|
||||
return -EFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user