Commit 6edd302a authored by David S. Miller's avatar David S. Miller

Merge branch 'hns3-next'

Guangbin Huang says:

====================
net: hns3: updates for -next

This series includes some updates for the HNS3 ethernet driver.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 39a7d726 08aa17a0
...@@ -99,11 +99,11 @@ enum HNAE3_DEV_CAP_BITS { ...@@ -99,11 +99,11 @@ enum HNAE3_DEV_CAP_BITS {
HNAE3_DEV_SUPPORT_CQ_B, HNAE3_DEV_SUPPORT_CQ_B,
}; };
#define hnae3_dev_fd_supported(hdev) \ #define hnae3_ae_dev_fd_supported(ae_dev) \
test_bit(HNAE3_DEV_SUPPORT_FD_B, (hdev)->ae_dev->caps) test_bit(HNAE3_DEV_SUPPORT_FD_B, (ae_dev)->caps)
#define hnae3_dev_gro_supported(hdev) \ #define hnae3_ae_dev_gro_supported(ae_dev) \
test_bit(HNAE3_DEV_SUPPORT_GRO_B, (hdev)->ae_dev->caps) test_bit(HNAE3_DEV_SUPPORT_GRO_B, (ae_dev)->caps)
#define hnae3_dev_fec_supported(hdev) \ #define hnae3_dev_fec_supported(hdev) \
test_bit(HNAE3_DEV_SUPPORT_FEC_B, (hdev)->ae_dev->caps) test_bit(HNAE3_DEV_SUPPORT_FEC_B, (hdev)->ae_dev->caps)
...@@ -223,6 +223,8 @@ enum hnae3_fec_mode { ...@@ -223,6 +223,8 @@ enum hnae3_fec_mode {
HNAE3_FEC_AUTO = 0, HNAE3_FEC_AUTO = 0,
HNAE3_FEC_BASER, HNAE3_FEC_BASER,
HNAE3_FEC_RS, HNAE3_FEC_RS,
HNAE3_FEC_LLRS,
HNAE3_FEC_NONE,
HNAE3_FEC_USER_DEF, HNAE3_FEC_USER_DEF,
}; };
......
...@@ -52,9 +52,9 @@ void hclge_comm_cmd_reuse_desc(struct hclge_desc *desc, bool is_read) ...@@ -52,9 +52,9 @@ void hclge_comm_cmd_reuse_desc(struct hclge_desc *desc, bool is_read)
static void hclge_comm_set_default_capability(struct hnae3_ae_dev *ae_dev, static void hclge_comm_set_default_capability(struct hnae3_ae_dev *ae_dev,
bool is_pf) bool is_pf)
{ {
set_bit(HNAE3_DEV_SUPPORT_FD_B, ae_dev->caps);
set_bit(HNAE3_DEV_SUPPORT_GRO_B, ae_dev->caps); set_bit(HNAE3_DEV_SUPPORT_GRO_B, ae_dev->caps);
if (is_pf && ae_dev->dev_version == HNAE3_DEVICE_VERSION_V2) { if (is_pf) {
set_bit(HNAE3_DEV_SUPPORT_FD_B, ae_dev->caps);
set_bit(HNAE3_DEV_SUPPORT_FEC_B, ae_dev->caps); set_bit(HNAE3_DEV_SUPPORT_FEC_B, ae_dev->caps);
set_bit(HNAE3_DEV_SUPPORT_PAUSE_B, ae_dev->caps); set_bit(HNAE3_DEV_SUPPORT_PAUSE_B, ae_dev->caps);
} }
...@@ -91,6 +91,7 @@ int hclge_comm_firmware_compat_config(struct hnae3_ae_dev *ae_dev, ...@@ -91,6 +91,7 @@ int hclge_comm_firmware_compat_config(struct hnae3_ae_dev *ae_dev,
hnae3_set_bit(compat, HCLGE_COMM_PHY_IMP_EN_B, 1); hnae3_set_bit(compat, HCLGE_COMM_PHY_IMP_EN_B, 1);
hnae3_set_bit(compat, HCLGE_COMM_MAC_STATS_EXT_EN_B, 1); hnae3_set_bit(compat, HCLGE_COMM_MAC_STATS_EXT_EN_B, 1);
hnae3_set_bit(compat, HCLGE_COMM_SYNC_RX_RING_HEAD_EN_B, 1); hnae3_set_bit(compat, HCLGE_COMM_SYNC_RX_RING_HEAD_EN_B, 1);
hnae3_set_bit(compat, HCLGE_COMM_LLRS_FEC_EN_B, 1);
req->compat = cpu_to_le32(compat); req->compat = cpu_to_le32(compat);
} }
...@@ -150,6 +151,8 @@ static const struct hclge_comm_caps_bit_map hclge_pf_cmd_caps[] = { ...@@ -150,6 +151,8 @@ static const struct hclge_comm_caps_bit_map hclge_pf_cmd_caps[] = {
HNAE3_DEV_SUPPORT_PORT_VLAN_BYPASS_B}, HNAE3_DEV_SUPPORT_PORT_VLAN_BYPASS_B},
{HCLGE_COMM_CAP_PORT_VLAN_BYPASS_B, HNAE3_DEV_SUPPORT_VLAN_FLTR_MDF_B}, {HCLGE_COMM_CAP_PORT_VLAN_BYPASS_B, HNAE3_DEV_SUPPORT_VLAN_FLTR_MDF_B},
{HCLGE_COMM_CAP_CQ_B, HNAE3_DEV_SUPPORT_CQ_B}, {HCLGE_COMM_CAP_CQ_B, HNAE3_DEV_SUPPORT_CQ_B},
{HCLGE_COMM_CAP_GRO_B, HNAE3_DEV_SUPPORT_GRO_B},
{HCLGE_COMM_CAP_FD_B, HNAE3_DEV_SUPPORT_FD_B},
}; };
static const struct hclge_comm_caps_bit_map hclge_vf_cmd_caps[] = { static const struct hclge_comm_caps_bit_map hclge_vf_cmd_caps[] = {
...@@ -162,6 +165,7 @@ static const struct hclge_comm_caps_bit_map hclge_vf_cmd_caps[] = { ...@@ -162,6 +165,7 @@ static const struct hclge_comm_caps_bit_map hclge_vf_cmd_caps[] = {
{HCLGE_COMM_CAP_TX_PUSH_B, HNAE3_DEV_SUPPORT_TX_PUSH_B}, {HCLGE_COMM_CAP_TX_PUSH_B, HNAE3_DEV_SUPPORT_TX_PUSH_B},
{HCLGE_COMM_CAP_RXD_ADV_LAYOUT_B, HNAE3_DEV_SUPPORT_RXD_ADV_LAYOUT_B}, {HCLGE_COMM_CAP_RXD_ADV_LAYOUT_B, HNAE3_DEV_SUPPORT_RXD_ADV_LAYOUT_B},
{HCLGE_COMM_CAP_CQ_B, HNAE3_DEV_SUPPORT_CQ_B}, {HCLGE_COMM_CAP_CQ_B, HNAE3_DEV_SUPPORT_CQ_B},
{HCLGE_COMM_CAP_GRO_B, HNAE3_DEV_SUPPORT_GRO_B},
}; };
static void static void
...@@ -220,8 +224,10 @@ int hclge_comm_cmd_query_version_and_capability(struct hnae3_ae_dev *ae_dev, ...@@ -220,8 +224,10 @@ int hclge_comm_cmd_query_version_and_capability(struct hnae3_ae_dev *ae_dev,
HNAE3_PCI_REVISION_BIT_SIZE; HNAE3_PCI_REVISION_BIT_SIZE;
ae_dev->dev_version |= ae_dev->pdev->revision; ae_dev->dev_version |= ae_dev->pdev->revision;
if (ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V2) if (ae_dev->dev_version == HNAE3_DEVICE_VERSION_V2) {
hclge_comm_set_default_capability(ae_dev, is_pf); hclge_comm_set_default_capability(ae_dev, is_pf);
return 0;
}
hclge_comm_parse_capability(ae_dev, is_pf, resp); hclge_comm_parse_capability(ae_dev, is_pf, resp);
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#define HCLGE_COMM_PHY_IMP_EN_B 2 #define HCLGE_COMM_PHY_IMP_EN_B 2
#define HCLGE_COMM_MAC_STATS_EXT_EN_B 3 #define HCLGE_COMM_MAC_STATS_EXT_EN_B 3
#define HCLGE_COMM_SYNC_RX_RING_HEAD_EN_B 4 #define HCLGE_COMM_SYNC_RX_RING_HEAD_EN_B 4
#define HCLGE_COMM_LLRS_FEC_EN_B 5
#define hclge_comm_dev_phy_imp_supported(ae_dev) \ #define hclge_comm_dev_phy_imp_supported(ae_dev) \
test_bit(HNAE3_DEV_SUPPORT_PHY_IMP_B, (ae_dev)->caps) test_bit(HNAE3_DEV_SUPPORT_PHY_IMP_B, (ae_dev)->caps)
...@@ -339,6 +340,8 @@ enum HCLGE_COMM_CAP_BITS { ...@@ -339,6 +340,8 @@ enum HCLGE_COMM_CAP_BITS {
HCLGE_COMM_CAP_RXD_ADV_LAYOUT_B = 15, HCLGE_COMM_CAP_RXD_ADV_LAYOUT_B = 15,
HCLGE_COMM_CAP_PORT_VLAN_BYPASS_B = 17, HCLGE_COMM_CAP_PORT_VLAN_BYPASS_B = 17,
HCLGE_COMM_CAP_CQ_B = 18, HCLGE_COMM_CAP_CQ_B = 18,
HCLGE_COMM_CAP_GRO_B = 20,
HCLGE_COMM_CAP_FD_B = 21,
}; };
enum HCLGE_COMM_API_CAP_BITS { enum HCLGE_COMM_API_CAP_BITS {
......
...@@ -3271,12 +3271,11 @@ static void hns3_set_default_feature(struct net_device *netdev) ...@@ -3271,12 +3271,11 @@ static void hns3_set_default_feature(struct net_device *netdev)
NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_SCTP_CRC | NETIF_F_FRAGLIST; NETIF_F_SCTP_CRC | NETIF_F_FRAGLIST;
if (ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V2) { if (hnae3_ae_dev_gro_supported(ae_dev))
netdev->features |= NETIF_F_GRO_HW; netdev->features |= NETIF_F_GRO_HW;
if (!(h->flags & HNAE3_SUPPORT_VF)) if (hnae3_ae_dev_fd_supported(ae_dev))
netdev->features |= NETIF_F_NTUPLE; netdev->features |= NETIF_F_NTUPLE;
}
if (test_bit(HNAE3_DEV_SUPPORT_UDP_GSO_B, ae_dev->caps)) if (test_bit(HNAE3_DEV_SUPPORT_UDP_GSO_B, ae_dev->caps))
netdev->features |= NETIF_F_GSO_UDP_L4; netdev->features |= NETIF_F_GSO_UDP_L4;
......
...@@ -1621,12 +1621,12 @@ static unsigned int loc_to_eth_fec(u8 loc_fec) ...@@ -1621,12 +1621,12 @@ static unsigned int loc_to_eth_fec(u8 loc_fec)
eth_fec |= ETHTOOL_FEC_AUTO; eth_fec |= ETHTOOL_FEC_AUTO;
if (loc_fec & BIT(HNAE3_FEC_RS)) if (loc_fec & BIT(HNAE3_FEC_RS))
eth_fec |= ETHTOOL_FEC_RS; eth_fec |= ETHTOOL_FEC_RS;
if (loc_fec & BIT(HNAE3_FEC_LLRS))
eth_fec |= ETHTOOL_FEC_LLRS;
if (loc_fec & BIT(HNAE3_FEC_BASER)) if (loc_fec & BIT(HNAE3_FEC_BASER))
eth_fec |= ETHTOOL_FEC_BASER; eth_fec |= ETHTOOL_FEC_BASER;
if (loc_fec & BIT(HNAE3_FEC_NONE))
/* if nothing is set, then FEC is off */ eth_fec |= ETHTOOL_FEC_OFF;
if (!eth_fec)
eth_fec = ETHTOOL_FEC_OFF;
return eth_fec; return eth_fec;
} }
...@@ -1637,12 +1637,13 @@ static unsigned int eth_to_loc_fec(unsigned int eth_fec) ...@@ -1637,12 +1637,13 @@ static unsigned int eth_to_loc_fec(unsigned int eth_fec)
u32 loc_fec = 0; u32 loc_fec = 0;
if (eth_fec & ETHTOOL_FEC_OFF) if (eth_fec & ETHTOOL_FEC_OFF)
return loc_fec; loc_fec |= BIT(HNAE3_FEC_NONE);
if (eth_fec & ETHTOOL_FEC_AUTO) if (eth_fec & ETHTOOL_FEC_AUTO)
loc_fec |= BIT(HNAE3_FEC_AUTO); loc_fec |= BIT(HNAE3_FEC_AUTO);
if (eth_fec & ETHTOOL_FEC_RS) if (eth_fec & ETHTOOL_FEC_RS)
loc_fec |= BIT(HNAE3_FEC_RS); loc_fec |= BIT(HNAE3_FEC_RS);
if (eth_fec & ETHTOOL_FEC_LLRS)
loc_fec |= BIT(HNAE3_FEC_LLRS);
if (eth_fec & ETHTOOL_FEC_BASER) if (eth_fec & ETHTOOL_FEC_BASER)
loc_fec |= BIT(HNAE3_FEC_BASER); loc_fec |= BIT(HNAE3_FEC_BASER);
...@@ -1668,6 +1669,8 @@ static int hns3_get_fecparam(struct net_device *netdev, ...@@ -1668,6 +1669,8 @@ static int hns3_get_fecparam(struct net_device *netdev,
fec->fec = loc_to_eth_fec(fec_ability); fec->fec = loc_to_eth_fec(fec_ability);
fec->active_fec = loc_to_eth_fec(fec_mode); fec->active_fec = loc_to_eth_fec(fec_mode);
if (!fec->active_fec)
fec->active_fec = ETHTOOL_FEC_OFF;
return 0; return 0;
} }
......
...@@ -347,7 +347,8 @@ struct hclge_sfp_info_cmd { ...@@ -347,7 +347,8 @@ struct hclge_sfp_info_cmd {
u8 autoneg_ability; /* whether support autoneg */ u8 autoneg_ability; /* whether support autoneg */
__le32 speed_ability; /* speed ability for current media */ __le32 speed_ability; /* speed ability for current media */
__le32 module_type; __le32 module_type;
u8 rsv[8]; u8 fec_ability;
u8 rsv[7];
}; };
#define HCLGE_MAC_CFG_FEC_AUTO_EN_B 0 #define HCLGE_MAC_CFG_FEC_AUTO_EN_B 0
...@@ -359,6 +360,7 @@ struct hclge_sfp_info_cmd { ...@@ -359,6 +360,7 @@ struct hclge_sfp_info_cmd {
#define HCLGE_MAC_FEC_OFF 0 #define HCLGE_MAC_FEC_OFF 0
#define HCLGE_MAC_FEC_BASER 1 #define HCLGE_MAC_FEC_BASER 1
#define HCLGE_MAC_FEC_RS 2 #define HCLGE_MAC_FEC_RS 2
#define HCLGE_MAC_FEC_LLRS 3
struct hclge_config_fec_cmd { struct hclge_config_fec_cmd {
u8 fec_mode; u8 fec_mode;
u8 default_config; u8 default_config;
......
...@@ -1517,7 +1517,7 @@ static int hclge_dbg_dump_fd_tcam(struct hclge_dev *hdev, char *buf, int len) ...@@ -1517,7 +1517,7 @@ static int hclge_dbg_dump_fd_tcam(struct hclge_dev *hdev, char *buf, int len)
char *tcam_buf; char *tcam_buf;
int pos = 0; int pos = 0;
if (!hnae3_dev_fd_supported(hdev)) { if (!hnae3_ae_dev_fd_supported(hdev->ae_dev)) {
dev_err(&hdev->pdev->dev, dev_err(&hdev->pdev->dev,
"Only FD-supported dev supports dump fd tcam\n"); "Only FD-supported dev supports dump fd tcam\n");
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -1585,6 +1585,9 @@ static int hclge_dbg_dump_fd_counter(struct hclge_dev *hdev, char *buf, int len) ...@@ -1585,6 +1585,9 @@ static int hclge_dbg_dump_fd_counter(struct hclge_dev *hdev, char *buf, int len)
u64 cnt; u64 cnt;
u8 i; u8 i;
if (!hnae3_ae_dev_fd_supported(hdev->ae_dev))
return -EOPNOTSUPP;
pos += scnprintf(buf + pos, len - pos, pos += scnprintf(buf + pos, len - pos,
"func_id\thit_times\n"); "func_id\thit_times\n");
......
...@@ -1003,6 +1003,27 @@ static int hclge_check_port_speed(struct hnae3_handle *handle, u32 speed) ...@@ -1003,6 +1003,27 @@ static int hclge_check_port_speed(struct hnae3_handle *handle, u32 speed)
return -EINVAL; return -EINVAL;
} }
static void hclge_update_fec_support(struct hclge_mac *mac)
{
linkmode_clear_bit(ETHTOOL_LINK_MODE_FEC_BASER_BIT, mac->supported);
linkmode_clear_bit(ETHTOOL_LINK_MODE_FEC_RS_BIT, mac->supported);
linkmode_clear_bit(ETHTOOL_LINK_MODE_FEC_LLRS_BIT, mac->supported);
linkmode_clear_bit(ETHTOOL_LINK_MODE_FEC_NONE_BIT, mac->supported);
if (mac->fec_ability & BIT(HNAE3_FEC_BASER))
linkmode_set_bit(ETHTOOL_LINK_MODE_FEC_BASER_BIT,
mac->supported);
if (mac->fec_ability & BIT(HNAE3_FEC_RS))
linkmode_set_bit(ETHTOOL_LINK_MODE_FEC_RS_BIT,
mac->supported);
if (mac->fec_ability & BIT(HNAE3_FEC_LLRS))
linkmode_set_bit(ETHTOOL_LINK_MODE_FEC_LLRS_BIT,
mac->supported);
if (mac->fec_ability & BIT(HNAE3_FEC_NONE))
linkmode_set_bit(ETHTOOL_LINK_MODE_FEC_NONE_BIT,
mac->supported);
}
static void hclge_convert_setting_sr(u16 speed_ability, static void hclge_convert_setting_sr(u16 speed_ability,
unsigned long *link_mode) unsigned long *link_mode)
{ {
...@@ -1101,34 +1122,36 @@ static void hclge_convert_setting_kr(u16 speed_ability, ...@@ -1101,34 +1122,36 @@ static void hclge_convert_setting_kr(u16 speed_ability,
static void hclge_convert_setting_fec(struct hclge_mac *mac) static void hclge_convert_setting_fec(struct hclge_mac *mac)
{ {
linkmode_clear_bit(ETHTOOL_LINK_MODE_FEC_BASER_BIT, mac->supported); /* If firmware has reported fec_ability, don't need to convert by speed */
linkmode_clear_bit(ETHTOOL_LINK_MODE_FEC_RS_BIT, mac->supported); if (mac->fec_ability)
goto out;
switch (mac->speed) { switch (mac->speed) {
case HCLGE_MAC_SPEED_10G: case HCLGE_MAC_SPEED_10G:
case HCLGE_MAC_SPEED_40G: case HCLGE_MAC_SPEED_40G:
linkmode_set_bit(ETHTOOL_LINK_MODE_FEC_BASER_BIT, mac->fec_ability = BIT(HNAE3_FEC_BASER) | BIT(HNAE3_FEC_AUTO) |
mac->supported); BIT(HNAE3_FEC_NONE);
mac->fec_ability =
BIT(HNAE3_FEC_BASER) | BIT(HNAE3_FEC_AUTO);
break; break;
case HCLGE_MAC_SPEED_25G: case HCLGE_MAC_SPEED_25G:
case HCLGE_MAC_SPEED_50G: case HCLGE_MAC_SPEED_50G:
linkmode_set_bit(ETHTOOL_LINK_MODE_FEC_RS_BIT, mac->fec_ability = BIT(HNAE3_FEC_BASER) | BIT(HNAE3_FEC_RS) |
mac->supported); BIT(HNAE3_FEC_AUTO) | BIT(HNAE3_FEC_NONE);
mac->fec_ability =
BIT(HNAE3_FEC_BASER) | BIT(HNAE3_FEC_RS) |
BIT(HNAE3_FEC_AUTO);
break; break;
case HCLGE_MAC_SPEED_100G: case HCLGE_MAC_SPEED_100G:
mac->fec_ability = BIT(HNAE3_FEC_RS) | BIT(HNAE3_FEC_AUTO) |
BIT(HNAE3_FEC_NONE);
break;
case HCLGE_MAC_SPEED_200G: case HCLGE_MAC_SPEED_200G:
linkmode_set_bit(ETHTOOL_LINK_MODE_FEC_RS_BIT, mac->supported); mac->fec_ability = BIT(HNAE3_FEC_RS) | BIT(HNAE3_FEC_AUTO) |
mac->fec_ability = BIT(HNAE3_FEC_RS) | BIT(HNAE3_FEC_AUTO); BIT(HNAE3_FEC_LLRS);
break; break;
default: default:
mac->fec_ability = 0; mac->fec_ability = 0;
break; break;
} }
out:
hclge_update_fec_support(mac);
} }
static void hclge_parse_fiber_link_mode(struct hclge_dev *hdev, static void hclge_parse_fiber_link_mode(struct hclge_dev *hdev,
...@@ -1574,7 +1597,7 @@ static int hclge_configure(struct hclge_dev *hdev) ...@@ -1574,7 +1597,7 @@ static int hclge_configure(struct hclge_dev *hdev)
if (cfg.vlan_fliter_cap == HCLGE_VLAN_FLTR_CAN_MDF) if (cfg.vlan_fliter_cap == HCLGE_VLAN_FLTR_CAN_MDF)
set_bit(HNAE3_DEV_SUPPORT_VLAN_FLTR_MDF_B, ae_dev->caps); set_bit(HNAE3_DEV_SUPPORT_VLAN_FLTR_MDF_B, ae_dev->caps);
if (hnae3_dev_fd_supported(hdev)) { if (hnae3_ae_dev_fd_supported(hdev->ae_dev)) {
hdev->fd_en = true; hdev->fd_en = true;
hdev->fd_active_type = HCLGE_FD_RULE_NONE; hdev->fd_active_type = HCLGE_FD_RULE_NONE;
} }
...@@ -1617,7 +1640,7 @@ static int hclge_config_gro(struct hclge_dev *hdev) ...@@ -1617,7 +1640,7 @@ static int hclge_config_gro(struct hclge_dev *hdev)
struct hclge_desc desc; struct hclge_desc desc;
int ret; int ret;
if (!hnae3_dev_gro_supported(hdev)) if (!hnae3_ae_dev_gro_supported(hdev->ae_dev))
return 0; return 0;
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_GRO_GENERIC_CONFIG, false); hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_GRO_GENERIC_CONFIG, false);
...@@ -2744,6 +2767,9 @@ static int hclge_set_fec_hw(struct hclge_dev *hdev, u32 fec_mode) ...@@ -2744,6 +2767,9 @@ static int hclge_set_fec_hw(struct hclge_dev *hdev, u32 fec_mode)
if (fec_mode & BIT(HNAE3_FEC_RS)) if (fec_mode & BIT(HNAE3_FEC_RS))
hnae3_set_field(req->fec_mode, HCLGE_MAC_CFG_FEC_MODE_M, hnae3_set_field(req->fec_mode, HCLGE_MAC_CFG_FEC_MODE_M,
HCLGE_MAC_CFG_FEC_MODE_S, HCLGE_MAC_FEC_RS); HCLGE_MAC_CFG_FEC_MODE_S, HCLGE_MAC_FEC_RS);
if (fec_mode & BIT(HNAE3_FEC_LLRS))
hnae3_set_field(req->fec_mode, HCLGE_MAC_CFG_FEC_MODE_M,
HCLGE_MAC_CFG_FEC_MODE_S, HCLGE_MAC_FEC_LLRS);
if (fec_mode & BIT(HNAE3_FEC_BASER)) if (fec_mode & BIT(HNAE3_FEC_BASER))
hnae3_set_field(req->fec_mode, HCLGE_MAC_CFG_FEC_MODE_M, hnae3_set_field(req->fec_mode, HCLGE_MAC_CFG_FEC_MODE_M,
HCLGE_MAC_CFG_FEC_MODE_S, HCLGE_MAC_FEC_BASER); HCLGE_MAC_CFG_FEC_MODE_S, HCLGE_MAC_FEC_BASER);
...@@ -2988,6 +3014,9 @@ static void hclge_update_fec_advertising(struct hclge_mac *mac) ...@@ -2988,6 +3014,9 @@ static void hclge_update_fec_advertising(struct hclge_mac *mac)
if (mac->fec_mode & BIT(HNAE3_FEC_RS)) if (mac->fec_mode & BIT(HNAE3_FEC_RS))
linkmode_set_bit(ETHTOOL_LINK_MODE_FEC_RS_BIT, linkmode_set_bit(ETHTOOL_LINK_MODE_FEC_RS_BIT,
mac->advertising); mac->advertising);
else if (mac->fec_mode & BIT(HNAE3_FEC_LLRS))
linkmode_set_bit(ETHTOOL_LINK_MODE_FEC_LLRS_BIT,
mac->advertising);
else if (mac->fec_mode & BIT(HNAE3_FEC_BASER)) else if (mac->fec_mode & BIT(HNAE3_FEC_BASER))
linkmode_set_bit(ETHTOOL_LINK_MODE_FEC_BASER_BIT, linkmode_set_bit(ETHTOOL_LINK_MODE_FEC_BASER_BIT,
mac->advertising); mac->advertising);
...@@ -3037,7 +3066,6 @@ static void hclge_update_port_capability(struct hclge_dev *hdev, ...@@ -3037,7 +3066,6 @@ static void hclge_update_port_capability(struct hclge_dev *hdev,
struct hclge_mac *mac) struct hclge_mac *mac)
{ {
if (hnae3_dev_fec_supported(hdev)) if (hnae3_dev_fec_supported(hdev))
/* update fec ability by speed */
hclge_convert_setting_fec(mac); hclge_convert_setting_fec(mac);
/* firmware can not identify back plane type, the media type /* firmware can not identify back plane type, the media type
...@@ -3123,6 +3151,7 @@ static int hclge_get_sfp_info(struct hclge_dev *hdev, struct hclge_mac *mac) ...@@ -3123,6 +3151,7 @@ static int hclge_get_sfp_info(struct hclge_dev *hdev, struct hclge_mac *mac)
mac->fec_mode = 0; mac->fec_mode = 0;
else else
mac->fec_mode = BIT(resp->active_fec); mac->fec_mode = BIT(resp->active_fec);
mac->fec_ability = resp->fec_ability;
} else { } else {
mac->speed_type = QUERY_SFP_SPEED; mac->speed_type = QUERY_SFP_SPEED;
} }
...@@ -5334,7 +5363,7 @@ static int hclge_init_fd_config(struct hclge_dev *hdev) ...@@ -5334,7 +5363,7 @@ static int hclge_init_fd_config(struct hclge_dev *hdev)
struct hclge_fd_key_cfg *key_cfg; struct hclge_fd_key_cfg *key_cfg;
int ret; int ret;
if (!hnae3_dev_fd_supported(hdev)) if (!hnae3_ae_dev_fd_supported(hdev->ae_dev))
return 0; return 0;
ret = hclge_get_fd_mode(hdev, &hdev->fd_cfg.fd_mode); ret = hclge_get_fd_mode(hdev, &hdev->fd_cfg.fd_mode);
...@@ -6339,7 +6368,7 @@ static int hclge_add_fd_entry(struct hnae3_handle *handle, ...@@ -6339,7 +6368,7 @@ static int hclge_add_fd_entry(struct hnae3_handle *handle,
u8 action; u8 action;
int ret; int ret;
if (!hnae3_dev_fd_supported(hdev)) { if (!hnae3_ae_dev_fd_supported(hdev->ae_dev)) {
dev_err(&hdev->pdev->dev, dev_err(&hdev->pdev->dev,
"flow table director is not supported\n"); "flow table director is not supported\n");
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -6395,7 +6424,7 @@ static int hclge_del_fd_entry(struct hnae3_handle *handle, ...@@ -6395,7 +6424,7 @@ static int hclge_del_fd_entry(struct hnae3_handle *handle,
struct ethtool_rx_flow_spec *fs; struct ethtool_rx_flow_spec *fs;
int ret; int ret;
if (!hnae3_dev_fd_supported(hdev)) if (!hnae3_ae_dev_fd_supported(hdev->ae_dev))
return -EOPNOTSUPP; return -EOPNOTSUPP;
fs = (struct ethtool_rx_flow_spec *)&cmd->fs; fs = (struct ethtool_rx_flow_spec *)&cmd->fs;
...@@ -6431,7 +6460,7 @@ static void hclge_clear_fd_rules_in_list(struct hclge_dev *hdev, ...@@ -6431,7 +6460,7 @@ static void hclge_clear_fd_rules_in_list(struct hclge_dev *hdev,
struct hlist_node *node; struct hlist_node *node;
u16 location; u16 location;
if (!hnae3_dev_fd_supported(hdev)) if (!hnae3_ae_dev_fd_supported(hdev->ae_dev))
return; return;
spin_lock_bh(&hdev->fd_rule_lock); spin_lock_bh(&hdev->fd_rule_lock);
...@@ -6473,7 +6502,7 @@ static int hclge_restore_fd_entries(struct hnae3_handle *handle) ...@@ -6473,7 +6502,7 @@ static int hclge_restore_fd_entries(struct hnae3_handle *handle)
* return value. If error is returned here, the reset process will * return value. If error is returned here, the reset process will
* fail. * fail.
*/ */
if (!hnae3_dev_fd_supported(hdev)) if (!hnae3_ae_dev_fd_supported(hdev->ae_dev))
return 0; return 0;
/* if fd is disabled, should not restore it when reset */ /* if fd is disabled, should not restore it when reset */
...@@ -6497,7 +6526,7 @@ static int hclge_get_fd_rule_cnt(struct hnae3_handle *handle, ...@@ -6497,7 +6526,7 @@ static int hclge_get_fd_rule_cnt(struct hnae3_handle *handle,
struct hclge_vport *vport = hclge_get_vport(handle); struct hclge_vport *vport = hclge_get_vport(handle);
struct hclge_dev *hdev = vport->back; struct hclge_dev *hdev = vport->back;
if (!hnae3_dev_fd_supported(hdev) || hclge_is_cls_flower_active(handle)) if (!hnae3_ae_dev_fd_supported(hdev->ae_dev) || hclge_is_cls_flower_active(handle))
return -EOPNOTSUPP; return -EOPNOTSUPP;
cmd->rule_cnt = hdev->hclge_fd_rule_num; cmd->rule_cnt = hdev->hclge_fd_rule_num;
...@@ -6715,7 +6744,7 @@ static int hclge_get_fd_rule_info(struct hnae3_handle *handle, ...@@ -6715,7 +6744,7 @@ static int hclge_get_fd_rule_info(struct hnae3_handle *handle,
struct hclge_dev *hdev = vport->back; struct hclge_dev *hdev = vport->back;
struct ethtool_rx_flow_spec *fs; struct ethtool_rx_flow_spec *fs;
if (!hnae3_dev_fd_supported(hdev)) if (!hnae3_ae_dev_fd_supported(hdev->ae_dev))
return -EOPNOTSUPP; return -EOPNOTSUPP;
fs = (struct ethtool_rx_flow_spec *)&cmd->fs; fs = (struct ethtool_rx_flow_spec *)&cmd->fs;
...@@ -6778,7 +6807,7 @@ static int hclge_get_all_rules(struct hnae3_handle *handle, ...@@ -6778,7 +6807,7 @@ static int hclge_get_all_rules(struct hnae3_handle *handle,
struct hlist_node *node2; struct hlist_node *node2;
int cnt = 0; int cnt = 0;
if (!hnae3_dev_fd_supported(hdev)) if (!hnae3_ae_dev_fd_supported(hdev->ae_dev))
return -EOPNOTSUPP; return -EOPNOTSUPP;
cmd->data = hdev->fd_cfg.rule_num[HCLGE_FD_STAGE_1]; cmd->data = hdev->fd_cfg.rule_num[HCLGE_FD_STAGE_1];
...@@ -6878,7 +6907,7 @@ static int hclge_add_fd_entry_by_arfs(struct hnae3_handle *handle, u16 queue_id, ...@@ -6878,7 +6907,7 @@ static int hclge_add_fd_entry_by_arfs(struct hnae3_handle *handle, u16 queue_id,
struct hclge_fd_rule *rule; struct hclge_fd_rule *rule;
u16 bit_id; u16 bit_id;
if (!hnae3_dev_fd_supported(hdev)) if (!hnae3_ae_dev_fd_supported(hdev->ae_dev))
return -EOPNOTSUPP; return -EOPNOTSUPP;
/* when there is already fd rule existed add by user, /* when there is already fd rule existed add by user,
...@@ -7167,6 +7196,12 @@ static int hclge_add_cls_flower(struct hnae3_handle *handle, ...@@ -7167,6 +7196,12 @@ static int hclge_add_cls_flower(struct hnae3_handle *handle,
struct hclge_fd_rule *rule; struct hclge_fd_rule *rule;
int ret; int ret;
if (!hnae3_ae_dev_fd_supported(hdev->ae_dev)) {
dev_err(&hdev->pdev->dev,
"cls flower is not supported\n");
return -EOPNOTSUPP;
}
ret = hclge_check_cls_flower(hdev, cls_flower, tc); ret = hclge_check_cls_flower(hdev, cls_flower, tc);
if (ret) { if (ret) {
dev_err(&hdev->pdev->dev, dev_err(&hdev->pdev->dev,
...@@ -7220,6 +7255,9 @@ static int hclge_del_cls_flower(struct hnae3_handle *handle, ...@@ -7220,6 +7255,9 @@ static int hclge_del_cls_flower(struct hnae3_handle *handle,
struct hclge_fd_rule *rule; struct hclge_fd_rule *rule;
int ret; int ret;
if (!hnae3_ae_dev_fd_supported(hdev->ae_dev))
return -EOPNOTSUPP;
spin_lock_bh(&hdev->fd_rule_lock); spin_lock_bh(&hdev->fd_rule_lock);
rule = hclge_find_cls_flower(hdev, cls_flower->cookie); rule = hclge_find_cls_flower(hdev, cls_flower->cookie);
...@@ -11443,6 +11481,10 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev) ...@@ -11443,6 +11481,10 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)
if (ret) if (ret)
goto err_mdiobus_unreg; goto err_mdiobus_unreg;
ret = hclge_update_port_info(hdev);
if (ret)
goto err_mdiobus_unreg;
INIT_KFIFO(hdev->mac_tnl_log); INIT_KFIFO(hdev->mac_tnl_log);
hclge_dcb_ops_set(hdev); hclge_dcb_ops_set(hdev);
......
...@@ -2125,7 +2125,7 @@ static int hclgevf_config_gro(struct hclgevf_dev *hdev) ...@@ -2125,7 +2125,7 @@ static int hclgevf_config_gro(struct hclgevf_dev *hdev)
struct hclge_desc desc; struct hclge_desc desc;
int ret; int ret;
if (!hnae3_dev_gro_supported(hdev)) if (!hnae3_ae_dev_gro_supported(hdev->ae_dev))
return 0; return 0;
hclgevf_cmd_setup_basic_desc(&desc, HCLGE_OPC_GRO_GENERIC_CONFIG, hclgevf_cmd_setup_basic_desc(&desc, HCLGE_OPC_GRO_GENERIC_CONFIG,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment