提交 a762dce4 编写于 作者: Y Yi Zou 提交者: James Bottomley

[SCSI] fcoe: fix regression on offload em matching function for initiator/target

This is a regression introduced by commit
1ff9918b 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: NYi Zou <yi.zou@intel.com>
Tested-by: NRoss Brattain <ross.b.brattain@intel.com>
Signed-off-by: NRobert Love <robert.w.love@intel.com>
Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
上级 19b628df
......@@ -756,11 +756,12 @@ bool fcoe_oem_match(struct fc_frame *fp)
if (fc_fcp_is_read(fr_fsp(fp)) &&
(fr_fsp(fp)->data_len > fcoe_ddp_min))
return true;
else if (!(ntoh24(fh->fh_f_ctl) & FC_FC_EX_CTX)) {
else if ((fr_fsp(fp) == NULL) &&
(fh->fh_r_ctl == FC_RCTL_DD_UNSOL_CMD) &&
(ntohs(fh->fh_rx_id) == FC_XID_UNKNOWN)) {
fcp = fc_frame_payload_get(fp, sizeof(*fcp));
if (ntohs(fh->fh_rx_id) == FC_XID_UNKNOWN &&
fcp && (ntohl(fcp->fc_dl) > fcoe_ddp_min) &&
(fcp->fc_flags & FCP_CFL_WRDATA))
if ((fcp->fc_flags & FCP_CFL_WRDATA) &&
(ntohl(fcp->fc_dl) > fcoe_ddp_min))
return true;
}
return false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册