Skip to content

Commit b7fe911

Browse files
authored
Merge pull request #399 from CodeConstruct/mi-kdoc
MI: Add kernel-doc documentation for MI API
2 parents 2b122ad + 9ff9e34 commit b7fe911

9 files changed

Lines changed: 520 additions & 26 deletions

File tree

.github/workflows/doc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
uses: actions/checkout@v3
1515
- name: Check documentation format
1616
run: |
17-
API_FILES="fabrics.h filters.h ioctl.h linux.h tree.h types.h"
17+
API_FILES="fabrics.h filters.h ioctl.h linux.h mi.h tree.h types.h"
1818
for file in $API_FILES; do
1919
./doc/kernel-doc -v -none src/nvme/$file 2>&1 | sed -r 's/^([^:]+):([0-9]+): (warning|error):/::\3 file=\1,line=\2::/g'
2020
done

doc/api.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ functions.
1111
.. include:: rst/ioctl.rst
1212
.. include:: rst/fabrics.rst
1313
.. include:: rst/linux.rst
14+
.. include:: rst/mi.rst
1415
.. include:: rst/tree.rst
1516
.. include:: rst/filters.rst
1617
.. include:: rst/util.rst

doc/api.rst.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ functions.
1111
.. include:: rst/ioctl.rst
1212
.. include:: rst/fabrics.rst
1313
.. include:: rst/linux.rst
14+
.. include:: rst/mi.rst
1415
.. include:: rst/tree.rst
1516
.. include:: rst/filters.rst
1617
.. include:: rst/util.rst

doc/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ and utilities to connect, scan, and manage nvme devices on a Linux system.
1212

1313
installation.rst
1414
quickstart.rst
15+
mi.rst
1516
api.rst
1617

1718
Indices and tables

doc/index.rst.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ and utilities to connect, scan, and manage nvme devices on a Linux system.
1212

1313
installation.rst
1414
quickstart.rst
15+
mi.rst
1516
api.rst
1617

1718
Indices and tables

doc/meson.build

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ api_files = [
1313
'ioctl.h',
1414
'linux.h',
1515
'log.h',
16+
'mi.h',
1617
'tree.h',
1718
'types.h',
1819
'fabrics.h',
@@ -25,6 +26,7 @@ sphinx_sources = [
2526
'index.rst',
2627
'quickstart.rst',
2728
'installation.rst',
29+
'mi.rst',
2830
'config-schema.json'
2931
]
3032

doc/mi.rst.in

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
NVMe Management Interface (NVMe-MI) support
2+
===========================================
3+
4+
This libnvme project also includes support for the NVMe Management Interface
5+
(NVMe-MI), currently over a Management Component Transport (MCTP)
6+
protocol link. This MCTP link will typically use i2c/SMBus as the
7+
hardware transport, enabling out-of-band management and control over NVMe
8+
devices using a simple SMBus interface.
9+
10+
The MI interface is compiled into a separate shared object, ``libnvme-mi.so``.
11+
12+
Most of the MI API is transport-agnostic, except for the endpoint constructor
13+
functions. Once an endpoint object (``nvme_mi_ep_t``) is created, the generic
14+
functions can be used to manage it.
15+
16+
MCTP Transport
17+
--------------
18+
19+
The MI API is generally transport-agnostic, but the only currently-supported
20+
transport is MCTP, using the kernel ``AF_MCTP`` socket interface.
21+
22+
MCTP endpoints are addressed by a (network-id, endpoint-id) pair. Endpoint
23+
IDs (EIDs) are defined by the MCTP standard as an 8-bit value. Since the
24+
address space is somewhat limited, the Linux `AF_MCTP` support allows for
25+
separate MCTP "networks", which provide separate address spaces. These networks
26+
each have a unique ``unsigned int`` as their ID.
27+
28+
The default Network ID is 1; unless you have configured otherwise, MCTP
29+
endpoints will appear on this network.

src/nvme/mi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -526,14 +526,14 @@ int nvme_mi_mi_read_mi_data_port(nvme_mi_ep_t ep, __u8 portid,
526526
return 0;
527527
}
528528

529-
int nvme_mi_mi_read_mi_data_ctrl_list(nvme_mi_ep_t ep, __u8 start_portid,
529+
int nvme_mi_mi_read_mi_data_ctrl_list(nvme_mi_ep_t ep, __u8 start_ctrlid,
530530
struct nvme_ctrl_list *list)
531531
{
532532
size_t len;
533533
__u32 cdw0;
534534
int rc;
535535

536-
cdw0 = ((__u8)nvme_mi_dtyp_ctrl_list << 24) | (start_portid << 16);
536+
cdw0 = ((__u8)nvme_mi_dtyp_ctrl_list << 24) | (start_ctrlid << 16);
537537
len = sizeof(*list);
538538

539539
rc = nvme_mi_read_data(ep, cdw0, list, &len);

0 commit comments

Comments
 (0)