aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/core.h
diff options
context:
space:
mode:
authorJon Paul Maloy <jon.maloy@ericsson.com>2015-07-16 16:54:31 -0400
committerDavid S. Miller <davem@davemloft.net>2015-07-20 20:41:16 -0700
commitd999297c3dbbe7fdd832f7fa4ec84301e170b3e6 (patch)
treeb476768ed4799eb009a19f7ff348b3ebd54212fa /net/tipc/core.h
parenttipc: introduce node contact FSM (diff)
downloadlinux-dev-d999297c3dbbe7fdd832f7fa4ec84301e170b3e6.tar.xz
linux-dev-d999297c3dbbe7fdd832f7fa4ec84301e170b3e6.zip
tipc: reduce locking scope during packet reception
We convert packet/message reception according to the same principle we have been using for message sending and timeout handling: We move the function tipc_rcv() to node.c, hence handling the initial packet reception at the link aggregation level. The function grabs the node lock, selects the receiving link, and accesses it via a new call tipc_link_rcv(). This function appends buffers to the input queue for delivery upwards, but it may also append outgoing packets to the xmit queue, just as we do during regular message sending. The latter will happen when buffers are forwarded from the link backlog, or when retransmission is requested. Upon return of this function, and after having released the node lock, tipc_rcv() delivers/tranmsits the contents of those queues, but it may also perform actions such as link activation or reset, as indicated by the return flags from the link. This reduces the number of cpu cycles spent inside the node spinlock, and reduces contention on that lock. Reviewed-by: Ying Xue <ying.xue@windriver.com> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/core.h')
-rw-r--r--net/tipc/core.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/net/tipc/core.h b/net/tipc/core.h
index 0fcf133d5cb7..f4ed67778c54 100644
--- a/net/tipc/core.h
+++ b/net/tipc/core.h
@@ -129,6 +129,11 @@ static inline int less(u16 left, u16 right)
return less_eq(left, right) && (mod(right) != mod(left));
}
+static inline int in_range(u16 val, u16 min, u16 max)
+{
+ return !less(val, min) && !more(val, max);
+}
+
#ifdef CONFIG_SYSCTL
int tipc_register_sysctl(void);
void tipc_unregister_sysctl(void);