aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2012-05-13 17:56:26 -0400
committerDavid S. Miller <davem@davemloft.net>2012-05-15 13:45:03 -0400
commite87cc4728f0e2fb663e592a1141742b1d6c63256 (patch)
treeb8219696d37f0c8d0521d5853560b97fc96dc667 /net/core
parent3a3bfb61e64476ff1e4ac3122cb6dec9c79b795c (diff)
net: Convert net_ratelimit uses to net_<level>_ratelimited
Standardize the net core ratelimited logging functions. Coalesce formats, align arguments. Change a printk then vprintk sequence to use printf extension %pV. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/dev.c30
-rw-r--r--net/core/pktgen.c7
-rw-r--r--net/core/rtnetlink.c8
-rw-r--r--net/core/skbuff.c11
4 files changed, 22 insertions, 34 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index a2be59fe6ab8..3dd853998d38 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1673,10 +1673,9 @@ static void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)
1673 1673
1674 if (skb_network_header(skb2) < skb2->data || 1674 if (skb_network_header(skb2) < skb2->data ||
1675 skb2->network_header > skb2->tail) { 1675 skb2->network_header > skb2->tail) {
1676 if (net_ratelimit()) 1676 net_crit_ratelimited("protocol %04x is buggy, dev %s\n",
1677 pr_crit("protocol %04x is buggy, dev %s\n", 1677 ntohs(skb2->protocol),
1678 ntohs(skb2->protocol), 1678 dev->name);
1679 dev->name);
1680 skb_reset_network_header(skb2); 1679 skb_reset_network_header(skb2);
1681 } 1680 }
1682 1681
@@ -2343,11 +2342,9 @@ EXPORT_SYMBOL(__skb_tx_hash);
2343static inline u16 dev_cap_txqueue(struct net_device *dev, u16 queue_index) 2342static inline u16 dev_cap_txqueue(struct net_device *dev, u16 queue_index)
2344{ 2343{
2345 if (unlikely(queue_index >= dev->real_num_tx_queues)) { 2344 if (unlikely(queue_index >= dev->real_num_tx_queues)) {
2346 if (net_ratelimit()) { 2345 net_warn_ratelimited("%s selects TX queue %d, but real number of TX queues is %d\n",
2347 pr_warn("%s selects TX queue %d, but real number of TX queues is %d\n", 2346 dev->name, queue_index,
2348 dev->name, queue_index, 2347 dev->real_num_tx_queues);
2349 dev->real_num_tx_queues);
2350 }
2351 return 0; 2348 return 0;
2352 } 2349 }
2353 return queue_index; 2350 return queue_index;
@@ -2589,17 +2586,15 @@ int dev_queue_xmit(struct sk_buff *skb)
2589 } 2586 }
2590 } 2587 }
2591 HARD_TX_UNLOCK(dev, txq); 2588 HARD_TX_UNLOCK(dev, txq);
2592 if (net_ratelimit()) 2589 net_crit_ratelimited("Virtual device %s asks to queue packet!\n",
2593 pr_crit("Virtual device %s asks to queue packet!\n", 2590 dev->name);
2594 dev->name);
2595 } else { 2591 } else {
2596 /* Recursion is detected! It is possible, 2592 /* Recursion is detected! It is possible,
2597 * unfortunately 2593 * unfortunately
2598 */ 2594 */
2599recursion_alert: 2595recursion_alert:
2600 if (net_ratelimit()) 2596 net_crit_ratelimited("Dead loop on virtual device %s, fix it urgently!\n",
2601 pr_crit("Dead loop on virtual device %s, fix it urgently!\n", 2597 dev->name);
2602 dev->name);
2603 } 2598 }
2604 } 2599 }
2605 2600
@@ -3080,9 +3075,8 @@ static int ing_filter(struct sk_buff *skb, struct netdev_queue *rxq)
3080 struct Qdisc *q; 3075 struct Qdisc *q;
3081 3076
3082 if (unlikely(MAX_RED_LOOP < ttl++)) { 3077 if (unlikely(MAX_RED_LOOP < ttl++)) {
3083 if (net_ratelimit()) 3078 net_warn_ratelimited("Redir loop detected Dropping packet (%d->%d)\n",
3084 pr_warn("Redir loop detected Dropping packet (%d->%d)\n", 3079 skb->skb_iif, dev->ifindex);
3085 skb->skb_iif, dev->ifindex);
3086 return TC_ACT_SHOT; 3080 return TC_ACT_SHOT;
3087 } 3081 }
3088 3082
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index ffb5d382f241..33912573959d 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2934,8 +2934,7 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev,
2934 2934
2935 if (datalen < sizeof(struct pktgen_hdr)) { 2935 if (datalen < sizeof(struct pktgen_hdr)) {
2936 datalen = sizeof(struct pktgen_hdr); 2936 datalen = sizeof(struct pktgen_hdr);
2937 if (net_ratelimit()) 2937 net_info_ratelimited("increased datalen to %d\n", datalen);
2938 pr_info("increased datalen to %d\n", datalen);
2939 } 2938 }
2940 2939
2941 udph->source = htons(pkt_dev->cur_udp_src); 2940 udph->source = htons(pkt_dev->cur_udp_src);
@@ -3365,8 +3364,8 @@ static void pktgen_xmit(struct pktgen_dev *pkt_dev)
3365 pkt_dev->errors++; 3364 pkt_dev->errors++;
3366 break; 3365 break;
3367 default: /* Drivers are not supposed to return other values! */ 3366 default: /* Drivers are not supposed to return other values! */
3368 if (net_ratelimit()) 3367 net_info_ratelimited("%s xmit error: %d\n",
3369 pr_info("%s xmit error: %d\n", pkt_dev->odevname, ret); 3368 pkt_dev->odevname, ret);
3370 pkt_dev->errors++; 3369 pkt_dev->errors++;
3371 /* fallthru */ 3370 /* fallthru */
3372 case NETDEV_TX_LOCKED: 3371 case NETDEV_TX_LOCKED:
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index b442d35bbc8b..21318d15bbc3 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1524,11 +1524,9 @@ static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm,
1524 err = 0; 1524 err = 0;
1525 1525
1526errout: 1526errout:
1527 if (err < 0 && modified && net_ratelimit()) 1527 if (err < 0 && modified)
1528 printk(KERN_WARNING "A link change request failed with " 1528 net_warn_ratelimited("A link change request failed with some changes committed already. Interface %s may have been left with an inconsistent configuration, please check.\n",
1529 "some changes committed already. Interface %s may " 1529 dev->name);
1530 "have been left with an inconsistent configuration, "
1531 "please check.\n", dev->name);
1532 1530
1533 if (send_addr_notify) 1531 if (send_addr_notify)
1534 call_netdevice_notifiers(NETDEV_CHANGEADDR, dev); 1532 call_netdevice_notifiers(NETDEV_CHANGEADDR, dev);
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 2c35da818ef9..2a1871942317 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -3299,10 +3299,8 @@ bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off)
3299{ 3299{
3300 if (unlikely(start > skb_headlen(skb)) || 3300 if (unlikely(start > skb_headlen(skb)) ||
3301 unlikely((int)start + off > skb_headlen(skb) - 2)) { 3301 unlikely((int)start + off > skb_headlen(skb) - 2)) {
3302 if (net_ratelimit()) 3302 net_warn_ratelimited("bad partial csum: csum=%u/%u len=%u\n",
3303 printk(KERN_WARNING 3303 start, off, skb_headlen(skb));
3304 "bad partial csum: csum=%u/%u len=%u\n",
3305 start, off, skb_headlen(skb));
3306 return false; 3304 return false;
3307 } 3305 }
3308 skb->ip_summed = CHECKSUM_PARTIAL; 3306 skb->ip_summed = CHECKSUM_PARTIAL;
@@ -3314,8 +3312,7 @@ EXPORT_SYMBOL_GPL(skb_partial_csum_set);
3314 3312
3315void __skb_warn_lro_forwarding(const struct sk_buff *skb) 3313void __skb_warn_lro_forwarding(const struct sk_buff *skb)
3316{ 3314{
3317 if (net_ratelimit()) 3315 net_warn_ratelimited("%s: received packets cannot be forwarded while LRO is enabled\n",
3318 pr_warning("%s: received packets cannot be forwarded" 3316 skb->dev->name);
3319 " while LRO is enabled\n", skb->dev->name);
3320} 3317}
3321EXPORT_SYMBOL(__skb_warn_lro_forwarding); 3318EXPORT_SYMBOL(__skb_warn_lro_forwarding);