xref: /openbmc/linux/include/uapi/linux/mctp.h (revision 2fa5ebe3)
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  * Management Component Transport Protocol (MCTP)
4  *
5  * Copyright (c) 2021 Code Construct
6  * Copyright (c) 2021 Google
7  */
8 
9 #ifndef __UAPI_MCTP_H
10 #define __UAPI_MCTP_H
11 
12 #include <linux/types.h>
13 #include <linux/socket.h>
14 #include <linux/netdevice.h>
15 
16 typedef __u8			mctp_eid_t;
17 
18 struct mctp_addr {
19 	mctp_eid_t		s_addr;
20 };
21 
22 struct sockaddr_mctp {
23 	__kernel_sa_family_t	smctp_family;
24 	__u16			__smctp_pad0;
25 	unsigned int		smctp_network;
26 	struct mctp_addr	smctp_addr;
27 	__u8			smctp_type;
28 	__u8			smctp_tag;
29 	__u8			__smctp_pad1;
30 };
31 
32 struct sockaddr_mctp_ext {
33 	struct sockaddr_mctp	smctp_base;
34 	int			smctp_ifindex;
35 	__u8			smctp_halen;
36 	__u8			__smctp_pad0[3];
37 	__u8			smctp_haddr[MAX_ADDR_LEN];
38 };
39 
40 #define MCTP_NET_ANY		0x0
41 
42 #define MCTP_ADDR_NULL		0x00
43 #define MCTP_ADDR_ANY		0xff
44 
45 #define MCTP_TAG_MASK		0x07
46 #define MCTP_TAG_OWNER		0x08
47 #define MCTP_TAG_PREALLOC	0x10
48 
49 #define MCTP_OPT_ADDR_EXT	1
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 
68 #endif /* __UAPI_MCTP_H */
69