blob: 05b49d4d2b111697824fed7178f07d3f529bf4be [file] [log] [blame]
Thomas Gleixner2b27bdc2019-05-29 16:57:50 -07001/* SPDX-License-Identifier: GPL-2.0-only */
Remi Denis-Courmontf8ff6022008-09-22 20:03:44 -07002/*
3 * File: pn_dev.h
4 *
5 * Phonet network device
6 *
7 * Copyright (C) 2008 Nokia Corporation.
Remi Denis-Courmontf8ff6022008-09-22 20:03:44 -07008 */
9
10#ifndef PN_DEV_H
11#define PN_DEV_H
12
13struct phonet_device_list {
14 struct list_head list;
Rémi Denis-Courmonteeb74a9d2009-11-18 10:08:26 -080015 struct mutex lock;
Remi Denis-Courmontf8ff6022008-09-22 20:03:44 -070016};
17
remi.denis-courmont@nokia9a3b7a42009-01-23 03:00:30 +000018struct phonet_device_list *phonet_device_list(struct net *net);
Remi Denis-Courmontf8ff6022008-09-22 20:03:44 -070019
20struct phonet_device {
21 struct list_head list;
22 struct net_device *netdev;
23 DECLARE_BITMAP(addrs, 64);
Jiri Pirko88e75942010-06-07 03:27:39 +000024 struct rcu_head rcu;
Remi Denis-Courmontf8ff6022008-09-22 20:03:44 -070025};
26
remi.denis-courmont@nokia76e02cf2009-01-23 03:00:27 +000027int phonet_device_init(void);
Remi Denis-Courmontf8ff6022008-09-22 20:03:44 -070028void phonet_device_exit(void);
remi.denis-courmont@nokia660f7062009-01-23 03:00:28 +000029int phonet_netlink_register(void);
Remi Denis-Courmontf8ff6022008-09-22 20:03:44 -070030struct net_device *phonet_device_get(struct net *net);
31
32int phonet_address_add(struct net_device *dev, u8 addr);
33int phonet_address_del(struct net_device *dev, u8 addr);
34u8 phonet_address_get(struct net_device *dev, u8 addr);
Rémi Denis-Courmont52404882008-12-03 15:42:56 -080035int phonet_address_lookup(struct net *net, u8 addr);
Rémi Denis-Courmontc7a1a4c2009-06-24 01:07:44 +000036void phonet_address_notify(int event, struct net_device *dev, u8 addr);
Remi Denis-Courmontf8ff6022008-09-22 20:03:44 -070037
Rémi Denis-Courmont55748ac02009-10-14 00:48:28 +000038int phonet_route_add(struct net_device *dev, u8 daddr);
39int phonet_route_del(struct net_device *dev, u8 daddr);
Rémi Denis-Courmontf062f412009-10-14 00:48:29 +000040void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
Eric Dumazete67f88d2011-04-27 22:56:07 +000041struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
Rémi Denis-Courmont55748ac02009-10-14 00:48:28 +000042struct net_device *phonet_route_output(struct net *net, u8 daddr);
43
Remi Denis-Courmontf8ff6022008-09-22 20:03:44 -070044#define PN_NO_ADDR 0xff
45
Christoph Hellwigc3506372018-04-10 19:42:55 +020046extern const struct seq_operations pn_sock_seq_ops;
47extern const struct seq_operations pn_res_seq_ops;
Rémi Denis-Courmontc1dc13e2009-07-21 01:57:57 +000048
Remi Denis-Courmontf8ff6022008-09-22 20:03:44 -070049#endif