Re: [PATCH net-next v4 15/15] mctp: Add MCTP overview document
From: Eugene Syromiatnikov <hidden>
Date: 2021-10-15 13:10:36
Also in:
linux-doc
On Thu, Jul 29, 2021 at 10:20:53AM +0800, Jeremy Kerr wrote:
This change adds a brief document about the sockets API provided for sending and receiving MCTP messages from userspace.
[...]
quoted hunk ↗ jump to hunk
diff --git a/Documentation/networking/mctp.rst b/Documentation/networking/mctp.rst
[...]
+``bind()`` : set local socket address +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Sockets that receive incoming request packets will bind to a local address, +using the ``bind()`` syscall. + +.. code-block:: C + + struct sockaddr_mctp addr; + + addr.smctp_family = AF_MCTP; + addr.smctp_network = MCTP_NET_ANY; + addr.smctp_addr.s_addr = MCTP_ADDR_ANY; + addr.smctp_type = MCTP_TYPE_PLDM;
[...]
+``sendto()``, ``sendmsg()``, ``send()`` : transmit an MCTP message +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +An MCTP message is transmitted using one of the ``sendto()``, ``sendmsg()`` or +``send()`` syscalls. Using ``sendto()`` as the primary example: + +.. code-block:: C + + struct sockaddr_mctp addr; + char buf[14]; + ssize_t len; + + /* set message destination */ + addr.smctp_family = AF_MCTP; + addr.smctp_network = 0; + addr.smctp_addr.s_addr = 8; + addr.smctp_tag = MCTP_TAG_OWNER; + addr.smctp_type = MCTP_TYPE_ECHO;
While MCTP_TYPE_PLDM and MCTP_TYPE_ECHO are mentioned in the documentation, their definition is currently missing in the UAPI header (or anywhere in the source tree at all). Is that expected?