vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| The following diff changes the re(4) driver so it will store the hw revision in a softc field once at attach time instead of reading it everytime through re_setmulti(). Also change the hw revision checking in re_setmulti() to a easier to read switch case. No functional change. Index: re.c ================================================== ================= RCS file: /cvs/src/sys/dev/ic/re.c,v retrieving revision 1.69 diff -u -p -r1.69 re.c --- re.c 2 Mar 2007 17:49:51 -0000 1.69 +++ re.c 14 Mar 2007 22:42:13 -0000 @@ -503,7 +503,7 @@ re_setmulti(struct rl_softc *sc) struct ifnet *ifp; int h = 0; u_int32_t hashes[2] = { 0, 0 }; - u_int32_t hwrev, rxfilt; + u_int32_t rxfilt; int mcnt = 0; struct arpcom *ac = &sc->sc_arpcom; struct ether_multi *enm; @@ -558,13 +558,16 @@ re_setmulti(struct rl_softc *sc) * parts. This means we have to write the hash pattern in reverse * order for those devices. */ - hwrev = CSR_READ_4(sc, RL_TXCFG) & RL_TXCFG_HWREV; - if (hwrev == RL_HWREV_8100E_SPIN1 || hwrev == RL_HWREV_8100E_SPIN2 || - hwrev == RL_HWREV_8101E || hwrev == RL_HWREV_8168_SPIN1 || - hwrev == RL_HWREV_8168_SPIN2) { + switch (sc->sc_hwrev) { + case RL_HWREV_8100E_SPIN1: + case RL_HWREV_8100E_SPIN2: + case RL_HWREV_8101E: + case RL_HWREV_8168_SPIN1: + case RL_HWREV_8168_SPIN2: CSR_WRITE_4(sc, RL_MAR0, swap32(hashes[1])); CSR_WRITE_4(sc, RL_MAR4, swap32(hashes[0])); - } else { + break; + default: CSR_WRITE_4(sc, RL_MAR0, hashes[0]); CSR_WRITE_4(sc, RL_MAR4, hashes[1]); } @@ -813,7 +816,6 @@ re_attach(struct rl_softc *sc, const cha struct ifnet *ifp; u_int16_t re_did = 0; int error = 0, i; - u_int32_t hwrev; const struct re_revision *rr; const char *re_name = NULL; @@ -869,16 +871,16 @@ re_attach(struct rl_softc *sc, const cha bcopy(eaddr, (char *)&sc->sc_arpcom.ac_enaddr, ETHER_ADDR_LEN); - hwrev = CSR_READ_4(sc, RL_TXCFG) & RL_TXCFG_HWREV; + sc->sc_hwrev = CSR_READ_4(sc, RL_TXCFG) & RL_TXCFG_HWREV; for (rr = re_revisions; rr->re_name != NULL; rr++) { - if (rr->re_chipid == hwrev) + if (rr->re_chipid == sc->sc_hwrev) re_name = rr->re_name; } if (re_name == NULL) - printf(": unknown ASIC (0x%04x)", hwrev >> 16); + printf(": unknown ASIC (0x%04x)", sc->sc_hwrev >> 16); else - printf(": %s (0x%04x)", re_name, hwrev >> 16); + printf(": %s (0x%04x)", re_name, sc->sc_hwrev >> 16); printf(", %s, address %s\n", intrstr, ether_sprintf(sc->sc_arpcom.ac_enaddr)); Index: rtl81x9reg.h ================================================== ================= RCS file: /cvs/src/sys/dev/ic/rtl81x9reg.h,v retrieving revision 1.36 diff -u -p -r1.36 rtl81x9reg.h --- rtl81x9reg.h 12 Dec 2006 10:24:38 -0000 1.36 +++ rtl81x9reg.h 14 Mar 2007 22:37:16 -0000 @@ -719,6 +719,7 @@ struct rl_softc { struct arpcom sc_arpcom; /* interface info */ struct mii_data sc_mii; /* MII information */ u_int8_t rl_type; + u_int32_t sc_hwrev; int rl_eecmd_read; int rl_eewidth; void *sc_sdhook; /* shutdownhook */ -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. |