diff options
author | Shahed Shaikh <shahed.shaikh@qlogic.com> | 2014-05-06 03:46:49 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-05-07 16:53:15 -0400 |
commit | 84d7ad2c3b8a80888d9a483388ccbd5e5f07438f (patch) | |
tree | d66b5da3616c3d20eca737b532c3230839a75562 | |
parent | d5d2bf3eabb34cc8eaf54db37fdc43f04267985a (diff) |
qlcnic: Set real_num_{tx|rx}_queues properly
Do not set netdev->real_num_tx_queues directly,
let netif_set_real_num_tx_queues() take care of it.
Do not overwrite netdev->num_tx_queues everytime when driver
changes its Tx ring size through ethtool -L and also notify
stack to update number of Rx queues.
Signed-off-by: Shahed Shaikh <shahed.shaikh@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | 16 | ||||
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 49 |
2 files changed, 47 insertions, 18 deletions
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h index 7b52a88923ef..f785d01c7d12 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | |||
@@ -1719,22 +1719,6 @@ static inline u32 qlcnic_tx_avail(struct qlcnic_host_tx_ring *tx_ring) | |||
1719 | tx_ring->producer; | 1719 | tx_ring->producer; |
1720 | } | 1720 | } |
1721 | 1721 | ||
1722 | static inline int qlcnic_set_real_num_queues(struct qlcnic_adapter *adapter, | ||
1723 | struct net_device *netdev) | ||
1724 | { | ||
1725 | int err; | ||
1726 | |||
1727 | netdev->num_tx_queues = adapter->drv_tx_rings; | ||
1728 | netdev->real_num_tx_queues = adapter->drv_tx_rings; | ||
1729 | |||
1730 | err = netif_set_real_num_tx_queues(netdev, adapter->drv_tx_rings); | ||
1731 | if (err) | ||
1732 | netdev_err(netdev, "failed to set %d Tx queues\n", | ||
1733 | adapter->drv_tx_rings); | ||
1734 | |||
1735 | return err; | ||
1736 | } | ||
1737 | |||
1738 | struct qlcnic_nic_template { | 1722 | struct qlcnic_nic_template { |
1739 | int (*config_bridged_mode) (struct qlcnic_adapter *, u32); | 1723 | int (*config_bridged_mode) (struct qlcnic_adapter *, u32); |
1740 | int (*config_led) (struct qlcnic_adapter *, u32, u32); | 1724 | int (*config_led) (struct qlcnic_adapter *, u32, u32); |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index be789513774c..7e55e88a81bf 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | |||
@@ -2206,6 +2206,31 @@ static void qlcnic_82xx_set_mac_filter_count(struct qlcnic_adapter *adapter) | |||
2206 | ahw->max_uc_count = count; | 2206 | ahw->max_uc_count = count; |
2207 | } | 2207 | } |
2208 | 2208 | ||
2209 | static int qlcnic_set_real_num_queues(struct qlcnic_adapter *adapter, | ||
2210 | u8 tx_queues, u8 rx_queues) | ||
2211 | { | ||
2212 | struct net_device *netdev = adapter->netdev; | ||
2213 | int err = 0; | ||
2214 | |||
2215 | if (tx_queues) { | ||
2216 | err = netif_set_real_num_tx_queues(netdev, tx_queues); | ||
2217 | if (err) { | ||
2218 | netdev_err(netdev, "failed to set %d Tx queues\n", | ||
2219 | tx_queues); | ||
2220 | return err; | ||
2221 | } | ||
2222 | } | ||
2223 | |||
2224 | if (rx_queues) { | ||
2225 | err = netif_set_real_num_rx_queues(netdev, rx_queues); | ||
2226 | if (err) | ||
2227 | netdev_err(netdev, "failed to set %d Rx queues\n", | ||
2228 | rx_queues); | ||
2229 | } | ||
2230 | |||
2231 | return err; | ||
2232 | } | ||
2233 | |||
2209 | int | 2234 | int |
2210 | qlcnic_setup_netdev(struct qlcnic_adapter *adapter, struct net_device *netdev, | 2235 | qlcnic_setup_netdev(struct qlcnic_adapter *adapter, struct net_device *netdev, |
2211 | int pci_using_dac) | 2236 | int pci_using_dac) |
@@ -2269,7 +2294,8 @@ qlcnic_setup_netdev(struct qlcnic_adapter *adapter, struct net_device *netdev, | |||
2269 | netdev->priv_flags |= IFF_UNICAST_FLT; | 2294 | netdev->priv_flags |= IFF_UNICAST_FLT; |
2270 | netdev->irq = adapter->msix_entries[0].vector; | 2295 | netdev->irq = adapter->msix_entries[0].vector; |
2271 | 2296 | ||
2272 | err = qlcnic_set_real_num_queues(adapter, netdev); | 2297 | err = qlcnic_set_real_num_queues(adapter, adapter->drv_tx_rings, |
2298 | adapter->drv_sds_rings); | ||
2273 | if (err) | 2299 | if (err) |
2274 | return err; | 2300 | return err; |
2275 | 2301 | ||
@@ -3982,12 +4008,21 @@ int qlcnic_validate_rings(struct qlcnic_adapter *adapter, __u32 ring_cnt, | |||
3982 | int qlcnic_setup_rings(struct qlcnic_adapter *adapter) | 4008 | int qlcnic_setup_rings(struct qlcnic_adapter *adapter) |
3983 | { | 4009 | { |
3984 | struct net_device *netdev = adapter->netdev; | 4010 | struct net_device *netdev = adapter->netdev; |
4011 | u8 tx_rings, rx_rings; | ||
3985 | int err; | 4012 | int err; |
3986 | 4013 | ||
3987 | if (test_bit(__QLCNIC_RESETTING, &adapter->state)) | 4014 | if (test_bit(__QLCNIC_RESETTING, &adapter->state)) |
3988 | return -EBUSY; | 4015 | return -EBUSY; |
3989 | 4016 | ||
4017 | tx_rings = adapter->drv_tss_rings; | ||
4018 | rx_rings = adapter->drv_rss_rings; | ||
4019 | |||
3990 | netif_device_detach(netdev); | 4020 | netif_device_detach(netdev); |
4021 | |||
4022 | err = qlcnic_set_real_num_queues(adapter, tx_rings, rx_rings); | ||
4023 | if (err) | ||
4024 | goto done; | ||
4025 | |||
3991 | if (netif_running(netdev)) | 4026 | if (netif_running(netdev)) |
3992 | __qlcnic_down(adapter, netdev); | 4027 | __qlcnic_down(adapter, netdev); |
3993 | 4028 | ||
@@ -4007,7 +4042,17 @@ int qlcnic_setup_rings(struct qlcnic_adapter *adapter) | |||
4007 | return err; | 4042 | return err; |
4008 | } | 4043 | } |
4009 | 4044 | ||
4010 | netif_set_real_num_tx_queues(netdev, adapter->drv_tx_rings); | 4045 | /* Check if we need to update real_num_{tx|rx}_queues because |
4046 | * qlcnic_setup_intr() may change Tx/Rx rings size | ||
4047 | */ | ||
4048 | if ((tx_rings != adapter->drv_tx_rings) || | ||
4049 | (rx_rings != adapter->drv_sds_rings)) { | ||
4050 | err = qlcnic_set_real_num_queues(adapter, | ||
4051 | adapter->drv_tx_rings, | ||
4052 | adapter->drv_sds_rings); | ||
4053 | if (err) | ||
4054 | goto done; | ||
4055 | } | ||
4011 | 4056 | ||
4012 | if (qlcnic_83xx_check(adapter)) { | 4057 | if (qlcnic_83xx_check(adapter)) { |
4013 | qlcnic_83xx_initialize_nic(adapter, 1); | 4058 | qlcnic_83xx_initialize_nic(adapter, 1); |