Commit ea647614 authored by Haibin Lu's avatar Haibin Lu Committed by Jie Liu
Browse files

UNIC: config function guid to hw in periodic service task

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


CVE: NA

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

In the current version, the unic driver configures the
function guid to the hardware during initialization.
However, no processing is performed after the configuration
fails. As a result, the function guid may not be configured
to the hardware.

This patch adds the process of configuring the function
guid to the periodic task to ensure that the function guid
can be configured to the hardware.

Signed-off-by: default avatarHaibin Lu <luhaibin10@hisilicon.com>
parent b0c14887
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -858,7 +858,7 @@ struct hnae3_ae_ops {
		       const unsigned char *addr,
		       enum hnae3_unic_addr_type addr_type);
	int (*get_func_guid)(struct hnae3_handle *handle, u8 *guid);
	int (*set_func_guid)(struct hnae3_handle *handle, u8 *guid);
	void (*set_func_guid)(struct hnae3_handle *handle, u8 *guid);
};

struct hnae3_dcb_ops {
+13 −7
Original line number Diff line number Diff line
@@ -248,32 +248,38 @@ hclge_comm_unic_func_guid_cmd_prepare(u8 *guid,
	memcpy(req->guid, guid, UBL_ALEN);
}

int hclge_comm_unic_set_func_guid(struct hclge_comm_hw *hw, u8 *guid)
void hclge_comm_unic_set_func_guid(struct hclge_comm_hw *hw, u8 **guid)
{
	struct hclge_comm_func_guid_cmd *req;
	struct hclge_desc desc;
	int ret;

	if (!*guid)
		return;

	req = (struct hclge_comm_func_guid_cmd *)desc.data;

	hclge_comm_cmd_setup_basic_desc(&desc, HCLGE_OPC_COMM_CFG_FUNC_GUID,
					false);
	hclge_comm_unic_func_guid_cmd_prepare(guid, req);
	hclge_comm_unic_func_guid_cmd_prepare(*guid, req);

	ret = hclge_comm_cmd_send(hw, &desc, 1);
	if (ret)
		dev_err(&hw->cmq.csq.pdev->dev,
			"failed to set guid for cmd_send, ret = %d\n", ret);

	return ret;
		dev_warn(&hw->cmq.csq.pdev->dev,
			 "set guid failed for cmd_send, ret = %d.\n", ret);
	else
		*guid = NULL;
}

void hclge_comm_unic_rm_func_guid(struct hclge_comm_hw *hw)
void hclge_comm_unic_rm_func_guid(struct hclge_comm_hw *hw, u8 **guid)
{
	struct hclge_comm_func_guid_cmd *req;
	struct hclge_desc desc;
	int ret;

	if (*guid)
		return;

	req = (struct hclge_comm_func_guid_cmd *)desc.data;

	hclge_comm_cmd_setup_basic_desc(&desc, HCLGE_OPC_COMM_CFG_FUNC_GUID,
+2 −2
Original line number Diff line number Diff line
@@ -100,8 +100,8 @@ bool hclge_comm_unic_sync_addr_table(struct hnae3_handle *handle,
						    struct list_head *));
int hclge_comm_unic_convert_ip_addr(const struct sockaddr *addr,
				    struct in6_addr *ip_addr);
int hclge_comm_unic_set_func_guid(struct hclge_comm_hw *hw, u8 *guid);
void hclge_comm_unic_set_func_guid(struct hclge_comm_hw *hw, u8 **guid);
int hclge_comm_unic_get_func_guid(struct hclge_comm_hw *hw, u8 *guid);
void hclge_comm_unic_rm_func_guid(struct hclge_comm_hw *hw);
void hclge_comm_unic_rm_func_guid(struct hclge_comm_hw *hw, u8 **guid);

#endif
+1 −6
Original line number Diff line number Diff line
@@ -354,12 +354,7 @@ int hns3_unic_init_guid(struct net_device *netdev)
	memcpy(netdev->dev_addr, temp_guid_addr, netdev->addr_len);
	memcpy(netdev->perm_addr, temp_guid_addr, netdev->addr_len);

	ret = h->ae_algo->ops->set_func_guid(h, netdev->dev_addr);
	if (ret) {
		netdev_err(netdev, "set function guid fail, ret = %d\n", ret);
		hns3_unic_del_mc_guid(netdev, bc_guid);
		return ret;
	}
	h->ae_algo->ops->set_func_guid(h, netdev->dev_addr);

	return 0;
}
+1 −0
Original line number Diff line number Diff line
@@ -4775,6 +4775,7 @@ static void hclge_periodic_service_task(struct hclge_dev *hdev)
	if (hnae3_dev_ubl_supported(hdev->ae_dev)) {
		hclge_unic_sync_mguid_table(hdev);
		hclge_unic_sync_ip_table(hdev);
		hclge_comm_unic_set_func_guid(&hdev->hw.hw, &hdev->hw.func_guid);
	}
#endif
	hclge_sync_promisc_mode(hdev);
Loading