Skip to content

Commit d944c3d

Browse files
jallen93davem330
authored andcommitted
ibmvnic: Track state of adapter napis
Track the state of ibmvnic napis. The driver can get into states where it can be reset when napis are already disabled and attempting to disable them again will cause the driver to hang. Signed-off-by: John Allen <[email protected]> Signed-off-by: Nathan Fontenot <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 0ca3737 commit d944c3d

File tree

2 files changed

+29
-9
lines changed

2 files changed

+29
-9
lines changed

drivers/net/ethernet/ibm/ibmvnic.c

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,32 @@ static void release_error_buffers(struct ibmvnic_adapter *adapter)
518518
spin_unlock_irqrestore(&adapter->error_list_lock, flags);
519519
}
520520

521+
static void ibmvnic_napi_enable(struct ibmvnic_adapter *adapter)
522+
{
523+
int i;
524+
525+
if (adapter->napi_enabled)
526+
return;
527+
528+
for (i = 0; i < adapter->req_rx_queues; i++)
529+
napi_enable(&adapter->napi[i]);
530+
531+
adapter->napi_enabled = true;
532+
}
533+
534+
static void ibmvnic_napi_disable(struct ibmvnic_adapter *adapter)
535+
{
536+
int i;
537+
538+
if (!adapter->napi_enabled)
539+
return;
540+
541+
for (i = 0; i < adapter->req_rx_queues; i++)
542+
napi_disable(&adapter->napi[i]);
543+
544+
adapter->napi_enabled = false;
545+
}
546+
521547
static int ibmvnic_login(struct net_device *netdev)
522548
{
523549
struct ibmvnic_adapter *adapter = netdev_priv(netdev);
@@ -674,9 +700,7 @@ static int __ibmvnic_open(struct net_device *netdev)
674700

675701
adapter->state = VNIC_OPENING;
676702
replenish_pools(adapter);
677-
678-
for (i = 0; i < adapter->req_rx_queues; i++)
679-
napi_enable(&adapter->napi[i]);
703+
ibmvnic_napi_enable(adapter);
680704

681705
/* We're ready to receive frames, enable the sub-crq interrupts and
682706
* set the logical link state to up
@@ -779,12 +803,7 @@ static int __ibmvnic_close(struct net_device *netdev)
779803

780804
adapter->state = VNIC_CLOSING;
781805
netif_tx_stop_all_queues(netdev);
782-
783-
if (adapter->napi) {
784-
for (i = 0; i < adapter->req_rx_queues; i++)
785-
napi_disable(&adapter->napi[i]);
786-
}
787-
806+
ibmvnic_napi_disable(adapter);
788807
clean_tx_pools(adapter);
789808

790809
if (adapter->tx_scrq) {

drivers/net/ethernet/ibm/ibmvnic.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,4 +1031,5 @@ struct ibmvnic_adapter {
10311031
struct list_head rwi_list;
10321032
struct work_struct ibmvnic_reset;
10331033
bool resetting;
1034+
bool napi_enabled;
10341035
};

0 commit comments

Comments
 (0)