1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
3 * Management Component Transport Protocol (MCTP)
5 * Copyright (c) 2021 Code Construct
6 * Copyright (c) 2021 Google
12 #include <linux/types.h>
13 #include <linux/socket.h>
14 #include <linux/netdevice.h>
16 typedef __u8 mctp_eid_t;
22 struct sockaddr_mctp {
23 __kernel_sa_family_t smctp_family;
25 unsigned int smctp_network;
26 struct mctp_addr smctp_addr;
32 struct sockaddr_mctp_ext {
33 struct sockaddr_mctp smctp_base;
37 __u8 smctp_haddr[MAX_ADDR_LEN];
40 #define MCTP_NET_ANY 0x0
42 #define MCTP_ADDR_NULL 0x00
43 #define MCTP_ADDR_ANY 0xff
45 #define MCTP_TAG_MASK 0x07
46 #define MCTP_TAG_OWNER 0x08
47 #define MCTP_TAG_PREALLOC 0x10
49 #define MCTP_OPT_ADDR_EXT 1
51 #define SIOCMCTPALLOCTAG (SIOCPROTOPRIVATE + 0)
52 #define SIOCMCTPDROPTAG (SIOCPROTOPRIVATE + 1)
53 #define SIOCMCTPALLOCTAG2 (SIOCPROTOPRIVATE + 2)
54 #define SIOCMCTPDROPTAG2 (SIOCPROTOPRIVATE + 3)
56 /* Deprecated: use mctp_ioc_tag_ctl2 / TAG2 ioctls instead, which defines the
57 * MCTP network ID as part of the allocated tag. Using this assumes the default
58 * net ID for allocated tags, which may not give correct behaviour on system
59 * with multiple networks configured.
61 struct mctp_ioc_tag_ctl {
64 /* For SIOCMCTPALLOCTAG: must be passed as zero, kernel will
65 * populate with the allocated tag value. Returned tag value will
66 * always have TO and PREALLOC set.
68 * For SIOCMCTPDROPTAG: userspace provides tag value to drop, from
69 * a prior SIOCMCTPALLOCTAG call (and so must have TO and PREALLOC set).
75 struct mctp_ioc_tag_ctl2 {
76 /* Peer details: network ID, peer EID, local EID. All set by the
79 * Local EID must be MCTP_ADDR_NULL or MCTP_ADDR_ANY in current
84 mctp_eid_t local_addr;
86 /* Set by caller, but no flags defined currently. Must be 0 */
89 /* For SIOCMCTPALLOCTAG2: must be passed as zero, kernel will
90 * populate with the allocated tag value. Returned tag value will
91 * always have TO and PREALLOC set.
93 * For SIOCMCTPDROPTAG2: userspace provides tag value to drop, from
94 * a prior SIOCMCTPALLOCTAG2 call (and so must have TO and PREALLOC set).
100 #endif /* __UAPI_MCTP_H */