提交 6701d806 编写于 作者: L Lang Cheng 提交者: Xie XiuQi

RDMA/hns: support send link down event fastly

driver inclusion
category: bugfix
bugzilla: NA
CVE: NA

When the netdev port status changes, the roce driver sends a port down
event by parsing the netdev event dispatched by IB_CORE, which takes about
a few hundred milliseconds.
But,it is not fast enough for ULP sometimes.

The HNS NIC driver can directly notify the ROCE driver send port
event via callback function, this takes only a few milliseconds.
This patch implements this callback function.

Feature or Bugfix:Bugfix
Signed-off-by: NLang Cheng <chenglang@huawei.com>
Reviewed-by: Noulijun <oulijun@huawei.com>
Reviewed-by: Nliyangyang20 <liyangyang20@huawei.com>
Reviewed-by: Nwangxi <wangxi11@huawei.com>
Reviewed-by: Nliuyixian <liuyixian@huawei.com>
Reviewed-by: NYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 fc467537
...@@ -7555,9 +7555,43 @@ static int hns_roce_hw_v2_reset_notify(struct hnae3_handle *handle, ...@@ -7555,9 +7555,43 @@ static int hns_roce_hw_v2_reset_notify(struct hnae3_handle *handle,
return ret; return ret;
} }
static void hns_roce_hw_v2_link_status_change(struct hnae3_handle *handle,
bool linkup)
{
struct hns_roce_dev *hr_dev = (struct hns_roce_dev *)handle->priv;
struct net_device *netdev = handle->rinfo.netdev;
struct ib_event event;
unsigned long flags;
u8 phy_port;
if (linkup || !hr_dev)
return;
for (phy_port = 0; phy_port < hr_dev->caps.num_ports; phy_port++)
if (netdev == hr_dev->iboe.netdevs[phy_port])
break;
if (phy_port == hr_dev->caps.num_ports)
return;
spin_lock_irqsave(&hr_dev->iboe.lock, flags);
if (hr_dev->iboe.last_port_state[phy_port] == IB_PORT_DOWN) {
spin_unlock_irqrestore(&hr_dev->iboe.lock, flags);
return;
}
hr_dev->iboe.last_port_state[phy_port] = IB_PORT_DOWN;
spin_unlock_irqrestore(&hr_dev->iboe.lock, flags);
event.device = &hr_dev->ib_dev;
event.element.port_num = to_rdma_port_num(phy_port);
event.event = IB_EVENT_PORT_ERR;
ib_dispatch_event(&event);
}
static const struct hnae3_client_ops hns_roce_hw_v2_ops = { static const struct hnae3_client_ops hns_roce_hw_v2_ops = {
.init_instance = hns_roce_hw_v2_init_instance, .init_instance = hns_roce_hw_v2_init_instance,
.uninit_instance = hns_roce_hw_v2_uninit_instance, .uninit_instance = hns_roce_hw_v2_uninit_instance,
.link_status_change = hns_roce_hw_v2_link_status_change,
.reset_notify = hns_roce_hw_v2_reset_notify, .reset_notify = hns_roce_hw_v2_reset_notify,
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册