Skip to content

Commit d6b6373

Browse files
author
root
committed
increase the timeout to 28s
1 parent 23333b6 commit d6b6373

File tree

3 files changed

+22
-14
lines changed

3 files changed

+22
-14
lines changed

include/spdk/nvmf_transport.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ int spdk_nvmf_request_get_buffers(struct spdk_nvmf_request *req,
517517
bool spdk_nvmf_request_get_dif_ctx(struct spdk_nvmf_request *req, struct spdk_dif_ctx *dif_ctx);
518518

519519
void spdk_nvmf_request_exec(struct spdk_nvmf_request *req);
520-
char *spdk_nvmf_request_nqn(struct spdk_nvmf_request *req);
520+
char *spdk_nvmf_request_nqn(struct spdk_nvmf_request *req, uint8_t idx);
521521
void spdk_nvmf_request_exec_fabrics(struct spdk_nvmf_request *req);
522522
int spdk_nvmf_request_free(struct spdk_nvmf_request *req);
523523
int spdk_nvmf_request_complete(struct spdk_nvmf_request *req);

lib/nvmf/ctrlr.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -4714,14 +4714,14 @@ nvmf_check_qpair_active(struct spdk_nvmf_request *req)
47144714
}
47154715

47164716
char *
4717-
spdk_nvmf_request_nqn(struct spdk_nvmf_request *req)
4717+
spdk_nvmf_request_nqn(struct spdk_nvmf_request *req, uint8_t idx)
47184718
{
47194719
struct spdk_nvmf_qpair *qpair = req->qpair;
47204720
struct spdk_nvmf_ctrlr *ctrlr;
47214721
if (qpair->ctrlr && qpair->qid != 0) {
47224722
ctrlr = qpair->ctrlr;
47234723
if (ctrlr->subsys) {
4724-
return &ctrlr->subsys->subnqn[67];
4724+
return &ctrlr->subsys->subnqn[idx];
47254725
}
47264726
}
47274727
return NULL;

lib/nvmf/tcp.c

+19-11
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ struct spdk_nvmf_tcp_qpair {
310310
void *fini_cb_arg;
311311
bool dump;
312312
uint64_t time;
313-
313+
uint64_t ticks_hz;
314314
TAILQ_ENTRY(spdk_nvmf_tcp_qpair) link;
315315
};
316316

@@ -539,7 +539,7 @@ nvmf_tcp_dump_qpair_req_contents(struct spdk_nvmf_tcp_qpair *tqpair)
539539
// }
540540
// }
541541

542-
char buf[1024]; // Adjust the size as necessary
542+
char buf[255]; // Adjust the size as necessary
543543
int offset = 0;
544544

545545
// Build the string with all states
@@ -1362,6 +1362,7 @@ nvmf_tcp_handle_connect(struct spdk_nvmf_transport *transport,
13621362
tqpair->state_cntr[TCP_REQUEST_STATE_FREE] = 0;
13631363
tqpair->port = port;
13641364
tqpair->qpair.transport = transport;
1365+
tqpair->ticks_hz = spdk_get_ticks_hz();
13651366

13661367
rc = spdk_sock_getaddr(tqpair->sock, tqpair->target_addr,
13671368
sizeof(tqpair->target_addr), &tqpair->target_port,
@@ -2909,21 +2910,28 @@ nvme_command_string(uint16_t value)
29092910

29102911
static void
29112912
check_time(struct spdk_nvmf_tcp_req *tcp_req, struct spdk_nvmf_tcp_qpair *tqpair) {
2912-
if (!tcp_req->loged && tcp_req->time && (tqpair->target_port <= 9099 && tqpair->target_port >= 9090)) {
2913-
if (((spdk_get_ticks() - tcp_req->time) > spdk_get_ticks_hz() * 2) && tqpair->qpair.qid) {
2914-
char *uuid = spdk_nvmf_request_nqn(&tcp_req->req);
2915-
if (!uuid) {
2916-
uuid = "";
2917-
}
2918-
SPDK_NOTICELOG("ttag %d (QID %d) cp %d sp %d, cmd %s, nqn %s\n",
2913+
if (!tcp_req->loged && tcp_req->time && tqpair->qpair.qid) {
2914+
uint64_t current = spdk_get_ticks();
2915+
uint8_t idx = (tqpair->target_port == 4420) ? 32 : 67;
2916+
// Check if more than 28 ticks have passed since tcp_req->time
2917+
if ((current - tcp_req->time) > tqpair->ticks_hz * 28) {
2918+
char *uuid = spdk_nvmf_request_nqn(&tcp_req->req, idx);
2919+
uuid = (uuid) ? uuid : ""; // Handle NULL UUID
2920+
2921+
// Log relevant information
2922+
SPDK_NOTICELOG("ttag %d (QID %d) cp %d sp %d, cmd %s, nqn %s\n",
29192923
tcp_req->ttag, tqpair->qpair.qid, tqpair->initiator_port,
29202924
tqpair->target_port, nvme_command_string(tcp_req->cmd.opc), uuid);
29212925
// spdk_nvmf_request_nqn(&tcp_req->req);
29222926
// spdk_nvme_print_command_s(tqpair->qpair.qid, &tcp_req->cmd);
2923-
if (tqpair->qpair.qid && ((spdk_get_ticks() - tqpair->time) > spdk_get_ticks_hz() * 15)) {
2927+
2928+
// If more than 30 ticks have passed for the qpair, dump its contents
2929+
if ((current - tqpair->time) > tqpair->ticks_hz * 30) {
29242930
nvmf_tcp_dump_qpair_req_contents(tqpair);
2925-
tqpair->time = spdk_get_ticks();
2931+
tqpair->time = current;
29262932
}
2933+
2934+
// Mark the request as logged
29272935
tcp_req->loged = true;
29282936
}
29292937
}

0 commit comments

Comments
 (0)