Commit 95e80adc authored by Chiqijun's avatar Chiqijun Committed by Yang Yingliang
Browse files

net/hinic: Fix VF driver loading failure during the firmware hot upgrade process



driver inclusion
category: bugfix
bugzilla: 4472

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

It is not allowed to send commands to the firmware during the firmware
upgrade process, and some commands are not retried during the VF
loading process, causing the loading to fail. Troubleshoot and modify
commands that have not been retried to ensure that the driver can
continue to load after the hot upgrade is complete.

Signed-off-by: default avatarChiqijun <chiqijun@huawei.com>
Reviewed-by: default avatarZengweiliang <zengweiliang.zengweiliang@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
parent 8d33668a
Loading
Loading
Loading
Loading
+11 −9
Original line number Diff line number Diff line
@@ -604,16 +604,15 @@ static int get_cap_from_fw(struct hinic_hwdev *dev, enum func_type type)

static int get_cap_from_pf(struct hinic_hwdev *dev, enum func_type type)
{
	int err;
	u16 in_len, out_len;
	struct hinic_dev_cap dev_cap = {0};
	u16 in_len, out_len;
	int err;

	in_len = sizeof(dev_cap);
	out_len = in_len;

	err = hinic_mbox_to_pf(dev, HINIC_MOD_CFGM, HINIC_CFG_MBOX_CAP,
			       &dev_cap, in_len, &dev_cap, &out_len,
			       CFG_MAX_CMD_TIMEOUT);
	err = hinic_msg_to_mgmt_sync(dev, HINIC_MOD_CFGM, HINIC_CFG_MBOX_CAP,
				     &dev_cap, in_len, &dev_cap, &out_len, 0);
	if (err || dev_cap.status || !out_len) {
		sdk_err(dev->dev_hdl, "Failed to get capability from PF,  err: %d, status: 0x%x, out size: 0x%x\n",
			err, dev_cap.status, out_len);
@@ -1346,14 +1345,17 @@ static int cfg_mbx_pf_proc_vf_msg(void *hwdev, u16 vf_id, u8 cmd, void *buf_in,
	/* fixed qnum in ovs mode */
	func_id = vf_id + hinic_glb_pf_vf_offset(hwdev);
	dev_cap_tmp.func_id = func_id;
	err = hinic_msg_to_mgmt_sync(dev, HINIC_MOD_CFGM, HINIC_CFG_FUNC_CAP,
	err = hinic_pf_msg_to_mgmt_sync(dev, HINIC_MOD_CFGM, HINIC_CFG_FUNC_CAP,
					&dev_cap_tmp, sizeof(dev_cap_tmp),
					&dev_cap_tmp, &out_len, 0);
	if (err || !out_len || dev_cap_tmp.status) {
	if (err && err != HINIC_DEV_BUSY_ACTIVE_FW &&
	    err != HINIC_MBOX_PF_BUSY_ACTIVE_FW) {
		sdk_err(dev->dev_hdl,
			"Get func_id: %u capability from FW failed, err: %d, status: 0x%x, out_size: 0x%x\n",
			func_id, err, dev_cap_tmp.status, out_len);
		return -EFAULT;
	} else if (err) {
		return err;
	}

	dev_cap->nic_max_sq = dev_cap_tmp.nic_max_sq + 1;
+0 −2
Original line number Diff line number Diff line
@@ -18,8 +18,6 @@

#include "hinic_ctx_def.h"

#define CFG_MAX_CMD_TIMEOUT     1000 /* ms */

enum {
	CFG_FREE = 0,
	CFG_BUSY = 1
+2 −1
Original line number Diff line number Diff line
@@ -839,7 +839,8 @@ static int __pf_to_mgmt_pre_handle(struct hinic_hwdev *hwdev,
				   enum hinic_mod_type mod, u8 cmd)
{
	if (hinic_get_mgmt_channel_status(hwdev)) {
		if (mod == HINIC_MOD_COMM || mod == HINIC_MOD_L2NIC)
		if (mod == HINIC_MOD_COMM || mod == HINIC_MOD_L2NIC ||
		    mod == HINIC_MOD_CFGM || mod == HINIC_MOD_HILINK)
			return HINIC_DEV_BUSY_ACTIVE_FW;
		else
			return -EBUSY;