Who would ever need that?
January 31st 2007 @ 6:36 pm Tech

We ran into a problem at work last night. A new version of the same model of a server had a very different set of hardware in it. To be specific, we have lots of Sun X4100 servers, and we were deploying some new ones… but these where the M2 series of X4100s. And instead of 4 Intel NICs, they had 2 nVidia NICs and 2 Intel NICs. And the nVidia NICs quite consistently failed. We couldn’t make them work. So eventually I hacked around this and did some minor magic to make the 2nd two NICs primary, and the last two NICs secondary. When I went home, one of my co-workers was coming in and started digging through the source code, since apparently this work on a later revision of the OS (RedHat EL3 vs EL4). He found this in the EL3 version of forcedeth.c:


static int nv_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
{
struct fe_priv *np = get_nvpriv(dev);
...

} else if (ecmd->autoneg == AUTONEG_DISABLE) {
/* Note: autonegotiation disable, speed 1000 intentionally
* forbidden - noone should need that. */

if (ecmd->speed != SPEED_10 && ecmd->speed != SPEED_100)
return -EINVAL;
if (ecmd->duplex != DUPLEX_HALF && ecmd->duplex != DUPLEX_FULL)
return -EINVAL;
} else {
...
}

For those of you who don’t read C, note the comment. It says if auto-negotiation is turned off (a common practice on servers), you can’t set this gigabit network card to gigabit speed. It will only do gigabit in autoneg. And the comment just makes it perfect: “no one should need that.” Wow. That. Is. Just. Wrong.

-phil
rss 2 comments
  1. March 3rd, 2007 | 7:33 pm

    There is an interesting story behind that code. Here it is:
    http://liquidat.wordpress.com/2007/03/04/the-forcedeth-story/

  2. Phil [Member]
    March 3rd, 2007 | 7:40 pm

    That’s the general story behind the driver… but no one in their right mind should ever have written the above snippet.

comment on this article

Notice: All comments are moderated. Your comment will appear once approved.