Blame SOURCES/librdmacm-mckey-test-support-for-send-only-full-member.patch

6698ac
commit 9db80df802bf9158c2d5a979175667babfce6506
6698ac
Author: Jason Gunthorpe <jgg@mellanox.com>
6698ac
Date:   Fri Nov 17 15:04:46 2017 -0700
6698ac
6698ac
    librdmacm: mckey test support for send only full member
6698ac
    
6698ac
    Added a new flag (-o) to mckey which allows mckey to join the multicast
6698ac
    group as Send Only Full Member.
6698ac
    
6698ac
    Demonstrates the use of rdma_join_multicast_ex instead of
6698ac
    rdma_join_multicast.
6698ac
    
6698ac
    Signed-off-by: Alex Vesker <valex@mellanox.com>
6698ac
    Signed-off-by: Christoph Lameter <cl@linux.com>
6698ac
    Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
6698ac
6698ac
diff --git a/librdmacm/examples/mckey.c b/librdmacm/examples/mckey.c
6698ac
index 60cf8a24..7abb5246 100644
6698ac
--- a/librdmacm/examples/mckey.c
6698ac
+++ b/librdmacm/examples/mckey.c
6698ac
@@ -77,6 +77,7 @@ static int connections = 1;
6698ac
 static int message_size = 100;
6698ac
 static int message_count = 10;
6698ac
 static int is_sender;
6698ac
+static int send_only;
6698ac
 static int unmapped_addr;
6698ac
 static char *dst_addr;
6698ac
 static char *src_addr;
6698ac
@@ -241,6 +242,7 @@ static void connect_error(void)
6698ac
 static int addr_handler(struct cmatest_node *node)
6698ac
 {
6698ac
 	int ret;
6698ac
+	struct rdma_cm_join_mc_attr_ex mc_attr;
6698ac
 
6698ac
 	ret = verify_test_params(node);
6698ac
 	if (ret)
6698ac
@@ -256,7 +258,14 @@ static int addr_handler(struct cmatest_node *node)
6698ac
 			goto err;
6698ac
 	}
6698ac
 
6698ac
-	ret = rdma_join_multicast(node->cma_id, test.dst_addr, node);
6698ac
+	mc_attr.comp_mask =
6698ac
+	    RDMA_CM_JOIN_MC_ATTR_ADDRESS | RDMA_CM_JOIN_MC_ATTR_JOIN_FLAGS;
6698ac
+	mc_attr.addr = test.dst_addr;
6698ac
+	mc_attr.join_flags = send_only ? RDMA_MC_JOIN_FLAG_SENDONLY_FULLMEMBER
6698ac
+				       : RDMA_MC_JOIN_FLAG_FULLMEMBER;
6698ac
+
6698ac
+	ret = rdma_join_multicast_ex(node->cma_id, &mc_attr, node);
6698ac
+
6698ac
 	if (ret) {
6698ac
 		perror("mckey: failure joining");
6698ac
 		goto err;
6698ac
@@ -555,8 +564,7 @@ int main(int argc, char **argv)
6698ac
 {
6698ac
 	int op, ret;
6698ac
 
6698ac
-
6698ac
-	while ((op = getopt(argc, argv, "m:M:sb:c:C:S:p:")) != -1) {
6698ac
+	while ((op = getopt(argc, argv, "m:M:sb:c:C:S:p:o")) != -1) {
6698ac
 		switch (op) {
6698ac
 		case 'm':
6698ac
 			dst_addr = optarg;
6698ac
@@ -584,6 +592,10 @@ int main(int argc, char **argv)
6698ac
 		case 'p':
6698ac
 			port_space = strtol(optarg, NULL, 0);
6698ac
 			break;
6698ac
+		case 'o':
6698ac
+			send_only = 1;
6698ac
+			break;
6698ac
+
6698ac
 		default:
6698ac
 			printf("usage: %s\n", argv[0]);
6698ac
 			printf("\t-m multicast_address\n");
6698ac
@@ -596,6 +608,7 @@ int main(int argc, char **argv)
6698ac
 			printf("\t[-S message_size]\n");
6698ac
 			printf("\t[-p port_space - %#x for UDP (default), "
6698ac
 			       "%#x for IPOIB]\n", RDMA_PS_UDP, RDMA_PS_IPOIB);
6698ac
+			printf("\t[-o join as a send-only full-member]\n");
6698ac
 			exit(1);
6698ac
 		}
6698ac
 	}
6698ac
diff --git a/librdmacm/man/mckey.1 b/librdmacm/man/mckey.1
6698ac
index a36f57ba..5e47ce5d 100644
6698ac
--- a/librdmacm/man/mckey.1
6698ac
+++ b/librdmacm/man/mckey.1
6698ac
@@ -41,6 +41,10 @@ The size of each message transferred, in bytes.  This value must be smaller
6698ac
 than the MTU of the underlying RDMA transport, or an error will occur.
6698ac
 (default 100)
6698ac
 .TP
6698ac
+\-o
6698ac
+Join the multicast group as a send-only full-member. Otherwise the group is
6698ac
+joined as a full-member.
6698ac
+.TP
6698ac
 \-p port_space
6698ac
 The port space of the datagram communication.  May be either the RDMA
6698ac
 UDP (0x0111) or IPoIB (0x0002) port space.  (default RDMA_PS_UDP)