Message ID | 20250212-dev-mctp-usb-v2-1-76e67025d764@codeconstruct.com.au (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | mctp: Add MCTP-over-USB hardware transport binding | expand |
On Wed, Feb 12, 2025 at 10:46:50AM +0800, Jeremy Kerr wrote: > 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. > > Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au> > > --- > v2: > - add reference & URL to DSP0283 > - update copyright year > --- > MAINTAINERS | 1 + > include/linux/usb/mctp-usb.h | 30 ++++++++++++++++++++++++++++++ > include/uapi/linux/usb/ch9.h | 1 + > 3 files changed, 32 insertions(+) > > diff --git a/MAINTAINERS b/MAINTAINERS > index 67665d9dd536873e94afffc00393c2fe2e8c2797..e7b326dba9a9e6f50c3beeb172d93641841f6242 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -13903,6 +13903,7 @@ L: netdev@vger.kernel.org > S: Maintained > F: Documentation/networking/mctp.rst > F: drivers/net/mctp/ > +F: include/linux/usb/mctp-usb.h > F: include/net/mctp.h > F: include/net/mctpdevice.h > F: include/net/netns/mctp.h > diff --git a/include/linux/usb/mctp-usb.h b/include/linux/usb/mctp-usb.h > new file mode 100644 > index 0000000000000000000000000000000000000000..b19392aa29310eda504f65bd098c849bd02dc0a1 > --- /dev/null > +++ b/include/linux/usb/mctp-usb.h > @@ -0,0 +1,30 @@ > +/* SPDX-License-Identifier: GPL-2.0+ */ I missed this the last time, sorry, but I have to ask, do you really mean v2 or later? If so, that's fine, just want to make sure. Whichever you pick is fine with me, so: Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
On Wed, 12 Feb 2025 10:46:50 +0800 Jeremy Kerr wrote: > + __u8 rsvd; > + __u8 len; Since this is not a uAPI header u8 is preferred to __u8
Hi Greg, > > --- /dev/null > > +++ b/include/linux/usb/mctp-usb.h > > @@ -0,0 +1,30 @@ > > +/* SPDX-License-Identifier: GPL-2.0+ */ > > I missed this the last time, sorry, but I have to ask, do you really > mean v2 or later? If so, that's fine, just want to make sure. I'm fine with 2.0+, but I figure the preference is consistency here. So, since I'm doing a v3, I will send that out with GPL-2.0. > Whichever you pick is fine with me, so: > > Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Thanks! v3 will have the __u8s changed to u8, as Jakub has requested. Would you like me to keep the Ack on that? Cheers, Jeremy
On Mon, Feb 17, 2025 at 04:55:59PM +0800, Jeremy Kerr wrote: > Hi Greg, > > > > --- /dev/null > > > +++ b/include/linux/usb/mctp-usb.h > > > @@ -0,0 +1,30 @@ > > > +/* SPDX-License-Identifier: GPL-2.0+ */ > > > > I missed this the last time, sorry, but I have to ask, do you really > > mean v2 or later? If so, that's fine, just want to make sure. > > I'm fine with 2.0+, but I figure the preference is consistency here. So, > since I'm doing a v3, I will send that out with GPL-2.0. > > > Whichever you pick is fine with me, so: > > > > Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > > Thanks! v3 will have the __u8s changed to u8, as Jakub has requested. > Would you like me to keep the Ack on that? Yes, that's fine. But to be fair, "__u8" is correct here as that's what the endpoint variable is as well (it is coming directly from hardware), but I'm not going to complain about that as it really doesn't matter :) thanks, greg k-h
diff --git a/MAINTAINERS b/MAINTAINERS index 67665d9dd536873e94afffc00393c2fe2e8c2797..e7b326dba9a9e6f50c3beeb172d93641841f6242 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -13903,6 +13903,7 @@ L: netdev@vger.kernel.org S: Maintained F: Documentation/networking/mctp.rst F: drivers/net/mctp/ +F: include/linux/usb/mctp-usb.h F: include/net/mctp.h F: include/net/mctpdevice.h F: include/net/netns/mctp.h diff --git a/include/linux/usb/mctp-usb.h b/include/linux/usb/mctp-usb.h new file mode 100644 index 0000000000000000000000000000000000000000..b19392aa29310eda504f65bd098c849bd02dc0a1 --- /dev/null +++ b/include/linux/usb/mctp-usb.h @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * mctp-usb.h - MCTP USB transport binding: common definitions, + * based on DMTF0283 specification: + * https://www.dmtf.org/sites/default/files/standards/documents/DSP0283_1.0.1.pdf + * + * These are protocol-level definitions, that may be shared between host + * and gadget drivers. + * + * Copyright (C) 2024-2025 Code Construct Pty Ltd + */ + +#ifndef __LINUX_USB_MCTP_USB_H +#define __LINUX_USB_MCTP_USB_H + +#include <linux/types.h> + +struct mctp_usb_hdr { + __be16 id; + __u8 rsvd; + __u8 len; +} __packed; + +#define MCTP_USB_XFER_SIZE 512 +#define MCTP_USB_BTU 68 +#define MCTP_USB_MTU_MIN MCTP_USB_BTU +#define MCTP_USB_MTU_MAX (U8_MAX - sizeof(struct mctp_usb_hdr)) +#define MCTP_USB_DMTF_ID 0x1ab4 + +#endif /* __LINUX_USB_MCTP_USB_H */ diff --git a/include/uapi/linux/usb/ch9.h b/include/uapi/linux/usb/ch9.h index 91f0f7e214a5a57c8bee3f44c4dbf7b175843d8c..052290652046591fba46f1f0cb5cf77fd965f555 100644 --- a/include/uapi/linux/usb/ch9.h +++ b/include/uapi/linux/usb/ch9.h @@ -330,6 +330,7 @@ struct usb_device_descriptor { #define USB_CLASS_AUDIO_VIDEO 0x10 #define USB_CLASS_BILLBOARD 0x11 #define USB_CLASS_USB_TYPE_C_BRIDGE 0x12 +#define USB_CLASS_MCTP 0x14 #define USB_CLASS_MISC 0xef #define USB_CLASS_APP_SPEC 0xfe #define USB_SUBCLASS_DFU 0x01
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. Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au> --- v2: - add reference & URL to DSP0283 - update copyright year --- MAINTAINERS | 1 + include/linux/usb/mctp-usb.h | 30 ++++++++++++++++++++++++++++++ include/uapi/linux/usb/ch9.h | 1 + 3 files changed, 32 insertions(+)