[ewg] [PATCH] Perftest: attach QP to a multicast group in INIT state rather then RESET state

orenmeron orenmeron at dev.mellanox.co.il
Mon May 18 00:40:42 PDT 2009


commit 95a83ad74db6a9b996ec3602e02d3c4cd5ff648a
Author: Hoang-Nam Nguyen <hnguyen at de.ibm.com>
Date:   Mon May 18 09:14:43 2009 +0300

    Perftest: attach QP to a multicast group in INIT state rather then RESET state

    Signed-off-by: Oren Meron <orenmeron at dev.mellanox.co.il>

diff --git a/send_bw.c b/send_bw.c
index afabfa4..fdb88a1 100755
--- a/send_bw.c
+++ b/send_bw.c
@@ -421,20 +421,6 @@ static struct pingpong_context *pp_init_ctx(struct ibv_device *ib_dev,
                        return NULL;
                }

-               if ((user_parm->connection_type==UD) && (user_parm->use_mcg) && (!user_parm->servername || u
-                       union ibv_gid gid;
-                       uint8_t mcg_gid[16] = MCG_GID;
-
-                       /* use the local QP number as part of the mcg */
-                       mcg_gid[11] = (user_parm->servername) ? 0 : 1;
-                       *(uint32_t *)(&mcg_gid[12]) = ctx->qp->qp_num;
-                       memcpy(gid.raw, mcg_gid, 16);
-
-                       if (ibv_attach_mcast(ctx->qp, &gid, MCG_LID)) {
-                               fprintf(stderr, "Couldn't attach QP to mcg\n");
-                               return NULL;
-                       }
-               }
        }

        {
@@ -457,6 +443,21 @@ static struct pingpong_context *pp_init_ctx(struct ibv_device *ib_dev,
                                fprintf(stderr, "Failed to modify UD QP to INIT\n");
                                return NULL;
                        }
+
+                       if ((user_parm->use_mcg) && (!user_parm->servername || user_parm->duplex)) {
+                               union ibv_gid gid;
+                               uint8_t mcg_gid[16] = MCG_GID;
+
+                               /* use the local QP number as part of the mcg */
+                               mcg_gid[11] = (user_parm->servername) ? 0 : 1;
+                               *(uint32_t *)(&mcg_gid[12]) = ctx->qp->qp_num;
+                               memcpy(gid.raw, mcg_gid, 16);
+
+                               if (ibv_attach_mcast(ctx->qp, &gid, MCG_LID)) {
+                                       fprintf(stderr, "Couldn't attach QP to mcg\n");
+                                       return NULL;
+                               }
+                       }
                } else if (ibv_modify_qp(ctx->qp, &attr,
                                         IBV_QP_STATE              |
                                         IBV_QP_PKEY_INDEX         |
diff --git a/send_lat.c b/send_lat.c
index 1f21652..3bbc3d1 100755
--- a/send_lat.c
+++ b/send_lat.c
@@ -425,21 +425,6 @@ static struct pingpong_context *pp_init_ctx(struct ibv_device *ib_dev, int size,
                        fprintf(stderr, "Couldn't create QP\n");
                        return NULL;
                }
-
-               if ((user_parm->connection_type==UD) && (user_parm->use_mcg)) {
-                       union ibv_gid gid;
-                       uint8_t mcg_gid[16] = MCG_GID;
-
-                       /* use the local QP number as part of the mcg */
-                       mcg_gid[11] = (user_parm->servername) ? 0 : 1;
-                       *(uint32_t *)(&mcg_gid[12]) = ctx->qp->qp_num;
-                       memcpy(gid.raw, mcg_gid, 16);
-
-                       if (ibv_attach_mcast(ctx->qp, &gid, MCG_LID)) {
-                               fprintf(stderr, "Couldn't attach QP to mcg\n");
-                               return NULL;
-                       }
-               }
        }

        {
@@ -463,6 +448,21 @@ static struct pingpong_context *pp_init_ctx(struct ibv_device *ib_dev, int size,
                                fprintf(stderr, "Failed to modify UD QP to INIT\n");
                                return NULL;
                        }
+
+                       if (user_parm->use_mcg) {
+                               union ibv_gid gid;
+                               uint8_t mcg_gid[16] = MCG_GID;
+
+                               /* use the local QP number as part of the mcg */
+                               mcg_gid[11] = (user_parm->servername) ? 0 : 1;
+                               *(uint32_t *)(&mcg_gid[12]) = ctx->qp->qp_num;
+                               memcpy(gid.raw, mcg_gid, 16);
+
+                               if (ibv_attach_mcast(ctx->qp, &gid, MCG_LID)) {
+                                       fprintf(stderr, "Couldn't attach QP to mcg\n");
+                                       return NULL;
+                               }
+                       }
                } else if (ibv_modify_qp(ctx->qp, &attr,
                                         IBV_QP_STATE              |
                                         IBV_QP_PKEY_INDEX         |



More information about the ewg mailing list