svn commit: r250384 - head/sys/dev/etherswitch/ukswitch

Adrian Chadd adrian at FreeBSD.org
Wed May 8 20:56:43 UTC 2013


Author: adrian
Date: Wed May  8 20:56:43 2013
New Revision: 250384
URL: http://svnweb.freebsd.org/changeset/base/250384

Log:
  Fix the ukswitch code to work with the new vlan changes:
  
  * Fix API changes;
  * remove unused code;
  * Allow some switches to be used that don't expose a set of PHY
    registers for the CPU facing port (eg the ADM6996 for the Ubiquiti
    Routerstation.)
  
  Submitted by:	Luiz Otavio O Souza <loos.br at gmail.com>
  Reviewed by:	ray

Modified:
  head/sys/dev/etherswitch/ukswitch/ukswitch.c

Modified: head/sys/dev/etherswitch/ukswitch/ukswitch.c
==============================================================================
--- head/sys/dev/etherswitch/ukswitch/ukswitch.c	Wed May  8 20:54:59 2013	(r250383)
+++ head/sys/dev/etherswitch/ukswitch/ukswitch.c	Wed May  8 20:56:43 2013	(r250384)
@@ -120,8 +120,6 @@ ukswitch_attach_phys(struct ukswitch_sof
 			continue;
 		sc->ifpport[phy] = port;
 		sc->portphy[port] = phy;
-//		if (phy == sc->cpuport)
-//			sc->info.es_cpuport = port;
 		sc->ifp[port] = if_alloc(IFT_ETHER);
 		sc->ifp[port]->if_softc = sc;
 		sc->ifp[port]->if_flags |= IFF_UP | IFF_BROADCAST |
@@ -166,7 +164,7 @@ ukswitch_attach(device_t dev)
 	/* XXX Defaults */
 	sc->numports = 6;
 	sc->phymask = 0x0f;
-	sc->cpuport = 5;
+	sc->cpuport = -1;
 	sc->media = 100;
 
 	(void) resource_int_value(device_get_name(dev), device_get_unit(dev),
@@ -182,9 +180,9 @@ ukswitch_attach(device_t dev)
 	if (sc->media != 100 && sc->media != 1000)
 		sc->media = 100;
 
-	/* Always attach the cpu port. */
-	sc->phymask |= (1 << sc->cpuport);
-//	sc->info.es_cpuport = sc->cpuport;
+	if (sc->cpuport != -1)
+		/* Always attach the cpu port. */
+		sc->phymask |= (1 << sc->cpuport);
 
 	/* We do not support any vlan groups. */
 	sc->info.es_nvlangroups = 0;
@@ -347,15 +345,17 @@ ukswitch_getport(device_t dev, etherswit
 	struct ukswitch_softc *sc = device_get_softc(dev);
 	struct mii_data *mii;
 	struct ifmediareq *ifmr = &p->es_ifmr;
-	int err;
+	int err, phy;
 
 	if (p->es_port < 0 || p->es_port >= sc->numports)
 		return (ENXIO);
-	p->es_vlangroup = 0;
+	p->es_pvid = 0;
 
+	phy = sc->portphy[p->es_port];
 	mii = ukswitch_miiforport(sc, p->es_port);
-	if (sc->portphy[p->es_port] == sc->cpuport) {
+	if (sc->cpuport != -1 && phy == sc->cpuport) {
 		/* fill in fixed values for CPU port */
+		p->es_flags |= ETHERSWITCH_PORT_CPU;
 		ifmr->ifm_count = 0;
 		if (sc->media == 100)
 			ifmr->ifm_current = ifmr->ifm_active =


More information about the svn-src-head mailing list