Bug 491358
Summary: | mii-tool is broken | ||||||
---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Bill Nottingham <notting> | ||||
Component: | net-tools | Assignee: | Jiri Popelka <jpopelka> | ||||
Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
Severity: | medium | Docs Contact: | |||||
Priority: | low | ||||||
Version: | 10 | CC: | agospoda, anton.fang, rvokal | ||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | All | ||||||
OS: | Linux | ||||||
Whiteboard: | |||||||
Fixed In Version: | 1.60-95.fc11 | Doc Type: | Bug Fix | ||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2009-11-12 01:00:07 UTC | Type: | --- | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Attachments: |
|
Description
Bill Nottingham
2009-03-20 15:44:24 UTC
when mii-tool checks link status, this code is called (from mii-tool.c): 200 int show_basic_mii(int sock, int phy_id) 201 { 202 char buf[100]; 203 int i, mii_val[32]; 204 int bmcr, bmsr, advert, lkpar; 205 206 /* Some bits in the BMSR are latched, but we can't rely on being 207 the only reader, so only the current values are meaningful */ 208 mdio_read(sock, MII_BMSR); 209 for (i = 0; i < ((verbose > 1) ? 32 : 8); i++) 210 mii_val[i] = mdio_read(sock, i); 211 212 if (mii_val[MII_BMCR] == 0xffff) { 213 fprintf(stderr, " No MII transceiver present!.\n"); 214 return -1; 215 } Since 'verbose' is false, we will call the SIOCGMIIREG ioctl with the commands MII_BMSR and then the commands 0-7 will be called. Those commands are: #define MII_BMCR 0x00 /* Basic mode control register */ #define MII_BMSR 0x01 /* Basic mode status register */ #define MII_PHYSID1 0x02 /* PHYS ID 1 */ #define MII_PHYSID2 0x03 /* PHYS ID 2 */ #define MII_ADVERTISE 0x04 /* Advertisement control reg */ #define MII_LPA 0x05 /* Link partner ability reg */ #define MII_EXPANSION 0x06 /* Expansion register */ #define MII_CTRL1000 0x09 /* 1000BASE-T control */ Where is 0x7???? If we look at the sources for e1000e, we can see why -EIO is returned. From drivers/net/e1000e/netdev.c (e1000_mii_ioctl) in net-next-2.6 upstream tree: 4347 case SIOCGMIIREG: 4348 if (!capable(CAP_NET_ADMIN)) 4349 return -EPERM; 4350 switch (data->reg_num & 0x1F) { 4351 case MII_BMCR: 4352 data->val_out = adapter->phy_regs.bmcr; 4353 break; 4354 case MII_BMSR: 4355 data->val_out = adapter->phy_regs.bmsr; 4356 break; 4357 case MII_PHYSID1: 4358 data->val_out = (adapter->hw.phy.id >> 16); 4359 break; 4360 case MII_PHYSID2: 4361 data->val_out = (adapter->hw.phy.id & 0xFFFF); 4362 break; 4363 case MII_ADVERTISE: 4364 data->val_out = adapter->phy_regs.advertise; 4365 break; 4366 case MII_LPA: 4367 data->val_out = adapter->phy_regs.lpa; 4368 break; 4369 case MII_EXPANSION: 4370 data->val_out = adapter->phy_regs.expansion; 4371 break; 4372 case MII_CTRL1000: 4373 data->val_out = adapter->phy_regs.ctrl1000; 4374 break; 4375 case MII_STAT1000: 4376 data->val_out = adapter->phy_regs.stat1000; 4377 break; 4378 case MII_ESTATUS: 4379 data->val_out = adapter->phy_regs.estatus; 4380 break; 4381 default: 4382 return -EIO; 4383 } 4384 break; The killer is 0x7 -- it seems it should not be checked by mii-tool. My guess is that this would fail on multiple devices. Have you tried it with any other interfaces? The only other wired device I have access to ATM is e100 - it doesn't throw an error. Interesting. Is mii-tool always called in initscripts or only when ethtool fails. Always, at least until I build http://git.fedorahosted.org/git/?p=initscripts.git;a=commitdiff;h=a1460db13758eb3d9f3a512a4b20cc4c91eb4d8e for rawhide. Created attachment 366821 [details]
mii-tool patch
mii-tool will be checking only generic MII registers defined in <linux/mii.h>
i.e.
#define MII_BMCR 0x00 /* Basic mode control register */
#define MII_BMSR 0x01 /* Basic mode status register */
#define MII_PHYSID1 0x02 /* PHYS ID 1 */
#define MII_PHYSID2 0x03 /* PHYS ID 2 */
#define MII_ADVERTISE 0x04 /* Advertisement control reg */
#define MII_LPA 0x05 /* Link partner ability reg */
#define MII_EXPANSION 0x06 /* Expansion register */
#define MII_CTRL1000 0x09 /* 1000BASE-T control */
#define MII_STAT1000 0x0a /* 1000BASE-T status */
#define MII_ESTATUS 0x0f /* Extended Status */
#define MII_DCOUNTER 0x12 /* Disconnect counter */
#define MII_FCSCOUNTER 0x13 /* False carrier counter */
#define MII_NWAYTEST 0x14 /* N-way auto-neg test reg */
#define MII_RERRCOUNTER 0x15 /* Receive error counter */
#define MII_SREVISION 0x16 /* Silicon revision */
#define MII_RESV1 0x17 /* Reserved... */
#define MII_LBRERROR 0x18 /* Lpback, rx, bypass error */
#define MII_PHYADDR 0x19 /* PHY address */
#define MII_RESV2 0x1a /* Reserved... */
#define MII_TPISTATUS 0x1b /* TPI status for 10mbps */
#define MII_NCONFIG 0x1c /* Network interface config */
net-tools-1.60-95.fc11 has been pushed to the Fedora 11 testing repository. If problems still persist, please make note of it in this bug report. If you want to test the update, you can install it with su -c 'yum --enablerepo=updates-testing update net-tools'. You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F11/FEDORA-2009-11010 net-tools-1.60-97.fc12 has been submitted as an update for Fedora 12. http://admin.fedoraproject.org/updates/net-tools-1.60-97.fc12 net-tools-1.60-98.fc12 has been pushed to the Fedora 12 testing repository. If problems still persist, please make note of it in this bug report. If you want to test the update, you can install it with su -c 'yum --enablerepo=updates-testing update net-tools'. You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F12/FEDORA-2009-11140 net-tools-1.60-95.fc11 has been pushed to the Fedora 11 stable repository. If problems still persist, please make note of it in this bug report. |