mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-12-17 17:31:27 +00:00
74 lines
2.6 KiB
Diff
74 lines
2.6 KiB
Diff
From 14b84b541426e1237e33aced57d08a25d1885098 Mon Sep 17 00:00:00 2001
|
|
From: Murat Sezgin <msezgin@codeaurora.org>
|
|
Date: Tue, 27 Jan 2015 18:06:30 +0000
|
|
Subject: [PATCH 222/281] vlan: Add vlan stats update function
|
|
|
|
Change-Id: Ib1165b37f29d48e5dbcee2c709b2f873dfb3e34d
|
|
Signed-off-by: Murat Sezgin <msezgin@codeaurora.org>
|
|
---
|
|
include/linux/if_vlan.h | 9 +++++++++
|
|
net/8021q/vlan_core.c | 20 ++++++++++++++++++++
|
|
2 files changed, 29 insertions(+)
|
|
|
|
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
|
|
index e00c4ee81ff7..ba73d5434684 100644
|
|
--- a/include/linux/if_vlan.h
|
|
+++ b/include/linux/if_vlan.h
|
|
@@ -135,6 +135,9 @@ extern struct net_device *__vlan_find_dev_deep_rcu(struct net_device *real_dev,
|
|
extern int vlan_for_each(struct net_device *dev,
|
|
int (*action)(struct net_device *dev, int vid,
|
|
void *arg), void *arg);
|
|
+extern void __vlan_dev_update_accel_stats(struct net_device *dev,
|
|
+ struct rtnl_link_stats64 *stats);
|
|
+
|
|
extern struct net_device *vlan_dev_real_dev(const struct net_device *dev);
|
|
extern u16 vlan_dev_vlan_id(const struct net_device *dev);
|
|
extern __be16 vlan_dev_vlan_proto(const struct net_device *dev);
|
|
@@ -228,6 +231,12 @@ extern void vlan_vids_del_by_dev(struct net_device *dev,
|
|
extern bool vlan_uses_dev(const struct net_device *dev);
|
|
|
|
#else
|
|
+static inline void __vlan_dev_update_accel_stats(struct net_device *dev,
|
|
+ struct rtnl_link_stats64 *stats)
|
|
+{
|
|
+
|
|
+}
|
|
+
|
|
static inline struct net_device *
|
|
__vlan_find_dev_deep_rcu(struct net_device *real_dev,
|
|
__be16 vlan_proto, u16 vlan_id)
|
|
diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
|
|
index 0beb44f2fe1f..149c7d7a8843 100644
|
|
--- a/net/8021q/vlan_core.c
|
|
+++ b/net/8021q/vlan_core.c
|
|
@@ -72,6 +72,26 @@ bool vlan_do_receive(struct sk_buff **skbp)
|
|
return true;
|
|
}
|
|
|
|
+/* Update the VLAN device with statistics from network offload engines */
|
|
+void __vlan_dev_update_accel_stats(struct net_device *dev,
|
|
+ struct rtnl_link_stats64 *nlstats)
|
|
+{
|
|
+ struct vlan_pcpu_stats *stats;
|
|
+
|
|
+ if (!is_vlan_dev(dev))
|
|
+ return;
|
|
+
|
|
+ stats = this_cpu_ptr(vlan_dev_priv(dev)->vlan_pcpu_stats);
|
|
+
|
|
+ u64_stats_update_begin(&stats->syncp);
|
|
+ u64_stats_add(&stats->rx_packets, nlstats->rx_packets);
|
|
+ u64_stats_add(&stats->rx_bytes, nlstats->rx_bytes);
|
|
+ u64_stats_add(&stats->tx_packets, nlstats->tx_packets);
|
|
+ u64_stats_add(&stats->tx_bytes, nlstats->tx_bytes);
|
|
+ u64_stats_update_end(&stats->syncp);
|
|
+}
|
|
+EXPORT_SYMBOL(__vlan_dev_update_accel_stats);
|
|
+
|
|
/* Must be invoked with rcu_read_lock. */
|
|
struct net_device *__vlan_find_dev_deep_rcu(struct net_device *dev,
|
|
__be16 vlan_proto, u16 vlan_id)
|
|
--
|
|
2.17.1
|
|
|