diff options
author | Jon Paul Maloy <jon.maloy@ericsson.com> | 2014-03-12 15:31:11 (GMT) |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-03-12 19:53:49 (GMT) |
commit | 3b4f302d85785bb1c99b3db7f9557b256baa3805 (patch) | |
tree | f7ae25914a547b93851fc7aef94fc2daf601cc95 /net/tipc/port.h | |
parent | 24be34b5a0c9114541891d29dff1152bb1a8df34 (diff) | |
download | linux-3b4f302d85785bb1c99b3db7f9557b256baa3805.tar.xz |
tipc: eliminate redundant locking
The three functions tipc_portimportance(), tipc_portunreliable() and
tipc_portunreturnable() and their corresponding tipc_set* functions,
are all grabbing port_lock when accessing the targeted port. This is
unnecessary in the current code, since these calls only are made from
within socket downcalls, already protected by sock_lock.
We remove the redundant locking. Also, since the functions now become
trivial one-liners, we move them to port.h and make them inline.
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>
Diffstat (limited to 'net/tipc/port.h')
-rw-r--r-- | net/tipc/port.h | 42 |
1 files changed, 33 insertions, 9 deletions
diff --git a/net/tipc/port.h b/net/tipc/port.h index 1c90cbd..53ec5f0 100644 --- a/net/tipc/port.h +++ b/net/tipc/port.h @@ -109,15 +109,6 @@ void tipc_acknowledge(u32 port_ref, u32 ack); 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); - -int tipc_portunreliable(u32 portref, unsigned int *isunreliable); -int tipc_set_portunreliable(u32 portref, unsigned int isunreliable); - -int tipc_portunreturnable(u32 portref, unsigned int *isunreturnable); -int tipc_set_portunreturnable(u32 portref, unsigned int isunreturnable); - int tipc_publish(struct tipc_port *p_ptr, unsigned int scope, struct tipc_name_seq const *name_seq); int tipc_withdraw(struct tipc_port *p_ptr, unsigned int scope, @@ -201,4 +192,37 @@ static inline u32 tipc_port_peerport(struct tipc_port *p_ptr) return msg_destport(&p_ptr->phdr); } +static inline bool tipc_port_unreliable(struct tipc_port *port) +{ + return msg_src_droppable(&port->phdr) != 0; +} + +static inline void tipc_port_set_unreliable(struct tipc_port *port, + bool unreliable) +{ + msg_set_src_droppable(&port->phdr, unreliable ? 1 : 0); +} + +static inline bool tipc_port_unreturnable(struct tipc_port *port) +{ + return msg_dest_droppable(&port->phdr) != 0; +} + +static inline void tipc_port_set_unreturnable(struct tipc_port *port, + bool unreturnable) +{ + msg_set_dest_droppable(&port->phdr, unreturnable ? 1 : 0); +} + + +static inline int tipc_port_importance(struct tipc_port *port) +{ + return msg_importance(&port->phdr); +} + +static inline void tipc_port_set_importance(struct tipc_port *port, int imp) +{ + msg_set_importance(&port->phdr, (u32)imp); +} + #endif |