[ofa-general] Re: [PATCH] opensm/libvendor/osm_vendor_ibumad.c: Add environment variable control for OSM_UMAD_MAX_PENDING
Sasha Khapyorsky
sashak at voltaire.com
Sun Feb 24 04:14:05 PST 2008
Hi Ira,
On 16:56 Thu 21 Feb , Ira Weiny wrote:
> From b8fb2151b92ddd4a7d2a4cc2ab38a6b34fffc7ab Mon Sep 17 00:00:00 2001
> From: Ira K. Weiny <weiny2 at llnl.gov>
> Date: Thu, 21 Feb 2008 09:10:10 -0800
> Subject: [PATCH] opensm/libvendor/osm_vendor_ibumad.c: Add environment variable control for OSM_UMAD_MAX_PENDING
>
>
> Signed-off-by: Ira K. Weiny <weiny2 at llnl.gov>
> ---
> opensm/include/vendor/osm_vendor_ibumad.h | 4 ++--
> opensm/libvendor/osm_vendor_ibumad.c | 27 ++++++++++++++++++++++++++-
> 2 files changed, 28 insertions(+), 3 deletions(-)
>
> diff --git a/opensm/include/vendor/osm_vendor_ibumad.h b/opensm/include/vendor/osm_vendor_ibumad.h
> index 84fd21a..3a3f070 100644
> --- a/opensm/include/vendor/osm_vendor_ibumad.h
> +++ b/opensm/include/vendor/osm_vendor_ibumad.h
> @@ -141,12 +141,12 @@ typedef struct _umad_match {
> uint32_t version;
> } umad_match_t;
>
> -#define OSM_UMAD_MAX_PENDING 1000
> +#define DEFAULT_OSM_UMAD_MAX_PENDING 1000
>
> typedef struct vendor_match_tbl {
> - umad_match_t tbl[OSM_UMAD_MAX_PENDING];
> uint32_t last_version;
> int max;
> + umad_match_t *tbl;
> } vendor_match_tbl_t;
>
> typedef struct _osm_vendor {
> diff --git a/opensm/libvendor/osm_vendor_ibumad.c b/opensm/libvendor/osm_vendor_ibumad.c
> index 679f06a..f847e61 100644
> --- a/opensm/libvendor/osm_vendor_ibumad.c
> +++ b/opensm/libvendor/osm_vendor_ibumad.c
> @@ -451,6 +451,7 @@ ib_api_status_t
> osm_vendor_init(IN osm_vendor_t * const p_vend,
> IN osm_log_t * const p_log, IN const uint32_t timeout)
> {
> + char *max = NULL;
> int r, n_cas;
>
> OSM_LOG_ENTER(p_log);
> @@ -480,7 +481,31 @@ osm_vendor_init(IN osm_vendor_t * const p_vend,
> }
>
> p_vend->ca_count = n_cas;
> - p_vend->mtbl.max = OSM_UMAD_MAX_PENDING;
> + p_vend->mtbl.max = DEFAULT_OSM_UMAD_MAX_PENDING;
> +
> + if ((max = getenv("OSM_UMAD_MAX_PENDING")) != NULL) {
> + int tmp = strtol(max, NULL, 0);
> + if (tmp > 0)
> + p_vend->mtbl.max = tmp;
> + else
> + osm_log(p_vend->p_log, OSM_LOG_ERROR,
> + "osm_vendor_init: Error:"
> + "OSM_UMAD_MAX_PENDING=%d is invalid",
> + tmp);
> + }
> +
> + osm_log(p_vend->p_log, OSM_LOG_INFO,
> + "osm_vendor_init: %d pending umads specified\n",
> + p_vend->mtbl.max);
> +
> + p_vend->mtbl.tbl = calloc(p_vend->mtbl.max, sizeof(*(p_vend->mtbl.tbl)));
There is calloc(), I guess we also need free() somewhere?
Sasha
More information about the general
mailing list