tipc: eliminate upcall function pointers between port and socket

Due to the original one-to-many relation between port and user API
layers, upcalls to the API have been performed via function pointers,
installed in struct tipc_port at creation. Since this relation now
always is one-to-one, we can instead use ordinary function calls.

We remove the function pointers 'dispatcher' and ´wakeup' from
struct tipc_port, and replace them with calls to the renamed
functions tipc_sk_rcv() and tipc_sk_wakeup().

At the same time we change the name and signature of the functions
tipc_createport() and tipc_deleteport() to reflect their new role
as mere initialization/destruction functions.

Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Reviewed-by: Erik Hugne <erik.hugne@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Jon Paul Maloy
2014-03-12 11:31:10 -04:00
committed by David S. Miller
parent 8826cde655
commit 24be34b5a0
5 changed files with 36 additions and 60 deletions

View File

@@ -59,8 +59,6 @@
* @ref: unique reference to port in TIPC object registry
* @phdr: preformatted message header used when sending messages
* @port_list: adjacent ports in TIPC's global list of ports
* @dispatcher: ptr to routine which handles received messages
* @wakeup: ptr to routine to call when port is no longer congested
* @wait_list: adjacent ports in list of ports waiting on link congestion
* @waiting_pkts:
* @sent: # of non-empty messages sent by port
@@ -84,8 +82,6 @@ struct tipc_port {
u32 ref;
struct tipc_msg phdr;
struct list_head port_list;
u32 (*dispatcher)(struct tipc_port *, struct sk_buff *);
void (*wakeup)(struct tipc_port *);
struct list_head wait_list;
u32 waiting_pkts;
u32 sent;
@@ -104,17 +100,14 @@ struct tipc_port_list;
/*
* TIPC port manipulation routines
*/
struct tipc_port *tipc_createport(struct sock *sk,
u32 (*dispatcher)(struct tipc_port *,
struct sk_buff *),
void (*wakeup)(struct tipc_port *),
const u32 importance);
u32 tipc_port_init(struct tipc_port *p_ptr,
const unsigned int importance);
int tipc_reject_msg(struct sk_buff *buf, u32 err);
void tipc_acknowledge(u32 port_ref, u32 ack);
int tipc_deleteport(struct tipc_port *p_ptr);
void tipc_port_destroy(struct tipc_port *p_ptr);
int tipc_portimportance(u32 portref, unsigned int *importance);
int tipc_set_portimportance(u32 portref, unsigned int importance);
@@ -136,6 +129,7 @@ int tipc_port_disconnect(u32 portref);
int tipc_port_shutdown(u32 ref);
void tipc_port_wakeup(struct tipc_port *port);
/*
* The following routines require that the port be locked on entry