Skip to contentSkip to conversation

mctp: Add MCTP-over-serial transport binding

PATCH Applied Jeremy Kerr 3 participants 4 messages Nov 23, 2021

Subsystems (4)
lore
Share & tools
lore

Jeremy Kerr

author maintainer
#0 lore raw

PATCH v3 1/1 mctp: Add MCTP-over-serial transport binding

This change adds a MCTP Serial transport binding, as defined by DMTF specificiation DSP0253 - "MCTP Serial Transport Binding". This is implemented as a new serial line discipline, and can be attached to arbitrary tty devices.

From the Kconfig description:

This driver provides an MCTP-over-serial interface, through a serial line-discipline, as defined by DMTF specification "DSP0253 - MCTP Serial Transport Binding". By attaching the ldisc to a serial device, we get a new net device to transport MCTP packets.

This allows communication with external MCTP endpoints which use serial as their transport. It can also be used as an easy way to provide MCTP connectivity between virtual machines, by forwarding data between simple virtual serial devices.

Say y here if you need to connect to MCTP endpoints over serial. To compile as a module, use m; the module will be called mctp-serial.

Once the N_MCTP line discipline is set [using ioctl(TCIOSETD)], we get a new netdev suitable for MCTP communication.

The 'mctp' utility[1] provides a simple wrapper for this ioctl, using 'link serial <device>':

  # mctp link serial /dev/ttyS0 &
  # mctp link
  dev lo index 1 address 0x00:00:00:00:00:00 net 1 mtu 65536 up
  dev mctpserial0 index 5 address 0x(no-addr) net 1 mtu 68 down

[1]: https://github.com/CodeConstruct/mctp

---
v3:
- fix state/txstate typo
v2:
- improve tx tty write() error handling
- remove unnecessary RCU deref of disc_data
- expand Kconfig help: elaborate on MCTP serial spec, list module name
- add references to mctp util

---
 drivers/net/mctp/Kconfig       |  18 ++
 drivers/net/mctp/Makefile      |   1 +
 drivers/net/mctp/mctp-serial.c | 510 +++++++++++++++++++++++++++++++++
 include/uapi/linux/tty.h       |   1 +
 4 files changed, 530 insertions(+)
 create mode 100644 drivers/net/mctp/mctp-serial.c
drivers/net/mctp/Kconfig +18 -0
index d8f966cedc89..2929471395ae 100644
@@ -3,6 +3,24 @@ if MCTP
 
 menu "MCTP Device Drivers"
 
+config MCTP_SERIAL
+	tristate "MCTP serial transport"
+	depends on TTY
+	select CRC_CCITT
+	help
+	  This driver provides an MCTP-over-serial interface, through a
+	  serial line-discipline, as defined by DMTF specification "DSP0253 -
+	  MCTP Serial Transport Binding". By attaching the ldisc to a serial
+	  device, we get a new net device to transport MCTP packets.
+
+	  This allows communication with external MCTP endpoints which use
+	  serial as their transport. It can also be used as an easy way to
+	  provide MCTP connectivity between virtual machines, by forwarding
+	  data between simple virtual serial devices.
+
+	  Say y here if you need to connect to MCTP endpoints over serial. To
+	  compile as a module, use m; the module will be called mctp-serial.
+
 endmenu
 
 endif
drivers/net/mctp/Makefile +1 -0
index e69de29bb2d1..d32622613ce4 100644
@@ -0,0 +1 @@
+obj-$(CONFIG_MCTP_SERIAL) += mctp-serial.o
drivers/net/mctp/mctp-serial.c new file +510 -0

510 lines not on this page · raw message

include/uapi/linux/tty.h +1 -0
index 376cccf397be..a58deb3061eb 100644
@@ -38,5 +38,6 @@
 #define N_NCI		25	/* NFC NCI UART */
 #define N_SPEAKUP	26	/* Speakup communication with synths */
 #define N_NULL		27	/* Null ldisc used for error handling */
+#define N_MCTP		28	/* MCTP-over-serial */
 
 #endif /* _UAPI_LINUX_TTY_H */
Signature · 1 line
2.30.2
#1 lore raw
This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:

Quoted 8 lines · On Tue, 23 Nov 2021 15:50:46 +0800 you wrote:

This change adds a MCTP Serial transport binding, as defined by DMTF specificiation DSP0253 - "MCTP Serial Transport Binding". This is implemented as a new serial line discipline, and can be attached to arbitrary tty devices.

From the Kconfig description:

[...]

Here is the summary with links:
- [net-next,v3] mctp: Add MCTP-over-serial transport binding

    https://git.kernel.org/netdev/net-next/c/a0c2ccd9b5ad

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
maintainer
#2 lore raw
Quoted 4 lines · On 23. 11. 21, 13:00, [email protected] wrote:

Hello:

This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:

I'd assumed a v4 is on its way...

Signature · 2 lines
js
suse labs
author maintainer
#3 lore raw

Hi,

Quoted 4 lines
Quoted 2 lines

This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:

I'd assumed a v4 is on its way...

Davem's super keen. I'll send a follow-up patch with the changes.

Cheers,

Jeremy