[ofa-general] [PATCH] libibmad/dump.c: Support link speed and width vendor extensions

Jason Gunthorpe jgunthorpe at obsidianresearch.com
Sat Nov 17 12:53:49 PST 2007


On Tue, Nov 13, 2007 at 07:38:43AM -0800, Hal Rosenstock wrote:
> libibmad/dump.c: Support link speed and width vendor extensions
> 
> When decoding values, handle vendor extensions to link speed and width
> including accommodating a "documentation" change between IBA 1.2 and
> 1.2.1

Isn't this better done with a bitmap match?

const unsigned int widths[] = {1,4,8,12};

char S[300];
int off = 0;
for (unsigned int I = 0; I != sizeof(width)/sizeof(width[0]) && off < sizeof(S); I++)
   if ((width >> I) & 1)
      off += snprintf(S,sizeof(S)-off,"%uX ",widths[I]);

Regards,
Jason



More information about the general mailing list