[ofw] [patch][tools[perftests] Add a -d <guid> option to enable choosing a device to run on

Irena Gannon irena at mellanox.co.il
Sun Sep 19 07:00:25 PDT 2010


Signed-off-by: Irena Gannon (irena at mellanox.co.il<mailto:irena at mellanox.co.il>)

This patch adds a -d <guid> option to the tests to enable choosing a device to run on.

Index: D:/Windows/MLNX_VPI/tools/perftests/user/send_bw/send_bw.c
===================================================================
--- D:/Windows/MLNX_VPI/tools/perftests/user/send_bw/send_bw.c                (revision 6545)
+++ D:/Windows/MLNX_VPI/tools/perftests/user/send_bw/send_bw.c             (revision 6546)
@@ -38,6 +38,7 @@
 #include "get_clock.h"

 #include "perf_defs.h"
+#include "l2w.h"

 #define SIGNAL 1
 #define MAX_INLINE 400
@@ -73,13 +74,14 @@


 static struct pingpong_context *pp_init_ctx(unsigned size,int port,
-                                                                              struct user_parameters *user_parm)
+                                                                             struct user_parameters *user_parm, char* ib_devguid)
 {

                struct pingpong_context              *ctx;
                ib_api_status_t                                                ib_status = IB_SUCCESS;
                size_t                                                                    guid_count;
                ib_net64_t                                                          *ca_guid_array;
+             int                                                                           guid_index = 0;



@@ -158,7 +160,28 @@
                 * Open only the first HCA
                 */
                /* Open the CA */
-              ib_status = ib_open_ca(ctx->al ,ca_guid_array[0] ,NULL,
+             if (ib_devguid)
+             {
+                             unsigned int i = 0;
+                             guid_index = -1;
+                             for (i = 0; i < guid_count; i++)
+                             {
+                                             char curr_dev[20];
+                                             sprintf(curr_dev, "0x%016I64x", ntohll(ca_guid_array[i]));
+                                             if (!_stricmp(ib_devguid, curr_dev))
+                                             {
+                                                             guid_index = i;
+                                                             break;
+                                             }
+                             }
+                             if (guid_index == -1)
+                             {
+                                             fprintf(stderr,"device with guid %s was not found\n", ib_devguid);
+                                             return NULL;
+                             }
+             }
+
+             ib_status = ib_open_ca(ctx->al ,ca_guid_array[guid_index] ,NULL,
                                NULL,    //ca_context
                                &ctx->ca);

@@ -549,6 +572,7 @@
                printf("\n");
                printf("Options:\n");
                printf("  -p, --port=<port>         listen on/connect to port <port> (default 18515)\n");
+             printf("  -d, --ib-dev=<dev>        use IB device <device guid> (default first device found)\n");
                printf("  -i, --ib-port=<port>      use port <port> of IB device (default 1)\n");
                printf("  -c, --connection=<RC/UC>  connection type RC/UC/UD (default RC)\n");
                printf("  -m, --mtu=<mtu>           mtu size (default 1024)\n");
@@ -943,7 +967,7 @@
                struct pingpong_dest                     *my_dest;
                struct pingpong_dest                     *rem_dest;
                struct user_parameters                                user_param;
-              char                                                       *ib_devname = NULL;
+             char                                                       *ib_devguid = NULL;
                int                                                           port = 18515;
                int                                                           ib_port = 1;
                unsigned                                             size = 65536;
@@ -953,6 +977,8 @@
                WSADATA                                                           wsaData;
                int                                                           iResult;

+             SYSTEM_INFO si;
+             GetSystemInfo(&si);

                /* init default values to user's parameters */
                memset(&user_param, 0, sizeof(struct user_parameters));
@@ -998,7 +1024,7 @@
                                                ++user_param.use_event;
                                                break;
                                case 'd':
-                                              ib_devname = _strdup(optarg);
+                                             ib_devguid = _strdup(optarg);
                                                break;
                                case 'c':
                                                if (strcmp("UC",optarg)==0)
@@ -1100,14 +1126,11 @@

                srand(GetCurrentProcessId() * GetTickCount());

-              //TODO: get pagesize from sysinfo
-              page_size = 4096;
+             page_size = si.dwPageSize;

-              //TODO:get the device names
-

                // init the context
-              ctx = pp_init_ctx(size, ib_port, &user_param);
+             ctx = pp_init_ctx(size, ib_port, &user_param, ib_devguid);
                if (!ctx)
                                return 1;

Index: D:/Windows/MLNX_VPI/tools/perftests/user/send_bw/SOURCES
===================================================================
--- D:/Windows/MLNX_VPI/tools/perftests/user/send_bw/SOURCES   (revision 6545)
+++ D:/Windows/MLNX_VPI/tools/perftests/user/send_bw/SOURCES                (revision 6546)
@@ -11,7 +11,7 @@
                ..\perf_utils.c \
                send_bw.c

-INCLUDES=..;..\..\..\..\inc;..\..\..\..\inc\user
+INCLUDES=..;..\..\..\..\inc;..\..\..\..\inc\user;..\..\..\..\hw\mlx4\user\hca;..\..\..\..\inc\complib

 RCOPTIONS=/I..\..\win\include

Index: D:/Windows/MLNX_VPI/tools/perftests/user/write_bw/SOURCES
===================================================================
--- D:/Windows/MLNX_VPI/tools/perftests/user/write_bw/SOURCES  (revision 6545)
+++ D:/Windows/MLNX_VPI/tools/perftests/user/write_bw/SOURCES               (revision 6546)
@@ -11,7 +11,7 @@
                ..\perf_utils.c \
                write_bw.c

-INCLUDES=..;..\..\..\..\inc;..\..\..\..\inc\user
+INCLUDES=..;..\..\..\..\inc;..\..\..\..\inc\user;..\..\..\..\hw\mlx4\user\hca;..\..\..\..\inc\complib

 RCOPTIONS=/I..\..\win\include

Index: D:/Windows/MLNX_VPI/tools/perftests/user/write_bw/write_bw.c
===================================================================
--- D:/Windows/MLNX_VPI/tools/perftests/user/write_bw/write_bw.c              (revision 6545)
+++ D:/Windows/MLNX_VPI/tools/perftests/user/write_bw/write_bw.c           (revision 6546)
@@ -34,12 +34,12 @@
  * $Id$
  */

+
 #include "getopt.h"
 #include "perf_defs.h"
 #include "get_clock.h"
+#include "l2w.h"

-
-
 struct user_parameters {
                const char              *servername;
                int connection_type;
@@ -66,7 +66,7 @@
                UNUSED_PARAM( cq_context);
                return ;
 }
-static struct pingpong_context *pp_init_ctx(unsigned size, int port, struct user_parameters *user_parm)
+static struct pingpong_context *pp_init_ctx(unsigned size, int port, struct user_parameters *user_parm, char* ib_devguid)
 {

                struct pingpong_context              *ctx;
@@ -74,6 +74,7 @@
                size_t                                                                    guid_count;
                ib_net64_t                                                          *ca_guid_array;
                int                                                                                           counter;
+             int                                                                           guid_index = 0;

                ctx = malloc(sizeof *ctx);
                if (!ctx){
@@ -159,7 +160,28 @@
                 * Open only the first HCA
                 */
                /* Open the CA */
-              ib_status = ib_open_ca(ctx->al ,ca_guid_array[0] ,NULL,
+             if (ib_devguid)
+             {
+                             unsigned int i = 0;
+                             guid_index = -1;
+                             for (i = 0; i < guid_count; i++)
+                             {
+                                             char curr_dev[20];
+                                             sprintf(curr_dev, "0x%016I64x", ntohll(ca_guid_array[i]));
+                                             if (!_stricmp(ib_devguid, curr_dev))
+                                             {
+                                                             guid_index = i;
+                                                             break;
+                                             }
+                             }
+                             if (guid_index == -1)
+                             {
+                                             fprintf(stderr,"device with guid %s was not found\n", ib_devguid);
+                                             return NULL;
+                             }
+             }
+
+             ib_status = ib_open_ca(ctx->al ,ca_guid_array[guid_index] ,NULL,
                                NULL,    //ca_context
                                &ctx->ca);

@@ -476,6 +498,7 @@
                printf("\n");
                printf("Options:\n");
                printf("  -p, --port=<port>         listen on/connect to port <port> (default 18515)\n");
+             printf("  -d, --ib-dev=<dev>        use IB device <device guid> (default first device found)\n");
                printf("  -i, --ib-port=<port>      use port <port> of IB device (default 1)\n");
                printf("  -c, --connection=<RC/UC>  connection type RC/UC (default RC)\n");
                printf("  -m, --mtu=<mtu>           mtu size (default 1024)\n");
@@ -650,7 +673,7 @@
                struct pingpong_dest     *my_dest;
                struct pingpong_dest     *rem_dest;
                struct user_parameters  user_param;
-              char                                                       *ib_devname = NULL;
+             char                                                       *ib_devguid = NULL;
                int                                                           port = 18515;
                int                                                           ib_port = 1;
                unsigned                                             size = 65536;
@@ -661,6 +684,9 @@
                int                                                           duplex = 0;


+             SYSTEM_INFO si;
+             GetSystemInfo(&si);
+
                /* init default values to user's parameters */
                memset(&user_param, 0, sizeof(struct user_parameters));
                user_param.mtu = 0;
@@ -705,7 +731,7 @@
                                                break;

                                case 'd':
-                                              ib_devname = _strdup(optarg);
+                                             ib_devguid = _strdup(optarg);
                                                break;
                                case 'c':
                                                if (strcmp("UC",optarg)==0)
@@ -814,13 +840,9 @@
                }
                srand(GetCurrentProcessId() * GetTickCount());

-              //TODO: get pagesize from sysinfo
-              page_size = 4096;
-
-              //TODO  get the device names
-
-
-              ctx = pp_init_ctx(size, ib_port, &user_param);
+             page_size = si.dwPageSize;
+
+             ctx = pp_init_ctx(size, ib_port, &user_param, ib_devguid);
                if (!ctx)
                                return 8;
                sockfd = pp_open_port(ctx, user_param.servername, ib_port, port,&my_dest,&rem_dest,&user_param);
Index: D:/Windows/MLNX_VPI/tools/perftests/user/send_lat/SOURCES
===================================================================
--- D:/Windows/MLNX_VPI/tools/perftests/user/send_lat/SOURCES    (revision 6545)
+++ D:/Windows/MLNX_VPI/tools/perftests/user/send_lat/SOURCES (revision 6546)
@@ -11,7 +11,7 @@
                ..\perf_utils.c \
                send_lat.c

-INCLUDES=..;..\..\..\..\inc;..\..\..\..\inc\user
+INCLUDES=..;..\..\..\..\inc;..\..\..\..\inc\user;..\..\..\..\hw\mlx4\user\hca;..\..\..\..\inc\complib

 RCOPTIONS=/I..\..\win\include

Index: D:/Windows/MLNX_VPI/tools/perftests/user/send_lat/send_lat.c
===================================================================
--- D:/Windows/MLNX_VPI/tools/perftests/user/send_lat/send_lat.c  (revision 6545)
+++ D:/Windows/MLNX_VPI/tools/perftests/user/send_lat/send_lat.c               (revision 6546)
@@ -38,6 +38,7 @@
 #include "getopt.h"
 #include "get_clock.h"
 #include "perf_defs.h"
+#include "l2w.h"



@@ -67,12 +68,13 @@
 }


-static struct pingpong_context *pp_init_ctx(unsigned int size,int port,struct user_parameters *user_parm) {
+static struct pingpong_context *pp_init_ctx(unsigned int size,int port,struct user_parameters *user_parm, char* ib_devguid) {

                struct pingpong_context              *ctx;
                ib_api_status_t                                                ib_status = IB_SUCCESS;
                size_t                                                                    guid_count;
                ib_net64_t                                                          *ca_guid_array;
+             int                                                                           guid_index = 0;



@@ -156,7 +158,29 @@
                 * Open only the first HCA
                 */
                /* Open the CA */
-              ib_status = ib_open_ca(ctx->al ,ca_guid_array[0] ,NULL,
+             if (ib_devguid)
+             {
+                             unsigned int i = 0;
+                             guid_index = -1;
+                             for (i = 0; i < guid_count; i++)
+                             {
+                                             char curr_dev[20];
+                                             sprintf(curr_dev, "0x%016I64x", ntohll(ca_guid_array[i]));
+                                             if (!_stricmp(ib_devguid, curr_dev))
+                                             {
+                                                             guid_index = i;
+                                                             break;
+                                             }
+                             }
+                             if (guid_index == -1)
+                             {
+                                             fprintf(stderr,"device with guid %s was not found\n", ib_devguid);
+                                             return NULL;
+                             }
+             }
+
+
+             ib_status = ib_open_ca(ctx->al ,ca_guid_array[guid_index] ,NULL,
                                NULL,    //ca_context
                                &ctx->ca);

@@ -536,6 +560,7 @@
                printf("\n");
                printf("Options:\n");
                printf("  -p, --port=<port>            listen on/connect to port <port> (default 18515)\n");
+             printf("  -d, --ib-dev=<dev>           use IB device <device guid> (default first device found)\n");
                printf("  -c, --connection=<RC/UC>     connection type RC/UC (default RC)\n");
                printf("  -m, --mtu=<mtu>              mtu size (default 2048)\n");
                printf("  -i, --ib-port=<port>         use port <port> of IB device (default 1)\n");
@@ -793,7 +818,7 @@
                struct pingpong_dest     *my_dest;
                struct pingpong_dest     *rem_dest;
                struct user_parameters  user_param;
-              char                                                       *ib_devname = NULL;
+             char                                                       *ib_devguid = NULL;
                int                                                           port = 18515;
                int                                                           ib_port = 1;
                unsigned                                             size = 2;
@@ -806,6 +831,9 @@

                struct report_options    report = {0};

+             SYSTEM_INFO si;
+             GetSystemInfo(&si);
+
                /* init default values to user's parameters */
                memset(&user_param, 0, sizeof(struct user_parameters));
                user_param.mtu = 0;
@@ -867,7 +895,7 @@
                                                return 0;
                                                break;
                                case 'd':
-                                              ib_devname = _strdup(optarg);
+                                             ib_devguid = _strdup(optarg);
                                                break;

                                case 'i':
@@ -967,12 +995,9 @@

                srand(GetCurrentProcessId() * GetTickCount());

-              //TODO: get pagesize from sysinfo
-              page_size = 4096;
-
-              //TODO  get the device names
+             page_size = si.dwPageSize;

-              ctx = pp_init_ctx( size, ib_port,&user_param);
+             ctx = pp_init_ctx( size, ib_port,&user_param, ib_devguid);
                if (!ctx)
                                return 8;

Index: D:/Windows/MLNX_VPI/tools/perftests/user/write_lat/SOURCES
===================================================================
--- D:/Windows/MLNX_VPI/tools/perftests/user/write_lat/SOURCES    (revision 6545)
+++ D:/Windows/MLNX_VPI/tools/perftests/user/write_lat/SOURCES (revision 6546)
@@ -11,7 +11,7 @@
                ..\perf_utils.c \
                write_lat.c

-INCLUDES=..;..\..\..\..\inc;..\..\..\..\inc\user
+INCLUDES=..;..\..\..\..\inc;..\..\..\..\inc\user;..\..\..\..\hw\mlx4\user\hca;..\..\..\..\inc\complib

 RCOPTIONS=/I..\..\win\include

Index: D:/Windows/MLNX_VPI/tools/perftests/user/write_lat/write_lat.c
===================================================================
--- D:/Windows/MLNX_VPI/tools/perftests/user/write_lat/write_lat.c (revision 6545)
+++ D:/Windows/MLNX_VPI/tools/perftests/user/write_lat/write_lat.c              (revision 6546)
@@ -38,6 +38,7 @@
 #include "getopt.h"
 #include "perf_defs.h"
 #include "get_clock.h"
+#include "l2w.h"



@@ -68,7 +69,7 @@
 }


-static struct pingpong_context *pp_init_ctx(unsigned size, int port, struct user_parameters *user_parm)
+static struct pingpong_context *pp_init_ctx(unsigned size, int port, struct user_parameters *user_parm, char* ib_devguid)
 {


@@ -76,6 +77,7 @@
                ib_api_status_t                                                ib_status = IB_SUCCESS;
                size_t                                                                    guid_count;
                ib_net64_t                                                          *ca_guid_array;
+             int                                                                                           guid_index = 0;

                ctx = malloc(sizeof *ctx);
                if (!ctx){
@@ -150,7 +152,28 @@
                 * Open only the first HCA
                 */
                /* Open the CA */
-              ib_status = ib_open_ca(ctx->al ,ca_guid_array[0] ,NULL,
+             if (ib_devguid)
+             {
+                             unsigned int i = 0;
+                             guid_index = -1;
+                             for (i = 0; i < guid_count; i++)
+                             {
+                                             char curr_dev[20];
+                                             sprintf(curr_dev, "0x%016I64x", ntohll(ca_guid_array[i]));
+                                             if (!_stricmp(ib_devguid, curr_dev))
+                                             {
+                                                             guid_index = i;
+                                                             break;
+                                             }
+                             }
+                             if (guid_index == -1)
+                             {
+                                             fprintf(stderr,"device with guid %s was not found\n", ib_devguid);
+                                             return NULL;
+                             }
+             }
+
+             ib_status = ib_open_ca(ctx->al ,ca_guid_array[guid_index] ,NULL,
                                NULL,    //ca_context
                                &ctx->ca);

@@ -465,6 +488,7 @@
                printf("\n");
                printf("Options:\n");
                printf("  -p, --port=<port>            listen on/connect to port <port> (default 18515)\n");
+             printf("  -d, --ib-dev=<dev>        use IB device <device guid> (default first device found)\n");
                printf("  -c, --connection=<RC/UC>     connection type RC/UC (default RC)\n");
                printf("  -m, --mtu=<mtu>              mtu size (default 1024)\n");
                printf("  -i, --ib-port=<port>         use port <port> of IB device (default 1)\n");
@@ -647,7 +671,7 @@
                struct pingpong_dest     *my_dest;
                struct pingpong_dest     *rem_dest;
                struct user_parameters  user_param;
-              char                                                       *ib_devname = NULL;
+             char                                                       *ib_devguid = NULL;
                int                                                           port = 18515;
                int                                                           ib_port = 1;
                unsigned                                             size = 2;
@@ -657,6 +681,8 @@
                int                                                           iResult;
                struct report_options    report = {0};

+             SYSTEM_INFO si;
+             GetSystemInfo(&si);

                /* init default values to user's parameters */
                memset(&user_param, 0, sizeof(struct user_parameters));
@@ -715,7 +741,7 @@
                                                return 0;
                                                break;
                                case 'd':
-                                              ib_devname = _strdup(optarg);
+                                             ib_devguid = _strdup(optarg);
                                                break;

                                case 'i':
@@ -811,13 +837,9 @@
                }
                srand(GetCurrentProcessId() * GetTickCount());

-              //TODO: get pagesize from sysinfo
-              page_size = 4096;
+             page_size = si.dwPageSize;

-              //TODO  get the device names
-
-
-              ctx = pp_init_ctx( size, ib_port,&user_param);
+             ctx = pp_init_ctx( size, ib_port,&user_param, ib_devguid);
                if (!ctx)
                                return 8;
                sockfd = pp_open_port(ctx, user_param.servername, ib_port, port,&my_dest,&rem_dest,&user_param);
@@ -846,4 +868,4 @@
                printf("------------------------------------------------------------------\n");
                free(tstamp);
                return 0;
-}
+}
\ No newline at end of file
Index: D:/Windows/MLNX_VPI/tools/perftests/user/read_bw/SOURCES
===================================================================
--- D:/Windows/MLNX_VPI/tools/perftests/user/read_bw/SOURCES    (revision 6545)
+++ D:/Windows/MLNX_VPI/tools/perftests/user/read_bw/SOURCES (revision 6546)
@@ -11,7 +11,7 @@
                ..\perf_utils.c \
                read_bw.c

-INCLUDES=..;..\..\..\..\inc;..\..\..\..\inc\user
+INCLUDES=..;..\..\..\..\inc;..\..\..\..\inc\user;..\..\..\..\hw\mlx4\user\hca;..\..\..\..\inc\complib

 RCOPTIONS=/I..\..\win\include

Index: D:/Windows/MLNX_VPI/tools/perftests/user/read_bw/read_bw.c
===================================================================
--- D:/Windows/MLNX_VPI/tools/perftests/user/read_bw/read_bw.c (revision 6545)
+++ D:/Windows/MLNX_VPI/tools/perftests/user/read_bw/read_bw.c              (revision 6546)
@@ -37,6 +37,7 @@
 #include "getopt.h"
 #include "perf_defs.h"
 #include "get_clock.h"
+#include "l2w.h"

 struct user_parameters {
                const char              *servername;
@@ -64,13 +65,14 @@
                return ;
 }

-static struct pingpong_context *pp_init_ctx(unsigned size,int port, struct user_parameters *user_parm)
+static struct pingpong_context *pp_init_ctx(unsigned size,int port, struct user_parameters *user_parm, char* ib_devguid)
 {

                struct pingpong_context              *ctx;
                ib_api_status_t                                                ib_status = IB_SUCCESS;
                size_t                                                                    guid_count;
                ib_net64_t                                                          *ca_guid_array;
+             int                                                                           guid_index = 0;


                ctx = malloc(sizeof *ctx);
@@ -145,7 +147,28 @@
                 * Open only the first HCA
                 */
                /* Open the CA */
-              ib_status = ib_open_ca(ctx->al ,ca_guid_array[0] ,NULL,
+             if (ib_devguid)
+             {
+                             unsigned int i = 0;
+                             guid_index = -1;
+                             for (i = 0; i < guid_count; i++)
+                             {
+                                             char curr_dev[20];
+                                             sprintf(curr_dev, "0x%016I64x", ntohll(ca_guid_array[i]));
+                                             if (!_stricmp(ib_devguid, curr_dev))
+                                             {
+                                                             guid_index = i;
+                                                             break;
+                                             }
+                             }
+                             if (guid_index == -1)
+                             {
+                                             fprintf(stderr,"device with guid %s was not found\n", ib_devguid);
+                                             return NULL;
+                             }
+             }
+
+             ib_status = ib_open_ca(ctx->al ,ca_guid_array[guid_index] ,NULL,
                                NULL,    //ca_context
                                &ctx->ca);

@@ -445,6 +468,7 @@
                printf("\n");
                printf("Options:\n");
                printf("  -p, --port=<port>      listen on/connect to port <port> (default 18515)\n");
+             printf("  -d, --ib-dev=<dev>        use IB device <device guid> (default first device found)\n");
                printf("  -i, --ib-port=<port>   use port <port> of IB device (default 1)\n");
                printf("  -m, --mtu=<mtu>        mtu size (default 1024)\n");
                printf("  -o, --outs=<num>       num of outstanding read/atom(default 4)\n");
@@ -582,7 +606,7 @@
                struct pingpong_dest     *my_dest;
                struct pingpong_dest     *rem_dest;
                struct user_parameters  user_param;
-              char                                                       *ib_devname = NULL;
+             char                                                       *ib_devguid = NULL;
                int                                                           port = 18515;
                int                                                           ib_port = 1;
                unsigned                                             size = 65536;
@@ -592,6 +616,9 @@
                int                                                           i = 0;
                int                                                           duplex = 0;

+             SYSTEM_INFO si;
+             GetSystemInfo(&si);
+
                /* init default values to user's parameters */
                memset(&user_param, 0, sizeof(struct user_parameters));
                user_param.mtu = 0; /* signal choose default by device */
@@ -632,7 +659,7 @@
                                                break;

                                case 'd':
-                                              ib_devname = _strdup(optarg);
+                                             ib_devguid = _strdup(optarg);
                                                break;
                                case 'm':
                                                user_param.mtu = strtol(optarg, NULL, 0);
@@ -717,13 +744,9 @@

                srand(GetCurrentProcessId() * GetTickCount());

-              //TODO: get pagesize from sysinfo
-              page_size = 4096;
+             page_size = si.dwPageSize;

-              //TODO:get the device names
-
-
-              ctx = pp_init_ctx(size,ib_port, &user_param);
+             ctx = pp_init_ctx(size,ib_port, &user_param, ib_devguid);
                if (!ctx)
                                return 8;

Index: D:/Windows/MLNX_VPI/tools/perftests/user/read_lat/SOURCES
===================================================================
--- D:/Windows/MLNX_VPI/tools/perftests/user/read_lat/SOURCES     (revision 6545)
+++ D:/Windows/MLNX_VPI/tools/perftests/user/read_lat/SOURCES  (revision 6546)
@@ -11,7 +11,7 @@
                ..\perf_utils.c \
                read_lat.c

-INCLUDES=..;..\..\..\..\inc;..\..\..\..\inc\user
+INCLUDES=..;..\..\..\..\inc;..\..\..\..\inc\user;..\..\..\..\hw\mlx4\user\hca;..\..\..\..\inc\complib

 RCOPTIONS=/I..\..\win\include

Index: D:/Windows/MLNX_VPI/tools/perftests/user/read_lat/read_lat.c
===================================================================
--- D:/Windows/MLNX_VPI/tools/perftests/user/read_lat/read_lat.c    (revision 6545)
+++ D:/Windows/MLNX_VPI/tools/perftests/user/read_lat/read_lat.c (revision 6546)
@@ -38,6 +38,7 @@
 #include "getopt.h"
 #include "perf_defs.h"
 #include "get_clock.h"
+#include "l2w.h"



@@ -68,7 +69,7 @@
                return ;
 }

-static struct pingpong_context *pp_init_ctx(unsigned size,int port, struct user_parameters *user_parm)
+static struct pingpong_context *pp_init_ctx(unsigned size,int port, struct user_parameters *user_parm, char* ib_devguid)
 {


@@ -76,6 +77,7 @@
                ib_api_status_t                                                ib_status = IB_SUCCESS;
                size_t                                                                    guid_count;
                ib_net64_t                                                          *ca_guid_array;
+             int                                                                                           guid_index = 0;


                ctx = malloc(sizeof *ctx);
@@ -149,7 +151,28 @@
                 * Open only the first HCA
                 */
                /* Open the CA */
-              ib_status = ib_open_ca(ctx->al ,ca_guid_array[0] ,NULL,
+             if (ib_devguid)
+             {
+                             unsigned int i = 0;
+                             guid_index = -1;
+                             for (i = 0; i < guid_count; i++)
+                             {
+                                             char curr_dev[20];
+                                             sprintf(curr_dev, "0x%016I64x", ntohll(ca_guid_array[i]));
+                                             if (!_stricmp(ib_devguid, curr_dev))
+                                             {
+                                                             guid_index = i;
+                                                             break;
+                                             }
+                             }
+                             if (guid_index == -1)
+                             {
+                                             fprintf(stderr,"device with guid %s was not found\n", ib_devguid);
+                                             return NULL;
+                             }
+             }
+
+             ib_status = ib_open_ca(ctx->al ,ca_guid_array[guid_index] ,NULL,
                                NULL,    //ca_context
                                &ctx->ca);

@@ -456,6 +479,7 @@
                printf("\n");
                printf("Options:\n");
                printf("  -p, --port=<port>            listen on/connect to port <port> (default 18515)\n");
+             printf("  -d, --ib-dev=<dev>           use IB device <device guid> (default first device found)\n");
                printf("  -m, --mtu=<mtu>              mtu size (default 256)\n");
                printf("  -i, --ib-port=<port>         use port <port> of IB device (default 1)\n");
                printf("  -s, --size=<size>            size of message to exchange (default 1)\n");
@@ -598,7 +622,7 @@
                struct pingpong_dest     *my_dest;
                struct pingpong_dest     *rem_dest;
                struct user_parameters  user_param;
-              char                                                       *ib_devname = NULL;
+             char                                                       *ib_devguid = NULL;
                int                                                           port = 18515;
                int                                                           ib_port = 1;
                unsigned                                             tmp_size,size = 2;
@@ -608,6 +632,8 @@
                int                                                           i = 0;
                struct report_options    report = {0};

+             SYSTEM_INFO si;
+             GetSystemInfo(&si);

                /* init default values to user's parameters */
                memset(&user_param, 0, sizeof(struct user_parameters));
@@ -665,7 +691,7 @@
                                                return 0;
                                                break;
                                case 'd':
-                                              ib_devname = _strdup(optarg);
+                                             ib_devguid = _strdup(optarg);
                                                break;

                                case 'i':
@@ -755,13 +781,9 @@

                srand(GetCurrentProcessId() * GetTickCount());

-              //TODO: get pagesize from sysinfo
-              page_size = 4096;
+             page_size = si.dwPageSize;

-              //TODO:get the device names
-
-
-              ctx = pp_init_ctx(size,ib_port, &user_param);
+             ctx = pp_init_ctx(size,ib_port, &user_param, ib_devguid);
                if (!ctx)
                                return 8;

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20100919/6e73fdb6/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ib_tools_dev.patch
Type: application/octet-stream
Size: 21852 bytes
Desc: ib_tools_dev.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20100919/6e73fdb6/attachment.obj>


More information about the ofw mailing list