xref: /linux/include/net/phonet/pn_dev.h (revision 42f5fe1dc4babad1c49bcc4121983fffccee3cd9)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * File: pn_dev.h
4  *
5  * Phonet network device
6  *
7  * Copyright (C) 2008 Nokia Corporation.
8  */
9 
10 #ifndef PN_DEV_H
11 #define PN_DEV_H
12 
13 #include <linux/list.h>
14 #include <linux/mutex.h>
15 #include <linux/spinlock.h>
16 
17 struct net;
18 
19 struct phonet_device_list {
20 	struct list_head list;
21 	spinlock_t lock;
22 };
23 
24 struct phonet_device_list *phonet_device_list(struct net *net);
25 
26 struct phonet_device {
27 	struct list_head list;
28 	struct net_device *netdev;
29 	DECLARE_BITMAP(addrs, 64);
30 	struct rcu_head	rcu;
31 };
32 
33 int phonet_device_init(void);
34 void phonet_device_exit(void);
35 int phonet_netlink_register(void);
36 struct net_device *phonet_device_get(struct net *net);
37 
38 int phonet_address_add(struct net_device *dev, u8 addr);
39 int phonet_address_del(struct net_device *dev, u8 addr);
40 u8 phonet_address_get(struct net_device *dev, u8 addr);
41 int phonet_address_lookup(struct net *net, u8 addr);
42 void phonet_address_notify(struct net *net, int event, u32 ifindex, u8 addr);
43 
44 int phonet_route_add(struct net_device *dev, u8 daddr);
45 int phonet_route_del(struct net_device *dev, u8 daddr);
46 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
47 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
48 struct net_device *phonet_route_output(struct net *net, u8 daddr);
49 
50 #define PN_NO_ADDR	0xff
51 
52 extern const struct seq_operations pn_sock_seq_ops;
53 extern const struct seq_operations pn_res_seq_ops;
54 
55 #endif
56