From 444cf90c724b8e177e9628bd79b17b22531bd690 Mon Sep 17 00:00:00 2001 From: Ben Walker Date: Tue, 21 Jan 2020 09:49:59 -0700 Subject: [PATCH] nvmf/tcp: Change qpair's state_cntr array to uint32_t These values do not need to be negative. Change-Id: Id9f798cf1c9da354448f9c6fbb90e599f877bb32 Signed-off-by: Ben Walker Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482277 Community-CI: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto Reviewed-by: Alexey Marchuk Tested-by: SPDK CI Jenkins --- lib/nvmf/tcp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/nvmf/tcp.c b/lib/nvmf/tcp.c index d6750cf08..6fd72bd4b 100644 --- a/lib/nvmf/tcp.c +++ b/lib/nvmf/tcp.c @@ -223,7 +223,7 @@ struct spdk_nvmf_tcp_qpair { /* Queues to track the requests in all states */ TAILQ_HEAD(, spdk_nvmf_tcp_req) state_queue[TCP_REQUEST_NUM_STATES]; /* Number of requests in each state */ - int32_t state_cntr[TCP_REQUEST_NUM_STATES]; + uint32_t state_cntr[TCP_REQUEST_NUM_STATES]; STAILQ_HEAD(, spdk_nvmf_tcp_req) queued_c2h_data_tcp_req; @@ -303,8 +303,8 @@ spdk_nvmf_tcp_req_set_state(struct spdk_nvmf_tcp_req *tcp_req, tqpair = SPDK_CONTAINEROF(qpair, struct spdk_nvmf_tcp_qpair, qpair); TAILQ_REMOVE(&tqpair->state_queue[tcp_req->state], tcp_req, state_link); + assert(tqpair->state_cntr[tcp_req->state] > 0); tqpair->state_cntr[tcp_req->state]--; - assert(tqpair->state_cntr[tcp_req->state] >= 0); TAILQ_INSERT_TAIL(&tqpair->state_queue[state], tcp_req, state_link); tqpair->state_cntr[state]++; @@ -430,7 +430,7 @@ nvmf_tcp_dump_qpair_req_contents(struct spdk_nvmf_tcp_qpair *tqpair) SPDK_ERRLOG("Dumping contents of queue pair (QID %d)\n", tqpair->qpair.qid); for (i = 1; i < TCP_REQUEST_NUM_STATES; i++) { - SPDK_ERRLOG("\tNum of requests in state[%d] = %d\n", i, tqpair->state_cntr[i]); + SPDK_ERRLOG("\tNum of requests in state[%d] = %u\n", i, tqpair->state_cntr[i]); TAILQ_FOREACH(tcp_req, &tqpair->state_queue[i], state_link) { SPDK_ERRLOG("\t\tRequest Data From Pool: %d\n", tcp_req->req.data_from_pool); SPDK_ERRLOG("\t\tRequest opcode: %d\n", tcp_req->req.cmd->nvmf_cmd.opcode);