From bb7dfefb45a7d7505173291429ad36be6bfa904b Mon Sep 17 00:00:00 2001 From: Bill Paul Date: Thu, 11 Jan 2007 20:31:35 +0000 Subject: Fix re_setmulti() so that it works correctly for PCIe chips where the multicast hash table are in reverse order compared to older devices. --- sys/dev/re/if_re.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/sys/dev/re/if_re.c b/sys/dev/re/if_re.c index 2ea024d1e238..6eae2ac5b3ca 100644 --- a/sys/dev/re/if_re.c +++ b/sys/dev/re/if_re.c @@ -620,6 +620,7 @@ re_setmulti(sc) struct ifmultiaddr *ifma; u_int32_t rxfilt; int mcnt = 0; + u_int32_t hwrev; RL_LOCK_ASSERT(sc); @@ -660,8 +661,24 @@ re_setmulti(sc) rxfilt &= ~RL_RXCFG_RX_MULTI; CSR_WRITE_4(sc, RL_RXCFG, rxfilt); - CSR_WRITE_4(sc, RL_MAR0, hashes[0]); - CSR_WRITE_4(sc, RL_MAR4, hashes[1]); + + /* + * For some unfathomable reason, RealTek decided to reverse + * the order of the multicast hash registers in the PCI Express + * 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 || hwrev == RL_HWREV_8101E || + hwrev == RL_HWREV_8168_SPIN1 || hwrev == RL_HWREV_8168_SPIN2) { + CSR_WRITE_4(sc, RL_MAR0, bswap32(hashes[1])); + CSR_WRITE_4(sc, RL_MAR4, bswap32(hashes[0])); + } else { + CSR_WRITE_4(sc, RL_MAR0, hashes[0]); + CSR_WRITE_4(sc, RL_MAR4, hashes[1]); + } } static void -- cgit v1.3