!276 support set/get VxLAN rule of rx flow director by ethtool
Merge Pull Request from: @svishen Background: Currently, the HNS3 driver, Linux kernel, and standard tools do not support the configuration of VXLAN tunnel tuple information as the key of the flow table. The ethtool –U command supports only the configuration of tuples for non-tunnel packets. Two types of tuples, vxlan4 and vxlan6, need to be added. Functions: The vxlan4 and vxlan6 flow types are added to the ethtool –U command. The vni in the outer header and the source MAC address, destination MAC address, source IP address, destination IP address, and VLAN ID in the inner header can be configured as tuple information. The HNS3 driver supports all tuple configurations of both types. patch name: (1) net: ethtool: add VxLAN to the NFC API (2) net: hns3: support set/get VxLAN rule of rx flow director by ethtool In include/uapi/linux/ethtool.h We changed a union, but didn't change its size.Neither of the two newly added members exceeds 52 bytes. The impact on user-mode tools is as follows: (1)The new tool is compiled on the old kernel and can configure the old flow table. The old kernel does not support VXLAN configuration. ``` [root@locaLhost ~]# [root@localhost alt rpm -ga | grep ethtool ethtool-5.15-4.aarch64 [root@localhost ~]# [root@localhost ~]# uname -a Linux localhost.localdomain 5.10.0-60.18.0.50.0e2203.aarch64 #1 SMP Wed Mar 30 02:43:08 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux [root@localhost ~]# [root@localhost ~]# ethtool -U enol flow-type tep6 tclass Oxi8 src-ip fese::218:2dff:feee:12 loc 4 action -1 [root@localhost ~]# ethtool -u ethtool: bad command line argument(s) For more information run ethtool -h [root@localhost ~]# ethtool -u eno1 32 RX rings available Total 1 rules Filter: 4 Rule Type: TCP over IPv6 Src IP addr: fe80::218:2dff:fe00:12 mask: : Dest Ip addr: :: mask: ffff:ffff:fff:ffff:ffff:ffff:ffff:ffff Traffic class: 0x18 mask: 0x0 Src port: 0 mask: Oxffff Dest'port: 0 mask: 0xffff Action: Drop [root@localhost ~]# ethtool -U enol flow-type udp4 src-ip 1.1.1.1 vf @ loc 4 queue 2 [root@localhost ~]# ethtool -u enot 32 RX rings available Total 1 rules Filter: 4 Rule Type: UDP over IPv4 Src IP addr: 1.1.1.1 mask: 0.0.0.0 Dest IP addr: 0.0.0.0 mask: 255.255.255.255 TOS: 0x0 mask: Oxff Src port: 0 mask: oxffff Dest'port: 0 mask: 0xffff Action: Direct to VF 0 queue 2 [root@localhost ~]# ethtool -U enol flow-type vxlan src-ip 192.168.1.2 loc 4 Add rule, invalid syntax ethtool: bad command line argument(s) For more information run ethtool -h [root@localhost ~]# ``` (2)The old tool is deployed on the new kernel and can configure the old flow table. ``` [root@localhost aarch64]# uname -a inux (none) 5.106.0+ #1 SMP Thu Nov 24 21:25:01 CST 2022 aarch64 GNU/Linux [root@localhost aarch64]# [root@localhost aarch64]# ethtool --version sthtool version 5.10 [root@localhost aarch64]# -oot@fpga: /root# ethtool -U eth1 flow-type tcp4 src-ip 192.168.49.30 action 3 loc 4 [root@localhost aarch64]# /root# [root@localhost aarch64]# ethtool -u etht 1 RX rings_ available Total 1 rules -ilter: 4 Rule Type: TCP over IPv4 Src IP addr: 192.168.40.30 mask: 0.0.0.0 Dest IP addr: 0.0.0.0 mask: 255.255.255.255 TOS: 0x0 mask: 0xff Src port: 0 mask: oxffff Dest port: 0 mask: Oxffff Action: Direct to queue 3 [root@localhost aarch64]# ethtool -U eth1 delete 4 [root@localhost aarch64]# ethtool -u eth1 4 RX rings_available Total @ rules [root@localhost aarch64]# ``` (3)The VXLAN flow table is successfully configured using the new kernel and tool. ``` [root@localhost aarch64]# ip Link add vxlan® type vxlan id 100 local 192.168.1.2 remote 192.168.1.3 dstport 4789 dev eno1 [root@localhost aarch64]# ethtool -u enol 32 RX rings available Total 1 rules Filter: 511 Rule Type: Vxlan IPv4 Vni: 100 mask: 0x0 Src MAC addr: 00:00:00:00:00:00 mask: FF:FF:FF:FF:FF:FF Dest MAC addr: 00:00:00:00:00:00 mask: FF:FF:FF:FF:FF:FF Ethertype: 0x0 mask: OxFFFF Src IP addr: 0.0.0.0 mask: 255.255.255.255 Dest IP addr: 192.168.1.3 mask: 0.0.0.0 TOS: 0x0 mask: Oxff L4 protocol: © mask: Oxff Action: Direct to queue 0 [root@localhost aarch64]# [root@localhost aarch64]# ethtool -N eno1 delete 511 [root@localhost aarch64]# ethtool -u eno1 52 Rx rings available Total o rdles [root@localhost aarch64]# [root@localhost aarch64]# ethtool -U eno1 flow-type vxlan4 vni 100 dst-ip 192.168.1.3 Added rule with ID 511 [root@localhost aarch64]# ethtool -u enot 52 Rx rings available Total 1 rules Filter: 511 Rule Type: Vxlan IPv4 Vni: 100 mask: 0x0 Src MAC addr: 00:00:00:00:00:00 mask: FF:FF:FF:FF:FF:FF Dest MAC addr: 00:00:00:00:00:00 mask: FF:FF:FF:FF:FF:FF Ethertype: 0x0 mask: 0xFFFF Src IP addr: 0.0.0.0 mask: 255.255.255.255 Dest IP addr: 192.168.1.3 mask: 0.0.0.0 TOS: 0x0 mask: oxff L4 protocol: © mask: Oxff Action: Direct to queue 0 [root@localhost aarch64]# uname -a Linux localhost.localdomain 5.10.0+ #10 SMP Fri Nov 25 14:12:36 CST 2022 aarch64 aarch64 aarch64 GNU/Linux [root@localhost aarch64]# ethtool --version ethtool version 5.15 ``` Link:https://gitee.com/openeuler/kernel/pulls/276 Reviewed-by: Yue Haibing <yuehaibing@huawei.com> Signed-off-by: Xie XiuQi <xiexiuqi@huawei.com>
Showing
想要评论请 注册 或 登录