lede/target/linux/ipq806x/patches-5.4/999-03d-qca-nss-pppoe-offload-support.patch
lovehackintosh 6fc2d00f25
kernel: bump 5.4 to 5.4.214 (#10170)
Manually rebased:
 generic/hack-5.4/953-net-patch-linux-kernel-to-support-shortcut-fe.patch
 ipq806x/patches-5.4/0063-2-tsens-support-configurable-interrupts.patch
 layerscape/patches-5.4/301-arch-0008-arm-add-new-non-shareable-ioremap.patch
 layerscape/patches-5.4/820-usb-0009-usb-dwc3-Add-workaround-for-host-mode-VBUS-glitch-wh.patch
 layerscape/patches-5.4/801-audio-0008-Revert-ASoC-Remove-dev_err-usage-after-platform_get_.patch
 octeon/patches-5.4/700-allocate_interface_by_label.patch

All other patches automatically rebased.

Signed-off-by: Liu Linhui <liulinhui36@gmail.com>

Signed-off-by: Liu Linhui <liulinhui36@gmail.com>
2022-09-24 12:09:08 +08:00

105 lines
3.9 KiB
Diff

From 4df2e1c28e8e3baadd50bdafa40fb35ea99cc52f Mon Sep 17 00:00:00 2001
From: Murat Sezgin <msezgin@codeaurora.org>
Date: Fri, 26 Feb 2016 14:59:20 -0800
Subject: net: ppp: rx/tx error and dropped pkt stats support
ppp_update_stats functions accepts rx/tx errors and dropped
pkt stats args.
Change-Id: Iba2f6ea2114d8a4678254332fec0ef7bc35bed2c
Signed-off-by: ratheesh kannoth <rkannoth@codeaurora.org>
Signed-off-by: Murat Sezgin <msezgin@codeaurora.org>
---
drivers/net/ppp/ppp_generic.c | 8 +++++++-
include/linux/ppp_channel.h | 4 +++-
net/l2tp/l2tp_core.c | 24 ++++++++++++++++++++++++
net/l2tp/l2tp_core.h | 2 ++
4 files changed, 36 insertions(+), 2 deletions(-)
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -3376,7 +3376,9 @@ static void *unit_find(struct idr *p, in
/* Updates the PPP interface statistics. */
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 tx_bytes, unsigned long rx_errors,
+ unsigned long tx_errors, unsigned long rx_dropped,
+ unsigned long tx_dropped)
{
struct ppp *ppp;
@@ -3391,11 +3393,15 @@ void ppp_update_stats(struct net_device
ppp_xmit_lock(ppp);
ppp->stats64.tx_packets += tx_packets;
ppp->stats64.tx_bytes += tx_bytes;
+ ppp->dev->stats.tx_errors += tx_errors;
+ ppp->dev->stats.tx_dropped += tx_dropped;
ppp_xmit_unlock(ppp);
ppp_recv_lock(ppp);
ppp->stats64.rx_packets += rx_packets;
ppp->stats64.rx_bytes += rx_bytes;
+ ppp->dev->stats.rx_errors += rx_errors;
+ ppp->dev->stats.rx_dropped += rx_dropped;
ppp_recv_unlock(ppp);
}
--- a/include/linux/ppp_channel.h
+++ b/include/linux/ppp_channel.h
@@ -82,7 +82,9 @@ extern int ppp_is_multilink(struct net_d
*/
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 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 *);
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -355,6 +355,30 @@ err_tlock:
}
EXPORT_SYMBOL_GPL(l2tp_session_register);
+void l2tp_stats_update(struct l2tp_tunnel *tunnel,
+ struct l2tp_session *session,
+ struct l2tp_stats *stats)
+{
+ atomic_long_add(atomic_long_read(&stats->rx_packets),
+ &tunnel->stats.rx_packets);
+ atomic_long_add(atomic_long_read(&stats->rx_bytes),
+ &tunnel->stats.rx_bytes);
+ atomic_long_add(atomic_long_read(&stats->tx_packets),
+ &tunnel->stats.tx_packets);
+ atomic_long_add(atomic_long_read(&stats->tx_bytes),
+ &tunnel->stats.tx_bytes);
+
+ atomic_long_add(atomic_long_read(&stats->rx_packets),
+ &session->stats.rx_packets);
+ atomic_long_add(atomic_long_read(&stats->rx_bytes),
+ &session->stats.rx_bytes);
+ atomic_long_add(atomic_long_read(&stats->tx_packets),
+ &session->stats.tx_packets);
+ atomic_long_add(atomic_long_read(&stats->tx_bytes),
+ &session->stats.tx_bytes);
+}
+EXPORT_SYMBOL_GPL(l2tp_stats_update);
+
/*****************************************************************************
* Receive data handling
*****************************************************************************/
--- a/net/l2tp/l2tp_core.h
+++ b/net/l2tp/l2tp_core.h
@@ -200,6 +200,8 @@ struct l2tp_session *l2tp_session_get(co
struct l2tp_session *l2tp_session_get_nth(struct l2tp_tunnel *tunnel, int nth);
struct l2tp_session *l2tp_session_get_by_ifname(const struct net *net,
const char *ifname);
+void l2tp_stats_update(struct l2tp_tunnel *tunnel, struct l2tp_session *session,
+ struct l2tp_stats *stats);
int l2tp_tunnel_create(struct net *net, int fd, int version, u32 tunnel_id,
u32 peer_tunnel_id, struct l2tp_tunnel_cfg *cfg,