Skip to content

Commit

Permalink
cxgb4: avoid stall while shutting down the adapter
Browse files Browse the repository at this point in the history
do not wait for completion while deleting the filters
when the adapter is shutting down because we may not get
the response as interrupts will be disabled.

Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ganesh Goudar authored and David S. Miller committed Sep 21, 2017
1 parent 51957bc commit e1f6198
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@ enum { /* adapter flags */
MASTER_PF = (1 << 7),
FW_OFLD_CONN = (1 << 9),
ROOT_NO_RELAXED_ORDERING = (1 << 10),
SHUTTING_DOWN = (1 << 11),
};

enum {
Expand Down
7 changes: 6 additions & 1 deletion drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ static int del_filter_wr(struct adapter *adapter, int fidx)
return -ENOMEM;

fwr = __skb_put(skb, len);
t4_mk_filtdelwr(f->tid, fwr, adapter->sge.fw_evtq.abs_id);
t4_mk_filtdelwr(f->tid, fwr, (adapter->flags & SHUTTING_DOWN) ? -1
: adapter->sge.fw_evtq.abs_id);

/* Mark the filter as "pending" and ship off the Filter Work Request.
* When we get the Work Request Reply we'll clear the pending status.
Expand Down Expand Up @@ -636,6 +637,10 @@ int cxgb4_del_filter(struct net_device *dev, int filter_id)
struct filter_ctx ctx;
int ret;

/* If we are shutting down the adapter do not wait for completion */
if (netdev2adap(dev)->flags & SHUTTING_DOWN)
return __cxgb4_del_filter(dev, filter_id, NULL);

init_completion(&ctx.completion);

ret = __cxgb4_del_filter(dev, filter_id, &ctx);
Expand Down
4 changes: 4 additions & 0 deletions drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -5254,6 +5254,8 @@ static void remove_one(struct pci_dev *pdev)
return;
}

adapter->flags |= SHUTTING_DOWN;

if (adapter->pf == 4) {
int i;

Expand Down Expand Up @@ -5339,6 +5341,8 @@ static void shutdown_one(struct pci_dev *pdev)
return;
}

adapter->flags |= SHUTTING_DOWN;

if (adapter->pf == 4) {
int i;

Expand Down

0 comments on commit e1f6198

Please sign in to comment.