Re: fail to load vlans into the vlan translation unit

From: Yasir hussan <kolyasir_at_gmail.com>
Date: Tue, 19 Feb 2013 23:54:14 +0500
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),
    AR8316_PORT_CTRL_LEARN | AR8316_PORT_CTRL_VLAN_MODE |
    AR8316_PORT_CTRL_SINGLE_VLAN | AR8316_PORT_CTRL_STATE |
    AR8316_PORT_CTRL_HEADER | AR8316_PORT_CTRL_LEARN_LOCK,
    AR8316_PORT_CTRL_LEARN |
    (egress << AR8316_PORT_CTRL_VLAN_MODE_SHIFT) |
    (AR8316_PORT_STATE_FORWARD <<
    AR8316_PORT_CTRL_STATE_SHIFT));

ar8316_reg_update(sc->sc_pdev, AR8316_REG_PORT_VLAN(i),
    AR8316_PORT_VLAN_DEST_PORTS | AR8316_PORT_VLAN_MODE |
    AR8316_PORT_VLAN_DEFAULT_ID,
    (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...

Thanks,


On Tue, Feb 19, 2013 at 10:07 PM, Yasir hussan <kolyasir_at_gmail.com> 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
> https://dev.openwrt.org/browser/trunk/target/linux/generic-2.6/files/drivers/net/phy/ar8216.c?rev=20083
>
>
> 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,
>
Received on Tue Feb 19 2013 - 17:54:21 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:35 UTC