This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Tagging non-VLAN packets on CPSW - Sitara am3357

Other Parts Discussed in Thread: SYSBIOS, AM3357

Hi,

Is it possible to tag packets on CPSW in ingress/egress?

I would like to implement the following configuration:

1) host with VLAN 40 subnet

2) PC connected to port 1 of cpsw generating (and accepting) 802.3 traffic

3) Port 1 tags incoming 802.3 traffic with VLAN 40 in order to enable communication with host. Of course I have to untag egress on port 1 to allow the PC to process packets.

I partially know how to do this:

...create VLANs and add CFTAG_IPNET in a new NDK entry - OK

//create vlan 40 subnet on ports 0 and 1 and force untagged egress on port 1 - OK

config.cmd = CONFIG_SWITCH_ADD_VLAN;
    switchcmd(&config).vid = 40;
    switchcmd(&config).mem_port = 3;
    switchcmd(&config).untag_port = 2; //mask
    switchcmd(&config).reg_multi = 3;
    switchcmd(&config).unreg_multi = 0;

But how to realize tag? I tried with

config.cmd = CONFIG_SWITCH_SET_PORT_VLAN_CONFIG;
    switchcmd(&config).vid = 40;
    switchcmd(&config).port = 1; //assume it performs an ingress-tagging
    switchcmd(&config).prio_port = 0; //use lowest prio
    switchcmd(&config).CFI_port = 0;

This commands exists in CPSW driver in Linux sdk 4, 7 and 8. I ported this driver to Sysbios/NDK. Essentially it writes to register Px_PORT_VLAN (see for example section 14.5.6.21 of Sitara TRM).

The problem is that in NIMUReceivePacket I found that the incoming packet is never tagged:

    if (Type == 0x8100)
        Type = VLANReceivePacket (hPkt); //never enters here

Is this command the right one? Does another command exists or packet tagging is not possible at all?

i'm using:

1) NDK 2.23.00.00

2) SysBios 6.35.1.29

3) CCS 6

4) Sitara am3357

Thanks

Luca

  • Moving this to the SYS/BIOS forum.

  • Luca,

    Can you please clarify why you are checking “if (Type == 0x8100)”?

    Thanks,
    Scott

  • Scott,

    Thanks for your reply. What I'm checking is the VLAN ethertype (0x8100) of packets received by the host (Sitara). Since I'm trying to tag packets in ingress to port 1, I expect that non-VLAN packets with standard ethertypes (like 0x0800 for IP protocol) get modified.

    Specifically, I expected that TPID (Tag Protocol Identifier)  0x8100 is added, as well as TCI (Tag Control Information) that  contains information about the vlan ID and the packet priority.

    I already checked that if a PC connected to port 1 produces VLAN packets, the correct type is detected and forwarded to  the correct host's sub-nets.

    Maybe the problem is that the command I used is not the correct one. As a result, the main question is if CPSW is able to perform packet tagging at all. Can you check this?

    Thank you very much,

    Luca

  • Luca,

    I’ve asked for some advice from others familiar with CPSW with VLAN.  Hope to get an answer to you soon…

    Regards,
    Scott

  • Luca,

    Sorry it has taken so long.  I’m still trying to get some clarifications and an answer for you.

    One question that has come up: Have you set the RX_VLAN_ENCAP bit in the CPSW control register to enable VLAN info to be added to the packet descriptors?  This register is described in Section 14.5.8.2 in the Sitara TRM.

    Thanks,
    Scott