--- zzzz-none-000/linux-4.4.60/include/linux/ppp_channel.h 2017-04-08 07:53:53.000000000 +0000 +++ jet-2400-727/linux-4.4.60/include/linux/ppp_channel.h 2021-03-17 14:36:41.000000000 +0000 @@ -1,3 +1,19 @@ +/* + ************************************************************************** + * Copyright (c) 2016, The Linux Foundation. All rights reserved. + * Permission to use, copy, modify, and/or distribute this software for + * any purpose with or without fee is hereby granted, provided that the + * above copyright notice and this permission notice appear in all copies. + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + ************************************************************************** + */ + #ifndef _PPP_CHANNEL_H_ #define _PPP_CHANNEL_H_ /* @@ -23,6 +39,12 @@ #include #include #include +#include +#include + +/* PPP channel connection event types */ +#define PPP_CHANNEL_DISCONNECT 0 +#define PPP_CHANNEL_CONNECT 1 struct ppp_channel; @@ -32,6 +54,16 @@ int (*start_xmit)(struct ppp_channel *, struct sk_buff *); /* Handle an ioctl call that has come in via /dev/ppp. */ int (*ioctl)(struct ppp_channel *, unsigned int, unsigned long); + /* Get channel protocol type, one of PX_PROTO_XYZ or specific to + * the channel subtype + */ + int (*get_channel_protocol)(struct ppp_channel *); + /* Get channel protocol version */ + int (*get_channel_protocol_ver)(struct ppp_channel *); + /* Hold the channel from being destroyed */ + void (*hold)(struct ppp_channel *); + /* Release hold on the channel */ + void (*release)(struct ppp_channel *); }; struct ppp_channel { @@ -46,6 +78,51 @@ }; #ifdef __KERNEL__ +/* Call this to obtain the underlying protocol of the PPP channel, + * e.g. PX_PROTO_OE + */ +extern int ppp_channel_get_protocol(struct ppp_channel *); + +/* Call this get protocol version */ +extern int ppp_channel_get_proto_version(struct ppp_channel *); + +/* Call this to hold a channel */ +extern bool ppp_channel_hold(struct ppp_channel *); + +/* Call this to release a hold you have upon a channel */ +extern void ppp_channel_release(struct ppp_channel *); + +/* Release hold on PPP channels */ +extern void ppp_release_channels(struct ppp_channel *channels[], + unsigned int chan_sz); + +/* Hold PPP channels for the PPP device */ +extern int ppp_hold_channels(struct net_device *dev, + struct ppp_channel *channels[], + unsigned int chan_sz); +/* Test if ppp xmit lock is locked */ +extern bool ppp_is_xmit_locked(struct net_device *dev); + +/* Hold PPP channels for the PPP device */ +extern int __ppp_hold_channels(struct net_device *dev, + struct ppp_channel *channels[], + unsigned int chan_sz); + +/* Test if the ppp device is a multi-link ppp device */ +extern int ppp_is_multilink(struct net_device *dev); + +/* Test if the ppp device is a multi-link ppp device */ +extern int __ppp_is_multilink(struct net_device *dev); + +/* Update statistics of the PPP net_device by incrementing related + * statistics field value with corresponding parameter + */ +extern void ppp_update_stats(struct net_device *dev, unsigned long rx_packets, + unsigned long rx_bytes, unsigned long tx_packets, + unsigned long tx_bytes, unsigned long rx_errors, + unsigned long tx_errors, unsigned long rx_dropped, + unsigned long tx_dropped); + /* Called by the channel when it can send some more data. */ extern void ppp_output_wakeup(struct ppp_channel *); @@ -69,12 +146,21 @@ /* Get the channel number for a channel */ extern int ppp_channel_index(struct ppp_channel *); +/* Get the device index associated with a channel, or 0, if none */ +extern int ppp_dev_index(struct ppp_channel *); + /* Get the unit number associated with a channel, or -1 if none */ extern int ppp_unit_number(struct ppp_channel *); /* Get the device name associated with a channel, or NULL if none */ extern char *ppp_dev_name(struct ppp_channel *); +/* Register the PPP channel connect notifier */ +extern void ppp_channel_connection_register_notify(struct notifier_block *nb); + +/* Unregister the PPP channel connect notifier */ +extern void ppp_channel_connection_unregister_notify(struct notifier_block *nb); + /* * SMP locking notes: * The channel code must ensure that when it calls ppp_unregister_channel,