Skip to contentSkip to conversation

tipc: remove pre-allocated message header in link struct

PATCH Applied Jon Maloy 2 participants 2 messages Mar 3, 2016 – Mar 7, 2016

Subsystems (3)
lore
Share & tools
lore

Jon Maloy

author
#0 lore raw

PATCH 1/1 tipc: remove pre-allocated message header in link struct

Until now, we have kept a pre-allocated protocol message header aggregated into struct tipc_link. Apart from adding unnecessary footprint to the link instances, this requires extra code both to initialize and re-initialize it.

We now remove this sub-optimization. This change also makes it possible to clean up the function tipc_build_proto_msg() and remove a couple of small functions that were accessing the mentioned header. In particular, we can replace all occurrences of the local function call link_own_addr(link) with the generic tipc_own_addr(net).

---
 net/tipc/bcast.c |   5 ---
 net/tipc/bcast.h |   1 -
 net/tipc/link.c  | 114 ++++++++++++++++++++++---------------------------------
 net/tipc/link.h  |   1 -
 net/tipc/net.c   |   1 -
 5 files changed, 45 insertions(+), 77 deletions(-)
net/tipc/bcast.c +0 -5
index e401108..ae469b3 100644
@@ -412,11 +412,6 @@ enomem:
 	return -ENOMEM;
 }
 
-void tipc_bcast_reinit(struct net *net)
-{
-	tipc_link_reinit(tipc_bc_sndlink(net), tipc_own_addr(net));
-}
-
 void tipc_bcast_stop(struct net *net)
 {
 	struct tipc_net *tn = net_generic(net, tipc_net_id);
net/tipc/bcast.h +0 -1
index 1944c6c..d5e79b3 100644
@@ -46,7 +46,6 @@ struct tipc_node_map;
 extern const char tipc_bclink_name[];
 
 int tipc_bcast_init(struct net *net);
-void tipc_bcast_reinit(struct net *net);
 void tipc_bcast_stop(struct net *net);
 void tipc_bcast_add_peer(struct net *net, struct tipc_link *l,
 			 struct sk_buff_head *xmitq);
net/tipc/link.c +45 -69

247 lines not on this page · raw message

net/tipc/link.h +0 -1
index b4ee9d6..6a94175 100644
@@ -86,7 +86,6 @@ bool tipc_link_bc_create(struct net *net, u32 ownnode, u32 peer,
 			 struct sk_buff_head *namedq,
 			 struct tipc_link *bc_sndlink,
 			 struct tipc_link **link);
-void tipc_link_reinit(struct tipc_link *l, u32 addr);
 void tipc_link_tnl_prepare(struct tipc_link *l, struct tipc_link *tnl,
 			   int mtyp, struct sk_buff_head *xmitq);
 void tipc_link_build_reset_msg(struct tipc_link *l, struct sk_buff_head *xmitq);
net/tipc/net.c +0 -1
index 77bf911..86d68b3 100644
@@ -116,7 +116,6 @@ int tipc_net_start(struct net *net, u32 addr)
 	tn->own_addr = addr;
 	tipc_named_reinit(net);
 	tipc_sk_reinit(net);
-	tipc_bcast_reinit(net);
 
 	tipc_nametbl_publish(net, TIPC_CFG_SRV, tn->own_addr, tn->own_addr,
 			     TIPC_ZONE_SCOPE, 0, tn->own_addr);
Signature · 1 line
1.9.1
maintainer Applied
#1 lore raw

From: Jon Maloy <[email protected]>
Date: Thu, 3 Mar 2016 14:23:21 -0500

Quoted 5 lines

Until now, we have kept a pre-allocated protocol message header aggregated into struct tipc_link. Apart from adding unnecessary footprint to the link instances, this requires extra code both to initialize and re-initialize it.

Quoted 8 lines

We now remove this sub-optimization. This change also makes it possible to clean up the function tipc_build_proto_msg() and remove a couple of small functions that were accessing the mentioned header. In particular, we can replace all occurrences of the local function call link_own_addr(link) with the generic tipc_own_addr(net).

Applied, thanks.