Commit dcc7e3a6 authored by Michael Chan's avatar Michael Chan Committed by David S. Miller

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: default avatarMichael Chan <mchan@broadcom.com>
Reviewed-by: default avatarBhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent dc219a2e
...@@ -1875,12 +1875,12 @@ static int cnic_bnx2x_destroy_ramrod(struct cnic_dev *dev, u32 l5_cid) ...@@ -1875,12 +1875,12 @@ static int cnic_bnx2x_destroy_ramrod(struct cnic_dev *dev, u32 l5_cid)
hw_cid, NONE_CONNECTION_TYPE, &l5_data); hw_cid, NONE_CONNECTION_TYPE, &l5_data);
if (ret == 0) { if (ret == 0) {
wait_event(ctx->waitq, ctx->wait_cond); wait_event_timeout(ctx->waitq, ctx->wait_cond, CNIC_RAMROD_TMO);
if (unlikely(test_bit(CTX_FL_CID_ERROR, &ctx->ctx_flags))) if (unlikely(test_bit(CTX_FL_CID_ERROR, &ctx->ctx_flags)))
return -EBUSY; return -EBUSY;
} }
return ret; return 0;
} }
static int cnic_bnx2x_iscsi_destroy(struct cnic_dev *dev, struct kwqe *kwqe) static int cnic_bnx2x_iscsi_destroy(struct cnic_dev *dev, struct kwqe *kwqe)
...@@ -2428,17 +2428,20 @@ static int cnic_bnx2x_fcoe_destroy(struct cnic_dev *dev, struct kwqe *kwqe) ...@@ -2428,17 +2428,20 @@ static int cnic_bnx2x_fcoe_destroy(struct cnic_dev *dev, struct kwqe *kwqe)
init_waitqueue_head(&ctx->waitq); init_waitqueue_head(&ctx->waitq);
ctx->wait_cond = 0; ctx->wait_cond = 0;
memset(&kcqe, 0, sizeof(kcqe));
kcqe.completion_status = FCOE_KCQE_COMPLETION_STATUS_ERROR;
memset(&l5_data, 0, sizeof(l5_data)); memset(&l5_data, 0, sizeof(l5_data));
ret = cnic_submit_kwqe_16(dev, FCOE_RAMROD_CMD_ID_TERMINATE_CONN, cid, ret = cnic_submit_kwqe_16(dev, FCOE_RAMROD_CMD_ID_TERMINATE_CONN, cid,
FCOE_CONNECTION_TYPE, &l5_data); FCOE_CONNECTION_TYPE, &l5_data);
if (ret == 0) { if (ret == 0) {
wait_event(ctx->waitq, ctx->wait_cond); wait_event_timeout(ctx->waitq, ctx->wait_cond, CNIC_RAMROD_TMO);
set_bit(CTX_FL_DELETE_WAIT, &ctx->ctx_flags); if (ctx->wait_cond)
queue_delayed_work(cnic_wq, &cp->delete_task, kcqe.completion_status = 0;
msecs_to_jiffies(2000));
} }
memset(&kcqe, 0, sizeof(kcqe)); set_bit(CTX_FL_DELETE_WAIT, &ctx->ctx_flags);
queue_delayed_work(cnic_wq, &cp->delete_task, msecs_to_jiffies(2000));
kcqe.op_code = FCOE_KCQE_OPCODE_DESTROY_CONN; kcqe.op_code = FCOE_KCQE_OPCODE_DESTROY_CONN;
kcqe.fcoe_conn_id = req->conn_id; kcqe.fcoe_conn_id = req->conn_id;
kcqe.fcoe_conn_context_id = cid; kcqe.fcoe_conn_context_id = cid;
......
...@@ -474,5 +474,7 @@ struct bnx2x_bd_chain_next { ...@@ -474,5 +474,7 @@ struct bnx2x_bd_chain_next {
MAX_STAT_COUNTER_ID_E1)) MAX_STAT_COUNTER_ID_E1))
#endif #endif
#define CNIC_RAMROD_TMO (HZ / 4)
#endif #endif
...@@ -67,6 +67,7 @@ ...@@ -67,6 +67,7 @@
#define FCOE_KWQE_OPCODE_DESTROY (10) #define FCOE_KWQE_OPCODE_DESTROY (10)
#define FCOE_KWQE_OPCODE_STAT (11) #define FCOE_KWQE_OPCODE_STAT (11)
#define FCOE_KCQE_COMPLETION_STATUS_ERROR (0x1)
#define FCOE_KCQE_COMPLETION_STATUS_CTX_ALLOC_FAILURE (0x3) #define FCOE_KCQE_COMPLETION_STATUS_CTX_ALLOC_FAILURE (0x3)
/* KCQ (kernel completion queue) response op codes */ /* KCQ (kernel completion queue) response op codes */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment