Commit 8353c2ab authored by Paolo Abeni's avatar Paolo Abeni

Merge branch 'check-vlan-filter-feature-in-vlan_vids_add_by_dev-and-vlan_vids_del_by_dev'

Liu Jian says:

====================
check vlan filter feature in vlan_vids_add_by_dev() and vlan_vids_del_by_dev()

v2->v3:
	Filter using vlan_hw_filter_capable().
	Add one basic test.
====================

Link: https://lore.kernel.org/r/20231216075219.2379123-1-liujian56@huawei.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parents fa94a0c8 2258b666
......@@ -407,6 +407,8 @@ int vlan_vids_add_by_dev(struct net_device *dev,
return 0;
list_for_each_entry(vid_info, &vlan_info->vid_list, list) {
if (!vlan_hw_filter_capable(by_dev, vid_info->proto))
continue;
err = vlan_vid_add(dev, vid_info->proto, vid_info->vid);
if (err)
goto unwind;
......@@ -417,6 +419,8 @@ int vlan_vids_add_by_dev(struct net_device *dev,
list_for_each_entry_continue_reverse(vid_info,
&vlan_info->vid_list,
list) {
if (!vlan_hw_filter_capable(by_dev, vid_info->proto))
continue;
vlan_vid_del(dev, vid_info->proto, vid_info->vid);
}
......@@ -436,8 +440,11 @@ void vlan_vids_del_by_dev(struct net_device *dev,
if (!vlan_info)
return;
list_for_each_entry(vid_info, &vlan_info->vid_list, list)
list_for_each_entry(vid_info, &vlan_info->vid_list, list) {
if (!vlan_hw_filter_capable(by_dev, vid_info->proto))
continue;
vlan_vid_del(dev, vid_info->proto, vid_info->vid);
}
}
EXPORT_SYMBOL(vlan_vids_del_by_dev);
......
......@@ -91,6 +91,7 @@ TEST_PROGS += test_bridge_neigh_suppress.sh
TEST_PROGS += test_vxlan_nolocalbypass.sh
TEST_PROGS += test_bridge_backup_port.sh
TEST_PROGS += fdb_flush.sh
TEST_PROGS += vlan_hw_filter.sh
TEST_FILES := settings
......
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
readonly NETNS="ns-$(mktemp -u XXXXXX)"
ret=0
cleanup() {
ip netns del $NETNS
}
trap cleanup EXIT
fail() {
echo "ERROR: ${1:-unexpected return code} (ret: $_)" >&2
ret=1
}
ip netns add ${NETNS}
ip netns exec ${NETNS} ip link add bond0 type bond mode 0
ip netns exec ${NETNS} ip link add bond_slave_1 type veth peer veth2
ip netns exec ${NETNS} ip link set bond_slave_1 master bond0
ip netns exec ${NETNS} ethtool -K bond0 rx-vlan-filter off
ip netns exec ${NETNS} ip link add link bond_slave_1 name bond_slave_1.0 type vlan id 0
ip netns exec ${NETNS} ip link add link bond0 name bond0.0 type vlan id 0
ip netns exec ${NETNS} ip link set bond_slave_1 nomaster
ip netns exec ${NETNS} ip link del veth2 || fail "Please check vlan HW filter function"
exit $ret
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment