: Initial patch set for TIPC 1.6.3
Subsystems (3)
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 | 9 +++++++ include/net/tipc/tipc_port.h | 7 ------ net/tipc/core.c | 11 +-------- net/tipc/core.h | 6 +++++ 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, 51 insertions(+), 81 deletions(-)
Allan Stephens (7):
[TIPC]: Removal of message header option code [TIPC]: Add argument validation for shutdown() [TIPC]: Eliminate "sparse" symbol warnings [TIPC]: Minor cleanup of message header code [TIPC]: Use correct bitmask when setting version [TIPC]: Enhancements to message header writing [TIPC]: Update version to 1.6.3
Thanks,
Al
PATCH 1/7 : Removal of message header option code
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
@@ -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
@@ -277,7 +277,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
@@ -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
@@ -413,13 +413,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
PATCH 2/7 : Add argument validation for shutdown()
In reply to Allan StephensThis 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
@@ -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 (mutex_lock_interruptible (&tsock->lock))return -ERESTARTSYS ;
Signature · 1 line
1.5.3.2
PATCH 3/7 : Eliminate "sparse" symbol warnings
In reply to Allan StephensThis patch eliminates warnings about undeclared symbols.
--- include/net/tipc/tipc_bearer.h | 9 +++++++++ net/tipc/core.c | 8 -------- net/tipc/core.h | 6 ++++++ 3 files changed, 15 insertions(+), 8 deletions(-)
include/net/tipc/tipc_bearer.h +9 -0
@@ -99,6 +99,9 @@ struct tipc_bearer {char name[TIPC_MAX_BEARER_NAME ]; }; +/* +* TIPC routines available to supported media types +*/ int tipc_register_media(u32 media_type, char *media_name,
@@ -123,6 +126,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 -8
@@ -48,14 +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.2"
net/tipc/core.h +6 -0
@@ -180,6 +180,12 @@ 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
PATCH 4/7 : Minor cleanup of message header code
In reply to Allan StephensThis 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
@@ -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
@@ -73,10 +73,10 @@ void tipc_msg_print(struct print_buf *buf, struct tipc_msg *msg, const char *strtipc_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 *strswitch (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
@@ -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)
@@ -365,7 +363,6 @@ static inline struct tipc_msg *msg_get_wrapped(struct tipc_msg *m)#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
@@ -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);
@@ -625,7 +626,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
PATCH 5/7 : Use correct bitmask when setting version
In reply to Allan StephensThis 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
@@ -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
PATCH 6/7 : Enhancements to message header writing
In reply to Allan StephensThis 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
@@ -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
PATCH 7/7 : Update version to 1.6.3
In reply to Allan StephensThis 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
@@ -49,7 +49,7 @@#include "config.h" -#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
Re: [PATCH 1/7 net-2.6.26] [TIPC]: Removal of message header option code
In reply to Allan StephensFrom: Allan Stephens <[email protected]>
Date: Thu, 6 Mar 2008 16:34:23 -0500
Quoted 6 lines
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.
Signed-off-by Allan Stephens <[email protected]>
Applied.
Re: [PATCH 2/7 net-2.6.26] [TIPC]: Add argument validation for shutdown()
In reply to Allan StephensFrom: Allan Stephens <[email protected]>
Date: Thu, 6 Mar 2008 16:34:24 -0500
Quoted 4 lines
This patch validates that the "how" argument to
shutdown()isSHUT_RDWR, since this is the only form that TIPC supports.Signed-off-by Allan Stephens <[email protected]>
Applied.
Re: [PATCH 3/7 net-2.6.26] [TIPC]: Eliminate "sparse" symbol warnings
In reply to Allan StephensFrom: Allan Stephens <[email protected]>
Date: Thu, 6 Mar 2008 16:34:25 -0500
Quoted 3 lines
This patch eliminates warnings about undeclared symbols.
Signed-off-by Allan Stephens <[email protected]>
Applied.
Re: [PATCH 4/7 net-2.6.26] [TIPC]: Minor cleanup of message header code
In reply to Allan StephensFrom: Allan Stephens <[email protected]>
Date: Thu, 6 Mar 2008 16:34:26 -0500
Quoted 5 lines
This patch eliminates some unused or duplicate message header symbols, and fixes up the comments and/or location of a few other symbols.
Signed-off-by Allan Stephens <[email protected]>
Applied.
Re: [PATCH 5/7 net-2.6.26] [TIPC]: Use correct bitmask when setting version
In reply to Allan StephensFrom: Allan Stephens <[email protected]>
Date: Thu, 6 Mar 2008 16:34:27 -0500
Quoted 4 lines
This patch ensures that the 3-bit version field of the TIPC message header is masked correctly when written into a message.
Signed-off-by Allan Stephens <[email protected]>
Applied.
Re: [PATCH 6/7 net-2.6.26] [TIPC]: Enhancements to message header writing
In reply to Allan StephensFrom: Allan Stephens <[email protected]>
Date: Thu, 6 Mar 2008 16:34:28 -0500
Quoted 8 lines
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.)
Quoted 6 lines
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.
Signed-off-by Allan Stephens <[email protected]>
Applied.
David Miller
maintainerFrom: Allan Stephens <[email protected]>
Date: Thu, 6 Mar 2008 16:34:22 -0500
Quoted 3 lines
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.
All applied, thanks Allan.