xref: /openbmc/linux/include/net/mctpdevice.h (revision ac5f3136)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Management Component Transport Protocol (MCTP) - device
4  * definitions.
5  *
6  * Copyright (c) 2021 Code Construct
7  * Copyright (c) 2021 Google
8  */
9 
10 #ifndef __NET_MCTPDEVICE_H
11 #define __NET_MCTPDEVICE_H
12 
13 #include <linux/list.h>
14 #include <linux/types.h>
15 #include <linux/refcount.h>
16 
17 struct mctp_dev {
18 	struct net_device	*dev;
19 
20 	unsigned int		net;
21 
22 	/* Only modified under RTNL. Reads have addrs_lock held */
23 	u8			*addrs;
24 	size_t			num_addrs;
25 	spinlock_t		addrs_lock;
26 
27 	struct rcu_head		rcu;
28 };
29 
30 #define MCTP_INITIAL_DEFAULT_NET	1
31 
32 struct mctp_dev *mctp_dev_get_rtnl(const struct net_device *dev);
33 struct mctp_dev *__mctp_dev_get(const struct net_device *dev);
34 
35 #endif /* __NET_MCTPDEVICE_H */
36