diff options
| author | Jeremy Kerr <jk@codeconstruct.com.au> | 2026-07-24 13:15:24 +0800 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2026-07-30 16:54:58 -0700 |
| commit | b8564b19c0fffb0ddfef760655c419b3953ceb0e (patch) | |
| tree | 1dcf74d00c90da36930b4d0844fb1e8847e00bda /include/linux | |
| parent | 05b1a3a5eeaa64a5d412688e682a3b13acd99e8b (diff) | |
net: mctp: usblib: Move RX transfer processing to a new mctp-usblib
The processing of USB receive transfers is common to both sides of a
MCTP over USB transport. In order to support a future gadget driver,
move the current host-side driver into a new common file, mctp-usblib.
This currently handles the submit-complete-packetise process of the
receive path of the USB transport. We'll add transmit handling in an
upcoming change.
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Link: https://patch.msgid.link/20260724-dev-mctp-usb-1-1-v5-3-e66bbba0dbdc@codeconstruct.com.au
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/usb/mctp-usb.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/include/linux/usb/mctp-usb.h b/include/linux/usb/mctp-usb.h index 2bece8afd1c7..595e6af16dd0 100644 --- a/include/linux/usb/mctp-usb.h +++ b/include/linux/usb/mctp-usb.h @@ -13,6 +13,8 @@ #ifndef __LINUX_USB_MCTP_USB_H #define __LINUX_USB_MCTP_USB_H +#include <linux/netdevice.h> +#include <linux/skbuff.h> #include <linux/types.h> struct mctp_usb_hdr { @@ -29,4 +31,28 @@ struct mctp_usb_hdr { #define MCTP_USB_1_0_MTU_MAX (MCTP_USB_1_0_PKTLEN_MAX - sizeof(struct mctp_usb_hdr)) #define MCTP_USB_DMTF_ID 0x1ab4 +/* mctp-usblib */ + +/* + * RX handle: drivers will typically create one on init, which persists for + * the life of the driver. The same handle is used for progressive + * prepare -> complete operations (for each incoming USB transfer), which + * result in netif_rx()-ing the MCTP packets received + */ +struct mctp_usblib_rx { + struct sk_buff *skb; +}; + +void mctp_usblib_rx_init(struct mctp_usblib_rx *rx); +void mctp_usblib_rx_fini(struct mctp_usblib_rx *rx); + +int mctp_usblib_rx_prepare(struct net_device *netdev, + struct mctp_usblib_rx *rx, + void **bufp, size_t *lenp, gfp_t gfp); + +int mctp_usblib_rx_complete(struct net_device *netdev, + struct mctp_usblib_rx *rx, size_t len); + +void mctp_usblib_rx_cancel(struct mctp_usblib_rx *rx); + #endif /* __LINUX_USB_MCTP_USB_H */ |
