Skip to contentSkip to conversation

: Initial patch set for TIPC 1.6.3

PATCH In review Allan Stephens 2 participants 13 messages Mar 4, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover : Initial patch set for TIPC 1.6.3

This patch set contains code created as part of the TIPC 1.7 development project. It contains minor enhancements that do not introduce new features, and is thus being integrated under the current TIPC 1.6 designation.

Summary:

 include/net/tipc/tipc_bearer.h |   10 ++++++++
 include/net/tipc/tipc_port.h   |    7 ------
 net/tipc/core.c                |   12 +---------
 net/tipc/core.h                |    7 ++++++
 net/tipc/link.c                |   16 ++++++-------
 net/tipc/msg.c                 |   16 ++++++-------
 net/tipc/msg.h                 |   50 ++++++++++------------------------------
 net/tipc/port.c                |   12 ++--------
 net/tipc/socket.c              |    5 ++--
 9 files changed, 53 insertions(+), 82 deletions(-)

Allan Stephens (7):
[TIPC]: Update version to 1.6.3
[TIPC]: Add argument validation for shutdown() [TIPC]: Eliminate "sparse" warning in socket code [TIPC]: Minor cleanup of message header code [TIPC]: Use correct bitmask when setting version in message [TIPC]: Enhancements to message header field writing [TIPC]: Removal of obsolete message header option code

Thanks,
Al

#1 lore raw

PATCH 1/7 : Update version to 1.6.3

This patch updates TIPC's version number to 1.6.3.

---
 net/tipc/core.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net/tipc/core.c +1 -1
index d2d7d32..9b9429e 100644
@@ -57,7 +57,7 @@ void tipc_socket_stop(void);
 int  tipc_netlink_start(void);
 void tipc_netlink_stop(void);
 
-#define TIPC_MOD_VER "1.6.2"
+#define TIPC_MOD_VER "1.6.3"
 
 #ifndef CONFIG_TIPC_ZONES
 #define CONFIG_TIPC_ZONES 3
Signature · 1 line
1.5.3.2
maintainer
#2 lore raw

Re: [PATCH 1/7 net-2.6.26] [TIPC]: Update version to 1.6.3

From: Allan Stephens <[email protected]>
Date: Tue, 4 Mar 2008 16:20:13 -0500

Quoted 3 lines

This patch updates TIPC's version number to 1.6.3.

You should bump version numbers after actually making changes. What if I didn't like the rest of your patch set, and I only applied this one?

#3 lore raw

RE: [PATCH 1/7 net-2.6.26] [TIPC]: Update version to 1.6.3

That's a good point. I'll include this as the last patch when I resubmit (since it turned out you really didn't like the rest of the patch set).

-- Al

-----Original Message-----
From: David Miller [mailto:[email protected]]
Sent: Tuesday, March 04, 2008 4:41 PM
To: Stephens, Allan
Cc: [email protected]
Subject: Re: [PATCH 1/7 net-2.6.26] [TIPC]: Update version to 1.6.3

From: Allan Stephens <[email protected]>
Date: Tue, 4 Mar 2008 16:20:13 -0500

Quoted 3 lines

This patch updates TIPC's version number to 1.6.3.

You should bump version numbers after actually making changes. What if I didn't like the rest of your patch set, and I only applied this one?

maintainer
#4 lore raw

Re: [PATCH 1/7 net-2.6.26] [TIPC]: Update version to 1.6.3

From: "Stephens, Allan" <[email protected]>
Date: Tue, 4 Mar 2008 14:01:34 -0800

Quoted 2 lines

That's a good point. I'll include this as the last patch when I resubmit

Thanks.

Hopefully it'll all be good this time around.

#5 lore raw

PATCH 2/7 : Add argument validation for shutdown()

In reply to Allan Stephens

This patch validates that the "how" argument to shutdown() is SHUT_RDWR, since this is the only form that TIPC supports.

---
 net/tipc/socket.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
net/tipc/socket.c +3 -2
index 2290903..8677da7 100644
@@ -1419,7 +1419,7 @@ exit:
 /**
  * shutdown - shutdown socket connection
  * @sock: socket structure
- * @how: direction to close (unused; always treated as read + write)
+ * @how: direction to close (must be SHUT_RDWR)
  *
  * Terminates connection (if necessary), then purges socket's receive queue.
  *
@@ -1432,7 +1432,8 @@ static int shutdown(struct socket *sock, int how)
 	struct sk_buff *buf;
 	int res;
 
-	/* Could return -EINVAL for an invalid "how", but why bother? */
+	if (how != SHUT_RDWR)
+		return -EINVAL;
 
 	if (down_interruptible(&tsock->sem))
 		return -ERESTARTSYS;
Signature · 1 line
1.5.3.2
maintainer
#6 lore raw

Re: [PATCH 2/7 net-2.6.26] [TIPC]: Add argument validation for shutdown()

From: Allan Stephens <[email protected]>
Date: Tue, 4 Mar 2008 16:20:14 -0500

Quoted 4 lines

This patch validates that the "how" argument to shutdown() is SHUT_RDWR, since this is the only form that TIPC supports.

You really didn't generate this patch against the current net-2.6.26 tree:

davem@sunset:~/src/GIT/net-2.6.26$ pcheck diff
+ git apply --check --whitespace=error-all diff
error: patch failed: net/tipc/socket.c:1432
error: net/tipc/socket.c: patch does not apply

The line numbers are all off. Likely you generated this against a net-2.6.26 tree from before the semaphore-->mutex TIPC changeset went in, throwing all the line numbers off.

I'm not looking at the rest of your patches, sorry.

#7 lore raw

RE: [PATCH 2/7 net-2.6.26] [TIPC]: Add argument validation for shutdown()

Arrgh! You're right, Dave. I was concentrating on fixing the problems with my email client and let things get out of sync. I'll fix 'em up and resubmit.

-- Al

-----Original Message-----
From: David Miller [mailto:[email protected]]
Sent: Tuesday, March 04, 2008 4:44 PM
To: Stephens, Allan
Cc: [email protected]
Subject: Re: [PATCH 2/7 net-2.6.26] [TIPC]: Add argument validation for shutdown()

From: Allan Stephens <[email protected]>
Date: Tue, 4 Mar 2008 16:20:14 -0500

Quoted 4 lines

This patch validates that the "how" argument to shutdown() is SHUT_RDWR, since this is the only form that TIPC supports.

You really didn't generate this patch against the current net-2.6.26 tree:

davem@sunset:~/src/GIT/net-2.6.26$ pcheck diff
+ git apply --check --whitespace=error-all diff
error: patch failed: net/tipc/socket.c:1432
error: net/tipc/socket.c: patch does not apply

The line numbers are all off. Likely you generated this against a net-2.6.26 tree from before the semaphore-->mutex TIPC changeset went in, throwing all the line numbers off.

I'm not looking at the rest of your patches, sorry.

#8 lore raw

PATCH 3/7 : Eliminate "sparse" symbol warnings

In reply to Allan Stephens

This patch eliminates warnings about undeclared symbols.

---
 include/net/tipc/tipc_bearer.h |   10 ++++++++++
 net/tipc/core.c                |    9 ---------
 net/tipc/core.h                |    7 +++++++
 3 files changed, 17 insertions(+), 9 deletions(-)
include/net/tipc/tipc_bearer.h +10 -0
index 2151a80..3eb02fd 100644
@@ -100,6 +100,10 @@ struct tipc_bearer {
 };
 
 
+/*
+ * TIPC routines available to supported media types
+ */
+
 int  tipc_register_media(u32 media_type,
 			 char *media_name, 
 			 int (*enable)(struct tipc_bearer *), 
@@ -123,6 +127,12 @@ void tipc_continue(struct tipc_bearer *tb_ptr);
 int tipc_enable_bearer(const char *bearer_name, u32 bcast_scope, u32 priority);
 int tipc_disable_bearer(const char *name);
 
+/*
+ * Routines made available to TIPC by supported media types
+ */
+
+int  tipc_eth_media_start(void);
+void tipc_eth_media_stop(void);
 
 #endif
 
net/tipc/core.c +0 -9
index 9b9429e..10209ec 100644
@@ -48,15 +48,6 @@
 #include "subscr.h"
 #include "config.h"
 
-int  tipc_eth_media_start(void);
-void tipc_eth_media_stop(void);
-int  tipc_handler_start(void);
-void tipc_handler_stop(void);
-int  tipc_socket_init(void);
-void tipc_socket_stop(void);
-int  tipc_netlink_start(void);
-void tipc_netlink_stop(void);
-
 #define TIPC_MOD_VER "1.6.3"
 
 #ifndef CONFIG_TIPC_ZONES
net/tipc/core.h +7 -0
index feabca5..bc3f384 100644
@@ -180,6 +180,13 @@ extern int  tipc_core_start(void);
 extern void tipc_core_stop(void);
 extern int  tipc_core_start_net(void);
 extern void tipc_core_stop_net(void);
+extern int  tipc_handler_start(void);
+extern void tipc_handler_stop(void);
+extern int  tipc_netlink_start(void);
+extern void tipc_netlink_stop(void);
+extern int  tipc_socket_init(void);
+extern void tipc_socket_stop(void);
+
 
 static inline int delimit(int val, int min, int max)
 {
Signature · 1 line
1.5.3.2
#9 lore raw

PATCH 4/7 : Minor cleanup of message header code

In reply to Allan Stephens

This patch eliminates some unused or duplicate message header symbols, and fixes up the comments and/or location of a few other symbols.

---
 net/tipc/link.c |   16 ++++++++--------
 net/tipc/msg.c  |   16 ++++++++--------
 net/tipc/msg.h  |   19 ++++++++-----------
 net/tipc/port.c |    5 +++--
 4 files changed, 27 insertions(+), 29 deletions(-)
net/tipc/link.c +8 -8
index 1b17fec..9d6b315 100644
@@ -2832,15 +2832,15 @@ static void link_set_supervision_props(struct link *l_ptr, u32 tolerance)
 void tipc_link_set_queue_limits(struct link *l_ptr, u32 window)
 {
 	/* Data messages from this node, inclusive FIRST_FRAGM */
-	l_ptr->queue_limit[DATA_LOW] = window;
-	l_ptr->queue_limit[DATA_MEDIUM] = (window / 3) * 4;
-	l_ptr->queue_limit[DATA_HIGH] = (window / 3) * 5;
-	l_ptr->queue_limit[DATA_CRITICAL] = (window / 3) * 6;
+	l_ptr->queue_limit[TIPC_LOW_IMPORTANCE] = window;
+	l_ptr->queue_limit[TIPC_MEDIUM_IMPORTANCE] = (window / 3) * 4;
+	l_ptr->queue_limit[TIPC_HIGH_IMPORTANCE] = (window / 3) * 5;
+	l_ptr->queue_limit[TIPC_CRITICAL_IMPORTANCE] = (window / 3) * 6;
 	/* Transiting data messages,inclusive FIRST_FRAGM */
-	l_ptr->queue_limit[DATA_LOW + 4] = 300;
-	l_ptr->queue_limit[DATA_MEDIUM + 4] = 600;
-	l_ptr->queue_limit[DATA_HIGH + 4] = 900;
-	l_ptr->queue_limit[DATA_CRITICAL + 4] = 1200;
+	l_ptr->queue_limit[TIPC_LOW_IMPORTANCE + 4] = 300;
+	l_ptr->queue_limit[TIPC_MEDIUM_IMPORTANCE + 4] = 600;
+	l_ptr->queue_limit[TIPC_HIGH_IMPORTANCE + 4] = 900;
+	l_ptr->queue_limit[TIPC_CRITICAL_IMPORTANCE + 4] = 1200;
 	l_ptr->queue_limit[CONN_MANAGER] = 1200;
 	l_ptr->queue_limit[ROUTE_DISTRIBUTOR] = 1200;
 	l_ptr->queue_limit[CHANGEOVER_PROTOCOL] = 2500;
net/tipc/msg.c +8 -8
index 7824854..696a863 100644
@@ -73,10 +73,10 @@ void tipc_msg_print(struct print_buf *buf, struct tipc_msg *msg, const char *str
 		tipc_printf(buf, "NO(%u/%u):",msg_long_msgno(msg),
 			    msg_fragm_no(msg));
 		break;
-	case DATA_LOW:
-	case DATA_MEDIUM:
-	case DATA_HIGH:
-	case DATA_CRITICAL:
+	case TIPC_LOW_IMPORTANCE:
+	case TIPC_MEDIUM_IMPORTANCE:
+	case TIPC_HIGH_IMPORTANCE:
+	case TIPC_CRITICAL_IMPORTANCE:
 		tipc_printf(buf, "DAT%u:", msg_user(msg));
 		if (msg_short(msg)) {
 			tipc_printf(buf, "CON:");
@@ -229,10 +229,10 @@ void tipc_msg_print(struct print_buf *buf, struct tipc_msg *msg, const char *str
 	switch (usr) {
 	case CONN_MANAGER:
 	case NAME_DISTRIBUTOR:
-	case DATA_LOW:
-	case DATA_MEDIUM:
-	case DATA_HIGH:
-	case DATA_CRITICAL:
+	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)) {
net/tipc/msg.h +8 -11
index e9ef6df..282e916 100644
@@ -40,18 +40,16 @@
 #include "core.h"
 
 #define TIPC_VERSION              2
-#define DATA_LOW                  TIPC_LOW_IMPORTANCE
-#define DATA_MEDIUM               TIPC_MEDIUM_IMPORTANCE
-#define DATA_HIGH                 TIPC_HIGH_IMPORTANCE
-#define DATA_CRITICAL             TIPC_CRITICAL_IMPORTANCE
-#define SHORT_H_SIZE              24	/* Connected,in cluster */
+
+#define SHORT_H_SIZE              24	/* Connected, in-cluster messages */
 #define DIR_MSG_H_SIZE            32	/* Directly addressed messages */
-#define CONN_MSG_H_SIZE           36	/* Routed connected msgs*/
-#define LONG_H_SIZE               40	/* Named Messages */
+#define LONG_H_SIZE               40	/* Named messages */
 #define MCAST_H_SIZE              44	/* Multicast messages */
-#define MAX_H_SIZE                60	/* Inclusive full options */
+#define INT_H_SIZE                40	/* Internal messages */
+#define MIN_H_SIZE                24	/* Smallest legal TIPC header size */
+#define MAX_H_SIZE                60	/* Largest possible TIPC header size */
+
 #define MAX_MSG_SIZE (MAX_H_SIZE + TIPC_MAX_USER_MSG_SIZE)
-#define LINK_CONFIG               13
 
 
 /*
@@ -97,7 +95,7 @@ static inline u32 msg_user(struct tipc_msg *m)
 
 static inline u32 msg_isdata(struct tipc_msg *m)
 {
-	return (msg_user(m) <= DATA_CRITICAL);
+	return (msg_user(m) <= TIPC_CRITICAL_IMPORTANCE);
 }
 
 static inline void msg_set_user(struct tipc_msg *m, u32 n)
@@ -388,7 +386,6 @@ static inline void msg_expand(struct tipc_msg *m, u32 destnode)
 #define  NAME_DISTRIBUTOR     11
 #define  MSG_FRAGMENTER       12
 #define  LINK_CONFIG          13
-#define  INT_H_SIZE           40
 #define  DSC_H_SIZE           40
 
 /*
net/tipc/port.c +3 -2
index f508614..6ec82e0 100644
@@ -242,7 +242,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, DATA_LOW, TIPC_NAMED_MSG, TIPC_OK, LONG_H_SIZE, 0);
+	msg_init(msg, TIPC_LOW_IMPORTANCE, TIPC_NAMED_MSG, TIPC_OK, LONG_H_SIZE,
+		 0);
 	msg_set_orignode(msg, tipc_own_addr);
 	msg_set_prevnode(msg, tipc_own_addr);
 	msg_set_origport(msg, ref);
@@ -632,7 +633,7 @@ void tipc_port_recv_proto_msg(struct sk_buff *buf)
 					     msg_orignode(msg),
 					     msg_destport(msg),
 					     tipc_own_addr,
-					     DATA_HIGH,
+					     TIPC_HIGH_IMPORTANCE,
 					     TIPC_CONN_MSG,
 					     err,
 					     0,
Signature · 1 line
1.5.3.2
#10 lore raw

PATCH 5/7 : Use correct bitmask when setting version

In reply to Allan Stephens

This patch ensures that the 3-bit version field of the TIPC message header is masked correctly when written into a message.

---
 net/tipc/msg.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net/tipc/msg.h +1 -1
index 282e916..e3a7392 100644
@@ -85,7 +85,7 @@ static inline u32 msg_version(struct tipc_msg *m)
 
 static inline void msg_set_version(struct tipc_msg *m)
 {
-	msg_set_bits(m, 0, 29, 0xf, TIPC_VERSION);
+	msg_set_bits(m, 0, 29, 7, TIPC_VERSION);
 }
 
 static inline u32 msg_user(struct tipc_msg *m)
Signature · 1 line
1.5.3.2
#11 lore raw

PATCH 6/7 : Enhancements to message header writing

In reply to Allan Stephens

This patch makes two enhancements to the routine used to set bit fields within a TIPC message header:

1) It now ignores any bits of the new field value that are not covered by the mask being used. (Previously, if the new value exceeded the size of the mask the extra bits could corrupt other fields in the message header word being updated.)

2) The code has been optimized to minimize the number of run-time endianness conversion operations by leveraging the fact that the mask (and, in some cases, the value as well) is constant and the necessary conversion can be performed by the compiler.

---
 net/tipc/msg.h |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
net/tipc/msg.h +4 -2
index e3a7392..5afa60b 100644
@@ -70,8 +70,10 @@ static inline void msg_set_bits(struct tipc_msg *m, u32 w,
 				u32 pos, u32 mask, u32 val)
 {
 	val = (val & mask) << pos;
-	m->hdr[w] &= ~htonl(mask << pos);
-	m->hdr[w] |= htonl(val);
+	val = htonl(val);
+	mask = htonl(mask << pos);
+	m->hdr[w] &= ~mask;
+	m->hdr[w] |= val;
 }
 
 /*
Signature · 1 line
1.5.3.2
#12 lore raw

PATCH 7/7 : Removal of message header option code

In reply to Allan Stephens

This patch removes code associated with optional, user-specified fields of the TIPC message header. Such fields were never utilized by TIPC, and have now been removed from the protocol specification.

---
 include/net/tipc/tipc_port.h |    7 -------
 net/tipc/core.c              |    1 -
 net/tipc/msg.h               |   23 -----------------------
 net/tipc/port.c              |    7 -------
 4 files changed, 0 insertions(+), 38 deletions(-)
include/net/tipc/tipc_port.h +0 -7
index cfc4ba4..c9b36b7 100644
@@ -86,13 +86,6 @@ u32 tipc_createport_raw(void *usr_handle,
 			void (*wakeup)(struct tipc_port *),
 			const u32 importance);
 
-/*
- * tipc_set_msg_option(): port must be locked.
- */
-int tipc_set_msg_option(struct tipc_port *tp_ptr,
-			const char *opt,
-			const u32 len);
-
 int tipc_reject_msg(struct sk_buff *buf, u32 err);
 
 int tipc_send_buf_fast(struct sk_buff *buf, u32 destnode);
net/tipc/core.c +0 -1
index 10209ec..e28e189 100644
@@ -268,7 +268,6 @@ EXPORT_SYMBOL(tipc_register_media);
 /* TIPC API for external APIs (see tipc_port.h) */
 
 EXPORT_SYMBOL(tipc_createport_raw);
-EXPORT_SYMBOL(tipc_set_msg_option);
 EXPORT_SYMBOL(tipc_reject_msg);
 EXPORT_SYMBOL(tipc_send_buf_fast);
 EXPORT_SYMBOL(tipc_acknowledge);
net/tipc/msg.h +0 -23
index 5afa60b..6ad070d 100644
@@ -190,18 +190,6 @@ static inline void msg_set_lookup_scope(struct tipc_msg *m, u32 n)
 	msg_set_bits(m, 1, 19, 0x3, n);
 }
 
-static inline void msg_set_options(struct tipc_msg *m, const char *opt, u32 sz)
-{
-	u32 hsz = msg_hdr_sz(m);
-	char *to = (char *)&m->hdr[hsz/4];
-
-	if ((hsz < DIR_MSG_H_SIZE) || ((hsz + sz) > MAX_H_SIZE))
-		return;
-	msg_set_bits(m, 1, 16, 0x7, (hsz - 28)/4);
-	msg_set_hdr_sz(m, hsz + sz);
-	memcpy(to, opt, sz);
-}
-
 static inline u32 msg_bcast_ack(struct tipc_msg *m)
 {
 	return msg_bits(m, 1, 0, 0xffff);
@@ -330,17 +318,6 @@ static inline struct tipc_msg *msg_get_wrapped(struct tipc_msg *m)
 	return (struct tipc_msg *)msg_data(m);
 }
 
-static inline void msg_expand(struct tipc_msg *m, u32 destnode)
-{
-	if (!msg_short(m))
-		return;
-	msg_set_hdr_sz(m, LONG_H_SIZE);
-	msg_set_orignode(m, msg_prevnode(m));
-	msg_set_destnode(m, destnode);
-	memset(&m->hdr[8], 0, 12);
-}
-
-
 
 /*
 		TIPC internal message header format, version 2
net/tipc/port.c +0 -7
index 6ec82e0..e2646a9 100644
@@ -414,13 +414,6 @@ static struct sk_buff *port_build_proto_msg(u32 destport, u32 destnode,
 	return buf;
 }
 
-int tipc_set_msg_option(struct tipc_port *tp_ptr, const char *opt, const u32 sz)
-{
-	msg_expand(&tp_ptr->phdr, msg_destnode(&tp_ptr->phdr));
-	msg_set_options(&tp_ptr->phdr, opt, sz);
-	return TIPC_OK;
-}
-
 int tipc_reject_msg(struct sk_buff *buf, u32 err)
 {
 	struct tipc_msg *msg = buf_msg(buf);
Signature · 1 line
1.5.3.2