* [PATCH net-next 13/21] tipc: make zone/cluster mask constants a define
From: Paul Gortmaker @ 2011-05-10 20:44 UTC (permalink / raw)
To: davem; +Cc: netdev, Allan.Stephens, Paul Gortmaker
In-Reply-To: <1305060277-15600-1-git-send-email-paul.gortmaker@windriver.com>
This allows them to be available for easy re-use in other places
and avoids trivial mistakes caused by "count the f's and 0's".
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
net/tipc/addr.h | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/net/tipc/addr.h b/net/tipc/addr.h
index 8971aba..e4f35af 100644
--- a/net/tipc/addr.h
+++ b/net/tipc/addr.h
@@ -37,14 +37,17 @@
#ifndef _TIPC_ADDR_H
#define _TIPC_ADDR_H
+#define TIPC_ZONE_MASK 0xff000000u
+#define TIPC_CLUSTER_MASK 0xfffff000u
+
static inline u32 tipc_zone_mask(u32 addr)
{
- return addr & 0xff000000u;
+ return addr & TIPC_ZONE_MASK;
}
static inline u32 tipc_cluster_mask(u32 addr)
{
- return addr & 0xfffff000u;
+ return addr & TIPC_CLUSTER_MASK;
}
static inline int in_own_cluster(u32 addr)
--
1.7.4.4
^ permalink raw reply related
* [PATCH net-next 14/21] tipc: Strengthen checks for neighboring node discovery
From: Paul Gortmaker @ 2011-05-10 20:44 UTC (permalink / raw)
To: davem; +Cc: netdev, Allan.Stephens, Paul Gortmaker
In-Reply-To: <1305060277-15600-1-git-send-email-paul.gortmaker@windriver.com>
From: Allan Stephens <Allan.Stephens@windriver.com>
Enhances existing checks on the discovery domain associated with a TIPC
bearer. A bearer can no longer be configured to accept links from itself
only (which would be pointless), or to nodes outside its own cluster
(since multi-cluster support has now been removed from TIPC). Also, the
neighbor discovery routine now validates link setup requests against the
configured discovery domain for the bearer, rather than simply ensuring
the requesting node belongs to the node's own cluster.
Signed-off-by: Allan Stephens <Allan.Stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
net/tipc/bearer.c | 11 +++++++++--
net/tipc/discover.c | 7 +++++--
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index 411719f..f7c29af 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -493,8 +493,15 @@ int tipc_enable_bearer(const char *name, u32 disc_domain, u32 priority)
warn("Bearer <%s> rejected, illegal name\n", name);
return -EINVAL;
}
- if (!tipc_addr_domain_valid(disc_domain) ||
- !tipc_in_scope(disc_domain, tipc_own_addr)) {
+ if (tipc_addr_domain_valid(disc_domain) &&
+ (disc_domain != tipc_own_addr)) {
+ if (tipc_in_scope(disc_domain, tipc_own_addr)) {
+ disc_domain = tipc_own_addr & TIPC_CLUSTER_MASK;
+ res = 0; /* accept any node in own cluster */
+ } else if (in_own_cluster(disc_domain))
+ res = 0; /* accept specified node in own cluster */
+ }
+ if (res) {
warn("Bearer <%s> rejected, illegal discovery domain\n", name);
return -EINVAL;
}
diff --git a/net/tipc/discover.c b/net/tipc/discover.c
index 491eff5..d2163bd 100644
--- a/net/tipc/discover.c
+++ b/net/tipc/discover.c
@@ -52,6 +52,7 @@
* struct link_req - information about an ongoing link setup request
* @bearer: bearer issuing requests
* @dest: destination address for request messages
+ * @domain: network domain to which links can be established
* @buf: request message to be (repeatedly) sent
* @timer: timer governing period between requests
* @timer_intv: current interval between requests (in ms)
@@ -59,6 +60,7 @@
struct link_req {
struct tipc_bearer *bearer;
struct tipc_media_addr dest;
+ u32 domain;
struct sk_buff *buf;
struct timer_list timer;
unsigned int timer_intv;
@@ -147,7 +149,7 @@ void tipc_disc_recv_msg(struct sk_buff *buf, struct tipc_bearer *b_ptr)
}
if (!tipc_in_scope(dest, tipc_own_addr))
return;
- if (!in_own_cluster(orig))
+ if (!tipc_in_scope(b_ptr->link_req->domain, orig))
return;
/* Locate structure corresponding to requesting node */
@@ -287,7 +289,7 @@ static void disc_timeout(struct link_req *req)
* tipc_disc_init_link_req - start sending periodic link setup requests
* @b_ptr: ptr to bearer issuing requests
* @dest: destination address for request messages
- * @dest_domain: network domain of node(s) which should respond to message
+ * @dest_domain: network domain to which links can be established
*
* Returns pointer to link request structure, or NULL if unable to create.
*/
@@ -310,6 +312,7 @@ struct link_req *tipc_disc_init_link_req(struct tipc_bearer *b_ptr,
memcpy(&req->dest, dest, sizeof(*dest));
req->bearer = b_ptr;
+ req->domain = dest_domain;
req->timer_intv = TIPC_LINK_REQ_INIT;
k_init_timer(&req->timer, (Handler)disc_timeout, (unsigned long)req);
k_start_timer(&req->timer, req->timer_intv);
--
1.7.4.4
^ permalink raw reply related
* [PATCH net-next 17/21] tipc: Introduce routine to enqueue a chain of messages on link tx queue
From: Paul Gortmaker @ 2011-05-10 20:44 UTC (permalink / raw)
To: davem; +Cc: netdev, Allan.Stephens, Allan Stephens, Paul Gortmaker
In-Reply-To: <1305060277-15600-1-git-send-email-paul.gortmaker@windriver.com>
From: Allan Stephens <allan.stephens@windriver.com>
Create a helper routine to enqueue a chain of sk_buffs to a link's
transmit queue. It improves readability and the new function is
anticipated to be used more than just once in the future as well.
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
net/tipc/link.c | 38 ++++++++++++++++++++++----------------
1 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 4bab139..5ed4b4f 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -843,6 +843,25 @@ static void link_add_to_outqueue(struct link *l_ptr,
l_ptr->stats.max_queue_sz = l_ptr->out_queue_size;
}
+static void link_add_chain_to_outqueue(struct link *l_ptr,
+ struct sk_buff *buf_chain,
+ u32 long_msgno)
+{
+ struct sk_buff *buf;
+ struct tipc_msg *msg;
+
+ if (!l_ptr->next_out)
+ l_ptr->next_out = buf_chain;
+ while (buf_chain) {
+ buf = buf_chain;
+ buf_chain = buf_chain->next;
+
+ msg = buf_msg(buf);
+ msg_set_long_msgno(msg, long_msgno);
+ link_add_to_outqueue(l_ptr, buf, msg);
+ }
+}
+
/*
* tipc_link_send_buf() is the 'full path' for messages, called from
* inside TIPC when the 'fast path' in tipc_send_buf
@@ -1276,25 +1295,12 @@ reject:
total_len, TIPC_ERR_NO_NODE);
}
- /* Append whole chain to send queue: */
+ /* Append chain of fragments to send queue & send them */
- buf = buf_chain;
l_ptr->long_msg_seq_no++;
- if (!l_ptr->next_out)
- l_ptr->next_out = buf_chain;
+ link_add_chain_to_outqueue(l_ptr, buf_chain, l_ptr->long_msg_seq_no);
+ l_ptr->stats.sent_fragments += fragm_no;
l_ptr->stats.sent_fragmented++;
- while (buf) {
- struct sk_buff *next = buf->next;
- struct tipc_msg *msg = buf_msg(buf);
-
- l_ptr->stats.sent_fragments++;
- msg_set_long_msgno(msg, l_ptr->long_msg_seq_no);
- link_add_to_outqueue(l_ptr, buf, msg);
- buf = next;
- }
-
- /* Send it, if possible: */
-
tipc_link_push_queue(l_ptr);
tipc_node_unlock(node);
return dsz;
--
1.7.4.4
^ permalink raw reply related
* [PATCH net-next 18/21] tipc: Enhance handling of discovery object creation failures
From: Paul Gortmaker @ 2011-05-10 20:44 UTC (permalink / raw)
To: davem; +Cc: netdev, Allan.Stephens, Paul Gortmaker
In-Reply-To: <1305060277-15600-1-git-send-email-paul.gortmaker@windriver.com>
From: Allan Stephens <Allan.Stephens@windriver.com>
Modifies bearer creation and deletion code to improve handling of
scenarios when a neighbor discovery object cannot be created. The
creation routine now aborts the creation of a bearer if its discovery
object cannot be created, and deletes the newly created bearer, rather
than failing quietly and leaving an unusable bearer hanging around.
Since the exit via the goto label really isn't a definitive failure
in all cases, relabel it appropriately.
Signed-off-by: Allan Stephens <Allan.Stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
net/tipc/bearer.c | 30 ++++++++++++++++++------------
net/tipc/discover.c | 45 +++++++++++++++++++++------------------------
net/tipc/discover.h | 8 +++-----
3 files changed, 42 insertions(+), 41 deletions(-)
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index f7c29af..5fcd1c1 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -46,6 +46,8 @@ static u32 media_count;
struct tipc_bearer tipc_bearers[MAX_BEARERS];
+static void bearer_disable(struct tipc_bearer *b_ptr);
+
/**
* media_name_valid - validate media name
*
@@ -518,7 +520,7 @@ int tipc_enable_bearer(const char *name, u32 disc_domain, u32 priority)
if (!m_ptr) {
warn("Bearer <%s> rejected, media <%s> not registered\n", name,
b_name.media_name);
- goto failed;
+ goto exit;
}
if (priority == TIPC_MEDIA_LINK_PRI)
@@ -534,14 +536,14 @@ restart:
}
if (!strcmp(name, tipc_bearers[i].name)) {
warn("Bearer <%s> rejected, already enabled\n", name);
- goto failed;
+ goto exit;
}
if ((tipc_bearers[i].priority == priority) &&
(++with_this_prio > 2)) {
if (priority-- == 0) {
warn("Bearer <%s> rejected, duplicate priority\n",
name);
- goto failed;
+ goto exit;
}
warn("Bearer <%s> priority adjustment required %u->%u\n",
name, priority + 1, priority);
@@ -551,7 +553,7 @@ restart:
if (bearer_id >= MAX_BEARERS) {
warn("Bearer <%s> rejected, bearer limit reached (%u)\n",
name, MAX_BEARERS);
- goto failed;
+ goto exit;
}
b_ptr = &tipc_bearers[bearer_id];
@@ -559,7 +561,7 @@ restart:
res = m_ptr->enable_bearer(b_ptr);
if (res) {
warn("Bearer <%s> rejected, enable failure (%d)\n", name, -res);
- goto failed;
+ goto exit;
}
b_ptr->identity = bearer_id;
@@ -569,14 +571,18 @@ restart:
b_ptr->priority = priority;
INIT_LIST_HEAD(&b_ptr->cong_links);
INIT_LIST_HEAD(&b_ptr->links);
- b_ptr->link_req = tipc_disc_init_link_req(b_ptr, &m_ptr->bcast_addr,
- disc_domain);
spin_lock_init(&b_ptr->lock);
- write_unlock_bh(&tipc_net_lock);
+
+ 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);
+ goto exit;
+ }
info("Enabled bearer <%s>, discovery domain %s, priority %u\n",
name, tipc_addr_string_fill(addr_string, disc_domain), priority);
- return 0;
-failed:
+exit:
write_unlock_bh(&tipc_net_lock);
return res;
}
@@ -627,14 +633,14 @@ static void bearer_disable(struct tipc_bearer *b_ptr)
struct link *temp_l_ptr;
info("Disabling bearer <%s>\n", b_ptr->name);
- tipc_disc_stop_link_req(b_ptr->link_req);
spin_lock_bh(&b_ptr->lock);
- b_ptr->link_req = NULL;
b_ptr->blocked = 1;
b_ptr->media->disable_bearer(b_ptr);
list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) {
tipc_link_delete(l_ptr);
}
+ if (b_ptr->link_req)
+ tipc_disc_delete(b_ptr->link_req);
spin_unlock_bh(&b_ptr->lock);
memset(b_ptr, 0, sizeof(struct tipc_bearer));
}
diff --git a/net/tipc/discover.c b/net/tipc/discover.c
index d2163bd..6acf32a 100644
--- a/net/tipc/discover.c
+++ b/net/tipc/discover.c
@@ -216,22 +216,6 @@ void tipc_disc_recv_msg(struct sk_buff *buf, struct tipc_bearer *b_ptr)
}
/**
- * tipc_disc_stop_link_req - stop sending periodic link setup requests
- * @req: ptr to link request structure
- */
-
-void tipc_disc_stop_link_req(struct link_req *req)
-{
- if (!req)
- return;
-
- k_cancel_timer(&req->timer);
- k_term_timer(&req->timer);
- buf_discard(req->buf);
- kfree(req);
-}
-
-/**
* tipc_disc_update_link_req - update frequency of periodic link setup requests
* @req: ptr to link request structure
*/
@@ -286,28 +270,27 @@ static void disc_timeout(struct link_req *req)
}
/**
- * tipc_disc_init_link_req - start sending periodic link setup requests
+ * tipc_disc_create - create object to send periodic link setup requests
* @b_ptr: ptr to bearer issuing requests
* @dest: destination address for request messages
* @dest_domain: network domain to which links can be established
*
- * Returns pointer to link request structure, or NULL if unable to create.
+ * Returns 0 if successful, otherwise -errno.
*/
-struct link_req *tipc_disc_init_link_req(struct tipc_bearer *b_ptr,
- const struct tipc_media_addr *dest,
- u32 dest_domain)
+int tipc_disc_create(struct tipc_bearer *b_ptr,
+ struct tipc_media_addr *dest, u32 dest_domain)
{
struct link_req *req;
req = kmalloc(sizeof(*req), GFP_ATOMIC);
if (!req)
- return NULL;
+ return -ENOMEM;
req->buf = tipc_disc_init_msg(DSC_REQ_MSG, dest_domain, b_ptr);
if (!req->buf) {
kfree(req);
- return NULL;
+ return -ENOMSG;
}
memcpy(&req->dest, dest, sizeof(*dest));
@@ -316,6 +299,20 @@ struct link_req *tipc_disc_init_link_req(struct tipc_bearer *b_ptr,
req->timer_intv = TIPC_LINK_REQ_INIT;
k_init_timer(&req->timer, (Handler)disc_timeout, (unsigned long)req);
k_start_timer(&req->timer, req->timer_intv);
- return req;
+ b_ptr->link_req = req;
+ return 0;
+}
+
+/**
+ * tipc_disc_delete - destroy object sending periodic link setup requests
+ * @req: ptr to link request structure
+ */
+
+void tipc_disc_delete(struct link_req *req)
+{
+ k_cancel_timer(&req->timer);
+ k_term_timer(&req->timer);
+ buf_discard(req->buf);
+ kfree(req);
}
diff --git a/net/tipc/discover.h b/net/tipc/discover.h
index e48a167..d6e44e3 100644
--- a/net/tipc/discover.h
+++ b/net/tipc/discover.h
@@ -39,12 +39,10 @@
struct link_req;
-struct link_req *tipc_disc_init_link_req(struct tipc_bearer *b_ptr,
- const struct tipc_media_addr *dest,
- u32 dest_domain);
+int tipc_disc_create(struct tipc_bearer *b_ptr, struct tipc_media_addr *dest,
+ u32 dest_domain);
+void tipc_disc_delete(struct link_req *req);
void tipc_disc_update_link_req(struct link_req *req);
-void tipc_disc_stop_link_req(struct link_req *req);
-
void tipc_disc_recv_msg(struct sk_buff *buf, struct tipc_bearer *b_ptr);
#endif
--
1.7.4.4
^ permalink raw reply related
* [PATCH net-next 19/21] tipc: Enhance sending of discovery object link request messages
From: Paul Gortmaker @ 2011-05-10 20:44 UTC (permalink / raw)
To: davem; +Cc: netdev, Allan.Stephens, Paul Gortmaker
In-Reply-To: <1305060277-15600-1-git-send-email-paul.gortmaker@windriver.com>
From: Allan Stephens <Allan.Stephens@windriver.com>
Augments TIPC's discovery object to send its initial neighbor discovery
request message as soon as the associated bearer is created, rather than
waiting for its first periodic timeout to occur, thereby speeding up the
discovery process. Also adds a check to suppress the initial request or
subsequent requests if the bearer is blocked at the time the request is
scheduled for transmission.
Signed-off-by: Allan Stephens <Allan.Stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
net/tipc/discover.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/net/tipc/discover.c b/net/tipc/discover.c
index 6acf32a..dba4767 100644
--- a/net/tipc/discover.c
+++ b/net/tipc/discover.c
@@ -241,6 +241,17 @@ void tipc_disc_update_link_req(struct link_req *req)
}
/**
+ * disc_send_msg - send link setup request message
+ * @req: ptr to link request structure
+ */
+
+static void disc_send_msg(struct link_req *req)
+{
+ if (!req->bearer->blocked)
+ tipc_bearer_send(req->bearer, req->buf, &req->dest);
+}
+
+/**
* disc_timeout - send a periodic link setup request
* @req: ptr to link request structure
*
@@ -251,7 +262,7 @@ static void disc_timeout(struct link_req *req)
{
spin_lock_bh(&req->bearer->lock);
- req->bearer->media->send_msg(req->buf, req->bearer, &req->dest);
+ disc_send_msg(req);
if ((req->timer_intv == TIPC_LINK_REQ_SLOW) ||
(req->timer_intv == TIPC_LINK_REQ_FAST)) {
@@ -300,6 +311,7 @@ int tipc_disc_create(struct tipc_bearer *b_ptr,
k_init_timer(&req->timer, (Handler)disc_timeout, (unsigned long)req);
k_start_timer(&req->timer, req->timer_intv);
b_ptr->link_req = req;
+ disc_send_msg(req);
return 0;
}
--
1.7.4.4
^ permalink raw reply related
* [PATCH net-next 16/21] tipc: Avoid recomputation of outgoing message length
From: Paul Gortmaker @ 2011-05-10 20:44 UTC (permalink / raw)
To: davem; +Cc: netdev, Allan.Stephens, Paul Gortmaker
In-Reply-To: <1305060277-15600-1-git-send-email-paul.gortmaker@windriver.com>
From: Allan Stephens <Allan.Stephens@windriver.com>
Rework TIPC's message sending routines to take advantage of the total
amount of data value passed to it by the kernel socket infrastructure.
This change eliminates the need for TIPC to compute the size of outgoing
messages itself, as well as the check for an oversize message in
tipc_msg_build(). In addition, this change warrants an explanation:
- res = send_packet(NULL, sock, &my_msg, 0);
+ res = send_packet(NULL, sock, &my_msg, bytes_to_send);
Previously, the final argument to send_packet() was ignored (since the
amount of data being sent was recalculated by a lower-level routine)
and we could just pass in a dummy value (0). Now that the
recalculation is being eliminated, the argument value being passed to
send_packet() is significant and we have to supply the actual amount
of data we want to send.
Signed-off-by: Allan Stephens <Allan.Stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
net/tipc/link.c | 18 +++++++++++-------
net/tipc/link.h | 1 +
net/tipc/msg.c | 25 +++----------------------
net/tipc/msg.h | 5 ++---
net/tipc/port.c | 49 +++++++++++++++++++++++++++----------------------
net/tipc/port.h | 14 +++++++++-----
net/tipc/socket.c | 14 +++++++++-----
net/tipc/subscr.c | 4 ++--
8 files changed, 64 insertions(+), 66 deletions(-)
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 2a9f44a..4bab139 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -92,7 +92,8 @@ static int link_recv_changeover_msg(struct link **l_ptr, struct sk_buff **buf);
static void link_set_supervision_props(struct link *l_ptr, u32 tolerance);
static int link_send_sections_long(struct tipc_port *sender,
struct iovec const *msg_sect,
- u32 num_sect, u32 destnode);
+ u32 num_sect, unsigned int total_len,
+ u32 destnode);
static void link_check_defragm_bufs(struct link *l_ptr);
static void link_state_event(struct link *l_ptr, u32 event);
static void link_reset_statistics(struct link *l_ptr);
@@ -1043,6 +1044,7 @@ int tipc_send_buf_fast(struct sk_buff *buf, u32 destnode)
int tipc_link_send_sections_fast(struct tipc_port *sender,
struct iovec const *msg_sect,
const u32 num_sect,
+ unsigned int total_len,
u32 destaddr)
{
struct tipc_msg *hdr = &sender->phdr;
@@ -1058,8 +1060,8 @@ again:
* (Must not hold any locks while building message.)
*/
- res = tipc_msg_build(hdr, msg_sect, num_sect, sender->max_pkt,
- !sender->user_port, &buf);
+ res = tipc_msg_build(hdr, msg_sect, num_sect, total_len,
+ sender->max_pkt, !sender->user_port, &buf);
read_lock_bh(&tipc_net_lock);
node = tipc_node_find(destaddr);
@@ -1104,7 +1106,8 @@ exit:
goto again;
return link_send_sections_long(sender, msg_sect,
- num_sect, destaddr);
+ num_sect, total_len,
+ destaddr);
}
tipc_node_unlock(node);
}
@@ -1116,7 +1119,7 @@ exit:
return tipc_reject_msg(buf, TIPC_ERR_NO_NODE);
if (res >= 0)
return tipc_port_reject_sections(sender, hdr, msg_sect, num_sect,
- TIPC_ERR_NO_NODE);
+ total_len, TIPC_ERR_NO_NODE);
return res;
}
@@ -1137,12 +1140,13 @@ exit:
static int link_send_sections_long(struct tipc_port *sender,
struct iovec const *msg_sect,
u32 num_sect,
+ unsigned int total_len,
u32 destaddr)
{
struct link *l_ptr;
struct tipc_node *node;
struct tipc_msg *hdr = &sender->phdr;
- u32 dsz = msg_data_sz(hdr);
+ u32 dsz = total_len;
u32 max_pkt, fragm_sz, rest;
struct tipc_msg fragm_hdr;
struct sk_buff *buf, *buf_chain, *prev;
@@ -1269,7 +1273,7 @@ reject:
buf_discard(buf_chain);
}
return tipc_port_reject_sections(sender, hdr, msg_sect, num_sect,
- TIPC_ERR_NO_NODE);
+ total_len, TIPC_ERR_NO_NODE);
}
/* Append whole chain to send queue: */
diff --git a/net/tipc/link.h b/net/tipc/link.h
index e6a30db..74fbeca 100644
--- a/net/tipc/link.h
+++ b/net/tipc/link.h
@@ -228,6 +228,7 @@ u32 tipc_link_get_max_pkt(u32 dest, u32 selector);
int tipc_link_send_sections_fast(struct tipc_port *sender,
struct iovec const *msg_sect,
const u32 num_sect,
+ unsigned int total_len,
u32 destnode);
void tipc_link_recv_bundle(struct sk_buff *buf);
int tipc_link_recv_fragment(struct sk_buff **pending,
diff --git a/net/tipc/msg.c b/net/tipc/msg.c
index 6d92d17..03e57bf 100644
--- a/net/tipc/msg.c
+++ b/net/tipc/msg.c
@@ -68,20 +68,6 @@ void tipc_msg_init(struct tipc_msg *m, u32 user, u32 type,
}
/**
- * tipc_msg_calc_data_size - determine total data size for message
- */
-
-int tipc_msg_calc_data_size(struct iovec const *msg_sect, u32 num_sect)
-{
- int dsz = 0;
- int i;
-
- for (i = 0; i < num_sect; i++)
- dsz += msg_sect[i].iov_len;
- return dsz;
-}
-
-/**
* tipc_msg_build - create message using specified header and data
*
* Note: Caller must not hold any locks in case copy_from_user() is interrupted!
@@ -89,18 +75,13 @@ int tipc_msg_calc_data_size(struct iovec const *msg_sect, u32 num_sect)
* Returns message data size or errno
*/
-int tipc_msg_build(struct tipc_msg *hdr,
- struct iovec const *msg_sect, u32 num_sect,
+int tipc_msg_build(struct tipc_msg *hdr, struct iovec const *msg_sect,
+ u32 num_sect, unsigned int total_len,
int max_size, int usrmem, struct sk_buff **buf)
{
int dsz, sz, hsz, pos, res, cnt;
- dsz = tipc_msg_calc_data_size(msg_sect, num_sect);
- if (unlikely(dsz > TIPC_MAX_USER_MSG_SIZE)) {
- *buf = NULL;
- return -EINVAL;
- }
-
+ dsz = total_len;
pos = hsz = msg_hdr_sz(hdr);
sz = hsz + dsz;
msg_set_size(hdr, sz);
diff --git a/net/tipc/msg.h b/net/tipc/msg.h
index 005b318..8452454 100644
--- a/net/tipc/msg.h
+++ b/net/tipc/msg.h
@@ -750,9 +750,8 @@ static inline void msg_set_link_tolerance(struct tipc_msg *m, u32 n)
u32 tipc_msg_tot_importance(struct tipc_msg *m);
void tipc_msg_init(struct tipc_msg *m, u32 user, u32 type,
u32 hsize, u32 destnode);
-int tipc_msg_calc_data_size(struct iovec const *msg_sect, u32 num_sect);
-int tipc_msg_build(struct tipc_msg *hdr,
- struct iovec const *msg_sect, u32 num_sect,
+int tipc_msg_build(struct tipc_msg *hdr, struct iovec const *msg_sect,
+ u32 num_sect, unsigned int total_len,
int max_size, int usrmem, struct sk_buff **buf);
static inline void msg_set_media_addr(struct tipc_msg *m, struct tipc_media_addr *a)
diff --git a/net/tipc/port.c b/net/tipc/port.c
index 9f2ff12..c68dc95 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -74,7 +74,8 @@ static u32 port_peerport(struct tipc_port *p_ptr)
*/
int tipc_multicast(u32 ref, struct tipc_name_seq const *seq,
- u32 num_sect, struct iovec const *msg_sect)
+ u32 num_sect, struct iovec const *msg_sect,
+ unsigned int total_len)
{
struct tipc_msg *hdr;
struct sk_buff *buf;
@@ -98,7 +99,7 @@ int tipc_multicast(u32 ref, struct tipc_name_seq const *seq,
msg_set_namelower(hdr, seq->lower);
msg_set_nameupper(hdr, seq->upper);
msg_set_hdr_sz(hdr, MCAST_H_SIZE);
- res = tipc_msg_build(hdr, msg_sect, num_sect, MAX_MSG_SIZE,
+ res = tipc_msg_build(hdr, msg_sect, num_sect, total_len, MAX_MSG_SIZE,
!oport->user_port, &buf);
if (unlikely(!buf))
return res;
@@ -418,12 +419,12 @@ int tipc_reject_msg(struct sk_buff *buf, u32 err)
int tipc_port_reject_sections(struct tipc_port *p_ptr, struct tipc_msg *hdr,
struct iovec const *msg_sect, u32 num_sect,
- int err)
+ unsigned int total_len, int err)
{
struct sk_buff *buf;
int res;
- res = tipc_msg_build(hdr, msg_sect, num_sect, MAX_MSG_SIZE,
+ res = tipc_msg_build(hdr, msg_sect, num_sect, total_len, MAX_MSG_SIZE,
!p_ptr->user_port, &buf);
if (!buf)
return res;
@@ -1163,12 +1164,13 @@ int tipc_shutdown(u32 ref)
*/
static int tipc_port_recv_sections(struct tipc_port *sender, unsigned int num_sect,
- struct iovec const *msg_sect)
+ struct iovec const *msg_sect,
+ unsigned int total_len)
{
struct sk_buff *buf;
int res;
- res = tipc_msg_build(&sender->phdr, msg_sect, num_sect,
+ res = tipc_msg_build(&sender->phdr, msg_sect, num_sect, total_len,
MAX_MSG_SIZE, !sender->user_port, &buf);
if (likely(buf))
tipc_port_recv_msg(buf);
@@ -1179,7 +1181,8 @@ static int tipc_port_recv_sections(struct tipc_port *sender, unsigned int num_se
* tipc_send - send message sections on connection
*/
-int tipc_send(u32 ref, unsigned int num_sect, struct iovec const *msg_sect)
+int tipc_send(u32 ref, unsigned int num_sect, struct iovec const *msg_sect,
+ unsigned int total_len)
{
struct tipc_port *p_ptr;
u32 destnode;
@@ -1194,9 +1197,10 @@ int tipc_send(u32 ref, unsigned int num_sect, struct iovec const *msg_sect)
destnode = port_peernode(p_ptr);
if (likely(destnode != tipc_own_addr))
res = tipc_link_send_sections_fast(p_ptr, msg_sect, num_sect,
- destnode);
+ total_len, destnode);
else
- res = tipc_port_recv_sections(p_ptr, num_sect, msg_sect);
+ res = tipc_port_recv_sections(p_ptr, num_sect, msg_sect,
+ total_len);
if (likely(res != -ELINKCONG)) {
p_ptr->congested = 0;
@@ -1207,8 +1211,7 @@ int tipc_send(u32 ref, unsigned int num_sect, struct iovec const *msg_sect)
}
if (port_unreliable(p_ptr)) {
p_ptr->congested = 0;
- /* Just calculate msg length and return */
- return tipc_msg_calc_data_size(msg_sect, num_sect);
+ return total_len;
}
return -ELINKCONG;
}
@@ -1218,7 +1221,8 @@ int tipc_send(u32 ref, unsigned int num_sect, struct iovec const *msg_sect)
*/
int tipc_send2name(u32 ref, struct tipc_name const *name, unsigned int domain,
- unsigned int num_sect, struct iovec const *msg_sect)
+ unsigned int num_sect, struct iovec const *msg_sect,
+ unsigned int total_len)
{
struct tipc_port *p_ptr;
struct tipc_msg *msg;
@@ -1245,23 +1249,23 @@ int tipc_send2name(u32 ref, struct tipc_name const *name, unsigned int domain,
if (likely(destport)) {
if (likely(destnode == tipc_own_addr))
res = tipc_port_recv_sections(p_ptr, num_sect,
- msg_sect);
+ msg_sect, total_len);
else
res = tipc_link_send_sections_fast(p_ptr, msg_sect,
- num_sect, destnode);
+ num_sect, total_len,
+ destnode);
if (likely(res != -ELINKCONG)) {
if (res > 0)
p_ptr->sent++;
return res;
}
if (port_unreliable(p_ptr)) {
- /* Just calculate msg length and return */
- return tipc_msg_calc_data_size(msg_sect, num_sect);
+ return total_len;
}
return -ELINKCONG;
}
return tipc_port_reject_sections(p_ptr, msg, msg_sect, num_sect,
- TIPC_ERR_NO_NAME);
+ total_len, TIPC_ERR_NO_NAME);
}
/**
@@ -1269,7 +1273,8 @@ int tipc_send2name(u32 ref, struct tipc_name const *name, unsigned int domain,
*/
int tipc_send2port(u32 ref, struct tipc_portid const *dest,
- unsigned int num_sect, struct iovec const *msg_sect)
+ unsigned int num_sect, struct iovec const *msg_sect,
+ unsigned int total_len)
{
struct tipc_port *p_ptr;
struct tipc_msg *msg;
@@ -1289,18 +1294,18 @@ int tipc_send2port(u32 ref, struct tipc_portid const *dest,
msg_set_hdr_sz(msg, DIR_MSG_H_SIZE);
if (dest->node == tipc_own_addr)
- res = tipc_port_recv_sections(p_ptr, num_sect, msg_sect);
+ res = tipc_port_recv_sections(p_ptr, num_sect, msg_sect,
+ total_len);
else
res = tipc_link_send_sections_fast(p_ptr, msg_sect, num_sect,
- dest->node);
+ total_len, dest->node);
if (likely(res != -ELINKCONG)) {
if (res > 0)
p_ptr->sent++;
return res;
}
if (port_unreliable(p_ptr)) {
- /* Just calculate msg length and return */
- return tipc_msg_calc_data_size(msg_sect, num_sect);
+ return total_len;
}
return -ELINKCONG;
}
diff --git a/net/tipc/port.h b/net/tipc/port.h
index 87b9424..b9aa341 100644
--- a/net/tipc/port.h
+++ b/net/tipc/port.h
@@ -205,23 +205,27 @@ int tipc_disconnect_port(struct tipc_port *tp_ptr);
/*
* TIPC messaging routines
*/
-int tipc_send(u32 portref, unsigned int num_sect, struct iovec const *msg_sect);
+int tipc_send(u32 portref, unsigned int num_sect, struct iovec const *msg_sect,
+ unsigned int total_len);
int tipc_send2name(u32 portref, struct tipc_name const *name, u32 domain,
- unsigned int num_sect, struct iovec const *msg_sect);
+ unsigned int num_sect, struct iovec const *msg_sect,
+ unsigned int total_len);
int tipc_send2port(u32 portref, struct tipc_portid const *dest,
- unsigned int num_sect, struct iovec const *msg_sect);
+ unsigned int num_sect, struct iovec const *msg_sect,
+ unsigned int total_len);
int tipc_send_buf2port(u32 portref, struct tipc_portid const *dest,
struct sk_buff *buf, unsigned int dsz);
int tipc_multicast(u32 portref, struct tipc_name_seq const *seq,
- unsigned int section_count, struct iovec const *msg);
+ unsigned int section_count, struct iovec const *msg,
+ unsigned int total_len);
int tipc_port_reject_sections(struct tipc_port *p_ptr, struct tipc_msg *hdr,
struct iovec const *msg_sect, u32 num_sect,
- int err);
+ unsigned int total_len, int err);
struct sk_buff *tipc_port_get_ports(void);
void tipc_port_recv_proto_msg(struct sk_buff *buf);
void tipc_port_recv_mcast(struct sk_buff *buf, struct port_list *dp);
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index e1c7917..3388373 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -576,12 +576,14 @@ static int send_msg(struct kiocb *iocb, struct socket *sock,
&dest->addr.name.name,
dest->addr.name.domain,
m->msg_iovlen,
- m->msg_iov);
+ m->msg_iov,
+ total_len);
} else if (dest->addrtype == TIPC_ADDR_ID) {
res = tipc_send2port(tport->ref,
&dest->addr.id,
m->msg_iovlen,
- m->msg_iov);
+ m->msg_iov,
+ total_len);
} else if (dest->addrtype == TIPC_ADDR_MCAST) {
if (needs_conn) {
res = -EOPNOTSUPP;
@@ -593,7 +595,8 @@ static int send_msg(struct kiocb *iocb, struct socket *sock,
res = tipc_multicast(tport->ref,
&dest->addr.nameseq,
m->msg_iovlen,
- m->msg_iov);
+ m->msg_iov,
+ total_len);
}
if (likely(res != -ELINKCONG)) {
if (needs_conn && (res >= 0))
@@ -659,7 +662,8 @@ static int send_packet(struct kiocb *iocb, struct socket *sock,
break;
}
- res = tipc_send(tport->ref, m->msg_iovlen, m->msg_iov);
+ res = tipc_send(tport->ref, m->msg_iovlen, m->msg_iov,
+ total_len);
if (likely(res != -ELINKCONG))
break;
if (m->msg_flags & MSG_DONTWAIT) {
@@ -766,7 +770,7 @@ static int send_stream(struct kiocb *iocb, struct socket *sock,
bytes_to_send = curr_left;
my_iov.iov_base = curr_start;
my_iov.iov_len = bytes_to_send;
- res = send_packet(NULL, sock, &my_msg, 0);
+ res = send_packet(NULL, sock, &my_msg, bytes_to_send);
if (res < 0) {
if (bytes_sent)
res = bytes_sent;
diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c
index aae9eae..6cf7268 100644
--- a/net/tipc/subscr.c
+++ b/net/tipc/subscr.c
@@ -109,7 +109,7 @@ static void subscr_send_event(struct subscription *sub,
sub->evt.found_upper = htohl(found_upper, sub->swap);
sub->evt.port.ref = htohl(port_ref, sub->swap);
sub->evt.port.node = htohl(node, sub->swap);
- tipc_send(sub->server_ref, 1, &msg_sect);
+ tipc_send(sub->server_ref, 1, &msg_sect, msg_sect.iov_len);
}
/**
@@ -521,7 +521,7 @@ static void subscr_named_msg_event(void *usr_handle,
/* Send an ACK- to complete connection handshaking */
- tipc_send(server_port_ref, 0, NULL);
+ tipc_send(server_port_ref, 0, NULL, 0);
/* Handle optional subscription request */
--
1.7.4.4
^ permalink raw reply related
* [PATCH net-next 15/21] tipc: Abort excessive send requests as early as possible
From: Paul Gortmaker @ 2011-05-10 20:44 UTC (permalink / raw)
To: davem; +Cc: netdev, Allan.Stephens, Paul Gortmaker
In-Reply-To: <1305060277-15600-1-git-send-email-paul.gortmaker@windriver.com>
From: Allan Stephens <Allan.Stephens@windriver.com>
Adds checks to TIPC's socket send routines to promptly detect and
abort attempts to send more than 66,000 bytes in a single TIPC
message or more than 2**31-1 bytes in a single TIPC byte stream request.
In addition, this ensures that the number of iovecs in a send request
does not exceed the limits of a standard integer variable.
Signed-off-by: Allan Stephens <Allan.Stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
include/linux/tipc.h | 2 +-
net/tipc/socket.c | 13 +++++++++++++
2 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/include/linux/tipc.h b/include/linux/tipc.h
index a5b994a..f2d9009 100644
--- a/include/linux/tipc.h
+++ b/include/linux/tipc.h
@@ -101,7 +101,7 @@ static inline unsigned int tipc_node(__u32 addr)
* Limiting values for messages
*/
-#define TIPC_MAX_USER_MSG_SIZE 66000
+#define TIPC_MAX_USER_MSG_SIZE 66000U
/*
* Message importance levels
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 29d94d5..e1c7917 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -535,6 +535,9 @@ static int send_msg(struct kiocb *iocb, struct socket *sock,
if (unlikely((m->msg_namelen < sizeof(*dest)) ||
(dest->family != AF_TIPC)))
return -EINVAL;
+ if ((total_len > TIPC_MAX_USER_MSG_SIZE) ||
+ (m->msg_iovlen > (unsigned)INT_MAX))
+ return -EMSGSIZE;
if (iocb)
lock_sock(sk);
@@ -640,6 +643,10 @@ static int send_packet(struct kiocb *iocb, struct socket *sock,
if (unlikely(dest))
return send_msg(iocb, sock, m, total_len);
+ if ((total_len > TIPC_MAX_USER_MSG_SIZE) ||
+ (m->msg_iovlen > (unsigned)INT_MAX))
+ return -EMSGSIZE;
+
if (iocb)
lock_sock(sk);
@@ -723,6 +730,12 @@ static int send_stream(struct kiocb *iocb, struct socket *sock,
goto exit;
}
+ if ((total_len > (unsigned)INT_MAX) ||
+ (m->msg_iovlen > (unsigned)INT_MAX)) {
+ res = -EMSGSIZE;
+ goto exit;
+ }
+
/*
* Send each iovec entry using one or more messages
*
--
1.7.4.4
^ permalink raw reply related
* [PATCH net-next 21/21] tipc: Revise timings used when sending link request messages
From: Paul Gortmaker @ 2011-05-10 20:44 UTC (permalink / raw)
To: davem; +Cc: netdev, Allan.Stephens, Paul Gortmaker
In-Reply-To: <1305060277-15600-1-git-send-email-paul.gortmaker@windriver.com>
From: Allan Stephens <Allan.Stephens@windriver.com>
Revises the algorithm governing the sending of link request messages
to take into account the number of nodes each bearer is currently in
contact with, and to ensure more rapid rediscovery of neighboring nodes
if a bearer fails and then recovers.
The discovery object now sends requests at least once a second if it
is not in contact with any other nodes, and at least once a minute if
it has at least one neighbor; if contact with the only neighbor is
lost, the object immediately reverts to its initial rapid-fire search
timing to accelerate the rediscovery process.
In addition, the discovery object now stops issuing link request
messages if it is in contact with the only neighboring node it is
configured to communicate with, since further searching is unnecessary.
Signed-off-by: Allan Stephens <Allan.Stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
net/tipc/discover.c | 66 +++++++++++++++++++++++++++-----------------------
1 files changed, 36 insertions(+), 30 deletions(-)
diff --git a/net/tipc/discover.c b/net/tipc/discover.c
index 3cb232d..0987933 100644
--- a/net/tipc/discover.c
+++ b/net/tipc/discover.c
@@ -39,13 +39,9 @@
#include "discover.h"
#define TIPC_LINK_REQ_INIT 125 /* min delay during bearer start up */
-#define TIPC_LINK_REQ_FAST 2000 /* normal delay if bearer has no links */
-#define TIPC_LINK_REQ_SLOW 600000 /* normal delay if bearer has links */
-
-/*
- * TODO: Most of the inter-cluster setup stuff should be
- * rewritten, and be made conformant with specification.
- */
+#define TIPC_LINK_REQ_FAST 1000 /* max delay if bearer has no links */
+#define TIPC_LINK_REQ_SLOW 60000 /* max delay if bearer has links */
+#define TIPC_LINK_REQ_INACTIVE 0xffffffff /* indicates no timer in use */
/**
@@ -220,22 +216,19 @@ void tipc_disc_recv_msg(struct sk_buff *buf, struct tipc_bearer *b_ptr)
/**
* disc_update - update frequency of periodic link setup requests
* @req: ptr to link request structure
+ *
+ * Reinitiates discovery process if discovery object has no associated nodes
+ * and is either not currently searching or is searching at a slow rate
*/
static void disc_update(struct link_req *req)
{
- if (req->timer_intv == TIPC_LINK_REQ_SLOW) {
- if (!req->bearer->nodes.count) {
- req->timer_intv = TIPC_LINK_REQ_FAST;
+ if (!req->num_nodes) {
+ if ((req->timer_intv == TIPC_LINK_REQ_INACTIVE) ||
+ (req->timer_intv > TIPC_LINK_REQ_FAST)) {
+ req->timer_intv = TIPC_LINK_REQ_INIT;
k_start_timer(&req->timer, req->timer_intv);
}
- } else if (req->timer_intv == TIPC_LINK_REQ_FAST) {
- if (req->bearer->nodes.count) {
- req->timer_intv = TIPC_LINK_REQ_SLOW;
- k_start_timer(&req->timer, req->timer_intv);
- }
- } else {
- /* leave timer "as is" if haven't yet reached a "normal" rate */
}
}
@@ -247,7 +240,6 @@ static void disc_update(struct link_req *req)
void tipc_disc_add_dest(struct link_req *req)
{
req->num_nodes++;
- disc_update(req);
}
/**
@@ -281,23 +273,37 @@ static void disc_send_msg(struct link_req *req)
static void disc_timeout(struct link_req *req)
{
+ int max_delay;
+
spin_lock_bh(&req->bearer->lock);
- disc_send_msg(req);
+ /* Stop searching if only desired node has been found */
- if ((req->timer_intv == TIPC_LINK_REQ_SLOW) ||
- (req->timer_intv == TIPC_LINK_REQ_FAST)) {
- /* leave timer interval "as is" if already at a "normal" rate */
- } else {
- req->timer_intv *= 2;
- if (req->timer_intv > TIPC_LINK_REQ_FAST)
- req->timer_intv = TIPC_LINK_REQ_FAST;
- if ((req->timer_intv == TIPC_LINK_REQ_FAST) &&
- (req->bearer->nodes.count))
- req->timer_intv = TIPC_LINK_REQ_SLOW;
+ if (tipc_node(req->domain) && req->num_nodes) {
+ req->timer_intv = TIPC_LINK_REQ_INACTIVE;
+ goto exit;
}
- k_start_timer(&req->timer, req->timer_intv);
+ /*
+ * Send discovery message, then update discovery timer
+ *
+ * Keep doubling time between requests until limit is reached;
+ * hold at fast polling rate if don't have any associated nodes,
+ * otherwise hold at slow polling rate
+ */
+
+ disc_send_msg(req);
+
+ req->timer_intv *= 2;
+ if (req->num_nodes)
+ max_delay = TIPC_LINK_REQ_SLOW;
+ else
+ max_delay = TIPC_LINK_REQ_FAST;
+ if (req->timer_intv > max_delay)
+ req->timer_intv = max_delay;
+
+ k_start_timer(&req->timer, req->timer_intv);
+exit:
spin_unlock_bh(&req->bearer->lock);
}
--
1.7.4.4
^ permalink raw reply related
* [PATCH net-next 20/21] tipc: Add monitoring of number of nodes discovered by bearer
From: Paul Gortmaker @ 2011-05-10 20:44 UTC (permalink / raw)
To: davem; +Cc: netdev, Allan.Stephens, Paul Gortmaker
In-Reply-To: <1305060277-15600-1-git-send-email-paul.gortmaker@windriver.com>
From: Allan Stephens <Allan.Stephens@windriver.com>
Augments TIPC's discovery object to track the number of neighboring nodes
having an active link to the associated bearer.
This means tipc_disc_update_link_req() becomes either one of:
tipc_disc_add_dest()
or:
tipc_disc_remove_dest()
depending on the code flow direction of things.
Signed-off-by: Allan Stephens <Allan.Stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
net/tipc/bearer.c | 4 ++--
net/tipc/discover.c | 32 +++++++++++++++++++++++++++-----
net/tipc/discover.h | 3 ++-
3 files changed, 31 insertions(+), 8 deletions(-)
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index 5fcd1c1..85209ea 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -344,15 +344,15 @@ struct sk_buff *tipc_bearer_get_names(void)
void tipc_bearer_add_dest(struct tipc_bearer *b_ptr, u32 dest)
{
tipc_nmap_add(&b_ptr->nodes, dest);
- tipc_disc_update_link_req(b_ptr->link_req);
tipc_bcbearer_sort();
+ tipc_disc_add_dest(b_ptr->link_req);
}
void tipc_bearer_remove_dest(struct tipc_bearer *b_ptr, u32 dest)
{
tipc_nmap_remove(&b_ptr->nodes, dest);
- tipc_disc_update_link_req(b_ptr->link_req);
tipc_bcbearer_sort();
+ tipc_disc_remove_dest(b_ptr->link_req);
}
/*
diff --git a/net/tipc/discover.c b/net/tipc/discover.c
index dba4767..3cb232d 100644
--- a/net/tipc/discover.c
+++ b/net/tipc/discover.c
@@ -53,6 +53,7 @@
* @bearer: bearer issuing requests
* @dest: destination address for request messages
* @domain: network domain to which links can be established
+ * @num_nodes: number of nodes currently discovered (i.e. with an active link)
* @buf: request message to be (repeatedly) sent
* @timer: timer governing period between requests
* @timer_intv: current interval between requests (in ms)
@@ -61,6 +62,7 @@ struct link_req {
struct tipc_bearer *bearer;
struct tipc_media_addr dest;
u32 domain;
+ int num_nodes;
struct sk_buff *buf;
struct timer_list timer;
unsigned int timer_intv;
@@ -216,15 +218,12 @@ void tipc_disc_recv_msg(struct sk_buff *buf, struct tipc_bearer *b_ptr)
}
/**
- * tipc_disc_update_link_req - update frequency of periodic link setup requests
+ * disc_update - update frequency of periodic link setup requests
* @req: ptr to link request structure
*/
-void tipc_disc_update_link_req(struct link_req *req)
+static void disc_update(struct link_req *req)
{
- if (!req)
- return;
-
if (req->timer_intv == TIPC_LINK_REQ_SLOW) {
if (!req->bearer->nodes.count) {
req->timer_intv = TIPC_LINK_REQ_FAST;
@@ -241,6 +240,28 @@ void tipc_disc_update_link_req(struct link_req *req)
}
/**
+ * tipc_disc_add_dest - increment set of discovered nodes
+ * @req: ptr to link request structure
+ */
+
+void tipc_disc_add_dest(struct link_req *req)
+{
+ req->num_nodes++;
+ disc_update(req);
+}
+
+/**
+ * tipc_disc_remove_dest - decrement set of discovered nodes
+ * @req: ptr to link request structure
+ */
+
+void tipc_disc_remove_dest(struct link_req *req)
+{
+ req->num_nodes--;
+ disc_update(req);
+}
+
+/**
* disc_send_msg - send link setup request message
* @req: ptr to link request structure
*/
@@ -307,6 +328,7 @@ int tipc_disc_create(struct tipc_bearer *b_ptr,
memcpy(&req->dest, dest, sizeof(*dest));
req->bearer = b_ptr;
req->domain = dest_domain;
+ req->num_nodes = 0;
req->timer_intv = TIPC_LINK_REQ_INIT;
k_init_timer(&req->timer, (Handler)disc_timeout, (unsigned long)req);
k_start_timer(&req->timer, req->timer_intv);
diff --git a/net/tipc/discover.h b/net/tipc/discover.h
index d6e44e3..a3af595 100644
--- a/net/tipc/discover.h
+++ b/net/tipc/discover.h
@@ -42,7 +42,8 @@ struct link_req;
int tipc_disc_create(struct tipc_bearer *b_ptr, struct tipc_media_addr *dest,
u32 dest_domain);
void tipc_disc_delete(struct link_req *req);
-void tipc_disc_update_link_req(struct link_req *req);
+void tipc_disc_add_dest(struct link_req *req);
+void tipc_disc_remove_dest(struct link_req *req);
void tipc_disc_recv_msg(struct sk_buff *buf, struct tipc_bearer *b_ptr);
#endif
--
1.7.4.4
^ permalink raw reply related
* Re: [Bugme-new] [Bug 33502] New: Caught 64-bit read from uninitialized memory in __alloc_skb
From: Eric Dumazet @ 2011-05-10 20:45 UTC (permalink / raw)
To: Christoph Lameter
Cc: Vegard Nossum, Pekka Enberg, casteyde.christian, Andrew Morton,
netdev, bugzilla-daemon, bugme-daemon
In-Reply-To: <alpine.DEB.2.00.1105101531160.4023@router.home>
Le mardi 10 mai 2011 à 15:33 -0500, Christoph Lameter a écrit :
> On Tue, 10 May 2011, Eric Dumazet wrote:
>
> > Le mardi 10 mai 2011 à 14:38 -0500, Christoph Lameter a écrit :
> >
> > > Optimizing? You think about this as concurrency issue between multiple
> > > cpus. That is fundamentally wrong. This is dealing with access to per cpu
> > > data and the concurrency issues are only with code running on the *same*
> > > cpu.
> > >
> >
> > If you enable irqs, then this object can be allocated by _this_ cpu and
> > given to another one.
>
> That will cause an incrementing of the tid.
>
> > Another cpu can free the page, forcing you to call a very expensive
> > function, that might give obsolete result as soon it returns.
>
> No the other cpu cannot free the page since the page is pinned by
> the current cpu (see PageFrozen()).
>
What happens then ? Other cpu calls kfree() on last nonfreed object for
this slab, and yet the page stay frozen ? How this page is going to be
freed at all ?
> > Maybe I am just tired tonight, this seems very obvious, I must miss
> > something.
>
> Yeah you are way off thinking about cpu to cpu concurrency issues that do
> not apply here.
I fail to understand how current cpu can assert page ownership, if IRQs
are enabled, this seems obvious it cannot.
^ permalink raw reply
* Re: [PATCHv2 net-next-2.6 2/2] qlcnic: Take FW dump via ethtool
From: Anirban Chakraborty @ 2011-05-10 21:00 UTC (permalink / raw)
To: Ben Hutchings; +Cc: netdev, David Miller
In-Reply-To: <1305052826.2859.53.camel@bwh-desktop>
On May 10, 2011, at 11:40 AM, Ben Hutchings wrote:
> On Mon, 2011-05-09 at 18:02 -0700, Anirban Chakraborty wrote:
>> Driver checks if the previous dump has been cleared before taking the dump.
>> It doesn't take the dump if it is not cleared.
>>
>> Signed-off-by: Anirban Chakraborty <anirban.chakraborty@qlogic.com>
>> ---
>> drivers/net/qlcnic/qlcnic_ethtool.c | 60 +++++++++++++++++++++++++++++++++++
>> 1 files changed, 60 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/net/qlcnic/qlcnic_ethtool.c b/drivers/net/qlcnic/qlcnic_ethtool.c
>> index c541461..1237449 100644
>> --- a/drivers/net/qlcnic/qlcnic_ethtool.c
>> +++ b/drivers/net/qlcnic/qlcnic_ethtool.c
>> @@ -965,6 +965,64 @@ static void qlcnic_set_msglevel(struct net_device *netdev, u32 msglvl)
>> adapter->msg_enable = msglvl;
>> }
>>
>> +static int
>> +qlcnic_get_dump(struct net_device *netdev, struct ethtool_dump *dump,
>> + void *buffer)
>> +{
>> + int i, copy_sz;
>> + u32 *hdr_ptr, *data;
>> + struct qlcnic_adapter *adapter = netdev_priv(netdev);
>> + struct qlcnic_fw_dump *fw_dump = &adapter->ahw->fw_dump;
>> +
>> + if (dump->type == ETHTOOL_DUMP_FLAG) {
>> + dump->len = fw_dump->tmpl_hdr->size + fw_dump->size;
>> + dump->flag = fw_dump->tmpl_hdr->drv_cap_mask;
>> + return 0;
>> + }
>> + if (!fw_dump->clr) {
>> + netdev_info(netdev, "Dump not available\n");
>> + return -EINVAL;
>> + }
>> + copy_sz = fw_dump->tmpl_hdr->size;
>> + /* Copy template header first */
>> + hdr_ptr = (u32 *) fw_dump->tmpl_hdr;
>> + data = (u32 *) buffer;
>> + for (i = 0; i < copy_sz/sizeof(u32); i++)
>> + *data++ = cpu_to_le32(*hdr_ptr++);
>> + /* Copy captured dump data */
>> + memcpy(buffer + copy_sz, fw_dump->data, fw_dump->size);
>> + dump->len = copy_sz + fw_dump->size;
>> + dump->flag = fw_dump->tmpl_hdr->drv_cap_mask;
>> + /* free dump area once the whoel dump data has been captured */
>> + vfree(fw_dump->data);
>> + fw_dump->size = 0;
>> + fw_dump->data = NULL;
>> + fw_dump->clr = 0;
>
> This doesn't seem to be serialised with the code that captures firmware
> dumps. They need to use the same lock!
When we take the dump, we bring down the interface. So, ethtool will not get a chance to
fetch the dump data while the dump operation is in progress.
>
>> + return 0;
>> +}
>> +
>> +static int
>> +qlcnic_set_dump(struct net_device *netdev, struct ethtool_dump *val)
>> +{
>> + struct qlcnic_adapter *adapter = netdev_priv(netdev);
>> + struct qlcnic_fw_dump *fw_dump = &adapter->ahw->fw_dump;
>> + if (val->flag == QLCNIC_FORCE_FW_DUMP_KEY) {
>> + netdev_info(netdev, "Forcing a FW dump\n");
>> + qlcnic_dev_request_reset(adapter);
>> + } else {
>> + if (val->flag > QLCNIC_DUMP_MASK_MAX ||
>> + val->flag < QLCNIC_DUMP_MASK_MIN) {
>> + netdev_info(netdev,
>> + "Invalid dump level: 0x%x\n", val->flag);
>> + return -EINVAL;
>> + }
>> + fw_dump->tmpl_hdr->drv_cap_mask = val->flag & 0xff;
>> + netdev_info(netdev, "Driver mask changed to: 0x%x\n",
>> + fw_dump->tmpl_hdr->drv_cap_mask);
>
> If the flags change, doesn't this invalidate any dump that has been
> collected by the driver but not saved?
If the flags change, its effect would be relevant from the next dump capture. The flag indicates to the
driver to gather FW dump for a specific level of detail.
>
> Also, same locking problem here.
Addressed above.
Thanks for reviewing.
-Anirban
^ permalink raw reply
* Re: [Bugme-new] [Bug 33502] New: Caught 64-bit read from uninitialized memory in __alloc_skb
From: Christoph Lameter @ 2011-05-10 21:22 UTC (permalink / raw)
To: Eric Dumazet
Cc: Vegard Nossum, Pekka Enberg, casteyde.christian, Andrew Morton,
netdev, bugzilla-daemon, bugme-daemon
In-Reply-To: <1305060353.2437.26.camel@edumazet-laptop>
On Tue, 10 May 2011, Eric Dumazet wrote:
> > No the other cpu cannot free the page since the page is pinned by
> > the current cpu (see PageFrozen()).
> >
>
> What happens then ? Other cpu calls kfree() on last nonfreed object for
> this slab, and yet the page stay frozen ? How this page is going to be
> freed at all ?
Yes the page stays frozen. The freed objects are used to replenish the
percpu free list when it becomes empty.
The page is going to be freed when a kmalloc() finds that the per cpu
freelist is empty and that the freelist of the page is also empty. Then
interrupts are disabled, the old page is unfrozen and a new
page is acquired for allocation.
> > > Maybe I am just tired tonight, this seems very obvious, I must miss
> > > something.
> >
> > Yeah you are way off thinking about cpu to cpu concurrency issues that do
> > not apply here.
>
> I fail to understand how current cpu can assert page ownership, if IRQs
> are enabled, this seems obvious it cannot.
The cpu sets a page flag called PageFrozen() and points a per cpu pointer
to the page.
^ permalink raw reply
* [PATCH v2 1/5] ssb: Change fallback sprom to callback mechanism.
From: Hauke Mehrtens @ 2011-05-10 21:31 UTC (permalink / raw)
To: ralf-6z/3iImG2C8G8FEW9MqTrA
Cc: linux-mips-6z/3iImG2C8G8FEW9MqTrA, Hauke Mehrtens,
netdev-u79uwXL29TY76Z2rM5mHXA,
linux-wireless-u79uwXL29TY76Z2rM5mHXA, Florian Fainelli
In-Reply-To: <1305063094-26656-1-git-send-email-hauke-5/S+JYg5SzeELgA04lAiVw@public.gmane.org>
Some embedded devices like the Netgear WNDR3300 have two SSB based
cards without an own sprom on the pci bus. We have to provide two
different fallback sproms for these and this was not possible with the
old solution. In the bcm47xx architecture the sprom data is stored in
the nvram in the main flash storage. The architecture code will be able
to fill the sprom with the stored data based on the bus where the
device was found.
The bcm63xx code should do the same thing as before, just using the new
API.
Acked-by: Michael Buesch <mb-fseUSCV1ubazQB+pC5nmwQ@public.gmane.org>
CC: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
CC: linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
CC: Florian Fainelli <florian-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
Signed-off-by: Hauke Mehrtens <hauke-5/S+JYg5SzeELgA04lAiVw@public.gmane.org>
---
v2: * fix some checkpatch errors and warnings
* spelling issues
arch/mips/bcm63xx/boards/board_bcm963xx.c | 16 +++++++++-
drivers/ssb/pci.c | 16 +++++++---
drivers/ssb/sprom.c | 43 +++++++++++++++++------------
drivers/ssb/ssb_private.h | 3 +-
include/linux/ssb/ssb.h | 4 ++-
5 files changed, 55 insertions(+), 27 deletions(-)
diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c
index 8dba8cf..40b223b 100644
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -643,6 +643,17 @@ static struct ssb_sprom bcm63xx_sprom = {
.boardflags_lo = 0x2848,
.boardflags_hi = 0x0000,
};
+
+int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out)
+{
+ if (bus->bustype == SSB_BUSTYPE_PCI) {
+ memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom));
+ return 0;
+ } else {
+ printk(KERN_ERR PFX "unable to fill SPROM for given bustype.\n");
+ return -EINVAL;
+ }
+}
#endif
/*
@@ -793,8 +804,9 @@ void __init board_prom_init(void)
if (!board_get_mac_address(bcm63xx_sprom.il0mac)) {
memcpy(bcm63xx_sprom.et0mac, bcm63xx_sprom.il0mac, ETH_ALEN);
memcpy(bcm63xx_sprom.et1mac, bcm63xx_sprom.il0mac, ETH_ALEN);
- if (ssb_arch_set_fallback_sprom(&bcm63xx_sprom) < 0)
- printk(KERN_ERR "failed to register fallback SPROM\n");
+ if (ssb_arch_register_fallback_sprom(
+ &bcm63xx_get_fallback_sprom) < 0)
+ printk(KERN_ERR PFX "failed to register fallback SPROM\n");
}
#endif
}
diff --git a/drivers/ssb/pci.c b/drivers/ssb/pci.c
index 6f34963..7ad4858 100644
--- a/drivers/ssb/pci.c
+++ b/drivers/ssb/pci.c
@@ -662,7 +662,6 @@ static int sprom_extract(struct ssb_bus *bus, struct ssb_sprom *out,
static int ssb_pci_sprom_get(struct ssb_bus *bus,
struct ssb_sprom *sprom)
{
- const struct ssb_sprom *fallback;
int err;
u16 *buf;
@@ -707,10 +706,17 @@ static int ssb_pci_sprom_get(struct ssb_bus *bus,
if (err) {
/* All CRC attempts failed.
* Maybe there is no SPROM on the device?
- * If we have a fallback, use that. */
- fallback = ssb_get_fallback_sprom();
- if (fallback) {
- memcpy(sprom, fallback, sizeof(*sprom));
+ * Now we ask the arch code if there is some sprom
+ * available for this device in some other storage */
+ err = ssb_fill_sprom_with_fallback(bus, sprom);
+ if (err) {
+ ssb_printk(KERN_WARNING PFX "WARNING: Using"
+ " fallback SPROM failed (err %d)\n",
+ err);
+ } else {
+ ssb_dprintk(KERN_DEBUG PFX "Using SPROM"
+ " revision %d provided by"
+ " platform.\n", sprom->revision);
err = 0;
goto out_free;
}
diff --git a/drivers/ssb/sprom.c b/drivers/ssb/sprom.c
index 5f34d7a..45ff0e3 100644
--- a/drivers/ssb/sprom.c
+++ b/drivers/ssb/sprom.c
@@ -17,7 +17,7 @@
#include <linux/slab.h>
-static const struct ssb_sprom *fallback_sprom;
+static int(*get_fallback_sprom)(struct ssb_bus *dev, struct ssb_sprom *out);
static int sprom2hex(const u16 *sprom, char *buf, size_t buf_len,
@@ -145,36 +145,43 @@ out:
}
/**
- * ssb_arch_set_fallback_sprom - Set a fallback SPROM for use if no SPROM is found.
+ * ssb_arch_register_fallback_sprom - Registers a method providing a
+ * fallback SPROM if no SPROM is found.
*
- * @sprom: The SPROM data structure to register.
+ * @sprom_callback: The callback function.
*
- * With this function the architecture implementation may register a fallback
- * SPROM data structure. The fallback is only used for PCI based SSB devices,
- * where no valid SPROM can be found in the shadow registers.
+ * With this function the architecture implementation may register a
+ * callback handler which fills the SPROM data structure. The fallback is
+ * only used for PCI based SSB devices, where no valid SPROM can be found
+ * in the shadow registers.
*
- * This function is useful for weird architectures that have a half-assed SSB device
- * hardwired to their PCI bus.
+ * This function is useful for weird architectures that have a half-assed
+ * SSB device hardwired to their PCI bus.
*
- * Note that it does only work with PCI attached SSB devices. PCMCIA devices currently
- * don't use this fallback.
- * Architectures must provide the SPROM for native SSB devices anyway,
- * so the fallback also isn't used for native devices.
+ * Note that it does only work with PCI attached SSB devices. PCMCIA
+ * devices currently don't use this fallback.
+ * Architectures must provide the SPROM for native SSB devices anyway, so
+ * the fallback also isn't used for native devices.
*
- * This function is available for architecture code, only. So it is not exported.
+ * This function is available for architecture code, only. So it is not
+ * exported.
*/
-int ssb_arch_set_fallback_sprom(const struct ssb_sprom *sprom)
+int ssb_arch_register_fallback_sprom(int (*sprom_callback)(struct ssb_bus *bus,
+ struct ssb_sprom *out))
{
- if (fallback_sprom)
+ if (get_fallback_sprom)
return -EEXIST;
- fallback_sprom = sprom;
+ get_fallback_sprom = sprom_callback;
return 0;
}
-const struct ssb_sprom *ssb_get_fallback_sprom(void)
+int ssb_fill_sprom_with_fallback(struct ssb_bus *bus, struct ssb_sprom *out)
{
- return fallback_sprom;
+ if (!get_fallback_sprom)
+ return -ENOENT;
+
+ return get_fallback_sprom(bus, out);
}
/* http://bcm-v4.sipsolutions.net/802.11/IsSpromAvailable */
diff --git a/drivers/ssb/ssb_private.h b/drivers/ssb/ssb_private.h
index 0331139..7765301 100644
--- a/drivers/ssb/ssb_private.h
+++ b/drivers/ssb/ssb_private.h
@@ -171,7 +171,8 @@ ssize_t ssb_attr_sprom_store(struct ssb_bus *bus,
const char *buf, size_t count,
int (*sprom_check_crc)(const u16 *sprom, size_t size),
int (*sprom_write)(struct ssb_bus *bus, const u16 *sprom));
-extern const struct ssb_sprom *ssb_get_fallback_sprom(void);
+extern int ssb_fill_sprom_with_fallback(struct ssb_bus *bus,
+ struct ssb_sprom *out);
/* core.c */
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index 9659eff..045f72a 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -404,7 +404,9 @@ extern bool ssb_is_sprom_available(struct ssb_bus *bus);
/* Set a fallback SPROM.
* See kdoc at the function definition for complete documentation. */
-extern int ssb_arch_set_fallback_sprom(const struct ssb_sprom *sprom);
+extern int ssb_arch_register_fallback_sprom(
+ int (*sprom_callback)(struct ssb_bus *bus,
+ struct ssb_sprom *out));
/* Suspend a SSB bus.
* Call this from the parent bus suspend routine. */
--
1.7.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* Re: 2.6.39-rc6-mmotm0506 - another lockdep splat (networking this time)
From: Eric Dumazet @ 2011-05-10 21:48 UTC (permalink / raw)
To: David Miller; +Cc: Valdis.Kletnieks, akpm, linux-kernel, netdev
In-Reply-To: <20110509.205851.189693332.davem@davemloft.net>
Le lundi 09 mai 2011 à 20:58 -0700, David Miller a écrit :
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Tue, 10 May 2011 05:47:51 +0200
>
> > [PATCH net-next-2.6] net: fix two lockdep splats
> >
> > Commit e67f88dd12f6 (net: dont hold rtnl mutex during netlink dump
> > callbacks) switched rtnl protection to RCU, but we forgot to adjust two
> > rcu_dereference() lockdep annotations :
> >
> > inet_get_link_af_size() or inet_fill_link_af() might be called with
> > rcu_read_lock or rtnl held, so use rcu_dereference_rtnl()
> > instead of rtnl_dereference()
> >
> > Reported-by: Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
> > Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
>
> Applied, thanks everyone.
David, I found you applied this patch for net-2.6, but it was
net-next-2.6 material only ...
^ permalink raw reply
* RE: [PATCH 0/7] Network namespace manipulation with file descriptors
From: Luck, Tony @ 2011-05-10 21:56 UTC (permalink / raw)
To: David Miller, ebiederm@xmission.com
Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org, linux-fsdevel@vger.kernel.org,
hadi@cyberus.ca, daniel.lezcano@free.fr,
containers@lists.osdl.org, renatowestphal@gmail.com
In-Reply-To: <20110509.134007.116389415.davem@davemloft.net>
>> The conflicts on syscall syscall numbers are an unfortunate pain.
>
> The way we've solved this before is the tree that cares pulls in
> the net-next-2.6 tree to resolve the conflict.
Actually it seems more common that new syscalls are only added to
x86 (plus one or more other architectures that the author cares
about). Then arch maintainers throw in a "wire up new syscalls"
patch during the merge window when they see these new bits show up.
-Tony
Oh - ia64 wiring looks good.
Acked-by: Tony Luck <tony.luck@intel.com>
^ permalink raw reply
* Re: [PATCHv2 net-next-2.6 2/2] qlcnic: Take FW dump via ethtool
From: Ben Hutchings @ 2011-05-10 21:58 UTC (permalink / raw)
To: Anirban Chakraborty; +Cc: netdev, David Miller
In-Reply-To: <3D85CC75-765C-4059-BB3F-82CCBF748FBC@qlogic.com>
On Tue, 2011-05-10 at 14:00 -0700, Anirban Chakraborty wrote:
> On May 10, 2011, at 11:40 AM, Ben Hutchings wrote:
>
> > On Mon, 2011-05-09 at 18:02 -0700, Anirban Chakraborty wrote:
> >> Driver checks if the previous dump has been cleared before taking the dump.
> >> It doesn't take the dump if it is not cleared.
> >>
> >> Signed-off-by: Anirban Chakraborty <anirban.chakraborty@qlogic.com>
> >> ---
> >> drivers/net/qlcnic/qlcnic_ethtool.c | 60 +++++++++++++++++++++++++++++++++++
> >> 1 files changed, 60 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/drivers/net/qlcnic/qlcnic_ethtool.c b/drivers/net/qlcnic/qlcnic_ethtool.c
> >> index c541461..1237449 100644
> >> --- a/drivers/net/qlcnic/qlcnic_ethtool.c
> >> +++ b/drivers/net/qlcnic/qlcnic_ethtool.c
> >> @@ -965,6 +965,64 @@ static void qlcnic_set_msglevel(struct net_device *netdev, u32 msglvl)
> >> adapter->msg_enable = msglvl;
> >> }
> >>
> >> +static int
> >> +qlcnic_get_dump(struct net_device *netdev, struct ethtool_dump *dump,
> >> + void *buffer)
> >> +{
> >> + int i, copy_sz;
> >> + u32 *hdr_ptr, *data;
> >> + struct qlcnic_adapter *adapter = netdev_priv(netdev);
> >> + struct qlcnic_fw_dump *fw_dump = &adapter->ahw->fw_dump;
> >> +
> >> + if (dump->type == ETHTOOL_DUMP_FLAG) {
> >> + dump->len = fw_dump->tmpl_hdr->size + fw_dump->size;
> >> + dump->flag = fw_dump->tmpl_hdr->drv_cap_mask;
> >> + return 0;
> >> + }
> >> + if (!fw_dump->clr) {
> >> + netdev_info(netdev, "Dump not available\n");
> >> + return -EINVAL;
> >> + }
> >> + copy_sz = fw_dump->tmpl_hdr->size;
> >> + /* Copy template header first */
> >> + hdr_ptr = (u32 *) fw_dump->tmpl_hdr;
> >> + data = (u32 *) buffer;
> >> + for (i = 0; i < copy_sz/sizeof(u32); i++)
> >> + *data++ = cpu_to_le32(*hdr_ptr++);
> >> + /* Copy captured dump data */
> >> + memcpy(buffer + copy_sz, fw_dump->data, fw_dump->size);
> >> + dump->len = copy_sz + fw_dump->size;
> >> + dump->flag = fw_dump->tmpl_hdr->drv_cap_mask;
> >> + /* free dump area once the whoel dump data has been captured */
> >> + vfree(fw_dump->data);
> >> + fw_dump->size = 0;
> >> + fw_dump->data = NULL;
> >> + fw_dump->clr = 0;
> >
> > This doesn't seem to be serialised with the code that captures firmware
> > dumps. They need to use the same lock!
> When we take the dump, we bring down the interface. So, ethtool will not get a chance to
> fetch the dump data while the dump operation is in progress.
[...]
The ethtool core generally doesn't care whether the interface is
running. Its operations are serialised only by the RTNL lock. The work
item you added to extract a dump from the NIC does not take that lock.
Ben.
--
Ben Hutchings, Senior Software 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: 2.6.39-rc6-mmotm0506 - another lockdep splat (networking this time)
From: David Miller @ 2011-05-10 21:59 UTC (permalink / raw)
To: eric.dumazet; +Cc: Valdis.Kletnieks, akpm, linux-kernel, netdev
In-Reply-To: <1305064116.2437.34.camel@edumazet-laptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 10 May 2011 23:48:36 +0200
> Le lundi 09 mai 2011 à 20:58 -0700, David Miller a écrit :
>> From: Eric Dumazet <eric.dumazet@gmail.com>
>> Date: Tue, 10 May 2011 05:47:51 +0200
>>
>> > [PATCH net-next-2.6] net: fix two lockdep splats
>> >
>> > Commit e67f88dd12f6 (net: dont hold rtnl mutex during netlink dump
>> > callbacks) switched rtnl protection to RCU, but we forgot to adjust two
>> > rcu_dereference() lockdep annotations :
>> >
>> > inet_get_link_af_size() or inet_fill_link_af() might be called with
>> > rcu_read_lock or rtnl held, so use rcu_dereference_rtnl()
>> > instead of rtnl_dereference()
>> >
>> > Reported-by: Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
>> > Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
>>
>> Applied, thanks everyone.
>
> David, I found you applied this patch for net-2.6, but it was
> net-next-2.6 material only ...
Thanks for catching that, I'll fix this.
^ permalink raw reply
* GIT net-2.6 rolled back 8 commits...
From: David Miller @ 2011-05-10 22:08 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA
Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA,
netfilter-devel-u79uwXL29TY76Z2rM5mHXA
I made a mistake and applied to net-2.6 a patch from Eric Dumazet that
only is applicable for net-next-2.6
I really don't want to have to toss Linus that commit and a revert commit
just to fix it up.
So I rewound the net-2.6 tree by 8 commits.
So if you've pulled in the past 3 hours, please reset your pull and repull.
Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [Bridge] Bug#625914: linux-image-2.6.38-2-amd64: bridging is not interacting well with multicast in 2.6.38-4
From: Stephen Hemminger @ 2011-05-10 22:11 UTC (permalink / raw)
To: Noah Meyerhans; +Cc: Ben Hutchings, 625914, bridge, netdev
In-Reply-To: <20110510180540.GI6397@morgul.net>
On Tue, 10 May 2011 11:05:40 -0700
Noah Meyerhans <noahm@debian.org> wrote:
> On Tue, May 10, 2011 at 01:42:49PM +0100, Ben Hutchings wrote:
> > > > This is pretty weird. Debian version 2.6.38-3 has a few bridging
> > > > changes from stable 2.6.38.3 and 2.6.38.4, but they don't look like they
> > > > would cause this.
> > >
> > > I have apparently filed the bug against the wrong version of Debian's
> > > kernel. 2.6.38-3 is not affected, and works as expected. The change
> > > was introduced in -4. That may have been clear from the report itself,
> > > but the report was filed against -3. I've fixed that in the BTS.
> >
> > I gathered that, and then made the same mistake in writing the above!
> > The version with the regression, 2.6.38-4, includes the changes from
> > stable 2.6.38.3 and 2.6.38.4
>
> With a little help from git bisect, I've tracked this regression down to
> the following commit to the stable-2.6.38.y tree:
>
> commit 5f1c356a3fadc0c19922d660da723b79bcc9aad7
> Author: Herbert Xu <herbert@gondor.apana.org.au>
> Date: Fri Mar 18 05:27:28 2011 +0000
>
> bridge: Reset IPCB when entering IP stack on NF_FORWARD
>
> [ Upstream commit 6b1e960fdbd75dcd9bcc3ba5ff8898ff1ad30b6e ]
>
> Whenever we enter the IP stack proper from bridge netfilter we
> need to ensure that the skb is in a form the IP stack expects
> it to be in.
>
> The entry point on NF_FORWARD did not meet the requirements of
> the IP stack, therefore leading to potential crashes/panics.
>
> This patch fixes the problem.
>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
> Acked-by: Stephen Hemminger <shemminger@vyatta.com>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
>
> The diff is
> diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
> index 4b5b66d..49d50ea 100644
> --- a/net/bridge/br_netfilter.c
> +++ b/net/bridge/br_netfilter.c
> @@ -741,6 +741,9 @@ static unsigned int br_nf_forward_ip(unsigned int
> hook, struct sk_buff *skb,
> nf_bridge->mask |= BRNF_PKT_TYPE;
> }
>
> + if (br_parse_ip_options(skb))
> + return NF_DROP;
> +
> /* The physdev module checks on this */
> nf_bridge->mask |= BRNF_BRIDGED;
> nf_bridge->physoutdev = skb->dev;
>
> If I revert this change, network connectivity functions as expected for
> the VMs on this host.
>
> I don't know enough about this change or the problem it was supposed to
> solve to be able to guess about what's going wrong.
>
> noah
>
There were two more follow on commits in stable related to this.
I recommend merging 2.6.38.6 which includes these.
--
^ permalink raw reply
* Re: [PATCH 2/2] net/dl2k: Don't reconfigure link @100Mbps when disabling autoneg @1Gbps
From: David Decotigny @ 2011-05-10 22:14 UTC (permalink / raw)
To: Ben Hutchings
Cc: Giuseppe Cavallaro, David S. Miller, Joe Perches,
Stanislaw Gruszka, netdev, linux-kernel
In-Reply-To: <1305053707.2859.57.camel@bwh-desktop>
Hi all,
Yes, right, I will send the updated patch together with the stmmac
update (if any).
I just hope that changing the netdev_private fields without committing
to hardware and before calling netif_carrier_off() will not create too
much confusion. I don't think so, but I still wish I could test.
Regards,
--
David Decotigny
On Tue, May 10, 2011 at 11:55 AM, Ben Hutchings
<bhutchings@solarflare.com> wrote:
> On Mon, 2011-05-09 at 17:19 -0700, David Decotigny wrote:
>> The initial version of the driver used to force the link to 100Mbps
>> when auto-negociation was disabled on a 1Gbps link, ignoring the
>> requested link speed. Instead, this change refuses to change anything
>> when it is asked to configure the link speed at 1Gbps without
>> auto-negociation, but acts as requested in all the other cases.
>>
>> IMPORTANT: Previously, the return value from mii_set_media() was
>> ignored. This patch uses it for its own return value.
>>
>> Tested: module compiling, NOT tested on real hardware.
>> Signed-off-by: David Decotigny <decot@google.com>
> [...]
>
> The changes to validation look fine. However, I noticed that there's a
> call to netif_carrier_off() at the top of this function. This means
> that in the error and shortcut cases, the interface will be left
> disabled! It's an existing bug but might be made slightly worse by this
> change.
>
> Please also move the call to netif_carrier_off() down to the end, just
> before the call to mii_set_media() which actually alters the link.
>
> Ben.
>
> --
> Ben Hutchings, Senior Software 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: [PATCHv2 net-next-2.6 2/2] qlcnic: Take FW dump via ethtool
From: Anirban Chakraborty @ 2011-05-10 22:19 UTC (permalink / raw)
To: Ben Hutchings; +Cc: netdev, David Miller
In-Reply-To: <1305064696.2859.90.camel@bwh-desktop>
On May 10, 2011, at 2:58 PM, Ben Hutchings wrote:
>>>> <snip>
>>>
>>> This doesn't seem to be serialised with the code that captures firmware
>>> dumps. They need to use the same lock!
>> When we take the dump, we bring down the interface. So, ethtool will not get a chance to
>> fetch the dump data while the dump operation is in progress.
> [...]
>
> The ethtool core generally doesn't care whether the interface is
> running. Its operations are serialised only by the RTNL lock. The work
> item you added to extract a dump from the NIC does not take that lock.
Oh, ok. Thanks for pointing that out.
-Anirban
^ permalink raw reply
* Re: [PATCH 4/10] ipvs: Use IP_VS_RT_MODE_* instead of magic constants.
From: Julian Anastasov @ 2011-05-10 22:26 UTC (permalink / raw)
To: David Miller; +Cc: netdev
In-Reply-To: <20110509.223118.260083861.davem@davemloft.net>
Fix more IP_VS_RT_MODE_* constants
Signed-off-by: Julian Anastasov <ja@ssi.bg>
---
Following patch can be used after patch 4, eg. as
number 6 because patches 4 and 5 are ok and we are going to replace
patches 6 and 7.
diff -urp net-next-2.6-7ef73bc/linux/net/netfilter/ipvs/ip_vs_xmit.c linux/net/netfilter/ipvs/ip_vs_xmit.c
--- net-next-2.6-7ef73bc/linux/net/netfilter/ipvs/ip_vs_xmit.c 2011-05-10 23:51:34.831272176 +0300
+++ linux/net/netfilter/ipvs/ip_vs_xmit.c 2011-05-10 23:51:28.900271527 +0300
@@ -230,8 +230,6 @@ out_err:
/*
* Get route to destination or remote server
- * rt_mode: flags, &1=Allow local dest, &2=Allow non-local dest,
- * &4=Allow redirect from remote daddr to local
*/
static struct rt6_info *
__ip_vs_get_out_rt_v6(struct sk_buff *skb, struct ip_vs_dest *dest,
@@ -275,13 +273,14 @@ __ip_vs_get_out_rt_v6(struct sk_buff *sk
}
local = __ip_vs_is_local_route6(rt);
- if (!((local ? 1 : 2) & rt_mode)) {
+ if (!((local ? IP_VS_RT_MODE_LOCAL : IP_VS_RT_MODE_NON_LOCAL) &
+ rt_mode)) {
IP_VS_DBG_RL("Stopping traffic to %s address, dest: %pI6\n",
local ? "local":"non-local", daddr);
dst_release(&rt->dst);
return NULL;
}
- if (local && !(rt_mode & 4) &&
+ if (local && !(rt_mode & IP_VS_RT_MODE_RDR) &&
!((ort = (struct rt6_info *) skb_dst(skb)) &&
__ip_vs_is_local_route6(ort))) {
IP_VS_DBG_RL("Redirect from non-local address %pI6 to local "
^ permalink raw reply
* Re: [PATCH 4/10] ipvs: Use IP_VS_RT_MODE_* instead of magic constants.
From: David Miller @ 2011-05-10 22:30 UTC (permalink / raw)
To: ja; +Cc: netdev
In-Reply-To: <alpine.LFD.2.00.1105110123001.4532@ja.ssi.bg>
From: Julian Anastasov <ja@ssi.bg>
Date: Wed, 11 May 2011 01:26:09 +0300 (EEST)
>
> Fix more IP_VS_RT_MODE_* constants
>
> Signed-off-by: Julian Anastasov <ja@ssi.bg>
> ---
>
> Following patch can be used after patch 4, eg. as
> number 6 because patches 4 and 5 are ok and we are going to replace
> patches 6 and 7.
Thanks Julian.
What I'm going to do is hold back the IPVS parts of the patches I
posted last night. In particular, I'll integrate this into the
original patch #4.
And then we can work through the reimplementation ideas you posted to
me in private email.
If you could post those ideas here on the list I'd appreciate it,
so others can follow along and provide feedback.
Thanks!
^ permalink raw reply
* Re: [PATCH 7/10] ipvs: Remove all remaining references to rt->rt_{src,dst}
From: Julian Anastasov @ 2011-05-10 22:46 UTC (permalink / raw)
To: David Miller; +Cc: netdev
In-Reply-To: <20110509.223127.102546540.davem@davemloft.net>
Remove all remaining references to rt->rt_{src,dst}
by using dest->dst_saddr to cache saddr (used for TUN mode).
For ICMP in FORWARD hook just restrict the rt_mode for NAT
to disable LOCALNODE. All other modes do not allow
IP_VS_RT_MODE_RDR, so we should be safe with the ICMP
forwarding. Using cp->daddr as replacement for rt_dst
is safe for all modes except BYPASS, even when cp->dest is
NULL because it is cp->daddr that is used to assign cp->dest
for sync-ed connections.
Signed-off-by: Julian Anastasov <ja@ssi.bg>
---
I'm proposing this patch as replacement for
original patches 6 and 7, it can be number 7 again.
The idea is to avoid storing flowi in cp.
diff -urp net-next-2.6-7ef73bc/linux/include/net/ip_vs.h linux/include/net/ip_vs.h
--- net-next-2.6-7ef73bc/linux/include/net/ip_vs.h 2011-05-09 07:24:07.000000000 +0300
+++ linux/include/net/ip_vs.h 2011-05-11 00:46:02.510271856 +0300
@@ -665,9 +665,7 @@ struct ip_vs_dest {
struct dst_entry *dst_cache; /* destination cache entry */
u32 dst_rtos; /* RT_TOS(tos) for dst */
u32 dst_cookie;
-#ifdef CONFIG_IP_VS_IPV6
- struct in6_addr dst_saddr;
-#endif
+ union nf_inet_addr dst_saddr;
/* for virtual service */
struct ip_vs_service *svc; /* service it belongs to */
@@ -1236,7 +1234,8 @@ extern int ip_vs_tunnel_xmit
extern int ip_vs_dr_xmit
(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp);
extern int ip_vs_icmp_xmit
-(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp, int offset);
+(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp,
+ int offset, unsigned int hooknum);
extern void ip_vs_dst_reset(struct ip_vs_dest *dest);
#ifdef CONFIG_IP_VS_IPV6
@@ -1250,7 +1249,7 @@ extern int ip_vs_dr_xmit_v6
(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp);
extern int ip_vs_icmp_xmit_v6
(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp,
- int offset);
+ int offset, unsigned int hooknum);
#endif
#ifdef CONFIG_SYSCTL
diff -urp net-next-2.6-7ef73bc/linux/net/netfilter/ipvs/ip_vs_core.c linux/net/netfilter/ipvs/ip_vs_core.c
--- net-next-2.6-7ef73bc/linux/net/netfilter/ipvs/ip_vs_core.c 2011-05-09 07:24:07.000000000 +0300
+++ linux/net/netfilter/ipvs/ip_vs_core.c 2011-05-11 01:07:29.429270382 +0300
@@ -1378,15 +1378,7 @@ ip_vs_in_icmp(struct sk_buff *skb, int *
ip_vs_in_stats(cp, skb);
if (IPPROTO_TCP == cih->protocol || IPPROTO_UDP == cih->protocol)
offset += 2 * sizeof(__u16);
- verdict = ip_vs_icmp_xmit(skb, cp, pp, offset);
- /* LOCALNODE from FORWARD hook is not supported */
- if (verdict == NF_ACCEPT && hooknum == NF_INET_FORWARD &&
- skb_rtable(skb)->rt_flags & RTCF_LOCAL) {
- IP_VS_DBG(1, "%s(): "
- "local delivery to %pI4 but in FORWARD\n",
- __func__, &skb_rtable(skb)->rt_dst);
- verdict = NF_DROP;
- }
+ verdict = ip_vs_icmp_xmit(skb, cp, pp, offset, hooknum);
out:
__ip_vs_conn_put(cp);
@@ -1408,7 +1400,6 @@ ip_vs_in_icmp_v6(struct sk_buff *skb, in
struct ip_vs_protocol *pp;
struct ip_vs_proto_data *pd;
unsigned int offset, verdict;
- struct rt6_info *rt;
*related = 1;
@@ -1470,23 +1461,12 @@ ip_vs_in_icmp_v6(struct sk_buff *skb, in
if (!cp)
return NF_ACCEPT;
- verdict = NF_DROP;
-
/* do the statistics and put it back */
ip_vs_in_stats(cp, skb);
if (IPPROTO_TCP == cih->nexthdr || IPPROTO_UDP == cih->nexthdr ||
IPPROTO_SCTP == cih->nexthdr)
offset += 2 * sizeof(__u16);
- verdict = ip_vs_icmp_xmit_v6(skb, cp, pp, offset);
- /* LOCALNODE from FORWARD hook is not supported */
- if (verdict == NF_ACCEPT && hooknum == NF_INET_FORWARD &&
- (rt = (struct rt6_info *) skb_dst(skb)) &&
- rt->rt6i_dev && rt->rt6i_dev->flags & IFF_LOOPBACK) {
- IP_VS_DBG(1, "%s(): "
- "local delivery to %pI6 but in FORWARD\n",
- __func__, &rt->rt6i_dst);
- verdict = NF_DROP;
- }
+ verdict = ip_vs_icmp_xmit_v6(skb, cp, pp, offset, hooknum);
__ip_vs_conn_put(cp);
diff -urp net-next-2.6-7ef73bc/linux/net/netfilter/ipvs/ip_vs_xmit.c linux/net/netfilter/ipvs/ip_vs_xmit.c
--- net-next-2.6-7ef73bc/linux/net/netfilter/ipvs/ip_vs_xmit.c 2011-05-10 23:52:06.000000000 +0300
+++ linux/net/netfilter/ipvs/ip_vs_xmit.c 2011-05-11 01:08:21.837272458 +0300
@@ -87,7 +87,7 @@ __ip_vs_dst_check(struct ip_vs_dest *des
/* Get route to destination or remote server */
static struct rtable *
__ip_vs_get_out_rt(struct sk_buff *skb, struct ip_vs_dest *dest,
- __be32 daddr, u32 rtos, int rt_mode)
+ __be32 daddr, u32 rtos, int rt_mode, __be32 *ret_saddr)
{
struct net *net = dev_net(skb_dst(skb)->dev);
struct rtable *rt; /* Route to the other host */
@@ -98,7 +98,12 @@ __ip_vs_get_out_rt(struct sk_buff *skb,
spin_lock(&dest->dst_lock);
if (!(rt = (struct rtable *)
__ip_vs_dst_check(dest, rtos))) {
- rt = ip_route_output(net, dest->addr.ip, 0, rtos, 0);
+ struct flowi4 fl4;
+
+ memset(&fl4, 0, sizeof(fl4));
+ fl4.daddr = dest->addr.ip;
+ fl4.flowi4_tos = rtos;
+ rt = ip_route_output_key(net, &fl4);
if (IS_ERR(rt)) {
spin_unlock(&dest->dst_lock);
IP_VS_DBG_RL("ip_route_output error, dest: %pI4\n",
@@ -106,19 +111,30 @@ __ip_vs_get_out_rt(struct sk_buff *skb,
return NULL;
}
__ip_vs_dst_set(dest, rtos, dst_clone(&rt->dst), 0);
- IP_VS_DBG(10, "new dst %pI4, refcnt=%d, rtos=%X\n",
- &dest->addr.ip,
+ dest->dst_saddr.ip = fl4.saddr;
+ IP_VS_DBG(10, "new dst %pI4, src %pI4, refcnt=%d, "
+ "rtos=%X\n",
+ &dest->addr.ip, &dest->dst_saddr.ip,
atomic_read(&rt->dst.__refcnt), rtos);
}
daddr = dest->addr.ip;
+ if (ret_saddr)
+ *ret_saddr = dest->dst_saddr.ip;
spin_unlock(&dest->dst_lock);
} else {
- rt = ip_route_output(net, daddr, 0, rtos, 0);
+ struct flowi4 fl4;
+
+ memset(&fl4, 0, sizeof(fl4));
+ fl4.daddr = daddr;
+ fl4.flowi4_tos = rtos;
+ rt = ip_route_output_key(net, &fl4);
if (IS_ERR(rt)) {
IP_VS_DBG_RL("ip_route_output error, dest: %pI4\n",
&daddr);
return NULL;
}
+ if (ret_saddr)
+ *ret_saddr = fl4.saddr;
}
local = rt->rt_flags & RTCF_LOCAL;
@@ -249,7 +265,7 @@ __ip_vs_get_out_rt_v6(struct sk_buff *sk
u32 cookie;
dst = __ip_vs_route_output_v6(net, &dest->addr.in6,
- &dest->dst_saddr,
+ &dest->dst_saddr.in6,
do_xfrm);
if (!dst) {
spin_unlock(&dest->dst_lock);
@@ -259,11 +275,11 @@ __ip_vs_get_out_rt_v6(struct sk_buff *sk
cookie = rt->rt6i_node ? rt->rt6i_node->fn_sernum : 0;
__ip_vs_dst_set(dest, 0, dst_clone(&rt->dst), cookie);
IP_VS_DBG(10, "new dst %pI6, src %pI6, refcnt=%d\n",
- &dest->addr.in6, &dest->dst_saddr,
+ &dest->addr.in6, &dest->dst_saddr.in6,
atomic_read(&rt->dst.__refcnt));
}
if (ret_saddr)
- ipv6_addr_copy(ret_saddr, &dest->dst_saddr);
+ ipv6_addr_copy(ret_saddr, &dest->dst_saddr.in6);
spin_unlock(&dest->dst_lock);
} else {
dst = __ip_vs_route_output_v6(net, daddr, ret_saddr, do_xfrm);
@@ -386,7 +402,7 @@ ip_vs_bypass_xmit(struct sk_buff *skb, s
EnterFunction(10);
if (!(rt = __ip_vs_get_out_rt(skb, NULL, iph->daddr, RT_TOS(iph->tos),
- IP_VS_RT_MODE_NON_LOCAL)))
+ IP_VS_RT_MODE_NON_LOCAL, NULL)))
goto tx_error_icmp;
/* MTU checking */
@@ -518,7 +534,7 @@ ip_vs_nat_xmit(struct sk_buff *skb, stru
RT_TOS(iph->tos),
IP_VS_RT_MODE_LOCAL |
IP_VS_RT_MODE_NON_LOCAL |
- IP_VS_RT_MODE_RDR)))
+ IP_VS_RT_MODE_RDR, NULL)))
goto tx_error_icmp;
local = rt->rt_flags & RTCF_LOCAL;
/*
@@ -540,7 +556,7 @@ ip_vs_nat_xmit(struct sk_buff *skb, stru
#endif
/* From world but DNAT to loopback address? */
- if (local && ipv4_is_loopback(rt->rt_dst) &&
+ if (local && ipv4_is_loopback(cp->daddr.ip) &&
rt_is_input_route(skb_rtable(skb))) {
IP_VS_DBG_RL_PKT(1, AF_INET, pp, skb, 0, "ip_vs_nat_xmit(): "
"stopping DNAT to loopback address");
@@ -751,6 +767,7 @@ ip_vs_tunnel_xmit(struct sk_buff *skb, s
struct ip_vs_protocol *pp)
{
struct rtable *rt; /* Route to the other host */
+ __be32 saddr; /* Source for tunnel */
struct net_device *tdev; /* Device to other host */
struct iphdr *old_iph = ip_hdr(skb);
u8 tos = old_iph->tos;
@@ -764,7 +781,8 @@ ip_vs_tunnel_xmit(struct sk_buff *skb, s
if (!(rt = __ip_vs_get_out_rt(skb, cp->dest, cp->daddr.ip,
RT_TOS(tos), IP_VS_RT_MODE_LOCAL |
- IP_VS_RT_MODE_NON_LOCAL)))
+ IP_VS_RT_MODE_NON_LOCAL,
+ &saddr)))
goto tx_error_icmp;
if (rt->rt_flags & RTCF_LOCAL) {
ip_rt_put(rt);
@@ -832,8 +850,8 @@ ip_vs_tunnel_xmit(struct sk_buff *skb, s
iph->frag_off = df;
iph->protocol = IPPROTO_IPIP;
iph->tos = tos;
- iph->daddr = rt->rt_dst;
- iph->saddr = rt->rt_src;
+ iph->daddr = cp->daddr.ip;
+ iph->saddr = saddr;
iph->ttl = old_iph->ttl;
ip_select_ident(iph, &rt->dst, NULL);
@@ -996,7 +1014,7 @@ ip_vs_dr_xmit(struct sk_buff *skb, struc
if (!(rt = __ip_vs_get_out_rt(skb, cp->dest, cp->daddr.ip,
RT_TOS(iph->tos),
IP_VS_RT_MODE_LOCAL |
- IP_VS_RT_MODE_NON_LOCAL)))
+ IP_VS_RT_MODE_NON_LOCAL, NULL)))
goto tx_error_icmp;
if (rt->rt_flags & RTCF_LOCAL) {
ip_rt_put(rt);
@@ -1114,12 +1132,13 @@ tx_error:
*/
int
ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
- struct ip_vs_protocol *pp, int offset)
+ struct ip_vs_protocol *pp, int offset, unsigned int hooknum)
{
struct rtable *rt; /* Route to the other host */
int mtu;
int rc;
int local;
+ int rt_mode;
EnterFunction(10);
@@ -1140,11 +1159,13 @@ ip_vs_icmp_xmit(struct sk_buff *skb, str
* mangle and send the packet here (only for VS/NAT)
*/
+ /* LOCALNODE from FORWARD hook is not supported */
+ rt_mode = (hooknum != NF_INET_FORWARD) ?
+ IP_VS_RT_MODE_LOCAL | IP_VS_RT_MODE_NON_LOCAL |
+ IP_VS_RT_MODE_RDR : IP_VS_RT_MODE_NON_LOCAL;
if (!(rt = __ip_vs_get_out_rt(skb, cp->dest, cp->daddr.ip,
RT_TOS(ip_hdr(skb)->tos),
- IP_VS_RT_MODE_LOCAL |
- IP_VS_RT_MODE_NON_LOCAL |
- IP_VS_RT_MODE_RDR)))
+ rt_mode, NULL)))
goto tx_error_icmp;
local = rt->rt_flags & RTCF_LOCAL;
@@ -1167,7 +1188,7 @@ ip_vs_icmp_xmit(struct sk_buff *skb, str
#endif
/* From world but DNAT to loopback address? */
- if (local && ipv4_is_loopback(rt->rt_dst) &&
+ if (local && ipv4_is_loopback(cp->daddr.ip) &&
rt_is_input_route(skb_rtable(skb))) {
IP_VS_DBG(1, "%s(): "
"stopping DNAT to loopback %pI4\n",
@@ -1232,12 +1253,13 @@ ip_vs_icmp_xmit(struct sk_buff *skb, str
#ifdef CONFIG_IP_VS_IPV6
int
ip_vs_icmp_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
- struct ip_vs_protocol *pp, int offset)
+ struct ip_vs_protocol *pp, int offset, unsigned int hooknum)
{
struct rt6_info *rt; /* Route to the other host */
int mtu;
int rc;
int local;
+ int rt_mode;
EnterFunction(10);
@@ -1258,10 +1280,12 @@ ip_vs_icmp_xmit_v6(struct sk_buff *skb,
* mangle and send the packet here (only for VS/NAT)
*/
+ /* LOCALNODE from FORWARD hook is not supported */
+ rt_mode = (hooknum != NF_INET_FORWARD) ?
+ IP_VS_RT_MODE_LOCAL | IP_VS_RT_MODE_NON_LOCAL |
+ IP_VS_RT_MODE_RDR : IP_VS_RT_MODE_NON_LOCAL;
if (!(rt = __ip_vs_get_out_rt_v6(skb, cp->dest, &cp->daddr.in6, NULL,
- 0, (IP_VS_RT_MODE_LOCAL |
- IP_VS_RT_MODE_NON_LOCAL |
- IP_VS_RT_MODE_RDR))))
+ 0, rt_mode)))
goto tx_error_icmp;
local = __ip_vs_is_local_route6(rt);
^ permalink raw reply
* [GIT] Networking
From: David Miller @ 2011-05-10 22:46 UTC (permalink / raw)
To: torvalds; +Cc: akpm, netdev, linux-kernel
There's several OOPS'ers and reverts in here.
I think we now have all of the worst ones fixed from the regression
list, and I would recommend doing just one more -rc to get this all
sorted out and tested properly. But of course that is completely up
to you.
1) ipheth regressed because it had a hard dependency upon NET_IP_ALIGN
being defined always as 2, get rid of that assumption. From Ben
Hutchings.
2) IPV6 REJECT module puts random values in TOS field, fix from
Fernando Luis Vazquez Cao.
3) When an ipv4 fragmentation entry expires via a timer, we have to
revalidate the route otherwise we can crash. Fix from Eric
Dumazet.
4) In usbnet, usbnet_bh can be scheduled too early during resume
resulting in flood of RX frames but no reclaim, and this leads to
running out of atomic memory. Don't allow usbnet_bh to schedule
until the device is brought completely up. Fix from Ming Lei.
5) TCP cubic can divide by zero in some extreme cases, fix from
Stephen Hemminger.
6) SLIP and SLCAN devices return incorrect values from their ldisc
open method, from Matvejchikov Ilya and Oliver Hartkopp.
7) VLAN GVRP state is undone at the wrong moment, causing crashes during
batched device delete. From Eric Dumazet.
8) dev_close() mistakenly had it's IFF_UP check removed, this has to be
put back otherwise we can crash during batched device teardown, in
particular with bonding. Fix from Eric DUmazet.
9) PCH_GBE "checksum correct" logic on RX is reversed (hardware sets
the status bit on checksum failure, clears it on success), from
Toshiharu Okada.
10) vmxnet3 does not take ->cmd_lock consistently with interrupts disabled,
as is warned by lockdep. Fix from Roland Dreier.
11) DCCP feature options length needs to be validated properly,
otherwise we can end up working with negative lengths, fix from
Dan Rosenberg.
13) Fix regressions in ebtables compat support, from Eric Dumazet and
Florian Westphal.
14) IPVS namespace support can leave objects referenced indefinitely until
reboot. Fixes from Hans Schillstrom.
15) DSCP netfilter code forgets to invert mask, from Fernando Luis
Vazquez Cao.
16) Revert a buggy xt_conntrack change that broke handling of locally
generated packets. From Florian Westphal and Jan Engelhardt.
17) Inter-family packet output was busted in IPSEC, we need to split
the operation into two parts, ->output() and ->output_finish(), to
make sure we work in the context of the correct protocol (ipv4 vs
ipv6) at each step. Fix from Steffen Klassert.
18) We cannot allow ESN handling when anti-reply detection is disabled,
also from Steffen Klassert.
Please pull, thanks a lot!
The following changes since commit 54b333529df25b21da462c7dcc16c7dc779d9f26:
Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/upstream-linus (2011-05-10 12:00:53 -0700)
are available in the git repository at:
master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6.git master
Ben Hutchings (1):
ipheth: Properly distinguish length and alignment in URBs and skbs
Dan Rosenberg (1):
dccp: handle invalid feature options length
Dan Williams (1):
net/usb: mark LG VL600 LTE modem ethernet interface as WWAN
David S. Miller (1):
Merge branch 'pablo/nf-2.6-updates' of git://1984.lsi.us.es/net-2.6
Eric Dumazet (4):
net: ip_expire() must revalidate route
netfilter: fix ebtables compat support
vlan: fix GVRP at dismantle time
net: dev_close() should check IFF_UP
Fernando Luis Vazquez Cao (2):
netfilter: IPv6: initialize TOS field in REJECT target module
netfilter: IPv6: fix DSCP mangle code
Florian Westphal (1):
netfilter: ebtables: only call xt_compat_add_offset once per rule
Hans Schillstrom (2):
IPVS: Change of socket usage to enable name space exit.
IPVS: init and cleanup restructuring
Kleber Sacilotto de Souza (1):
ehea: fix wrongly reported speed and port
Kurt Van Dijck (1):
can: fix SJA1000 dlc for RTR packets
Matvejchikov Ilya (1):
NET: slip, fix ldisc->open retval
Ming Lei (1):
usbnet: runtime pm: fix out of memory
Oliver Hartkopp (1):
slcan: fix ldisc->open retval
Pablo Neira Ayuso (2):
netfilter: ctnetlink: fix timestamp support for new conntracks
netfilter: revert a2361c8735e07322023aedc36e4938b35af31eb0
Roland Dreier (1):
vmxnet3: Consistently disable irqs when taking adapter->cmd_lock
Somnath Kotur (1):
be2net: Fixed bugs related to PVID.
Steffen Klassert (2):
xfrm: Assign the inner mode output function to the dst entry
xfrm: Don't allow esn with disabled anti replay detection
Tomoya (1):
pch_gbe: support ML7223 IOH
Toshiharu Okada (2):
PCH_GbE : Fixed the issue of collision detection
PCH_GbE : Fixed the issue of checksum judgment
stephen hemminger (1):
tcp_cubic: limit delayed_ack ratio to prevent divide error
drivers/net/Kconfig | 8 ++-
drivers/net/benet/be.h | 2 +-
drivers/net/benet/be_cmds.c | 2 +-
drivers/net/benet/be_main.c | 18 ++++--
drivers/net/can/sja1000/sja1000.c | 2 +-
drivers/net/can/slcan.c | 4 +-
drivers/net/ehea/ehea_ethtool.c | 21 ++++--
drivers/net/pch_gbe/pch_gbe_main.c | 23 +++++--
drivers/net/slip.c | 4 +-
drivers/net/usb/cdc_ether.c | 2 +-
drivers/net/usb/ipheth.c | 14 +++--
drivers/net/usb/usbnet.c | 10 ++-
drivers/net/vmxnet3/vmxnet3_drv.c | 10 ++-
include/net/ip_vs.h | 17 +++++
include/net/xfrm.h | 3 +
net/8021q/vlan.c | 3 +
net/8021q/vlan_dev.c | 3 -
net/bridge/netfilter/ebtables.c | 64 +++---------------
net/core/dev.c | 10 ++-
net/dccp/options.c | 2 +
net/ipv4/ip_fragment.c | 33 +++++-----
net/ipv4/tcp_cubic.c | 9 ++-
net/ipv4/xfrm4_output.c | 8 ++-
net/ipv4/xfrm4_state.c | 1 +
net/ipv6/netfilter/ip6t_REJECT.c | 4 +-
net/ipv6/xfrm6_output.c | 6 +-
net/ipv6/xfrm6_state.c | 1 +
net/netfilter/ipvs/ip_vs_app.c | 15 +----
net/netfilter/ipvs/ip_vs_conn.c | 12 +---
net/netfilter/ipvs/ip_vs_core.c | 103 ++++++++++++++++++++++++++---
net/netfilter/ipvs/ip_vs_ctl.c | 120 ++++++++++++++++++++++++++++-----
net/netfilter/ipvs/ip_vs_est.c | 14 +---
net/netfilter/ipvs/ip_vs_proto.c | 11 +---
net/netfilter/ipvs/ip_vs_sync.c | 65 ++++++++++--------
net/netfilter/nf_conntrack_netlink.c | 4 +
net/netfilter/x_tables.c | 4 +-
net/netfilter/xt_DSCP.c | 2 +-
net/netfilter/xt_conntrack.c | 5 --
net/xfrm/xfrm_policy.c | 14 ++++-
net/xfrm/xfrm_replay.c | 3 +
40 files changed, 423 insertions(+), 233 deletions(-)
^ permalink raw reply
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