Commit 49acadc5 authored by Hao Chen's avatar Hao Chen Committed by Jiantao Xiao
Browse files

net: hns3: add support for getting GE port lanes

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


CVE: NA

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

The number of lanes on the electrical port is 0, which does not
meet the expectation. The patch add support for getting GE port
lanes.

Signed-off-by: default avatarHao Chen <chenhao418@huawei.com>
parent f5432d46
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -7,10 +7,15 @@
static ssize_t lane_num_show(struct device *dev,
			     struct device_attribute *attr, char *buf)
{
#define HCLGE_GE_PORT_ONE_LANE	1
	struct pci_dev *pdev = container_of(dev, struct pci_dev, dev);
	struct hnae3_ae_dev *ae_dev = pci_get_drvdata(pdev);
	struct hclge_dev *hdev = ae_dev->priv;

	if (hdev->hw.mac.media_type == HNAE3_MEDIA_TYPE_COPPER)
		return scnprintf(buf, PAGE_SIZE, "%u\n",
				 HCLGE_GE_PORT_ONE_LANE);
	else
		return scnprintf(buf, PAGE_SIZE, "%u\n", hdev->hw.mac.lane_num);
}