[openib-general] [RFC] [PATCH] OpenSM: Add functional partition manager support
Sasha Khapyorsky
sashak at voltaire.com
Sun Feb 26 15:20:49 PST 2006
On 18:38 Sun 19 Feb , Sasha Khapyorsky wrote:
>
> There is phase 1 of partiton manager for OpenSM. Please review.
Some selfreview addition: main thing is mtu and rate flags for
IPoIB partitions config.
This patch is incremental against previous one.
Sasha.
This adds possibility to specify in partition configuration mtu and rate
values (and overwrite defaults) for partitions which suports IPoIB MC
group. Also small fix in pkey auto-generation code.
Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
osm/doc/partition-config.txt | 18 +++++++++++----
osm/opensm/osm_prtn.c | 15 +++++++------
osm/opensm/osm_prtn_config.c | 50 ++++++++++++++++++++++++++++++++----------
3 files changed, 59 insertions(+), 24 deletions(-)
diff --git a/osm/doc/partition-config.txt b/osm/doc/partition-config.txt
index b3ba804..a5d0fd0 100644
--- a/osm/doc/partition-config.txt
+++ b/osm/doc/partition-config.txt
@@ -32,15 +32,23 @@ General file format:
Partition Definition:
--------------------
-[PartitionName][=PKey][,flag]
+[PartitionName][=PKey][,flag[=value]]
PartitionName - free string, will be used with logging. When omitted
empty string will be used.
PKey - P_Key value for this partition. Only low 15 bits will
be used. When omitted will be autogenerated.
flag - used to indicate IPoIB capability of this partition.
- 'ipoib' is only valid value currently (in future other
- values may be added).
+
+Currently recognized flags are:
+
+ipoib - indicates that this partition may be used for IPoIB, as
+ result IPoIB capable MC group will be created.
+rate=<val> - specifies rate for this IPoIB MC group (default is 3 (10Bps))
+mtu=<val> - specifies MTU for this IPoIB MC group (default is 4 (2048))
+
+Note that values for 'rate' and 'mtu' should be specified as defined in
+IBTA specification (for example mtu=4 for 2048).
PortGUIDs list:
@@ -49,7 +57,7 @@ PortGUIDs list:
[PortGUID[=full|=part]] [,PortGUID[=full|=part]] [,PortGUID] ...
PortGUID - GUID of partition member EndPort. Hexadecimal numbers
- should start from 0x.
+ should start from 0x, decimal numbers are accepted too.
full or part - indicates full or partial membership for this port. When
omitted (or unrecognized) partial membership is assumed.
@@ -71,7 +79,7 @@ between.
PartitionName does not need to be unique, PKey does need to be unique.
If PKey is repeated then those partition configurations will be merged
-(see also next note).
+and first PartitionName will be used (see also next note).
It is possible to split partition configuration in more than one
definition, but then PKey should be explicitly specified (overwise
diff --git a/osm/opensm/osm_prtn.c b/osm/opensm/osm_prtn.c
index f5f3a32..c53d849 100644
--- a/osm/opensm/osm_prtn.c
+++ b/osm/opensm/osm_prtn.c
@@ -170,7 +170,7 @@ ib_api_status_t osm_prtn_add_all(osm_log
ib_api_status_t osm_prtn_add_mcgroup(osm_log_t *p_log,
- osm_subn_t *p_subn, osm_prtn_t *p)
+ osm_subn_t *p_subn, osm_prtn_t *p, uint8_t rate, uint8_t mtu)
{
ib_member_rec_t mc_rec;
ib_net64_t comp_mask;
@@ -187,17 +187,17 @@ ib_api_status_t osm_prtn_add_mcgroup(osm
cl_memcpy(&mc_rec.mgid.raw[4], &pkey, sizeof(pkey));
mc_rec.qkey = CL_HTON32(0x0b1b);
- mc_rec.mtu = 4; /* 2048 Bytes */
+ mc_rec.mtu = mtu ? mtu : 4; /* 2048 Bytes */
mc_rec.tclass = 0;
mc_rec.pkey = pkey;
- mc_rec.rate = 0x3; /* 10Gb/sec */
+ mc_rec.rate = rate ? rate : 0x3; /* 10Gb/sec */
mc_rec.pkt_life = OSM_DEFAULT_SUBNET_TIMEOUT;
mc_rec.sl_flow_hop = OSM_DEFAULT_SL << 28;
/* Note: scope needs to be consistent with MGID */
mc_rec.scope_state = 0x21;
- /* mtu and rate will be updated according to CA */
- comp_mask = 0;
+ /* don't update rate, mtu */
+ comp_mask = IB_MCR_COMPMASK_MTU | IB_MCR_COMPMASK_RATE;
status = osm_mcmr_rcv_find_or_create_new_mgrp(&p_sa->mcmr_rcv,
comp_mask, &mc_rec, &p_mgrp);
@@ -216,10 +216,11 @@ static uint16_t __generate_pkey(osm_subn
{
uint16_t pkey;
cl_qmap_t *m = &p_subn->prtn_pkey_tbl;
- while ( global_pkey_counter < IB_DEFAULT_PARTIAL_PKEY - 1) {
+ while ( global_pkey_counter < cl_ntoh16(IB_DEFAULT_PARTIAL_PKEY) - 1) {
pkey = ++global_pkey_counter;
+ pkey = cl_hton16(pkey);
if (cl_qmap_get(m, pkey) == cl_qmap_end(m))
- return cl_hton16(pkey);
+ return pkey;
}
return 0;
}
diff --git a/osm/opensm/osm_prtn_config.c b/osm/opensm/osm_prtn_config.c
index 97a835a..d818e84 100644
--- a/osm/opensm/osm_prtn_config.c
+++ b/osm/opensm/osm_prtn_config.c
@@ -83,6 +83,7 @@ struct part_conf {
osm_log_t *p_log;
osm_subn_t *p_subn;
osm_prtn_t *p_prtn;
+ unsigned is_ipoib, mtu, rate;
};
@@ -94,8 +95,7 @@ extern ib_api_status_t osm_prtn_add_port
osm_subn_t *p_subn, osm_prtn_t *p, ib_net64_t guid,
boolean_t full);
extern ib_api_status_t osm_prtn_add_mcgroup(osm_log_t *p_log,
- osm_subn_t *p_subn, osm_prtn_t *p);
-
+ osm_subn_t *p_subn, osm_prtn_t *p, uint8_t rate, uint8_t mtu);
static int partition_create(unsigned lineno, struct part_conf *conf,
char *name, char *id, char *flag, char *flag_val)
@@ -120,18 +120,39 @@ static int partition_create(unsigned lin
name, cl_hton16(pkey));
if (!conf->p_prtn)
return -1;
+
+ if (conf->is_ipoib)
+ osm_prtn_add_mcgroup(conf->p_log, conf->p_subn,
+ conf->p_prtn, conf->rate, conf->mtu);
- if (flag) {
- if(!strncmp(flag, "ipoib", strlen(flag)))
- osm_prtn_add_mcgroup(conf->p_log,
- conf->p_subn, conf->p_prtn);
- else {
+ return 0;
+}
+
+
+static int partition_add_flag(unsigned lineno, struct part_conf *conf,
+ char *flag, char *val)
+{
+ int len = strlen(flag);
+ if (!strncmp(flag, "ipoib", len)) {
+ conf->is_ipoib = 1;
+ }
+ else if (!strncmp(flag, "mtu", len)) {
+ if (!val || (conf->mtu = strtoul(val, NULL, 0)) == 0)
PARSEWARN(conf->p_log, lineno,
- "unrecognized partition flag \'%s\'"
- " - ignored.\n", flag);
- }
+ "flag \'mtu\' requires valid value"
+ " - skipped.\n");
+ }
+ else if (!strncmp(flag, "rate", len)) {
+ if (!val || (conf->rate = strtoul(val, NULL, 0)) == 0)
+ PARSEWARN(conf->p_log, lineno,
+ "flag \'rate\' requires valid value"
+ " - skipped.\n");
+ }
+ else {
+ PARSEWARN(conf->p_log, lineno,
+ "unrecognized partition flag \'%s\'"
+ " - ignored.\n", flag);
}
-
return 0;
}
@@ -285,7 +306,11 @@ static int parse_part_conf(struct part_c
p += ret;
len += ret;
- if (q) {
+ while (q) {
+ flag = flval = NULL;
+ q = strchr(p, ',');
+ if (q)
+ *q++ = '\0';
ret = parse_name_token(p, &flag, &flval);
if (!flag) {
PARSERR(conf->p_log, lineno,
@@ -294,6 +319,7 @@ static int parse_part_conf(struct part_c
}
p += ret;
len += ret;
+ partition_add_flag(lineno, conf, flag, flval);
}
if (p != str || (partition_create(lineno, conf,
More information about the general
mailing list