static int partition_add_port(unsigned lineno, struct part_conf *conf, char *name, char *flag) { osm_prtn_t *p = conf->p_prtn; ib_net64_t guid; boolean_t full = conf->full; if (!name || !*name || !strncmp(name, "NONE", strlen(name))) return 0; if (flag) { /* reset default membership to limited */ full = FALSE; if (!strncmp(flag, "full", strlen(flag))) full = TRUE; else if (strncmp(flag, "limited", strlen(flag))) { OSM_LOG(conf->p_log, OSM_LOG_VERBOSE, "PARSE WARN: line %d: " "unrecognized port flag \'%s\'." " Assume \'limited\'\n", lineno, flag); } } if (!strncmp(name, "ALL", strlen(name))) { return osm_prtn_add_all(conf->p_log, conf->p_subn, p, 0, full) == IB_SUCCESS ? 0 : -1; } else if (!strncmp(name, "ALL_CAS", strlen(name))) { return osm_prtn_add_all(conf->p_log, conf->p_subn, p, IB_NODE_TYPE_CA, full) == IB_SUCCESS ? 0 : -1; } else if (!strncmp(name, "ALL_SWITCHES", strlen(name))) { return osm_prtn_add_all(conf->p_log, conf->p_subn, p, IB_NODE_TYPE_SWITCH, full) == IB_SUCCESS ? 0 : -1; } else if (!strncmp(name, "ALL_ROUTERS", strlen(name))) { return osm_prtn_add_all(conf->p_log, conf->p_subn, p, IB_NODE_TYPE_ROUTER, full) == IB_SUCCESS ? 0 : -1; } else if (!strncmp(name, "SELF", strlen(name))) { guid = cl_ntoh64(conf->p_subn->sm_port_guid); } else { char *end; guid = strtoull(name, &end, 0); if (!guid || *end) return -1; } if (osm_prtn_add_port(conf->p_log, conf->p_subn, p, cl_hton64(guid), full) != IB_SUCCESS) return -1; return 0; }
static ib_api_status_t prtn_make_default(osm_log_t * p_log, osm_subn_t * p_subn, boolean_t no_config) { ib_api_status_t status = IB_UNKNOWN_ERROR; osm_prtn_t *p; p = osm_prtn_make_new(p_log, p_subn, "Default", IB_DEFAULT_PARTIAL_PKEY); if (!p) goto _err; status = osm_prtn_add_all(p_log, p_subn, p, 0, no_config, FALSE); if (status != IB_SUCCESS) goto _err; cl_map_remove(&p->part_guid_tbl, p_subn->sm_port_guid); status = osm_prtn_add_port(p_log, p_subn, p, p_subn->sm_port_guid, TRUE, FALSE); /* ipv4 broadcast group */ if (no_config) osm_prtn_add_mcgroup(p_log, p_subn, p, OSM_DEFAULT_MGRP_RATE, OSM_DEFAULT_MGRP_MTU, OSM_DEFAULT_SL, 0, OSM_IPOIB_BROADCAST_MGRP_QKEY, 0, 0, &osm_ipoib_broadcast_mgid); _err: return status; }