aboutsummaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorPyun YongHyeon <yongari@FreeBSD.org>2010-03-23 19:16:35 +0000
committerPyun YongHyeon <yongari@FreeBSD.org>2010-03-23 19:16:35 +0000
commit60a337785e3b6eaf1e0b82b7819cd724dd1e1cb6 (patch)
tree11c5d13b0d703f3fc20d8836ea3aaef1803e5d30 /sys/dev
parent229c84e85bb140719cf9aec3fcab325d3287b193 (diff)
Notes
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/bge/if_bge.c41
1 files changed, 15 insertions, 26 deletions
diff --git a/sys/dev/bge/if_bge.c b/sys/dev/bge/if_bge.c
index 5209b6a6c9f1..390222816bac 100644
--- a/sys/dev/bge/if_bge.c
+++ b/sys/dev/bge/if_bge.c
@@ -2816,7 +2816,7 @@ bge_attach(device_t dev)
IFCAP_VLAN_MTU;
if ((sc->bge_flags & BGE_FLAG_TSO) != 0) {
ifp->if_hwassist |= CSUM_TSO;
- ifp->if_capabilities |= IFCAP_TSO4;
+ ifp->if_capabilities |= IFCAP_TSO4 | IFCAP_VLAN_HWTSO;
}
#ifdef IFCAP_VLAN_HWCSUM
ifp->if_capabilities |= IFCAP_VLAN_HWCSUM;
@@ -3835,12 +3835,11 @@ bge_cksum_pad(struct mbuf *m)
static struct mbuf *
bge_setup_tso(struct bge_softc *sc, struct mbuf *m, uint16_t *mss)
{
- struct ether_header *eh;
struct ip *ip;
struct tcphdr *tcp;
struct mbuf *n;
uint16_t hlen;
- uint32_t ip_off, poff;
+ uint32_t poff;
if (M_WRITABLE(m) == 0) {
/* Get a writable copy. */
@@ -3850,28 +3849,16 @@ bge_setup_tso(struct bge_softc *sc, struct mbuf *m, uint16_t *mss)
return (NULL);
m = n;
}
- ip_off = sizeof(struct ether_header);
- m = m_pullup(m, ip_off);
+ m = m_pullup(m, sizeof(struct ether_header) + sizeof(struct ip));
if (m == NULL)
return (NULL);
- eh = mtod(m, struct ether_header *);
- /* Check the existence of VLAN tag. */
- if (eh->ether_type == htons(ETHERTYPE_VLAN)) {
- ip_off = sizeof(struct ether_vlan_header);
- m = m_pullup(m, ip_off);
- if (m == NULL)
- return (NULL);
- }
- m = m_pullup(m, ip_off + sizeof(struct ip));
- if (m == NULL)
- return (NULL);
- ip = (struct ip *)(mtod(m, char *) + ip_off);
- poff = ip_off + (ip->ip_hl << 2);
+ ip = (struct ip *)(mtod(m, char *) + sizeof(struct ether_header));
+ poff = sizeof(struct ether_header) + (ip->ip_hl << 2);
m = m_pullup(m, poff + sizeof(struct tcphdr));
if (m == NULL)
return (NULL);
tcp = (struct tcphdr *)(mtod(m, char *) + poff);
- m = m_pullup(m, poff + sizeof(struct tcphdr) + tcp->th_off);
+ m = m_pullup(m, poff + (tcp->th_off << 2));
if (m == NULL)
return (NULL);
/*
@@ -4526,9 +4513,6 @@ bge_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
ifp->if_hwassist |= BGE_CSUM_FEATURES;
else
ifp->if_hwassist &= ~BGE_CSUM_FEATURES;
-#ifdef VLAN_CAPABILITIES
- VLAN_CAPABILITIES(ifp);
-#endif
}
if ((mask & IFCAP_TSO4) != 0 &&
@@ -4546,16 +4530,21 @@ bge_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
bge_init(sc);
}
- if (mask & IFCAP_VLAN_HWTAGGING) {
+ if ((mask & IFCAP_VLAN_HWTSO) != 0 &&
+ (ifp->if_capabilities & IFCAP_VLAN_HWTSO) != 0)
+ ifp->if_capenable ^= IFCAP_VLAN_HWTSO;
+ if ((mask & IFCAP_VLAN_HWTAGGING) != 0 &&
+ (ifp->if_capabilities & IFCAP_VLAN_HWTAGGING) != 0) {
ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING;
+ if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) == 0)
+ ifp->if_capenable &= ~IFCAP_VLAN_HWTSO;
BGE_LOCK(sc);
bge_setvlan(sc);
BGE_UNLOCK(sc);
+ }
#ifdef VLAN_CAPABILITIES
- VLAN_CAPABILITIES(ifp);
+ VLAN_CAPABILITIES(ifp);
#endif
- }
-
break;
default:
error = ether_ioctl(ifp, command, data);