From: Kefeng Wang <wangkefeng.wang@huawei.com>
To: <linux-kernel@vger.kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"David S. Miller" <davem@davemloft.net>,
Pablo Neira Ayuso <pablo@netfilter.org>,
"Stephen Hemminger" <stephen@networkplumber.org>,
Johannes Berg <johannes@sipsolutions.net>,
"John W. Linville" <linville@tuxdriver.com>,
Stanislaw Gruszka <sgruszka@redhat.com>,
Johannes Berg <johannes.berg@intel.com>,
Francois Romieu <romieu@fr.zoreil.com>,
"Ben Hutchings" <bhutchings@solarflare.com>,
Chas Williams <chas@cmf.nrl.navy.mil>,
Marc Kleine-Budde <mkl@pengutronix.de>,
Samuel Ortiz <samuel@sortiz.org>,
Paul Mackerras <paulus@samba.org>,
Oliver Neukum <oneukum@suse.de>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
"Boris Ostrovsky" <boris.ostrovsky@oracle.com>,
David Vrabel <david.vrabel@citrix.com>,
Rusty Russell <rusty@rustcorp.com.au>,
"Michael S. Tsirkin" <mst@redhat.com>,
<netfilter@vger.kernel.org>,
<netdev@vger.ker
Subject: [PATCH 02/18] net: use wrapper functions of net_ratelimit() to simplify code
Date: Tue, 15 Oct 2013 19:44:58 +0800 [thread overview]
Message-ID: <1381837514-50660-3-git-send-email-wangkefeng.wang@huawei.com> (raw)
In-Reply-To: <1381837514-50660-1-git-send-email-wangkefeng.wang@huawei.com>
Wrapper functions net_ratelimited_function() and net_XXX_ratelimited()
are called to simplify code.
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
net/bridge/br_fdb.c | 6 ++----
net/bridge/br_multicast.c | 13 ++++---------
net/bridge/br_stp_bpdu.c | 11 ++++-------
net/mac80211/rx.c | 6 ++----
net/netfilter/ipset/ip_set_hash_gen.h | 3 +--
5 files changed, 13 insertions(+), 26 deletions(-)
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index ffd5874..e47dfe5 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -465,10 +465,8 @@ void br_fdb_update(struct net_bridge *br, struct net_bridge_port *source,
if (likely(fdb)) {
/* attempt to update an entry for a local interface */
if (unlikely(fdb->is_local)) {
- if (net_ratelimit())
- br_warn(br, "received packet on %s with "
- "own address as source address\n",
- source->dev->name);
+ net_ratelimited_function(br_warn, br, "received packet on %s "
+ "with own address as source address\n", source->dev->name);
} else {
/* fastpath: update of existing entry */
fdb->dst = source;
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index d1c5786..c00d8a2 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -530,11 +530,8 @@ static struct net_bridge_mdb_entry *br_multicast_get_group(
max = mdb->max;
if (unlikely(count > br->hash_elasticity && count)) {
- if (net_ratelimit())
- br_info(br, "Multicast hash table "
- "chain limit reached: %s\n",
- port ? port->dev->name : br->dev->name);
-
+ net_ratelimited_function(br_info, br, "Multicast hash table "
+ "chain limit reached: %s\n", port ? port->dev->name : br->dev->name);
elasticity = br->hash_elasticity;
}
@@ -554,10 +551,8 @@ disable:
if (max > mdb->max || elasticity) {
if (mdb->old) {
- if (net_ratelimit())
- br_info(br, "Multicast hash table "
- "on fire: %s\n",
- port ? port->dev->name : br->dev->name);
+ net_ratelimited_function(br_info, br, "Multicast hash table "
+ "on fire: %s\n", port ? port->dev->name : br->dev->name);
err = -EEXIST;
goto err;
}
diff --git a/net/bridge/br_stp_bpdu.c b/net/bridge/br_stp_bpdu.c
index 8660ea3..482ef11 100644
--- a/net/bridge/br_stp_bpdu.c
+++ b/net/bridge/br_stp_bpdu.c
@@ -220,13 +220,10 @@ void br_stp_rcv(const struct stp_proto *proto, struct sk_buff *skb,
bpdu.forward_delay = br_get_ticks(buf+30);
if (bpdu.message_age > bpdu.max_age) {
- if (net_ratelimit())
- br_notice(p->br,
- "port %u config from %pM"
- " (message_age %ul > max_age %ul)\n",
- p->port_no,
- eth_hdr(skb)->h_source,
- bpdu.message_age, bpdu.max_age);
+ net_ratelimited_function(br_notice, p->br,
+ "port %u config from %pM (message_age %ul > max_age %ul)\n",
+ p->port_no, eth_hdr(skb)->h_source,
+ bpdu.message_age, bpdu.max_age);
goto out;
}
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 54395d7..35b8b1d 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -3156,10 +3156,8 @@ static bool ieee80211_prepare_and_rx_handle(struct ieee80211_rx_data *rx,
if (!consume) {
skb = skb_copy(skb, GFP_ATOMIC);
if (!skb) {
- if (net_ratelimit())
- wiphy_debug(local->hw.wiphy,
- "failed to copy skb for %s\n",
- sdata->name);
+ net_ratelimited_function(wiphy_debug, local->hw.wiphy,
+ "failed to copy skb for %s\n", sdata->name);
return true;
}
diff --git a/net/netfilter/ipset/ip_set_hash_gen.h b/net/netfilter/ipset/ip_set_hash_gen.h
index 707bc52..6179436 100644
--- a/net/netfilter/ipset/ip_set_hash_gen.h
+++ b/net/netfilter/ipset/ip_set_hash_gen.h
@@ -607,8 +607,7 @@ mtype_add(struct ip_set *set, void *value, const struct ip_set_ext *ext,
mtype_expire(h, NETS_LENGTH(set->family), h->dsize);
if (h->elements >= h->maxelem) {
- if (net_ratelimit())
- pr_warning("Set %s is full, maxelem %u reached\n",
+ net_warn_ratelimited("Set %s is full, maxelem %u reached\n",
set->name, h->maxelem);
return -IPSET_ERR_HASH_FULL;
}
--
1.8.2.1
next prev parent reply other threads:[~2013-10-15 11:44 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-15 11:44 [PATCH 00/18] cleanup: wrapper functions of net_ratelimit() called to simplify code Kefeng Wang
2013-10-15 11:44 ` [PATCH 01/18] netfilter: cleanup: delete Macro PRINTR Kefeng Wang
2013-10-15 11:44 ` Kefeng Wang [this message]
2013-10-15 16:24 ` [PATCH 02/18] net: use wrapper functions of net_ratelimit() to simplify code Joe Perches
2013-10-16 3:24 ` Kefeng Wang
2013-10-15 11:44 ` [PATCH 03/18] rt18187se: " Kefeng Wang
2013-10-15 11:45 ` [PATCH 04/18] rt18192e: " Kefeng Wang
2013-10-15 11:45 ` [PATCH 05/18] rt18192u: " Kefeng Wang
2013-10-15 11:45 ` [PATCH 06/18] net: wireless: " Kefeng Wang
2013-10-15 11:45 ` [PATCH 07/18] net: ethernet: " Kefeng Wang
2013-10-15 11:45 ` [PATCH 08/18] atm: " Kefeng Wang
2013-10-15 11:45 ` [PATCH 09/18] block: aoe: " Kefeng Wang
2013-10-15 11:45 ` [PATCH 10/18] net: peak_usb: " Kefeng Wang
2013-10-15 11:45 ` [PATCH 11/18] net: hamradio: " Kefeng Wang
2013-10-15 11:45 ` [PATCH 12/18] net: irda: " Kefeng Wang
2013-10-15 11:45 ` [PATCH 13/18] net: ppp: " Kefeng Wang
2013-10-15 11:45 ` [PATCH 14/18] net: usb: " Kefeng Wang
2013-10-15 19:06 ` Sergei Shtylyov
2013-10-16 3:27 ` Kefeng Wang
2013-10-15 11:45 ` [PATCH 15/18] net: xen: " Kefeng Wang
2013-10-15 11:45 ` [PATCH 16/18] net: virtio: " Kefeng Wang
2013-10-15 11:45 ` [PATCH 17/18] net: vxlan: " Kefeng Wang
2013-10-15 11:45 ` [PATCH 18/18] net: wimax: " Kefeng Wang
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=1381837514-50660-3-git-send-email-wangkefeng.wang@huawei.com \
--to=wangkefeng.wang@huawei.com \
--cc=bhutchings@solarflare.com \
--cc=boris.ostrovsky@oracle.com \
--cc=chas@cmf.nrl.navy.mil \
--cc=davem@davemloft.net \
--cc=david.vrabel@citrix.com \
--cc=gregkh@linuxfoundation.org \
--cc=johannes.berg@intel.com \
--cc=johannes@sipsolutions.net \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=mkl@pengutronix.de \
--cc=mst@redhat.com \
--cc=netdev@vger.ker \
--cc=netfilter@vger.kernel.org \
--cc=oneukum@suse.de \
--cc=pablo@netfilter.org \
--cc=paulus@samba.org \
--cc=romieu@fr.zoreil.com \
--cc=rusty@rustcorp.com.au \
--cc=samuel@sortiz.org \
--cc=sgruszka@redhat.com \
--cc=stephen@networkplumber.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).