From 9637e17d2d435e1e9d4b662d1405b9cda8d9c21d Mon Sep 17 00:00:00 2001 From: Changpeng Liu Date: Wed, 12 Sep 2018 04:20:08 -0400 Subject: [PATCH] iscsi: reserve value 0xffffffff for TTT in R2T According to RFC3720 10.8.5, value 0xffffffff is reserved for Target Transfer Tag when sending an R2T to initiator. Change-Id: I0d92539d7640d3a4ffc5f8452cfe16f34269e7d0 Signed-off-by: Changpeng Liu Reviewed-on: https://review.gerrithub.io/425369 Reviewed-by: Shuhei Matsumoto Reviewed-by: Jim Harris Reviewed-by: Ben Walker Tested-by: SPDK CI Jenkins Chandler-Test-Pool: SPDK Automated Test System --- lib/iscsi/iscsi.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/iscsi/iscsi.c b/lib/iscsi/iscsi.c index b0fa9aded7..99fd851ccb 100644 --- a/lib/iscsi/iscsi.c +++ b/lib/iscsi/iscsi.c @@ -3398,7 +3398,13 @@ spdk_add_transfer_task(struct spdk_iscsi_conn *conn, task->next_expected_r2t_offset = data_len; task->current_r2t_length = 0; task->R2TSN = 0; - task->ttt = ++conn->ttt; + /* According to RFC3720 10.8.5, 0xffffffff is + * reserved for TTT in R2T. + */ + if (++conn->ttt == 0xffffffffu) { + conn->ttt = 0; + } + task->ttt = conn->ttt; while (data_len != transfer_len) { len = DMIN32(max_burst_len, (transfer_len - data_len));