Try   HackMD

AIROHA - VLAN Mapping Implementation

Patch on OpenWrt

  • The patch to implements the VLAN mapping is located at the
    ~/AIROHA_CPE/airoha_feeds/target/linux/airoha/patches/900-airoha_allinone_patch.patch
  • In this patch, it adds hook points at the receiving function and sending function of the Linux kernel networking stack.

Code Tracing

__netif_receive_skb_core

  • The packet receving entry of the Linux kernel is __netif_receive_skb_core.
  • We can find that it adds a inline hook (ecnt_netif_recv_inline_hook) to this function for handling the mapping rules on receiving side.

Function Call Stack

__netif_receive_skb_core
    ->ecnt_netif_recv_inline_hook
        ->ecnt_ponvlan_rx_inline_hook
            ->pon_insert_tag_hook(pon_insert_tag)

pon_insert_tag

  • This is the core function to process the VLAN rules.
  • We could use the ponvlancmd dbglevel to set the debug level, and it will show the debug information in the kernel messages .
pon_insert_tag
    is_valid_tx_rx_pkt
    store_tag_info
    handle_igmp_pkt
    handle_common_pkt
    __pon_vlan_put_tag

handle_common_pkt

  • It will eventually call to the do_option function, which assigns the TPID or TCI in the matched rule to the skb.

Function Call Stack

handle_common_pkt
    ->change_pkt_by_match_rule
        ->get_match_rule
            match_rule
        ->do_option
            add_tag_to_skb
            del_tag_from_skb
            ->change_tag_in_skb
                ->write_tag_info_to_skb
                    skb->pon_vlan_tpid[index] = out_tpid;

pon_vlan_rule_option

Function Call Stack

  • The omci daemon in the userspace will set the rules to the VLAN driver through ioctl when it receive the VLAN-related ME.
~/AIROHA_CPE/airoha_feeds/package/airoha/BSP/xpon_app/src/omci/src/omci_adpt/omci_me/omci_me_vlan_func.c

attribute_func_t extVlanTagOpTblFunc = {
    NULL,//getExtVlanTagOpTblValue, needn't in omci2.0
    setExtVlanTagOpTblValue
};

omci_attr_dscp_t omci_attr_ext_vlan_tag_op[]={
    {0, "Managed entity id",        2,  ATTR_ACCESS_R_SET_CREATE,       ATTR_FORMAT_UNSIGNED_INT,   ATTR_FULLY_SUPPORT,&generalAttrFunc},
    {1, "Association type",         1,  ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_UNSIGNED_INT,   ATTR_FULLY_SUPPORT,&extVlanTagOpAssociaTypeFunc},
    {2, "VLAN tag table Max size",  2,  ATTR_ACCESS_R,                  ATTR_FORMAT_UNSIGNED_INT,   ATTR_FULLY_SUPPORT, &extVlanTagOpMaxNumFunc},
    {3, "Input TPID",               2,  ATTR_ACCESS_R_W,                ATTR_FORMAT_UNSIGNED_INT,   ATTR_FULLY_SUPPORT, &extVlanTagOpInputTPIDFunc},
    {4, "Output TPID",              2,  ATTR_ACCESS_R_W,                ATTR_FORMAT_UNSIGNED_INT,   ATTR_FULLY_SUPPORT,&extVlanTagOpOutputTPIDFunc},
    {5, "Downstream mode",          1,  ATTR_ACCESS_R_W,                ATTR_FORMAT_UNSIGNED_INT,   ATTR_FULLY_SUPPORT,&extVlanTagOpDownModeFunc},
    {6, "VLAN tag operation table", 16, ATTR_ACCESS_R_W,                ATTR_FORMAT_TABLE,          ATTR_FULLY_SUPPORT, &extVlanTagOpTblFunc},
    {7, "Associated ME pointer",    2,  ATTR_ACCESS_R_W_SET_CREATE,     ATTR_FORMAT_UNSIGNED_INT,   ATTR_FULLY_SUPPORT,&extVlanTagOpAssociaPointerFunc},
    {8, "DSCP to P bit mapping",    24, ATTR_ACCESS_R_W,                ATTR_FORMAT_STRING,         ATTR_FULLY_SUPPORT, &extVlanTagOpDSCPMappingFunc},
    {255,   "",                     0,  0,                              0,                          0,                  NULL}
};

setExtVlanTagOpTblValue->
    ->pon_add_vlan_rule
~/AIROHA_CPE/airoha/BSP/xpon_bsp/src/app_bsp/xpon_lib/pon_vlan/lib_pon_vlan.c

pon_add_vlan_rule
        ->ponvlan_ioctl(PONVLAN_IOC_RULE_OPT,&data,sizeof(data));
~/AIROHA_CPE/airoha_feeds/package/airoha/drivers/pon_vlan/src/pon_vlan.c

ponvlan_ioctl
    ->pon_vlan_rule_option

__pon_vlan_put_tag

  • In this function, it adds the new header with TPID and VLAN TCI to the packet, and move the original MAC address to the new header.
/*
Uesd for xPon insert tag.Support set TPID
*/
struct sk_buff *__pon_vlan_put_tag(struct sk_buff *skb, u16 tpid,unsigned short vlan_tci)
{
    struct vlan_ethhdr *veth;

    if (skb_cow_head(skb, VLAN_HLEN) < 0) {
        kfree_skb(skb);
        return NULL;
    }
    veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN);

    /* Move the mac addresses to the beginning of the new header. */
    memmove(skb->data, skb->data + VLAN_HLEN, 2 * ETH_ALEN);
    skb->mac_header -= VLAN_HLEN;

    /* first, the ethernet type */
    veth->h_vlan_proto = htons(tpid);

    /* now, the TCI */
    veth->h_vlan_TCI = htons(vlan_tci);

    skb->protocol = htons(tpid);

    return skb;
}

__dev_queue_xmit

  • The __dev_queue_xmit function is usually called by dev_queue_xmit which is usually called from the Linux networking stack.
  • It will finally call to ndo_start_xmit which is implemented in the network device drver for commited the packets to the hardware.

Function Call Stack

dev_queue_xmit
    ->__dev_queue_xmit
        ->ecnt_ponvlan_xmit_inline_hook
            pon_insert_tag_hook

ecnt_ponvlan_xmit_inline_hook

  • In this function, it will call to pon_insert_tag_hook function, just like the ecnt_ponvlan_rx_inline_hook function in the receiving side.

Console Log

ponvlancmd showrule

ponvlancmd
[2024-07-09 18:56:06.745] 
[2024-07-09 18:56:06.745] root@OpenWrt:/tmp# root@OpenWrt:/tmp# /userfs/bin/gponmapcmd showQueueRule
[2024-07-09 18:56:07.709] [ 1590.477232] queuemapping-->
[2024-07-09 18:56:07.709] [ 1590.480030] gemPort	pqMode	tcont	queue	tse	tsChannelId
[2024-07-09 18:56:07.713] [ 1590.485212] 1182	00	1070	07	00	00
[2024-07-09 18:56:07.717] [ 1590.488527] 1181	00	1070	06	00	00
[2024-07-09 18:56:07.721] [ 1590.491843] 1180	00	1070	05	00	00
[2024-07-09 18:56:07.721] [ 1590.495158] 1179	00	1070	04	00	00
[2024-07-09 18:56:07.727] [ 1590.498467] 1178	00	1070	03	00	00
[2024-07-09 18:56:07.731] [ 1590.501786] 1177	00	1070	02	00	00
[2024-07-09 18:56:07.739] [ 1590.505106] 1176	00	1070	01	00	00
[2024-07-09 18:56:07.739] [ 1590.508415] 1175	00	1070	00	00	00
[2024-07-09 18:56:07.745] [ 1590.511729] 65534	01	65535	00	00	00
[2024-07-09 18:56:07.745] root@OpenWrt:/tmp# 
[2024-07-09 18:56:08.013] root@OpenWrt:/tmp# root@OpenWrt:/tmp# /userfs/bin/gponmapcmd showQueueRuleroot@OpenWrt:/tmp# /userfs/bin/ponvlancmd showruleroot@OpenWrt:/tmp# /userfs/bin/ponvlancmd showrule 3root@OpenWrt:/tmp# /userfs/bin/ponvlancmd showruleroot@OpenWrt:/tmp# /userfs/bin/ponvlancmd showrule 3
[2024-07-09 18:56:10.072] [ 1592.836060] 
[2024-07-09 18:56:10.072] [ 1592.836060] We will show some globel info below
[2024-07-09 18:56:10.072] [ 1592.836060] VLan status is 1,Igmp status is 0,resort status is 0
[2024-07-09 18:56:10.075] [ 1592.836060] Interface bind vlan is Disable,VID is:
[2024-07-09 18:56:10.079] [ 1592.853217] 13_0:4097  13_1:4097  13_2:4097  13_3:4097  13_4:4097  13_5:4097  13_6:4097  13_7:4097  
[2024-07-09 18:56:10.087] [ 1592.862456] 14_0:4097  14_1:4097  14_2:4097  14_3:4097  14_4:4097  14_5:4097  14_6:4097  14_7:4097  
[2024-07-09 18:56:10.096] [ 1592.871683] 15_0:4097  15_1:4097  15_2:4097  15_3:4097  15_4:4097  15_5:4097  15_6:4097  15_7:4097  
[2024-07-09 18:56:10.109] [ 1592.880905] 16_0:4097  16_1:4097  16_2:4097  16_3:4097  16_4:4097  16_5:4097  16_6:4097  16_7:4097  
[2024-07-09 18:56:10.116] [ 1592.890129] 17_0:4097  17_1:4097  17_2:4097  17_3:4097  17_4:4097  17_5:4097  17_6:4097  17_7:4097  
[2024-07-09 18:56:10.127] [ 1592.899356] 18_0:4097  18_1:4097  18_2:4097  18_3:4097  18_4:4097  18_5:4097  18_6:4097  18_7:4097  
[2024-07-09 18:56:10.133] [ 1592.908584] 19_0:4097  19_1:4097  19_2:4097  19_3:4097  19_4:4097  19_5:4097  19_6:4097  19_7:4097  
[2024-07-09 18:56:10.143] [ 1592.917810] 20_0:4097  20_1:4097  20_2:4097  20_3:4097  20_4:4097  20_5:4097  20_6:4097  20_7:4097  
[2024-07-09 18:56:10.152] [ 1592.917810] PCP mode is 0
[2024-07-09 18:56:10.157] [ 1592.917810] User group is Enable
[2024-07-09 18:56:10.161] [ 1592.917810] Max TPID num is 16
[2024-07-09 18:56:10.164] [ 1592.936159] 0: Disable  0x0  1: Disable  0x0  2: Disable  0x0  3: Disable  0x0  
[2024-07-09 18:56:10.170] [ 1592.943645] 4: Disable  0x0  5: Disable  0x0  6: Disable  0x0  7: Disable  0x0  
[2024-07-09 18:56:10.177] [ 1592.951121] 8: Disable  0x0  9: Disable  0x0  10: Disable  0x0  11: Disable  0x0  
[2024-07-09 18:56:10.184] [ 1592.958775] 12: Disable  0x0  13: Disable  0x0  14: Disable  0x0  15: Disable  0x0  
[2024-07-09 18:56:10.192] [ 1592.958775] We will show all rule on port 3
[2024-07-09 18:56:10.198] [ 1592.958775] Input TPID is 8100,Output TPID is 8100
[2024-07-09 18:56:10.202] [ 1592.958775] Downstream mode is 1
[2024-07-09 18:56:10.208] [ 1592.958775] Downstream mode	mask is 0xf
[2024-07-09 18:56:10.211] [ 1592.982846] 
[2024-07-09 18:56:10.211] [ 1592.982846] Downstream mode unmatch_oper is Discard
[2024-07-09 18:56:10.215] [ 1592.989281] 
[2024-07-09 18:56:10.219] [ 1592.989281] Default Rule is Enable
[2024-07-09 18:56:10.224] [ 1592.989281] User group is ffffffff
[2024-07-09 18:56:10.228] [ 1592.989281] DSCP Map is:
[2024-07-09 18:56:10.228] [ 1593.000406] 0 0 0 0 0 0 0 0 
[2024-07-09 18:56:10.232] [ 1593.003375] 1 1 1 1 1 1 1 1 
[2024-07-09 18:56:10.232] [ 1593.006337] 2 2 2 2 2 2 2 2 
[2024-07-09 18:56:10.237] [ 1593.009297] 3 3 3 3 3 3 3 3 
[2024-07-09 18:56:10.242] [ 1593.012266] 4 4 4 4 4 4 4 4 
[2024-07-09 18:56:10.242] [ 1593.015235] 5 5 5 5 5 5 5 5 
[2024-07-09 18:56:10.245] [ 1593.018195] 6 6 6 6 6 6 6 6 
[2024-07-09 18:56:10.250] [ 1593.021161] 7 7 7 7 7 7 7 7 
[2024-07-09 18:56:10.250] [ 1593.021161] Mac bind Vlan is Enable,Time out is 300
[2024-07-09 18:56:10.263] [ 1593.028988] source mac is [00:00:00:00:00:00], uprule index [1],vid mask is [0]
[2024-07-09 18:56:10.263] [ 1593.036382] Org_Outer vid is [0x0],Org_Outer pbit is [0x0]
[2024-07-09 18:56:10.270] [ 1593.041952] Org_Inner vid is [0x0],Org_Inner pbit is [0x0]
[2024-07-09 18:56:10.274] [ 1593.047519] RS_Outer vid is [0x0],Last time is [0]
[2024-07-09 18:56:10.278] [ 1593.052396] source mac is [00:00:00:00:00:00], uprule index [1],vid mask is [0]
[2024-07-09 18:56:10.285] [ 1593.059786] Org_Outer vid is [0x0],Org_Outer pbit is [0x0]
[2024-07-09 18:56:10.293] [ 1593.065354] Org_Inner vid is [0x0],Org_Inner pbit is [0x0]
[2024-07-09 18:56:10.298] [ 1593.070922] RS_Outer vid is [0x0],Last time is [0]
[2024-07-09 18:56:10.303] [ 1593.075798] source mac is [00:00:00:00:00:00], uprule index [1],vid mask is [0]
[2024-07-09 18:56:10.309] [ 1593.083193] Org_Outer vid is [0x0],Org_Outer pbit is [0x0]
[2024-07-09 18:56:10.315] [ 1593.088760] Org_Inner vid is [0x0],Org_Inner pbit is [0x0]
[2024-07-09 18:56:10.320] [ 1593.094334] RS_Outer vid is [0x0],Last time is [0]
[2024-07-09 18:56:10.326] [ 1593.099205] source mac is [00:00:00:00:00:00], uprule index [1],vid mask is [0]
[2024-07-09 18:56:10.331] [ 1593.106597] Org_Outer vid is [0x0],Org_Outer pbit is [0x0]
[2024-07-09 18:56:10.337] [ 1593.112169] Org_Inner vid is [0x0],Org_Inner pbit is [0x0]
[2024-07-09 18:56:10.343] [ 1593.117736] RS_Outer vid is [0x0],Last time is [0]
[2024-07-09 18:56:10.348] [ 1593.122613] source mac is [00:00:00:00:00:00], uprule index [1],vid mask is [0]
[2024-07-09 18:56:10.357] [ 1593.130002] Org_Outer vid is [0x0],Org_Outer pbit is [0x0]
[2024-07-09 18:56:10.361] [ 1593.135572] Org_Inner vid is [0x0],Org_Inner pbit is [0x0]
[2024-07-09 18:56:10.366] [ 1593.141140] RS_Outer vid is [0x0],Last time is [0]
[2024-07-09 18:56:10.372] [ 1593.146016] source mac is [00:00:00:00:00:00], uprule index [1],vid mask is [0]
[2024-07-09 18:56:10.379] [ 1593.153410] Org_Outer vid is [0x0],Org_Outer pbit is [0x0]
[2024-07-09 18:56:10.385] [ 1593.158977] Org_Inner vid is [0x0],Org_Inner pbit is [0x0]
[2024-07-09 18:56:10.391] [ 1593.164546] RS_Outer vid is [0x0],Last time is [0]
[2024-07-09 18:56:10.395] [ 1593.169422] source mac is [00:00:00:00:00:00], uprule index [1],vid mask is [0]
[2024-07-09 18:56:10.402] [ 1593.176812] Org_Outer vid is [0x0],Org_Outer pbit is [0x0]
[2024-07-09 18:56:10.409] [ 1593.182386] Org_Inner vid is [0x0],Org_Inner pbit is [0x0]
[2024-07-09 18:56:10.414] [ 1593.187953] RS_Outer vid is [0x0],Last time is [0]
[2024-07-09 18:56:10.421] [ 1593.192830] source mac is [00:00:00:00:00:00], uprule index [1],vid mask is [0]
[2024-07-09 18:56:10.427] [ 1593.200218] Org_Outer vid is [0x0],Org_Outer pbit is [0x0]
[2024-07-09 18:56:10.434] [ 1593.205788] Org_Inner vid is [0x0],Org_Inner pbit is [0x0]
[2024-07-09 18:56:10.438] [ 1593.211361] RS_Outer vid is [0x0],Last time is [0]
[2024-07-09 18:56:10.442] [ 1593.216237] source mac is [00:00:00:00:00:00], uprule index [1],vid mask is [0]
[2024-07-09 18:56:10.449] [ 1593.223627] Org_Outer vid is [0x0],Org_Outer pbit is [0x0]
[2024-07-09 18:56:10.455] [ 1593.229194] Org_Inner vid is [0x0],Org_Inner pbit is [0x0]
[2024-07-09 18:56:10.462] [ 1593.234765] RS_Outer vid is [0x0],Last time is [0]
[2024-07-09 18:56:10.466] [ 1593.239639] source mac is [00:00:00:00:00:00], uprule index [1],vid mask is [0]
[2024-07-09 18:56:10.472] [ 1593.247031] Org_Outer vid is [0x0],Org_Outer pbit is [0x0]
[2024-07-09 18:56:10.480] [ 1593.252603] Org_Inner vid is [0x0],Org_Inner pbit is [0x0]
[2024-07-09 18:56:10.487] [ 1593.258170] RS_Outer vid is [0x0],Last time is [0]
[2024-07-09 18:56:10.492] [ 1593.263047] source mac is [00:00:00:00:00:00], uprule index [1],vid mask is [0]
[2024-07-09 18:56:10.496] [ 1593.270436] Org_Outer vid is [0x0],Org_Outer pbit is [0x0]
[2024-07-09 18:56:10.501] [ 1593.276006] Org_Inner vid is [0x0],Org_Inner pbit is [0x0]
[2024-07-09 18:56:10.507] [ 1593.281579] RS_Outer vid is [0x0],Last time is [0]
[2024-07-09 18:56:10.513] [ 1593.286453] source mac is [00:00:00:00:00:00], uprule index [1],vid mask is [0]
[2024-07-09 18:56:10.520] [ 1593.293844] Org_Outer vid is [0x0],Org_Outer pbit is [0x0]
[2024-07-09 18:56:10.527] [ 1593.299411] Org_Inner vid is [0x0],Org_Inner pbit is [0x0]
[2024-07-09 18:56:10.533] [ 1593.304982] RS_Outer vid is [0x0],Last time is [0]
[2024-07-09 18:56:10.536] [ 1593.309856] source mac is [00:00:00:00:00:00], uprule index [1],vid mask is [0]
[2024-07-09 18:56:10.543] [ 1593.317247] Org_Outer vid is [0x0],Org_Outer pbit is [0x0]
[2024-07-09 18:56:10.548] [ 1593.322819] Org_Inner vid is [0x0],Org_Inner pbit is [0x0]
[2024-07-09 18:56:10.554] [ 1593.328387] RS_Outer vid is [0x0],Last time is [0]
[2024-07-09 18:56:10.560] [ 1593.333264] source mac is [00:00:00:00:00:00], uprule index [1],vid mask is [0]
[2024-07-09 18:56:10.568] [ 1593.340653] Org_Outer vid is [0x0],Org_Outer pbit is [0x0]
[2024-07-09 18:56:10.571] [ 1593.346232] Org_Inner vid is [0x0],Org_Inner pbit is [0x0]
[2024-07-09 18:56:10.578] [ 1593.351810] RS_Outer vid is [0x0],Last time is [0]
[2024-07-09 18:56:10.583] [ 1593.356679] source mac is [00:00:00:00:00:00], uprule index [1],vid mask is [0]
[2024-07-09 18:56:10.591] [ 1593.364072] Org_Outer vid is [0x0],Org_Outer pbit is [0x0]
[2024-07-09 18:56:10.596] [ 1593.369637] Org_Inner vid is [0x0],Org_Inner pbit is [0x0]
[2024-07-09 18:56:10.602] [ 1593.375207] RS_Outer vid is [0x0],Last time is [0]
[2024-07-09 18:56:10.608] [ 1593.380082] source mac is [00:00:00:00:00:00], uprule index [1],vid mask is [0]
[2024-07-09 18:56:10.614] [ 1593.387477] Org_Outer vid is [0x0],Org_Outer pbit is [0x0]
[2024-07-09 18:56:10.619] [ 1593.393062] Org_Inner vid is [0x0],Org_Inner pbit is [0x0]
[2024-07-09 18:56:10.628] [ 1593.398631] RS_Outer vid is [0x0],Last time is [0]
[2024-07-09 18:56:10.631] [ 1593.403519] source mac is [00:00:00:00:00:00], uprule index [1],vid mask is [0]
[2024-07-09 18:56:10.636] [ 1593.410914] Org_Outer vid is [0x0],Org_Outer pbit is [0x0]
[2024-07-09 18:56:10.643] [ 1593.416489] Org_Inner vid is [0x0],Org_Inner pbit is [0x0]
[2024-07-09 18:56:10.648] [ 1593.422059] RS_Outer vid is [0x0],Last time is [0]
[2024-07-09 18:56:10.653] [ 1593.426930] source mac is [00:00:00:00:00:00], uprule index [1],vid mask is [0]
[2024-07-09 18:56:10.659] [ 1593.434326] Org_Outer vid is [0x0],Org_Outer pbit is [0x0]
[2024-07-09 18:56:10.667] [ 1593.439889] Org_Inner vid is [0x0],Org_Inner pbit is [0x0]
[2024-07-09 18:56:10.673] [ 1593.445460] RS_Outer vid is [0x0],Last time is [0]
[2024-07-09 18:56:10.677] [ 1593.450333] source mac is [00:00:00:00:00:00], uprule index [1],vid mask is [0]
[2024-07-09 18:56:10.684] [ 1593.457727] Org_Outer vid is [0x0],Org_Outer pbit is [0x0]
[2024-07-09 18:56:10.688] [ 1593.463299] Org_Inner vid is [0x0],Org_Inner pbit is [0x0]
[2024-07-09 18:56:10.694] [ 1593.468864] RS_Outer vid is [0x0],Last time is [0]
[2024-07-09 18:56:10.699] [ 1593.473744] source mac is [00:00:00:00:00:00], uprule index [1],vid mask is [0]
[2024-07-09 18:56:10.707] [ 1593.481130] Org_Outer vid is [0x0],Org_Outer pbit is [0x0]
[2024-07-09 18:56:10.713] [ 1593.486702] Org_Inner vid is [0x0],Org_Inner pbit is [0x0]
[2024-07-09 18:56:10.719] [ 1593.492275] RS_Outer vid is [0x0],Last time is [0]
[2024-07-09 18:56:10.723] [ 1593.497147] source mac is [00:00:00:00:00:00], uprule index [1],vid mask is [0]
[2024-07-09 18:56:10.729] [ 1593.504541] Org_Outer vid is [0x0],Org_Outer pbit is [0x0]
[2024-07-09 18:56:10.736] [ 1593.510106] Org_Inner vid is [0x0],Org_Inner pbit is [0x0]
[2024-07-09 18:56:10.743] [ 1593.515678] RS_Outer vid is [0x0],Last time is [0]
[2024-07-09 18:56:10.747] [ 1593.520550] source mac is [00:00:00:00:00:00], uprule index [1],vid mask is [0]
[2024-07-09 18:56:10.753] [ 1593.527945] Org_Outer vid is [0x0],Org_Outer pbit is [0x0]
[2024-07-09 18:56:10.760] [ 1593.533517] Org_Inner vid is [0x0],Org_Inner pbit is [0x0]
[2024-07-09 18:56:10.766] [ 1593.539081] RS_Outer vid is [0x0],Last time is [0]
[2024-07-09 18:56:10.771] [ 1593.543961] source mac is [00:00:00:00:00:00], uprule index [1],vid mask is [0]
[2024-07-09 18:56:10.777] [ 1593.551355] Org_Outer vid is [0x0],Org_Outer pbit is [0x0]
[2024-07-09 18:56:10.783] [ 1593.556920] Org_Inner vid is [0x0],Org_Inner pbit is [0x0]
[2024-07-09 18:56:10.788] [ 1593.562493] RS_Outer vid is [0x0],Last time is [0]
[2024-07-09 18:56:10.795] [ 1593.567365] source mac is [00:00:00:00:00:00], uprule index [1],vid mask is [0]
[2024-07-09 18:56:10.800] [ 1593.574757] Org_Outer vid is [0x0],Org_Outer pbit is [0x0]
[2024-07-09 18:56:10.806] [ 1593.580323] Org_Inner vid is [0x0],Org_Inner pbit is [0x0]
[2024-07-09 18:56:10.814] [ 1593.585894] RS_Outer vid is [0x0],Last time is [0]
[2024-07-09 18:56:10.818] [ 1593.590766] source mac is [00:00:00:00:00:00], uprule index [1],vid mask is [0]
[2024-07-09 18:56:10.824] [ 1593.598162] Org_Outer vid is [0x0],Org_Outer pbit is [0x0]
[2024-07-09 18:56:10.830] [ 1593.603733] Org_Inner vid is [0x0],Org_Inner pbit is [0x0]
[2024-07-09 18:56:10.835] [ 1593.609298] RS_Outer vid is [0x0],Last time is [0]
[2024-07-09 18:56:10.841] [ 1593.614184] source mac is [00:00:00:00:00:00], uprule index [1],vid mask is [0]
[2024-07-09 18:56:10.846] [ 1593.621581] Org_Outer vid is [0x0],Org_Outer pbit is [0x0]
[2024-07-09 18:56:10.852] [ 1593.627145] Org_Inner vid is [0x0],Org_Inner pbit is [0x0]
[2024-07-09 18:56:10.861] [ 1593.632718] RS_Outer vid is [0x0],Last time is [0]
[2024-07-09 18:56:10.864] [ 1593.637590] source mac is [00:00:00:00:00:00], uprule index [1],vid mask is [0]
[2024-07-09 18:56:10.871] [ 1593.644983] Org_Outer vid is [0x0],Org_Outer pbit is [0x0]
[2024-07-09 18:56:10.878] [ 1593.650549] Org_Inner vid is [0x0],Org_Inner pbit is [0x0]
[2024-07-09 18:56:10.883] [ 1593.656121] RS_Outer vid is [0x0],Last time is [0]
[2024-07-09 18:56:10.889] [ 1593.660993] source mac is [00:00:00:00:00:00], uprule index [1],vid mask is [0]
[2024-07-09 18:56:10.895] [ 1593.668386] Org_Outer vid is [0x0],Org_Outer pbit is [0x0]
[2024-07-09 18:56:10.900] [ 1593.673959] Org_Inner vid is [0x0],Org_Inner pbit is [0x0]
[2024-07-09 18:56:10.906] [ 1593.679525] RS_Outer vid is [0x0],Last time is [0]
[2024-07-09 18:56:10.910] [ 1593.684404] source mac is [00:00:00:00:00:00], uprule index [1],vid mask is [0]
[2024-07-09 18:56:10.917] [ 1593.691797] Org_Outer vid is [0x0],Org_Outer pbit is [0x0]
[2024-07-09 18:56:10.924] [ 1593.697362] Org_Inner vid is [0x0],Org_Inner pbit is [0x0]
[2024-07-09 18:56:10.930] [ 1593.702935] RS_Outer vid is [0x0],Last time is [0]
[2024-07-09 18:56:10.935] [ 1593.707807] source mac is [00:00:00:00:00:00], uprule index [1],vid mask is [0]
[2024-07-09 18:56:10.945] [ 1593.715200] Org_Outer vid is [0x0],Org_Outer pbit is [0x0]
[2024-07-09 18:56:10.952] [ 1593.720766] Org_Inner vid is [0x0],Org_Inner pbit is [0x0]
[2024-07-09 18:56:10.959] [ 1593.726338] RS_Outer vid is [0x0],Last time is [0]
[2024-07-09 18:56:10.965] [ 1593.731217] source mac is [00:00:00:00:00:00], uprule index [1],vid mask is [0]
[2024-07-09 18:56:10.970] [ 1593.738605] Org_Outer vid is [0x0],Org_Outer pbit is [0x0]
[2024-07-09 18:56:10.976] [ 1593.744178] Org_Inner vid is [0x0],Org_Inner pbit is [0x0]
[2024-07-09 18:56:10.983] [ 1593.749741] RS_Outer vid is [0x0],Last time is [0]
[2024-07-09 18:56:10.983] [ 1593.754642] source mac is [00:00:00:00:00:00], uprule index [1],vid mask is [0]
[2024-07-09 18:56:10.992] [ 1593.762050] Org_Outer vid is [0x0],Org_Outer pbit is [0x0]
[2024-07-09 18:56:10.995] [ 1593.767615] Org_Inner vid is [0x0],Org_Inner pbit is [0x0]
[2024-07-09 18:56:11.000] [ 1593.773198] RS_Outer vid is [0x0],Last time is [0]
[2024-07-09 18:56:11.004] [ 1593.778075] Igmp mode is 0,Igmp tci is 0
[2024-07-09 18:56:11.010] [ 1593.782002] Upstream direction
[2024-07-09 18:56:11.013] [ 1593.785054] Idx TagN foinfo         fiinfo        Etp  Method   tfinfo     tsinfo      pri complex
[2024-07-09 18:56:11.020] [ 1593.794019] 1   1    0 8 2 4096     2 8 2 4096     0  1      1 0 2 4096     2 0 2 0     Default 1
[2024-07-09 18:56:11.028] [ 1593.802898] 2   2    2 8 2 4096     0 8 2 4096     0  1      1 0 3 4096     2 0 2 0     Default 1
[2024-07-09 18:56:11.037] [ 1593.811777] 3   1    0 8 2 4096     2 8 2 2887     0  40      1 8 2 2787     2 0 2 0     High 2
[2024-07-09 18:56:11.044] [ 1593.820476] 4   2    2 8 2 2887     0 8 2 4096     0  41      0 0 0 4094     1 9 3 2787     High 2
[2024-07-09 18:56:11.053] [ 1593.829442] 5   0    0 8 2 4096     2 8 2 0     0  1      1 0 0 0     2 0 2 0     High 2
[2024-07-09 18:56:11.063] [ 1593.837535] Downstream direction
[2024-07-09 18:56:11.067] [ 1593.840757] Idx TagN foinfo         fiinfo        Etp  Method   tfinfo     tsinfo      pri complex
[2024-07-09 18:56:11.077] [ 1593.849719] 1   5    0 0 0 0     0 0 0 0     0  0      0 0 0 0     0 0 0 0     Default 1
[2024-07-09 18:56:11.084] [ 1593.857812] down_foinfo         down_fiinfo
[2024-07-09 18:56:11.090] [ 1593.861998] 0 0 0 0     0 0 0 0
[2024-07-09 18:56:11.096] [ 1593.865132] Idx TagN foinfo         fiinfo        Etp  Method   tfinfo     tsinfo      pri complex
[2024-07-09 18:56:11.102] [ 1593.874100] 2   5    0 0 0 0     0 0 0 0     0  0      0 0 0 0     0 0 0 0     Default 1
[2024-07-09 18:56:11.109] [ 1593.882188] down_foinfo         down_fiinfo
[2024-07-09 18:56:11.113] [ 1593.886365] 0 0 0 0     0 0 0 0
[2024-07-09 18:56:11.119] [ 1593.889498] Idx TagN foinfo         fiinfo        Etp  Method   tfinfo     tsinfo      pri complex
[2024-07-09 18:56:11.129] [ 1593.898461] 3   1    0 8 2 4096     3 8 2 2787     0  40      4 8 2 2887     2 0 2 0     High 2
[2024-07-09 18:56:11.135] [ 1593.907162] down_foinfo         down_fiinfo
[2024-07-09 18:56:11.141] [ 1593.911347] 0 8 2 4096     0 8 2 4096
[2024-07-09 18:56:11.145] [ 1593.915001] Idx TagN foinfo         fiinfo        Etp  Method   tfinfo     tsinfo      pri complex
[2024-07-09 18:56:11.150] [ 1593.923965] 4   2    3 8 2 2787     0 8 2 4096     0  41      0 0 0 4094     4 9 2 2887     High 2
[2024-07-09 18:56:11.158] [ 1593.932926] down_foinfo         down_fiinfo
[2024-07-09 18:56:11.163] [ 1593.937103] 0 8 2 4096     0 8 2 4096
[2024-07-09 18:56:11.167] [ 1593.940757] Idx TagN foinfo         fiinfo        Etp  Method   tfinfo     tsinfo      pri complex
[2024-07-09 18:56:11.184] [ 1593.949719] 5   5    0 0 0 0     0 0 0 0     0  0      0 0 0 0     0 0 0 0     High 2
[2024-07-09 18:56:11.201] [ 1593.957552] down_foinfo         down_fiinfo
[2024-07-09 18:56:11.201] [ 1593.961737] 0 0 0 0     0 0 0 0
[2024-07-09 18:56:11.231] [ 1593.964871] 
[2024-07-09 18:56:11.231] root@OpenWrt:/tmp# 
[2024-07-09 18:56:11.654] root@OpenWrt:/tmp# 
[2024-07-09 18:56:11.758] root@OpenWrt:/tmp# ifconfig
[2024-07-09 18:56:13.178] br-lan    Link encap:Ethernet  HWaddr A8:C2:46:09:AA:70  
[2024-07-09 18:56:13.178]           inet addr:192.168.29.1  Bcast:192.168.29.255  Mask:255.255.255.0
[2024-07-09 18:56:13.182]           inet6 addr: fdea:e111:ce6b::1/60 Scope:Global
[2024-07-09 18:56:13.187]           inet6 addr: fe80::1/64 Scope:Link
[2024-07-09 18:56:13.191]           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
[2024-07-09 18:56:13.195]           RX packets:11353 errors:0 dropped:0 overruns:0 frame:0
[2024-07-09 18:56:13.200]           TX packets:10025 errors:0 dropped:0 overruns:0 carrier:0
[2024-07-09 18:56:13.207]           collisions:0 txqueuelen:1000 
[2024-07-09 18:56:13.210]           RX bytes:920566 (898.9 KiB)  TX bytes:4427578 (4.2 MiB)
[2024-07-09 18:56:13.216] 
[2024-07-09 18:56:13.216] eth0      Link encap:Ethernet  HWaddr A8:C2:46:09:AA:70  
[2024-07-09 18:56:13.222]           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
[2024-07-09 18:56:13.230]           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
[2024-07-09 18:56:13.235]           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
[2024-07-09 18:56:13.239]           collisions:0 txqueuelen:1000 
[2024-07-09 18:56:13.243]           RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
[2024-07-09 18:56:13.247] 
[2024-07-09 18:56:13.247] eth0.1    Link encap:Ethernet  HWaddr A8:C2:46:09:AA:70  
[2024-07-09 18:56:13.251]           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
[2024-07-09 18:56:13.258]           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
[2024-07-09 18:56:13.262]           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
[2024-07-09 18:56:13.268]           collisions:0 txqueuelen:1000 
[2024-07-09 18:56:13.273]           RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
[2024-07-09 18:56:13.277] 
[2024-07-09 18:56:13.277] eth0.2    Link encap:Ethernet  HWaddr A8:C2:46:09:AA:70  
[2024-07-09 18:56:13.280]           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
[2024-07-09 18:56:13.287]           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
[2024-07-09 18:56:13.292]           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
[2024-07-09 18:56:13.300]           collisions:0 txqueuelen:1000 
[2024-07-09 18:56:13.300]           RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
[2024-07-09 18:56:13.305] 
[2024-07-09 18:56:13.305] eth0.3    Link encap:Ethernet  HWaddr A8:C2:46:09:AA:70  
[2024-07-09 18:56:13.311]           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
[2024-07-09 18:56:13.315]           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
[2024-07-09 18:56:13.321]           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
[2024-07-09 18:56:13.327]           collisions:0 txqueuelen:1000 
[2024-07-09 18:56:13.330]           RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
[2024-07-09 18:56:13.334] 
[2024-07-09 18:56:13.334] eth0.4    Link encap:Ethernet  HWaddr A8:C2:46:09:AA:70  
[2024-07-09 18:56:13.341]           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
[2024-07-09 18:56:13.346]           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
[2024-07-09 18:56:13.349]           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
[2024-07-09 18:56:13.355]           collisions:0 txqueuelen:1000 
[2024-07-09 18:56:13.360]           RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
[2024-07-09 18:56:13.367] 
[2024-07-09 18:56:13.367] eth0.5    Link encap:Ethernet  HWaddr A8:C2:46:09:AA:70  
[2024-07-09 18:56:13.370]           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
[2024-07-09 18:56:13.376]           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
[2024-07-09 18:56:13.380]           TX packets:1078 errors:0 dropped:0 overruns:0 carrier:0
[2024-07-09 18:56:13.386]           collisions:0 txqueuelen:1000 
[2024-07-09 18:56:13.390]           RX bytes:0 (0.0 B)  TX bytes:202505 (197.7 KiB)
[2024-07-09 18:56:13.393] 
[2024-07-09 18:56:13.393] eth0.8    Link encap:Ethernet  HWaddr A8:C2:46:09:AA:70  
[2024-07-09 18:56:13.399]           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
[2024-07-09 18:56:13.405]           RX packets:11592 errors:0 dropped:0 overruns:0 frame:0
[2024-07-09 18:56:13.410]           TX packets:10455 errors:0 dropped:0 overruns:0 carrier:0
[2024-07-09 18:56:13.415]           collisions:0 txqueuelen:1000 
[2024-07-09 18:56:13.422]           RX bytes:1184506 (1.1 MiB)  TX bytes:4461323 (4.2 MiB)
[2024-07-09 18:56:13.425] 
[2024-07-09 18:56:13.425] lo        Link encap:Local Loopback  
[2024-07-09 18:56:13.429]           inet addr:127.0.0.1  Mask:255.0.0.0
[2024-07-09 18:56:13.433]           inet6 addr: ::1/128 Scope:Host
[2024-07-09 18:56:13.439]           UP LOOPBACK RUNNING  MTU:65536  Metric:1
[2024-07-09 18:56:13.443]           RX packets:10226 errors:0 dropped:0 overruns:0 frame:0
[2024-07-09 18:56:13.446]           TX packets:10226 errors:0 dropped:0 overruns:0 carrier:0
[2024-07-09 18:56:13.452]           collisions:0 txqueuelen:1000 
[2024-07-09 18:56:13.458]           RX bytes:529307 (516.9 KiB)  TX bytes:529307 (516.9 KiB)
[2024-07-09 18:56:13.465] 
[2024-07-09 18:56:13.465] omci      Link encap:Ethernet  HWaddr A8:C2:46:09:AA:70  
[2024-07-09 18:56:13.469]           UP BROADCAST RUNNING NOARP  MTU:2000  Metric:1
[2024-07-09 18:56:13.473]           RX packets:436 errors:0 dropped:0 overruns:0 frame:0
[2024-07-09 18:56:13.479]           TX packets:436 errors:0 dropped:0 overruns:0 carrier:0
[2024-07-09 18:56:13.486]           collisions:0 txqueuelen:1000 
[2024-07-09 18:56:13.490]           RX bytes:19184 (18.7 KiB)  TX bytes:19184 (18.7 KiB)
[2024-07-09 18:56:13.494] 
[2024-07-09 18:56:13.494] pon       Link encap:Ethernet  HWaddr A8:C2:46:09:AA:70  
[2024-07-09 18:56:13.501]           UP BROADCAST RUNNING MULTICAST  MTU:2000  Metric:1
[2024-07-09 18:56:13.504]           RX packets:131 errors:0 dropped:0 overruns:0 frame:0
[2024-07-09 18:56:13.510]           TX packets:435 errors:0 dropped:191 overruns:0 carrier:0
[2024-07-09 18:56:13.516]           collisions:0 txqueuelen:1000 
[2024-07-09 18:56:13.519]           RX bytes:12118 (11.8 KiB)  TX bytes:41986 (41.0 KiB)
[2024-07-09 18:56:13.527] 
[2024-07-09 18:56:13.527] pon.2887  Link encap:Ethernet  HWaddr A8:C2:46:09:AA:70  
[2024-07-09 18:56:13.532]           inet addr:192.168.100.2  Bcast:192.168.100.255  Mask:255.255.255.0
[2024-07-09 18:56:13.539]           inet6 addr: fe80::aac2:46ff:fe09:aa70/64 Scope:Link
[2024-07-09 18:56:13.542]           UP BROADCAST RUNNING MULTICAST  MTU:2000  Metric:1
[2024-07-09 18:56:13.547]           RX packets:131 errors:0 dropped:0 overruns:0 frame:0
[2024-07-09 18:56:13.553]           TX packets:571 errors:0 dropped:0 overruns:0 carrier:0
[2024-07-09 18:56:13.561]           collisions:0 txqueuelen:1000 
[2024-07-09 18:56:13.564]           RX bytes:9760 (9.5 KiB)  TX bytes:49512 (48.3 KiB)
[2024-07-09 18:56:13.568] 
[2024-07-09 18:56:13.568] pon.2900  Link encap:Ethernet  HWaddr A8:C2:46:09:AA:70  
[2024-07-09 18:56:13.575]           inet addr:192.168.100.3  Bcast:192.168.100.3  Mask:255.255.255.252
[2024-07-09 18:56:13.581]           inet6 addr: fe80::aac2:46ff:fe09:aa70/64 Scope:Link
[2024-07-09 18:56:13.584]           UP BROADCAST RUNNING MULTICAST  MTU:2000  Metric:1
[2024-07-09 18:56:13.591]           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
[2024-07-09 18:56:13.597]           TX packets:44 errors:0 dropped:0 overruns:0 carrier:0
[2024-07-09 18:56:13.603]           collisions:0 txqueuelen:1000 
[2024-07-09 18:56:13.607]           RX bytes:0 (0.0 B)  TX bytes:5922 (5.7 KiB)
[2024-07-09 18:56:13.610] 
[2024-07-09 18:56:13.610] root@OpenWrt:/tmp# 
[2024-07-09 18:56:53.999] root@OpenWrt:/tmp# 
[2024-07-09 18:56:54.258] root@OpenWrt:/tmp# 

dmesg

dmesg
[ 2972.273644] set dbg level success,now value is 7
...
[ 2976.903114] [pon_insert_tag:2899]: Skb flag is 200, out_dev is pon  hy_enable=0 
[ 2976.910608] [pon_insert_tag:2949]: valid pkt
[ 2976.914973] [store_tag_info:886]: TPID is 81,tci is e30a
[ 2976.920363] [store_tag_info:908]: Tag Conut is 1
[ 2976.930201] [handle_igmp_pkt:2512]: Igmp add Tag function is disable,do as normal packet
[ 2976.938389] [get_port_num:678]: packet from wan(hgu RX)
[ 2976.938389] 
[ 2976.945180] [get_vlan_opt_data:737]: Port Num is 3 ====>get vlan opt data
[ 2976.952055] [get_vlan_opt_data:747]: frame port is 3,vlan data port is 2  ====>get vlan opt data
[ 2976.960919] [get_vlan_opt_data:747]: frame port is 3,vlan data port is 3  ====>get vlan opt data
[ 2976.969789] [get_vlan_opt_data:768]: we have rule on port 3 in downstream,====>get vlan opt data
[ 2976.978661] [handle_common_pkt:2592]: Find Vlan rule in port 3
[ 2976.984581] [handle_common_pkt:2656]: downstream print, tag num is 1
[ 2976.991016] [match_rule:1177]: rule direction is Down ====>pon match rule
[ 2976.997889] [match_rule:1200]: rule's tag num is 5 ,it will cause error====>pon match rule
[ 2977.006238] [match_rule:1177]: rule direction is Down ====>pon match rule
[ 2977.013114] [match_rule:1206]: frame has 1 Tag,rule's tag num is 2 ====>pon match rule
[ 2977.021109] [match_rule:1177]: rule direction is Down ====>pon match rule
[ 2977.027983] [match_rule:1210]: Begin Match the Rule ====>pon match rule
[ 2977.034685] [match_tag:942]: match tag index is 1 ====>pon Match Tag
[ 2977.041125] [match_tag:1004]: TPID Match Success ====>pon Match Tag
[ 2977.047475] [match_tag:1022]: Pbit Match Success ====>pon Match Tag
[ 2977.053856] [match_tag:1036]: DEI Match Success ====>pon Match Tag
[ 2977.060121] [match_tag:1110]: VID Match Success ====>pon Match Tag
[ 2977.066402] [match_tag:1112]: All Match Success ====>pon Match Tag direction = 2, ret = 1
[ 2977.066402] 
[ 2977.083337] [match_rule:1254]: match rule ====>pon match rule
[ 2977.083341] [get_match_rule:1269]: match high pri rule idx = 2 ====>pon match rule
[ 2977.109174] [match_tag:942]: match tag index is 1 ====>pon Match Tag
[ 2977.122752] [match_tag:1004]: TPID Match Success ====>pon Match Tag
[ 2977.134322] [match_tag:1022]: Pbit Match Success ====>pon Match Tag
[ 2977.147888] [match_tag:1036]: DEI Match Success ====>pon Match Tag
[ 2977.147891] [match_tag:1110]: VID Match Success ====>pon Match Tag
[ 2977.172872] [match_tag:1112]: All Match Success ====>pon Match Tag direction = 2, ret = 1
[ 2977.172872] 
[ 2977.172875] [match_rule:1254]: match rule ====>pon match rule
[ 2977.172878] [change_pkt_by_match_rule:2528]: Match the Rule 2,we will do the option
[ 2977.172882] [change_tag_in_skb:1632]: change no.0 tag ====>Change Tag to Skb
[ 2977.172885] [change_pkt_by_match_rule:2542]: Match the Rule 2, set the old mac enable info
[ 2977.172890] [handle_common_pkt:2732]: downstream print, match the rule return value=1
[ 2977.172896] [pon_insert_tag:3070]: handle common pkt success
[ 2977.184303] [pon_insert_tag:3100]: In the Pon Insert Tag,vlan tag index is 0,tpid is 8100,tci is b47

[ 2977.201253] skb info isa8c24609aa70b4450666f89b8100[pon_insert_tag:3133]: In the Pon Insert Tag,HGU ds print,protocol is  81,skb data is 81