aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2021-11-28 18:44:22 +0100
committerIngo Molnar <mingo@kernel.org>2022-03-15 12:57:34 +0100
commit3394a7ff8b2318cdc7ebae6adda1c38a7ca03795 (patch)
treea35d8fff710868b826a6f9dd467ca8df17d6295d
parent850ab092bfdcebe637e53733cddcc329a4a035b8 (diff)
downloadtip-3394a7ff8b2318cdc7ebae6adda1c38a7ca03795.tar.gz
headers/deps: net: Move the snmp_get*() APIs from <net/ip.h> to <net/ip_extra.h>
These APIs are only used in ~10 files - all of which already include <net/ip_extra.h>, so move them over to the <net/ip_extra.h> header, to decouple <net/ip.h> from <linux/percpu.h> and <linux/skbuff_api.h>. Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--include/net/ip.h47
-rw-r--r--include/net/ip_extra.h47
2 files changed, 47 insertions, 47 deletions
diff --git a/include/net/ip.h b/include/net/ip.h
index ee847660ce4171..206734a20c6446 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -287,53 +287,6 @@ void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb,
#define NET_ADD_STATS(net, field, adnd) SNMP_ADD_STATS((net)->mib.net_statistics, field, adnd)
#define __NET_ADD_STATS(net, field, adnd) __SNMP_ADD_STATS((net)->mib.net_statistics, field, adnd)
-static inline u64 snmp_get_cpu_field(void __percpu *mib, int cpu, int offt)
-{
- return *(((unsigned long *)per_cpu_ptr(mib, cpu)) + offt);
-}
-
-unsigned long snmp_fold_field(void __percpu *mib, int offt);
-#if BITS_PER_LONG==32
-u64 snmp_get_cpu_field64(void __percpu *mib, int cpu, int offct,
- size_t syncp_offset);
-u64 snmp_fold_field64(void __percpu *mib, int offt, size_t sync_off);
-#else
-static inline u64 snmp_get_cpu_field64(void __percpu *mib, int cpu, int offct,
- size_t syncp_offset)
-{
- return snmp_get_cpu_field(mib, cpu, offct);
-
-}
-
-static inline u64 snmp_fold_field64(void __percpu *mib, int offt, size_t syncp_off)
-{
- return snmp_fold_field(mib, offt);
-}
-#endif
-
-#define snmp_get_cpu_field64_batch(buff64, stats_list, mib_statistic, offset) \
-{ \
- int i, c; \
- for_each_possible_cpu(c) { \
- for (i = 0; stats_list[i].name; i++) \
- buff64[i] += snmp_get_cpu_field64( \
- mib_statistic, \
- c, stats_list[i].entry, \
- offset); \
- } \
-}
-
-#define snmp_get_cpu_field_batch(buff, stats_list, mib_statistic) \
-{ \
- int i, c; \
- for_each_possible_cpu(c) { \
- for (i = 0; stats_list[i].name; i++) \
- buff[i] += snmp_get_cpu_field( \
- mib_statistic, \
- c, stats_list[i].entry); \
- } \
-}
-
void inet_get_local_port_range(struct net *net, int *low, int *high);
#ifdef CONFIG_SYSCTL
diff --git a/include/net/ip_extra.h b/include/net/ip_extra.h
index f6abd971891f94..b94e0288e1647e 100644
--- a/include/net/ip_extra.h
+++ b/include/net/ip_extra.h
@@ -259,6 +259,53 @@ static __inline__ void inet_reset_saddr(struct sock *sk)
#endif
}
+#endif /* CONFIG_INET */
+
+static inline u64 snmp_get_cpu_field(void __percpu *mib, int cpu, int offt)
+{
+ return *(((unsigned long *)per_cpu_ptr(mib, cpu)) + offt);
+}
+
+unsigned long snmp_fold_field(void __percpu *mib, int offt);
+#if BITS_PER_LONG==32
+u64 snmp_get_cpu_field64(void __percpu *mib, int cpu, int offct,
+ size_t syncp_offset);
+u64 snmp_fold_field64(void __percpu *mib, int offt, size_t sync_off);
+#else
+static inline u64 snmp_get_cpu_field64(void __percpu *mib, int cpu, int offct,
+ size_t syncp_offset)
+{
+ return snmp_get_cpu_field(mib, cpu, offct);
+
+}
+
+static inline u64 snmp_fold_field64(void __percpu *mib, int offt, size_t syncp_off)
+{
+ return snmp_fold_field(mib, offt);
+}
#endif
+#define snmp_get_cpu_field64_batch(buff64, stats_list, mib_statistic, offset) \
+{ \
+ int i, c; \
+ for_each_possible_cpu(c) { \
+ for (i = 0; stats_list[i].name; i++) \
+ buff64[i] += snmp_get_cpu_field64( \
+ mib_statistic, \
+ c, stats_list[i].entry, \
+ offset); \
+ } \
+}
+
+#define snmp_get_cpu_field_batch(buff, stats_list, mib_statistic) \
+{ \
+ int i, c; \
+ for_each_possible_cpu(c) { \
+ for (i = 0; stats_list[i].name; i++) \
+ buff[i] += snmp_get_cpu_field( \
+ mib_statistic, \
+ c, stats_list[i].entry); \
+ } \
+}
+
#endif /* _IP_EXTRA_H */