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.

[参考译文] DRA821U:如何使用 CPSW2G 添加 VLAN 标签

Guru**** 2553450 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1071128/dra821u-how-to-add-vlan-tag-with-cpsw2g

部件号:DRA821U

你(们)好  

我们关注 cpsw2g 以太网,以添加 VLAN  

3.2.3.7. CPSW2g 以太网—用于 J7200的处理器 SDK Linux 文档

root@j7200-evm:~# ip link add link eth0 name eth0.5 type vlan id 5
[ 7256.997582] 8021q: 802.1Q VLAN Support v1.8
[ 7257.001812] 8021q: adding VLAN 0 to HW filter on device eth0
[ 7257.009214] am65-cpsw-nuss 46000000.ethernet: Adding vlan 5 to vlan filter
[ 7257.016208] am65-cpsw-nuss 46000000.ethernet: get: wrong ale fld id 2
[ 7257.022760] am65-cpsw-nuss 46000000.ethernet: get: wrong ale fld id 1

root@j7200-evm:~# ip addr add 192.168.0.21/24 dev eth0.5
root@j7200-evm:~# [ 7294.916006] systemd-journald[163]: Failed to send WATCHDOG=1 notification message: Transport endpoint is not connected
ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500  metric 1
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        ether 02:42:be:76:f1:a0  txqueuelen 0  (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

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500  metric 1
        inet 192.168.0.20  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::f684:4cff:fef9:73e3  prefixlen 64  scopeid 0x20<link>
        ether f4:84:4c:f9:73:e3  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 191  bytes 50097 (48.9 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0.5: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500  metric 1
        inet 192.168.0.21  netmask 255.255.255.0  broadcast 0.0.0.0
        inet6 fe80::f684:4cff:fef9:73e3  prefixlen 64  scopeid 0x20<link>
        ether f4:84:4c:f9:73:e3  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 37  bytes 6294 (6.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

VLAN 数据包发送/接收

要发送或接收带有 VLAN 标记的数据包,请将该套接字绑定到上面显示的正确以太网接口,并可通过该套接字 FD 发送/接收。

如何通过  CPSW2G 发送带有 VLAN 标签的数据流

巴西

Jay

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Jay,  

    我看到您已经添加了 VLAN ID 5并为 eth0.5分配了 IP 地址。 因此,您可以直接使用 eth0.1发送数据包,而 VLAN ID 将由 CPSW 添加到数据包中。 一个简单的例子就是  

    ping -i eth0.5 <目标 IP>

    注意:目的 IP 还需要支持 VLAN。  

    希望这些注释有所帮助。

    华普