lib/iscsi: Move down iscsi_get_pdu_length() in a file
Move iscsi_get_pdu_length() down closer to the caller. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: Iacbe43d39f5b23c47a65631ae8004fcfb489e2cc Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/477410 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
3a58b2fb2f
commit
18609b025f
@ -1197,36 +1197,6 @@ spdk_iscsi_task_cpl(struct spdk_scsi_task *scsi_task)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
iscsi_get_pdu_length(struct spdk_iscsi_pdu *pdu, int header_digest,
|
|
||||||
int data_digest)
|
|
||||||
{
|
|
||||||
int data_len, enable_digest, total;
|
|
||||||
|
|
||||||
enable_digest = 1;
|
|
||||||
if (pdu->bhs.opcode == ISCSI_OP_LOGIN_RSP) {
|
|
||||||
enable_digest = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
total = ISCSI_BHS_LEN;
|
|
||||||
|
|
||||||
total += (4 * pdu->bhs.total_ahs_len);
|
|
||||||
|
|
||||||
if (enable_digest && header_digest) {
|
|
||||||
total += ISCSI_DIGEST_LEN;
|
|
||||||
}
|
|
||||||
|
|
||||||
data_len = DGET24(pdu->bhs.data_segment_len);
|
|
||||||
if (data_len > 0) {
|
|
||||||
total += ISCSI_ALIGN(data_len);
|
|
||||||
if (enable_digest && data_digest) {
|
|
||||||
total += ISCSI_DIGEST_LEN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return total;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
iscsi_conn_send_nopin(struct spdk_iscsi_conn *conn)
|
iscsi_conn_send_nopin(struct spdk_iscsi_conn *conn)
|
||||||
{
|
{
|
||||||
@ -1296,6 +1266,36 @@ spdk_iscsi_conn_handle_nop(struct spdk_iscsi_conn *conn)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
iscsi_get_pdu_length(struct spdk_iscsi_pdu *pdu, int header_digest,
|
||||||
|
int data_digest)
|
||||||
|
{
|
||||||
|
int data_len, enable_digest, total;
|
||||||
|
|
||||||
|
enable_digest = 1;
|
||||||
|
if (pdu->bhs.opcode == ISCSI_OP_LOGIN_RSP) {
|
||||||
|
enable_digest = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
total = ISCSI_BHS_LEN;
|
||||||
|
|
||||||
|
total += (4 * pdu->bhs.total_ahs_len);
|
||||||
|
|
||||||
|
if (enable_digest && header_digest) {
|
||||||
|
total += ISCSI_DIGEST_LEN;
|
||||||
|
}
|
||||||
|
|
||||||
|
data_len = DGET24(pdu->bhs.data_segment_len);
|
||||||
|
if (data_len > 0) {
|
||||||
|
total += ISCSI_ALIGN(data_len);
|
||||||
|
if (enable_digest && data_digest) {
|
||||||
|
total += ISCSI_DIGEST_LEN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
iscsi_is_free_pdu_deferred(struct spdk_iscsi_pdu *pdu)
|
iscsi_is_free_pdu_deferred(struct spdk_iscsi_pdu *pdu)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user