mirror of
https://github.com/opnsense/src.git
synced 2026-06-08 16:22:46 -04:00
MFC r207375-207377.
r207375: Preserve unknown bits of RX MAC control register when driver programs RX filter configuration. It seems RX MAC control register is one of key registers to get various offloading features as well as performance. Blindly clearing unrelated bits can result in unexpected results. Tested by: xclin <xclin <> cs dot nctu dot edu dot tw > r207376: Remove wrong link state chage. r207377: Explicitly marks SiS190 to differentiate it from SiS191.
This commit is contained in:
parent
71bd361a5f
commit
ac61735c1d
2 changed files with 18 additions and 17 deletions
|
|
@ -453,8 +453,9 @@ sge_rxfilter(struct sge_softc *sc)
|
|||
SGE_LOCK_ASSERT(sc);
|
||||
|
||||
ifp = sc->sge_ifp;
|
||||
hashes[0] = hashes[1] = 0;
|
||||
rxfilt = AcceptMyPhys;
|
||||
rxfilt = CSR_READ_2(sc, RxMacControl);
|
||||
rxfilt &= ~(AcceptBroadcast | AcceptAllPhys | AcceptMulticast);
|
||||
rxfilt |= AcceptMyPhys;
|
||||
if ((ifp->if_flags & IFF_BROADCAST) != 0)
|
||||
rxfilt |= AcceptBroadcast;
|
||||
if ((ifp->if_flags & (IFF_PROMISC | IFF_ALLMULTI)) != 0) {
|
||||
|
|
@ -463,20 +464,20 @@ sge_rxfilter(struct sge_softc *sc)
|
|||
rxfilt |= AcceptMulticast;
|
||||
hashes[0] = 0xFFFFFFFF;
|
||||
hashes[1] = 0xFFFFFFFF;
|
||||
goto done;
|
||||
} else {
|
||||
rxfilt |= AcceptMulticast;
|
||||
hashes[0] = hashes[1] = 0;
|
||||
/* Now program new ones. */
|
||||
if_maddr_rlock(ifp);
|
||||
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
|
||||
if (ifma->ifma_addr->sa_family != AF_LINK)
|
||||
continue;
|
||||
crc = ether_crc32_be(LLADDR((struct sockaddr_dl *)
|
||||
ifma->ifma_addr), ETHER_ADDR_LEN);
|
||||
hashes[crc >> 31] |= 1 << ((crc >> 26) & 0x1f);
|
||||
}
|
||||
if_maddr_runlock(ifp);
|
||||
}
|
||||
rxfilt |= AcceptMulticast;
|
||||
/* Now program new ones. */
|
||||
if_maddr_rlock(ifp);
|
||||
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
|
||||
if (ifma->ifma_addr->sa_family != AF_LINK)
|
||||
continue;
|
||||
crc = ether_crc32_be(LLADDR((struct sockaddr_dl *)
|
||||
ifma->ifma_addr), ETHER_ADDR_LEN);
|
||||
hashes[crc >> 31] |= 1 << ((crc >> 26) & 0x1f);
|
||||
}
|
||||
if_maddr_runlock(ifp);
|
||||
done:
|
||||
CSR_WRITE_2(sc, RxMacControl, rxfilt | 0x02);
|
||||
CSR_WRITE_4(sc, RxHashTable, hashes[0]);
|
||||
CSR_WRITE_4(sc, RxHashTable2, hashes[1]);
|
||||
|
|
@ -571,7 +572,7 @@ sge_attach(device_t dev)
|
|||
}
|
||||
sc->sge_rev = pci_get_revid(dev);
|
||||
if (pci_get_device(dev) == SIS_DEVICEID_190)
|
||||
sc->sge_flags |= SGE_FLAG_FASTETHER;
|
||||
sc->sge_flags |= SGE_FLAG_FASTETHER | SGE_FLAG_SIS190;
|
||||
/* Reset the adapter. */
|
||||
sge_reset(sc);
|
||||
|
||||
|
|
@ -1590,7 +1591,6 @@ sge_ifmedia_upd(struct ifnet *ifp)
|
|||
sc = ifp->if_softc;
|
||||
SGE_LOCK(sc);
|
||||
mii = device_get_softc(sc->sge_miibus);
|
||||
sc->sge_flags &= ~SGE_FLAG_LINK;
|
||||
if (mii->mii_instance) {
|
||||
struct mii_softc *miisc;
|
||||
LIST_FOREACH(miisc, &mii->mii_phys, mii_list)
|
||||
|
|
|
|||
|
|
@ -331,6 +331,7 @@ struct sge_softc {
|
|||
int sge_timer;
|
||||
int sge_flags;
|
||||
#define SGE_FLAG_FASTETHER 0x0001
|
||||
#define SGE_FLAG_SIS190 0x0002
|
||||
#define SGE_FLAG_RGMII 0x0010
|
||||
#define SGE_FLAG_SPEED_1000 0x2000
|
||||
#define SGE_FLAG_FDX 0x4000
|
||||
|
|
|
|||
Loading…
Reference in a new issue