aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bnx2i/bnx2i_hwi.c
diff options
context:
space:
mode:
authorEddie Wai <eddie.wai@broadcom.com>2010-11-23 18:29:20 -0500
committerJames Bottomley <James.Bottomley@suse.de>2010-12-21 13:24:10 -0500
commit5ee32576269f33b66c6dbc98144aead1e74a1e91 (patch)
tree1b570cb71a80227e47979ee190f9bd2ccdc19ba0 /drivers/scsi/bnx2i/bnx2i_hwi.c
parentf0cebfb0177f26e214adca3511f37c089d1317f8 (diff)
[SCSI] bnx2i: Fixed bugs in the handling of unsolicited NOP-Ins
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>
Diffstat (limited to 'drivers/scsi/bnx2i/bnx2i_hwi.c')
-rw-r--r--drivers/scsi/bnx2i/bnx2i_hwi.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c
index 8d9dbb33972f..16c76e0b2318 100644
--- a/drivers/scsi/bnx2i/bnx2i_hwi.c
+++ b/drivers/scsi/bnx2i/bnx2i_hwi.c
@@ -1549,11 +1549,9 @@ static int bnx2i_process_nopin_mesg(struct iscsi_session *session,
1549 struct iscsi_task *task; 1549 struct iscsi_task *task;
1550 struct bnx2i_nop_in_msg *nop_in; 1550 struct bnx2i_nop_in_msg *nop_in;
1551 struct iscsi_nopin *hdr; 1551 struct iscsi_nopin *hdr;
1552 u32 itt;
1553 int tgt_async_nop = 0; 1552 int tgt_async_nop = 0;
1554 1553
1555 nop_in = (struct bnx2i_nop_in_msg *)cqe; 1554 nop_in = (struct bnx2i_nop_in_msg *)cqe;
1556 itt = nop_in->itt & ISCSI_NOP_IN_MSG_INDEX;
1557 1555
1558 spin_lock(&session->lock); 1556 spin_lock(&session->lock);
1559 hdr = (struct iscsi_nopin *)&bnx2i_conn->gen_pdu.resp_hdr; 1557 hdr = (struct iscsi_nopin *)&bnx2i_conn->gen_pdu.resp_hdr;
@@ -1563,7 +1561,7 @@ static int bnx2i_process_nopin_mesg(struct iscsi_session *session,
1563 hdr->exp_cmdsn = cpu_to_be32(nop_in->exp_cmd_sn); 1561 hdr->exp_cmdsn = cpu_to_be32(nop_in->exp_cmd_sn);
1564 hdr->ttt = cpu_to_be32(nop_in->ttt); 1562 hdr->ttt = cpu_to_be32(nop_in->ttt);
1565 1563
1566 if (itt == (u16) RESERVED_ITT) { 1564 if (nop_in->itt == (u16) RESERVED_ITT) {
1567 bnx2i_unsol_pdu_adjust_rq(bnx2i_conn); 1565 bnx2i_unsol_pdu_adjust_rq(bnx2i_conn);
1568 hdr->itt = RESERVED_ITT; 1566 hdr->itt = RESERVED_ITT;
1569 tgt_async_nop = 1; 1567 tgt_async_nop = 1;
@@ -1571,7 +1569,8 @@ static int bnx2i_process_nopin_mesg(struct iscsi_session *session,
1571 } 1569 }
1572 1570
1573 /* this is a response to one of our nop-outs */ 1571 /* this is a response to one of our nop-outs */
1574 task = iscsi_itt_to_task(conn, itt); 1572 task = iscsi_itt_to_task(conn,
1573 (itt_t) (nop_in->itt & ISCSI_NOP_IN_MSG_INDEX));
1575 if (task) { 1574 if (task) {
1576 hdr->flags = ISCSI_FLAG_CMD_FINAL; 1575 hdr->flags = ISCSI_FLAG_CMD_FINAL;
1577 hdr->itt = task->hdr->itt; 1576 hdr->itt = task->hdr->itt;
@@ -1721,9 +1720,18 @@ static void bnx2i_process_new_cqes(struct bnx2i_conn *bnx2i_conn)
1721 if (nopin->cq_req_sn != qp->cqe_exp_seq_sn) 1720 if (nopin->cq_req_sn != qp->cqe_exp_seq_sn)
1722 break; 1721 break;
1723 1722
1724 if (unlikely(test_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx))) 1723 if (unlikely(test_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx))) {
1724 if (nopin->op_code == ISCSI_OP_NOOP_IN &&
1725 nopin->itt == (u16) RESERVED_ITT) {
1726 printk(KERN_ALERT "bnx2i: Unsolicited "
1727 "NOP-In detected for suspended "
1728 "connection dev=%s!\n",
1729 bnx2i_conn->hba->netdev->name);
1730 bnx2i_unsol_pdu_adjust_rq(bnx2i_conn);
1731 goto cqe_out;
1732 }
1725 break; 1733 break;
1726 1734 }
1727 tgt_async_msg = 0; 1735 tgt_async_msg = 0;
1728 1736
1729 switch (nopin->op_code) { 1737 switch (nopin->op_code) {
@@ -1770,10 +1778,9 @@ static void bnx2i_process_new_cqes(struct bnx2i_conn *bnx2i_conn)
1770 printk(KERN_ALERT "bnx2i: unknown opcode 0x%x\n", 1778 printk(KERN_ALERT "bnx2i: unknown opcode 0x%x\n",
1771 nopin->op_code); 1779 nopin->op_code);
1772 } 1780 }
1773
1774 if (!tgt_async_msg) 1781 if (!tgt_async_msg)
1775 bnx2i_conn->ep->num_active_cmds--; 1782 bnx2i_conn->ep->num_active_cmds--;
1776 1783cqe_out:
1777 /* clear out in production version only, till beta keep opcode 1784 /* clear out in production version only, till beta keep opcode
1778 * field intact, will be helpful in debugging (context dump) 1785 * field intact, will be helpful in debugging (context dump)
1779 * nopin->op_code = 0; 1786 * nopin->op_code = 0;