svn commit: r200759 - head/sys/dev/vge

Pyun YongHyeon yongari at FreeBSD.org
Sun Dec 20 19:45:46 UTC 2009


Author: yongari
Date: Sun Dec 20 19:45:46 2009
New Revision: 200759
URL: http://svn.freebsd.org/changeset/base/200759

Log:
  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.

Modified:
  head/sys/dev/vge/if_vge.c
  head/sys/dev/vge/if_vgevar.h

Modified: head/sys/dev/vge/if_vge.c
==============================================================================
--- head/sys/dev/vge/if_vge.c	Sun Dec 20 19:11:32 2009	(r200758)
+++ head/sys/dev/vge/if_vge.c	Sun Dec 20 19:45:46 2009	(r200759)
@@ -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 comm
 
 	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);

Modified: head/sys/dev/vge/if_vgevar.h
==============================================================================
--- head/sys/dev/vge/if_vgevar.h	Sun Dec 20 19:11:32 2009	(r200758)
+++ head/sys/dev/vge/if_vgevar.h	Sun Dec 20 19:45:46 2009	(r200759)
@@ -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;


More information about the svn-src-all mailing list