提交 01c810c8 编写于 作者: J Junxian Huang 提交者: ZhouJuan

RDMA/hns: Fix the counting error of slave number

driver inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I6Z4E9

---------------------------------------------------------------

Currently, the driver will count the number of slave hr_dev,
but during bond clearing event and slave decreasing event, only
one slave has a corresponding hr_dev, and the number will always
be 1. It causes that all slave decrease events are redirected to
a bond clearing operation.

This patch fixes this problem by counting slave netdev directly instead
of getting its hr_dev during bond clearing event and slave decreasing
event.

Fixes: 646b97db ("RDMA/hns: adjust the structure of RoCE bonding driver")
Signed-off-by: NJunxian Huang <huangjunxian6@hisilicon.com>
上级 8d3ee0ae
...@@ -661,15 +661,21 @@ static enum bond_support_type ...@@ -661,15 +661,21 @@ static enum bond_support_type
rcu_read_lock(); rcu_read_lock();
for_each_netdev_in_bond_rcu(*upper_dev, net_dev) { for_each_netdev_in_bond_rcu(*upper_dev, net_dev) {
hr_dev = hns_roce_get_hrdev_by_netdev(net_dev); if (!info->linking && bond_grp_exist) {
if (hr_dev) { if (is_netdev_bond_slave(net_dev, bond_grp))
slave_num++; slave_num++;
if (bus_num == -1) } else {
bus_num = hr_dev->pci_dev->bus->number; hr_dev = hns_roce_get_hrdev_by_netdev(net_dev);
if (hr_dev->is_vf || pci_num_vf(hr_dev->pci_dev) > 0 || if (hr_dev) {
bus_num != hr_dev->pci_dev->bus->number) { slave_num++;
support = false; if (bus_num == -1)
break; bus_num = hr_dev->pci_dev->bus->number;
if (hr_dev->is_vf ||
pci_num_vf(hr_dev->pci_dev) > 0 ||
bus_num != hr_dev->pci_dev->bus->number) {
support = false;
break;
}
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册