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