From owner-svn-src-all@FreeBSD.ORG Wed May 8 20:56:43 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id CAA503D9; Wed, 8 May 2013 20:56:43 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A3960CCA; Wed, 8 May 2013 20:56:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r48Kuhnf080380; Wed, 8 May 2013 20:56:43 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r48Kuhxe080379; Wed, 8 May 2013 20:56:43 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201305082056.r48Kuhxe080379@svn.freebsd.org> From: Adrian Chadd Date: Wed, 8 May 2013 20:56:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r250384 - head/sys/dev/etherswitch/ukswitch X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 May 2013 20:56:43 -0000 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 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 =