From: igorm@etf.rs
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, Igor Maravic <igorm@etf.rs>
Subject: [PATCH 04/10 net-next] include:net:ipv6: Moved _DEV* macros
Date: Fri, 16 Dec 2011 16:25:57 +0100 [thread overview]
Message-ID: <1324049163-11207-5-git-send-email-igorm@etf.rs> (raw)
In-Reply-To: <1324049163-11207-1-git-send-email-igorm@etf.rs>
From: Igor Maravic <igorm@etf.rs>
Moved _DEV* macros to /include/net/snmp.h so they
could be reused for ipv4 per device statistics.
Changed calling of _DEV* macros because they now have +1 argument - type.
Signed-off-by: Igor Maravic <igorm@etf.rs>
---
include/net/ipv6.h | 64 +++++++++-------------------------------------------
1 files changed, 11 insertions(+), 53 deletions(-)
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index e4170a2..fe65b9b 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -115,73 +115,31 @@ struct frag_hdr {
extern int sysctl_mld_max_msf;
extern struct ctl_path net_ipv6_ctl_path[];
-#define _DEVINC(net, statname, modifier, idev, field) \
-({ \
- struct inet6_dev *_idev = (idev); \
- if (likely(_idev != NULL)) \
- SNMP_INC_STATS##modifier((_idev)->stats.statname, (field)); \
- SNMP_INC_STATS##modifier((net)->mib.statname##_statistics, (field));\
-})
-
-/* per device counters are atomic_long_t */
-#define _DEVINCATOMIC(net, statname, modifier, idev, field) \
-({ \
- struct inet6_dev *_idev = (idev); \
- if (likely(_idev != NULL)) \
- SNMP_INC_STATS_ATOMIC_LONG((_idev)->stats.statname##dev, (field)); \
- SNMP_INC_STATS##modifier((net)->mib.statname##_statistics, (field));\
-})
-
-/* per device and per net counters are atomic_long_t */
-#define _DEVINC_ATOMIC_ATOMIC(net, statname, idev, field) \
-({ \
- struct inet6_dev *_idev = (idev); \
- if (likely(_idev != NULL)) \
- SNMP_INC_STATS_ATOMIC_LONG((_idev)->stats.statname##dev, (field)); \
- SNMP_INC_STATS_ATOMIC_LONG((net)->mib.statname##_statistics, (field));\
-})
-
-#define _DEVADD(net, statname, modifier, idev, field, val) \
-({ \
- struct inet6_dev *_idev = (idev); \
- if (likely(_idev != NULL)) \
- SNMP_ADD_STATS##modifier((_idev)->stats.statname, (field), (val)); \
- SNMP_ADD_STATS##modifier((net)->mib.statname##_statistics, (field), (val));\
-})
-
-#define _DEVUPD(net, statname, modifier, idev, field, val) \
-({ \
- struct inet6_dev *_idev = (idev); \
- if (likely(_idev != NULL)) \
- SNMP_UPD_PO_STATS##modifier((_idev)->stats.statname, field, (val)); \
- SNMP_UPD_PO_STATS##modifier((net)->mib.statname##_statistics, field, (val));\
-})
-
/* MIBs */
#define IP6_INC_STATS(net, idev,field) \
- _DEVINC(net, ipv6, 64, idev, field)
+ _DEVINC(net, ipv6, 64, struct inet6_dev, idev, field)
#define IP6_INC_STATS_BH(net, idev,field) \
- _DEVINC(net, ipv6, 64_BH, idev, field)
+ _DEVINC(net, ipv6, 64_BH, struct inet6_dev, idev, field)
#define IP6_ADD_STATS(net, idev,field,val) \
- _DEVADD(net, ipv6, 64, idev, field, val)
+ _DEVADD(net, ipv6, 64, struct inet6_dev, idev, field, val)
#define IP6_ADD_STATS_BH(net, idev,field,val) \
- _DEVADD(net, ipv6, 64_BH, idev, field, val)
+ _DEVADD(net, ipv6, 64_BH, struct inet6_dev, idev, field, val)
#define IP6_UPD_PO_STATS(net, idev,field,val) \
- _DEVUPD(net, ipv6, 64, idev, field, val)
+ _DEVUPD(net, ipv6, 64, struct inet6_dev, idev, field, val)
#define IP6_UPD_PO_STATS_BH(net, idev,field,val) \
- _DEVUPD(net, ipv6, 64_BH, idev, field, val)
+ _DEVUPD(net, ipv6, 64_BH, struct inet6_dev, idev, field, val)
#define ICMP6_INC_STATS(net, idev, field) \
- _DEVINCATOMIC(net, icmpv6, , idev, field)
+ _DEVINCATOMIC(net, icmpv6, , struct inet6_dev, idev, field)
#define ICMP6_INC_STATS_BH(net, idev, field) \
- _DEVINCATOMIC(net, icmpv6, _BH, idev, field)
+ _DEVINCATOMIC(net, icmpv6, _BH, struct inet6_dev, idev, field)
#define ICMP6MSGOUT_INC_STATS(net, idev, field) \
- _DEVINC_ATOMIC_ATOMIC(net, icmpv6msg, idev, field +256)
+ _DEVINC_ATOMIC_ATOMIC(net, icmpv6msg, struct inet6_dev, idev, field +256)
#define ICMP6MSGOUT_INC_STATS_BH(net, idev, field) \
- _DEVINC_ATOMIC_ATOMIC(net, icmpv6msg, idev, field +256)
+ _DEVINC_ATOMIC_ATOMIC(net, icmpv6msg, struct inet6_dev, idev, field +256)
#define ICMP6MSGIN_INC_STATS_BH(net, idev, field) \
- _DEVINC_ATOMIC_ATOMIC(net, icmpv6msg, idev, field)
+ _DEVINC_ATOMIC_ATOMIC(net, icmpv6msg, struct inet6_dev, idev, field)
struct ip6_ra_chain {
struct ip6_ra_chain *next;
--
1.7.5.4
next prev parent reply other threads:[~2011-12-16 15:26 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-16 15:25 [PATCH 00/10 net-next] Introduce per interface ipv4 statistics igorm
2011-12-16 15:25 ` [PATCH 01/10 net-next] include: net: netns: mib: Add proc_dir_entry for ipv4 per interface stats igorm
2011-12-16 15:25 ` [PATCH 02/10 net-next] include: net: snmp: Create icmp per device counters and add macros for per device stats igorm
2011-12-16 15:25 ` [PATCH 03/10 net-next] include:linux:inetdevice: Add struct ipv4_devstat and func __in_dev_get_rcu_safely igorm
2011-12-16 15:25 ` igorm [this message]
2011-12-16 15:25 ` [PATCH 05/10 net-next] include:net:ip: Tuned up IP_*_STATS macros for per device statistics and added functions for (un)registering per device proc entries igorm
2011-12-16 15:25 ` [PATCH 06/10 net-next] include:net:icmp: Tuned up ICMP_*_STATS macros for per device statistics and changed prototype for icmp_out_count igorm
2011-12-16 15:26 ` [PATCH 07/10 net-next] net:ipv4:devinet: Add support for alloc/free of per device stats and (un)register of per device proc files igorm
2011-12-16 15:26 ` [PATCH 08/10 net-next] net:ipv4:af_inet: Init proc fs before ip_init igorm
2011-12-16 15:26 ` [PATCH 09/10 net-next] net:ipv4:proc: Introduce proc files for ipv4 per interface stats igorm
2011-12-16 15:26 ` [PATCH 10/10 net-next] net: Enable ipv4 per interface statistics igorm
2011-12-16 15:41 ` [PATCH 00/10 net-next] Introduce per interface ipv4 statistics Eric Dumazet
2011-12-16 15:58 ` Igor Maravić
2011-12-16 16:33 ` Eric Dumazet
2011-12-16 16:44 ` Christoph Lameter
2011-12-16 16:50 ` Eric Dumazet
2011-12-16 16:55 ` Christoph Lameter
2011-12-16 17:14 ` Eric Dumazet
2011-12-16 17:29 ` Christoph Lameter
2011-12-16 18:08 ` Eric Dumazet
2011-12-16 18:30 ` Christoph Lameter
2011-12-16 18:39 ` David Miller
2011-12-16 17:19 ` Stephen Hemminger
2011-12-16 18:31 ` David Miller
2011-12-16 18:28 ` David Miller
2011-12-16 18:27 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1324049163-11207-5-git-send-email-igorm@etf.rs \
--to=igorm@etf.rs \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).