[ofa-general] Re: ibsim parsing question
Hal Rosenstock
hrosenstock at xsigo.com
Mon May 12 13:40:04 PDT 2008
On Mon, 2008-05-12 at 23:18 +0000, Sasha Khapyorsky wrote:
> On 23:12 Mon 12 May , Sasha Khapyorsky wrote:
> > On 13:02 Mon 12 May , Hal Rosenstock wrote:
> > >
> > > In your previous post, you wrote:
> > > "node description value is ignored by ibsim parser in those lines
> > > anyway"
> > > so that seems like it should be "skipped" rather than treating it like
> > > some keyword preceeds it.
> >
> > Yes, that is correct.
>
> Something like this should help (eg ignore "unknown" options).
Right; that's what I meant by option 1.
Also, it's not really unknown options since it's part of the
NodeDescription.
This works as long as the "known" options (currently s= and w=) are not
part of NodeDescription. It works for the real life use case that
started this.
-- Hal
> Sasha
>
>
> diff --git a/ibsim/sim_net.c b/ibsim/sim_net.c
> index 2a9c19b..6e3c0e9 100644
> --- a/ibsim/sim_net.c
> +++ b/ibsim/sim_net.c
> @@ -432,32 +432,31 @@ static int parse_port_lid_and_lmc(Port * port, char *line)
>
> static int parse_port_opt(Port * port, char *opt, char *val)
> {
> - int width;
> - int speed;
> + int v;
>
> - if (*opt == 'w') {
> - width = strtoul(val, 0, 0);
> - if (!is_linkwidth_valid(width))
> + switch (*opt) {
> + case 'w':
> + v = strtoul(val, 0, 0);
> + if (!is_linkwidth_valid(v))
> return -1;
>
> - port->linkwidthena = width;
> + port->linkwidthena = v;
> DEBUG("port %p linkwidth enabled set to %d", port,
> port->linkwidthena);
> - return 0;
> - } else if (*opt == 's') {
> - speed = strtoul(val, 0, 0);
> -
> - if (!is_linkspeed_valid(speed))
> + break;
> + case 's':
> + v = strtoul(val, 0, 0);
> + if (!is_linkspeed_valid(v))
> return -1;
>
> - port->linkspeedena = speed;
> + port->linkspeedena = v;
> DEBUG("port %p linkspeed enabled set to %d", port,
> port->linkspeedena);
> - return 0;
> - } else {
> - IBWARN("unknown opt %c", *opt);
> - return -1;
> + break;
> + default:
> + break;
> }
> + return 0;
> }
>
> static void init_ports(Node * node, int type, int maxports)
> _______________________________________________
> general mailing list
> general at lists.openfabrics.org
> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general
>
> To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general
More information about the general
mailing list