From owner-svn-src-head@FreeBSD.ORG Sun Mar 8 23:02:17 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E99F565E; Sun, 8 Mar 2015 23:02:17 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CA3003B2; Sun, 8 Mar 2015 23:02:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t28N2HPa009453; Sun, 8 Mar 2015 23:02:17 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t28N2GgG009449; Sun, 8 Mar 2015 23:02:16 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201503082302.t28N2GgG009449@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 8 Mar 2015 23:02:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r279797 - head/sys/dev/etherswitch/arswitch X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Mar 2015 23:02:18 -0000 Author: adrian Date: Sun Mar 8 23:02:15 2015 New Revision: 279797 URL: https://svnweb.freebsd.org/changeset/base/279797 Log: Methodise a couple more of the VLAN methods. Modified: head/sys/dev/etherswitch/arswitch/arswitch.c head/sys/dev/etherswitch/arswitch/arswitch_vlans.c head/sys/dev/etherswitch/arswitch/arswitch_vlans.h head/sys/dev/etherswitch/arswitch/arswitchvar.h Modified: head/sys/dev/etherswitch/arswitch/arswitch.c ============================================================================== --- head/sys/dev/etherswitch/arswitch/arswitch.c Sun Mar 8 22:50:45 2015 (r279796) +++ head/sys/dev/etherswitch/arswitch/arswitch.c Sun Mar 8 23:02:15 2015 (r279797) @@ -312,6 +312,8 @@ arswitch_attach(device_t dev) sc->hal.arswitch_get_dot1q_vlan = ar8xxx_get_dot1q_vlan; sc->hal.arswitch_set_dot1q_vlan = ar8xxx_set_dot1q_vlan; + sc->hal.arswitch_flush_dot1q_vlan = ar8xxx_flush_dot1q_vlan; + sc->hal.arswitch_purge_dot1q_vlan = ar8xxx_purge_dot1q_vlan; sc->hal.arswitch_get_port_vlan = ar8xxx_get_port_vlan; sc->hal.arswitch_set_port_vlan = ar8xxx_set_port_vlan; Modified: head/sys/dev/etherswitch/arswitch/arswitch_vlans.c ============================================================================== --- head/sys/dev/etherswitch/arswitch/arswitch_vlans.c Sun Mar 8 22:50:45 2015 (r279796) +++ head/sys/dev/etherswitch/arswitch/arswitch_vlans.c Sun Mar 8 23:02:15 2015 (r279797) @@ -53,11 +53,10 @@ /* * XXX TODO: teach about the AR933x SoC switch * XXX TODO: teach about the AR934x SoC switch - * XXX TODO: teach about the AR8327 external switch */ static int -arswitch_vlan_op(struct arswitch_softc *sc, uint32_t op, uint32_t vid, +ar8xxx_vlan_op(struct arswitch_softc *sc, uint32_t op, uint32_t vid, uint32_t data) { int err; @@ -87,20 +86,20 @@ arswitch_vlan_op(struct arswitch_softc * return (0); } -static int -arswitch_flush_dot1q_vlan(struct arswitch_softc *sc) +int +ar8xxx_flush_dot1q_vlan(struct arswitch_softc *sc) { ARSWITCH_LOCK_ASSERT(sc, MA_OWNED); - return (arswitch_vlan_op(sc, AR8X16_VLAN_OP_FLUSH, 0, 0)); + return (ar8xxx_vlan_op(sc, AR8X16_VLAN_OP_FLUSH, 0, 0)); } -static int -arswitch_purge_dot1q_vlan(struct arswitch_softc *sc, int vid) +int +ar8xxx_purge_dot1q_vlan(struct arswitch_softc *sc, int vid) { ARSWITCH_LOCK_ASSERT(sc, MA_OWNED); - return (arswitch_vlan_op(sc, AR8X16_VLAN_OP_PURGE, vid, 0)); + return (ar8xxx_vlan_op(sc, AR8X16_VLAN_OP_PURGE, vid, 0)); } int @@ -110,7 +109,7 @@ ar8xxx_get_dot1q_vlan(struct arswitch_so int err; ARSWITCH_LOCK_ASSERT(sc, MA_OWNED); - err = arswitch_vlan_op(sc, AR8X16_VLAN_OP_GET, vid, 0); + err = ar8xxx_vlan_op(sc, AR8X16_VLAN_OP_GET, vid, 0); if (err) return (err); @@ -130,7 +129,7 @@ ar8xxx_set_dot1q_vlan(struct arswitch_so int err; ARSWITCH_LOCK_ASSERT(sc, MA_OWNED); - err = arswitch_vlan_op(sc, AR8X16_VLAN_OP_LOAD, vid, ports); + err = ar8xxx_vlan_op(sc, AR8X16_VLAN_OP_LOAD, vid, ports); if (err) return (err); return (0); @@ -193,7 +192,7 @@ ar8xxx_reset_vlans(struct arswitch_softc } } - if (arswitch_flush_dot1q_vlan(sc)) { + if (sc->hal.arswitch_flush_dot1q_vlan(sc)) { ARSWITCH_UNLOCK(sc); return; } @@ -323,7 +322,7 @@ ar8xxx_setvgroup(struct arswitch_softc * (vid & ETHERSWITCH_VID_VALID) != 0 && (vid & ETHERSWITCH_VID_MASK) != (vg->es_vid & ETHERSWITCH_VID_MASK)) { - err = arswitch_purge_dot1q_vlan(sc, vid); + err = sc->hal.arswitch_purge_dot1q_vlan(sc, vid); if (err) { ARSWITCH_UNLOCK(sc); return (err); Modified: head/sys/dev/etherswitch/arswitch/arswitch_vlans.h ============================================================================== --- head/sys/dev/etherswitch/arswitch/arswitch_vlans.h Sun Mar 8 22:50:45 2015 (r279796) +++ head/sys/dev/etherswitch/arswitch/arswitch_vlans.h Sun Mar 8 23:02:15 2015 (r279797) @@ -35,6 +35,8 @@ int ar8xxx_setvgroup(struct arswitch_sof int ar8xxx_get_pvid(struct arswitch_softc *, int, int *); int ar8xxx_set_pvid(struct arswitch_softc *, int, int); +int ar8xxx_flush_dot1q_vlan(struct arswitch_softc *sc); +int ar8xxx_purge_dot1q_vlan(struct arswitch_softc *sc, int vid); int ar8xxx_get_dot1q_vlan(struct arswitch_softc *sc, uint32_t *ports, int vid); int ar8xxx_set_dot1q_vlan(struct arswitch_softc *sc, uint32_t ports, int vid); int ar8xxx_get_port_vlan(struct arswitch_softc *sc, uint32_t *ports, int vid); Modified: head/sys/dev/etherswitch/arswitch/arswitchvar.h ============================================================================== --- head/sys/dev/etherswitch/arswitch/arswitchvar.h Sun Mar 8 22:50:45 2015 (r279796) +++ head/sys/dev/etherswitch/arswitch/arswitchvar.h Sun Mar 8 23:02:15 2015 (r279797) @@ -99,6 +99,9 @@ struct arswitch_softc { int (* arswitch_vlan_set_pvid) (struct arswitch_softc *, int, int); + int (* arswitch_flush_dot1q_vlan) (struct arswitch_softc *sc); + int (* arswitch_purge_dot1q_vlan) (struct arswitch_softc *sc, + int vid); int (* arswitch_get_dot1q_vlan) (struct arswitch_softc *, uint32_t *ports, int vid); int (* arswitch_set_dot1q_vlan) (struct arswitch_softc *sc,