Commit 76b745fa authored by Hao Lan's avatar Hao Lan Committed by Jiantao Xiao
Browse files

net: hns3: Disable SerDes serial loopback for HiLink H60

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


CVE: NA

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

When the hilink is H60, the serdes serial loopback test is not
supported. This patch add hilink detection. When the value
is H60, the serdes serial loopback test will be disable.

Fixes: c39c4d98 ("net: hns3: Add mac loopback selftest support in hns3 driver")
Signed-off-by: default avatarHao Lan <lanhao@huawei.com>
parent e6bec4e4
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -453,6 +453,7 @@ struct hnae3_dev_specs {
	u8 tnl_num;
	u16 guid_tbl_space;
	u16 ip_tbl_space;
	u8 hilink_version;
};

struct hnae3_client_ops {
+2 −0
Original line number Diff line number Diff line
@@ -1099,6 +1099,8 @@ hns3_dbg_dev_specs(struct hnae3_handle *h, char *buf, int len, int *pos)
	*pos += scnprintf(buf + *pos, len - *pos,
			  "TX timeout threshold: %d seconds\n",
			  dev->watchdog_timeo / HZ);
	*pos += scnprintf(buf + *pos, len - *pos, "Hilink Version: %u\n",
			  dev_specs->hilink_version);
}

static int hns3_dbg_dev_info(struct hnae3_handle *h, char *buf, int len)
+2 −1
Original line number Diff line number Diff line
@@ -868,7 +868,8 @@ struct hclge_dev_specs_1_cmd {
	__le16 guid_tbl_space;
	__le16 ip_tbl_space;
	u8 tnl_num;
	u8 rsv2[5];
	u8 hilink_version;
	u8 rsv2[4];
};

/* mac speed type defined in firmware command */
+7 −2
Original line number Diff line number Diff line
@@ -704,8 +704,12 @@ static int hclge_get_sset_count(struct hnae3_handle *handle, int stringset)
			handle->flags |= HNAE3_SUPPORT_APP_LOOPBACK;
		}

		if (hdev->ae_dev->dev_specs.hilink_version !=
		    HCLGE_HILINK_H60) {
			count += 1;
			handle->flags |= HNAE3_SUPPORT_SERDES_SERIAL_LOOPBACK;
		}

		count += 1;
		handle->flags |= HNAE3_SUPPORT_SERDES_PARALLEL_LOOPBACK;
		count += 1;
@@ -1424,6 +1428,7 @@ static void hclge_parse_dev_specs(struct hclge_dev *hdev,
	ae_dev->dev_specs.umv_size = le16_to_cpu(req1->umv_size);
	ae_dev->dev_specs.mc_mac_size = le16_to_cpu(req1->mc_mac_size);
	ae_dev->dev_specs.tnl_num = req1->tnl_num;
	ae_dev->dev_specs.hilink_version = req1->hilink_version;
#ifdef CONFIG_HNS3_UBL
	if (hnae3_dev_ubl_supported(ae_dev)) {
		ae_dev->dev_specs.guid_tbl_space =
+6 −0
Original line number Diff line number Diff line
@@ -259,6 +259,12 @@ enum HCLGE_MAC_DUPLEX {
	HCLGE_MAC_FULL
};

/* hilink version */
enum hclge_hilink_version {
	HCLGE_HILINK_H32 = 0,
	HCLGE_HILINK_H60 = 1,
};

#define QUERY_SFP_SPEED		0
#define QUERY_ACTIVE_SPEED	1