* [PATCH net-next 5/8] tipc: simplify link_print by divorcing it from using tipc_printf
From: Paul Gortmaker @ 2012-07-12 16:39 UTC (permalink / raw)
To: davem; +Cc: netdev, Jon Maloy, Erik Hugne, ying.xue, Paul Gortmaker
In-Reply-To: <1342111201-9426-1-git-send-email-paul.gortmaker@windriver.com>
To pave the way for a pending cleanup of tipc_printf, and
removal of struct print_buf entirely, we make that task simpler
by converting link_print to issue its messages with standard
printk infrastructure. [Original idea separated from a larger
patch from Erik Hugne <erik.hugne@ericsson.com>]
Cc: Erik Hugne <erik.hugne@ericsson.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
net/tipc/link.c | 24 +++++++-----------------
1 file changed, 7 insertions(+), 17 deletions(-)
diff --git a/net/tipc/link.c b/net/tipc/link.c
index b389ab9..bf4cc41 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -3008,26 +3008,16 @@ u32 tipc_link_get_max_pkt(u32 dest, u32 selector)
static void link_print(struct tipc_link *l_ptr, const char *str)
{
- char print_area[256];
- struct print_buf pb;
- struct print_buf *buf = &pb;
-
- tipc_printbuf_init(buf, print_area, sizeof(print_area));
-
- tipc_printf(buf, str);
- tipc_printf(buf, "Link %x<%s>:",
- l_ptr->addr, l_ptr->b_ptr->name);
+ pr_info("TIPC: %s Link %x<%s>:", str, l_ptr->addr, l_ptr->b_ptr->name);
if (link_working_unknown(l_ptr))
- tipc_printf(buf, ":WU");
+ pr_cont(":WU\n");
else if (link_reset_reset(l_ptr))
- tipc_printf(buf, ":RR");
+ pr_cont(":RR\n");
else if (link_reset_unknown(l_ptr))
- tipc_printf(buf, ":RU");
+ pr_cont(":RU\n");
else if (link_working_working(l_ptr))
- tipc_printf(buf, ":WW");
- tipc_printf(buf, "\n");
-
- tipc_printbuf_validate(buf);
- pr_info("TIPC: %s", print_area);
+ pr_cont(":WW\n");
+ else
+ pr_cont("\n");
}
--
1.7.9.7
^ permalink raw reply related
* [PATCH net-next 6/8] tipc: simplify print buffer handling in tipc_printf
From: Paul Gortmaker @ 2012-07-12 16:39 UTC (permalink / raw)
To: davem; +Cc: netdev, Jon Maloy, Erik Hugne, ying.xue, Paul Gortmaker
In-Reply-To: <1342111201-9426-1-git-send-email-paul.gortmaker@windriver.com>
From: Erik Hugne <erik.hugne@ericsson.com>
tipc_printf was previously used both to construct debug traces
and to append data to buffers that should be sent over netlink
to the tipc-config application. A global print_buffer was
used to format the string before it was copied to the actual
output buffer. This could lead to concurrent access of the
global print_buffer, which then had to be lock protected.
This is simplified by changing tipc_printf to append data
directly to the output buffer using vscnprintf.
With the new implementation of tipc_printf, there is no longer
any risk of concurrent access to the internal log buffer, so
the lock (and the comments describing it) are no longer
strictly necessary. However, there are still a few functions
that do grab this lock before resizing/dumping the log
buffer. We leave the lock, and these functions untouched since
they will be removed with a subsequent commit that drops the
deprecated log buffer handling code
Signed-off-by: Erik Hugne <erik.hugne@ericsson.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
net/tipc/log.c | 52 ++++++++++------------------------------------------
1 file changed, 10 insertions(+), 42 deletions(-)
diff --git a/net/tipc/log.c b/net/tipc/log.c
index 026733f..d01e37a 100644
--- a/net/tipc/log.c
+++ b/net/tipc/log.c
@@ -71,21 +71,11 @@ struct print_buf *const TIPC_LOG = &log_buf;
* on the caller to prevent simultaneous use of the print buffer(s) being
* manipulated.
*/
-static char print_string[TIPC_PB_MAX_STR];
static DEFINE_SPINLOCK(print_lock);
static void tipc_printbuf_move(struct print_buf *pb_to,
struct print_buf *pb_from);
-#define FORMAT(PTR, LEN, FMT) \
-{\
- va_list args;\
- va_start(args, FMT);\
- LEN = vsprintf(PTR, FMT, args);\
- va_end(args);\
- *(PTR + LEN) = '\0';\
-}
-
/**
* tipc_printbuf_init - initialize print buffer to empty
* @pb: pointer to print buffer structure
@@ -220,39 +210,17 @@ static void tipc_printbuf_move(struct print_buf *pb_to,
*/
void tipc_printf(struct print_buf *pb, const char *fmt, ...)
{
- int chars_to_add;
- int chars_left;
- char save_char;
-
- spin_lock_bh(&print_lock);
-
- FORMAT(print_string, chars_to_add, fmt);
- if (chars_to_add >= TIPC_PB_MAX_STR)
- strcpy(print_string, "*** PRINT BUFFER STRING TOO LONG ***");
-
- if (pb->buf) {
- chars_left = pb->buf + pb->size - pb->crs - 1;
- if (chars_to_add <= chars_left) {
- strcpy(pb->crs, print_string);
- pb->crs += chars_to_add;
- } else if (chars_to_add >= (pb->size - 1)) {
- strcpy(pb->buf, print_string + chars_to_add + 1
- - pb->size);
- pb->crs = pb->buf + pb->size - 1;
- } else {
- strcpy(pb->buf, print_string + chars_left);
- save_char = print_string[chars_left];
- print_string[chars_left] = 0;
- strcpy(pb->crs, print_string);
- print_string[chars_left] = save_char;
- pb->crs = pb->buf + chars_to_add - chars_left;
- }
- }
-
- if (pb->echo)
- printk("%s", print_string);
+ int i;
+ va_list args;
+ char *buf;
+ int len;
- spin_unlock_bh(&print_lock);
+ buf = pb->crs;
+ len = pb->buf + pb->size - pb->crs;
+ va_start(args, fmt);
+ i = vscnprintf(buf, len, fmt, args);
+ va_end(args);
+ pb->crs += i;
}
/**
--
1.7.9.7
^ permalink raw reply related
* [PATCH net-next 3/8] tipc: use standard printk shortcut macros (pr_err etc.)
From: Paul Gortmaker @ 2012-07-12 16:39 UTC (permalink / raw)
To: davem; +Cc: netdev, Jon Maloy, Erik Hugne, ying.xue, Paul Gortmaker
In-Reply-To: <1342111201-9426-1-git-send-email-paul.gortmaker@windriver.com>
From: Erik Hugne <erik.hugne@ericsson.com>
All messages should go directly to the kernel log. The TIPC
specific error, warning, info and debug trace macro's are
removed and all references replaced with pr_err, pr_warn,
pr_info and pr_debug.
Commonly used sub-strings are explicitly declared as a const
char to reduce .text size.
Note that this means the debug messages (changed to pr_debug),
are now enabled through dynamic debugging, instead of a TIPC
specific Kconfig option (TIPC_DEBUG). The latter will be
phased out completely
Signed-off-by: Erik Hugne <erik.hugne@ericsson.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
net/tipc/bcast.c | 2 +-
net/tipc/bearer.c | 52 ++++++++++++-----------
net/tipc/config.c | 6 +--
net/tipc/core.c | 10 ++---
net/tipc/core.h | 10 -----
net/tipc/discover.c | 4 +-
net/tipc/handler.c | 4 +-
net/tipc/link.c | 109 +++++++++++++++++++++++++-----------------------
net/tipc/name_distr.c | 25 +++++------
net/tipc/name_table.c | 40 +++++++++---------
net/tipc/net.c | 8 ++--
net/tipc/netlink.c | 2 +-
net/tipc/node.c | 23 +++++-----
net/tipc/node_subscr.c | 3 +-
net/tipc/port.c | 8 ++--
net/tipc/ref.c | 10 ++---
net/tipc/socket.c | 4 +-
net/tipc/subscr.c | 14 +++----
18 files changed, 168 insertions(+), 166 deletions(-)
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c
index d9df34f..c4414c7 100644
--- a/net/tipc/bcast.c
+++ b/net/tipc/bcast.c
@@ -880,7 +880,7 @@ void tipc_port_list_add(struct tipc_port_list *pl_ptr, u32 port)
if (!item->next) {
item->next = kmalloc(sizeof(*item), GFP_ATOMIC);
if (!item->next) {
- warn("Incomplete multicast delivery, no memory\n");
+ pr_warn("TIPC: Incomplete multicast delivery, no memory\n");
return;
}
item->next->next = NULL;
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index 86b703f..a663d30 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -123,7 +123,7 @@ int tipc_register_media(struct tipc_media *m_ptr)
exit:
write_unlock_bh(&tipc_net_lock);
if (res)
- warn("Media <%s> registration error\n", m_ptr->name);
+ pr_warn("TIPC: Media <%s> registration error\n", m_ptr->name);
return res;
}
@@ -418,12 +418,12 @@ int tipc_enable_bearer(const char *name, u32 disc_domain, u32 priority)
int res = -EINVAL;
if (!tipc_own_addr) {
- warn("Bearer <%s> rejected, not supported in standalone mode\n",
- name);
+ pr_warn("TIPC: Bearer <%s> rejected, not supported in standalone mode\n",
+ name);
return -ENOPROTOOPT;
}
if (!bearer_name_validate(name, &b_names)) {
- warn("Bearer <%s> rejected, illegal name\n", name);
+ pr_warn("TIPC: Bearer <%s> rejected, illegal name\n", name);
return -EINVAL;
}
if (tipc_addr_domain_valid(disc_domain) &&
@@ -435,12 +435,13 @@ int tipc_enable_bearer(const char *name, u32 disc_domain, u32 priority)
res = 0; /* accept specified node in own cluster */
}
if (res) {
- warn("Bearer <%s> rejected, illegal discovery domain\n", name);
+ pr_warn("TIPC: Bearer <%s> rejected, illegal discovery domain\n",
+ name);
return -EINVAL;
}
if ((priority > TIPC_MAX_LINK_PRI) &&
(priority != TIPC_MEDIA_LINK_PRI)) {
- warn("Bearer <%s> rejected, illegal priority\n", name);
+ pr_warn("TIPC: Bearer <%s> rejected, illegal priority\n", name);
return -EINVAL;
}
@@ -448,8 +449,8 @@ int tipc_enable_bearer(const char *name, u32 disc_domain, u32 priority)
m_ptr = tipc_media_find(b_names.media_name);
if (!m_ptr) {
- warn("Bearer <%s> rejected, media <%s> not registered\n", name,
- b_names.media_name);
+ pr_warn("TIPC: Bearer <%s> rejected, media <%s> not registered\n",
+ name, b_names.media_name);
goto exit;
}
@@ -465,24 +466,25 @@ restart:
continue;
}
if (!strcmp(name, tipc_bearers[i].name)) {
- warn("Bearer <%s> rejected, already enabled\n", name);
+ pr_warn("TIPC: Bearer <%s> rejected, already enabled\n",
+ name);
goto exit;
}
if ((tipc_bearers[i].priority == priority) &&
(++with_this_prio > 2)) {
if (priority-- == 0) {
- warn("Bearer <%s> rejected, duplicate priority\n",
- name);
+ pr_warn("TIPC: Bearer <%s> rejected, duplicate priority\n",
+ name);
goto exit;
}
- warn("Bearer <%s> priority adjustment required %u->%u\n",
- name, priority + 1, priority);
+ pr_warn("TIPC: Bearer <%s> priority adjustment required %u->%u\n",
+ name, priority + 1, priority);
goto restart;
}
}
if (bearer_id >= MAX_BEARERS) {
- warn("Bearer <%s> rejected, bearer limit reached (%u)\n",
- name, MAX_BEARERS);
+ pr_warn("TIPC: Bearer <%s> rejected, bearer limit reached (%u)\n",
+ name, MAX_BEARERS);
goto exit;
}
@@ -490,7 +492,8 @@ restart:
strcpy(b_ptr->name, name);
res = m_ptr->enable_bearer(b_ptr);
if (res) {
- warn("Bearer <%s> rejected, enable failure (%d)\n", name, -res);
+ pr_warn("TIPC: Bearer <%s> rejected, enable failure (%d)\n",
+ name, -res);
goto exit;
}
@@ -508,12 +511,13 @@ restart:
res = tipc_disc_create(b_ptr, &m_ptr->bcast_addr, disc_domain);
if (res) {
bearer_disable(b_ptr);
- warn("Bearer <%s> rejected, discovery object creation failed\n",
- name);
+ pr_warn("TIPC: Bearer <%s> rejected, discovery object creation failed\n",
+ name);
goto exit;
}
- info("Enabled bearer <%s>, discovery domain %s, priority %u\n",
- name, tipc_addr_string_fill(addr_string, disc_domain), priority);
+ pr_info("TIPC: Enabled bearer <%s>, discovery domain %s, priority %u\n",
+ name,
+ tipc_addr_string_fill(addr_string, disc_domain), priority);
exit:
write_unlock_bh(&tipc_net_lock);
return res;
@@ -531,12 +535,12 @@ int tipc_block_bearer(const char *name)
read_lock_bh(&tipc_net_lock);
b_ptr = tipc_bearer_find(name);
if (!b_ptr) {
- warn("Attempt to block unknown bearer <%s>\n", name);
+ pr_warn("TIPC: Attempt to block unknown bearer <%s>\n", name);
read_unlock_bh(&tipc_net_lock);
return -EINVAL;
}
- info("Blocking bearer <%s>\n", name);
+ pr_info("TIPC: Blocking bearer <%s>\n", name);
spin_lock_bh(&b_ptr->lock);
b_ptr->blocked = 1;
list_splice_init(&b_ptr->cong_links, &b_ptr->links);
@@ -562,7 +566,7 @@ static void bearer_disable(struct tipc_bearer *b_ptr)
struct tipc_link *l_ptr;
struct tipc_link *temp_l_ptr;
- info("Disabling bearer <%s>\n", b_ptr->name);
+ pr_info("TIPC: Disabling bearer <%s>\n", b_ptr->name);
spin_lock_bh(&b_ptr->lock);
b_ptr->blocked = 1;
b_ptr->media->disable_bearer(b_ptr);
@@ -584,7 +588,7 @@ int tipc_disable_bearer(const char *name)
write_lock_bh(&tipc_net_lock);
b_ptr = tipc_bearer_find(name);
if (b_ptr == NULL) {
- warn("Attempt to disable unknown bearer <%s>\n", name);
+ pr_warn("TIPC: Attempt to disable unknown bearer <%s>\n", name);
res = -EINVAL;
} else {
bearer_disable(b_ptr);
diff --git a/net/tipc/config.c b/net/tipc/config.c
index c5712a3..30e5b0a 100644
--- a/net/tipc/config.c
+++ b/net/tipc/config.c
@@ -432,7 +432,7 @@ static void cfg_named_msg_event(void *userdata,
if ((size < sizeof(*req_hdr)) ||
(size != TCM_ALIGN(ntohl(req_hdr->tcm_len))) ||
(ntohs(req_hdr->tcm_flags) != TCM_F_REQUEST)) {
- warn("Invalid configuration message discarded\n");
+ pr_warn("TIPC: Invalid configuration message discarded\n");
return;
}
@@ -478,7 +478,7 @@ int tipc_cfg_init(void)
return 0;
failed:
- err("Unable to create configuration service\n");
+ pr_err("TIPC: Unable to create configuration service\n");
return res;
}
@@ -494,7 +494,7 @@ void tipc_cfg_reinit(void)
seq.lower = seq.upper = tipc_own_addr;
res = tipc_publish(config_port_ref, TIPC_ZONE_SCOPE, &seq);
if (res)
- err("Unable to reinitialize configuration service\n");
+ pr_err("TIPC: Unable to reinitialize configuration service\n");
}
void tipc_cfg_stop(void)
diff --git a/net/tipc/core.c b/net/tipc/core.c
index f7b9523..019d054 100644
--- a/net/tipc/core.c
+++ b/net/tipc/core.c
@@ -162,9 +162,9 @@ static int __init tipc_init(void)
int res;
if (tipc_log_resize(CONFIG_TIPC_LOG) != 0)
- warn("Unable to create log buffer\n");
+ pr_warn("TIPC: Unable to create log buffer\n");
- info("Activated (version " TIPC_MOD_VER ")\n");
+ pr_info("TIPC: Activated (version " TIPC_MOD_VER ")\n");
tipc_own_addr = 0;
tipc_remote_management = 1;
@@ -175,9 +175,9 @@ static int __init tipc_init(void)
res = tipc_core_start();
if (res)
- err("Unable to start in single node mode\n");
+ pr_err("TIPC: Unable to start in single node mode\n");
else
- info("Started in single node mode\n");
+ pr_info("TIPC: Started in single node mode\n");
return res;
}
@@ -185,7 +185,7 @@ static void __exit tipc_exit(void)
{
tipc_core_stop_net();
tipc_core_stop();
- info("Deactivated\n");
+ pr_info("TIPC: Deactivated\n");
}
module_init(tipc_init);
diff --git a/net/tipc/core.h b/net/tipc/core.h
index 2a9bb99..e8b4909 100644
--- a/net/tipc/core.h
+++ b/net/tipc/core.h
@@ -89,13 +89,6 @@ void tipc_printf(struct print_buf *, const char *fmt, ...);
#define TIPC_OUTPUT TIPC_LOG
#endif
-#define err(fmt, arg...) tipc_printf(TIPC_OUTPUT, \
- KERN_ERR "TIPC: " fmt, ## arg)
-#define warn(fmt, arg...) tipc_printf(TIPC_OUTPUT, \
- KERN_WARNING "TIPC: " fmt, ## arg)
-#define info(fmt, arg...) tipc_printf(TIPC_OUTPUT, \
- KERN_NOTICE "TIPC: " fmt, ## arg)
-
#ifdef CONFIG_TIPC_DEBUG
/*
@@ -105,15 +98,12 @@ void tipc_printf(struct print_buf *, const char *fmt, ...);
#define DBG_OUTPUT TIPC_LOG
#endif
-#define dbg(fmt, arg...) tipc_printf(DBG_OUTPUT, KERN_DEBUG fmt, ## arg);
-
#define msg_dbg(msg, txt) tipc_msg_dbg(DBG_OUTPUT, msg, txt);
void tipc_msg_dbg(struct print_buf *, struct tipc_msg *, const char *);
#else
-#define dbg(fmt, arg...) do {} while (0)
#define msg_dbg(msg, txt) do {} while (0)
#define tipc_msg_dbg(buf, msg, txt) do {} while (0)
diff --git a/net/tipc/discover.c b/net/tipc/discover.c
index ae054cf..8f92e52 100644
--- a/net/tipc/discover.c
+++ b/net/tipc/discover.c
@@ -106,8 +106,8 @@ static void disc_dupl_alert(struct tipc_bearer *b_ptr, u32 node_addr,
tipc_printbuf_init(&pb, media_addr_str, sizeof(media_addr_str));
tipc_media_addr_printf(&pb, media_addr);
tipc_printbuf_validate(&pb);
- warn("Duplicate %s using %s seen on <%s>\n",
- node_addr_str, media_addr_str, b_ptr->name);
+ pr_warn("TIPC: Duplicate %s using %s seen on <%s>\n",
+ node_addr_str, media_addr_str, b_ptr->name);
}
/**
diff --git a/net/tipc/handler.c b/net/tipc/handler.c
index 9c6f22f..061e7a6 100644
--- a/net/tipc/handler.c
+++ b/net/tipc/handler.c
@@ -57,14 +57,14 @@ unsigned int tipc_k_signal(Handler routine, unsigned long argument)
struct queue_item *item;
if (!handler_enabled) {
- err("Signal request ignored by handler\n");
+ pr_err("TIPC: Signal request ignored by handler\n");
return -ENOPROTOOPT;
}
spin_lock_bh(&qitem_lock);
item = kmem_cache_alloc(tipc_queue_item_cache, GFP_ATOMIC);
if (!item) {
- err("Signal queue out of memory\n");
+ pr_err("TIPC: Signal queue out of memory\n");
spin_unlock_bh(&qitem_lock);
return -ENOMEM;
}
diff --git a/net/tipc/link.c b/net/tipc/link.c
index f6bf483..da1f3c5 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -41,6 +41,12 @@
#include "discover.h"
#include "config.h"
+/*
+ * Error message prefixes
+ */
+static const char *link_co_err = "TIPC: Link changeover error, ";
+static const char *link_rst_msg = "TIPC: Resetting link ";
+static const char *link_unk_evt = "TIPC: Unknown link event ";
/*
* Out-of-range value for link session numbers
@@ -300,20 +306,21 @@ struct tipc_link *tipc_link_create(struct tipc_node *n_ptr,
if (n_ptr->link_cnt >= 2) {
tipc_addr_string_fill(addr_string, n_ptr->addr);
- err("Attempt to establish third link to %s\n", addr_string);
+ pr_err("TIPC: Attempt to establish third link to %s\n",
+ addr_string);
return NULL;
}
if (n_ptr->links[b_ptr->identity]) {
tipc_addr_string_fill(addr_string, n_ptr->addr);
- err("Attempt to establish second link on <%s> to %s\n",
+ pr_err("TIPC: Attempt to establish second link on <%s> to %s\n",
b_ptr->name, addr_string);
return NULL;
}
l_ptr = kzalloc(sizeof(*l_ptr), GFP_ATOMIC);
if (!l_ptr) {
- warn("Link creation failed, no memory\n");
+ pr_warn("TIPC: Link creation failed, no memory\n");
return NULL;
}
@@ -371,7 +378,7 @@ struct tipc_link *tipc_link_create(struct tipc_node *n_ptr,
void tipc_link_delete(struct tipc_link *l_ptr)
{
if (!l_ptr) {
- err("Attempt to delete non-existent link\n");
+ pr_err("TIPC: Attempt to delete non-existent link\n");
return;
}
@@ -632,8 +639,8 @@ static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
link_set_timer(l_ptr, cont_intv / 4);
break;
case RESET_MSG:
- info("Resetting link <%s>, requested by peer\n",
- l_ptr->name);
+ pr_info("%s<%s>, requested by peer\n", link_rst_msg,
+ l_ptr->name);
tipc_link_reset(l_ptr);
l_ptr->state = RESET_RESET;
l_ptr->fsm_msg_cnt = 0;
@@ -642,7 +649,7 @@ static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
link_set_timer(l_ptr, cont_intv);
break;
default:
- err("Unknown link event %u in WW state\n", event);
+ pr_err("%s%u in WW state\n", link_unk_evt, event);
}
break;
case WORKING_UNKNOWN:
@@ -654,8 +661,8 @@ static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
link_set_timer(l_ptr, cont_intv);
break;
case RESET_MSG:
- info("Resetting link <%s>, requested by peer "
- "while probing\n", l_ptr->name);
+ pr_info("%s<%s>, requested by peer while probing\n",
+ link_rst_msg, l_ptr->name);
tipc_link_reset(l_ptr);
l_ptr->state = RESET_RESET;
l_ptr->fsm_msg_cnt = 0;
@@ -680,8 +687,8 @@ static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
l_ptr->fsm_msg_cnt++;
link_set_timer(l_ptr, cont_intv / 4);
} else { /* Link has failed */
- warn("Resetting link <%s>, peer not responding\n",
- l_ptr->name);
+ pr_warn("%s<%s>, peer not responding\n",
+ link_rst_msg, l_ptr->name);
tipc_link_reset(l_ptr);
l_ptr->state = RESET_UNKNOWN;
l_ptr->fsm_msg_cnt = 0;
@@ -692,7 +699,7 @@ static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
}
break;
default:
- err("Unknown link event %u in WU state\n", event);
+ pr_err("%s%u in WU state\n", link_unk_evt, event);
}
break;
case RESET_UNKNOWN:
@@ -726,7 +733,7 @@ static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
link_set_timer(l_ptr, cont_intv);
break;
default:
- err("Unknown link event %u in RU state\n", event);
+ pr_err("%s%u in RU state\n", link_unk_evt, event);
}
break;
case RESET_RESET:
@@ -751,11 +758,11 @@ static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
link_set_timer(l_ptr, cont_intv);
break;
default:
- err("Unknown link event %u in RR state\n", event);
+ pr_err("%s%u in RR state\n", link_unk_evt, event);
}
break;
default:
- err("Unknown link state %u/%u\n", l_ptr->state, event);
+ pr_err("TIPC: Unknown link state %u/%u\n", l_ptr->state, event);
}
}
@@ -856,7 +863,8 @@ int tipc_link_send_buf(struct tipc_link *l_ptr, struct sk_buff *buf)
}
kfree_skb(buf);
if (imp > CONN_MANAGER) {
- warn("Resetting link <%s>, send queue full", l_ptr->name);
+ pr_warn("%s<%s>, send queue full", link_rst_msg,
+ l_ptr->name);
tipc_link_reset(l_ptr);
}
return dsz;
@@ -1409,8 +1417,8 @@ static void link_reset_all(unsigned long addr)
tipc_node_lock(n_ptr);
- warn("Resetting all links to %s\n",
- tipc_addr_string_fill(addr_string, n_ptr->addr));
+ pr_warn("TIPC: Resetting all links to %s\n",
+ tipc_addr_string_fill(addr_string, n_ptr->addr));
for (i = 0; i < MAX_BEARERS; i++) {
if (n_ptr->links[i]) {
@@ -1428,7 +1436,7 @@ static void link_retransmit_failure(struct tipc_link *l_ptr,
{
struct tipc_msg *msg = buf_msg(buf);
- warn("Retransmission failure on link <%s>\n", l_ptr->name);
+ pr_warn("TIPC: Retransmission failure on link <%s>\n", l_ptr->name);
if (l_ptr->addr) {
/* Handle failure on standard link */
@@ -1440,21 +1448,21 @@ static void link_retransmit_failure(struct tipc_link *l_ptr,
struct tipc_node *n_ptr;
char addr_string[16];
- info("Msg seq number: %u, ", msg_seqno(msg));
- info("Outstanding acks: %lu\n",
- (unsigned long) TIPC_SKB_CB(buf)->handle);
+ pr_info("TIPC: Msg seq number: %u, ", msg_seqno(msg));
+ pr_info("TIPC: Outstanding acks: %lu\n",
+ (unsigned long) TIPC_SKB_CB(buf)->handle);
n_ptr = tipc_bclink_retransmit_to();
tipc_node_lock(n_ptr);
tipc_addr_string_fill(addr_string, n_ptr->addr);
- info("Broadcast link info for %s\n", addr_string);
- info("Supportable: %d, ", n_ptr->bclink.supportable);
- info("Supported: %d, ", n_ptr->bclink.supported);
- info("Acked: %u\n", n_ptr->bclink.acked);
- info("Last in: %u, ", n_ptr->bclink.last_in);
- info("Oos state: %u, ", n_ptr->bclink.oos_state);
- info("Last sent: %u\n", n_ptr->bclink.last_sent);
+ pr_info("TIPC: Broadcast link info for %s\n", addr_string);
+ pr_info("TIPC: Supportable: %d, ", n_ptr->bclink.supportable);
+ pr_info("TIPC: Supported: %d, ", n_ptr->bclink.supported);
+ pr_info("TIPC: Acked: %u\n", n_ptr->bclink.acked);
+ pr_info("TIPC: Last in: %u, ", n_ptr->bclink.last_in);
+ pr_info("TIPC: Oos state: %u, ", n_ptr->bclink.oos_state);
+ pr_info("TIPC: Last sent: %u\n", n_ptr->bclink.last_sent);
tipc_k_signal((Handler)link_reset_all, (unsigned long)n_ptr->addr);
@@ -1479,7 +1487,7 @@ void tipc_link_retransmit(struct tipc_link *l_ptr, struct sk_buff *buf,
l_ptr->retransm_queue_head = msg_seqno(msg);
l_ptr->retransm_queue_size = retransmits;
} else {
- err("Unexpected retransmit on link %s (qsize=%d)\n",
+ pr_err("TIPC: Unexpected retransmit on link %s (qsize=%d)\n",
l_ptr->name, l_ptr->retransm_queue_size);
}
return;
@@ -2074,8 +2082,9 @@ static void link_recv_proto_msg(struct tipc_link *l_ptr, struct sk_buff *buf)
if (msg_linkprio(msg) &&
(msg_linkprio(msg) != l_ptr->priority)) {
- warn("Resetting link <%s>, priority change %u->%u\n",
- l_ptr->name, l_ptr->priority, msg_linkprio(msg));
+ pr_warn("%s<%s>, priority change %u->%u\n",
+ link_rst_msg, l_ptr->name, l_ptr->priority,
+ msg_linkprio(msg));
l_ptr->priority = msg_linkprio(msg);
tipc_link_reset(l_ptr); /* Enforce change to take effect */
break;
@@ -2139,15 +2148,13 @@ static void tipc_link_tunnel(struct tipc_link *l_ptr,
tunnel = l_ptr->owner->active_links[selector & 1];
if (!tipc_link_is_up(tunnel)) {
- warn("Link changeover error, "
- "tunnel link no longer available\n");
+ pr_warn("%stunnel link no longer available\n", link_co_err);
return;
}
msg_set_size(tunnel_hdr, length + INT_H_SIZE);
buf = tipc_buf_acquire(length + INT_H_SIZE);
if (!buf) {
- warn("Link changeover error, "
- "unable to send tunnel msg\n");
+ pr_warn("%sunable to send tunnel msg\n", link_co_err);
return;
}
skb_copy_to_linear_data(buf, tunnel_hdr, INT_H_SIZE);
@@ -2173,8 +2180,7 @@ void tipc_link_changeover(struct tipc_link *l_ptr)
return;
if (!l_ptr->owner->permit_changeover) {
- warn("Link changeover error, "
- "peer did not permit changeover\n");
+ pr_warn("%speer did not permit changeover\n", link_co_err);
return;
}
@@ -2192,8 +2198,8 @@ void tipc_link_changeover(struct tipc_link *l_ptr)
msg_set_size(&tunnel_hdr, INT_H_SIZE);
tipc_link_send_buf(tunnel, buf);
} else {
- warn("Link changeover error, "
- "unable to send changeover msg\n");
+ pr_warn("%sunable to send changeover msg\n",
+ link_co_err);
}
return;
}
@@ -2246,8 +2252,8 @@ void tipc_link_send_duplicate(struct tipc_link *l_ptr, struct tipc_link *tunnel)
msg_set_size(&tunnel_hdr, length + INT_H_SIZE);
outbuf = tipc_buf_acquire(length + INT_H_SIZE);
if (outbuf == NULL) {
- warn("Link changeover error, "
- "unable to send duplicate msg\n");
+ pr_warn("%sunable to send duplicate msg\n",
+ link_co_err);
return;
}
skb_copy_to_linear_data(outbuf, &tunnel_hdr, INT_H_SIZE);
@@ -2298,7 +2304,7 @@ static int link_recv_changeover_msg(struct tipc_link **l_ptr,
if (!dest_link)
goto exit;
if (dest_link == *l_ptr) {
- err("Unexpected changeover message on link <%s>\n",
+ pr_err("TIPC: Unexpected changeover message on link <%s>\n",
(*l_ptr)->name);
goto exit;
}
@@ -2310,7 +2316,7 @@ static int link_recv_changeover_msg(struct tipc_link **l_ptr,
goto exit;
*buf = buf_extract(tunnel_buf, INT_H_SIZE);
if (*buf == NULL) {
- warn("Link changeover error, duplicate msg dropped\n");
+ pr_warn("%sduplicate msg dropped\n", link_co_err);
goto exit;
}
kfree_skb(tunnel_buf);
@@ -2319,8 +2325,8 @@ static int link_recv_changeover_msg(struct tipc_link **l_ptr,
/* First original message ?: */
if (tipc_link_is_up(dest_link)) {
- info("Resetting link <%s>, changeover initiated by peer\n",
- dest_link->name);
+ pr_info("%s<%s>, changeover initiated by peer\n", link_rst_msg,
+ dest_link->name);
tipc_link_reset(dest_link);
dest_link->exp_msg_count = msg_count;
if (!msg_count)
@@ -2333,8 +2339,7 @@ static int link_recv_changeover_msg(struct tipc_link **l_ptr,
/* Receive original message */
if (dest_link->exp_msg_count == 0) {
- warn("Link switchover error, "
- "got too many tunnelled messages\n");
+ pr_warn("%sgot too many tunnelled messages\n", link_co_err);
goto exit;
}
dest_link->exp_msg_count--;
@@ -2346,7 +2351,7 @@ static int link_recv_changeover_msg(struct tipc_link **l_ptr,
kfree_skb(tunnel_buf);
return 1;
} else {
- warn("Link changeover error, original msg dropped\n");
+ pr_warn("%soriginal msg dropped\n", link_co_err);
}
}
exit:
@@ -2367,7 +2372,7 @@ void tipc_link_recv_bundle(struct sk_buff *buf)
while (msgcount--) {
obuf = buf_extract(buf, pos);
if (obuf == NULL) {
- warn("Link unable to unbundle message(s)\n");
+ pr_warn("TIPC: Link unable to unbundle message(s)\n");
break;
}
pos += align(msg_size(buf_msg(obuf)));
@@ -2538,7 +2543,7 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
set_fragm_size(pbuf, fragm_sz);
set_expected_frags(pbuf, exp_fragm_cnt - 1);
} else {
- dbg("Link unable to reassemble fragmented message\n");
+ pr_debug("TIPC: Link unable to reassemble fragmented message\n");
kfree_skb(fbuf);
return -1;
}
@@ -3060,5 +3065,5 @@ print_state:
tipc_printf(buf, "\n");
tipc_printbuf_validate(buf);
- info("%s", print_area);
+ pr_info("TIPC: %s", print_area);
}
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c
index 158318e..cdd614e 100644
--- a/net/tipc/name_distr.c
+++ b/net/tipc/name_distr.c
@@ -161,7 +161,7 @@ void tipc_named_publish(struct publication *publ)
buf = named_prepare_buf(PUBLICATION, ITEM_SIZE, 0);
if (!buf) {
- warn("Publication distribution failure\n");
+ pr_warn("TIPC: Publication distribution failure\n");
return;
}
@@ -186,7 +186,7 @@ void tipc_named_withdraw(struct publication *publ)
buf = named_prepare_buf(WITHDRAWAL, ITEM_SIZE, 0);
if (!buf) {
- warn("Withdrawal distribution failure\n");
+ pr_warn("TIPC: Withdrawal distribution failure\n");
return;
}
@@ -213,7 +213,7 @@ static void named_distribute(struct list_head *message_list, u32 node,
rest -= left;
buf = named_prepare_buf(PUBLICATION, left, node);
if (!buf) {
- warn("Bulk publication failure\n");
+ pr_warn("TIPC: Bulk publication failure\n");
return;
}
item = (struct distr_item *)msg_data(buf_msg(buf));
@@ -283,9 +283,10 @@ static void named_purge_publ(struct publication *publ)
write_unlock_bh(&tipc_nametbl_lock);
if (p != publ) {
- err("Unable to remove publication from failed node\n"
- "(type=%u, lower=%u, node=0x%x, ref=%u, key=%u)\n",
- publ->type, publ->lower, publ->node, publ->ref, publ->key);
+ pr_err("TIPC: Unable to remove publication from failed node\n"
+ " (type=%u, lower=%u, node=0x%x, ref=%u, key=%u)\n",
+ publ->type, publ->lower, publ->node, publ->ref,
+ publ->key);
}
kfree(p);
@@ -329,14 +330,14 @@ void tipc_named_recv(struct sk_buff *buf)
tipc_nodesub_unsubscribe(&publ->subscr);
kfree(publ);
} else {
- err("Unable to remove publication by node 0x%x\n"
- "(type=%u, lower=%u, ref=%u, key=%u)\n",
- msg_orignode(msg),
- ntohl(item->type), ntohl(item->lower),
- ntohl(item->ref), ntohl(item->key));
+ pr_err("TIPC: Unable to remove publication by node 0x%x\n"
+ " (type=%u, lower=%u, ref=%u, key=%u)\n",
+ msg_orignode(msg), ntohl(item->type),
+ ntohl(item->lower), ntohl(item->ref),
+ ntohl(item->key));
}
} else {
- warn("Unrecognized name table message received\n");
+ pr_warn("TIPC: Unrecognized name table message received\n");
}
item++;
}
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c
index cade0ac..0b48fbb 100644
--- a/net/tipc/name_table.c
+++ b/net/tipc/name_table.c
@@ -126,7 +126,7 @@ static struct publication *publ_create(u32 type, u32 lower, u32 upper,
{
struct publication *publ = kzalloc(sizeof(*publ), GFP_ATOMIC);
if (publ == NULL) {
- warn("Publication creation failure, no memory\n");
+ pr_warn("TIPC: Publication creation failure, no memory\n");
return NULL;
}
@@ -163,7 +163,7 @@ static struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_hea
struct sub_seq *sseq = tipc_subseq_alloc(1);
if (!nseq || !sseq) {
- warn("Name sequence creation failed, no memory\n");
+ pr_warn("TIPC: Name sequence creation failed, no memory\n");
kfree(nseq);
kfree(sseq);
return NULL;
@@ -263,8 +263,8 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
/* Lower end overlaps existing entry => need an exact match */
if ((sseq->lower != lower) || (sseq->upper != upper)) {
- warn("Cannot publish {%u,%u,%u}, overlap error\n",
- type, lower, upper);
+ pr_warn("TIPC: Cannot publish {%u,%u,%u}, overlap error\n",
+ type, lower, upper);
return NULL;
}
@@ -286,8 +286,8 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
/* Fail if upper end overlaps into an existing entry */
if ((inspos < nseq->first_free) &&
(upper >= nseq->sseqs[inspos].lower)) {
- warn("Cannot publish {%u,%u,%u}, overlap error\n",
- type, lower, upper);
+ pr_warn("TIPC: Cannot publish {%u,%u,%u}, overlap error\n",
+ type, lower, upper);
return NULL;
}
@@ -296,8 +296,8 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
struct sub_seq *sseqs = tipc_subseq_alloc(nseq->alloc * 2);
if (!sseqs) {
- warn("Cannot publish {%u,%u,%u}, no memory\n",
- type, lower, upper);
+ pr_warn("TIPC: Cannot publish {%u,%u,%u}, no memory\n",
+ type, lower, upper);
return NULL;
}
memcpy(sseqs, nseq->sseqs,
@@ -309,8 +309,8 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
info = kzalloc(sizeof(*info), GFP_ATOMIC);
if (!info) {
- warn("Cannot publish {%u,%u,%u}, no memory\n",
- type, lower, upper);
+ pr_warn("TIPC: Cannot publish {%u,%u,%u}, no memory\n",
+ type, lower, upper);
return NULL;
}
@@ -492,8 +492,8 @@ struct publication *tipc_nametbl_insert_publ(u32 type, u32 lower, u32 upper,
if ((scope < TIPC_ZONE_SCOPE) || (scope > TIPC_NODE_SCOPE) ||
(lower > upper)) {
- dbg("Failed to publish illegal {%u,%u,%u} with scope %u\n",
- type, lower, upper, scope);
+ pr_debug("TIPC: Failed to publish illegal {%u,%u,%u} with scope %u\n",
+ type, lower, upper, scope);
return NULL;
}
@@ -668,8 +668,8 @@ struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper,
struct publication *publ;
if (table.local_publ_count >= tipc_max_publications) {
- warn("Publication failed, local publication limit reached (%u)\n",
- tipc_max_publications);
+ pr_warn("TIPC: Publication failed, local publication limit reached (%u)\n",
+ tipc_max_publications);
return NULL;
}
@@ -702,9 +702,9 @@ int tipc_nametbl_withdraw(u32 type, u32 lower, u32 ref, u32 key)
return 1;
}
write_unlock_bh(&tipc_nametbl_lock);
- err("Unable to remove local publication\n"
- "(type=%u, lower=%u, ref=%u, key=%u)\n",
- type, lower, ref, key);
+ pr_err("TIPC: Unable to remove local publication\n"
+ "(type=%u, lower=%u, ref=%u, key=%u)\n",
+ type, lower, ref, key);
return 0;
}
@@ -725,8 +725,8 @@ void tipc_nametbl_subscribe(struct tipc_subscription *s)
tipc_nameseq_subscribe(seq, s);
spin_unlock_bh(&seq->lock);
} else {
- warn("Failed to create subscription for {%u,%u,%u}\n",
- s->seq.type, s->seq.lower, s->seq.upper);
+ pr_warn("TIPC: Failed to create subscription for {%u,%u,%u}\n",
+ s->seq.type, s->seq.lower, s->seq.upper);
}
write_unlock_bh(&tipc_nametbl_lock);
}
@@ -942,7 +942,7 @@ void tipc_nametbl_stop(void)
for (i = 0; i < tipc_nametbl_size; i++) {
if (hlist_empty(&table.types[i]))
continue;
- err("tipc_nametbl_stop(): orphaned hash chain detected\n");
+ pr_err("TIPC: nametbl_stop(): orphaned hash chain detected\n");
break;
}
kfree(table.types);
diff --git a/net/tipc/net.c b/net/tipc/net.c
index 7c236c8..38a34b9 100644
--- a/net/tipc/net.c
+++ b/net/tipc/net.c
@@ -184,9 +184,9 @@ int tipc_net_start(u32 addr)
tipc_cfg_reinit();
- info("Started in network mode\n");
- info("Own node address %s, network identity %u\n",
- tipc_addr_string_fill(addr_string, tipc_own_addr), tipc_net_id);
+ pr_info("TIPC: Started in network mode\n");
+ pr_info("TIPC: Own node address %s, network identity %u\n",
+ tipc_addr_string_fill(addr_string, tipc_own_addr), tipc_net_id);
return 0;
}
@@ -202,5 +202,5 @@ void tipc_net_stop(void)
list_for_each_entry_safe(node, t_node, &tipc_node_list, list)
tipc_node_delete(node);
write_unlock_bh(&tipc_net_lock);
- info("Left network mode\n");
+ pr_info("TIPC: Left network mode\n");
}
diff --git a/net/tipc/netlink.c b/net/tipc/netlink.c
index 7bda8e3..f8ca12d 100644
--- a/net/tipc/netlink.c
+++ b/net/tipc/netlink.c
@@ -90,7 +90,7 @@ int tipc_netlink_start(void)
res = genl_register_family_with_ops(&tipc_genl_family,
&tipc_genl_ops, 1);
if (res) {
- err("Failed to register netlink interface\n");
+ pr_err("TIPC: Failed to register netlink interface\n");
return res;
}
diff --git a/net/tipc/node.c b/net/tipc/node.c
index d4fd341..e03fc45 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -105,7 +105,7 @@ struct tipc_node *tipc_node_create(u32 addr)
n_ptr = kzalloc(sizeof(*n_ptr), GFP_ATOMIC);
if (!n_ptr) {
spin_unlock_bh(&node_create_lock);
- warn("Node creation failed, no memory\n");
+ pr_warn("TIPC: Node creation failed, no memory\n");
return NULL;
}
@@ -151,8 +151,8 @@ void tipc_node_link_up(struct tipc_node *n_ptr, struct tipc_link *l_ptr)
n_ptr->working_links++;
- info("Established link <%s> on network plane %c\n",
- l_ptr->name, l_ptr->b_ptr->net_plane);
+ pr_info("TIPC: Established link <%s> on network plane %c\n",
+ l_ptr->name, l_ptr->b_ptr->net_plane);
if (!active[0]) {
active[0] = active[1] = l_ptr;
@@ -160,7 +160,7 @@ void tipc_node_link_up(struct tipc_node *n_ptr, struct tipc_link *l_ptr)
return;
}
if (l_ptr->priority < active[0]->priority) {
- info("New link <%s> becomes standby\n", l_ptr->name);
+ pr_info("TIPC: New link <%s> becomes standby\n", l_ptr->name);
return;
}
tipc_link_send_duplicate(active[0], l_ptr);
@@ -168,9 +168,10 @@ void tipc_node_link_up(struct tipc_node *n_ptr, struct tipc_link *l_ptr)
active[0] = l_ptr;
return;
}
- info("Old link <%s> becomes standby\n", active[0]->name);
+ pr_info("TIPC: Old link <%s> becomes standby\n", active[0]->name);
if (active[1] != active[0])
- info("Old link <%s> becomes standby\n", active[1]->name);
+ pr_info("TIPC: Old link <%s> becomes standby\n",
+ active[1]->name);
active[0] = active[1] = l_ptr;
}
@@ -211,11 +212,11 @@ void tipc_node_link_down(struct tipc_node *n_ptr, struct tipc_link *l_ptr)
n_ptr->working_links--;
if (!tipc_link_is_active(l_ptr)) {
- info("Lost standby link <%s> on network plane %c\n",
- l_ptr->name, l_ptr->b_ptr->net_plane);
+ pr_info("TIPC: Lost standby link <%s> on network plane %c\n",
+ l_ptr->name, l_ptr->b_ptr->net_plane);
return;
}
- info("Lost link <%s> on network plane %c\n",
+ pr_info("TIPC: Lost link <%s> on network plane %c\n",
l_ptr->name, l_ptr->b_ptr->net_plane);
active = &n_ptr->active_links[0];
@@ -290,8 +291,8 @@ static void node_lost_contact(struct tipc_node *n_ptr)
char addr_string[16];
u32 i;
- info("Lost contact with %s\n",
- tipc_addr_string_fill(addr_string, n_ptr->addr));
+ pr_info("TIPC: Lost contact with %s\n",
+ tipc_addr_string_fill(addr_string, n_ptr->addr));
/* Flush broadcast link info associated with lost node */
if (n_ptr->bclink.supported) {
diff --git a/net/tipc/node_subscr.c b/net/tipc/node_subscr.c
index 7a27344..2256281 100644
--- a/net/tipc/node_subscr.c
+++ b/net/tipc/node_subscr.c
@@ -51,7 +51,8 @@ void tipc_nodesub_subscribe(struct tipc_node_subscr *node_sub, u32 addr,
node_sub->node = tipc_node_find(addr);
if (!node_sub->node) {
- warn("Node subscription rejected, unknown node 0x%x\n", addr);
+ pr_warn("TIPC: Node subscription rejected, unknown node 0x%x\n",
+ addr);
return;
}
node_sub->handle_node_down = handle_down;
diff --git a/net/tipc/port.c b/net/tipc/port.c
index 70bf78b..5d374d7 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -191,7 +191,7 @@ void tipc_port_recv_mcast(struct sk_buff *buf, struct tipc_port_list *dp)
struct sk_buff *b = skb_clone(buf, GFP_ATOMIC);
if (b == NULL) {
- warn("Unable to deliver multicast message(s)\n");
+ pr_warn("TIPC: Unable to deliver multicast message(s)\n");
goto exit;
}
if ((index == 0) && (cnt != 0))
@@ -221,12 +221,12 @@ struct tipc_port *tipc_createport_raw(void *usr_handle,
p_ptr = kzalloc(sizeof(*p_ptr), GFP_ATOMIC);
if (!p_ptr) {
- warn("Port creation failed, no memory\n");
+ pr_warn("TIPC: Port creation failed, no memory\n");
return NULL;
}
ref = tipc_ref_acquire(p_ptr, &p_ptr->lock);
if (!ref) {
- warn("Port creation failed, reference table exhausted\n");
+ pr_warn("TIPC: Port creation failed, ref. table exhausted\n");
kfree(p_ptr);
return NULL;
}
@@ -906,7 +906,7 @@ int tipc_createport(void *usr_handle,
up_ptr = kmalloc(sizeof(*up_ptr), GFP_ATOMIC);
if (!up_ptr) {
- warn("Port creation failed, no memory\n");
+ pr_warn("TIPC: Port creation failed, no memory\n");
return -ENOMEM;
}
p_ptr = tipc_createport_raw(NULL, port_dispatcher, port_wakeup,
diff --git a/net/tipc/ref.c b/net/tipc/ref.c
index 5cada0e..7435871 100644
--- a/net/tipc/ref.c
+++ b/net/tipc/ref.c
@@ -153,11 +153,11 @@ u32 tipc_ref_acquire(void *object, spinlock_t **lock)
struct reference *entry = NULL;
if (!object) {
- err("Attempt to acquire reference to non-existent object\n");
+ pr_err("TIPC: Attempt to acquire ref. to non-existent obj\n");
return 0;
}
if (!tipc_ref_table.entries) {
- err("Reference table not found during acquisition attempt\n");
+ pr_err("TIPC: Ref. table not found in acquisition attempt\n");
return 0;
}
@@ -211,7 +211,7 @@ void tipc_ref_discard(u32 ref)
u32 index_mask;
if (!tipc_ref_table.entries) {
- err("Reference table not found during discard attempt\n");
+ pr_err("TIPC: Ref. table not found during discard attempt\n");
return;
}
@@ -222,11 +222,11 @@ void tipc_ref_discard(u32 ref)
write_lock_bh(&ref_table_lock);
if (!entry->object) {
- err("Attempt to discard reference to non-existent object\n");
+ pr_err("TIPC: Attempt to discard ref. to non-existent obj\n");
goto exit;
}
if (entry->ref != ref) {
- err("Attempt to discard non-existent reference\n");
+ pr_err("TIPC: Attempt to discard non-existent reference\n");
goto exit;
}
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 1ebb49f..fefec9c 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -1787,13 +1787,13 @@ int tipc_socket_init(void)
res = proto_register(&tipc_proto, 1);
if (res) {
- err("Failed to register TIPC protocol type\n");
+ pr_err("TIPC: Failed to register TIPC protocol type\n");
goto out;
}
res = sock_register(&tipc_family_ops);
if (res) {
- err("Failed to register TIPC socket type\n");
+ pr_err("TIPC: Failed to register TIPC socket type\n");
proto_unregister(&tipc_proto);
goto out;
}
diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c
index f976e9c..18703a5 100644
--- a/net/tipc/subscr.c
+++ b/net/tipc/subscr.c
@@ -305,8 +305,8 @@ static struct tipc_subscription *subscr_subscribe(struct tipc_subscr *s,
/* Refuse subscription if global limit exceeded */
if (atomic_read(&topsrv.subscription_count) >= tipc_max_subscriptions) {
- warn("Subscription rejected, subscription limit reached (%u)\n",
- tipc_max_subscriptions);
+ pr_warn("TIPC: Subscription rejected, limit reached (%u)\n",
+ tipc_max_subscriptions);
subscr_terminate(subscriber);
return NULL;
}
@@ -314,7 +314,7 @@ static struct tipc_subscription *subscr_subscribe(struct tipc_subscr *s,
/* Allocate subscription object */
sub = kmalloc(sizeof(*sub), GFP_ATOMIC);
if (!sub) {
- warn("Subscription rejected, no memory\n");
+ pr_warn("TIPC: Subscription rejected, no memory\n");
subscr_terminate(subscriber);
return NULL;
}
@@ -328,7 +328,7 @@ static struct tipc_subscription *subscr_subscribe(struct tipc_subscr *s,
if ((!(sub->filter & TIPC_SUB_PORTS) ==
!(sub->filter & TIPC_SUB_SERVICE)) ||
(sub->seq.lower > sub->seq.upper)) {
- warn("Subscription rejected, illegal request\n");
+ pr_warn("TIPC: Subscription rejected, illegal request\n");
kfree(sub);
subscr_terminate(subscriber);
return NULL;
@@ -440,7 +440,7 @@ static void subscr_named_msg_event(void *usr_handle,
/* Create subscriber object */
subscriber = kzalloc(sizeof(struct tipc_subscriber), GFP_ATOMIC);
if (subscriber == NULL) {
- warn("Subscriber rejected, no memory\n");
+ pr_warn("TIPC: Subscriber rejected, no memory\n");
return;
}
INIT_LIST_HEAD(&subscriber->subscription_list);
@@ -458,7 +458,7 @@ static void subscr_named_msg_event(void *usr_handle,
NULL,
&subscriber->port_ref);
if (subscriber->port_ref == 0) {
- warn("Subscriber rejected, unable to create port\n");
+ pr_warn("TIPC: Subscriber rejected, unable to create port\n");
kfree(subscriber);
return;
}
@@ -517,7 +517,7 @@ int tipc_subscr_start(void)
return 0;
failed:
- err("Failed to create subscription service\n");
+ pr_err("TIPC: Failed to create subscription service\n");
return res;
}
--
1.7.9.7
^ permalink raw reply related
* [PATCH net-next 4/8] tipc: remove TIPC packet debugging functions and macros
From: Paul Gortmaker @ 2012-07-12 16:39 UTC (permalink / raw)
To: davem; +Cc: netdev, Jon Maloy, Erik Hugne, ying.xue, Paul Gortmaker
In-Reply-To: <1342111201-9426-1-git-send-email-paul.gortmaker@windriver.com>
From: Erik Hugne <erik.hugne@ericsson.com>
The link queue traces and packet level debug functions served
a purpose during early development, but are now redundant
since there are other, more capable tools available for
debugging at the packet level.
The TIPC_DEBUG Kconfig option is removed since it does not
provide any extra debugging features anymore.
This gets rid of a lot of tipc_printf usages, which will
make the pending cleanup work of that function easier.
Signed-off-by: Erik Hugne <erik.hugne@ericsson.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
net/tipc/Kconfig | 12 ---
net/tipc/core.h | 22 -----
net/tipc/link.c | 36 --------
net/tipc/msg.c | 242 ------------------------------------------------------
4 files changed, 312 deletions(-)
diff --git a/net/tipc/Kconfig b/net/tipc/Kconfig
index 2c5954b..e24519a 100644
--- a/net/tipc/Kconfig
+++ b/net/tipc/Kconfig
@@ -54,16 +54,4 @@ config TIPC_LOG
There is no need to enable the log buffer unless the node will be
managed remotely via TIPC.
-config TIPC_DEBUG
- bool "Enable debugging support"
- default n
- help
- Saying Y here enables TIPC debugging capabilities used by developers.
- Most users do not need to bother; if unsure, just say N.
-
- Enabling debugging support causes TIPC to display data about its
- internal state when certain abnormal conditions occur. It also
- makes it easy for developers to capture additional information of
- interest using the dbg() or msg_dbg() macros.
-
endif # TIPC
diff --git a/net/tipc/core.h b/net/tipc/core.h
index e8b4909..c7b5ab5 100644
--- a/net/tipc/core.h
+++ b/net/tipc/core.h
@@ -89,28 +89,6 @@ void tipc_printf(struct print_buf *, const char *fmt, ...);
#define TIPC_OUTPUT TIPC_LOG
#endif
-#ifdef CONFIG_TIPC_DEBUG
-
-/*
- * DBG_OUTPUT is the destination print buffer for debug messages.
- */
-#ifndef DBG_OUTPUT
-#define DBG_OUTPUT TIPC_LOG
-#endif
-
-#define msg_dbg(msg, txt) tipc_msg_dbg(DBG_OUTPUT, msg, txt);
-
-void tipc_msg_dbg(struct print_buf *, struct tipc_msg *, const char *);
-
-#else
-
-#define msg_dbg(msg, txt) do {} while (0)
-
-#define tipc_msg_dbg(buf, msg, txt) do {} while (0)
-
-#endif
-
-
/*
* TIPC-specific error codes
*/
diff --git a/net/tipc/link.c b/net/tipc/link.c
index da1f3c5..b389ab9 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -3018,42 +3018,6 @@ static void link_print(struct tipc_link *l_ptr, const char *str)
tipc_printf(buf, "Link %x<%s>:",
l_ptr->addr, l_ptr->b_ptr->name);
-#ifdef CONFIG_TIPC_DEBUG
- if (link_reset_reset(l_ptr) || link_reset_unknown(l_ptr))
- goto print_state;
-
- tipc_printf(buf, ": NXO(%u):", mod(l_ptr->next_out_no));
- tipc_printf(buf, "NXI(%u):", mod(l_ptr->next_in_no));
- tipc_printf(buf, "SQUE");
- if (l_ptr->first_out) {
- tipc_printf(buf, "[%u..", buf_seqno(l_ptr->first_out));
- if (l_ptr->next_out)
- tipc_printf(buf, "%u..", buf_seqno(l_ptr->next_out));
- tipc_printf(buf, "%u]", buf_seqno(l_ptr->last_out));
- if ((mod(buf_seqno(l_ptr->last_out) -
- buf_seqno(l_ptr->first_out))
- != (l_ptr->out_queue_size - 1)) ||
- (l_ptr->last_out->next != NULL)) {
- tipc_printf(buf, "\nSend queue inconsistency\n");
- tipc_printf(buf, "first_out= %p ", l_ptr->first_out);
- tipc_printf(buf, "next_out= %p ", l_ptr->next_out);
- tipc_printf(buf, "last_out= %p ", l_ptr->last_out);
- }
- } else
- tipc_printf(buf, "[]");
- tipc_printf(buf, "SQSIZ(%u)", l_ptr->out_queue_size);
- if (l_ptr->oldest_deferred_in) {
- u32 o = buf_seqno(l_ptr->oldest_deferred_in);
- u32 n = buf_seqno(l_ptr->newest_deferred_in);
- tipc_printf(buf, ":RQUE[%u..%u]", o, n);
- if (l_ptr->deferred_inqueue_sz != mod((n + 1) - o)) {
- tipc_printf(buf, ":RQSIZ(%u)",
- l_ptr->deferred_inqueue_sz);
- }
- }
-print_state:
-#endif
-
if (link_working_unknown(l_ptr))
tipc_printf(buf, ":WU");
else if (link_reset_reset(l_ptr))
diff --git a/net/tipc/msg.c b/net/tipc/msg.c
index deea0d2..f2db8a8 100644
--- a/net/tipc/msg.c
+++ b/net/tipc/msg.c
@@ -109,245 +109,3 @@ int tipc_msg_build(struct tipc_msg *hdr, struct iovec const *msg_sect,
*buf = NULL;
return -EFAULT;
}
-
-#ifdef CONFIG_TIPC_DEBUG
-void tipc_msg_dbg(struct print_buf *buf, struct tipc_msg *msg, const char *str)
-{
- u32 usr = msg_user(msg);
- tipc_printf(buf, KERN_DEBUG);
- tipc_printf(buf, str);
-
- switch (usr) {
- case MSG_BUNDLER:
- tipc_printf(buf, "BNDL::");
- tipc_printf(buf, "MSGS(%u):", msg_msgcnt(msg));
- break;
- case BCAST_PROTOCOL:
- tipc_printf(buf, "BCASTP::");
- break;
- case MSG_FRAGMENTER:
- tipc_printf(buf, "FRAGM::");
- switch (msg_type(msg)) {
- case FIRST_FRAGMENT:
- tipc_printf(buf, "FIRST:");
- break;
- case FRAGMENT:
- tipc_printf(buf, "BODY:");
- break;
- case LAST_FRAGMENT:
- tipc_printf(buf, "LAST:");
- break;
- default:
- tipc_printf(buf, "UNKNOWN:%x", msg_type(msg));
-
- }
- tipc_printf(buf, "NO(%u/%u):", msg_long_msgno(msg),
- msg_fragm_no(msg));
- break;
- case TIPC_LOW_IMPORTANCE:
- case TIPC_MEDIUM_IMPORTANCE:
- case TIPC_HIGH_IMPORTANCE:
- case TIPC_CRITICAL_IMPORTANCE:
- tipc_printf(buf, "DAT%u:", msg_user(msg));
- if (msg_short(msg)) {
- tipc_printf(buf, "CON:");
- break;
- }
- switch (msg_type(msg)) {
- case TIPC_CONN_MSG:
- tipc_printf(buf, "CON:");
- break;
- case TIPC_MCAST_MSG:
- tipc_printf(buf, "MCST:");
- break;
- case TIPC_NAMED_MSG:
- tipc_printf(buf, "NAM:");
- break;
- case TIPC_DIRECT_MSG:
- tipc_printf(buf, "DIR:");
- break;
- default:
- tipc_printf(buf, "UNKNOWN TYPE %u", msg_type(msg));
- }
- if (msg_reroute_cnt(msg))
- tipc_printf(buf, "REROUTED(%u):",
- msg_reroute_cnt(msg));
- break;
- case NAME_DISTRIBUTOR:
- tipc_printf(buf, "NMD::");
- switch (msg_type(msg)) {
- case PUBLICATION:
- tipc_printf(buf, "PUBL(%u):", (msg_size(msg) - msg_hdr_sz(msg)) / 20); /* Items */
- break;
- case WITHDRAWAL:
- tipc_printf(buf, "WDRW:");
- break;
- default:
- tipc_printf(buf, "UNKNOWN:%x", msg_type(msg));
- }
- if (msg_reroute_cnt(msg))
- tipc_printf(buf, "REROUTED(%u):",
- msg_reroute_cnt(msg));
- break;
- case CONN_MANAGER:
- tipc_printf(buf, "CONN_MNG:");
- switch (msg_type(msg)) {
- case CONN_PROBE:
- tipc_printf(buf, "PROBE:");
- break;
- case CONN_PROBE_REPLY:
- tipc_printf(buf, "PROBE_REPLY:");
- break;
- case CONN_ACK:
- tipc_printf(buf, "CONN_ACK:");
- tipc_printf(buf, "ACK(%u):", msg_msgcnt(msg));
- break;
- default:
- tipc_printf(buf, "UNKNOWN TYPE:%x", msg_type(msg));
- }
- if (msg_reroute_cnt(msg))
- tipc_printf(buf, "REROUTED(%u):", msg_reroute_cnt(msg));
- break;
- case LINK_PROTOCOL:
- switch (msg_type(msg)) {
- case STATE_MSG:
- tipc_printf(buf, "STATE:");
- tipc_printf(buf, "%s:", msg_probe(msg) ? "PRB" : "");
- tipc_printf(buf, "NXS(%u):", msg_next_sent(msg));
- tipc_printf(buf, "GAP(%u):", msg_seq_gap(msg));
- tipc_printf(buf, "LSTBC(%u):", msg_last_bcast(msg));
- break;
- case RESET_MSG:
- tipc_printf(buf, "RESET:");
- if (msg_size(msg) != msg_hdr_sz(msg))
- tipc_printf(buf, "BEAR:%s:", msg_data(msg));
- break;
- case ACTIVATE_MSG:
- tipc_printf(buf, "ACTIVATE:");
- break;
- default:
- tipc_printf(buf, "UNKNOWN TYPE:%x", msg_type(msg));
- }
- tipc_printf(buf, "PLANE(%c):", msg_net_plane(msg));
- tipc_printf(buf, "SESS(%u):", msg_session(msg));
- break;
- case CHANGEOVER_PROTOCOL:
- tipc_printf(buf, "TUNL:");
- switch (msg_type(msg)) {
- case DUPLICATE_MSG:
- tipc_printf(buf, "DUPL:");
- break;
- case ORIGINAL_MSG:
- tipc_printf(buf, "ORIG:");
- tipc_printf(buf, "EXP(%u)", msg_msgcnt(msg));
- break;
- default:
- tipc_printf(buf, "UNKNOWN TYPE:%x", msg_type(msg));
- }
- break;
- case LINK_CONFIG:
- tipc_printf(buf, "CFG:");
- switch (msg_type(msg)) {
- case DSC_REQ_MSG:
- tipc_printf(buf, "DSC_REQ:");
- break;
- case DSC_RESP_MSG:
- tipc_printf(buf, "DSC_RESP:");
- break;
- default:
- tipc_printf(buf, "UNKNOWN TYPE:%x:", msg_type(msg));
- break;
- }
- break;
- default:
- tipc_printf(buf, "UNKNOWN USER:");
- }
-
- switch (usr) {
- case CONN_MANAGER:
- case TIPC_LOW_IMPORTANCE:
- case TIPC_MEDIUM_IMPORTANCE:
- case TIPC_HIGH_IMPORTANCE:
- case TIPC_CRITICAL_IMPORTANCE:
- switch (msg_errcode(msg)) {
- case TIPC_OK:
- break;
- case TIPC_ERR_NO_NAME:
- tipc_printf(buf, "NO_NAME:");
- break;
- case TIPC_ERR_NO_PORT:
- tipc_printf(buf, "NO_PORT:");
- break;
- case TIPC_ERR_NO_NODE:
- tipc_printf(buf, "NO_PROC:");
- break;
- case TIPC_ERR_OVERLOAD:
- tipc_printf(buf, "OVERLOAD:");
- break;
- case TIPC_CONN_SHUTDOWN:
- tipc_printf(buf, "SHUTDOWN:");
- break;
- default:
- tipc_printf(buf, "UNKNOWN ERROR(%x):",
- msg_errcode(msg));
- }
- default:
- break;
- }
-
- tipc_printf(buf, "HZ(%u):", msg_hdr_sz(msg));
- tipc_printf(buf, "SZ(%u):", msg_size(msg));
- tipc_printf(buf, "SQNO(%u):", msg_seqno(msg));
-
- if (msg_non_seq(msg))
- tipc_printf(buf, "NOSEQ:");
- else
- tipc_printf(buf, "ACK(%u):", msg_ack(msg));
- tipc_printf(buf, "BACK(%u):", msg_bcast_ack(msg));
- tipc_printf(buf, "PRND(%x)", msg_prevnode(msg));
-
- if (msg_isdata(msg)) {
- if (msg_named(msg)) {
- tipc_printf(buf, "NTYP(%u):", msg_nametype(msg));
- tipc_printf(buf, "NINST(%u)", msg_nameinst(msg));
- }
- }
-
- if ((usr != LINK_PROTOCOL) && (usr != LINK_CONFIG) &&
- (usr != MSG_BUNDLER)) {
- if (!msg_short(msg)) {
- tipc_printf(buf, ":ORIG(%x:%u):",
- msg_orignode(msg), msg_origport(msg));
- tipc_printf(buf, ":DEST(%x:%u):",
- msg_destnode(msg), msg_destport(msg));
- } else {
- tipc_printf(buf, ":OPRT(%u):", msg_origport(msg));
- tipc_printf(buf, ":DPRT(%u):", msg_destport(msg));
- }
- }
- if (msg_user(msg) == NAME_DISTRIBUTOR) {
- tipc_printf(buf, ":ONOD(%x):", msg_orignode(msg));
- tipc_printf(buf, ":DNOD(%x):", msg_destnode(msg));
- }
-
- if (msg_user(msg) == LINK_CONFIG) {
- struct tipc_media_addr orig;
-
- tipc_printf(buf, ":DDOM(%x):", msg_dest_domain(msg));
- tipc_printf(buf, ":NETID(%u):", msg_bc_netid(msg));
- memcpy(orig.value, msg_media_addr(msg), sizeof(orig.value));
- orig.media_id = 0;
- orig.broadcast = 0;
- tipc_media_addr_printf(buf, &orig);
- }
- if (msg_user(msg) == BCAST_PROTOCOL) {
- tipc_printf(buf, "BCNACK:AFTER(%u):", msg_bcgap_after(msg));
- tipc_printf(buf, "TO(%u):", msg_bcgap_to(msg));
- }
- tipc_printf(buf, "\n");
- if ((usr == CHANGEOVER_PROTOCOL) && (msg_msgcnt(msg)))
- tipc_msg_dbg(buf, msg_get_wrapped(msg), " /");
- if ((usr == MSG_FRAGMENTER) && (msg_type(msg) == FIRST_FRAGMENT))
- tipc_msg_dbg(buf, msg_get_wrapped(msg), " /");
-}
-#endif
--
1.7.9.7
^ permalink raw reply related
* [PATCH net-next 2/8] tipc: limit error messages relating to memory leak to one line
From: Paul Gortmaker @ 2012-07-12 16:39 UTC (permalink / raw)
To: davem; +Cc: netdev, Jon Maloy, Erik Hugne, ying.xue, Paul Gortmaker
In-Reply-To: <1342111201-9426-1-git-send-email-paul.gortmaker@windriver.com>
With the default name table size of 1024, it is possible that
the sanity check in tipc_nametbl_stop could spam out 1024
essentially identical error messages if memory was corrupted
or similar. Limit it to issuing no more than a single message.
The actual chain number (i.e. 0 --> 1023) wouldn't provide any
useful insight if/when such an instance happened, so don't
bother printing out that value.
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
net/tipc/name_table.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c
index 13fb9d5..cade0ac 100644
--- a/net/tipc/name_table.c
+++ b/net/tipc/name_table.c
@@ -940,8 +940,10 @@ void tipc_nametbl_stop(void)
/* Verify name table is empty, then release it */
write_lock_bh(&tipc_nametbl_lock);
for (i = 0; i < tipc_nametbl_size; i++) {
- if (!hlist_empty(&table.types[i]))
- err("tipc_nametbl_stop(): hash chain %u is non-null\n", i);
+ if (hlist_empty(&table.types[i]))
+ continue;
+ err("tipc_nametbl_stop(): orphaned hash chain detected\n");
+ break;
}
kfree(table.types);
table.types = NULL;
--
1.7.9.7
^ permalink raw reply related
* [PATCH net-next 1/8] tipc: factor stats struct out of the larger link struct
From: Paul Gortmaker @ 2012-07-12 16:39 UTC (permalink / raw)
To: davem; +Cc: netdev, Jon Maloy, Erik Hugne, ying.xue, Paul Gortmaker
In-Reply-To: <1342111201-9426-1-git-send-email-paul.gortmaker@windriver.com>
This is done to improve readability, and so that we can give
the struct a name that will allow us to declare a local
pointer to it in code, instead of having to always redirect
through the link struct to get to it.
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
net/tipc/link.h | 62 ++++++++++++++++++++++++++++---------------------------
1 file changed, 32 insertions(+), 30 deletions(-)
diff --git a/net/tipc/link.h b/net/tipc/link.h
index d6a60a9..8024a56 100644
--- a/net/tipc/link.h
+++ b/net/tipc/link.h
@@ -63,6 +63,37 @@
*/
#define MAX_PKT_DEFAULT 1500
+struct tipc_stats {
+ u32 sent_info; /* used in counting # sent packets */
+ u32 recv_info; /* used in counting # recv'd packets */
+ u32 sent_states;
+ u32 recv_states;
+ u32 sent_probes;
+ u32 recv_probes;
+ u32 sent_nacks;
+ u32 recv_nacks;
+ u32 sent_acks;
+ u32 sent_bundled;
+ u32 sent_bundles;
+ u32 recv_bundled;
+ u32 recv_bundles;
+ u32 retransmitted;
+ u32 sent_fragmented;
+ u32 sent_fragments;
+ u32 recv_fragmented;
+ u32 recv_fragments;
+ u32 link_congs; /* # port sends blocked by congestion */
+ u32 bearer_congs;
+ u32 deferred_recv;
+ u32 duplicates;
+ u32 max_queue_sz; /* send queue size high water mark */
+ u32 accu_queue_sz; /* used for send queue size profiling */
+ u32 queue_sz_counts; /* used for send queue size profiling */
+ u32 msg_length_counts; /* used for message length profiling */
+ u32 msg_lengths_total; /* used for message length profiling */
+ u32 msg_length_profile[7]; /* used for msg. length profiling */
+};
+
/**
* struct tipc_link - TIPC link data structure
* @addr: network address of link's peer node
@@ -175,36 +206,7 @@ struct tipc_link {
struct sk_buff *defragm_buf;
/* Statistics */
- struct {
- u32 sent_info; /* used in counting # sent packets */
- u32 recv_info; /* used in counting # recv'd packets */
- u32 sent_states;
- u32 recv_states;
- u32 sent_probes;
- u32 recv_probes;
- u32 sent_nacks;
- u32 recv_nacks;
- u32 sent_acks;
- u32 sent_bundled;
- u32 sent_bundles;
- u32 recv_bundled;
- u32 recv_bundles;
- u32 retransmitted;
- u32 sent_fragmented;
- u32 sent_fragments;
- u32 recv_fragmented;
- u32 recv_fragments;
- u32 link_congs; /* # port sends blocked by congestion */
- u32 bearer_congs;
- u32 deferred_recv;
- u32 duplicates;
- u32 max_queue_sz; /* send queue size high water mark */
- u32 accu_queue_sz; /* used for send queue size profiling */
- u32 queue_sz_counts; /* used for send queue size profiling */
- u32 msg_length_counts; /* used for message length profiling */
- u32 msg_lengths_total; /* used for message length profiling */
- u32 msg_length_profile[7]; /* used for msg. length profiling */
- } stats;
+ struct tipc_stats stats;
};
struct tipc_port;
--
1.7.9.7
^ permalink raw reply related
* [PATCH net-next 0/8] tipc: kill off struct print_buf/log
From: Paul Gortmaker @ 2012-07-12 16:39 UTC (permalink / raw)
To: davem; +Cc: netdev, Jon Maloy, Erik Hugne, ying.xue, Paul Gortmaker
Dave,
The main thrust of what happens in this series is to deal with
the request you'd made a while ago about making it so TIPC did
not have its own specific (and complex) logging infrastructure.
It used to have tipc_printf taking an arg of this struct print_buf
thing, with a length field in it. There was also a function to
set/validate string lengths etc. So the approach was to first
wean off as many users of tipc_printf as possible (e.g. by deleting
old debug code, etc.) and then changing tipc_printf into something
much simpler that conveyed string lengths via normal return values
one would expect from snprintf-like functions. Finally, with the
core code no longer using the print_buf struct, it and the log
code associated with it are removed.
A side bonus is that we get rid of a couple TIPC related Kconfig
options along the way, and about 600 lines of code too.
The folks at Ericsson did most of the work here, and I just
refactored things a bit and made a few suggestions here and there.
I've also run the server/client tests on this series atop of the
net-next baseline of 48ee3569f "ipv6: Move ipv6 twsk accessors
outside of CONFIG_IPV6 ifdefs."
If there no obvious problems spotted by anyone in the next day
or so, I would like to issue a pull request for these.
Thanks,
Paul.
---
Erik Hugne (5):
tipc: use standard printk shortcut macros (pr_err etc.)
tipc: remove TIPC packet debugging functions and macros
tipc: simplify print buffer handling in tipc_printf
tipc: phase out most of the struct print_buf usage
tipc: remove print_buf and deprecated log buffer code
Paul Gortmaker (3):
tipc: factor stats struct out of the larger link struct
tipc: limit error messages relating to memory leak to one line
tipc: simplify link_print by divorcing it from using tipc_printf
include/linux/tipc_config.h | 4 +-
net/tipc/Kconfig | 25 ----
net/tipc/bcast.c | 65 +++++-----
net/tipc/bearer.c | 62 +++++----
net/tipc/bearer.h | 2 +-
net/tipc/config.c | 41 +++---
net/tipc/core.c | 15 +--
net/tipc/core.h | 63 +--------
net/tipc/discover.c | 10 +-
net/tipc/handler.c | 4 +-
net/tipc/link.c | 297 ++++++++++++++++++------------------------
net/tipc/link.h | 63 ++++-----
net/tipc/log.c | 302 ++-----------------------------------------
net/tipc/log.h | 66 ----------
net/tipc/msg.c | 242 ----------------------------------
net/tipc/name_distr.c | 25 ++--
net/tipc/name_table.c | 132 ++++++++++---------
net/tipc/net.c | 8 +-
net/tipc/netlink.c | 2 +-
net/tipc/node.c | 23 ++--
net/tipc/node_subscr.c | 3 +-
net/tipc/port.c | 66 +++++-----
net/tipc/ref.c | 10 +-
net/tipc/socket.c | 4 +-
net/tipc/subscr.c | 14 +-
25 files changed, 430 insertions(+), 1118 deletions(-)
delete mode 100644 net/tipc/log.h
--
1.7.9.7
^ permalink raw reply
* Re: [PATCH 2/2] ipvs: generalize app registration in netns
From: Pablo Neira Ayuso @ 2012-07-12 16:22 UTC (permalink / raw)
To: Simon Horman
Cc: lvs-devel, netdev, netfilter-devel, Wensong Zhang,
Julian Anastasov, Hans Schillstrom, Jesper Dangaard Brouer
In-Reply-To: <1341966327-16606-3-git-send-email-horms@verge.net.au>
On Wed, Jul 11, 2012 at 09:25:27AM +0900, Simon Horman wrote:
> From: Julian Anastasov <ja@ssi.bg>
>
> Get rid of the ftp_app pointer and allow applications
> to be registered without adding fields in the netns_ipvs structure.
>
> Signed-off-by: Julian Anastasov <ja@ssi.bg>
> Signed-off-by: Simon Horman <horms@verge.net.au>
> ---
> include/net/ip_vs.h | 5 ++--
> net/netfilter/ipvs/ip_vs_app.c | 61 +++++++++++++++++++++++++++++++-----------
> net/netfilter/ipvs/ip_vs_ftp.c | 21 ++++-----------
> 3 files changed, 52 insertions(+), 35 deletions(-)
>
> diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
> index d6146b4..6cb4699 100644
> --- a/include/net/ip_vs.h
> +++ b/include/net/ip_vs.h
> @@ -808,8 +808,6 @@ struct netns_ipvs {
> struct list_head rs_table[IP_VS_RTAB_SIZE];
> /* ip_vs_app */
> struct list_head app_list;
> - /* ip_vs_ftp */
> - struct ip_vs_app *ftp_app;
> /* ip_vs_proto */
> #define IP_VS_PROTO_TAB_SIZE 32 /* must be power of 2 */
> struct ip_vs_proto_data *proto_data_table[IP_VS_PROTO_TAB_SIZE];
> @@ -1179,7 +1177,8 @@ extern void ip_vs_service_net_cleanup(struct net *net);
> * (from ip_vs_app.c)
> */
> #define IP_VS_APP_MAX_PORTS 8
> -extern int register_ip_vs_app(struct net *net, struct ip_vs_app *app);
> +extern struct ip_vs_app *register_ip_vs_app(struct net *net,
> + struct ip_vs_app *app);
> extern void unregister_ip_vs_app(struct net *net, struct ip_vs_app *app);
> extern int ip_vs_bind_app(struct ip_vs_conn *cp, struct ip_vs_protocol *pp);
> extern void ip_vs_unbind_app(struct ip_vs_conn *cp);
> diff --git a/net/netfilter/ipvs/ip_vs_app.c b/net/netfilter/ipvs/ip_vs_app.c
> index 64f9e8f..11caaea 100644
> --- a/net/netfilter/ipvs/ip_vs_app.c
> +++ b/net/netfilter/ipvs/ip_vs_app.c
> @@ -180,22 +180,41 @@ register_ip_vs_app_inc(struct net *net, struct ip_vs_app *app, __u16 proto,
> }
>
>
> -/*
> - * ip_vs_app registration routine
> - */
> -int register_ip_vs_app(struct net *net, struct ip_vs_app *app)
> +/* Register application for netns */
> +struct ip_vs_app *register_ip_vs_app(struct net *net, struct ip_vs_app *app)
> {
> struct netns_ipvs *ipvs = net_ipvs(net);
> - /* increase the module use count */
> - ip_vs_use_count_inc();
> + struct ip_vs_app *a;
> + int err = 0;
> +
> + if (!ipvs)
> + return ERR_PTR(-ENOENT);
>
> mutex_lock(&__ip_vs_app_mutex);
>
> - list_add(&app->a_list, &ipvs->app_list);
> + list_for_each_entry(a, &ipvs->app_list, a_list) {
> + if (!strcmp(app->name, a->name)) {
> + err = -EEXIST;
> + break;
> + }
> + }
> + if (!err) {
> + a = kmemdup(app, sizeof(*app), GFP_KERNEL);
> + if (!a)
> + err = -ENOMEM;
> + }
> + if (!err) {
> + INIT_LIST_HEAD(&a->incs_list);
> + list_add(&a->a_list, &ipvs->app_list);
> + /* increase the module use count */
> + ip_vs_use_count_inc();
> + }
I think this code will look better if you use something like:
+ if (!strcmp(app->name, a->name)) {
+ err = -EEXIST;
+ goto err_unlock;
+ }
err_unlock:
mutex_unlock(...)
>
> mutex_unlock(&__ip_vs_app_mutex);
>
> - return 0;
> + if (err)
> + return ERR_PTR(err);
> + return a;
For this three lines above, you can use:
return err ? return ERR_PTR(err) : a;
> }
>
>
> @@ -205,20 +224,29 @@ int register_ip_vs_app(struct net *net, struct ip_vs_app *app)
> */
> void unregister_ip_vs_app(struct net *net, struct ip_vs_app *app)
> {
> - struct ip_vs_app *inc, *nxt;
> + struct netns_ipvs *ipvs = net_ipvs(net);
> + struct ip_vs_app *a, *anxt, *inc, *nxt;
> +
> + if (!ipvs)
> + return;
>
> mutex_lock(&__ip_vs_app_mutex);
>
> - list_for_each_entry_safe(inc, nxt, &app->incs_list, a_list) {
> - ip_vs_app_inc_release(net, inc);
> - }
> + list_for_each_entry_safe(a, anxt, &ipvs->app_list, a_list) {
> + if (app && strcmp(app->name, a->name))
> + continue;
> + list_for_each_entry_safe(inc, nxt, &a->incs_list, a_list) {
> + ip_vs_app_inc_release(net, inc);
> + }
>
> - list_del(&app->a_list);
> + list_del(&a->a_list);
> + kfree(a);
>
> - mutex_unlock(&__ip_vs_app_mutex);
> + /* decrease the module use count */
> + ip_vs_use_count_dec();
> + }
>
> - /* decrease the module use count */
> - ip_vs_use_count_dec();
> + mutex_unlock(&__ip_vs_app_mutex);
> }
>
>
> @@ -586,5 +614,6 @@ int __net_init ip_vs_app_net_init(struct net *net)
>
> void __net_exit ip_vs_app_net_cleanup(struct net *net)
> {
> + unregister_ip_vs_app(net, NULL /* all */);
> proc_net_remove(net, "ip_vs_app");
> }
> diff --git a/net/netfilter/ipvs/ip_vs_ftp.c b/net/netfilter/ipvs/ip_vs_ftp.c
> index b20b29c..ad70b7e 100644
> --- a/net/netfilter/ipvs/ip_vs_ftp.c
> +++ b/net/netfilter/ipvs/ip_vs_ftp.c
> @@ -441,16 +441,10 @@ static int __net_init __ip_vs_ftp_init(struct net *net)
>
> if (!ipvs)
> return -ENOENT;
> - app = kmemdup(&ip_vs_ftp, sizeof(struct ip_vs_app), GFP_KERNEL);
> - if (!app)
> - return -ENOMEM;
> - INIT_LIST_HEAD(&app->a_list);
> - INIT_LIST_HEAD(&app->incs_list);
> - ipvs->ftp_app = app;
>
> - ret = register_ip_vs_app(net, app);
> - if (ret)
> - goto err_exit;
> + app = register_ip_vs_app(net, &ip_vs_ftp);
> + if (IS_ERR(app))
> + return PTR_ERR(app);
>
> for (i = 0; i < ports_count; i++) {
> if (!ports[i])
> @@ -464,9 +458,7 @@ static int __net_init __ip_vs_ftp_init(struct net *net)
> return 0;
>
> err_unreg:
> - unregister_ip_vs_app(net, app);
> -err_exit:
> - kfree(ipvs->ftp_app);
> + unregister_ip_vs_app(net, &ip_vs_ftp);
> return ret;
> }
> /*
> @@ -474,10 +466,7 @@ err_exit:
> */
> static void __ip_vs_ftp_exit(struct net *net)
> {
> - struct netns_ipvs *ipvs = net_ipvs(net);
> -
> - unregister_ip_vs_app(net, ipvs->ftp_app);
> - kfree(ipvs->ftp_app);
> + unregister_ip_vs_app(net, &ip_vs_ftp);
> }
>
> static struct pernet_operations ip_vs_ftp_ops = {
> --
> 1.7.10.2.484.gcd07cc5
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH net-next 01/11] sfc: Implement 128-bit writes for efx_writeo_page
From: Ben Hutchings @ 2012-07-12 16:17 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-net-drivers
In-Reply-To: <20120712.081300.624240435828585132.davem@davemloft.net>
On Thu, 2012-07-12 at 08:13 -0700, David Miller wrote:
> From: Ben Hutchings <bhutchings@solarflare.com>
> Date: Thu, 12 Jul 2012 00:15:18 +0100
>
> > Add support for writing a TX descriptor to the NIC in one PCIe
> > transaction on x86_64 machines.
> >
> > Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
>
> This absolutely does not belong in a driver.
OK. My assumption was that 128-bit MMIO on a data path would be so rare
that this would not be generically useful. (Really long MMIOs are
likely to be done with write-combining, so that the data width of
instructions doesn't matter much.)
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* RE: [PATCH net-next 01/11] sfc: Implement 128-bit writes for efx_writeo_page
From: Ben Hutchings @ 2012-07-12 16:10 UTC (permalink / raw)
To: David Laight; +Cc: David Miller, netdev, linux-net-drivers
In-Reply-To: <AE90C24D6B3A694183C094C60CF0A2F6026B6F7D@saturn3.aculab.com>
On Thu, 2012-07-12 at 09:45 +0100, David Laight wrote:
> > From: netdev-owner@vger.kernel.org [mailto:netdev-
> > owner@vger.kernel.org] On Behalf Of Ben Hutchings
> > Sent: 12 July 2012 00:15
> > To: David Miller
> > Cc: netdev@vger.kernel.org; linux-net-drivers@solarflare.com
> > Subject: [PATCH net-next 01/11] sfc: Implement 128-bit writes for
> > efx_writeo_page
> >
> > Add support for writing a TX descriptor to the NIC in one PCIe
> > transaction on x86_64 machines.
> ...
> > +static inline void _efx_writeo(struct efx_nic *efx, efx_le_128 value,
> > + unsigned int reg)
> > +{
> ...
> > +}
>
> Wouldn't it be better to put code this in some generic header
> where it can be used by other drivers?
I can do that, but I'm not sure that it's all that generic.
> Some architectures/cpus have dma engines associated with the
> PCIe interface than can be used to request longer PCIe transactions.
>
> So you probably need a transfer length as well.
>
> I suspect that it is never worth using an interrupt for
> the completion of such dma - although splitting the request
> and wait would allow the caller to overlap operations.
>
> With a dma interface it is worth updating multiple ring
> entries at one, and reading multiple entries for status.
We're trying to reduce latency. You seem to be talking about batching
to increase efficiency at the cost of latency.
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* Re: [PATCH] tc: man: change man page and comment to confirm to code's behavior.
From: Stephen Hemminger @ 2012-07-12 16:06 UTC (permalink / raw)
To: Li Wei; +Cc: netdev
In-Reply-To: <4FFE2EE9.8030808@cn.fujitsu.com>
On Thu, 12 Jul 2012 09:56:57 +0800
Li Wei <lw@cn.fujitsu.com> wrote:
>
> Since the get_rate() code incorrectly interpreted bare number, the
> behavior is not the same as man page and comment described.
>
> We need to change the man page and comment for compatible with the
> existing usage by scripts.
> ---
> man/man8/tc.8 | 7 +++++--
> tc/tc_util.c | 2 +-
> 2 files changed, 6 insertions(+), 3 deletions(-)
Thanks for fixing. Accepted.
^ permalink raw reply
* Re: [PATCH iproute2] Ability to compile iproute2 as shared library
From: Stephen Hemminger @ 2012-07-12 16:03 UTC (permalink / raw)
To: hamid jafarian; +Cc: netdev
In-Reply-To: <1342093501.19963.11.camel@gol>
On Thu, 12 Jul 2012 16:14:54 +0430
hamid jafarian <hamid.jafarian@pdnsoft.com> wrote:
> Hi,
>
> This is a try with minimum changes to compile iproute2 as shared
> library.
> Some functions would be used when we compile iproute2 as
> shared library has been defined in "ip.c".
> Also NICs caching strategy has been changed because, when we use
> "libiproute2.so", system NIC list may change, so we should
> re-cache all NICs at each call to NIC manipulation functions.
> Also some call of "exit(*)" changed to "return *".
> HOWTO Make: # export LIBIPROUTE2_SO=y; make
>
> in attached files there is a simple wrapper to work with
> libiproute2.so ...
>
Thank you for the contribution. I can see how this could be useful
in some limited embedded applications, but at this moment it doesn't
seem to be generally worth adding to the upstream code.
The patch does contain some cleanup bits for where the existing
code is not freeing stuff. This should be fixed, independent of
whether library support is added, because it would remove the number
of leaks reported when testing under valgrind. Could you resubmit
that part please.
^ permalink raw reply
* Re: [patch net-next 0/3] team: couple of patches
From: Jiri Pirko @ 2012-07-12 15:53 UTC (permalink / raw)
To: David Miller; +Cc: netdev
In-Reply-To: <20120712.081443.1373285885474644661.davem@davemloft.net>
Thu, Jul 12, 2012 at 05:14:43PM CEST, davem@davemloft.net wrote:
>From: David Miller <davem@davemloft.net>
>Date: Thu, 12 Jul 2012 08:11:24 -0700 (PDT)
>
>> From: Jiri Pirko <jpirko@redhat.com>
>> Date: Wed, 11 Jul 2012 17:34:01 +0200
>>
>>> Jiri Pirko (3):
>>> team: use function team_port_txable() for determing enabled and up
>>> port
>>> team: add broadcast mode
>>> team: make team_port_enabled() and team_port_txable() static inline
>>
>> All applied, thanks.
>
>Jiri, btw, any chance I can convince you to remove the EXPERIMENTAL
>Kconfig dependency?
>
>Code I've written and checked in myself over the past few days is
>several orders of magnitude more experimental than the team driver
>is :-)
Hehe :) Nevertheless, I would like to keep this flag for some more time.
I will remove that once I have all planned basic functionality in.
Jirka
^ permalink raw reply
* Re: [net-next:master 90/102] net/ipv4/route.c:1283:9: warning: unused variable 'saddr'
From: Dan Carpenter @ 2012-07-12 15:47 UTC (permalink / raw)
To: David Miller; +Cc: fengguang.wu, kernel-janitors, netdev
In-Reply-To: <20120712.074058.753681400854318989.davem@davemloft.net>
On Thu, Jul 12, 2012 at 07:40:58AM -0700, David Miller wrote:
>
> There's not need to report these to kernel-janitors if it's a
> net-next specific issue and I'm going to fix it up 5 minutes
> after you report it.
The kernel-janitors list is CC'd to prevent people from sending
duplicate messages. This has happened in the past and it's
annoying for everyone.
regards,
dan carpenter
^ permalink raw reply
* Re: [PATCH 1/2] ipvs: ip_vs_ftp depends on nf_conntrack_ftp helper
From: Pablo Neira Ayuso @ 2012-07-12 15:39 UTC (permalink / raw)
To: Simon Horman
Cc: lvs-devel, netdev, netfilter-devel, Wensong Zhang,
Julian Anastasov, Hans Schillstrom, Jesper Dangaard Brouer
In-Reply-To: <1341966327-16606-2-git-send-email-horms@verge.net.au>
On Wed, Jul 11, 2012 at 09:25:26AM +0900, Simon Horman wrote:
> From: Julian Anastasov <ja@ssi.bg>
>
> The FTP application indirectly depends on the
> nf_conntrack_ftp helper for proper NAT support. If the
> module is not loaded, IPVS can resize the packets for the
> command connection, eg. PASV response but the SEQ adjustment
> logic in ipv4_confirm is not called without helper.
>
> Signed-off-by: Julian Anastasov <ja@ssi.bg>
> Signed-off-by: Simon Horman <horms@verge.net.au>
> ---
> net/netfilter/ipvs/Kconfig | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/netfilter/ipvs/Kconfig b/net/netfilter/ipvs/Kconfig
> index f987138..8b2cffd 100644
> --- a/net/netfilter/ipvs/Kconfig
> +++ b/net/netfilter/ipvs/Kconfig
> @@ -250,7 +250,8 @@ comment 'IPVS application helper'
>
> config IP_VS_FTP
> tristate "FTP protocol helper"
> - depends on IP_VS_PROTO_TCP && NF_CONNTRACK && NF_NAT
> + depends on IP_VS_PROTO_TCP && NF_CONNTRACK && NF_NAT && \
> + NF_CONNTRACK_FTP
If you require FTP NAT support, then this depends on NF_NAT_FTP
instead of NF_CONNTRACK_FTP.
^ permalink raw reply
* Re: [RFC PATCH 1/2] net: Add new network device function to allow for MMIO batching
From: Alexander Duyck @ 2012-07-12 15:39 UTC (permalink / raw)
To: Eric Dumazet
Cc: netdev, davem, jeffrey.t.kirsher, edumazet, bhutchings, therbert,
alexander.duyck
In-Reply-To: <1342077259.3265.8232.camel@edumazet-glaptop>
On 07/12/2012 12:14 AM, Eric Dumazet wrote:
> On Wed, 2012-07-11 at 17:26 -0700, Alexander Duyck wrote:
>> This change adds capabilities to the driver for batching the MMIO write
>> involved with transmits. Most of the logic is based off of the code for
>> the qdisc scheduling.
>>
>> What I did is break the transmit path into two parts. We already had the
>> ndo_start_xmit function which has been there all along. The part I added
>> was ndo_complete_xmit which is meant to handle notifying the hardware that
>> frames are ready for delivery.
>>
>> To control all of this I added a net sysfs value for the Tx queues called
>> dispatch_limit. When 0 it indicates that all frames will notify hardware
>> immediately. When 1 or more the netdev_complete_xmit call will queue up to
>> that number of packets, and when the value is exceeded it will notify the
>> hardware and reset the pending frame dispatch count.
>>
>> Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
>> ---
> The idea is good, but do we really need so complex schem ?
>
> Most of the transmits are done from __qdisc_run()
>
> We could add logic in __qdisc_run()/qdisc_restart()
>
> qdisc_run_end() would then have to call ndo_complete_xmit() to make
> sure the MMIO is done.
The problem is in both of the cases where I have seen the issue the
qdisc is actually empty.
In the case of pktgen it does not use the qdisc layer at all. It just
directly calls ndo_start_xmit.
In the standard networking case we never fill the qdisc because the MMIO
write stalls the entire CPU so the application never gets a chance to
get ahead of the hardware. From what I can tell the only case in which
the qdisc_run solution would work is if the ndo_start_xmit was called on
a different CPU from the application that is doing the transmitting.
Thanks,
Alex
^ permalink raw reply
* Re: [PATCH] sch_sfb: Fix missing NULL check
From: David Miller @ 2012-07-12 15:33 UTC (permalink / raw)
To: eric.dumazet; +Cc: alan, netdev
In-Reply-To: <1342101021.3265.8261.camel@edumazet-glaptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 12 Jul 2012 15:50:21 +0200
> On Thu, 2012-07-12 at 06:25 -0700, David Miller wrote:
>> From: Alan Cox <alan@lxorguk.ukuu.org.uk>
>> Date: Thu, 12 Jul 2012 14:39:11 +0100
>>
>> > Signed-off-by: Alan Cox <alna@linux.intel.com>
>> ^^^^
>>
>> I'm truly astonished that you type in signoffs by hand Alan.
>
> Weel, I do the same ;)
You guys are weird :-)
> Feel free to add my
>
> Acked-by: Eric Dumazet <edumazet@google.com>
Applied, with signoff typo fixed too :-)
^ permalink raw reply
* Re: [PATCH 2/2] net: Update alloc frag to reduce get/put page usage and recycle pages
From: Alexander Duyck @ 2012-07-12 15:33 UTC (permalink / raw)
To: Eric Dumazet
Cc: Alexander Duyck, netdev, davem, jeffrey.t.kirsher, Eric Dumazet
In-Reply-To: <1342069601.3265.8218.camel@edumazet-glaptop>
On 07/11/2012 10:06 PM, Eric Dumazet wrote:
> On Wed, 2012-07-11 at 19:02 -0700, Alexander Duyck wrote:
>
>> The gain will be minimal if any with the 1500 byte allocations, however
>> there shouldn't be a performance degradation.
>>
>> I was thinking more of the ixgbe case where we are working with only 256
>> byte allocations and can recycle pages in the case of GRO or TCP. For
>> ixgbe the advantages are significant since we drop a number of the
>> get_page calls and get the advantage of the page recycling. So for
>> example with GRO enabled we should only have to allocate 1 page for
>> headers every 16 buffers, and the 6 slots we use in that page have a
>> good likelihood of being warm in the cache since we just keep looping on
>> the same page.
>>
> Its not possible to get 16 buffers per 4096 bytes page.
Actually I was talking about buffers from the device, not buffers from
the page. However, it is possible to get 16 head_frag buffers from the
same 4K page if we consider recycling. In the case of GRO we will end
up with the first buffer keeping the head_frag, and all of the remaining
head_frags will be freed before we call netdev_alloc_frag again. So
what will end up happening is that each GRO assembled frame from ixgbe
would start with a recycled page used for the previously freed
head_frags, the page will be dropped from netdev_alloc_frag after we run
out of space, a new page will be allocated for use as head_frags, and
finally those head_frags will be freed and recycled until we hit the end
of the GRO frame and start over. So if you count them all then we end
up using the page up to 16 times, maybe even more depending on how the
page offset reset aligns with the start of the GRO frame.
> sizeof(struct skb_shared_info)=0x140 320
>
> Add 192 bytes (NET_SKB_PAD + 128)
>
> Thats a minimum of 512 bytes (but ixgbe uses more) per skb.
>
> In practice for ixgbe, its :
>
> #define IXGBE_RXBUFFER_512 512 /* Used for packet split */
> #define IXGBE_RX_HDR_SIZE IXGBE_RXBUFFER_512
>
> skb = netdev_alloc_skb_ip_align(rx_ring->netdev, IXGBE_RX_HDR_SIZE)
>
> So 4 buffers per PAGE
>
> Maybe you plan to use IXGBE_RXBUFFER_256 or IXGBE_RXBUFFER_128 ?
I have a patch that is in testing in Jeff Kirsher's tree that uses
IXGBE_RXBUFFER_256. With your recent changes it didn't make sense to
use 512 when we would only copy 256 bytes into the head. With the size
set to 256 we will get 6 buffers per page without any recycling.
Thanks,
Alex
^ permalink raw reply
* Re: [PATCH 02/16] ipv4: Deliver ICMP redirects to sockets too.
From: Hiroaki SHIMODA @ 2012-07-12 15:21 UTC (permalink / raw)
To: David Miller; +Cc: netdev
In-Reply-To: <20120712.080653.1463195798230664640.davem@davemloft.net>
On Thu, 12 Jul 2012 08:06:53 -0700 (PDT)
David Miller <davem@davemloft.net> wrote:
> From: Hiroaki SHIMODA <shimoda.hiroaki@gmail.com>
> Date: Thu, 12 Jul 2012 23:58:37 +0900
>
> > So, I think avobe deleted checks about skb->len need to move to
> > ping_err() in case of packets are malformed.
>
> You would be wrong, the check belongs in icmp_socket_deliver().
Ah, OK. Thanks ;)
^ permalink raw reply
* Re: pull-request: can-next 2012-07-11
From: David Miller @ 2012-07-12 15:19 UTC (permalink / raw)
To: mkl; +Cc: netdev, linux-can
In-Reply-To: <4FFD8825.2060109@pengutronix.de>
From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Wed, 11 Jul 2012 16:05:25 +0200
> the fourth pull request for upcoming v3.6 net-next consist of a series
> of can_gw netlink cleanups done by Thomas Graf.
Pulled, thanks.
^ permalink raw reply
* Re: [PATCH net-next 0/7] be2net updates
From: David Miller @ 2012-07-12 15:16 UTC (permalink / raw)
To: padmanabh.ratnakar; +Cc: netdev
In-Reply-To: <a8f2c513-d398-4be6-a059-242dfc2c052a@exht1.ad.emulex.com>
From: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Date: Thu, 12 Jul 2012 19:25:01 +0530
> Padmanabh Ratnakar (7):
> be2net: Fix error while toggling autoneg of pause parameters
> be2net : Fix die temperature stat for Lancer
> be2net: Fix initialization sequence for Lancer
> be2net: Activate new FW after FW download for Lancer
> be2net: Fix cleanup path when EQ creation fails
> be2net: Fix port name in message during driver load
> be2net: Enable RSS UDP hashing for Lancer and Skyhawk
All applied, but like others have said you should document in
the driver what exactly the chip uses in it's RSS calculations
and in what circumstances.
^ permalink raw reply
* Re: [patch net-next 0/3] team: couple of patches
From: David Miller @ 2012-07-12 15:14 UTC (permalink / raw)
To: jpirko; +Cc: netdev
In-Reply-To: <20120712.081124.1207448876900334978.davem@davemloft.net>
From: David Miller <davem@davemloft.net>
Date: Thu, 12 Jul 2012 08:11:24 -0700 (PDT)
> From: Jiri Pirko <jpirko@redhat.com>
> Date: Wed, 11 Jul 2012 17:34:01 +0200
>
>> Jiri Pirko (3):
>> team: use function team_port_txable() for determing enabled and up
>> port
>> team: add broadcast mode
>> team: make team_port_enabled() and team_port_txable() static inline
>
> All applied, thanks.
Jiri, btw, any chance I can convince you to remove the EXPERIMENTAL
Kconfig dependency?
Code I've written and checked in myself over the past few days is
several orders of magnitude more experimental than the team driver
is :-)
^ permalink raw reply
* Re: [PATCH net-next 01/11] sfc: Implement 128-bit writes for efx_writeo_page
From: David Miller @ 2012-07-12 15:13 UTC (permalink / raw)
To: bhutchings; +Cc: netdev, linux-net-drivers
In-Reply-To: <1342048518.2613.60.camel@bwh-desktop.uk.solarflarecom.com>
From: Ben Hutchings <bhutchings@solarflare.com>
Date: Thu, 12 Jul 2012 00:15:18 +0100
> Add support for writing a TX descriptor to the NIC in one PCIe
> transaction on x86_64 machines.
>
> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
This absolutely does not belong in a driver.
^ permalink raw reply
* Re: [patch net-next 0/3] team: couple of patches
From: David Miller @ 2012-07-12 15:11 UTC (permalink / raw)
To: jpirko; +Cc: netdev
In-Reply-To: <1342020844-3547-1-git-send-email-jpirko@redhat.com>
From: Jiri Pirko <jpirko@redhat.com>
Date: Wed, 11 Jul 2012 17:34:01 +0200
> Jiri Pirko (3):
> team: use function team_port_txable() for determing enabled and up
> port
> team: add broadcast mode
> team: make team_port_enabled() and team_port_txable() static inline
All applied, thanks.
^ permalink raw reply
* Re: [PATCH 02/16] ipv4: Deliver ICMP redirects to sockets too.
From: David Miller @ 2012-07-12 15:06 UTC (permalink / raw)
To: shimoda.hiroaki; +Cc: netdev
In-Reply-To: <20120712235837.4d611326830a16f9a035dd75@gmail.com>
From: Hiroaki SHIMODA <shimoda.hiroaki@gmail.com>
Date: Thu, 12 Jul 2012 23:58:37 +0900
> So, I think avobe deleted checks about skb->len need to move to
> ping_err() in case of packets are malformed.
You would be wrong, the check belongs in icmp_socket_deliver().
====================
>From f0a70e902f483295a8b6d74ef4393bc577b703d7 Mon Sep 17 00:00:00 2001
From: "David S. Miller" <davem@davemloft.net>
Date: Thu, 12 Jul 2012 08:06:04 -0700
Subject: [PATCH] ipv4: Put proper checks into icmp_socket_deliver().
All handler->err() routines expect that we've done a pskb_may_pull()
test to make sure that IP header length + 8 bytes can be safely
pulled.
Reported-by: Hiroaki SHIMODA <shimoda.hiroaki@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
net/ipv4/icmp.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index d01aeb4..ea3a996 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -640,6 +640,12 @@ static void icmp_socket_deliver(struct sk_buff *skb, u32 info)
const struct net_protocol *ipprot;
int protocol = iph->protocol;
+ /* Checkin full IP header plus 8 bytes of protocol to
+ * avoid additional coding at protocol handlers.
+ */
+ if (!pskb_may_pull(skb, iph->ihl * 4 + 8))
+ return;
+
raw_icmp_error(skb, protocol, info);
rcu_read_lock();
@@ -733,12 +739,6 @@ static void icmp_unreach(struct sk_buff *skb)
goto out;
}
- /* Checkin full IP header plus 8 bytes of protocol to
- * avoid additional coding at protocol handlers.
- */
- if (!pskb_may_pull(skb, iph->ihl * 4 + 8))
- goto out;
-
icmp_socket_deliver(skb, info);
out:
--
1.7.10.4
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox