Hi Ralph, On Tue, 2006-01-10 at 13:31, Ralph Campbell wrote: > If opensm is started with no arguments, the default algorithm > for finding a port to bind to will skip ports which are present > but the link is DOWN. If there is only one port in the system, > no port is selected and opensm tries the default HCA name "mthca0" > which, if not present, confuses opensm and it exits. > > The following patch changes the port selection so that the first > active port is selected, and if none, the first non-disabled port.
This is close and headed in the right direction but has one property I'm not too fond of: when there are no active ports, it does not prefer a port whose physical state is link up over one in (say) polling (anything other than link up) so the subnet may not come up when it could in that case. -- Hal > Signed-off-by: Ralph Campbell <[EMAIL PROTECTED]> > > Index: umad.c > =================================================================== > --- umad.c (revision 4900) > +++ umad.c (working copy) > @@ -207,9 +207,9 @@ > } > > /* > - * if *port > 0 checks ca[port] state. Otherwise set *port to > + * if *port > 0, check ca[port] state. Otherwise set *port to > * the first port that is active, and if such is not found, to > - * the first port that is (physically) up. Otherwise return -1; > + * the first port that is not disabled. Otherwise return -1; > */ > static int > resolve_ca_port(char *ca_name, int *port) > @@ -228,14 +228,14 @@ > return 1; > } > > - if (*port > 0) { /* user wants user gets */ > + if (*port > 0) { /* check only the port the user wants */ > if (*port > ca.numports) > return -1; > if (!ca.ports[*port]) > return -1; > if (ca.ports[*port]->state == 4) > return 1; > - if (ca.ports[*port]->phys_state == 5) > + if (ca.ports[*port]->phys_state != 3) > return 0; > return -1; > } > @@ -244,7 +244,7 @@ > DEBUG("checking port %d", i); > if (!ca.ports[i]) > continue; > - if (up < 0 && ca.ports[i]->phys_state == 5) > + if (up < 0 && ca.ports[i]->phys_state != 3) > up = *port = i; > if (ca.ports[i]->state == 4) { > active = *port = i; > @@ -278,10 +278,11 @@ > return ca_name; > } > > - /* find first existing HCA with Active port */ > + /* Get the list of CA names. */ > if ((n = umad_get_cas_names((void *)names, UMAD_CA_NAME_LEN)) < 0) > return 0; > > + /* Find the first existing CA with an active port. */ > for (caidx = 0; caidx < n; caidx++) { > TRACE("checking ca '%s'", names[caidx]); > _______________________________________________ openib-general mailing list openib-general@openib.org http://openib.org/mailman/listinfo/openib-general To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general