From: Saeed Mahameed Date: Mon, 30 Sep 2013 11:26:54 +0000 (+0200) Subject: mlx4_vnic: use netif_set_real_num_tx_queues to dynamically change tx queue size X-Git-Tag: v4.1.12-92~293^2~1^2~66 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=a778b39e86ce6534a38a85d1cc19e37091e8451b;p=users%2Fjedix%2Flinux-maple.git mlx4_vnic: use netif_set_real_num_tx_queues to dynamically change tx queue size When network admin vnics are created the network device is already registered and it is not allowed to change dev->real_num_tx_queues directly. This fixes a bug where the unload of mlx4_vnic hangs with the following error message: waiting for eth442 to become free. Usage count = 16 Signed-off-by: Saeed Mahameed (Ported from Mellanox OFED 2.4) Signed-off-by: Mukesh Kacker --- diff --git a/drivers/net/ethernet/mellanox/mlx4_vnic/vnic.h b/drivers/net/ethernet/mellanox/mlx4_vnic/vnic.h index 04a5e832d422..03c12e93d211 100644 --- a/drivers/net/ethernet/mellanox/mlx4_vnic/vnic.h +++ b/drivers/net/ethernet/mellanox/mlx4_vnic/vnic.h @@ -322,9 +322,13 @@ extern struct ib_sa_client vnic_sa_client; #ifndef _BP_NETDEV_NO_TMQ /* >= 2.6.27 */ #define VNIC_TXQ_GET_HASH(_skb, _max) (skb_get_queue_mapping(_skb)) #define VNIC_TXQ_ALLOC_NETDEV(sz, nm, sp, qm) alloc_netdev_mq(sz, nm, sp, qm) -#define VNIC_TXQ_SET_ACTIVE(login, num) (login->dev->real_num_tx_queues = \ - login->real_tx_rings_num = \ - login->ndo_tx_rings_num = num) +#define VNIC_TXQ_SET_ACTIVE(login, num) \ + do { \ + rtnl_lock(); \ + netif_set_real_num_tx_queues(login->dev,num); \ + rtnl_unlock(); \ + login->real_tx_rings_num = login->ndo_tx_rings_num = num; \ + } while (0) #define VNIC_TXQ_GET_ACTIVE(login) (login->real_tx_rings_num) #define VNIC_TXQ_GET(tx_res) netdev_get_tx_queue(tx_res->login->dev, tx_res->index) #define VNIC_TXQ_STOP(tx_res) netif_tx_stop_queue(VNIC_TXQ_GET(tx_res)) diff --git a/drivers/net/ethernet/mellanox/mlx4_vnic/vnic_main.c b/drivers/net/ethernet/mellanox/mlx4_vnic/vnic_main.c index f07ee4e63fb7..74c0ec69072f 100644 --- a/drivers/net/ethernet/mellanox/mlx4_vnic/vnic_main.c +++ b/drivers/net/ethernet/mellanox/mlx4_vnic/vnic_main.c @@ -60,8 +60,6 @@ err: static void __exit mlx4_ib_cleanup(void) { - int ret; - vnic_dbg_func("module_exit"); vnic_ports_cleanup(); vnic_dbg_mark();