Commit e2c1c2f7 authored by Rahul Thakur's avatar Rahul Thakur

iopsys-brcm63xx-arm: add support for QinQ on unmanaged bridge.

parent 905f3909
......@@ -11,6 +11,7 @@ MACADDR=""
TYPE="8021q"
PRIORITY=0
VLANID=1
INNER_VLANID=0
TVLANID=0
ROUTED=1
BRIDGED=0
......@@ -253,10 +254,17 @@ create_vlan() {
fi
if [ $TYPE == "8021ad" ]; then
# If type is 8021ad, push inner tag.
TAGINDEX=1
vlanCtl_cmdSetTagVid $INNER_VLANID $TAGINDEX
vlanCtl_cmdSetTagPbits $INNER_PRIORITY $TAGINDEX
if [ $UNMANAGED -eq 0 ]; then
# If type is 8021ad, push inner tag.
TAGINDEX=1
vlanCtl_cmdSetTagVid $INNER_VLANID $TAGINDEX
vlanCtl_cmdSetTagPbits $INNER_PRIORITY $TAGINDEX
else
vlanCtl_cmdPushVlanTag
TAGINDEX=0
vlanCtl_cmdSetTagVid $VLANID $TAGINDEX
vlanCtl_cmdSetTagPbits $PRIORITY $TAGINDEX
fi
vlanCtl_cmdSetEtherType 0x88A8 # $vlanTpid
fi
......@@ -269,6 +277,12 @@ create_vlan() {
POSITION="rule-insert-before"
TAGRULEID="-1"
vlanCtl_insertTagRule $IFNAME $DIRECTION $TAGS $POSITION $TAGRULEID
if [ $TYPE == "8021ad" ]; then
if [ $UNMANAGED -eq 1 ]; then
TAGS=1
vlanCtl_insertTagRule $IFNAME $DIRECTION $TAGS $POSITION $TAGRULEID
fi
fi
# If translation is enabled on this interface, modify outgoing VLAN ID
if [ $TVLANID -ne 0 ]; then
......@@ -309,6 +323,7 @@ create_vlan() {
vlanCtl_cmdPopVlanTag
[ $TYPE == "8021ad" ] && vlanCtl_cmdPopVlanTag
else
[ $TYPE == "8021ad" ] && vlanCtl_cmdPopVlanTag
# If VLAN translated vlan id is configured, then on ingress,
# write the translated vlan id into the header
if [ $TVLANID -ne 0 ]; then
......@@ -377,6 +392,8 @@ create_vlan() {
fi
else
# ******** untagged virtual interface ******** #
TPIDTABLE="0x8100 0x8100 0x88A8 0x9100"
vlanCtl_setTpidTable $IFNAME $TPIDTABLE
# ======== Set tx rules ======== #
......@@ -394,6 +411,7 @@ create_vlan() {
if [ $UNMANAGED -eq 1 ]; then
# For the untagged interface at tx, pop the tag if any
vlanCtl_cmdPopVlanTag
[ $INNER_VLANID -ne 0 ] && vlanCtl_cmdPopVlanTag
TAGS=1
fi
......@@ -420,9 +438,19 @@ create_vlan() {
# interface
if [ $UNMANAGED -eq 1 ]; then
vlanCtl_cmdPushVlanTag
if [ $INNER_VLANID -ne 0 ]; then
vlanCtl_cmdPushVlanTag
fi
TAGINDEX=0
vlanCtl_cmdSetTagVid $VLANID $TAGINDEX
vlanCtl_cmdSetTagPbits $PRIORITY $TAGINDEX
if [ $INNER_VLANID -ne 0 ]; then
# If type is 8021ad, push inner tag.
TAGINDEX=1
vlanCtl_cmdSetTagVid $INNER_VLANID $TAGINDEX
vlanCtl_cmdSetTagPbits $INNER_PRIORITY $TAGINDEX
vlanCtl_cmdSetEtherType 0x88A8 # $vlanTpid
fi
fi
# If a managed interface, forward unconditionally to
# the rx vlan interface
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment