Date: Sun, 8 Mar 2015 23:02:16 +0000 (UTC) From: Adrian Chadd <adrian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r279797 - head/sys/dev/etherswitch/arswitch Message-ID: <201503082302.t28N2GgG009449@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201503082302.t28N2GgG009449>