From fd413d352f75c321c300654fb2b8d7a5762a9f7f Mon Sep 17 00:00:00 2001 From: yongari Date: Sun, 23 Mar 2008 04:59:13 +0000 Subject: Always honor configured VLAN/checksum offload capabilities. Previously re(4) used to blindly enable VLAN hardware tag stripping and Rx checksum offload regardless of enabled optional features of interface. --- sys/dev/re/if_re.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'sys/dev/re/if_re.c') diff --git a/sys/dev/re/if_re.c b/sys/dev/re/if_re.c index 6613282..0b8757a 100644 --- a/sys/dev/re/if_re.c +++ b/sys/dev/re/if_re.c @@ -2410,6 +2410,7 @@ re_init_locked(sc) struct ifnet *ifp = sc->rl_ifp; struct mii_data *mii; u_int32_t rxcfg = 0; + uint16_t cfg; union { uint32_t align_dummy; u_char eaddr[ETHER_ADDR_LEN]; @@ -2429,9 +2430,13 @@ re_init_locked(sc) * RX checksum offload. We must configure the C+ register * before all others. */ - CSR_WRITE_2(sc, RL_CPLUS_CMD, RL_CPLUSCMD_RXENB| - RL_CPLUSCMD_TXENB|RL_CPLUSCMD_PCI_MRW| - RL_CPLUSCMD_VLANSTRIP|RL_CPLUSCMD_RXCSUM_ENB); + cfg = RL_CPLUSCMD_PCI_MRW; + if ((ifp->if_capenable & IFCAP_RXCSUM) != 0) + cfg |= RL_CPLUSCMD_RXCSUM_ENB; + if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0) + cfg |= RL_CPLUSCMD_VLANSTRIP; + CSR_WRITE_2(sc, RL_CPLUS_CMD, + cfg | RL_CPLUSCMD_RXENB | RL_CPLUSCMD_TXENB); /* * Init our MAC address. Even though the chipset -- cgit v1.1