Creating VLAN in S32G A53 in Data-Link Layer

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Creating VLAN in S32G A53 in Data-Link Layer

Jump to solution
2,443 Views
nkv2
Contributor II

Hello NXP Support Team,

How can i create a VLAN interface attached to a base interface(for eg: pfe0) with user defined mac address in the Data Link layer (Not in Network/IP layer) in S32G A53 cores?

In pc we can use the macvlan tool to create the similar vlan interface as mentioned above and it works, but when i try the same, i get the below following error.

root@s32g:~# ip link add link pfe0 address 00:11:11:11:11:11 pfe0vlan0 type macvlan
ip: RTNETLINK answers: Operation not supported

Please let me know how can we come accross this scenario? should we do something with PFE to enable the vlan or change something in yocto build to allow the ip tool to create macvlan ?

Thanks in Advance.

Tags (4)
0 Kudos
1 Solution
2,322 Views
Daniel-Aguirre
NXP TechSupport
NXP TechSupport

Hi,

We have received the following comment:

"This is standard linux and nothing to do with the pfe mode/state.

I haven’t verified extensively but here’s what I done to check:

ip a add 192.0.0.123/24 dev pfe0

ip link add link pfe0 name pfe0.20 address 00:11:11:11:11:11 type vlan id 20

ip a add 192.0.0.124/24 dev pfe0.20

ifconfig pfe0 up

ifconfig pfe0.20 up

ifconfig

pfe0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.0.0.123  netmask 255.255.255.0  broadcast 0.0.0.0

        inet6 fe80::201:beff:febe:ef11  prefixlen 64  scopeid 0x20<link>

        ether 00:01:be:be:ef:11  txqueuelen 1000  (Ethernet)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes  (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

       device memory 0x46000000-46ffffff

pfe0.20: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.0.0.124  netmask 255.255.255.0  broadcast 0.0.0.0

        inet6 fe80::211:11ff:fe11:1111  prefixlen 64  scopeid 0x20<link>

        ether 00:11:11:11:11:11  txqueuelen 1000  (Ethernet)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ip route add 192.0.0.100/32 via 192.0.0.123 dev pfe0

ip route add 192.0.0.101/32 via 192.0.0.124 dev pfe0.20

ip r

192.0.0.0/24 dev pfe0 proto kernel scope link src 192.0.0.123

192.0.0.0/24 dev pfe0.20 proto kernel scope link src 192.0.0.124

192.0.0.100 via 192.0.0.123 dev pfe0

192.0.0.101 via 192.0.0.124 dev pfe0.20

ping 192.0.0.100

Output of tcpdump is:

17:26:19.059989 00:01:be:be:ef:11 (oui Unknown) > Broadcast, ethertype ARP (0x0806), length 42: Request who-has 192.0.0.100 tell s32g274aevb, length 28

        0x0000:  ffff ffff ffff 0001 bebe ef11 0806 0001  ................

        0x0010:  0800 0604 0001 0001 bebe ef11 c000 007b  ...............{

        0x0020:  0000 0000 0000 c000 0064                 .........d

Ping 192.0.0.101

Output of tcpdump is:

17:27:04.726531 00:11:11:11:11:11 (oui Unknown) > Broadcast, ethertype 802.1Q (0x8100), length 46: vlan 20, p 0, ethertype ARP, Request who-has 192.0.0.101 tell s32g274aevb, length 28

        0x0000:  ffff ffff ffff 0011 1111 1111 8100 0014  ................

        0x0010:  0806 0001 0800 0604 0001 0011 1111 1111  ................

        0x0020:  c000 007c 0000 0000 0000 c000 0065       ...|.........e

cat /dev/urandom | nc -u 192.0.0.100 123

17:28:24.989939 00:01:be:be:ef:11 (oui Unknown) > 00:01:23:45:67:00 (oui Unknown), ethertype IPv4 (0x0800), length 1066: s32g274aevb.49078 > 192.0.0.100.ntp: NTPv0, unspecified, length 1024

        0x0000:  0001 2345 6700 0001 bebe ef11 0800 4500  ..#Eg.........E.

        0x0010:  041c 99d1 4000 4011 1c20 c000 007b c000 

cat /dev/urandom | nc -u 192.0.0.101 123

17:30:31.993536 00:11:11:11:11:11 (oui Unknown) > 00:01:23:45:67:02 (oui Unknown), ethertype 802.1Q (0x8100), length 1070: vlan 20, p 0, ethertype IPv4, s32g274aevb.52319 > 192.0.0.101.ntp: NTPv0, symmetric active, length 1024

        0x0000:  0001 2345 6702 0011 1111 1111 8100 0014  ..#Eg...........

        0x0010:  0800 4500 041c 3821 4000 4011 7dce c000

If they are going to use the same subnet for the base port and the VLAN port attached to it then they need to use the ip route command to assign IP addresses on that subnet to either the base port or the VLAN port. If they don’t then Linux will use the first rule of any duplicate rules it hits in the route table to send out traffic. The easiest way round this is to use different subnets for the base and vlan ports, otherwise they need to use ip route or some other method like netns."

We also understand that a local FAE is at this moment giving you support. This information was already being sent to you through him. Let us know if you want us to duplicate the information or if you prefer to continue with the support of the local FAE only.

Please, let us know.

View solution in original post

0 Kudos
8 Replies
2,424 Views
Daniel-Aguirre
NXP TechSupport
NXP TechSupport

Hi,

Could you please let us know which BSP version are you working with? Also, on which platform you are trying to implement it?

Please, let us know.

0 Kudos
2,415 Views
nkv2
Contributor II

Hello,

Thank you for replying quickly.

We could able to resolve the problem by enabling the MACVLAN drivers in the bitbake make menuconfig. But i have some other issues which i will try to explain below.

Platform: S322G274

Switch: Sja1110

BSP: 31

PFE Version: 1.0

After creating a new interface(myvlan) attached to pfe0, i could able to assign new MAC and IP address to this new vlan interface. When pinging the vlan ipaddress from external pc, the vlan interface sends that it is present in both pfe mac address and also vlan mac address, you can see that in the attached pic myvlan_1.png. Then ICMP/TCP packets coming out of the hardware contains source mac address as mac address of pfe0 interface(refer pic myvlan_2.png). But the ICMP/TCP packets coming from external pc to hardware contains vlan mac address as destination address. The communication still happens though without any issue.

How to resolve this issue of setting the destination address of packets coming from the hardware to MAC address from VLAN interface instead of pfe0 interface. Is there any change in PFE firmware can be done to resolve this issue ?

I have attached screenshot of output of ip a command

below is the output of  libfci_cli phyif-print

DISCLAIMER: This i[ 8715.881546] [/usr/src/debug/pfe/0.9.6-r0/git/sw/pfe_platform/src/pfe_phy_if.c:2543] WRN: emac0: Unable to get MAC address: 2
s[ 8715.881738] [/usr/src/debug/pfe/0.9.6-r0/git/sw/pfe_platform/src/pfe_phy_if.c:2543] WRN: emac0: Unable to get MAC address: 2
a DEMO applicati[ 8715.904791] [/usr/src/debug/pfe/0.9.6-r0/git/sw/pfe_platform/src/pfe_phy_if.c:2479] WRN: emac1: Unable to get MAC address: 2
o[ 8715.905190] [/usr/src/debug/pfe/0.9.6-r0/git/sw/pfe_platform/src/pfe_phy_if.c:2479] WRN: emac2: Unable to get MAC address: 2
n. It is not part of the production code deliverables.
0: emac0
<ENABLED>
<promisc:OFF, mode:DEFAULT, block-state:NORMAL>
<vlan-conf:OFF, ptp-conf:OFF, ptp-promisc:OFF, q-in-q:ON>
<discard-if-ttl-below-2:OFF>
ingress: 109 egress: 79 discarded: 0 malformed: 0
MAC:
00:01:be:be:ef:11
33:33:00:00:00:01
01:00:5e:00:00:01
cc:11:33:22:ff:ff
33:33:ff:22:ff:ff
33:33:ff:be:ef:11
mirrors:
rxmirr0: ---
rxmirr1: ---
txmirr0: ---
txmirr1: ---
logical interfaces:
0: pfe0
<ENABLED>
<promisc:ON, match-mode:AND, discard-on-match:OFF, loopback:OFF>
accepted: 109 rejected: 0 discarded: 0 processed: 109
egress: hif0
match-rules: ---
1: emac1
<DISABLED>
<promisc:OFF, mode:DEFAULT, block-state:NORMAL>
<vlan-conf:OFF, ptp-conf:OFF, ptp-promisc:OFF, q-in-q:ON>
<discard-if-ttl-below-2:OFF>
ingress: 0 egress: 0 discarded: 0 malformed: 0
MAC: ---
mirrors:
rxmirr0: ---
rxmirr1: ---
txmirr0: ---
txmirr1: ---
logical interfaces: ---
2: emac2
<DISABLED>
<promisc:OFF, mode:DEFAULT, block-state:NORMAL>
<vlan-conf:OFF, ptp-conf:OFF, ptp-promisc:OFF, q-in-q:ON>
<discard-if-ttl-below-2:OFF>
ingress: 0 egress: 0 discarded: 0 malformed: 0
MAC: ---
mirrors:
rxmirr0: ---
rxmirr1: ---
txmirr0: ---
txmirr1: ---
logical interfaces: ---
5: util
<DISABLED>
<promisc:OFF, mode:DEFAULT, block-state:NORMAL>
<vlan-conf:OFF, ptp-conf:OFF, ptp-promisc:OFF, q-in-q:ON>
<discard-if-ttl-below-2:OFF>
ingress: 0 egress: 0 discarded: 0 malformed: 0
MAC: ---
mirrors:
rxmirr0: ---
rxmirr1: ---
txmirr0: ---
txmirr1: ---
logical interfaces: ---
6: hif0
<ENABLED>
<promisc:OFF, mode:DEFAULT, block-state:NORMAL>
<vlan-conf:OFF, ptp-conf:OFF, ptp-promisc:OFF, q-in-q:ON>
<discard-if-ttl-below-2:OFF>
ingress: 79 egress: 109 discarded: 0 malformed: 0
MAC: ---
mirrors:
rxmirr0: ---
rxmirr1: ---
txmirr0: ---
txmirr1: ---
logical interfaces:
1: hif0-logif
<DISABLED>
<promisc:OFF, match-mode:AND, discard-on-match:OFF, loopback:OFF>
accepted: 0 rejected: 0 discarded: 0 processed: 0
egress: ---
match-rules: ---
7: hif1
<DISABLED>
<promisc:OFF, mode:DEFAULT, block-state:NORMAL>
<vlan-conf:OFF, ptp-conf:OFF, ptp-promisc:OFF, q-in-q:ON>
<discard-if-ttl-below-2:OFF>
ingress: 0 egress: 0 discarded: 0 malformed: 0
MAC: ---
mirrors:
rxmirr0: ---
rxmirr1: ---
txmirr0: ---
txmirr1: ---
logical interfaces: ---
8: hif2
<DISABLED>
<promisc:OFF, mode:DEFAULT, block-state:NORMAL>
<vlan-conf:OFF, ptp-conf:OFF, ptp-promisc:OFF, q-in-q:ON>
<discard-if-ttl-below-2:OFF>
ingress: 0 egress: 0 discarded: 0 malformed: 0
MAC: ---
mirrors:
rxmirr0: ---
rxmirr1: ---
txmirr0: ---
txmirr1: ---
logical interfaces: ---
9: hif3
<DISABLED>
<promisc:OFF, mode:DEFAULT, block-state:NORMAL>
<vlan-conf:OFF, ptp-conf:OFF, ptp-promisc:OFF, q-in-q:ON>
<discard-if-ttl-below-2:OFF>
ingress: 0 egress: 0 discarded: 0 malformed: 0
MAC: ---
mirrors:
rxmirr0: ---
rxmirr1: ---
txmirr0: ---
txmirr1: ---
logical interfaces: ---
Command successfully executed

 

Thank you in Advance.

0 Kudos
2,031 Views
irfank
Contributor III

Hello;

 

Can you please describe step by step how to enabling the MACVLAN drivers in the bitbake make menuconfig?

 

Regards,

irfan

0 Kudos
2,026 Views
nkv2
Contributor II

Hello,

 

You can enable in the menuconfig in the following options,

Device drivers---->networkdevice support---->mac-vlan

0 Kudos
2,393 Views
Daniel-Aguirre
NXP TechSupport
NXP TechSupport

Hi,

We have the following comments:

"The default syntax for vlan is:

ip a add 192.0.0.123/24 dev pfe0
ip link add link pfe0 name pfe0.20 address 00:11:11:11:11:11 type vlan id 20
ip a add 192.0.20.123/24 dev pfe0.20

Can't see any problem using the macvlan driver.

Can you check the values of arp_ignore and arp_announce? Not sure if BSP31 had moved to systemd or is still sysctl so the method of setting them is different but to prevent ports responding to arps for other ports then arp_ignore should be 1 and arp_announce should be 2.

Your setup is implemented entirely in the kernel and PFE driver and as such is not using anything other than the default firmware which will deliver packets to the host without any classification."

Please, let us know if this information was helpful or not.

0 Kudos
2,385 Views
nkv2
Contributor II

Hello Daniel,

As you suggested arp_ignore and arp_announce and works for the arp request, but when it comes to TCP/IP or any other network protocol, still the VLAN uses the mac address of the base interface(i.e pfe0) to communicate with the external world instead of using its own mac address.

 

Thanks and Regards.

0 Kudos
2,323 Views
Daniel-Aguirre
NXP TechSupport
NXP TechSupport

Hi,

We have received the following comment:

"This is standard linux and nothing to do with the pfe mode/state.

I haven’t verified extensively but here’s what I done to check:

ip a add 192.0.0.123/24 dev pfe0

ip link add link pfe0 name pfe0.20 address 00:11:11:11:11:11 type vlan id 20

ip a add 192.0.0.124/24 dev pfe0.20

ifconfig pfe0 up

ifconfig pfe0.20 up

ifconfig

pfe0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.0.0.123  netmask 255.255.255.0  broadcast 0.0.0.0

        inet6 fe80::201:beff:febe:ef11  prefixlen 64  scopeid 0x20<link>

        ether 00:01:be:be:ef:11  txqueuelen 1000  (Ethernet)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes  (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

       device memory 0x46000000-46ffffff

pfe0.20: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.0.0.124  netmask 255.255.255.0  broadcast 0.0.0.0

        inet6 fe80::211:11ff:fe11:1111  prefixlen 64  scopeid 0x20<link>

        ether 00:11:11:11:11:11  txqueuelen 1000  (Ethernet)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ip route add 192.0.0.100/32 via 192.0.0.123 dev pfe0

ip route add 192.0.0.101/32 via 192.0.0.124 dev pfe0.20

ip r

192.0.0.0/24 dev pfe0 proto kernel scope link src 192.0.0.123

192.0.0.0/24 dev pfe0.20 proto kernel scope link src 192.0.0.124

192.0.0.100 via 192.0.0.123 dev pfe0

192.0.0.101 via 192.0.0.124 dev pfe0.20

ping 192.0.0.100

Output of tcpdump is:

17:26:19.059989 00:01:be:be:ef:11 (oui Unknown) > Broadcast, ethertype ARP (0x0806), length 42: Request who-has 192.0.0.100 tell s32g274aevb, length 28

        0x0000:  ffff ffff ffff 0001 bebe ef11 0806 0001  ................

        0x0010:  0800 0604 0001 0001 bebe ef11 c000 007b  ...............{

        0x0020:  0000 0000 0000 c000 0064                 .........d

Ping 192.0.0.101

Output of tcpdump is:

17:27:04.726531 00:11:11:11:11:11 (oui Unknown) > Broadcast, ethertype 802.1Q (0x8100), length 46: vlan 20, p 0, ethertype ARP, Request who-has 192.0.0.101 tell s32g274aevb, length 28

        0x0000:  ffff ffff ffff 0011 1111 1111 8100 0014  ................

        0x0010:  0806 0001 0800 0604 0001 0011 1111 1111  ................

        0x0020:  c000 007c 0000 0000 0000 c000 0065       ...|.........e

cat /dev/urandom | nc -u 192.0.0.100 123

17:28:24.989939 00:01:be:be:ef:11 (oui Unknown) > 00:01:23:45:67:00 (oui Unknown), ethertype IPv4 (0x0800), length 1066: s32g274aevb.49078 > 192.0.0.100.ntp: NTPv0, unspecified, length 1024

        0x0000:  0001 2345 6700 0001 bebe ef11 0800 4500  ..#Eg.........E.

        0x0010:  041c 99d1 4000 4011 1c20 c000 007b c000 

cat /dev/urandom | nc -u 192.0.0.101 123

17:30:31.993536 00:11:11:11:11:11 (oui Unknown) > 00:01:23:45:67:02 (oui Unknown), ethertype 802.1Q (0x8100), length 1070: vlan 20, p 0, ethertype IPv4, s32g274aevb.52319 > 192.0.0.101.ntp: NTPv0, symmetric active, length 1024

        0x0000:  0001 2345 6702 0011 1111 1111 8100 0014  ..#Eg...........

        0x0010:  0800 4500 041c 3821 4000 4011 7dce c000

If they are going to use the same subnet for the base port and the VLAN port attached to it then they need to use the ip route command to assign IP addresses on that subnet to either the base port or the VLAN port. If they don’t then Linux will use the first rule of any duplicate rules it hits in the route table to send out traffic. The easiest way round this is to use different subnets for the base and vlan ports, otherwise they need to use ip route or some other method like netns."

We also understand that a local FAE is at this moment giving you support. This information was already being sent to you through him. Let us know if you want us to duplicate the information or if you prefer to continue with the support of the local FAE only.

Please, let us know.

0 Kudos
2,308 Views
nkv2
Contributor II

Hello Daniel,

Thank you replying in the forum. Yes , we contacted local FAE and he gave us the below solution that you suggested. This solution works for pings and TCP connection as well. I will update the FAE as well about the solution. 

Thanks again.

 

0 Kudos