fail to load vlans into the vlan translation unit

Yasir hussan kolyasir at
Tue Feb 19 18:54:21 UTC 2013

i can`t send u complete patch yet, i will send u main point where i think
am getting failer, its not bug free code, plz to understand logic

u8 portmask=0;//[AR8216_NUM_PORTS];
int i, j;

/* flush all vlan translation unit entries */
ar8216_vtu_op(priv, AR8216_VTU_OP_FLUSH, 0);

ar8316_vtu_op(sc, AR8316_VTU_OP_LOAD |
    (1/*vlanid*/ << AR8316_VTU_VID_SHIFT),
    (3 /*ports*/<< 1) | (1 << AR8316_CPU_PORT));
 ar8316_vtu_op(sc, AR8316_VTU_OP_LOAD |
    (2/*vlanid*/ << AR8316_VTU_VID_SHIFT),
    (12 /*ports*/<< 1) | (1 << AR8316_CPU_PORT));

/* update the port destination mask registers and tag settings */
for (i = 0; i < AR8216_NUM_PORTS; i++) {
int egress, ingress;
int pvid;

if ( i<3) {
 pvid =1;//priv->vlan_id[priv->pvid[i]];
} else {
pvid = 2//i;

egress = AR8216_OUT_STRIP_VLAN;

ingress = AR8216_IN_SECURE;

ar8316_reg_update(sc->sc_pdev, AR8316_REG_PORT_CTRL(i),
    (egress << AR8316_PORT_CTRL_VLAN_MODE_SHIFT) |

ar8316_reg_update(sc->sc_pdev, AR8316_REG_PORT_VLAN(i),
    (portmask << AR8316_PORT_VLAN_DEST_PORTS_SHIFT) |
    (ingress << AR8316_PORT_VLAN_MODE_SHIFT) |
    (pvid << AR8316_PORT_VLAN_DEFAULT_ID_SHIFT));

I think two vlan with ids 1,2 should be created which would be working fine
by just upgrading registers, if i am missing something u can it...


On Tue, Feb 19, 2013 at 10:07 PM, Yasir hussan <kolyasir at> wrote:

> hi,
> i am trying to build up vlan feature for chip ar8316 in freebsd, i am yet
> able to make a single defualt vlan which is working properly, where i am
> failing is i guess is in calculate the port destination masks and load
> vlans into the vlan translation unit, i am tring to copy style of
> open-wrt, u can also brows it from
> the vlan i tried to add in last is working as defualt vlan but switch
> should also add the previous one vlans.I think it should even work if i
> dont use loop and just use ar8216_vtu_op funtion to add each vlan, but it
> does`t work on me, kindly anyone body have idea what i am missing or have
> any suggestion would be arpiciotive..
> Thanks,

More information about the freebsd-current mailing list