diff options
author | yongari <yongari@FreeBSD.org> | 2006-11-21 04:40:30 +0000 |
---|---|---|
committer | yongari <yongari@FreeBSD.org> | 2006-11-21 04:40:30 +0000 |
commit | bcc65cbefc6ba075a92b5d87e248c64653ac1674 (patch) | |
tree | c9818a04ac6a2fe04f1c27f4c554d8be9422b4e5 | |
parent | 31dadd4d684390cafbda57c8ff033ff9812b64a0 (diff) | |
download | FreeBSD-src-bcc65cbefc6ba075a92b5d87e248c64653ac1674.zip FreeBSD-src-bcc65cbefc6ba075a92b5d87e248c64653ac1674.tar.gz |
Add TSO support.
Tested by: wilko, Pieter de Goeje < pieter AT degoeje DOT nl >
-rw-r--r-- | sys/dev/re/if_re.c | 34 | ||||
-rw-r--r-- | sys/pci/if_rlreg.h | 1 |
2 files changed, 25 insertions, 10 deletions
diff --git a/sys/dev/re/if_re.c b/sys/dev/re/if_re.c index e9ca0f1..f576632 100644 --- a/sys/dev/re/if_re.c +++ b/sys/dev/re/if_re.c @@ -1258,8 +1258,8 @@ re_attach(dev) ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = re_ioctl; ifp->if_start = re_start; - ifp->if_hwassist = RE_CSUM_FEATURES; - ifp->if_capabilities = IFCAP_HWCSUM; + ifp->if_hwassist = RE_CSUM_FEATURES | CSUM_TSO; + ifp->if_capabilities = IFCAP_HWCSUM | IFCAP_TSO4; ifp->if_capenable = ifp->if_capabilities; ifp->if_watchdog = re_watchdog; ifp->if_init = re_init; @@ -2032,12 +2032,18 @@ re_encap(sc, m_head, idx) arg.rl_flags = 0; - if ((*m_head)->m_pkthdr.csum_flags & CSUM_IP) - arg.rl_flags |= RL_TDESC_CMD_IPCSUM; - if ((*m_head)->m_pkthdr.csum_flags & CSUM_TCP) - arg.rl_flags |= RL_TDESC_CMD_TCPCSUM; - if ((*m_head)->m_pkthdr.csum_flags & CSUM_UDP) - arg.rl_flags |= RL_TDESC_CMD_UDPCSUM; + if (((*m_head)->m_pkthdr.csum_flags & CSUM_TSO) != 0) + arg.rl_flags = RL_TDESC_CMD_LGSEND | + ((uint32_t)(*m_head)->m_pkthdr.tso_segsz << + RL_TDESC_CMD_MSSVAL_SHIFT); + else { + if ((*m_head)->m_pkthdr.csum_flags & CSUM_IP) + arg.rl_flags |= RL_TDESC_CMD_IPCSUM; + if ((*m_head)->m_pkthdr.csum_flags & CSUM_TCP) + arg.rl_flags |= RL_TDESC_CMD_TCPCSUM; + if ((*m_head)->m_pkthdr.csum_flags & CSUM_UDP) + arg.rl_flags |= RL_TDESC_CMD_UDPCSUM; + } arg.sc = sc; arg.rl_idx = *idx; @@ -2542,15 +2548,23 @@ re_ioctl(ifp, command, data) if (mask & IFCAP_HWCSUM) { ifp->if_capenable ^= IFCAP_HWCSUM; if (ifp->if_capenable & IFCAP_TXCSUM) - ifp->if_hwassist = RE_CSUM_FEATURES; + ifp->if_hwassist |= RE_CSUM_FEATURES; else - ifp->if_hwassist = 0; + ifp->if_hwassist = ~RE_CSUM_FEATURES; reinit = 1; } if (mask & IFCAP_VLAN_HWTAGGING) { ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; reinit = 1; } + if (mask & IFCAP_TSO4) { + ifp->if_capenable ^= IFCAP_TSO4; + if ((IFCAP_TSO4 & ifp->if_capenable) && + (IFCAP_TSO4 & ifp->if_capabilities)) + ifp->if_hwassist |= CSUM_TSO; + else + ifp->if_hwassist &= ~CSUM_TSO; + } if (reinit && ifp->if_drv_flags & IFF_DRV_RUNNING) re_init(sc); VLAN_CAPABILITIES(ifp); diff --git a/sys/pci/if_rlreg.h b/sys/pci/if_rlreg.h index 973d2d5..4553635 100644 --- a/sys/pci/if_rlreg.h +++ b/sys/pci/if_rlreg.h @@ -541,6 +541,7 @@ struct rl_desc { #define RL_TDESC_CMD_UDPCSUM 0x00020000 /* UDP checksum enable */ #define RL_TDESC_CMD_IPCSUM 0x00040000 /* IP header checksum enable */ #define RL_TDESC_CMD_MSSVAL 0x07FF0000 /* Large send MSS value */ +#define RL_TDESC_CMD_MSSVAL_SHIFT 16 /* Large send MSS value shift */ #define RL_TDESC_CMD_LGSEND 0x08000000 /* TCP large send enb */ #define RL_TDESC_CMD_EOF 0x10000000 /* end of frame marker */ #define RL_TDESC_CMD_SOF 0x20000000 /* start of frame marker */ |