aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/re
diff options
context:
space:
mode:
authorPyun YongHyeon <yongari@FreeBSD.org>2014-05-13 05:19:29 +0000
committerPyun YongHyeon <yongari@FreeBSD.org>2014-05-13 05:19:29 +0000
commit74a034464e1a12ea02fd71a7054ee56da406ec67 (patch)
tree1ad152a67f1d2bf708ee38b1b7e8e65c3a748d4f /sys/dev/re
parentc732cd1af1ac303a919809c4f18fc8a6d3969785 (diff)
downloadsrc-74a034464e1a12ea02fd71a7054ee56da406ec67.tar.gz
src-74a034464e1a12ea02fd71a7054ee56da406ec67.zip
Disable TX IP/TCP/UDP checksum offloading for RTL8168C/RTL8168CP.
Previously only TX IP checksum offloading was disabled but it's reported that TX checksum offloading for UDP datagrams with IP options also generates corrupted frames. Reporter's controller is RTL8168CP but I guess RTL8168C also have the same issue since it shall share the same core. Reported and tested by: tuexen
Notes
Notes: svn path=/head/; revision=265943
Diffstat (limited to 'sys/dev/re')
-rw-r--r--sys/dev/re/if_re.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/sys/dev/re/if_re.c b/sys/dev/re/if_re.c
index cce305bade2b..f687daa8937a 100644
--- a/sys/dev/re/if_re.c
+++ b/sys/dev/re/if_re.c
@@ -1619,16 +1619,18 @@ re_attach(device_t dev)
ifp->if_start = re_start;
/*
* RTL8168/8111C generates wrong IP checksummed frame if the
- * packet has IP options so disable TX IP checksum offloading.
+ * packet has IP options so disable TX checksum offloading.
*/
if (sc->rl_hwrev->rl_rev == RL_HWREV_8168C ||
sc->rl_hwrev->rl_rev == RL_HWREV_8168C_SPIN2 ||
- sc->rl_hwrev->rl_rev == RL_HWREV_8168CP)
- ifp->if_hwassist = CSUM_TCP | CSUM_UDP;
- else
+ sc->rl_hwrev->rl_rev == RL_HWREV_8168CP) {
+ ifp->if_hwassist = 0;
+ ifp->if_capabilities = IFCAP_RXCSUM | IFCAP_TSO4;
+ } else {
ifp->if_hwassist = CSUM_IP | CSUM_TCP | CSUM_UDP;
+ ifp->if_capabilities = IFCAP_HWCSUM | IFCAP_TSO4;
+ }
ifp->if_hwassist |= CSUM_TSO;
- ifp->if_capabilities = IFCAP_HWCSUM | IFCAP_TSO4;
ifp->if_capenable = ifp->if_capabilities;
ifp->if_init = re_init;
IFQ_SET_MAXLEN(&ifp->if_snd, RL_IFQ_MAXLEN);
@@ -3364,7 +3366,6 @@ re_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
struct rl_softc *sc = ifp->if_softc;
struct ifreq *ifr = (struct ifreq *) data;
struct mii_data *mii;
- uint32_t rev;
int error = 0;
switch (command) {
@@ -3453,15 +3454,9 @@ re_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
if ((mask & IFCAP_TXCSUM) != 0 &&
(ifp->if_capabilities & IFCAP_TXCSUM) != 0) {
ifp->if_capenable ^= IFCAP_TXCSUM;
- if ((ifp->if_capenable & IFCAP_TXCSUM) != 0) {
- rev = sc->rl_hwrev->rl_rev;
- if (rev == RL_HWREV_8168C ||
- rev == RL_HWREV_8168C_SPIN2 ||
- rev == RL_HWREV_8168CP)
- ifp->if_hwassist |= CSUM_TCP | CSUM_UDP;
- else
- ifp->if_hwassist |= RE_CSUM_FEATURES;
- } else
+ if ((ifp->if_capenable & IFCAP_TXCSUM) != 0)
+ ifp->if_hwassist |= RE_CSUM_FEATURES;
+ else
ifp->if_hwassist &= ~RE_CSUM_FEATURES;
reinit = 1;
}