History

usb: Add base USB MCTP definitions

Upcoming changes will add a USB host (and later gadget) driver for the MCTP-over-USB protocol. Add a header that provides common definitions for protocol support: the packet header format and a few framing definitions. Add a define for the MCTP class code, as per https://usb.org/defined-class-codes.

Jeremy Kerr committed 1 year ago

Commit dcc35ba1 parent e6a53213 files · +32 −0Browse files

Unified · Split

3 files
  1. MAINTAINERS +1 −0
  2. include/linux/usb/mctp-usb.h +30 −0
  3. include/uapi/linux/usb/ch9.h +1 −0
MAINTAINERS+1−0
@@ -13896,6 +13896,7 @@ L: netdev@vger.kernel.org · 13895 unmodified lines
1389613896 S: Maintained
1389713897 F: Documentation/networking/mctp.rst
1389813898 F: drivers/net/mctp/
13899+F: include/linux/usb/mctp-usb.h
1389913900 F: include/net/mctp.h
1390013901 F: include/net/mctpdevice.h
1390113902 F: include/net/netns/mctp.h
include/linux/usb/mctp-usb.h+30−0
@@ -0,0 +1,30 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+/*
3+ * mctp-usb.h - MCTP USB transport binding: common definitions,
4+ * based on DMTF0283 specification:
5+ * https://www.dmtf.org/sites/default/files/standards/documents/DSP0283_1.0.1.pdf
6+ *
7+ * These are protocol-level definitions, that may be shared between host
8+ * and gadget drivers.
9+ *
10+ * Copyright (C) 2024-2025 Code Construct Pty Ltd
11+ */
12+
13+#ifndef __LINUX_USB_MCTP_USB_H
14+#define __LINUX_USB_MCTP_USB_H
15+
16+#include <linux/types.h>
17+
18+struct mctp_usb_hdr {
19+ __be16 id;
20+ u8 rsvd;
21+ u8 len;
22+} __packed;
23+
24+#define MCTP_USB_XFER_SIZE 512
25+#define MCTP_USB_BTU 68
26+#define MCTP_USB_MTU_MIN MCTP_USB_BTU
27+#define MCTP_USB_MTU_MAX (U8_MAX - sizeof(struct mctp_usb_hdr))
28+#define MCTP_USB_DMTF_ID 0x1ab4
29+
30+#endif /* __LINUX_USB_MCTP_USB_H */
include/uapi/linux/usb/ch9.h+1−0
@@ -330,6 +330,7 @@ struct usb_device_descriptor { · 329 unmodified lines
330330 #define USB_CLASS_AUDIO_VIDEO 0x10
331331 #define USB_CLASS_BILLBOARD 0x11
332332 #define USB_CLASS_USB_TYPE_C_BRIDGE 0x12
333+#define USB_CLASS_MCTP 0x14
333334 #define USB_CLASS_MISC 0xef
334335 #define USB_CLASS_APP_SPEC 0xfe
335336 #define USB_SUBCLASS_DFU 0x01