Skip to content

Commit 86ceb42

Browse files
hreineckeigaw
authored andcommitted
nvme.i: decode 'tsas' discovery log page entry
Decode the 'tsas' discovery log page entry to get information about any TCP 'sectype' settings. Signed-off-by: Hannes Reinecke <hare@suse.de>
1 parent b686562 commit 86ceb42

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

libnvme/nvme.i

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,75 @@ PyObject *hostid_from_file();
309309
}
310310
PyDict_SetItemStringDecRef(entry, "treq", val);
311311

312+
if (e->trtype == NVMF_TRTYPE_TCP) {
313+
PyObject *tsas = PyDict_New();
314+
315+
switch (e->tsas.tcp.sectype) {
316+
case NVMF_TCP_SECTYPE_NONE:
317+
val = PyUnicode_FromString("none");
318+
break;
319+
case NVMF_TCP_SECTYPE_TLS:
320+
val = PyUnicode_FromString("tls");
321+
break;
322+
case NVMF_TCP_SECTYPE_TLS13:
323+
val = PyUnicode_FromString("tls1.3");
324+
break;
325+
default:
326+
val = PyUnicode_FromString("reserved");
327+
break;
328+
}
329+
PyDict_SetItemStringDecRef(tsas, "sectype", val);
330+
PyDict_SetItemStringDecRef(entry, "tsas", tsas);
331+
} else if (e->trtype == NVMF_TRTYPE_RDMA) {
332+
PyObject *tsas = PyDict_New();
333+
334+
switch (e->tsas.rdma.qptype) {
335+
case NVMF_RDMA_QPTYPE_CONNECTED:
336+
val = PyUnicode_FromString("connected");
337+
break;
338+
case NVMF_RDMA_QPTYPE_DATAGRAM:
339+
val = PyUnicode_FromString("datagram");
340+
break;
341+
default:
342+
val = PyUnicode_FromString("reserved");
343+
break;
344+
}
345+
PyDict_SetItemStringDecRef(tsas, "qptype", val);
346+
347+
switch (e->tsas.rdma.prtype) {
348+
case NVMF_RDMA_PRTYPE_NOT_SPECIFIED:
349+
val = PyUnicode_FromString("not specified");
350+
break;
351+
case NVMF_RDMA_PRTYPE_IB:
352+
val = PyUnicode_FromString("infiniband");
353+
break;
354+
case NVMF_RDMA_PRTYPE_ROCE:
355+
val = PyUnicode_FromString("roce");
356+
break;
357+
case NVMF_RDMA_PRTYPE_ROCEV2:
358+
val = PyUnicode_FromString("rocev2");
359+
break;
360+
case NVMF_RDMA_PRTYPE_IWARP:
361+
val = PyUnicode_FromString("iwarp");
362+
break;
363+
default:
364+
val = PyUnicode_FromString("reserved");
365+
break;
366+
}
367+
PyDict_SetItemStringDecRef(tsas, "prtype", val);
368+
369+
switch (e->tsas.rdma.cms) {
370+
case NVMF_RDMA_CMS_RDMA_CM:
371+
val = PyUnicode_FromString("cm");
372+
break;
373+
default:
374+
val = PyUnicode_FromString("reserved");
375+
break;
376+
}
377+
PyDict_SetItemStringDecRef(tsas, "cms", val);
378+
PyDict_SetItemStringDecRef(entry, "tsas", val);
379+
}
380+
312381
val = PyLong_FromLong(e->portid);
313382
PyDict_SetItemStringDecRef(entry, "portid", val);
314383
val = PyLong_FromLong(e->cntlid);

0 commit comments

Comments
 (0)