Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cnic: Add timeout for ramrod replies.

If the bnx2x device has encountered parity errors, the chip will not DMA
any replies. Using wait_event_timeout() will allow us to make forward
progress and let bnx2x reset the chip.

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>

authored by

Michael Chan and committed by
David S. Miller
dcc7e3a6 dc219a2e

+13 -7
+10 -7
drivers/net/ethernet/broadcom/cnic.c
··· 1875 1875 hw_cid, NONE_CONNECTION_TYPE, &l5_data); 1876 1876 1877 1877 if (ret == 0) { 1878 - wait_event(ctx->waitq, ctx->wait_cond); 1878 + wait_event_timeout(ctx->waitq, ctx->wait_cond, CNIC_RAMROD_TMO); 1879 1879 if (unlikely(test_bit(CTX_FL_CID_ERROR, &ctx->ctx_flags))) 1880 1880 return -EBUSY; 1881 1881 } 1882 1882 1883 - return ret; 1883 + return 0; 1884 1884 } 1885 1885 1886 1886 static int cnic_bnx2x_iscsi_destroy(struct cnic_dev *dev, struct kwqe *kwqe) ··· 2428 2428 init_waitqueue_head(&ctx->waitq); 2429 2429 ctx->wait_cond = 0; 2430 2430 2431 + memset(&kcqe, 0, sizeof(kcqe)); 2432 + kcqe.completion_status = FCOE_KCQE_COMPLETION_STATUS_ERROR; 2431 2433 memset(&l5_data, 0, sizeof(l5_data)); 2432 2434 ret = cnic_submit_kwqe_16(dev, FCOE_RAMROD_CMD_ID_TERMINATE_CONN, cid, 2433 2435 FCOE_CONNECTION_TYPE, &l5_data); 2434 2436 if (ret == 0) { 2435 - wait_event(ctx->waitq, ctx->wait_cond); 2436 - set_bit(CTX_FL_DELETE_WAIT, &ctx->ctx_flags); 2437 - queue_delayed_work(cnic_wq, &cp->delete_task, 2438 - msecs_to_jiffies(2000)); 2437 + wait_event_timeout(ctx->waitq, ctx->wait_cond, CNIC_RAMROD_TMO); 2438 + if (ctx->wait_cond) 2439 + kcqe.completion_status = 0; 2439 2440 } 2440 2441 2441 - memset(&kcqe, 0, sizeof(kcqe)); 2442 + set_bit(CTX_FL_DELETE_WAIT, &ctx->ctx_flags); 2443 + queue_delayed_work(cnic_wq, &cp->delete_task, msecs_to_jiffies(2000)); 2444 + 2442 2445 kcqe.op_code = FCOE_KCQE_OPCODE_DESTROY_CONN; 2443 2446 kcqe.fcoe_conn_id = req->conn_id; 2444 2447 kcqe.fcoe_conn_context_id = cid;
+2
drivers/net/ethernet/broadcom/cnic.h
··· 474 474 MAX_STAT_COUNTER_ID_E1)) 475 475 #endif 476 476 477 + #define CNIC_RAMROD_TMO (HZ / 4) 478 + 477 479 #endif 478 480
+1
drivers/net/ethernet/broadcom/cnic_defs.h
··· 67 67 #define FCOE_KWQE_OPCODE_DESTROY (10) 68 68 #define FCOE_KWQE_OPCODE_STAT (11) 69 69 70 + #define FCOE_KCQE_COMPLETION_STATUS_ERROR (0x1) 70 71 #define FCOE_KCQE_COMPLETION_STATUS_CTX_ALLOC_FAILURE (0x3) 71 72 72 73 /* KCQ (kernel completion queue) response op codes */