Date: Fri, 11 Sep 1998 23:56:07 -0500 From: jdugan@ncsa.uiuc.edu To: FreeBSD-gnats-submit@FreeBSD.ORG Subject: kern/7902: if_de doesn't properly recognize a "Magic Packet" variant SROM Message-ID: <E0zHhjD-0003BV-00@rivendell.ncsa.uiuc.edu>
next in thread | raw e-mail | index | archive | help
>Number: 7902 >Category: kern >Synopsis: if_de doesn't properly recognize a "Magic Packet" variant SROM >Confidential: no >Severity: serious >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Sep 11 22:00:00 PDT 1998 >Last-Modified: >Originator: Jon Dugan >Organization: NCSA, University of Illinois >Release: 2.2.6-RELEASE >Environment: FreeBSD olorin.ncsa.uiuc.edu 2.2.6-RELEASE FreeBSD 2.2.6-RELEASE #1: Fri Sep 11 23:06:40 CDT 1998 root@olorin.ncsa.uiuc.edu:/usr/src/sys/compile/OLORIN i386 Running on a Hitachi Visionbook Pro 7590. >Description: With 2.2.6-RELEASE and 2.2.7-RELEASE as well (they both use revision 1.54.2.10 of if_de.c) tulip based ethernet interfaces with the "Magic Packet" format SROMs are not properly detected because of a failed checksum. Revision 1.74 of if_de.c has a fix that will handle this, but it's kinda kludgey. My fix actually checks the checksum for the variant SROM format. (The differnce is that the normal SROM checksum is performed on bytes 0-125 and the low order 16 bits of the checksum are stored in bytes 126 & 127 of the SROM. In the case of the "Magic Packet" format SROM the checksum is for bytes 0-93 and the low order 16 bits are stored in bytes 94 & 95.) As far as I can tell the specification provides no way to tell if it is a standard format SROM or a "Magic Packet" SROM. I am not confident that my solution is the right thing to do in all cases, but it does work for me. The docs that I am working from are: http://developer.intel.com/design/network/new21/download/srom_405.doc (in M$ Word format which sucks). I made PostScript and PDF versions of the docs which you can grab at http://rivendell.ncsa.uiuc.edu/~jdugan/srom.{ps,pdf}. I think this patch is a little better than the way the similiar situation is handled in revision 1.74 of if_de.c. Although the 1.74 patch will potentially work in more situations. It should patch against the current RELENG_2_2 (1.54.2.11) just fine. This is the first time I've submitted a pr, so I hope I've covered all the bases, let me know if I missed something... >How-To-Repeat: Boot kernel.GENERIC from at 2.2 system on a Hitachi Visionbook Pro 7590. Although some 7590s may have if_lnc based interfaces...mine has a if_de based interface. >Fix: Here's a patch that will check the checksum for the "Magic Packet" format SROMs: *** if_de.c.orig Fri Sep 11 22:00:19 1998 --- if_de.c Fri Sep 11 23:01:26 1998 *************** *** 2066,2074 **** } #define tulip_mchash(mca) (tulip_crc32(mca, 6) & 0x1FF) ! #define tulip_srom_crcok(databuf) ( \ ! ((tulip_crc32(databuf, 126) & 0xFFFFU) ^ 0xFFFFU) == \ ! ((databuf)[126] | ((databuf)[127] << 8))) static unsigned tulip_crc32( --- 2066,2074 ---- } #define tulip_mchash(mca) (tulip_crc32(mca, 6) & 0x1FF) ! #define tulip_srom_crcok(databuf,len) ( \ ! ((tulip_crc32(databuf, (len)) & 0xFFFFU) ^ 0xFFFFU) == \ ! ((databuf)[(len)] | ((databuf)[(len)+1] << 8))) static unsigned tulip_crc32( *************** *** 2780,2789 **** sc->tulip_boardsw = &tulip_21140_eb_boardsw; } tulip_srom_read(sc); ! if (tulip_srom_crcok(sc->tulip_rombuf)) { /* * SROM CRC is valid therefore it must be in the * new format. */ sc->tulip_features |= TULIP_HAVE_ISVSROM; } else if (sc->tulip_rombuf[126] == 0xff && sc->tulip_rombuf[127] == 0xFF) { --- 2780,2794 ---- sc->tulip_boardsw = &tulip_21140_eb_boardsw; } tulip_srom_read(sc); ! if (tulip_srom_crcok(sc->tulip_rombuf,126)) { /* * SROM CRC is valid therefore it must be in the * new format. + */ + sc->tulip_features |= TULIP_HAVE_ISVSROM; + } else if (tulip_srom_crcok(sc->tulip_rombuf,94)) { + /* + * This controller supports "Magic Packet" */ sc->tulip_features |= TULIP_HAVE_ISVSROM; } else if (sc->tulip_rombuf[126] == 0xff && sc->tulip_rombuf[127] == 0xFF) { >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E0zHhjD-0003BV-00>