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

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