Merge branch 'readdir' (readdir speedup and sanity checking)
[linux-block.git] / include / linux / ppp_channel.h
CommitLineData
2874c5fd 1/* SPDX-License-Identifier: GPL-2.0-or-later */
1da177e4
LT
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 *
1da177e4
LT
15 * ==FILEVERSION 20000322==
16 */
17
18#include <linux/list.h>
19#include <linux/skbuff.h>
20#include <linux/poll.h>
273ec51d 21#include <net/net_namespace.h>
1da177e4
LT
22
23struct ppp_channel;
24
25struct 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
33struct ppp_channel {
34 void *private; /* channel private data */
d7100da0 35 const struct ppp_channel_ops *ops; /* operations for this channel */
1da177e4
LT
36 int mtu; /* max transmit packet size */
37 int hdrlen; /* amount of headroom channel needs */
38 void *ppp; /* opaque to channel */
1da177e4 39 int speed; /* transfer rate (bytes/second) */
9c705260 40 /* the following is not used at present */
1da177e4
LT
41 int latency; /* overhead time in milliseconds */
42};
43
44#ifdef __KERNEL__
45/* Called by the channel when it can send some more data. */
46extern 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. */
50extern 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. */
54extern void ppp_input_error(struct ppp_channel *, int code);
55
273ec51d
CG
56/* Attach a channel to a given PPP unit in specified net. */
57extern int ppp_register_net_channel(struct net *, struct ppp_channel *);
58
1da177e4
LT
59/* Attach a channel to a given PPP unit. */
60extern int ppp_register_channel(struct ppp_channel *);
61
62/* Detach a channel from its PPP unit (e.g. on hangup). */
63extern void ppp_unregister_channel(struct ppp_channel *);
64
65/* Get the channel number for a channel */
66extern int ppp_channel_index(struct ppp_channel *);
67
68/* Get the unit number associated with a channel, or -1 if none */
69extern int ppp_unit_number(struct ppp_channel *);
70
63f96072
JC
71/* Get the device name associated with a channel, or NULL if none */
72extern char *ppp_dev_name(struct ppp_channel *);
73
1da177e4
LT
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