virtio_net.c (3ab098df35f8b98b6553edc2e40234af512ba877) | virtio_net.c (35ed159bfd96a7547ec277ed8b550c7cbd9841b6) |
---|---|
1/* A network driver using virtio. 2 * 3 * Copyright 2007 Rusty Russell <rusty@rustcorp.com.au> IBM Corporation 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. --- 924 unchanged lines hidden (view full) --- 933 934 if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_MQ, 935 VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET, &sg, NULL)) { 936 dev_warn(&dev->dev, "Fail to set num of queue pairs to %d\n", 937 queue_pairs); 938 return -EINVAL; 939 } else { 940 vi->curr_queue_pairs = queue_pairs; | 1/* A network driver using virtio. 2 * 3 * Copyright 2007 Rusty Russell <rusty@rustcorp.com.au> IBM Corporation 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. --- 924 unchanged lines hidden (view full) --- 933 934 if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_MQ, 935 VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET, &sg, NULL)) { 936 dev_warn(&dev->dev, "Fail to set num of queue pairs to %d\n", 937 queue_pairs); 938 return -EINVAL; 939 } else { 940 vi->curr_queue_pairs = queue_pairs; |
941 schedule_delayed_work(&vi->refill, 0); | 941 /* virtnet_open() will refill when device is going to up. */ 942 if (dev->flags & IFF_UP) 943 schedule_delayed_work(&vi->refill, 0); |
942 } 943 944 return 0; 945} 946 947static int virtnet_close(struct net_device *dev) 948{ 949 struct virtnet_info *vi = netdev_priv(dev); --- 786 unchanged lines hidden (view full) --- 1736 for (i = 0; i < vi->curr_queue_pairs; i++) 1737 if (!try_fill_recv(&vi->rq[i], GFP_KERNEL)) 1738 schedule_delayed_work(&vi->refill, 0); 1739 1740 mutex_lock(&vi->config_lock); 1741 vi->config_enable = true; 1742 mutex_unlock(&vi->config_lock); 1743 | 944 } 945 946 return 0; 947} 948 949static int virtnet_close(struct net_device *dev) 950{ 951 struct virtnet_info *vi = netdev_priv(dev); --- 786 unchanged lines hidden (view full) --- 1738 for (i = 0; i < vi->curr_queue_pairs; i++) 1739 if (!try_fill_recv(&vi->rq[i], GFP_KERNEL)) 1740 schedule_delayed_work(&vi->refill, 0); 1741 1742 mutex_lock(&vi->config_lock); 1743 vi->config_enable = true; 1744 mutex_unlock(&vi->config_lock); 1745 |
1746 rtnl_lock(); |
|
1744 virtnet_set_queues(vi, vi->curr_queue_pairs); | 1747 virtnet_set_queues(vi, vi->curr_queue_pairs); |
1748 rtnl_unlock(); |
|
1745 1746 return 0; 1747} 1748#endif 1749 1750static struct virtio_device_id id_table[] = { 1751 { VIRTIO_ID_NET, VIRTIO_DEV_ANY_ID }, 1752 { 0 }, --- 35 unchanged lines hidden --- | 1749 1750 return 0; 1751} 1752#endif 1753 1754static struct virtio_device_id id_table[] = { 1755 { VIRTIO_ID_NET, VIRTIO_DEV_ANY_ID }, 1756 { 0 }, --- 35 unchanged lines hidden --- |