Skip to contentSkip to conversation

Linux 2.4.18 8139too.c driver fix for mii-tool

DISCUSSION David Ashley 2 participants 2 messages Dec 2, 2002

lore
Share & tools
lore
#0 lore raw

mii-tool doesn't work with the 8139too.c driver (RTL8139 based network cards). Internally the driver uses phy ID #'s 32+, but when ioctls are used to access the phy registers, the ID is masked down to 0-0x1f, so none of them work properly, and mii-tool fails.

The fix is to change the masking done in the top of netdev_ioctl:

	if (cmd != SIOCETHTOOL) {
		/* With SIOCETHTOOL, this would corrupt the pointer.  */
		data->phy_id &= 0x3f; // was 0x1f (DA) 20021202
		data->reg_num &= 0x1f;
	}

-Dave

#1 lore raw
Quoted 11 lines · David Ashley

mii-tool doesn't work with the 8139too.c driver (RTL8139 based network cards). Internally the driver uses phy ID #'s 32+, but when ioctls are used to access the phy registers, the ID is masked down to 0-0x1f, so none of them work properly, and mii-tool fails.

The fix is to change the masking done in the top of netdev_ioctl:

	if (cmd != SIOCETHTOOL) {
		/* With SIOCETHTOOL, this would corrupt the pointer.  */
		data->phy_id &= 0x3f; // was 0x1f (DA) 20021202
		data->reg_num &= 0x1f;
	}

Already fixed in the latest stable kernel, 2.4.20.

But thanks for testing though!