Anaconda currently does not detect link for drivers that do not support the IOCTLs. I found that in QEMU when trying to test iSCSI Anaconda tried to setup networking even if the network was configured. This patch assumes that if there is link on devices that don't support the required ioctls.
Elliot
user: Elliot Peele http://issues.rpath.com/ files: isys/linkdetect.c
Assume there is link on devices that don't support the required ioctls (RPL-2301)
diff -r 925b8bd510d7 -r 3e60e4b058e2 isys/linkdetect.c --- a/isys/linkdetect.c Mon Mar 10 12:29:50 2008 -0400 +++ b/isys/linkdetect.c Wed Mar 26 16:02:08 2008 -0400 @@ -73,6 +73,8 @@ int i, mii_val[32];
if (ioctl(sock, SIOCGMIIPHY, &ifr) < 0) { + if (errno == EOPNOTSUPP) + return -2; if (errno != ENODEV) #ifdef STANDALONE fprintf(stderr, "SIOCGMIIPHY on '%s' failed: %s\n", @@ -113,6 +115,9 @@ #ifdef STANDALONE fprintf(stderr, "Cannot get link status (%d): %s\n", errno, strerror(errno)); #endif + } else { + // ethtool not supported by driver + return -2; }
return -1; @@ -122,6 +127,7 @@
int get_link_status(char * devname) { int sock, rc; + int link_status_supported = 1;
if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { #ifdef STANDALONE @@ -145,13 +151,15 @@ if (rc == 1) { close(sock); return 1; + } else if (rc == -2) { + link_status_supported = 0; }
rc = get_mii_link_status(sock); #ifdef STANDALONE printf("MII link status of %s is: %d\n", devname, rc); #endif - if (rc == 1) { + if (rc == 1 || (rc == -2 && link_status_supported == 0)) { close(sock); return 1; }
On Thu, 2008-03-27 at 16:56 -0400, Elliot Peele wrote:
Anaconda currently does not detect link for drivers that do not support the IOCTLs. I found that in QEMU when trying to test iSCSI Anaconda tried to setup networking even if the network was configured. This patch assumes that if there is link on devices that don't support the required ioctls.
Why not fix the drivers instead of papering over the problem?
Jeremy
On Thu, Mar 27, 2008 at 05:09:46PM -0400, Jeremy Katz wrote:
Why not fix the drivers instead of papering over the problem?
You might be able to read bit 2 (GDLNK) of the mode configuration register (MCR) of a *real* 8390, but I don't think that the qemu hw emulation has the bit set properly... I don't see where qemu handles MCR read/writes at all...
It doesn't seem unreasonable to assume the link is up if the ioctls are not supported by a driver.
Meanwhile, Elliot - you might want to use one of the other ethernet cards emulated by qemu like the rtl8139.
Cheers,
Matt
On Thu, 2008-03-27 at 19:29 -0400, Matt Wilson wrote:
Meanwhile, Elliot - you might want to use one of the other ethernet cards emulated by qemu like the rtl8139.
or e1000.
On Thu, 2008-03-27 at 19:29 -0400, Matt Wilson wrote:
On Thu, Mar 27, 2008 at 05:09:46PM -0400, Jeremy Katz wrote:
Why not fix the drivers instead of papering over the problem?
You might be able to read bit 2 (GDLNK) of the mode configuration register (MCR) of a *real* 8390, but I don't think that the qemu hw emulation has the bit set properly... I don't see where qemu handles MCR read/writes at all...
The qemu source is available too ;-)
It doesn't seem unreasonable to assume the link is up if the ioctls are not supported by a driver.
Except for the cases from when this whole link checking stuff was added where drivers didn't support things and didn't have instant link up. So the wait is the price you pay for poor drivers.
Meanwhile, Elliot - you might want to use one of the other ethernet cards emulated by qemu like the rtl8139.
Indeed, I'd recommend this in any case. ne2k is slloooowwww
Jeremy
anaconda-devel@lists.stg.fedoraproject.org