VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   33 Branches   57 Tags
author: Ahmed S. Darwish <a.darwish@linutronix.de> 2021-10-16 10:49:07 +0200 committer: Minda Chen <minda.chen@starfivetech.com> 2023-11-06 19:24:40 +0800 commit: 3ecd178321656264a74a58af79e958173508974c parent: 1d22de8de2d260735ed4dfde0eaaf2d91c5c172f
Commit Summary:
net: sched: Protect Qdisc::bstats with u64_stats
Diffstat:
2 files changed, 4 insertions, 0 deletions
diff --git a/include/net/gen_stats.h b/include/net/gen_stats.h
index d47155f5db5d..304d792f7977 100644
--- a/include/net/gen_stats.h
+++ b/include/net/gen_stats.h
@@ -11,6 +11,7 @@
 struct gnet_stats_basic_packed {
 	__u64	bytes;
 	__u64	packets;
+	struct u64_stats_sync syncp;
 };
 
 struct gnet_stats_basic_cpu {
@@ -34,6 +35,7 @@ struct gnet_dump {
 	struct tc_stats   tc_stats;
 };
 
+void gnet_stats_basic_packed_init(struct gnet_stats_basic_packed *b);
 int gnet_stats_start_copy(struct sk_buff *skb, int type, spinlock_t *lock,
 			  struct gnet_dump *d, int padattr);
 
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 97ce9c0b1860..2e397b258d6b 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -848,8 +848,10 @@ static inline int qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch,
 static inline void _bstats_update(struct gnet_stats_basic_packed *bstats,
 				  __u64 bytes, __u32 packets)
 {
+	u64_stats_update_begin(&bstats->syncp);
 	bstats->bytes += bytes;
 	bstats->packets += packets;
+	u64_stats_update_end(&bstats->syncp);
 }
 
 static inline void bstats_update(struct gnet_stats_basic_packed *bstats,