Skip to content

Commit c5fa7b3

Browse files
ying-xuedavem330
authored andcommitted
tipc: introduce new TIPC server infrastructure
TIPC has two internal servers, one providing a subscription service for topology events, and another providing the configuration interface. These servers have previously been running in BH context, accessing the TIPC-port (aka native) API directly. Apart from these servers, even the TIPC socket implementation is partially built on this API. As this API may simultaneously be called via different paths and in different contexts, a complex and costly lock policiy is required in order to protect TIPC internal resources. To eliminate the need for this complex lock policiy, we introduce a new, generic service API that uses kernel sockets for message passing instead of the native API. Once the toplogy and configuration servers are converted to use this new service, all code pertaining to the native API can be removed. This entails a significant reduction in code amount and complexity, and opens up for a complete rework of the locking policy in TIPC. The new service also solves another problem: As the current topology server works in BH context, it cannot easily be blocked when sending of events fails due to congestion. In such cases events may have to be silently dropped, something that is unacceptable. Therefore, the new service keeps a dedicated outbound queue receiving messages from BH context. Once messages are inserted into this queue, we will immediately schedule a work from a special workqueue. This way, messages/events from the topology server are in reality sent in process context, and the server can block if necessary. Analogously, there is a new workqueue for receiving messages. Once a notification about an arriving message is received in BH context, we schedule a work from the receive workqueue to do the job of receiving the message in process context. As both sending and receive messages are now finished in processes, subscribed events cannot be dropped any more. As of this commit, this new server infrastructure is built, but not actually yet called by the existing TIPC code, but since the conversion changes required in order to use it are significant, the addition is kept here as a separate commit. Signed-off-by: Ying Xue <[email protected]> Signed-off-by: Jon Maloy <[email protected]> Signed-off-by: Paul Gortmaker <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 5d21cb7 commit c5fa7b3

File tree

5 files changed

+789
-10
lines changed

5 files changed

+789
-10
lines changed

net/tipc/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ tipc-y += addr.o bcast.o bearer.o config.o \
88
core.o handler.o link.o discover.o msg.o \
99
name_distr.o subscr.o name_table.o net.o \
1010
netlink.o node.o node_subscr.o port.o ref.o \
11-
socket.o log.o eth_media.o
11+
socket.o log.o eth_media.o server.o
1212

1313
tipc-$(CONFIG_TIPC_MEDIA_IB) += ib_media.o
1414
tipc-$(CONFIG_SYSCTL) += sysctl.o

net/tipc/core.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
22
* net/tipc/core.h: Include file for TIPC global declarations
33
*
4-
* Copyright (c) 2005-2006, Ericsson AB
5-
* Copyright (c) 2005-2007, 2010-2011, Wind River Systems
4+
* Copyright (c) 2005-2006, 2013 Ericsson AB
5+
* Copyright (c) 2005-2007, 2010-2013, Wind River Systems
66
* All rights reserved.
77
*
88
* Redistribution and use in source and binary forms, with or without
@@ -97,6 +97,10 @@ extern int tipc_netlink_start(void);
9797
extern void tipc_netlink_stop(void);
9898
extern int tipc_socket_init(void);
9999
extern void tipc_socket_stop(void);
100+
extern int tipc_sock_create_local(int type, struct socket **res);
101+
extern void tipc_sock_release_local(struct socket *sock);
102+
extern int tipc_sock_accept_local(struct socket *sock,
103+
struct socket **newsock, int flags);
100104

101105
#ifdef CONFIG_SYSCTL
102106
extern int tipc_register_sysctl(void);

0 commit comments

Comments
 (0)