summaryrefslogtreecommitdiffstats
path: root/net/tipc/port.h
diff options
context:
space:
mode:
authorJon Paul Maloy2014-03-12 16:31:11 +0100
committerDavid S. Miller2014-03-12 20:53:49 +0100
commit3b4f302d85785bb1c99b3db7f9557b256baa3805 (patch)
treef7ae25914a547b93851fc7aef94fc2daf601cc95 /net/tipc/port.h
parenttipc: eliminate upcall function pointers between port and socket (diff)
downloadkernel-qcow2-linux-3b4f302d85785bb1c99b3db7f9557b256baa3805.tar.gz
kernel-qcow2-linux-3b4f302d85785bb1c99b3db7f9557b256baa3805.tar.xz
kernel-qcow2-linux-3b4f302d85785bb1c99b3db7f9557b256baa3805.zip
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.h42
1 files changed, 33 insertions, 9 deletions
diff --git a/net/tipc/port.h b/net/tipc/port.h
index 1c90cbd74990..53ec5f06422f 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