Skip to content

Commit 74e49bb

Browse files
Michael Chandavem330
authored andcommitted
cnic: Wait for all Context IDs to be deleted before sending FCOE_DESTROY_FUNC
Otherwise, the firmware will not respond and we'll have to wait for timeout. Refactor the wait loop we already have into a separate function for this purpose. Signed-off-by: Michael Chan <mchan@broadcom.com> Reviewed-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent b37a41e commit 74e49bb

1 file changed

Lines changed: 27 additions & 18 deletions

File tree

‎drivers/net/cnic.c‎

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2448,6 +2448,30 @@ static int cnic_bnx2x_fcoe_destroy(struct cnic_dev *dev, struct kwqe *kwqe)
24482448
return ret;
24492449
}
24502450

2451+
static void cnic_bnx2x_delete_wait(struct cnic_dev *dev, u32 start_cid)
2452+
{
2453+
struct cnic_local *cp = dev->cnic_priv;
2454+
u32 i;
2455+
2456+
for (i = start_cid; i < cp->max_cid_space; i++) {
2457+
struct cnic_context *ctx = &cp->ctx_tbl[i];
2458+
int j;
2459+
2460+
while (test_bit(CTX_FL_DELETE_WAIT, &ctx->ctx_flags))
2461+
msleep(10);
2462+
2463+
for (j = 0; j < 5; j++) {
2464+
if (!test_bit(CTX_FL_OFFLD_START, &ctx->ctx_flags))
2465+
break;
2466+
msleep(20);
2467+
}
2468+
2469+
if (test_bit(CTX_FL_OFFLD_START, &ctx->ctx_flags))
2470+
netdev_warn(dev->netdev, "CID %x not deleted\n",
2471+
ctx->cid);
2472+
}
2473+
}
2474+
24512475
static int cnic_bnx2x_fcoe_fw_destroy(struct cnic_dev *dev, struct kwqe *kwqe)
24522476
{
24532477
struct fcoe_kwqe_destroy *req;
@@ -2456,6 +2480,8 @@ static int cnic_bnx2x_fcoe_fw_destroy(struct cnic_dev *dev, struct kwqe *kwqe)
24562480
int ret;
24572481
u32 cid;
24582482

2483+
cnic_bnx2x_delete_wait(dev, MAX_ISCSI_TBL_SZ);
2484+
24592485
req = (struct fcoe_kwqe_destroy *) kwqe;
24602486
cid = BNX2X_HW_CID(cp, cp->fcoe_init_cid);
24612487

@@ -3930,31 +3956,14 @@ static void cnic_close_bnx2x_conn(struct cnic_sock *csk, u32 opcode)
39303956
static void cnic_cm_stop_bnx2x_hw(struct cnic_dev *dev)
39313957
{
39323958
struct cnic_local *cp = dev->cnic_priv;
3933-
int i;
39343959

39353960
if (!cp->ctx_tbl)
39363961
return;
39373962

39383963
if (!netif_running(dev->netdev))
39393964
return;
39403965

3941-
for (i = 0; i < cp->max_cid_space; i++) {
3942-
struct cnic_context *ctx = &cp->ctx_tbl[i];
3943-
int j;
3944-
3945-
while (test_bit(CTX_FL_DELETE_WAIT, &ctx->ctx_flags))
3946-
msleep(10);
3947-
3948-
for (j = 0; j < 5; j++) {
3949-
if (!test_bit(CTX_FL_OFFLD_START, &ctx->ctx_flags))
3950-
break;
3951-
msleep(20);
3952-
}
3953-
3954-
if (test_bit(CTX_FL_OFFLD_START, &ctx->ctx_flags))
3955-
netdev_warn(dev->netdev, "CID %x not deleted\n",
3956-
ctx->cid);
3957-
}
3966+
cnic_bnx2x_delete_wait(dev, 0);
39583967

39593968
cancel_delayed_work(&cp->delete_task);
39603969
flush_workqueue(cnic_wq);

0 commit comments

Comments
 (0)