[ofa-general] [PATCH] opensm/libvendor/osm_vendor_ibumad.c: Add environment variable control for OSM_UMAD_MAX_PENDING
Ira Weiny
weiny2 at llnl.gov
Thu Feb 21 16:56:55 PST 2008
>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)));
+ if (!p_vend->mtbl.tbl) {
+ osm_log(p_vend->p_log, OSM_LOG_ERROR,
+ "osm_vendor_init: Error:"
+ "failed to allocate vendor match table\n");
+ r = IB_INSUFFICIENT_MEMORY;
+ goto Exit;
+ }
Exit:
OSM_LOG_EXIT(p_log);
--
1.5.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-opensm-libvendor-osm_vendor_ibumad.c-Add-environmen.patch
Type: application/octet-stream
Size: 2397 bytes
Desc: not available
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20080221/772d74f2/attachment.obj>
More information about the general
mailing list