tipc: misc updates for 3.7
Subsystems (3)
cover tipc: misc updates for 3.7
This series gets some more largely trivial things out of the way. Most interesting are:
1) fix lockdep splat from bearer init by pushing the setup off to schedule_work.
2) simplification of configuration by removal of a couple of tuning knobs which used to have low default values.
The remainder are largely innocuous, I think. I did wonder if there was an alternate/better way to handle the splat though.
I've done my own local testing of this series on today's net-next commit 2ea214929d601 ("Merge branch 'for-davem' ... wireless-next")
I'll wait a couple of days to allow for any possible feedback and change requests, and then send a pull request after that.
Thanks,
Paul.
---
Ying Xue (9):
tipc: optimize the initialization of network device notifier
tipc: fix lockdep warning during bearer initialization
tipc: remove pointless name sanity check and tipc_alphabet array
tipc: manually inline single use media_name_valid routine
tipc: change tipc_net_start routine return value type
tipc: convert tipc_nametbl_size type from variable to macro
tipc: add __read_mostly annotations to several global variables
tipc: eliminate configuration for maximum number of name subscriptions
tipc: eliminate configuration for maximum number of name publications
include/linux/tipc_config.h | 8 ++++---- net/tipc/bearer.c | 21 ++------------------ net/tipc/config.c | 48 +++++---------------------------------------- net/tipc/core.c | 22 +++++++-------------- net/tipc/core.h | 18 ++++++++--------- net/tipc/eth_media.c | 29 +++++++++++++++++++++++---- net/tipc/handler.c | 2 +- net/tipc/link.c | 4 +--- net/tipc/name_table.c | 14 ++++++------- net/tipc/net.c | 3 +-- net/tipc/net.h | 2 +- net/tipc/subscr.c | 4 ++-- 12 files changed, 64 insertions(+), 111 deletions(-)
Signature · 1 line
1.7.11.1
PATCH 2/9 tipc: fix lockdep warning during bearer initialization
From: Ying Xue <[email protected]>
When the lockdep validator is enabled, it will report the below warning when we enable a TIPC bearer:
[ INFO: possible irq lock inversion dependency detected ]
---------------------------------------------------------
Possible interrupt unsafe locking scenario:
CPU0 CPU1
---- ----
lock(ptype_lock);
local_irq_disable();
lock(tipc_net_lock);
lock(ptype_lock); <Interrupt>
lock(tipc_net_lock);
*** DEADLOCK ***
the shortest dependencies between 2nd lock and 1st lock:
-> (ptype_lock){+.+...} ops: 10 {
[...]
SOFTIRQ-ON-W at:
[<c1089418>] __lock_acquire+0x528/0x13e0
[<c108a360>] lock_acquire+0x90/0x100
[<c1553c38>] _raw_spin_lock+0x38/0x50
[<c14651ca>] dev_add_pack+0x3a/0x60
[<c182da75>] arp_init+0x1a/0x48
[<c182dce5>] inet_init+0x181/0x27e
[<c1001114>] do_one_initcall+0x34/0x170
[<c17f7329>] kernel_init+0x110/0x1b2
[<c155b6a2>] kernel_thread_helper+0x6/0x10
[...]
... key at: [<c17e4b10>] ptype_lock+0x10/0x20
... acquired at:
[<c108a360>] lock_acquire+0x90/0x100
[<c1553c38>] _raw_spin_lock+0x38/0x50
[<c14651ca>] dev_add_pack+0x3a/0x60
[<c8bc18d2>] enable_bearer+0xf2/0x140 [tipc]
[<c8bb283a>] tipc_enable_bearer+0x1ba/0x450 [tipc]
[<c8bb3a04>] tipc_cfg_do_cmd+0x5c4/0x830 [tipc]
[<c8bbc032>] handle_cmd+0x42/0xd0 [tipc]
[<c148e802>] genl_rcv_msg+0x232/0x280
[<c148d3f6>] netlink_rcv_skb+0x86/0xb0
[<c148e5bc>] genl_rcv+0x1c/0x30
[<c148d144>] netlink_unicast+0x174/0x1f0
[<c148ddab>] netlink_sendmsg+0x1eb/0x2d0
[<c1456bc1>] sock_aio_write+0x161/0x170
[<c1135a7c>] do_sync_write+0xac/0xf0
[<c11360f6>] vfs_write+0x156/0x170
[<c11361e2>] sys_write+0x42/0x70
[<c155b0df>] sysenter_do_call+0x12/0x38[...]
}
-> (tipc_net_lock){+..-..} ops: 4 {
[...]
IN-SOFTIRQ-R at:
[<c108953a>] __lock_acquire+0x64a/0x13e0
[<c108a360>] lock_acquire+0x90/0x100
[<c15541cd>] _raw_read_lock_bh+0x3d/0x50
[<c8bb874d>] tipc_recv_msg+0x1d/0x830 [tipc]
[<c8bc195f>] recv_msg+0x3f/0x50 [tipc]
[<c146a5fa>] __netif_receive_skb+0x22a/0x590
[<c146ab0b>] netif_receive_skb+0x2b/0xf0
[<c13c43d2>] pcnet32_poll+0x292/0x780
[<c146b00a>] net_rx_action+0xfa/0x1e0
[<c103a4be>] __do_softirq+0xae/0x1e0[...]
}
Quoted 1 line
From the log, we can see three different call chains between
CPU0 and CPU1:
Time 0 on CPU0:
kernel_init()->inet_init()->dev_add_pack()
At time 0, the ptype_lock is held by CPU0 in dev_add_pack();
Time 1 on CPU1:
tipc_enable_bearer()->enable_bearer()->dev_add_pack()
At time 1, tipc_enable_bearer() first holds tipc_net_lock, and then wants to take ptype_lock to register TIPC protocol handler into the networking stack. But the ptype_lock has been taken by dev_add_pack() on CPU0, so at this time the dev_add_pack() running on CPU1 has to be busy looping.
Time 2 on CPU0:
netif_receive_skb()->recv_msg()->tipc_recv_msg()
At time 2, an incoming TIPC packet arrives at CPU0, hence tipc_recv_msg() will be invoked. In tipc_recv_msg(), it first wants to hold tipc_net_lock. At the moment, below scenario happens:
On CPU0, below is our sequence of taking locks:
lock(ptype_lock)->lock(tipc_net_lock)
On CPU1, our sequence of taking locks looks like:
lock(tipc_net_lock)->lock(ptype_lock)
Obviously deadlock may happen in this case.
But please note the deadlock possibly doesn't occur at all when the first TIPC bearer is enabled. Before enable_bearer() -- running on CPU1 does not hold ptype_lock, so the TIPC receive handler (i.e. recv_msg()) is not registered successfully via dev_add_pack(), so the tipc_recv_msg() cannot be called by recv_msg() even if a TIPC message comes to CPU0. But when the second TIPC bearer is registered, the deadlock can perhaps really happen.
To fix it, we will push the work of registering TIPC protocol handler into workqueue context. After the change, both paths taking ptype_lock are always in process contexts, thus, the deadlock should never occur.
--- net/tipc/eth_media.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
net/tipc/eth_media.c +15 -1
@@ -46,12 +46,14 @@* @bearer: ptr to associated "generic" bearer structure * @dev: ptr to associated Ethernet network device * @tipc_packet_type: used in binding TIPC to Ethernet driver +* @setup: work item used when enabling bearer * @cleanup: work item used when disabling bearer */ struct eth_bearer {struct tipc_bearer *bearer;struct net_device *dev;struct packet_type tipc_packet_type; +struct work_struct setup;struct work_struct cleanup; };
@@ -143,6 +145,17 @@ static int recv_msg(struct sk_buff *buf, struct net_device *dev, }/** +* setup_bearer - setup association between Ethernet bearer and interface +*/ +static void setup_bearer (struct work_struct *work) +{ +struct eth_bearer *eb_ptr = + container_of(work, struct eth_bearer, setup); + +dev_add_pack (&eb_ptr->tipc_packet_type); +} + +/** * enable_bearer - attach TIPC bearer to an Ethernet interface */ static int enable_bearer (struct tipc_bearer *tb_ptr)
@@ -182,7 +195,8 @@ static int enable_bearer(struct tipc_bearer *tb_ptr) eb_ptr->tipc_packet_type.func = recv_msg; eb_ptr->tipc_packet_type.af_packet_priv = eb_ptr;INIT_LIST_HEAD (&(eb_ptr->tipc_packet_type.list)); -dev_add_pack (&eb_ptr->tipc_packet_type); +INIT_WORK (&eb_ptr->setup, setup_bearer); +schedule_work (&eb_ptr->setup);/* Associate TIPC bearer with Ethernet bearer */ eb_ptr->bearer = tb_ptr;
Signature · 1 line
1.7.11.1
PATCH 3/9 tipc: remove pointless name sanity check and tipc_alphabet array
In reply to Paul GortmakerFrom: Ying Xue <[email protected]>
There is no real reason to check whether all letters in the given media name and network interface name are within the character set defined in tipc_alphabet array. Even if we eliminate the checking, the rest of checking conditions in tipc_enable_bearer() can ensure we do not enable an invalid or illegal bearer.
--- net/tipc/bearer.c | 6 ++---- net/tipc/core.c | 3 --- net/tipc/core.h | 2 -- net/tipc/link.c | 4 +--- 4 files changed, 3 insertions(+), 12 deletions(-)
net/tipc/bearer.c +2 -4
@@ -60,7 +60,7 @@ static int media_name_valid(const char *name) len =strlen (name);if ((len +1 ) >TIPC_MAX_MEDIA_NAME )return 0 ; -return strspn (name, tipc_alphabet) == len; +return 1 ; }/**
@@ -206,9 +206,7 @@ static int bearer_name_validate(const char *name,/* validate component parts of bearer name */ if ((media_len <=1 ) || (media_len >TIPC_MAX_MEDIA_NAME ) || - (if_len <=1 ) || (if_len >TIPC_MAX_IF_NAME ) || - (strspn (media_name, tipc_alphabet) != (media_len -1 )) || - (strspn (if_name, tipc_alphabet) != (if_len -1 ))) + (if_len <=1 ) || (if_len >TIPC_MAX_IF_NAME ))return 0 ;/* return bearer name components, if necessary */
net/tipc/core.c +0 -3
@@ -50,9 +50,6 @@/* global variables used by multiple sub-systems within TIPC */ int tipc_random; -const char tipc_alphabet[] = -"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_." ; -/* configurable TIPC parameters */ u32 tipc_own_addr;int tipc_max_ports;
net/tipc/core.h +0 -2
@@ -85,8 +85,6 @@ extern int tipc_remote_management;* Other global variables */ extern int tipc_random; -extern const char tipc_alphabet[]; -/* * Routines available to privileged subsystems
net/tipc/link.c +1 -3
@@ -210,9 +210,7 @@ static int link_name_validate(const char *name, (z_local >255 ) || (c_local >4095 ) || (n_local >4095 ) || (z_peer >255 ) || (c_peer >4095 ) || (n_peer >4095 ) || (if_local_len <=1 ) || (if_local_len >TIPC_MAX_IF_NAME ) || - (if_peer_len <=1 ) || (if_peer_len >TIPC_MAX_IF_NAME ) || - (strspn (if_local, tipc_alphabet) != (if_local_len -1 )) || - (strspn(if_peer, tipc_alphabet) != (if_peer_len - 1))) + (if_peer_len <= 1) || (if_peer_len > TIPC_MAX_IF_NAME)) return 0;/* return link name components, if necessary */
Signature · 1 line
1.7.11.1
PATCH 1/9 tipc: optimize the initialization of network device notifier
In reply to Paul GortmakerFrom: Ying Xue <[email protected]>
Ethernet media initialization is only done when TIPC is started or switched to network mode. So the initialization of the network device notifier structure can be moved out of this function and done statically instead.
--- net/tipc/eth_media.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
net/tipc/eth_media.c +10 -3
@@ -58,7 +58,16 @@ struct eth_bearer {static struct tipc_media eth_media_info;static struct eth_bearer eth_bearers[MAX_ETH_BEARERS ];static int eth_started; -static struct notifier_block notifier; + +static int recv_notification (struct notifier_block *nb,unsigned long evt, +void *dv); +/* +* Network device notifier info +*/ +static struct notifier_block notifier = { + .notifier_call = recv_notification, + .priority =0 +};/** * eth_media_addr_set - initialize Ethernet media address structure
@@ -357,8 +366,6 @@ int tipc_eth_media_start(void)if (res)return res; - notifier.notifier_call = &recv_notification; - notifier.priority =0 ; res =register_netdevice_notifier (¬ifier);if (!res) eth_started =1 ;
Signature · 1 line
1.7.11.1
PATCH 4/9 tipc: manually inline single use media_name_valid routine
In reply to Paul GortmakerFrom: Ying Xue <[email protected]>
After eliminating the mechanism which checks whether all letters in media name string are within a given character set, the media_name_valid routine becomes trivial. It is also only used once, so it is unnecessary to keep it as a separate function.
--- net/tipc/bearer.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-)
net/tipc/bearer.c +1 -16
@@ -49,21 +49,6 @@ struct tipc_bearer tipc_bearers[MAX_BEARERS];static void bearer_disable (struct tipc_bearer *b_ptr);/** -* media_name_valid - validate media name -* -* Returns 1 if media name is valid, otherwise 0. -*/ -static int media_name_valid (const char *name) -{ -u32 len; - - len =strlen (name); -if ((len +1 ) >TIPC_MAX_MEDIA_NAME ) -return 0 ; -return 1 ; -} - -/** * tipc_media_find - locates specified media object by name */ struct tipc_media *tipc_media_find (const char *name)
@@ -102,7 +87,7 @@ int tipc_register_media(struct tipc_media *m_ptr)write_lock_bh (&tipc_net_lock); -if (!media_name_valid (m_ptr->name)) +if ((strlen (m_ptr->name) +1 ) >TIPC_MAX_MEDIA_NAME ) goto exit;if ((m_ptr->bcast_addr.media_id != m_ptr->type_id) || !m_ptr->bcast_addr.broadcast)
Signature · 1 line
1.7.11.1
PATCH 5/9 tipc: change tipc_net_start routine return value type
In reply to Paul GortmakerFrom: Ying Xue <[email protected]>
Since now tipc_net_start() always returns a success code - 0, its return value type should be changed from integer to void, which can avoid unnecessary check for its return value.
--- net/tipc/core.c | 5 ++--- net/tipc/net.c | 3 +-- net/tipc/net.h | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-)
net/tipc/core.c +2 -3
@@ -98,9 +98,8 @@ int tipc_core_start_net(unsigned long addr) {int res; - res =tipc_net_start (addr); -if (!res) - res =tipc_eth_media_start (); +tipc_net_start (addr); + res =tipc_eth_media_start ();if (res)tipc_core_stop_net ();return res;
net/tipc/net.c +1 -2
@@ -171,7 +171,7 @@ void tipc_net_route_msg(struct sk_buff *buf)tipc_link_send (buf, dnode,msg_link_selector (msg)); } -int tipc_net_start (u32 addr) +void tipc_net_start (u32 addr) {char addr_string[16 ];
@@ -187,7 +187,6 @@ int tipc_net_start(u32 addr)pr_info ("Started in network mode\n" );pr_info ("Own node address %s, network identity %u\n" ,tipc_addr_string_fill (addr_string, tipc_own_addr), tipc_net_id); -return 0 ; }void tipc_net_stop (void )
net/tipc/net.h +1 -1
@@ -41,7 +41,7 @@ extern rwlock_t tipc_net_lock;void tipc_net_route_msg (struct sk_buff *buf); -int tipc_net_start (u32 addr); +void tipc_net_start (u32 addr);void tipc_net_stop (void );#endif
Signature · 1 line
1.7.11.1
PATCH 6/9 tipc: convert tipc_nametbl_size type from variable to macro
In reply to Paul GortmakerFrom: Ying Xue <[email protected]>
There is nothing changing this variable dynamically, so change it to a macro to make that more obvious when reading the code.
--- net/tipc/name_table.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
net/tipc/name_table.c +5 -5
@@ -41,7 +41,7 @@#include "subscr.h" #include "port.h" -static int tipc_nametbl_size =1024 ;/* must be a power of 2 */ +#define TIPC_NAMETBL_SIZE 1024/* must be a power of 2 */ /** * struct name_info - name sequence publication info
@@ -114,7 +114,7 @@ DEFINE_RWLOCK(tipc_nametbl_lock);static int hash (int x) { -return x & (tipc_nametbl_size -1 ); +return x & (TIPC_NAMETBL_SIZE -1 ); }/**
@@ -871,7 +871,7 @@ static int nametbl_list(char *buf, int len, u32 depth_info, ret +=nametbl_header (buf, len, depth); lowbound =0 ; upbound = ~0 ; -for (i =0 ; i < tipc_nametbl_size; i++) { +for (i =0 ; i <TIPC_NAMETBL_SIZE ; i++) { seq_head = &table.types[i];hlist_for_each_entry (seq, seq_node, seq_head, ns_list) { ret += nameseq_list(seq, buf + ret, len - ret,
@@ -935,7 +935,7 @@ struct sk_buff *tipc_nametbl_get(const void *req_tlv_area, int req_tlv_space)int tipc_nametbl_init (void ) { - table.types =kcalloc (tipc_nametbl_size,sizeof (struct hlist_head ), + table.types =kcalloc (TIPC_NAMETBL_SIZE ,sizeof (struct hlist_head ),GFP_ATOMIC );if (!table.types)return -ENOMEM ;
@@ -953,7 +953,7 @@ void tipc_nametbl_stop(void)/* Verify name table is empty, then release it */ write_lock_bh (&tipc_nametbl_lock); -for (i =0 ; i < tipc_nametbl_size; i++) { +for (i =0 ; i <TIPC_NAMETBL_SIZE ; i++) {if (hlist_empty (&table.types[i]))continue ;pr_err ("nametbl_stop(): orphaned hash chain detected\n" );
Signature · 1 line
1.7.11.1
PATCH 7/9 tipc: add __read_mostly annotations to several global variables
In reply to Paul GortmakerFrom: Ying Xue <[email protected]>
Added to the following:
- tipc_random
- tipc_own_addr
- tipc_max_ports
- tipc_net_id
- tipc_remote_management
- handler_enabled
The above global variables are read often, but written rarely. Use __read_mostly to prevent them being on the same cacheline as another variable which is written to often, which would cause cacheline bouncing.
--- net/tipc/core.c | 10 +++++----- net/tipc/core.h | 10 +++++----- net/tipc/handler.c | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-)
net/tipc/core.c +5 -5
@@ -48,15 +48,15 @@/* global variables used by multiple sub-systems within TIPC */ -int tipc_random; +int tipc_random__read_mostly ;/* configurable TIPC parameters */ -u32 tipc_own_addr; -int tipc_max_ports; +u32 tipc_own_addr__read_mostly ; +int tipc_max_ports__read_mostly ;int tipc_max_subscriptions;int tipc_max_publications; -int tipc_net_id; -int tipc_remote_management; +int tipc_net_id__read_mostly ; +int tipc_remote_management__read_mostly ;/**
net/tipc/core.h +5 -5
@@ -74,17 +74,17 @@ int tipc_snprintf(char *buf, int len, const char *fmt, ...);/* * Global configuration variables */ -extern u32 tipc_own_addr; -extern int tipc_max_ports; +extern u32 tipc_own_addr__read_mostly ; +extern int tipc_max_ports__read_mostly ;extern int tipc_max_subscriptions;extern int tipc_max_publications; -extern int tipc_net_id; -extern int tipc_remote_management; +extern int tipc_net_id__read_mostly ; +extern int tipc_remote_management__read_mostly ;/* * Other global variables */ -extern int tipc_random; +extern int tipc_random__read_mostly ;/* * Routines available to privileged subsystems
net/tipc/handler.c +1 -1
@@ -45,7 +45,7 @@ struct queue_item {static struct kmem_cache *tipc_queue_item_cache;static struct list_head signal_queue_head;static DEFINE_SPINLOCK (qitem_lock); -static int handler_enabled; +static int handler_enabled__read_mostly ;static void process_signal_queue (unsigned long dummy);
Signature · 1 line
1.7.11.1
PATCH 8/9 tipc: eliminate configuration for maximum number of name subscriptions
In reply to Paul GortmakerFrom: Ying Xue <[email protected]>
Gets rid of the need for users to specify the maximum number of name subscriptions supported by TIPC. TIPC now automatically provides support for the maximum number of name subscriptions to 65535.
--- include/linux/tipc_config.h | 4 ++-- net/tipc/config.c | 25 +++---------------------- net/tipc/core.c | 2 -- net/tipc/core.h | 4 ++-- net/tipc/subscr.c | 4 ++-- 5 files changed, 9 insertions(+), 30 deletions(-)
include/linux/tipc_config.h +2 -2
@@ -90,7 +90,7 @@#define TIPC_CMD_GET_REMOTE_MNG 0x4003/* tx none, rx unsigned */ #define TIPC_CMD_GET_MAX_PORTS 0x4004/* tx none, rx unsigned */ #define TIPC_CMD_GET_MAX_PUBL 0x4005/* tx none, rx unsigned */ -#define TIPC_CMD_GET_MAX_SUBSCR 0x4006/* tx none, rx unsigned */ +#define TIPC_CMD_GET_MAX_SUBSCR 0x4006/* obsoleted */ #define TIPC_CMD_GET_MAX_ZONES 0x4007/* obsoleted */ #define TIPC_CMD_GET_MAX_CLUSTERS 0x4008/* obsoleted */ #define TIPC_CMD_GET_MAX_NODES 0x4009/* obsoleted */
@@ -116,7 +116,7 @@#define TIPC_CMD_SET_REMOTE_MNG 0x8003/* tx unsigned, rx none */ #define TIPC_CMD_SET_MAX_PORTS 0x8004/* tx unsigned, rx none */ #define TIPC_CMD_SET_MAX_PUBL 0x8005/* tx unsigned, rx none */ -#define TIPC_CMD_SET_MAX_SUBSCR 0x8006/* tx unsigned, rx none */ +#define TIPC_CMD_SET_MAX_SUBSCR 0x8006/* obsoleted */ #define TIPC_CMD_SET_MAX_ZONES 0x8007/* obsoleted */ #define TIPC_CMD_SET_MAX_CLUSTERS 0x8008/* obsoleted */ #define TIPC_CMD_SET_MAX_NODES 0x8009/* obsoleted */
net/tipc/config.c +3 -22
@@ -2,7 +2,7 @@* net/tipc/config.c: TIPC configuration management code * * Copyright (c) 2002-2006, Ericsson AB -* Copyright (c) 2004-2007, 2010-2011, Wind River Systems +* Copyright (c) 2004-2007, 2010-2012, Wind River Systems * All rights reserved. * * Redistribution and use in source and binary forms, with or without
@@ -223,21 +223,6 @@ static struct sk_buff *cfg_set_max_publications(void)return tipc_cfg_reply_none (); } -static struct sk_buff *cfg_set_max_subscriptions (void ) -{ -u32 value; - -if (!TLV_CHECK (req_tlv_area, req_tlv_space,TIPC_TLV_UNSIGNED )) -return tipc_cfg_reply_error_string (TIPC_CFG_TLV_ERROR ); - - value =ntohl (*(__be32 *)TLV_DATA (req_tlv_area)); -if (value <1 || value >65535 ) -return tipc_cfg_reply_error_string (TIPC_CFG_INVALID_VALUE -" (max subscriptions must be 1-65535" ); - tipc_max_subscriptions = value; -return tipc_cfg_reply_none (); -} -static struct sk_buff *cfg_set_max_ports (void ) {u32 value;
@@ -360,9 +345,6 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_areacase TIPC_CMD_SET_MAX_PUBL : rep_tlv_buf =cfg_set_max_publications ();break ; -case TIPC_CMD_SET_MAX_SUBSCR : - rep_tlv_buf =cfg_set_max_subscriptions (); -break ;case TIPC_CMD_SET_NETID : rep_tlv_buf =cfg_set_netid ();break ;
@@ -375,9 +357,6 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_areacase TIPC_CMD_GET_MAX_PUBL : rep_tlv_buf =tipc_cfg_reply_unsigned (tipc_max_publications);break ; -case TIPC_CMD_GET_MAX_SUBSCR : - rep_tlv_buf =tipc_cfg_reply_unsigned (tipc_max_subscriptions); -break ;case TIPC_CMD_GET_NETID : rep_tlv_buf =tipc_cfg_reply_unsigned (tipc_net_id);break ;
@@ -393,6 +372,8 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_areacase TIPC_CMD_GET_MAX_CLUSTERS :case TIPC_CMD_SET_MAX_NODES :case TIPC_CMD_GET_MAX_NODES : +case TIPC_CMD_SET_MAX_SUBSCR : +case TIPC_CMD_GET_MAX_SUBSCR :case TIPC_CMD_SET_LOG_SIZE :case TIPC_CMD_DUMP_LOG : rep_tlv_buf = tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
net/tipc/core.c +0 -2
@@ -53,7 +53,6 @@ int tipc_random __read_mostly;/* configurable TIPC parameters */ u32 tipc_own_addr__read_mostly ;int tipc_max_ports__read_mostly ; -int tipc_max_subscriptions;int tipc_max_publications;int tipc_net_id__read_mostly ;int tipc_remote_management__read_mostly ;
@@ -157,7 +156,6 @@ static int __init tipc_init(void) tipc_own_addr =0 ; tipc_remote_management =1 ; tipc_max_publications =10000 ; - tipc_max_subscriptions =2000 ; tipc_max_ports =CONFIG_TIPC_PORTS ; tipc_net_id =4711 ;
net/tipc/core.h +2 -2
@@ -60,7 +60,8 @@#define TIPC_MOD_VER "2.0.0" -#define ULTRA_STRING_MAX_LEN 32768 +#define ULTRA_STRING_MAX_LEN 32768 +#define TIPC_MAX_SUBSCRIPTIONS 65535struct tipc_msg ;/* msg.h */
@@ -76,7 +77,6 @@ int tipc_snprintf(char *buf, int len, const char *fmt, ...);*/ extern u32 tipc_own_addr__read_mostly ;extern int tipc_max_ports__read_mostly ; -extern int tipc_max_subscriptions;extern int tipc_max_publications;extern int tipc_net_id__read_mostly ;extern int tipc_remote_management__read_mostly ;
net/tipc/subscr.c +2 -2
@@ -304,9 +304,9 @@ static struct tipc_subscription *subscr_subscribe(struct tipc_subscr *s, }/* Refuse subscription if global limit exceeded */ -if (atomic_read (&topsrv.subscription_count) >= tipc_max_subscriptions) { +if (atomic_read (&topsrv.subscription_count) >=TIPC_MAX_SUBSCRIPTIONS ) {pr_warn ("Subscription rejected, limit reached (%u)\n" , - tipc_max_subscriptions); +TIPC_MAX_SUBSCRIPTIONS );subscr_terminate (subscriber);return NULL ; }
Signature · 1 line
1.7.11.1
PATCH 9/9 tipc: eliminate configuration for maximum number of name publications
In reply to Paul GortmakerFrom: Ying Xue <[email protected]>
Gets rid of the need for users to specify the maximum number of name publications supported by TIPC. TIPC now automatically provides support for the maximum number of name publications to 65535.
--- include/linux/tipc_config.h | 4 ++-- net/tipc/config.c | 23 ++--------------------- net/tipc/core.c | 2 -- net/tipc/core.h | 2 +- net/tipc/name_table.c | 4 ++-- 5 files changed, 7 insertions(+), 28 deletions(-)
include/linux/tipc_config.h +2 -2
@@ -89,7 +89,7 @@#define TIPC_CMD_GET_REMOTE_MNG 0x4003/* tx none, rx unsigned */ #define TIPC_CMD_GET_MAX_PORTS 0x4004/* tx none, rx unsigned */ -#define TIPC_CMD_GET_MAX_PUBL 0x4005/* tx none, rx unsigned */ +#define TIPC_CMD_GET_MAX_PUBL 0x4005/* obsoleted */ #define TIPC_CMD_GET_MAX_SUBSCR 0x4006/* obsoleted */ #define TIPC_CMD_GET_MAX_ZONES 0x4007/* obsoleted */ #define TIPC_CMD_GET_MAX_CLUSTERS 0x4008/* obsoleted */
@@ -115,7 +115,7 @@#define TIPC_CMD_SET_NODE_ADDR 0x8001/* tx net_addr, rx none */ #define TIPC_CMD_SET_REMOTE_MNG 0x8003/* tx unsigned, rx none */ #define TIPC_CMD_SET_MAX_PORTS 0x8004/* tx unsigned, rx none */ -#define TIPC_CMD_SET_MAX_PUBL 0x8005/* tx unsigned, rx none */ +#define TIPC_CMD_SET_MAX_PUBL 0x8005/* obsoleted */ #define TIPC_CMD_SET_MAX_SUBSCR 0x8006/* obsoleted */ #define TIPC_CMD_SET_MAX_ZONES 0x8007/* obsoleted */ #define TIPC_CMD_SET_MAX_CLUSTERS 0x8008/* obsoleted */
net/tipc/config.c +2 -21
@@ -208,21 +208,6 @@ static struct sk_buff *cfg_set_remote_mng(void)return tipc_cfg_reply_none (); } -static struct sk_buff *cfg_set_max_publications (void ) -{ -u32 value; - -if (!TLV_CHECK (req_tlv_area, req_tlv_space,TIPC_TLV_UNSIGNED )) -return tipc_cfg_reply_error_string (TIPC_CFG_TLV_ERROR ); - - value =ntohl (*(__be32 *)TLV_DATA (req_tlv_area)); -if (value <1 || value >65535 ) -return tipc_cfg_reply_error_string (TIPC_CFG_INVALID_VALUE -" (max publications must be 1-65535)" ); - tipc_max_publications = value; -return tipc_cfg_reply_none (); -} -static struct sk_buff *cfg_set_max_ports (void ) {u32 value;
@@ -342,9 +327,6 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_areacase TIPC_CMD_SET_MAX_PORTS : rep_tlv_buf =cfg_set_max_ports ();break ; -case TIPC_CMD_SET_MAX_PUBL : - rep_tlv_buf =cfg_set_max_publications (); -break ;case TIPC_CMD_SET_NETID : rep_tlv_buf =cfg_set_netid ();break ;
@@ -354,9 +336,6 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_areacase TIPC_CMD_GET_MAX_PORTS : rep_tlv_buf =tipc_cfg_reply_unsigned (tipc_max_ports);break ; -case TIPC_CMD_GET_MAX_PUBL : - rep_tlv_buf =tipc_cfg_reply_unsigned (tipc_max_publications); -break ;case TIPC_CMD_GET_NETID : rep_tlv_buf =tipc_cfg_reply_unsigned (tipc_net_id);break ;
@@ -374,6 +353,8 @@ struct sk_buff *tipc_cfg_do_cmd(u32 orig_node, u16 cmd, const void *request_areacase TIPC_CMD_GET_MAX_NODES :case TIPC_CMD_SET_MAX_SUBSCR :case TIPC_CMD_GET_MAX_SUBSCR : +case TIPC_CMD_SET_MAX_PUBL : +case TIPC_CMD_GET_MAX_PUBL :case TIPC_CMD_SET_LOG_SIZE :case TIPC_CMD_DUMP_LOG : rep_tlv_buf = tipc_cfg_reply_error_string(TIPC_CFG_NOT_SUPPORTED
net/tipc/core.c +0 -2
@@ -53,7 +53,6 @@ int tipc_random __read_mostly;/* configurable TIPC parameters */ u32 tipc_own_addr__read_mostly ;int tipc_max_ports__read_mostly ; -int tipc_max_publications;int tipc_net_id__read_mostly ;int tipc_remote_management__read_mostly ;
@@ -155,7 +154,6 @@ static int __init tipc_init(void) tipc_own_addr =0 ; tipc_remote_management =1 ; - tipc_max_publications =10000 ; tipc_max_ports =CONFIG_TIPC_PORTS ; tipc_net_id =4711 ;
net/tipc/core.h +1 -1
@@ -62,6 +62,7 @@#define ULTRA_STRING_MAX_LEN 32768#define TIPC_MAX_SUBSCRIPTIONS 65535 +#define TIPC_MAX_PUBLICATIONS 65535struct tipc_msg ;/* msg.h */
@@ -77,7 +78,6 @@ int tipc_snprintf(char *buf, int len, const char *fmt, ...);*/ extern u32 tipc_own_addr__read_mostly ;extern int tipc_max_ports__read_mostly ; -extern int tipc_max_publications;extern int tipc_net_id__read_mostly ;extern int tipc_remote_management__read_mostly ;
net/tipc/name_table.c +2 -2
@@ -667,9 +667,9 @@ struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper, {struct publication *publ; -if (table.local_publ_count >= tipc_max_publications) { +if (table.local_publ_count >=TIPC_MAX_PUBLICATIONS ) {pr_warn ("Publication failed, local publication limit reached (%u)\n" , - tipc_max_publications); +TIPC_MAX_PUBLICATIONS );return NULL ; }
Signature · 1 line
1.7.11.1
David Miller
maintainerFrom: Paul Gortmaker <[email protected]>
Date: Thu, 16 Aug 2012 18:09:05 -0400
Quoted 9 lines
This series gets some more largely trivial things out of the way. Most interesting are:
1) fix lockdep splat from bearer init by pushing the setup off to
schedule_work.2) simplification of configuration by removal of a couple of tuning knobs which used to have low default values.
Quoted 8 lines
The remainder are largely innocuous, I think. I did wonder if there was an alternate/better way to handle the splat though.
I've done my own local testing of this series on today's net-next commit
2ea214929d601("Merge branch 'for-davem' ... wireless-next")I'll wait a couple of days to allow for any possible feedback and change requests, and then send a pull request after that.
All applied, thanks Paul.
It's less useful for you to build the GIT tree "later", at least for me.
If the patches are good and there is no feedback asking for changes, I want to be able to just pull them into my tree immediately as I did here.
Thanks.
Quoted 21 lines · David Miller
From: Paul Gortmaker <[email protected]>
Date: Thu, 16 Aug 2012 18:09:05 -0400Quoted 9 lines
This series gets some more largely trivial things out of the way. Most interesting are:
1) fix lockdep splat from bearer init by pushing the setup off to
schedule_work.2) simplification of configuration by removal of a couple of tuning knobs which used to have low default values.
Quoted 8 lines
The remainder are largely innocuous, I think. I did wonder if there was an alternate/better way to handle the splat though.
I've done my own local testing of this series on today's net-next commit
2ea214929d601("Merge branch 'for-davem' ... wireless-next")I'll wait a couple of days to allow for any possible feedback and change requests, and then send a pull request after that.
Quoted 8 lines
All applied, thanks Paul.
It's less useful for you to build the GIT tree "later", at least for me.
If the patches are good and there is no feedback asking for changes, I want to be able to just pull them into my tree immediately as I did here.
OK, I will go back to what I was doing before, i.e. putting them on kernel.org and putting the git:// location in the 0/N summary all in one step.
Paul.
Quoted 3 lines
Thanks.