AR8327: Fix up the ability to configure the vlangroup configuration for the CPU port

I messed up when doing the reset_vlans method - setting vid[0] = 1 here
was making it 'hidden' from configuration (as it needed ETHERSWITCH_VID_VALID
as well) and so there was no way to configure vlangroup0.

In per-port VLAN mode, vlangroup0 is for the CPU port (port0).
Now, it normally wouldn't really matter - the CPU port thus sees
all other ports. However there are two CPU ports on the AR8327 and
so port0 (arge0) was seeing all traffic on port6 (arge1).
If you thus tried to use arge1/port6 for anything (eg a WAN port)
in a bridge group then things would very upset very quickly.

Whilst here, add a comment to remind myself that yes, it'd be nice
if we could specify a boot-time switch config.

Tested:

* AP135 reference platform w/ AR8327N switch
This commit is contained in:
adrian 2015-10-20 21:18:02 +00:00
parent f2fc8e1816
commit 4f765a9a46

View File

@ -66,6 +66,14 @@
#include "miibus_if.h"
#include "etherswitch_if.h"
/*
* AR8327 TODO:
*
* There should be a default hardware setup hint set for the default
* switch config. Otherwise the default is "all ports in one vlangroup",
* which means both CPU ports can see each other and that will quickly
* lead to traffic storms/loops.
*/
static int
ar8327_vlan_op(struct arswitch_softc *sc, uint32_t op, uint32_t vid,
@ -897,8 +905,8 @@ ar8327_reset_vlans(struct arswitch_softc *sc)
/*
* If dot1q - set pvid; dot1q, etc.
*/
sc->vid[0] = 1;
if (sc->vlan_mode == ETHERSWITCH_VLAN_DOT1Q) {
sc->vid[0] = 1;
for (i = 0; i < AR8327_NUM_PORTS; i++) {
/* Each port - pvid 1 */
sc->hal.arswitch_vlan_set_pvid(sc, i, sc->vid[0]);