summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryongari <yongari@FreeBSD.org>2009-12-20 19:45:46 +0000
committeryongari <yongari@FreeBSD.org>2009-12-20 19:45:46 +0000
commita303d4ee7151aeabbbfc1fcb8f5afe02c1bd9dbe (patch)
tree05fd98c71ba8173fc6710b7c2e424db0f50547d1
parentd7fc8c3ed3e3340ccb60233ff6fe86cb3b63bb10 (diff)
downloadFreeBSD-src-a303d4ee7151aeabbbfc1fcb8f5afe02c1bd9dbe.zip
FreeBSD-src-a303d4ee7151aeabbbfc1fcb8f5afe02c1bd9dbe.tar.gz
Disable jumbo frame support for PCIe VT6130/VT6132 controllers.
Quite contrary to VT6130 datasheet which says it supports up to 8K jumbo frame, VT6130 does not seem to send jumbo frame that is larger than 4K in length. Trying to send a frame that is larger than 4K cause TX MAC hang. Even though it's possible to allow 4K jumbo frame for VT6130, I think it's meaningless to allow 4K jumbo frame. I'm not sure VT6132 also has the same limitation but I guess it uses the same MAC of VT6130.
-rw-r--r--sys/dev/vge/if_vge.c15
-rw-r--r--sys/dev/vge/if_vgevar.h1
2 files changed, 13 insertions, 3 deletions
diff --git a/sys/dev/vge/if_vge.c b/sys/dev/vge/if_vge.c
index 5ad6ed8..fa54bbe 100644
--- a/sys/dev/vge/if_vge.c
+++ b/sys/dev/vge/if_vge.c
@@ -1013,7 +1013,8 @@ vge_attach(device_t dev)
if (pci_find_extcap(dev, PCIY_EXPRESS, &cap) == 0) {
sc->vge_flags |= VGE_FLAG_PCIE;
sc->vge_expcap = cap;
- }
+ } else
+ sc->vge_flags |= VGE_FLAG_JUMBO;
if (pci_find_extcap(dev, PCIY_PMG, &cap) == 0) {
sc->vge_flags |= VGE_FLAG_PMCAP;
sc->vge_pmcap = cap;
@@ -2221,9 +2222,17 @@ vge_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
switch (command) {
case SIOCSIFMTU:
- if (ifr->ifr_mtu > VGE_JUMBO_MTU)
+ VGE_LOCK(sc);
+ if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > VGE_JUMBO_MTU)
error = EINVAL;
- ifp->if_mtu = ifr->ifr_mtu;
+ else if (ifp->if_mtu != ifr->ifr_mtu) {
+ if (ifr->ifr_mtu > ETHERMTU &&
+ (sc->vge_flags & VGE_FLAG_JUMBO) == 0)
+ error = EINVAL;
+ else
+ ifp->if_mtu = ifr->ifr_mtu;
+ }
+ VGE_UNLOCK(sc);
break;
case SIOCSIFFLAGS:
VGE_LOCK(sc);
diff --git a/sys/dev/vge/if_vgevar.h b/sys/dev/vge/if_vgevar.h
index da8f6c5..ca899cc 100644
--- a/sys/dev/vge/if_vgevar.h
+++ b/sys/dev/vge/if_vgevar.h
@@ -187,6 +187,7 @@ struct vge_softc {
#define VGE_FLAG_PCIE 0x0001
#define VGE_FLAG_MSI 0x0002
#define VGE_FLAG_PMCAP 0x0004
+#define VGE_FLAG_JUMBO 0x0008
#define VGE_FLAG_SUSPENDED 0x4000
#define VGE_FLAG_LINK 0x8000
int vge_expcap;
OpenPOWER on IntegriCloud