Skip to content

Commit 75da216

Browse files
Jon Maloydavem330
authored andcommitted
tipc: introduce communication groups
As a preparation for introducing flow control for multicast and datagram messaging we need a more strictly defined framework than we have now. A socket must be able keep track of exactly how many and which other sockets it is allowed to communicate with at any moment, and keep the necessary state for those. We therefore introduce a new concept we have named Communication Group. Sockets can join a group via a new setsockopt() call TIPC_GROUP_JOIN. The call takes four parameters: 'type' serves as group identifier, 'instance' serves as an logical member identifier, and 'scope' indicates the visibility of the group (node/cluster/zone). Finally, 'flags' makes it possible to set certain properties for the member. For now, there is only one flag, indicating if the creator of the socket wants to receive a copy of broadcast or multicast messages it is sending via the socket, and if wants to be eligible as destination for its own anycasts. A group is closed, i.e., sockets which have not joined a group will not be able to send messages to or receive messages from members of the group, and vice versa. Any member of a group can send multicast ('group broadcast') messages to all group members, optionally including itself, using the primitive send(). The messages are received via the recvmsg() primitive. A socket can only be member of one group at a time. Signed-off-by: Jon Maloy <[email protected]> Acked-by: Ying Xue <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a80ae53 commit 75da216

File tree

10 files changed

+748
-48
lines changed

10 files changed

+748
-48
lines changed

include/uapi/linux/tipc.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,20 @@ struct sockaddr_tipc {
231231
#define TIPC_SOCK_RECVQ_DEPTH 132 /* Default: none (read only) */
232232
#define TIPC_MCAST_BROADCAST 133 /* Default: TIPC selects. No arg */
233233
#define TIPC_MCAST_REPLICAST 134 /* Default: TIPC selects. No arg */
234+
#define TIPC_GROUP_JOIN 135 /* Takes struct tipc_group_req* */
235+
#define TIPC_GROUP_LEAVE 136 /* No argument */
236+
237+
/*
238+
* Flag values
239+
*/
240+
#define TIPC_GROUP_LOOPBACK 0x1 /* Receive copy of sent msg when match */
241+
242+
struct tipc_group_req {
243+
__u32 type; /* group id */
244+
__u32 instance; /* member id */
245+
__u32 scope; /* zone/cluster/node */
246+
__u32 flags;
247+
};
234248

235249
/*
236250
* Maximum sizes of TIPC bearer-related names (including terminating NULL)

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 \
88
core.o link.o discover.o msg.o \
99
name_distr.o subscr.o monitor.o name_table.o net.o \
1010
netlink.o netlink_compat.o node.o socket.o eth_media.o \
11-
server.o socket.o
11+
server.o socket.o group.o
1212

1313
tipc-$(CONFIG_TIPC_MEDIA_UDP) += udp_media.o
1414
tipc-$(CONFIG_TIPC_MEDIA_IB) += ib_media.o

0 commit comments

Comments
 (0)