Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions libnvme/nvme.i
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,75 @@ PyObject *hostid_from_file();
}
PyDict_SetItemStringDecRef(entry, "treq", val);

if (e->trtype == NVMF_TRTYPE_TCP) {
PyObject *tsas = PyDict_New();

switch (e->tsas.tcp.sectype) {
case NVMF_TCP_SECTYPE_NONE:
val = PyUnicode_FromString("none");
break;
case NVMF_TCP_SECTYPE_TLS:
val = PyUnicode_FromString("tls");
break;
case NVMF_TCP_SECTYPE_TLS13:
val = PyUnicode_FromString("tls1.3");
break;
default:
val = PyUnicode_FromString("reserved");
break;
}
PyDict_SetItemStringDecRef(tsas, "sectype", val);
PyDict_SetItemStringDecRef(entry, "tsas", tsas);
} else if (e->trtype == NVMF_TRTYPE_RDMA) {
PyObject *tsas = PyDict_New();

switch (e->tsas.rdma.qptype) {
case NVMF_RDMA_QPTYPE_CONNECTED:
val = PyUnicode_FromString("connected");
break;
case NVMF_RDMA_QPTYPE_DATAGRAM:
val = PyUnicode_FromString("datagram");
break;
default:
val = PyUnicode_FromString("reserved");
break;
}
PyDict_SetItemStringDecRef(tsas, "qptype", val);

switch (e->tsas.rdma.prtype) {
case NVMF_RDMA_PRTYPE_NOT_SPECIFIED:
val = PyUnicode_FromString("not specified");
break;
case NVMF_RDMA_PRTYPE_IB:
val = PyUnicode_FromString("infiniband");
break;
case NVMF_RDMA_PRTYPE_ROCE:
val = PyUnicode_FromString("roce");
break;
case NVMF_RDMA_PRTYPE_ROCEV2:
val = PyUnicode_FromString("rocev2");
break;
case NVMF_RDMA_PRTYPE_IWARP:
val = PyUnicode_FromString("iwarp");
break;
default:
val = PyUnicode_FromString("reserved");
break;
}
PyDict_SetItemStringDecRef(tsas, "prtype", val);

switch (e->tsas.rdma.cms) {
case NVMF_RDMA_CMS_RDMA_CM:
val = PyUnicode_FromString("cm");
break;
default:
val = PyUnicode_FromString("reserved");
break;
}
PyDict_SetItemStringDecRef(tsas, "cms", val);
PyDict_SetItemStringDecRef(entry, "tsas", val);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be using the tsas object instead of val?
PyDict_SetItemStringDecRef(entry, "tsas", tsas);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hreinecke
@igaw
Fixed it with this PR: #1058

}

val = PyLong_FromLong(e->portid);
PyDict_SetItemStringDecRef(entry, "portid", val);
val = PyLong_FromLong(e->cntlid);
Expand Down