aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
diff options
context:
space:
mode:
authorJian Shen <shenjian15@huawei.com>2019-05-03 17:50:37 +0800
committerDavid S. Miller <davem@davemloft.net>2019-05-04 00:02:40 -0400
commit88d10bd6f73014e8392968cc1db246ad4bf98792 (patch)
treec794dc2a55cfd9a5a2927f4b8f1b10c1adc871c8 /drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
parentusbnet: ipheth: Remove unnecessary NULL pointer check (diff)
downloadlinux-dev-88d10bd6f73014e8392968cc1db246ad4bf98792.tar.xz
linux-dev-88d10bd6f73014e8392968cc1db246ad4bf98792.zip
net: hns3: add support for multiple media type
Previously, we can only identify copper and fiber type, the supported link modes of port information are always showing SR type. This patch adds support for multiple media types, include SR, LR CR, KR. Driver needs to query the media type from firmware periodicly, and updates the port information. The new port information looks like this: Settings for eth0: Supported ports: [ FIBRE ] Supported link modes: 25000baseCR/Full 25000baseSR/Full 1000baseX/Full 10000baseCR/Full 10000baseSR/Full 10000baseLR/Full Supported pause frame use: Symmetric Supports auto-negotiation: No Supported FEC modes: None BaseR Advertised link modes: Not reported Advertised pause frame use: No Advertised auto-negotiation: No Advertised FEC modes: Not reported Speed: 10000Mb/s Duplex: Full Port: FIBRE PHYAD: 0 Transceiver: internal Auto-negotiation: off Current message level: 0x00000036 (54) probe link ifdown ifup Link detected: yes In order to be compatible with old firmware which only support sfp speed, we remained using the same query command, and kept the former logic. Signed-off-by: Jian Shen <shenjian15@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h')
-rw-r--r--drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
index 4aba6248965d..197e7025ae23 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h
@@ -189,6 +189,8 @@ enum HLCGE_PORT_TYPE {
#define HCLGE_SUPPORT_25G_BIT BIT(2)
#define HCLGE_SUPPORT_50G_BIT BIT(3)
#define HCLGE_SUPPORT_100G_BIT BIT(4)
+/* to be compatible with exsit board */
+#define HCLGE_SUPPORT_40G_BIT BIT(5)
#define HCLGE_SUPPORT_100M_BIT BIT(6)
#define HCLGE_SUPPORT_10M_BIT BIT(7)
#define HCLGE_SUPPORT_GE \
@@ -236,14 +238,21 @@ enum HCLGE_MAC_DUPLEX {
HCLGE_MAC_FULL
};
+#define QUERY_SFP_SPEED 0
+#define QUERY_ACTIVE_SPEED 1
+
struct hclge_mac {
u8 phy_addr;
u8 flag;
- u8 media_type;
+ u8 media_type; /* port media type, e.g. fibre/copper/backplane */
u8 mac_addr[ETH_ALEN];
u8 autoneg;
u8 duplex;
+ u8 support_autoneg;
+ u8 speed_type; /* 0: sfp speed, 1: active speed */
u32 speed;
+ u32 speed_ability; /* speed ability supported by current media */
+ u32 module_type; /* sub media type, e.g. kr/cr/sr/lr */
int link; /* store the link status of mac & phy (if phy exit)*/
struct phy_device *phydev;
struct mii_bus *mdio_bus;