* [PATCH net-next 1/2] netpoll: Convert printks to np_<level> and add pr_fmt
@ 2012-01-30 1:50 Joe Perches
2012-01-30 1:50 ` [PATCH net-next 2/2] netpoll: Neaten MAX_SKB_SIZE macro Joe Perches
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Joe Perches @ 2012-01-30 1:50 UTC (permalink / raw)
To: linux-kernel; +Cc: David S. Miller, netdev
Use a more current message logging style.
Add pr_fmt to prefix dmesg output with "netpoll: "
Add macros to print np->name.
Signed-off-by: Joe Perches <joe@perches.com>
---
net/core/netpoll.c | 63 +++++++++++++++++++++++----------------------------
1 files changed, 28 insertions(+), 35 deletions(-)
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 556b082..b523274 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -9,6 +9,8 @@
* Copyright (C) 2002 Red Hat, Inc.
*/
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#include <linux/moduleparam.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
@@ -55,6 +57,13 @@ static void arp_reply(struct sk_buff *skb);
static unsigned int carrier_timeout = 4;
module_param(carrier_timeout, uint, 0644);
+#define np_info(np, fmt, ...) \
+ pr_info("%s: " fmt, np->name, ##__VA_ARGS__)
+#define np_err(np, fmt, ...) \
+ pr_err("%s: " fmt, np->name, ##__VA_ARGS__)
+#define np_notice(np, fmt, ...) \
+ pr_notice("%s: " fmt, np->name, ##__VA_ARGS__)
+
static void queue_process(struct work_struct *work)
{
struct netpoll_info *npinfo =
@@ -627,18 +636,12 @@ out:
void netpoll_print_options(struct netpoll *np)
{
- printk(KERN_INFO "%s: local port %d\n",
- np->name, np->local_port);
- printk(KERN_INFO "%s: local IP %pI4\n",
- np->name, &np->local_ip);
- printk(KERN_INFO "%s: interface '%s'\n",
- np->name, np->dev_name);
- printk(KERN_INFO "%s: remote port %d\n",
- np->name, np->remote_port);
- printk(KERN_INFO "%s: remote IP %pI4\n",
- np->name, &np->remote_ip);
- printk(KERN_INFO "%s: remote ethernet address %pM\n",
- np->name, np->remote_mac);
+ np_info(np, "local port %d\n", np->local_port);
+ np_info(np, "local IP %pI4\n", &np->local_ip);
+ np_info(np, "interface '%s'\n", np->dev_name);
+ np_info(np, "remote port %d\n", np->remote_port);
+ np_info(np, "remote IP %pI4\n", &np->remote_ip);
+ np_info(np, "remote ethernet address %pM\n", np->remote_mac);
}
EXPORT_SYMBOL(netpoll_print_options);
@@ -680,8 +683,7 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
goto parse_failed;
*delim = 0;
if (*cur == ' ' || *cur == '\t')
- printk(KERN_INFO "%s: warning: whitespace"
- "is not allowed\n", np->name);
+ np_info(np, "warning: whitespace is not allowed\n");
np->remote_port = simple_strtol(cur, NULL, 10);
cur = delim;
}
@@ -705,8 +707,7 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
return 0;
parse_failed:
- printk(KERN_INFO "%s: couldn't parse config at '%s'!\n",
- np->name, cur);
+ np_info(np, "couldn't parse config at '%s'!\n", cur);
return -1;
}
EXPORT_SYMBOL(netpoll_parse_options);
@@ -721,8 +722,8 @@ int __netpoll_setup(struct netpoll *np)
if ((ndev->priv_flags & IFF_DISABLE_NETPOLL) ||
!ndev->netdev_ops->ndo_poll_controller) {
- printk(KERN_ERR "%s: %s doesn't support polling, aborting.\n",
- np->name, np->dev_name);
+ np_err(np, "%s doesn't support polling, aborting\n",
+ np->dev_name);
err = -ENOTSUPP;
goto out;
}
@@ -785,14 +786,12 @@ int netpoll_setup(struct netpoll *np)
if (np->dev_name)
ndev = dev_get_by_name(&init_net, np->dev_name);
if (!ndev) {
- printk(KERN_ERR "%s: %s doesn't exist, aborting.\n",
- np->name, np->dev_name);
+ np_err(np, "%s doesn't exist, aborting\n", np->dev_name);
return -ENODEV;
}
if (ndev->master) {
- printk(KERN_ERR "%s: %s is a slave device, aborting.\n",
- np->name, np->dev_name);
+ np_err(np, "%s is a slave device, aborting\n", np->dev_name);
err = -EBUSY;
goto put;
}
@@ -800,16 +799,14 @@ int netpoll_setup(struct netpoll *np)
if (!netif_running(ndev)) {
unsigned long atmost, atleast;
- printk(KERN_INFO "%s: device %s not up yet, forcing it\n",
- np->name, np->dev_name);
+ np_info(np, "device %s not up yet, forcing it\n", np->dev_name);
rtnl_lock();
err = dev_open(ndev);
rtnl_unlock();
if (err) {
- printk(KERN_ERR "%s: failed to open %s\n",
- np->name, ndev->name);
+ np_err(np, "failed to open %s\n", ndev->name);
goto put;
}
@@ -817,9 +814,7 @@ int netpoll_setup(struct netpoll *np)
atmost = jiffies + carrier_timeout * HZ;
while (!netif_carrier_ok(ndev)) {
if (time_after(jiffies, atmost)) {
- printk(KERN_NOTICE
- "%s: timeout waiting for carrier\n",
- np->name);
+ np_notice(np, "timeout waiting for carrier\n");
break;
}
msleep(1);
@@ -831,9 +826,7 @@ int netpoll_setup(struct netpoll *np)
*/
if (time_before(jiffies, atleast)) {
- printk(KERN_NOTICE "%s: carrier detect appears"
- " untrustworthy, waiting 4 seconds\n",
- np->name);
+ np_notice(np, "carrier detect appears untrustworthy, waiting 4 seconds\n");
msleep(4000);
}
}
@@ -844,15 +837,15 @@ int netpoll_setup(struct netpoll *np)
if (!in_dev || !in_dev->ifa_list) {
rcu_read_unlock();
- printk(KERN_ERR "%s: no IP address for %s, aborting\n",
- np->name, np->dev_name);
+ np_err(np, "no IP address for %s, aborting\n",
+ np->dev_name);
err = -EDESTADDRREQ;
goto put;
}
np->local_ip = in_dev->ifa_list->ifa_local;
rcu_read_unlock();
- printk(KERN_INFO "%s: local IP %pI4\n", np->name, &np->local_ip);
+ np_info(np, "local IP %pI4\n", &np->local_ip);
}
np->dev = ndev;
--
1.7.8.111.gad25c.dirty
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next 2/2] netpoll: Neaten MAX_SKB_SIZE macro
2012-01-30 1:50 [PATCH net-next 1/2] netpoll: Convert printks to np_<level> and add pr_fmt Joe Perches
@ 2012-01-30 1:50 ` Joe Perches
2012-01-30 3:14 ` Cong Wang
2012-02-01 19:22 ` David Miller
2012-01-30 3:13 ` [PATCH net-next 1/2] netpoll: Convert printks to np_<level> and add pr_fmt Cong Wang
2012-02-01 19:22 ` David Miller
2 siblings, 2 replies; 6+ messages in thread
From: Joe Perches @ 2012-01-30 1:50 UTC (permalink / raw)
To: linux-kernel; +Cc: David S. Miller, netdev
Add the types in the packet layout order.
Signed-off-by: Joe Perches <joe@perches.com>
---
net/core/netpoll.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index b523274..4ce473e 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -47,9 +47,11 @@ static atomic_t trapped;
#define NETPOLL_RX_ENABLED 1
#define NETPOLL_RX_DROP 2
-#define MAX_SKB_SIZE \
- (MAX_UDP_CHUNK + sizeof(struct udphdr) + \
- sizeof(struct iphdr) + sizeof(struct ethhdr))
+#define MAX_SKB_SIZE \
+ (sizeof(struct ethhdr) + \
+ sizeof(struct iphdr) + \
+ sizeof(struct udphdr) + \
+ MAX_UDP_CHUNK)
static void zap_completion_queue(void);
static void arp_reply(struct sk_buff *skb);
--
1.7.8.111.gad25c.dirty
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 1/2] netpoll: Convert printks to np_<level> and add pr_fmt
2012-01-30 1:50 [PATCH net-next 1/2] netpoll: Convert printks to np_<level> and add pr_fmt Joe Perches
2012-01-30 1:50 ` [PATCH net-next 2/2] netpoll: Neaten MAX_SKB_SIZE macro Joe Perches
@ 2012-01-30 3:13 ` Cong Wang
2012-02-01 19:22 ` David Miller
2 siblings, 0 replies; 6+ messages in thread
From: Cong Wang @ 2012-01-30 3:13 UTC (permalink / raw)
To: Joe Perches; +Cc: linux-kernel, David S. Miller, netdev
On 01/30/2012 09:50 AM, Joe Perches wrote:
> Use a more current message logging style.
> Add pr_fmt to prefix dmesg output with "netpoll: "
> Add macros to print np->name.
>
> Signed-off-by: Joe Perches<joe@perches.com>
Reviewed-by: WANG Cong <xiyou.wangcong@gmail.com>
Thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 2/2] netpoll: Neaten MAX_SKB_SIZE macro
2012-01-30 1:50 ` [PATCH net-next 2/2] netpoll: Neaten MAX_SKB_SIZE macro Joe Perches
@ 2012-01-30 3:14 ` Cong Wang
2012-02-01 19:22 ` David Miller
1 sibling, 0 replies; 6+ messages in thread
From: Cong Wang @ 2012-01-30 3:14 UTC (permalink / raw)
To: Joe Perches; +Cc: linux-kernel, David S. Miller, netdev
On 01/30/2012 09:50 AM, Joe Perches wrote:
> Add the types in the packet layout order.
>
Good idea.
> Signed-off-by: Joe Perches<joe@perches.com>
Reviewed-by: WANG Cong <xiyou.wangcong@gmail.com>
Thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 1/2] netpoll: Convert printks to np_<level> and add pr_fmt
2012-01-30 1:50 [PATCH net-next 1/2] netpoll: Convert printks to np_<level> and add pr_fmt Joe Perches
2012-01-30 1:50 ` [PATCH net-next 2/2] netpoll: Neaten MAX_SKB_SIZE macro Joe Perches
2012-01-30 3:13 ` [PATCH net-next 1/2] netpoll: Convert printks to np_<level> and add pr_fmt Cong Wang
@ 2012-02-01 19:22 ` David Miller
2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2012-02-01 19:22 UTC (permalink / raw)
To: joe; +Cc: linux-kernel, netdev
From: Joe Perches <joe@perches.com>
Date: Sun, 29 Jan 2012 17:50:43 -0800
> Use a more current message logging style.
> Add pr_fmt to prefix dmesg output with "netpoll: "
> Add macros to print np->name.
>
> Signed-off-by: Joe Perches <joe@perches.com>
Applied.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 2/2] netpoll: Neaten MAX_SKB_SIZE macro
2012-01-30 1:50 ` [PATCH net-next 2/2] netpoll: Neaten MAX_SKB_SIZE macro Joe Perches
2012-01-30 3:14 ` Cong Wang
@ 2012-02-01 19:22 ` David Miller
1 sibling, 0 replies; 6+ messages in thread
From: David Miller @ 2012-02-01 19:22 UTC (permalink / raw)
To: joe; +Cc: linux-kernel, netdev
From: Joe Perches <joe@perches.com>
Date: Sun, 29 Jan 2012 17:50:44 -0800
> Add the types in the packet layout order.
>
> Signed-off-by: Joe Perches <joe@perches.com>
Applied.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-02-01 19:22 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-30 1:50 [PATCH net-next 1/2] netpoll: Convert printks to np_<level> and add pr_fmt Joe Perches
2012-01-30 1:50 ` [PATCH net-next 2/2] netpoll: Neaten MAX_SKB_SIZE macro Joe Perches
2012-01-30 3:14 ` Cong Wang
2012-02-01 19:22 ` David Miller
2012-01-30 3:13 ` [PATCH net-next 1/2] netpoll: Convert printks to np_<level> and add pr_fmt Cong Wang
2012-02-01 19:22 ` David Miller
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).