[ofw][patch] added new case in ipoib_mac_from_guid to handle hp oui

Fab Tillier ftillier at windows.microsoft.com
Thu Jun 19 09:23:16 PDT 2008


Hi Anatoly,

There are checks for Cisco, SuperMicro, and now HP GUIDs that essentially do the same thing except for the hardcoded OUI in the MAC address.  The handlers for converting these GUIDs are only invoked after a check on the OUI:

> +               else if( p_guid[1] == 0x1a && p_guid[2] == 0x4b )
> +               {
> +                       status = ipoib_mac_from_hp_guid( port_guid,
> p_mac_addr );

So the following assertion is unnecessary:

> +       ASSERT( p_guid[0] == 0x00 && p_guid[1] == 0x1a && p_guid[2] ==
> 0x4b);

Next, if the code here:

> +       p_mac_addr->addr[0] = 0;
> +       p_mac_addr->addr[1] = 0x1a;
> +       p_mac_addr->addr[2] = 0x4b;
> +       p_mac_addr->addr[3] = p_guid[5];
> +       p_mac_addr->addr[4] = p_guid[6];
> +       p_mac_addr->addr[5] = p_guid[7];

Used the values from the GUID in the upper 3 bytes, the three functions could be replaced with as single common function.  Maybe name it "ipoib_easy_mac_from_guid" or something.

This would result in your patch being a net reduction in code, which is a good thing.

-Fab



More information about the ofw mailing list