1 /* SPDX-License-Identifier: GPL-2.0 */
9 struct dn_ifaddr __rcu *ifa_next;
10 struct dn_dev *ifa_dev;
15 char ifa_label[IFNAMSIZ];
19 #define DN_DEV_S_RU 0 /* Run - working normally */
20 #define DN_DEV_S_CR 1 /* Circuit Rejected */
21 #define DN_DEV_S_DS 2 /* Data Link Start */
22 #define DN_DEV_S_RI 3 /* Routing Layer Initialize */
23 #define DN_DEV_S_RV 4 /* Routing Layer Verify */
24 #define DN_DEV_S_RC 5 /* Routing Layer Complete */
25 #define DN_DEV_S_OF 6 /* Off */
26 #define DN_DEV_S_HA 7 /* Halt */
30 * The dn_dev_parms structure contains the set of parameters
31 * for each device (hence inclusion in the dn_dev structure)
32 * and an array is used to store the default types of supported
33 * device (in dn_dev.c).
35 * The type field matches the ARPHRD_ constants and is used in
36 * searching the list for supported devices when new devices
39 * The mode field is used to find out if a device is broadcast,
40 * multipoint, or pointopoint. Please note that DECnet thinks
41 * different ways about devices to the rest of the kernel
42 * so the normal IFF_xxx flags are invalid here. For devices
43 * which can be any combination of the previously mentioned
44 * attributes, you can set this on a per device basis by
45 * installing an up() routine.
47 * The device state field, defines the initial state in which the
48 * device will come up. In the dn_dev structure, it is the actual
51 * Things have changed here. I've killed timer1 since it's a user space
52 * issue for a user space routing deamon to sort out. The kernel does
53 * not need to be bothered with it.
56 * t2 - Rate limit timer, min time between routing and hello messages
57 * t3 - Hello timer, send hello messages when it expires
60 * up() - Called to initialize device, return value can veto use of
62 * down() - Called to turn device off when it goes down
63 * timer3() - Called once for each ifaddr when timer 3 goes off
65 * sysctl - Hook for sysctl things
69 int type; /* ARPHRD_xxx */
70 int mode; /* Broadcast, Unicast, Mulitpoint */
71 #define DN_DEV_BCAST 1
72 #define DN_DEV_UCAST 2
73 #define DN_DEV_MPOINT 4
74 int state; /* Initial state */
75 int forwarding; /* 0=EndNode, 1=L1Router, 2=L2Router */
76 unsigned long t2; /* Default value of t2 */
77 unsigned long t3; /* Default value of t3 */
78 int priority; /* Priority to be a router */
79 char *name; /* Name for sysctl */
80 int (*up)(struct net_device *);
81 void (*down)(struct net_device *);
82 void (*timer3)(struct net_device *, struct dn_ifaddr *ifa);
88 struct dn_ifaddr __rcu *ifa_list;
89 struct net_device *dev;
90 struct dn_dev_parms parms;
92 struct timer_list timer;
94 struct neigh_parms *neigh_parms;
96 struct neighbour *router; /* Default router on circuit */
97 struct neighbour *peer; /* Peer on pointopoint links */
98 unsigned long uptime; /* Time device went up in jiffies */
101 struct dn_short_packet {
108 struct dn_long_packet {
122 /*------------------------- DRP - Routing messages ---------------------*/
124 struct endnode_hello_message {
139 struct rtnode_hello_message {
152 void dn_dev_init(void);
153 void dn_dev_cleanup(void);
155 int dn_dev_ioctl(unsigned int cmd, void __user *arg);
157 void dn_dev_devices_off(void);
158 void dn_dev_devices_on(void);
160 void dn_dev_init_pkt(struct sk_buff *skb);
161 void dn_dev_veri_pkt(struct sk_buff *skb);
162 void dn_dev_hello(struct sk_buff *skb);
164 void dn_dev_up(struct net_device *);
165 void dn_dev_down(struct net_device *);
167 int dn_dev_set_default(struct net_device *dev, int force);
168 struct net_device *dn_dev_get_default(void);
169 int dn_dev_bind_default(__le16 *addr);
171 int register_dnaddr_notifier(struct notifier_block *nb);
172 int unregister_dnaddr_notifier(struct notifier_block *nb);
174 static inline int dn_dev_islocal(struct net_device *dev, __le16 addr)
176 struct dn_dev *dn_db;
177 struct dn_ifaddr *ifa;
181 dn_db = rcu_dereference(dev->dn_ptr);
183 printk(KERN_DEBUG "dn_dev_islocal: Called for non DECnet device\n");
187 for (ifa = rcu_dereference(dn_db->ifa_list);
189 ifa = rcu_dereference(ifa->ifa_next))
190 if ((addr ^ ifa->ifa_local) == 0) {
199 #endif /* _NET_DN_DEV_H */