Files
openwrt-R7800-nss/target/linux/ipq806x/patches-6.6/990-0344-net-ppp-API-to-check-compression-enabled-on-PPP-devi.patch

57 lines
1.5 KiB
Diff

From cad2cc2ca7c6cb9b4428a0333c46713f82d2424d Mon Sep 17 00:00:00 2001
From: Ratheesh Kannoth <rkannoth@codeaurora.org>
Date: Fri, 6 Nov 2020 12:56:12 +0530
Subject: [PATCH 244/500] net: ppp: API to check compression enabled on PPP
device
Change-Id: I574c688a9299531263061534a51cc88fef5e069f
Signed-off-by: Ratheesh Kannoth <rkannoth@codeaurora.org>
Signed-off-by: Pavithra R <quic_pavir@quicinc.com>
---
drivers/net/ppp/ppp_generic.c | 22 ++++++++++++++++++++++
include/linux/ppp_channel.h | 2 ++
2 files changed, 24 insertions(+)
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -3689,6 +3689,28 @@ void ppp_update_stats(struct net_device
ppp_recv_unlock(ppp);
}
+/* Returns true if Compression is enabled on PPP device
+ */
+bool ppp_is_cp_enabled(struct net_device *dev)
+{
+ struct ppp *ppp;
+ bool flag = false;
+
+ if (!dev)
+ return false;
+
+ if (dev->type != ARPHRD_PPP)
+ return false;
+
+ ppp = netdev_priv(dev);
+ ppp_lock(ppp);
+ flag = !!ppp->xcomp || !!ppp->rcomp;
+ ppp_unlock(ppp);
+
+ return flag;
+}
+EXPORT_SYMBOL(ppp_is_cp_enabled);
+
/* Returns >0 if the device is a multilink PPP netdevice, 0 if not or < 0 if
* the device is not PPP.
*/
--- a/include/linux/ppp_channel.h
+++ b/include/linux/ppp_channel.h
@@ -80,6 +80,8 @@ extern int ppp_hold_channels(struct net_
struct ppp_channel *channels[],
unsigned int chan_sz);
+bool ppp_is_cp_enabled(struct net_device *dev);
+
/* Test if the ppp device is a multi-link ppp device */
extern int ppp_is_multilink(struct net_device *dev);