Skip to content

Commit

Permalink
Merge branch 'qlcnic_net'
Browse files Browse the repository at this point in the history
Rajesh Borundia says:

====================
qlcnic: Bug fixes.

This patch series contain following bug fixes.

* Fix panic where driver was accessing un-initialized crb_intr_mask
  in non Multi-Tx queue mode while dumping TX queue.
* Do not set netdev->real_num_tx_queues directly from driver instead
  use kernel defined netif_set_real_num_tx_queues() API. Also notify
  stack about change in number of Rx queues.

Please apply this series to net.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed May 7, 2014
2 parents 76a691d + 84d7ad2 commit 7fc1c5f
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 20 deletions.
16 changes: 0 additions & 16 deletions drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
Original file line number Diff line number Diff line change
Expand Up @@ -1719,22 +1719,6 @@ static inline u32 qlcnic_tx_avail(struct qlcnic_host_tx_ring *tx_ring)
tx_ring->producer;
}

static inline int qlcnic_set_real_num_queues(struct qlcnic_adapter *adapter,
struct net_device *netdev)
{
int err;

netdev->num_tx_queues = adapter->drv_tx_rings;
netdev->real_num_tx_queues = adapter->drv_tx_rings;

err = netif_set_real_num_tx_queues(netdev, adapter->drv_tx_rings);
if (err)
netdev_err(netdev, "failed to set %d Tx queues\n",
adapter->drv_tx_rings);

return err;
}

struct qlcnic_nic_template {
int (*config_bridged_mode) (struct qlcnic_adapter *, u32);
int (*config_led) (struct qlcnic_adapter *, u32, u32);
Expand Down
57 changes: 53 additions & 4 deletions drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2206,6 +2206,31 @@ static void qlcnic_82xx_set_mac_filter_count(struct qlcnic_adapter *adapter)
ahw->max_uc_count = count;
}

static int qlcnic_set_real_num_queues(struct qlcnic_adapter *adapter,
u8 tx_queues, u8 rx_queues)
{
struct net_device *netdev = adapter->netdev;
int err = 0;

if (tx_queues) {
err = netif_set_real_num_tx_queues(netdev, tx_queues);
if (err) {
netdev_err(netdev, "failed to set %d Tx queues\n",
tx_queues);
return err;
}
}

if (rx_queues) {
err = netif_set_real_num_rx_queues(netdev, rx_queues);
if (err)
netdev_err(netdev, "failed to set %d Rx queues\n",
rx_queues);
}

return err;
}

int
qlcnic_setup_netdev(struct qlcnic_adapter *adapter, struct net_device *netdev,
int pci_using_dac)
Expand Down Expand Up @@ -2269,7 +2294,8 @@ qlcnic_setup_netdev(struct qlcnic_adapter *adapter, struct net_device *netdev,
netdev->priv_flags |= IFF_UNICAST_FLT;
netdev->irq = adapter->msix_entries[0].vector;

err = qlcnic_set_real_num_queues(adapter, netdev);
err = qlcnic_set_real_num_queues(adapter, adapter->drv_tx_rings,
adapter->drv_sds_rings);
if (err)
return err;

Expand Down Expand Up @@ -2943,9 +2969,13 @@ static void qlcnic_dump_tx_rings(struct qlcnic_adapter *adapter)
tx_ring->tx_stats.xmit_called,
tx_ring->tx_stats.xmit_on,
tx_ring->tx_stats.xmit_off);

if (tx_ring->crb_intr_mask)
netdev_info(netdev, "crb_intr_mask=%d\n",
readl(tx_ring->crb_intr_mask));

netdev_info(netdev,
"crb_intr_mask=%d, hw_producer=%d, sw_producer=%d sw_consumer=%d, hw_consumer=%d\n",
readl(tx_ring->crb_intr_mask),
"hw_producer=%d, sw_producer=%d sw_consumer=%d, hw_consumer=%d\n",
readl(tx_ring->crb_cmd_producer),
tx_ring->producer, tx_ring->sw_consumer,
le32_to_cpu(*(tx_ring->hw_consumer)));
Expand Down Expand Up @@ -3978,12 +4008,21 @@ int qlcnic_validate_rings(struct qlcnic_adapter *adapter, __u32 ring_cnt,
int qlcnic_setup_rings(struct qlcnic_adapter *adapter)
{
struct net_device *netdev = adapter->netdev;
u8 tx_rings, rx_rings;
int err;

if (test_bit(__QLCNIC_RESETTING, &adapter->state))
return -EBUSY;

tx_rings = adapter->drv_tss_rings;
rx_rings = adapter->drv_rss_rings;

netif_device_detach(netdev);

err = qlcnic_set_real_num_queues(adapter, tx_rings, rx_rings);
if (err)
goto done;

if (netif_running(netdev))
__qlcnic_down(adapter, netdev);

Expand All @@ -4003,7 +4042,17 @@ int qlcnic_setup_rings(struct qlcnic_adapter *adapter)
return err;
}

netif_set_real_num_tx_queues(netdev, adapter->drv_tx_rings);
/* Check if we need to update real_num_{tx|rx}_queues because
* qlcnic_setup_intr() may change Tx/Rx rings size
*/
if ((tx_rings != adapter->drv_tx_rings) ||
(rx_rings != adapter->drv_sds_rings)) {
err = qlcnic_set_real_num_queues(adapter,
adapter->drv_tx_rings,
adapter->drv_sds_rings);
if (err)
goto done;
}

if (qlcnic_83xx_check(adapter)) {
qlcnic_83xx_initialize_nic(adapter, 1);
Expand Down

0 comments on commit 7fc1c5f

Please sign in to comment.