Skip to content

Commit

Permalink
[SCSI] bnx2i: Fixed bugs in the handling of unsolicited NOP-Ins
Browse files Browse the repository at this point in the history
Unsolicited NOP-Ins are placed in the receive queue of the hardware
which requires to be read out regardless if the receive pipe is suspended
or not.  This patch adds the disposal of this RQ element under this
condition.
Also fixed the bug in the unsolicited NOP-In handling routine which
checks for the RESERVED_ITT.

Signed-off-by: Eddie Wai <eddie.wai@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Reviewed-by: Benjamin Li <benli@broadcom.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
  • Loading branch information
Eddie Wai authored and James Bottomley committed Dec 21, 2010
1 parent f0cebfb commit 5ee3257
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions drivers/scsi/bnx2i/bnx2i_hwi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1549,11 +1549,9 @@ static int bnx2i_process_nopin_mesg(struct iscsi_session *session,
struct iscsi_task *task;
struct bnx2i_nop_in_msg *nop_in;
struct iscsi_nopin *hdr;
u32 itt;
int tgt_async_nop = 0;

nop_in = (struct bnx2i_nop_in_msg *)cqe;
itt = nop_in->itt & ISCSI_NOP_IN_MSG_INDEX;

spin_lock(&session->lock);
hdr = (struct iscsi_nopin *)&bnx2i_conn->gen_pdu.resp_hdr;
Expand All @@ -1563,15 +1561,16 @@ static int bnx2i_process_nopin_mesg(struct iscsi_session *session,
hdr->exp_cmdsn = cpu_to_be32(nop_in->exp_cmd_sn);
hdr->ttt = cpu_to_be32(nop_in->ttt);

if (itt == (u16) RESERVED_ITT) {
if (nop_in->itt == (u16) RESERVED_ITT) {
bnx2i_unsol_pdu_adjust_rq(bnx2i_conn);
hdr->itt = RESERVED_ITT;
tgt_async_nop = 1;
goto done;
}

/* this is a response to one of our nop-outs */
task = iscsi_itt_to_task(conn, itt);
task = iscsi_itt_to_task(conn,
(itt_t) (nop_in->itt & ISCSI_NOP_IN_MSG_INDEX));
if (task) {
hdr->flags = ISCSI_FLAG_CMD_FINAL;
hdr->itt = task->hdr->itt;
Expand Down Expand Up @@ -1721,9 +1720,18 @@ static void bnx2i_process_new_cqes(struct bnx2i_conn *bnx2i_conn)
if (nopin->cq_req_sn != qp->cqe_exp_seq_sn)
break;

if (unlikely(test_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx)))
if (unlikely(test_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx))) {
if (nopin->op_code == ISCSI_OP_NOOP_IN &&
nopin->itt == (u16) RESERVED_ITT) {
printk(KERN_ALERT "bnx2i: Unsolicited "
"NOP-In detected for suspended "
"connection dev=%s!\n",
bnx2i_conn->hba->netdev->name);
bnx2i_unsol_pdu_adjust_rq(bnx2i_conn);
goto cqe_out;
}
break;

}
tgt_async_msg = 0;

switch (nopin->op_code) {
Expand Down Expand Up @@ -1770,10 +1778,9 @@ static void bnx2i_process_new_cqes(struct bnx2i_conn *bnx2i_conn)
printk(KERN_ALERT "bnx2i: unknown opcode 0x%x\n",
nopin->op_code);
}

if (!tgt_async_msg)
bnx2i_conn->ep->num_active_cmds--;

cqe_out:
/* clear out in production version only, till beta keep opcode
* field intact, will be helpful in debugging (context dump)
* nopin->op_code = 0;
Expand Down

0 comments on commit 5ee3257

Please sign in to comment.