netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/13 net-next-2.6] [TIPC]: More minor fixes and enhancements
@ 2008-05-30 18:20 Allan Stephens
  2008-05-30 18:20 ` [PATCH 01/13 net-next-2.6] [TIPC]: Fix bug in connection setup via native API Allan Stephens
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: Allan Stephens @ 2008-05-30 18:20 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, allan.stephens


This patch set is another collection of small changes to TIPC that fix obscure
problems, plus some minor enhancements.  Please see each individual patch for
a more detailed description of each change.

Summary:

 net/tipc/bcast.c      |    4 ++-
 net/tipc/cluster.c    |    2 +-
 net/tipc/discover.c   |    9 +++----
 net/tipc/discover.h   |    2 +-
 net/tipc/link.c       |   60 +++++++++++++++++++++----------------------------
 net/tipc/msg.c        |    3 --
 net/tipc/msg.h        |   42 ++++++++++++++++++++++++++++------
 net/tipc/name_distr.c |    3 +-
 net/tipc/name_table.c |    7 +++++-
 net/tipc/port.c       |   58 +++++++++++++++++++----------------------------
 10 files changed, 98 insertions(+), 92 deletions(-)

Allan Stephens (13):
      [TIPC]: Fix bug in connection setup via native API
      [TIPC]: Standardize error checking on incoming messages via native API
      [TIPC]: Fix bugs in message error code display when debugging
      [TIPC]: Fix minor bugs in link session number handling
      [TIPC]: Minor optimizations to received message processing
      [TIPC]: Prevent access of non-existent field in short message header
      [TIPC]: Optimize message initialization routine
      [TIPC]: Prevent display of name table types with no publications
      [TIPC]: Add missing spinlock in name table display code
      [TIPC]: Expand link sequence gap field to 13 bits
      [TIPC]: Message header creation optimizations
      [TIPC]: Fix bugs in rejection of message with short header
      [TIPC]: Message rejection rework preparatory changes

Thanks,
Al

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 01/13 net-next-2.6] [TIPC]: Fix bug in connection setup via native API
  2008-05-30 18:20 [PATCH 00/13 net-next-2.6] [TIPC]: More minor fixes and enhancements Allan Stephens
@ 2008-05-30 18:20 ` Allan Stephens
  2008-05-30 18:20 ` [PATCH 02/13 net-next-2.6] [TIPC]: Standardize error checking on incoming messages " Allan Stephens
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Allan Stephens @ 2008-05-30 18:20 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, allan.stephens

This patch fixes a bug that prevented TIPC from receiving a
connection setup request message on a native TIPC port.
The revised connection setup logic ensures that validation
of the source of a connection-based message is skipped if
the port is not yet connected to a peer.

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
---
 net/tipc/port.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/net/tipc/port.c b/net/tipc/port.c
index 2c64ad8..0bd3e61 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -842,13 +842,10 @@ static void port_dispatcher_sigh(void *dummy)
 
 				tipc_port_unlock(p_ptr);
 				if (unlikely(!connected)) {
-					if (unlikely(published))
+					if (tipc_connect2port(dref, &orig))
 						goto reject;
-					tipc_connect2port(dref,&orig);
-				}
-				if (unlikely(msg_origport(msg) != peer_port))
-					goto reject;
-				if (unlikely(msg_orignode(msg) != peer_node))
+				} else if ((msg_origport(msg) != peer_port) ||
+					   (msg_orignode(msg) != peer_node))
 					goto reject;
 				if (unlikely(!cb))
 					goto reject;
-- 
1.5.3.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 02/13 net-next-2.6] [TIPC]: Standardize error checking on incoming messages via native API
  2008-05-30 18:20 [PATCH 00/13 net-next-2.6] [TIPC]: More minor fixes and enhancements Allan Stephens
  2008-05-30 18:20 ` [PATCH 01/13 net-next-2.6] [TIPC]: Fix bug in connection setup via native API Allan Stephens
@ 2008-05-30 18:20 ` Allan Stephens
  2008-05-30 18:20 ` [PATCH 03/13 net-next-2.6] [TIPC]: Fix bugs in message error code display when debugging Allan Stephens
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Allan Stephens @ 2008-05-30 18:20 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, allan.stephens

This patch re-orders & re-groups the error checks performed on
messages being delivered to native API ports, in order to clarify the
similarities and differences required for the various message types.

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
---
 net/tipc/port.c |   25 +++++++++----------------
 1 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/net/tipc/port.c b/net/tipc/port.c
index 0bd3e61..4dfef9e 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -841,14 +841,14 @@ static void port_dispatcher_sigh(void *dummy)
 				u32 peer_node = port_peernode(p_ptr);
 
 				tipc_port_unlock(p_ptr);
+				if (unlikely(!cb))
+					goto reject;
 				if (unlikely(!connected)) {
 					if (tipc_connect2port(dref, &orig))
 						goto reject;
 				} else if ((msg_origport(msg) != peer_port) ||
 					   (msg_orignode(msg) != peer_node))
 					goto reject;
-				if (unlikely(!cb))
-					goto reject;
 				if (unlikely(++p_ptr->publ.conn_unacked >=
 					     TIPC_FLOW_CONTROL_WIN))
 					tipc_acknowledge(dref,
@@ -862,9 +862,7 @@ static void port_dispatcher_sigh(void *dummy)
 				tipc_msg_event cb = up_ptr->msg_cb;
 
 				tipc_port_unlock(p_ptr);
-				if (unlikely(connected))
-					goto reject;
-				if (unlikely(!cb))
+				if (unlikely(!cb || connected))
 					goto reject;
 				skb_pull(buf, msg_hdr_sz(msg));
 				cb(usr_handle, dref, &buf, msg_data(msg),
@@ -877,11 +875,7 @@ static void port_dispatcher_sigh(void *dummy)
 				tipc_named_msg_event cb = up_ptr->named_msg_cb;
 
 				tipc_port_unlock(p_ptr);
-				if (unlikely(connected))
-					goto reject;
-				if (unlikely(!cb))
-					goto reject;
-				if (unlikely(!published))
+				if (unlikely(!cb || connected || !published))
 					goto reject;
 				dseq.type =  msg_nametype(msg);
 				dseq.lower = msg_nameinst(msg);
@@ -908,11 +902,10 @@ err:
 				u32 peer_node = port_peernode(p_ptr);
 
 				tipc_port_unlock(p_ptr);
-				if (!connected || !cb)
-					break;
-				if (msg_origport(msg) != peer_port)
+				if (!cb || !connected)
 					break;
-				if (msg_orignode(msg) != peer_node)
+				if ((msg_origport(msg) != peer_port) ||
+				    (msg_orignode(msg) != peer_node))
 					break;
 				tipc_disconnect(dref);
 				skb_pull(buf, msg_hdr_sz(msg));
@@ -924,7 +917,7 @@ err:
 				tipc_msg_err_event cb = up_ptr->err_cb;
 
 				tipc_port_unlock(p_ptr);
-				if (connected || !cb)
+				if (!cb || connected)
 					break;
 				skb_pull(buf, msg_hdr_sz(msg));
 				cb(usr_handle, dref, &buf, msg_data(msg),
@@ -937,7 +930,7 @@ err:
 					up_ptr->named_err_cb;
 
 				tipc_port_unlock(p_ptr);
-				if (connected || !cb)
+				if (!cb || connected)
 					break;
 				dseq.type =  msg_nametype(msg);
 				dseq.lower = msg_nameinst(msg);
-- 
1.5.3.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 03/13 net-next-2.6] [TIPC]: Fix bugs in message error code display when debugging
  2008-05-30 18:20 [PATCH 00/13 net-next-2.6] [TIPC]: More minor fixes and enhancements Allan Stephens
  2008-05-30 18:20 ` [PATCH 01/13 net-next-2.6] [TIPC]: Fix bug in connection setup via native API Allan Stephens
  2008-05-30 18:20 ` [PATCH 02/13 net-next-2.6] [TIPC]: Standardize error checking on incoming messages " Allan Stephens
@ 2008-05-30 18:20 ` Allan Stephens
  2008-05-30 18:20 ` [PATCH 04/13 net-next-2.6] [TIPC]: Fix minor bugs in link session number handling Allan Stephens
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Allan Stephens @ 2008-05-30 18:20 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, allan.stephens

This patch corrects two problems in the display of error code
information in TIPC messages when debugging:
- no longer tries to display error code in NAME_DISTRIBUTOR
  messages, which don't have the error field
- now displays error code in 24 byte data messages, which do
  have the error field

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
---
 net/tipc/msg.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/net/tipc/msg.c b/net/tipc/msg.c
index 38abeba..73dcd00 100644
--- a/net/tipc/msg.c
+++ b/net/tipc/msg.c
@@ -230,13 +230,10 @@ void tipc_msg_dbg(struct print_buf *buf, struct tipc_msg *msg, const char *str)
 
 	switch (usr) {
 	case CONN_MANAGER:
-	case NAME_DISTRIBUTOR:
 	case TIPC_LOW_IMPORTANCE:
 	case TIPC_MEDIUM_IMPORTANCE:
 	case TIPC_HIGH_IMPORTANCE:
 	case TIPC_CRITICAL_IMPORTANCE:
-		if (msg_short(msg))
-			break;	/* No error */
 		switch (msg_errcode(msg)) {
 		case TIPC_OK:
 			break;
-- 
1.5.3.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 04/13 net-next-2.6] [TIPC]: Fix minor bugs in link session number handling
  2008-05-30 18:20 [PATCH 00/13 net-next-2.6] [TIPC]: More minor fixes and enhancements Allan Stephens
                   ` (2 preceding siblings ...)
  2008-05-30 18:20 ` [PATCH 03/13 net-next-2.6] [TIPC]: Fix bugs in message error code display when debugging Allan Stephens
@ 2008-05-30 18:20 ` Allan Stephens
  2008-05-30 18:20 ` [PATCH 05/13 net-next-2.6] [TIPC]: Minor optimizations to received message processing Allan Stephens
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Allan Stephens @ 2008-05-30 18:20 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, allan.stephens

This patch introduces a new, out-of-range value to indicate that
a link endpoint does not have an existing session established
with its peer, eliminating the risk that the previously used
"invalid session number" value (i.e. zero) might eventually be
assigned as a valid session number and cause incorrect link
behavior.

The patch also introduces explicit bit masking when assigning a
new link session number to ensure it does not exceed 16 bits.

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
---
 net/tipc/link.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/net/tipc/link.c b/net/tipc/link.c
index bd206eb..b8c1231 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -51,6 +51,12 @@
 
 
 /*
+ * Out-of-range value for link session numbers
+ */
+
+#define INVALID_SESSION 0x10000
+
+/*
  * Limit for deferred reception queue:
  */
 
@@ -464,7 +470,7 @@ struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer,
 	msg = l_ptr->pmsg;
 	msg_init(msg, LINK_PROTOCOL, RESET_MSG, TIPC_OK, INT_H_SIZE, l_ptr->addr);
 	msg_set_size(msg, sizeof(l_ptr->proto_msg));
-	msg_set_session(msg, tipc_random);
+	msg_set_session(msg, (tipc_random & 0xffff));
 	msg_set_bearer_id(msg, b_ptr->identity);
 	strcpy((char *)msg_data(msg), if_name);
 
@@ -705,10 +711,10 @@ void tipc_link_reset(struct link *l_ptr)
 	u32 checkpoint = l_ptr->next_in_no;
 	int was_active_link = tipc_link_is_active(l_ptr);
 
-	msg_set_session(l_ptr->pmsg, msg_session(l_ptr->pmsg) + 1);
+	msg_set_session(l_ptr->pmsg, ((msg_session(l_ptr->pmsg) + 1) & 0xffff));
 
-	/* Link is down, accept any session: */
-	l_ptr->peer_session = 0;
+	/* Link is down, accept any session */
+	l_ptr->peer_session = INVALID_SESSION;
 
 	/* Prepare for max packet size negotiation */
 	link_init_max_pkt(l_ptr);
@@ -2275,7 +2281,8 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf)
 	switch (msg_type(msg)) {
 
 	case RESET_MSG:
-		if (!link_working_unknown(l_ptr) && l_ptr->peer_session) {
+		if (!link_working_unknown(l_ptr) &&
+		    (l_ptr->peer_session != INVALID_SESSION)) {
 			if (msg_session(msg) == l_ptr->peer_session) {
 				dbg("Duplicate RESET: %u<->%u\n",
 				    msg_session(msg), l_ptr->peer_session);
-- 
1.5.3.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 05/13 net-next-2.6] [TIPC]: Minor optimizations to received message processing
  2008-05-30 18:20 [PATCH 00/13 net-next-2.6] [TIPC]: More minor fixes and enhancements Allan Stephens
                   ` (3 preceding siblings ...)
  2008-05-30 18:20 ` [PATCH 04/13 net-next-2.6] [TIPC]: Fix minor bugs in link session number handling Allan Stephens
@ 2008-05-30 18:20 ` Allan Stephens
  2008-05-30 18:20 ` [PATCH 06/13 net-next-2.6] [TIPC]: Prevent access of non-existent field in short message header Allan Stephens
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Allan Stephens @ 2008-05-30 18:20 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, allan.stephens

This patch enhances TIPC's handler for incoming messages in two
ways:
- the trivial, single-use routine for processing non-sequenced
  messages has been merged into the main handler
- the interface that received a message is now identified without
  having to access and/or modify the associated sk_buff

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
---
 net/tipc/discover.c |    4 ++--
 net/tipc/discover.h |    2 +-
 net/tipc/link.c     |   27 +++++----------------------
 3 files changed, 8 insertions(+), 25 deletions(-)

diff --git a/net/tipc/discover.c b/net/tipc/discover.c
index faeaf06..ada213a 100644
--- a/net/tipc/discover.c
+++ b/net/tipc/discover.c
@@ -156,11 +156,11 @@ static void disc_dupl_alert(struct bearer *b_ptr, u32 node_addr,
 /**
  * tipc_disc_recv_msg - handle incoming link setup message (request or response)
  * @buf: buffer containing message
+ * @b_ptr: bearer that message arrived on
  */
 
-void tipc_disc_recv_msg(struct sk_buff *buf)
+void tipc_disc_recv_msg(struct sk_buff *buf, struct bearer *b_ptr)
 {
-	struct bearer *b_ptr = (struct bearer *)TIPC_SKB_CB(buf)->handle;
 	struct link *link;
 	struct tipc_media_addr media_addr;
 	struct tipc_msg *msg = buf_msg(buf);
diff --git a/net/tipc/discover.h b/net/tipc/discover.h
index 9fd7587..c36eaeb 100644
--- a/net/tipc/discover.h
+++ b/net/tipc/discover.h
@@ -48,7 +48,7 @@ struct link_req *tipc_disc_init_link_req(struct bearer *b_ptr,
 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);
+void tipc_disc_recv_msg(struct sk_buff *buf, struct bearer *b_ptr);
 
 void tipc_disc_link_event(u32 addr, char *name, int up);
 #if 0
diff --git a/net/tipc/link.c b/net/tipc/link.c
index b8c1231..c62ebfe 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -1766,21 +1766,6 @@ void tipc_link_retransmit(struct link *l_ptr, struct sk_buff *buf,
 	l_ptr->retransm_queue_head = l_ptr->retransm_queue_size = 0;
 }
 
-/*
- * link_recv_non_seq: Receive packets which are outside
- *                    the link sequence flow
- */
-
-static void link_recv_non_seq(struct sk_buff *buf)
-{
-	struct tipc_msg *msg = buf_msg(buf);
-
-	if (msg_user(msg) ==  LINK_CONFIG)
-		tipc_disc_recv_msg(buf);
-	else
-		tipc_bclink_recv_pkt(buf);
-}
-
 /**
  * link_insert_deferred_queue - insert deferred messages back into receive chain
  */
@@ -1857,7 +1842,7 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr)
 {
 	read_lock_bh(&tipc_net_lock);
 	while (head) {
-		struct bearer *b_ptr;
+		struct bearer *b_ptr = (struct bearer *)tb_ptr;
 		struct node *n_ptr;
 		struct link *l_ptr;
 		struct sk_buff *crs;
@@ -1868,9 +1853,6 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr)
 		u32 released = 0;
 		int type;
 
-		b_ptr = (struct bearer *)tb_ptr;
-		TIPC_SKB_CB(buf)->handle = b_ptr;
-
 		head = head->next;
 
 		/* Ensure message is well-formed */
@@ -1889,7 +1871,10 @@ void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr)
 		msg = buf_msg(buf);
 
 		if (unlikely(msg_non_seq(msg))) {
-			link_recv_non_seq(buf);
+			if (msg_user(msg) ==  LINK_CONFIG)
+				tipc_disc_recv_msg(buf, b_ptr);
+			else
+				tipc_bclink_recv_pkt(buf);
 			continue;
 		}
 
@@ -1996,8 +1981,6 @@ deliver:
 						if (link_recv_changeover_msg(&l_ptr, &buf)) {
 							msg = buf_msg(buf);
 							seq_no = msg_seqno(msg);
-							TIPC_SKB_CB(buf)->handle
-								= b_ptr;
 							if (type == ORIGINAL_MSG)
 								goto deliver;
 							goto protocol_check;
-- 
1.5.3.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 06/13 net-next-2.6] [TIPC]: Prevent access of non-existent field in short message header
  2008-05-30 18:20 [PATCH 00/13 net-next-2.6] [TIPC]: More minor fixes and enhancements Allan Stephens
                   ` (4 preceding siblings ...)
  2008-05-30 18:20 ` [PATCH 05/13 net-next-2.6] [TIPC]: Minor optimizations to received message processing Allan Stephens
@ 2008-05-30 18:20 ` Allan Stephens
  2008-05-30 18:20 ` [PATCH 07/13 net-next-2.6] [TIPC]: Optimize message initialization routine Allan Stephens
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Allan Stephens @ 2008-05-30 18:20 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, allan.stephens

This patch eliminates a case where TIPC's link code could try reading
a field that is not present in a short message header.  (The random
value obtained was not being used, but the read operation could result
in an invalid memory access exception in extremely rare circumstances.)

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
---
 net/tipc/link.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/net/tipc/link.c b/net/tipc/link.c
index c62ebfe..022cb2f 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -2674,10 +2674,12 @@ int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf)
 	u32 pack_sz = link_max_pkt(l_ptr);
 	u32 fragm_sz = pack_sz - INT_H_SIZE;
 	u32 fragm_no = 1;
-	u32 destaddr = msg_destnode(inmsg);
+	u32 destaddr;
 
 	if (msg_short(inmsg))
 		destaddr = l_ptr->addr;
+	else
+		destaddr = msg_destnode(inmsg);
 
 	if (msg_routed(inmsg))
 		msg_set_prevnode(inmsg, tipc_own_addr);
-- 
1.5.3.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 07/13 net-next-2.6] [TIPC]: Optimize message initialization routine
  2008-05-30 18:20 [PATCH 00/13 net-next-2.6] [TIPC]: More minor fixes and enhancements Allan Stephens
                   ` (5 preceding siblings ...)
  2008-05-30 18:20 ` [PATCH 06/13 net-next-2.6] [TIPC]: Prevent access of non-existent field in short message header Allan Stephens
@ 2008-05-30 18:20 ` Allan Stephens
  2008-05-30 18:20 ` [PATCH 08/13 net-next-2.6] [TIPC]: Prevent display of name table types with no publications Allan Stephens
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Allan Stephens @ 2008-05-30 18:20 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, allan.stephens

This patch eliminates the rarely-used "error code" argument
when initializing a TIPC message header, since the default
value of zero is the desired result in most cases; the few
exceptional cases now set the error code explicitly.

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
---
 net/tipc/bcast.c      |    2 +-
 net/tipc/cluster.c    |    2 +-
 net/tipc/discover.c   |    3 +--
 net/tipc/link.c       |   12 ++++++------
 net/tipc/msg.h        |    3 +--
 net/tipc/name_distr.c |    3 +--
 net/tipc/port.c       |    9 +++++----
 7 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c
index e788017..0052c07 100644
--- a/net/tipc/bcast.c
+++ b/net/tipc/bcast.c
@@ -276,7 +276,7 @@ static void bclink_send_nack(struct node *n_ptr)
 	if (buf) {
 		msg = buf_msg(buf);
 		msg_init(msg, BCAST_PROTOCOL, STATE_MSG,
-			 TIPC_OK, INT_H_SIZE, n_ptr->addr);
+			 INT_H_SIZE, n_ptr->addr);
 		msg_set_mc_netid(msg, tipc_net_id);
 		msg_set_bcast_ack(msg, mod(n_ptr->bclink.last_in));
 		msg_set_bcgap_after(msg, n_ptr->bclink.gap_after);
diff --git a/net/tipc/cluster.c b/net/tipc/cluster.c
index 4bb3404..bc1db47 100644
--- a/net/tipc/cluster.c
+++ b/net/tipc/cluster.c
@@ -238,7 +238,7 @@ static struct sk_buff *tipc_cltr_prepare_routing_msg(u32 data_size, u32 dest)
 	if (buf) {
 		msg = buf_msg(buf);
 		memset((char *)msg, 0, size);
-		msg_init(msg, ROUTE_DISTRIBUTOR, 0, TIPC_OK, INT_H_SIZE, dest);
+		msg_init(msg, ROUTE_DISTRIBUTOR, 0, INT_H_SIZE, dest);
 	}
 	return buf;
 }
diff --git a/net/tipc/discover.c b/net/tipc/discover.c
index ada213a..64c2028 100644
--- a/net/tipc/discover.c
+++ b/net/tipc/discover.c
@@ -120,8 +120,7 @@ static struct sk_buff *tipc_disc_init_msg(u32 type,
 
 	if (buf) {
 		msg = buf_msg(buf);
-		msg_init(msg, LINK_CONFIG, type, TIPC_OK, DSC_H_SIZE,
-			 dest_domain);
+		msg_init(msg, LINK_CONFIG, type, DSC_H_SIZE, dest_domain);
 		msg_set_non_seq(msg);
 		msg_set_req_links(msg, req_links);
 		msg_set_dest_domain(msg, dest_domain);
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 022cb2f..9784a8e 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -468,7 +468,7 @@ struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer,
 
 	l_ptr->pmsg = (struct tipc_msg *)&l_ptr->proto_msg;
 	msg = l_ptr->pmsg;
-	msg_init(msg, LINK_PROTOCOL, RESET_MSG, TIPC_OK, INT_H_SIZE, l_ptr->addr);
+	msg_init(msg, LINK_PROTOCOL, RESET_MSG, INT_H_SIZE, l_ptr->addr);
 	msg_set_size(msg, sizeof(l_ptr->proto_msg));
 	msg_set_session(msg, (tipc_random & 0xffff));
 	msg_set_bearer_id(msg, b_ptr->identity);
@@ -1128,7 +1128,7 @@ int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf)
 
 			if (bundler) {
 				msg_init(&bundler_hdr, MSG_BUNDLER, OPEN_MSG,
-					 TIPC_OK, INT_H_SIZE, l_ptr->addr);
+					 INT_H_SIZE, l_ptr->addr);
 				skb_copy_to_linear_data(bundler, &bundler_hdr,
 							INT_H_SIZE);
 				skb_trim(bundler, INT_H_SIZE);
@@ -1392,7 +1392,7 @@ again:
 
 	msg_dbg(hdr, ">FRAGMENTING>");
 	msg_init(&fragm_hdr, MSG_FRAGMENTER, FIRST_FRAGMENT,
-		 TIPC_OK, INT_H_SIZE, msg_destnode(hdr));
+		 INT_H_SIZE, msg_destnode(hdr));
 	msg_set_link_selector(&fragm_hdr, sender->publ.ref);
 	msg_set_size(&fragm_hdr, max_pkt);
 	msg_set_fragm_no(&fragm_hdr, 1);
@@ -2426,7 +2426,7 @@ void tipc_link_changeover(struct link *l_ptr)
 	}
 
 	msg_init(&tunnel_hdr, CHANGEOVER_PROTOCOL,
-		 ORIGINAL_MSG, TIPC_OK, INT_H_SIZE, l_ptr->addr);
+		 ORIGINAL_MSG, INT_H_SIZE, l_ptr->addr);
 	msg_set_bearer_id(&tunnel_hdr, l_ptr->peer_bearer_id);
 	msg_set_msgcnt(&tunnel_hdr, msgcount);
 	dbg("Link changeover requires %u tunnel messages\n", msgcount);
@@ -2481,7 +2481,7 @@ void tipc_link_send_duplicate(struct link *l_ptr, struct link *tunnel)
 	struct tipc_msg tunnel_hdr;
 
 	msg_init(&tunnel_hdr, CHANGEOVER_PROTOCOL,
-		 DUPLICATE_MSG, TIPC_OK, INT_H_SIZE, l_ptr->addr);
+		 DUPLICATE_MSG, INT_H_SIZE, l_ptr->addr);
 	msg_set_msgcnt(&tunnel_hdr, l_ptr->out_queue_size);
 	msg_set_bearer_id(&tunnel_hdr, l_ptr->peer_bearer_id);
 	iter = l_ptr->first_out;
@@ -2687,7 +2687,7 @@ int tipc_link_send_long_buf(struct link *l_ptr, struct sk_buff *buf)
 	/* Prepare reusable fragment header: */
 
 	msg_init(&fragm_hdr, MSG_FRAGMENTER, FIRST_FRAGMENT,
-		 TIPC_OK, INT_H_SIZE, destaddr);
+		 INT_H_SIZE, destaddr);
 	msg_set_link_selector(&fragm_hdr, msg_link_selector(inmsg));
 	msg_set_long_msgno(&fragm_hdr, mod(l_ptr->long_msg_seq_no++));
 	msg_set_fragm_no(&fragm_hdr, fragm_no);
diff --git a/net/tipc/msg.h b/net/tipc/msg.h
index ad487e8..3418ffa 100644
--- a/net/tipc/msg.h
+++ b/net/tipc/msg.h
@@ -696,7 +696,7 @@ static inline u32 msg_tot_importance(struct tipc_msg *m)
 
 
 static inline void msg_init(struct tipc_msg *m, u32 user, u32 type,
-			    u32 err, u32 hsize, u32 destnode)
+			    u32 hsize, u32 destnode)
 {
 	memset(m, 0, hsize);
 	msg_set_version(m);
@@ -705,7 +705,6 @@ static inline void msg_init(struct tipc_msg *m, u32 user, u32 type,
 	msg_set_size(m, hsize);
 	msg_set_prevnode(m, tipc_own_addr);
 	msg_set_type(m, type);
-	msg_set_errcode(m, err);
 	if (!msg_short(m)) {
 		msg_set_orignode(m, tipc_own_addr);
 		msg_set_destnode(m, destnode);
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c
index aecba5c..10a6989 100644
--- a/net/tipc/name_distr.c
+++ b/net/tipc/name_distr.c
@@ -103,8 +103,7 @@ static struct sk_buff *named_prepare_buf(u32 type, u32 size, u32 dest)
 
 	if (buf != NULL) {
 		msg = buf_msg(buf);
-		msg_init(msg, NAME_DISTRIBUTOR, type, TIPC_OK,
-			 LONG_H_SIZE, dest);
+		msg_init(msg, NAME_DISTRIBUTOR, type, LONG_H_SIZE, dest);
 		msg_set_size(msg, LONG_H_SIZE + size);
 	}
 	return buf;
diff --git a/net/tipc/port.c b/net/tipc/port.c
index 4dfef9e..e3e9c12 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -244,8 +244,7 @@ u32 tipc_createport_raw(void *usr_handle,
 	p_ptr->publ.max_pkt = MAX_PKT_DEFAULT;
 	p_ptr->publ.ref = ref;
 	msg = &p_ptr->publ.phdr;
-	msg_init(msg, TIPC_LOW_IMPORTANCE, TIPC_NAMED_MSG, TIPC_OK, LONG_H_SIZE,
-		 0);
+	msg_init(msg, TIPC_LOW_IMPORTANCE, TIPC_NAMED_MSG, LONG_H_SIZE, 0);
 	msg_set_orignode(msg, tipc_own_addr);
 	msg_set_prevnode(msg, tipc_own_addr);
 	msg_set_origport(msg, ref);
@@ -404,7 +403,8 @@ static struct sk_buff *port_build_proto_msg(u32 destport, u32 destnode,
 	buf = buf_acquire(LONG_H_SIZE);
 	if (buf) {
 		msg = buf_msg(buf);
-		msg_init(msg, usr, type, err, LONG_H_SIZE, destnode);
+		msg_init(msg, usr, type, LONG_H_SIZE, destnode);
+		msg_set_errcode(msg, err);
 		msg_set_destport(msg, destport);
 		msg_set_origport(msg, origport);
 		msg_set_destnode(msg, destnode);
@@ -448,7 +448,8 @@ int tipc_reject_msg(struct sk_buff *buf, u32 err)
 		return data_sz;
 	}
 	rmsg = buf_msg(rbuf);
-	msg_init(rmsg, imp, msg_type(msg), err, hdr_sz, msg_orignode(msg));
+	msg_init(rmsg, imp, msg_type(msg), hdr_sz, msg_orignode(msg));
+	msg_set_errcode(rmsg, err);
 	msg_set_destport(rmsg, msg_origport(msg));
 	msg_set_prevnode(rmsg, tipc_own_addr);
 	msg_set_origport(rmsg, msg_destport(msg));
-- 
1.5.3.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 08/13 net-next-2.6] [TIPC]: Prevent display of name table types with no publications
  2008-05-30 18:20 [PATCH 00/13 net-next-2.6] [TIPC]: More minor fixes and enhancements Allan Stephens
                   ` (6 preceding siblings ...)
  2008-05-30 18:20 ` [PATCH 07/13 net-next-2.6] [TIPC]: Optimize message initialization routine Allan Stephens
@ 2008-05-30 18:20 ` Allan Stephens
  2008-05-30 18:20 ` [PATCH 09/13 net-next-2.6] [TIPC]: Add missing spinlock in name table display code Allan Stephens
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Allan Stephens @ 2008-05-30 18:20 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, allan.stephens

This patch adds a check to prevent TIPC's name table display code
from listing a name type entry if it exists only to hold subscription
info, rather than published names.

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
---
 net/tipc/name_table.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c
index 892373e..4455f13 100644
--- a/net/tipc/name_table.c
+++ b/net/tipc/name_table.c
@@ -905,6 +905,9 @@ static void nameseq_list(struct name_seq *seq, struct print_buf *buf, u32 depth,
 	struct sub_seq *sseq;
 	char typearea[11];
 
+	if (seq->first_free == 0)
+		return;
+
 	sprintf(typearea, "%-10u", seq->type);
 
 	if (depth == 1) {
-- 
1.5.3.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 09/13 net-next-2.6] [TIPC]: Add missing spinlock in name table display code
  2008-05-30 18:20 [PATCH 00/13 net-next-2.6] [TIPC]: More minor fixes and enhancements Allan Stephens
                   ` (7 preceding siblings ...)
  2008-05-30 18:20 ` [PATCH 08/13 net-next-2.6] [TIPC]: Prevent display of name table types with no publications Allan Stephens
@ 2008-05-30 18:20 ` Allan Stephens
  2008-05-30 18:20 ` [PATCH 10/13 net-next-2.6] [TIPC]: Expand link sequence gap field to 13 bits Allan Stephens
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Allan Stephens @ 2008-05-30 18:20 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, allan.stephens

This patch ensures that the display code that traverses the
publication lists belonging to a name table entry take its
associated spinlock, to protect against a possible change to
one of its "head of list" pointers caused by a simultaneous
name table lookup operation by another thread of control.

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
---
 net/tipc/name_table.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c
index 4455f13..096f7bd 100644
--- a/net/tipc/name_table.c
+++ b/net/tipc/name_table.c
@@ -74,7 +74,7 @@ struct sub_seq {
  * @first_free: array index of first unused sub-sequence entry
  * @ns_list: links to adjacent name sequences in hash chain
  * @subscriptions: list of subscriptions for this 'type'
- * @lock: spinlock controlling access to name sequence structure
+ * @lock: spinlock controlling access to publication lists of all sub-sequences
  */
 
 struct name_seq {
@@ -918,7 +918,9 @@ static void nameseq_list(struct name_seq *seq, struct print_buf *buf, u32 depth,
 	for (sseq = seq->sseqs; sseq != &seq->sseqs[seq->first_free]; sseq++) {
 		if ((lowbound <= sseq->upper) && (upbound >= sseq->lower)) {
 			tipc_printf(buf, "%s ", typearea);
+			spin_lock_bh(&seq->lock);
 			subseq_list(sseq, buf, depth, index);
+			spin_unlock_bh(&seq->lock);
 			sprintf(typearea, "%10s", " ");
 		}
 	}
-- 
1.5.3.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 10/13 net-next-2.6] [TIPC]: Expand link sequence gap field to 13 bits
  2008-05-30 18:20 [PATCH 00/13 net-next-2.6] [TIPC]: More minor fixes and enhancements Allan Stephens
                   ` (8 preceding siblings ...)
  2008-05-30 18:20 ` [PATCH 09/13 net-next-2.6] [TIPC]: Add missing spinlock in name table display code Allan Stephens
@ 2008-05-30 18:20 ` Allan Stephens
  2008-05-30 18:20 ` [PATCH 11/13 net-next-2.6] [TIPC]: Message header creation optimizations Allan Stephens
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Allan Stephens @ 2008-05-30 18:20 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, allan.stephens

This patch increases the "sequence gap" field of the LINK_PROTOCOL
message header from 8 bits to 13 bits (utilizing 5 previously
unused 0 bits).  This ensures that the field is big enough to
indicate the loss of up to 8191 consecutive messages on the link,
thereby accommodating the current worst-case scenario of 4000
lost messages.

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
---
 net/tipc/msg.h |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/tipc/msg.h b/net/tipc/msg.h
index 3418ffa..b23619f 100644
--- a/net/tipc/msg.h
+++ b/net/tipc/msg.h
@@ -2,7 +2,7 @@
  * net/tipc/msg.h: Include file for TIPC message header routines
  *
  * Copyright (c) 2000-2007, Ericsson AB
- * Copyright (c) 2005-2007, Wind River Systems
+ * Copyright (c) 2005-2008, Wind River Systems
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -325,7 +325,7 @@ static inline struct tipc_msg *msg_get_wrapped(struct tipc_msg *m)
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    w0:|vers |msg usr|hdr sz |n|resrv|            packet size          |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-   w1:|m typ|rsv=0|   sequence gap    |       broadcast ack no        |
+   w1:|m typ|      sequence gap       |       broadcast ack no        |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    w2:| link level ack no/bc_gap_from |     seq no / bcast_gap_to     |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -388,12 +388,12 @@ static inline struct tipc_msg *msg_get_wrapped(struct tipc_msg *m)
 
 static inline u32 msg_seq_gap(struct tipc_msg *m)
 {
-	return msg_bits(m, 1, 16, 0xff);
+	return msg_bits(m, 1, 16, 0x1fff);
 }
 
 static inline void msg_set_seq_gap(struct tipc_msg *m, u32 n)
 {
-	msg_set_bits(m, 1, 16, 0xff, n);
+	msg_set_bits(m, 1, 16, 0x1fff, n);
 }
 
 static inline u32 msg_req_links(struct tipc_msg *m)
-- 
1.5.3.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 11/13 net-next-2.6] [TIPC]: Message header creation optimizations
  2008-05-30 18:20 [PATCH 00/13 net-next-2.6] [TIPC]: More minor fixes and enhancements Allan Stephens
                   ` (9 preceding siblings ...)
  2008-05-30 18:20 ` [PATCH 10/13 net-next-2.6] [TIPC]: Expand link sequence gap field to 13 bits Allan Stephens
@ 2008-05-30 18:20 ` Allan Stephens
  2008-05-30 18:20 ` [PATCH 12/13 net-next-2.6] [TIPC]: Fix bugs in rejection of message with short header Allan Stephens
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Allan Stephens @ 2008-05-30 18:20 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, allan.stephens

This patch eliminates several cases where message header fields
were being set to the same value twice.

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
---
 net/tipc/port.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/net/tipc/port.c b/net/tipc/port.c
index e3e9c12..93014f9 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -244,11 +244,8 @@ u32 tipc_createport_raw(void *usr_handle,
 	p_ptr->publ.max_pkt = MAX_PKT_DEFAULT;
 	p_ptr->publ.ref = ref;
 	msg = &p_ptr->publ.phdr;
-	msg_init(msg, TIPC_LOW_IMPORTANCE, TIPC_NAMED_MSG, LONG_H_SIZE, 0);
-	msg_set_orignode(msg, tipc_own_addr);
-	msg_set_prevnode(msg, tipc_own_addr);
+	msg_init(msg, importance, TIPC_NAMED_MSG, LONG_H_SIZE, 0);
 	msg_set_origport(msg, ref);
-	msg_set_importance(msg,importance);
 	p_ptr->last_in_seqno = 41;
 	p_ptr->sent = 1;
 	INIT_LIST_HEAD(&p_ptr->wait_list);
@@ -407,7 +404,6 @@ static struct sk_buff *port_build_proto_msg(u32 destport, u32 destnode,
 		msg_set_errcode(msg, err);
 		msg_set_destport(msg, destport);
 		msg_set_origport(msg, origport);
-		msg_set_destnode(msg, destnode);
 		msg_set_orignode(msg, orignode);
 		msg_set_transp_seqno(msg, seqno);
 		msg_set_msgcnt(msg, ack);
@@ -451,7 +447,6 @@ int tipc_reject_msg(struct sk_buff *buf, u32 err)
 	msg_init(rmsg, imp, msg_type(msg), hdr_sz, msg_orignode(msg));
 	msg_set_errcode(rmsg, err);
 	msg_set_destport(rmsg, msg_origport(msg));
-	msg_set_prevnode(rmsg, tipc_own_addr);
 	msg_set_origport(rmsg, msg_destport(msg));
 	if (msg_short(msg))
 		msg_set_orignode(rmsg, tipc_own_addr);
-- 
1.5.3.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 12/13 net-next-2.6] [TIPC]: Fix bugs in rejection of message with short header
  2008-05-30 18:20 [PATCH 00/13 net-next-2.6] [TIPC]: More minor fixes and enhancements Allan Stephens
                   ` (10 preceding siblings ...)
  2008-05-30 18:20 ` [PATCH 11/13 net-next-2.6] [TIPC]: Message header creation optimizations Allan Stephens
@ 2008-05-30 18:20 ` Allan Stephens
  2008-05-30 18:20 ` [PATCH 13/13 net-next-2.6] [TIPC]: Message rejection rework preparatory changes Allan Stephens
  2008-06-05  1:21 ` [PATCH 00/13 net-next-2.6] [TIPC]: More minor fixes and enhancements David Miller
  13 siblings, 0 replies; 15+ messages in thread
From: Allan Stephens @ 2008-05-30 18:20 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, allan.stephens

This patch ensures that TIPC doesn't try to access non-existent
message header fields when rejecting a message with a short header.

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
---
 net/tipc/port.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/net/tipc/port.c b/net/tipc/port.c
index 93014f9..2e0cff4 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -448,13 +448,15 @@ int tipc_reject_msg(struct sk_buff *buf, u32 err)
 	msg_set_errcode(rmsg, err);
 	msg_set_destport(rmsg, msg_origport(msg));
 	msg_set_origport(rmsg, msg_destport(msg));
-	if (msg_short(msg))
+	if (msg_short(msg)) {
 		msg_set_orignode(rmsg, tipc_own_addr);
-	else
+		/* leave name type & instance as zeroes */
+	} else {
 		msg_set_orignode(rmsg, msg_destnode(msg));
+		msg_set_nametype(rmsg, msg_nametype(msg));
+		msg_set_nameinst(rmsg, msg_nameinst(msg));
+	}
 	msg_set_size(rmsg, data_sz + hdr_sz);
-	msg_set_nametype(rmsg, msg_nametype(msg));
-	msg_set_nameinst(rmsg, msg_nameinst(msg));
 	skb_copy_to_linear_data_offset(rbuf, hdr_sz, msg_data(msg), data_sz);
 
 	/* send self-abort message when rejecting on a connected port */
-- 
1.5.3.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 13/13 net-next-2.6] [TIPC]: Message rejection rework preparatory changes
  2008-05-30 18:20 [PATCH 00/13 net-next-2.6] [TIPC]: More minor fixes and enhancements Allan Stephens
                   ` (11 preceding siblings ...)
  2008-05-30 18:20 ` [PATCH 12/13 net-next-2.6] [TIPC]: Fix bugs in rejection of message with short header Allan Stephens
@ 2008-05-30 18:20 ` Allan Stephens
  2008-06-05  1:21 ` [PATCH 00/13 net-next-2.6] [TIPC]: More minor fixes and enhancements David Miller
  13 siblings, 0 replies; 15+ messages in thread
From: Allan Stephens @ 2008-05-30 18:20 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, allan.stephens

This patch defines a few new message header manipulation routines,
and generalizes the usefulness of another, in preparation for upcoming
rework of TIPC's message rejection code.

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
---
 net/tipc/bcast.c    |    2 +-
 net/tipc/discover.c |    2 +-
 net/tipc/msg.h      |   31 +++++++++++++++++++++++++++++--
 3 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c
index 0052c07..a5883b1 100644
--- a/net/tipc/bcast.c
+++ b/net/tipc/bcast.c
@@ -571,7 +571,7 @@ static int tipc_bcbearer_send(struct sk_buff *buf,
 		assert(tipc_cltr_bcast_nodes.count != 0);
 		bcbuf_set_acks(buf, tipc_cltr_bcast_nodes.count);
 		msg = buf_msg(buf);
-		msg_set_non_seq(msg);
+		msg_set_non_seq(msg, 1);
 		msg_set_mc_netid(msg, tipc_net_id);
 	}
 
diff --git a/net/tipc/discover.c b/net/tipc/discover.c
index 64c2028..1657f0e 100644
--- a/net/tipc/discover.c
+++ b/net/tipc/discover.c
@@ -121,7 +121,7 @@ static struct sk_buff *tipc_disc_init_msg(u32 type,
 	if (buf) {
 		msg = buf_msg(buf);
 		msg_init(msg, LINK_CONFIG, type, DSC_H_SIZE, dest_domain);
-		msg_set_non_seq(msg);
+		msg_set_non_seq(msg, 1);
 		msg_set_req_links(msg, req_links);
 		msg_set_dest_domain(msg, dest_domain);
 		msg_set_bc_netid(msg, tipc_net_id);
diff --git a/net/tipc/msg.h b/net/tipc/msg.h
index b23619f..7ee6ae2 100644
--- a/net/tipc/msg.h
+++ b/net/tipc/msg.h
@@ -75,6 +75,14 @@ static inline void msg_set_bits(struct tipc_msg *m, u32 w,
 	m->hdr[w] |= htonl(val);
 }
 
+static inline void msg_swap_words(struct tipc_msg *msg, u32 a, u32 b)
+{
+	u32 temp = msg->hdr[a];
+
+	msg->hdr[a] = msg->hdr[b];
+	msg->hdr[b] = temp;
+}
+
 /*
  * Word 0
  */
@@ -119,9 +127,9 @@ static inline int msg_non_seq(struct tipc_msg *m)
 	return msg_bits(m, 0, 20, 1);
 }
 
-static inline void msg_set_non_seq(struct tipc_msg *m)
+static inline void msg_set_non_seq(struct tipc_msg *m, u32 n)
 {
-	msg_set_bits(m, 0, 20, 1, 1);
+	msg_set_bits(m, 0, 20, 1, n);
 }
 
 static inline int msg_dest_droppable(struct tipc_msg *m)
@@ -224,6 +232,25 @@ static inline void msg_set_seqno(struct tipc_msg *m, u32 n)
 	msg_set_bits(m, 2, 0, 0xffff, n);
 }
 
+/*
+ * TIPC may utilize the "link ack #" and "link seq #" fields of a short
+ * message header to hold the destination node for the message, since the
+ * normal "dest node" field isn't present.  This cache is only referenced
+ * when required, so populating the cache of a longer message header is
+ * harmless (as long as the header has the two link sequence fields present).
+ *
+ * Note: Host byte order is OK here, since the info never goes off-card.
+ */
+
+static inline u32 msg_destnode_cache(struct tipc_msg *m)
+{
+	return m->hdr[2];
+}
+
+static inline void msg_set_destnode_cache(struct tipc_msg *m, u32 dnode)
+{
+	m->hdr[2] = dnode;
+}
 
 /*
  * Words 3-10
-- 
1.5.3.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH 00/13 net-next-2.6] [TIPC]: More minor fixes and enhancements
  2008-05-30 18:20 [PATCH 00/13 net-next-2.6] [TIPC]: More minor fixes and enhancements Allan Stephens
                   ` (12 preceding siblings ...)
  2008-05-30 18:20 ` [PATCH 13/13 net-next-2.6] [TIPC]: Message rejection rework preparatory changes Allan Stephens
@ 2008-06-05  1:21 ` David Miller
  13 siblings, 0 replies; 15+ messages in thread
From: David Miller @ 2008-06-05  1:21 UTC (permalink / raw)
  To: allan.stephens; +Cc: netdev

From: Allan Stephens <allan.stephens@windriver.com>
Date: Fri, 30 May 2008 14:20:35 -0400

> This patch set is another collection of small changes to TIPC that fix obscure
> problems, plus some minor enhancements.  Please see each individual patch for
> a more detailed description of each change.

All applied and pushed out to net-next-2.6, thanks Allan.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2008-06-05  1:21 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-30 18:20 [PATCH 00/13 net-next-2.6] [TIPC]: More minor fixes and enhancements Allan Stephens
2008-05-30 18:20 ` [PATCH 01/13 net-next-2.6] [TIPC]: Fix bug in connection setup via native API Allan Stephens
2008-05-30 18:20 ` [PATCH 02/13 net-next-2.6] [TIPC]: Standardize error checking on incoming messages " Allan Stephens
2008-05-30 18:20 ` [PATCH 03/13 net-next-2.6] [TIPC]: Fix bugs in message error code display when debugging Allan Stephens
2008-05-30 18:20 ` [PATCH 04/13 net-next-2.6] [TIPC]: Fix minor bugs in link session number handling Allan Stephens
2008-05-30 18:20 ` [PATCH 05/13 net-next-2.6] [TIPC]: Minor optimizations to received message processing Allan Stephens
2008-05-30 18:20 ` [PATCH 06/13 net-next-2.6] [TIPC]: Prevent access of non-existent field in short message header Allan Stephens
2008-05-30 18:20 ` [PATCH 07/13 net-next-2.6] [TIPC]: Optimize message initialization routine Allan Stephens
2008-05-30 18:20 ` [PATCH 08/13 net-next-2.6] [TIPC]: Prevent display of name table types with no publications Allan Stephens
2008-05-30 18:20 ` [PATCH 09/13 net-next-2.6] [TIPC]: Add missing spinlock in name table display code Allan Stephens
2008-05-30 18:20 ` [PATCH 10/13 net-next-2.6] [TIPC]: Expand link sequence gap field to 13 bits Allan Stephens
2008-05-30 18:20 ` [PATCH 11/13 net-next-2.6] [TIPC]: Message header creation optimizations Allan Stephens
2008-05-30 18:20 ` [PATCH 12/13 net-next-2.6] [TIPC]: Fix bugs in rejection of message with short header Allan Stephens
2008-05-30 18:20 ` [PATCH 13/13 net-next-2.6] [TIPC]: Message rejection rework preparatory changes Allan Stephens
2008-06-05  1:21 ` [PATCH 00/13 net-next-2.6] [TIPC]: More minor fixes and enhancements David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).