This change adds a couple of new ioctls for mctp sockets: SIOCMCTPALLOCTAG and SIOCMCTPDROPTAG. These ioctls provide facilities for explicit allocation / release of tags, overriding the automatic allocate-on-send/release-on-reply and timeout behaviours. This allows userspace more control over messages that may not fit a simple request/response model. In order to indicate a pre-allocated tag to the sendmsg() syscall, we introduce a new flag to the struct sockaddr_mctp.smctp_tag value: MCTP_TAG_PREALLOC. Additional changes from Jeremy Kerr <jk@codeconstruct.com.au>. Contains a fix that was: Reported-by: kernel test robot <lkp@intel.com>
Showing the changes to include/uapi (1 of 6 files). Show all
Unified · Split
| @@ -44,7 +44,25 @@ struct sockaddr_mctp_ext { · 43 unmodified lines | |||
| 44 | 44 | ||
| 45 | #define MCTP_TAG_MASK 0x07 | 45 | #define MCTP_TAG_MASK 0x07 |
| 46 | #define MCTP_TAG_OWNER 0x08 | 46 | #define MCTP_TAG_OWNER 0x08 |
| 47 | #define MCTP_TAG_PREALLOC 0x10 | ||
| 47 | 48 | ||
| 48 | #define MCTP_OPT_ADDR_EXT 1 | 49 | #define MCTP_OPT_ADDR_EXT 1 |
| 49 | 50 | ||
| 51 | #define SIOCMCTPALLOCTAG (SIOCPROTOPRIVATE + 0) | ||
| 52 | #define SIOCMCTPDROPTAG (SIOCPROTOPRIVATE + 1) | ||
| 53 | |||
| 54 | struct mctp_ioc_tag_ctl { | ||
| 55 | mctp_eid_t peer_addr; | ||
| 56 | |||
| 57 | /* For SIOCMCTPALLOCTAG: must be passed as zero, kernel will | ||
| 58 | * populate with the allocated tag value. Returned tag value will | ||
| 59 | * always have TO and PREALLOC set. | ||
| 60 | * | ||
| 61 | * For SIOCMCTPDROPTAG: userspace provides tag value to drop, from | ||
| 62 | * a prior SIOCMCTPALLOCTAG call (and so must have TO and PREALLOC set). | ||
| 63 | */ | ||
| 64 | __u8 tag; | ||
| 65 | __u16 flags; | ||
| 66 | }; | ||
| 67 | |||
| 50 | #endif /* __UAPI_MCTP_H */ | 68 | #endif /* __UAPI_MCTP_H */ |