aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/fcoe/fcoe.c
diff options
context:
space:
mode:
authorYi Zou <yi.zou@intel.com>2012-01-13 20:26:15 -0500
committerJames Bottomley <JBottomley@Parallels.com>2012-01-16 03:44:28 -0500
commita762dce41cb5742a143f6aa2d80ee1aac7e1f5eb (patch)
tree173bd7ca3d621f073d8a8ed887c39c7c0dd926f3 /drivers/scsi/fcoe/fcoe.c
parent19b628dfc60eda4459b65e4b6b7a748932d28929 (diff)
[SCSI] fcoe: fix regression on offload em matching function for initiator/target
This is a regression introduced by commit 1ff9918b625457ce20d450d00f9ed0a12ba191b7 The else statement here is breaking the initiator logic of allocating xid from the offloaded em xid pool for READ I/O only to use DDP, as shown by the snippet of trace below, where the WRITE is using xid 0x5 from the offloaded em xid pool: Protocol VID Len S_ID D_ID OX_ID RX_ID Summary .. *FCP 228 96 0b.08.01 -> 01.0f.00 0x0005 0xffff SCSI: Write(10) LUN: 0x00 FCP 228 76 01.0f.00 -> 0b.08.01 0x0005 0x828d XFER_RDY ... The bug is in the else statement, for both initiator and target, the new command will have FC frame header bit 23 (FC_FC_EX_CTX) cleared as it was originated from the initiator. Also, this is assuming the frame header is already filled up, which is only true for target since for initiator, this is a new frame and oem_match gets called when em tries get xid for this i/o before it is filled up and sent out. The fix is to check if there is a fc_fcp_pkt associated w/ this frame from fr_fsp(fp), since fr_fsp(fp) is NULL for tcm_fc target and non-I/O frame in initiator. This should also return true for target only if it is an FC_RCTL_DD_UNSOL_CMD and rx_id is not allocated. Signed-off-by: Yi Zou <yi.zou@intel.com> Tested-by: Ross Brattain <ross.b.brattain@intel.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/fcoe/fcoe.c')
-rw-r--r--drivers/scsi/fcoe/fcoe.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index e535f95e4772..507504b77880 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -756,11 +756,12 @@ bool fcoe_oem_match(struct fc_frame *fp)
756 if (fc_fcp_is_read(fr_fsp(fp)) && 756 if (fc_fcp_is_read(fr_fsp(fp)) &&
757 (fr_fsp(fp)->data_len > fcoe_ddp_min)) 757 (fr_fsp(fp)->data_len > fcoe_ddp_min))
758 return true; 758 return true;
759 else if (!(ntoh24(fh->fh_f_ctl) & FC_FC_EX_CTX)) { 759 else if ((fr_fsp(fp) == NULL) &&
760 (fh->fh_r_ctl == FC_RCTL_DD_UNSOL_CMD) &&
761 (ntohs(fh->fh_rx_id) == FC_XID_UNKNOWN)) {
760 fcp = fc_frame_payload_get(fp, sizeof(*fcp)); 762 fcp = fc_frame_payload_get(fp, sizeof(*fcp));
761 if (ntohs(fh->fh_rx_id) == FC_XID_UNKNOWN && 763 if ((fcp->fc_flags & FCP_CFL_WRDATA) &&
762 fcp && (ntohl(fcp->fc_dl) > fcoe_ddp_min) && 764 (ntohl(fcp->fc_dl) > fcoe_ddp_min))
763 (fcp->fc_flags & FCP_CFL_WRDATA))
764 return true; 765 return true;
765 } 766 }
766 return false; 767 return false;