lib/iscsi: Use cached pdu->data_segment_len throughout in iscsi_pdu_hdr_op_scsi()
Data segment length of the PDU is already cached in pdu->data_segment_len. Hence additional caching to the local variable data_len is not necessary. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: I1e596999640229b1b0fa85cbdb342b1636af5076 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471879 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
parent
bb61fabf26
commit
22f4e0a12f
@ -3382,7 +3382,6 @@ iscsi_pdu_hdr_op_scsi(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
|
||||
uint8_t *cdb;
|
||||
uint64_t lun;
|
||||
uint32_t task_tag;
|
||||
uint32_t data_len;
|
||||
uint32_t transfer_len;
|
||||
int R_bit, W_bit;
|
||||
int lun_i;
|
||||
@ -3399,7 +3398,6 @@ iscsi_pdu_hdr_op_scsi(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
|
||||
W_bit = reqh->write_bit;
|
||||
lun = from_be64(&reqh->lun);
|
||||
task_tag = from_be32(&reqh->itt);
|
||||
data_len = pdu->data_segment_len;
|
||||
transfer_len = from_be32(&reqh->expected_data_xfer_len);
|
||||
cdb = reqh->cdb;
|
||||
|
||||
@ -3465,8 +3463,8 @@ iscsi_pdu_hdr_op_scsi(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
|
||||
}
|
||||
|
||||
/* check the ImmediateData and also pdu->data_segment_len */
|
||||
if ((!conn->sess->ImmediateData && (data_len > 0)) ||
|
||||
(data_len > conn->sess->FirstBurstLength)) {
|
||||
if ((!conn->sess->ImmediateData && (pdu->data_segment_len > 0)) ||
|
||||
(pdu->data_segment_len > conn->sess->FirstBurstLength)) {
|
||||
spdk_iscsi_task_put(task);
|
||||
return iscsi_reject(conn, pdu, ISCSI_REASON_PROTOCOL_ERROR);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user