RDMA/hns: Fix port active speed

HW supports a variety of different speed, but the current speed
is fixed.

The real speed should be querried from ethernet.

Fixes: 9a4435375c ("IB/hns: Add driver files for hns RoCE driver")
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Link: https://lore.kernel.org/r/20230804012711.808069-2-huangjunxian6@hisilicon.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
This commit is contained in:
Chengchang Tang 2023-08-04 09:27:08 +08:00 коммит произвёл Leon Romanovsky
Родитель 14611b9b98
Коммит df1bcf90a6
1 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -219,6 +219,7 @@ static int hns_roce_query_port(struct ib_device *ib_dev, u32 port_num,
unsigned long flags; unsigned long flags;
enum ib_mtu mtu; enum ib_mtu mtu;
u32 port; u32 port;
int ret;
port = port_num - 1; port = port_num - 1;
@ -231,8 +232,10 @@ static int hns_roce_query_port(struct ib_device *ib_dev, u32 port_num,
IB_PORT_BOOT_MGMT_SUP; IB_PORT_BOOT_MGMT_SUP;
props->max_msg_sz = HNS_ROCE_MAX_MSG_LEN; props->max_msg_sz = HNS_ROCE_MAX_MSG_LEN;
props->pkey_tbl_len = 1; props->pkey_tbl_len = 1;
props->active_width = IB_WIDTH_4X; ret = ib_get_eth_speed(ib_dev, port_num, &props->active_speed,
props->active_speed = 1; &props->active_width);
if (ret)
ibdev_warn(ib_dev, "failed to get speed, ret = %d.\n", ret);
spin_lock_irqsave(&hr_dev->iboe.lock, flags); spin_lock_irqsave(&hr_dev->iboe.lock, flags);