From 97768b0773aae7ec2606ae7fa6b9891f63e878ef Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Thu, 14 Feb 2019 17:05:50 +0900 Subject: [PATCH] iscsi: Replace helper function spdk_get_data_out_buffer_size() by macro constant The helper function spdk_get_data_out_buffer_size() is a little confusing because it does only returning macro constant SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH. The macro constant will be configurable and so the helper function is not sustainable. Replace the helper function simply by the macro constant. Change-Id: I4ec300f61783da7bb712512603c2dd80987ec702 Signed-off-by: Shuhei Matsumoto Reviewed-on: https://review.gerrithub.io/c/444537 Tested-by: SPDK CI Jenkins Reviewed-by: Pawel Wodkowski Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- lib/iscsi/iscsi.c | 6 +++--- lib/iscsi/iscsi.h | 6 ------ lib/iscsi/iscsi_subsystem.c | 2 +- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/iscsi/iscsi.c b/lib/iscsi/iscsi.c index 93e4b6c3b..dfeba61f4 100644 --- a/lib/iscsi/iscsi.c +++ b/lib/iscsi/iscsi.c @@ -429,11 +429,11 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu) if (pdu->data_buf == NULL) { if (data_len <= spdk_get_immediate_data_buffer_size()) { pool = g_spdk_iscsi.pdu_immediate_data_pool; - } else if (data_len <= spdk_get_data_out_buffer_size()) { + } else if (data_len <= SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH) { pool = g_spdk_iscsi.pdu_data_out_pool; } else { SPDK_ERRLOG("Data(%d) > MaxSegment(%d)\n", - data_len, spdk_get_data_out_buffer_size()); + data_len, SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH); *_pdu = NULL; spdk_put_pdu(pdu); conn->pdu_in_progress = NULL; @@ -513,7 +513,7 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu) */ max_segment_len = SPDK_ISCSI_FIRST_BURST_LENGTH; } else if (pdu->bhs.opcode == ISCSI_OP_SCSI_DATAOUT) { - max_segment_len = spdk_get_data_out_buffer_size(); + max_segment_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH; } else if (pdu->bhs.opcode == ISCSI_OP_NOPOUT) { max_segment_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH; } else { diff --git a/lib/iscsi/iscsi.h b/lib/iscsi/iscsi.h index ad7b1bc02..9871542f9 100644 --- a/lib/iscsi/iscsi.h +++ b/lib/iscsi/iscsi.h @@ -461,10 +461,4 @@ spdk_get_immediate_data_buffer_size(void) 52; /* extended CDB AHS (for a 64-byte CDB) */ } -static inline int -spdk_get_data_out_buffer_size(void) -{ - return SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH; -} - #endif /* SPDK_ISCSI_H */ diff --git a/lib/iscsi/iscsi_subsystem.c b/lib/iscsi/iscsi_subsystem.c index 01d68b34e..87340e7ab 100644 --- a/lib/iscsi/iscsi_subsystem.c +++ b/lib/iscsi/iscsi_subsystem.c @@ -147,7 +147,7 @@ static int spdk_iscsi_initialize_pdu_pool(void) struct spdk_iscsi_globals *iscsi = &g_spdk_iscsi; int imm_mobj_size = spdk_get_immediate_data_buffer_size() + sizeof(struct spdk_mobj) + ISCSI_DATA_BUFFER_ALIGNMENT; - int dout_mobj_size = spdk_get_data_out_buffer_size() + + int dout_mobj_size = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH + sizeof(struct spdk_mobj) + ISCSI_DATA_BUFFER_ALIGNMENT; /* create PDU pool */