void eth_setup_vlan_headers(struct eth_header *ehdr, uint16_t vlan_tag,

    bool *is_new)

{

    struct vlan_header *vhdr = PKT_GET_VLAN_HDR(ehdr);



    switch (be16_to_cpu(ehdr->h_proto)) {

    case ETH_P_VLAN:

    case ETH_P_DVLAN:

        /* vlan hdr exists */

        *is_new = false;

        break;



    default:

        /* No VLAN header, put a new one */

        vhdr->h_proto = ehdr->h_proto;

        ehdr->h_proto = cpu_to_be16(ETH_P_VLAN);

        *is_new = true;

        break;

    }

    vhdr->h_tci = cpu_to_be16(vlan_tag);

}

void eth_setup_vlan_headers(struct eth_header *ehdr, uint16_t vlan_tag,

    bool *is_new)

{

    struct vlan_header *vhdr = PKT_GET_VLAN_HDR(ehdr);



    switch (be16_to_cpu(ehdr->h_proto)) {

    case ETH_P_VLAN:

    case ETH_P_DVLAN:

        

        *is_new = false;

        break;



    default:

        

        vhdr->h_proto = ehdr->h_proto;

        ehdr->h_proto = cpu_to_be16(ETH_P_VLAN);

        *is_new = true;

        break;

    }

    vhdr->h_tci = cpu_to_be16(vlan_tag);

}

void FUNC_0(struct eth_header *VAR_0, uint16_t VAR_1,

    bool *VAR_2)

{

    struct vlan_header *VAR_3 = PKT_GET_VLAN_HDR(VAR_0);



    switch (be16_to_cpu(VAR_0->h_proto)) {

    case ETH_P_VLAN:

    case ETH_P_DVLAN:

        

        *VAR_2 = false;

        break;



    default:

        

        VAR_3->h_proto = VAR_0->h_proto;

        VAR_0->h_proto = cpu_to_be16(ETH_P_VLAN);

        *VAR_2 = true;

        break;

    }

    VAR_3->h_tci = cpu_to_be16(VAR_1);

}

void FUNC_0(struct eth_header *VAR_0, uint16_t VAR_1,
bool *VAR_2)
{ struct vlan_header *VAR_3 = PKT_GET_VLAN_HDR(VAR_0); switch (be16_to_cpu(VAR_0->h_proto)) { case ETH_P_VLAN:
case ETH_P_DVLAN:
*VAR_2 = false; break; default:
VAR_3->h_proto = VAR_0->h_proto; VAR_0->h_proto = cpu_to_be16(ETH_P_VLAN); *VAR_2 = true; break; } VAR_3->h_tci = cpu_to_be16(VAR_1); }