]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blob - include/linux/ppp_channel.h
Merge branch 'for-arm-soc' of git://git.armlinux.org.uk/~rmk/linux-arm into arm/soc
[mirror_ubuntu-hirsute-kernel.git] / include / linux / ppp_channel.h
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 #ifndef _PPP_CHANNEL_H_
3 #define _PPP_CHANNEL_H_
4 /*
5 * Definitions for the interface between the generic PPP code
6 * and a PPP channel.
7 *
8 * A PPP channel provides a way for the generic PPP code to send
9 * and receive packets over some sort of communications medium.
10 * Packets are stored in sk_buffs and have the 2-byte PPP protocol
11 * number at the start, but not the address and control bytes.
12 *
13 * Copyright 1999 Paul Mackerras.
14 *
15 * ==FILEVERSION 20000322==
16 */
17
18 #include <linux/list.h>
19 #include <linux/skbuff.h>
20 #include <linux/poll.h>
21 #include <net/net_namespace.h>
22
23 struct ppp_channel;
24
25 struct ppp_channel_ops {
26 /* Send a packet (or multilink fragment) on this channel.
27 Returns 1 if it was accepted, 0 if not. */
28 int (*start_xmit)(struct ppp_channel *, struct sk_buff *);
29 /* Handle an ioctl call that has come in via /dev/ppp. */
30 int (*ioctl)(struct ppp_channel *, unsigned int, unsigned long);
31 };
32
33 struct ppp_channel {
34 void *private; /* channel private data */
35 const struct ppp_channel_ops *ops; /* operations for this channel */
36 int mtu; /* max transmit packet size */
37 int hdrlen; /* amount of headroom channel needs */
38 void *ppp; /* opaque to channel */
39 int speed; /* transfer rate (bytes/second) */
40 /* the following is not used at present */
41 int latency; /* overhead time in milliseconds */
42 };
43
44 #ifdef __KERNEL__
45 /* Called by the channel when it can send some more data. */
46 extern void ppp_output_wakeup(struct ppp_channel *);
47
48 /* Called by the channel to process a received PPP packet.
49 The packet should have just the 2-byte PPP protocol header. */
50 extern void ppp_input(struct ppp_channel *, struct sk_buff *);
51
52 /* Called by the channel when an input error occurs, indicating
53 that we may have missed a packet. */
54 extern void ppp_input_error(struct ppp_channel *, int code);
55
56 /* Attach a channel to a given PPP unit in specified net. */
57 extern int ppp_register_net_channel(struct net *, struct ppp_channel *);
58
59 /* Attach a channel to a given PPP unit. */
60 extern int ppp_register_channel(struct ppp_channel *);
61
62 /* Detach a channel from its PPP unit (e.g. on hangup). */
63 extern void ppp_unregister_channel(struct ppp_channel *);
64
65 /* Get the channel number for a channel */
66 extern int ppp_channel_index(struct ppp_channel *);
67
68 /* Get the unit number associated with a channel, or -1 if none */
69 extern int ppp_unit_number(struct ppp_channel *);
70
71 /* Get the device name associated with a channel, or NULL if none */
72 extern char *ppp_dev_name(struct ppp_channel *);
73
74 /*
75 * SMP locking notes:
76 * The channel code must ensure that when it calls ppp_unregister_channel,
77 * nothing is executing in any of the procedures above, for that
78 * channel. The generic layer will ensure that nothing is executing
79 * in the start_xmit and ioctl routines for the channel by the time
80 * that ppp_unregister_channel returns.
81 */
82
83 #endif /* __KERNEL__ */
84 #endif