Lines Matching refs:mac

641 		    hdev->hw.mac.speed == HCLGE_MAC_SPEED_10M ||  in hclge_get_sset_count()
642 hdev->hw.mac.speed == HCLGE_MAC_SPEED_100M || in hclge_get_sset_count()
643 hdev->hw.mac.speed == HCLGE_MAC_SPEED_1G) { in hclge_get_sset_count()
655 if ((hdev->hw.mac.phydev && hdev->hw.mac.phydev->drv && in hclge_get_sset_count()
656 hdev->hw.mac.phydev->drv->set_loopback) || in hclge_get_sset_count()
750 hdev->hw.mac.mac_id = status->mac_id & HCLGE_MAC_ID_MASK; in hclge_parse_func_status()
908 u32 speed_ability = hdev->hw.mac.speed_ability; in hclge_check_port_speed()
922 static void hclge_update_fec_support(struct hclge_mac *mac) in hclge_update_fec_support() argument
924 linkmode_clear_bit(ETHTOOL_LINK_MODE_FEC_BASER_BIT, mac->supported); in hclge_update_fec_support()
925 linkmode_clear_bit(ETHTOOL_LINK_MODE_FEC_RS_BIT, mac->supported); in hclge_update_fec_support()
926 linkmode_clear_bit(ETHTOOL_LINK_MODE_FEC_LLRS_BIT, mac->supported); in hclge_update_fec_support()
927 linkmode_clear_bit(ETHTOOL_LINK_MODE_FEC_NONE_BIT, mac->supported); in hclge_update_fec_support()
929 if (mac->fec_ability & BIT(HNAE3_FEC_BASER)) in hclge_update_fec_support()
931 mac->supported); in hclge_update_fec_support()
932 if (mac->fec_ability & BIT(HNAE3_FEC_RS)) in hclge_update_fec_support()
934 mac->supported); in hclge_update_fec_support()
935 if (mac->fec_ability & BIT(HNAE3_FEC_LLRS)) in hclge_update_fec_support()
937 mac->supported); in hclge_update_fec_support()
938 if (mac->fec_ability & BIT(HNAE3_FEC_NONE)) in hclge_update_fec_support()
940 mac->supported); in hclge_update_fec_support()
1039 static void hclge_convert_setting_fec(struct hclge_mac *mac) in hclge_convert_setting_fec() argument
1042 if (mac->fec_ability) in hclge_convert_setting_fec()
1045 switch (mac->speed) { in hclge_convert_setting_fec()
1048 mac->fec_ability = BIT(HNAE3_FEC_BASER) | BIT(HNAE3_FEC_AUTO) | in hclge_convert_setting_fec()
1053 mac->fec_ability = BIT(HNAE3_FEC_BASER) | BIT(HNAE3_FEC_RS) | in hclge_convert_setting_fec()
1057 mac->fec_ability = BIT(HNAE3_FEC_RS) | BIT(HNAE3_FEC_AUTO) | in hclge_convert_setting_fec()
1061 mac->fec_ability = BIT(HNAE3_FEC_RS) | BIT(HNAE3_FEC_AUTO) | in hclge_convert_setting_fec()
1065 mac->fec_ability = 0; in hclge_convert_setting_fec()
1070 hclge_update_fec_support(mac); in hclge_convert_setting_fec()
1076 struct hclge_mac *mac = &hdev->hw.mac; in hclge_parse_fiber_link_mode() local
1080 mac->supported); in hclge_parse_fiber_link_mode()
1082 hclge_convert_setting_sr(speed_ability, mac->supported); in hclge_parse_fiber_link_mode()
1083 hclge_convert_setting_lr(speed_ability, mac->supported); in hclge_parse_fiber_link_mode()
1084 hclge_convert_setting_cr(speed_ability, mac->supported); in hclge_parse_fiber_link_mode()
1086 hclge_convert_setting_fec(mac); in hclge_parse_fiber_link_mode()
1089 linkmode_set_bit(ETHTOOL_LINK_MODE_Pause_BIT, mac->supported); in hclge_parse_fiber_link_mode()
1091 linkmode_set_bit(ETHTOOL_LINK_MODE_FIBRE_BIT, mac->supported); in hclge_parse_fiber_link_mode()
1092 linkmode_set_bit(ETHTOOL_LINK_MODE_FEC_NONE_BIT, mac->supported); in hclge_parse_fiber_link_mode()
1098 struct hclge_mac *mac = &hdev->hw.mac; in hclge_parse_backplane_link_mode() local
1100 hclge_convert_setting_kr(speed_ability, mac->supported); in hclge_parse_backplane_link_mode()
1102 hclge_convert_setting_fec(mac); in hclge_parse_backplane_link_mode()
1105 linkmode_set_bit(ETHTOOL_LINK_MODE_Pause_BIT, mac->supported); in hclge_parse_backplane_link_mode()
1107 linkmode_set_bit(ETHTOOL_LINK_MODE_Backplane_BIT, mac->supported); in hclge_parse_backplane_link_mode()
1108 linkmode_set_bit(ETHTOOL_LINK_MODE_FEC_NONE_BIT, mac->supported); in hclge_parse_backplane_link_mode()
1114 unsigned long *supported = hdev->hw.mac.supported; in hclge_parse_copper_link_mode()
1147 u8 media_type = hdev->hw.mac.media_type; in hclge_parse_link_mode()
1501 ether_addr_copy(hdev->hw.mac.mac_addr, cfg.mac_addr); in hclge_configure()
1502 hdev->hw.mac.media_type = cfg.media_type; in hclge_configure()
1503 hdev->hw.mac.phy_addr = cfg.phy_addr; in hclge_configure()
1523 ret = hclge_parse_speed(cfg.default_speed, &hdev->hw.mac.speed); in hclge_configure()
1529 hdev->hw.mac.req_speed = hdev->hw.mac.speed; in hclge_configure()
1530 hdev->hw.mac.req_autoneg = AUTONEG_ENABLE; in hclge_configure()
1531 hdev->hw.mac.req_duplex = DUPLEX_FULL; in hclge_configure()
1535 hdev->hw.mac.max_speed = hclge_get_max_speed(cfg.speed_ability); in hclge_configure()
2576 struct hclge_mac *mac = &hdev->hw.mac; in hclge_cfg_mac_speed_dup() local
2580 if (!mac->support_autoneg && mac->speed == speed && in hclge_cfg_mac_speed_dup()
2581 mac->duplex == duplex && (mac->lane_num == lane_num || lane_num == 0)) in hclge_cfg_mac_speed_dup()
2588 hdev->hw.mac.speed = speed; in hclge_cfg_mac_speed_dup()
2589 hdev->hw.mac.duplex = duplex; in hclge_cfg_mac_speed_dup()
2591 hdev->hw.mac.lane_num = lane_num; in hclge_cfg_mac_speed_dup()
2608 hdev->hw.mac.req_speed = speed; in hclge_cfg_mac_speed_dup_h()
2609 hdev->hw.mac.req_duplex = duplex; in hclge_cfg_mac_speed_dup_h()
2641 if (!hdev->hw.mac.support_autoneg) { in hclge_set_autoneg()
2658 struct phy_device *phydev = hdev->hw.mac.phydev; in hclge_get_autoneg()
2663 return hdev->hw.mac.autoneg; in hclge_get_autoneg()
2685 if (hdev->hw.mac.support_autoneg && hdev->hw.mac.autoneg) in hclge_halt_autoneg()
2807 u32 fec_mode = hdev->hw.mac.fec_mode; in hclge_comm_get_fec_stats()
2830 u32 fec_mode = hdev->hw.mac.fec_mode; in hclge_get_fec_stats()
2874 struct hclge_mac *mac = &hdev->hw.mac; in hclge_set_fec() local
2877 if (fec_mode && !(mac->fec_ability & fec_mode)) { in hclge_set_fec()
2886 mac->user_fec_mode = fec_mode | BIT(HNAE3_FEC_USER_DEF); in hclge_set_fec()
2895 struct hclge_mac *mac = &hdev->hw.mac; in hclge_get_fec() local
2898 *fec_ability = mac->fec_ability; in hclge_get_fec()
2900 *fec_mode = mac->fec_mode; in hclge_get_fec()
2905 struct hclge_mac *mac = &hdev->hw.mac; in hclge_mac_init() local
2911 hdev->hw.mac.duplex = HCLGE_MAC_FULL; in hclge_mac_init()
2913 if (hdev->hw.mac.support_autoneg) { in hclge_mac_init()
2914 ret = hclge_set_autoneg_en(hdev, hdev->hw.mac.autoneg); in hclge_mac_init()
2919 if (!hdev->hw.mac.autoneg) { in hclge_mac_init()
2920 ret = hclge_cfg_mac_speed_dup_hw(hdev, hdev->hw.mac.req_speed, in hclge_mac_init()
2921 hdev->hw.mac.req_duplex, in hclge_mac_init()
2922 hdev->hw.mac.lane_num); in hclge_mac_init()
2927 mac->link = 0; in hclge_mac_init()
2929 if (mac->user_fec_mode & BIT(HNAE3_FEC_USER_DEF)) { in hclge_mac_init()
2930 ret = hclge_set_fec_hw(hdev, mac->user_fec_mode); in hclge_mac_init()
3009 struct phy_device *phydev = hdev->hw.mac.phydev; in hclge_get_mac_phy_link()
3063 if (state != hdev->hw.mac.link) { in hclge_update_link_status()
3064 hdev->hw.mac.link = state; in hclge_update_link_status()
3086 static void hclge_update_speed_advertising(struct hclge_mac *mac) in hclge_update_speed_advertising() argument
3090 if (hclge_get_speed_bit(mac->speed, &speed_ability)) in hclge_update_speed_advertising()
3093 switch (mac->module_type) { in hclge_update_speed_advertising()
3095 hclge_convert_setting_lr(speed_ability, mac->advertising); in hclge_update_speed_advertising()
3099 hclge_convert_setting_sr(speed_ability, mac->advertising); in hclge_update_speed_advertising()
3102 hclge_convert_setting_cr(speed_ability, mac->advertising); in hclge_update_speed_advertising()
3105 hclge_convert_setting_kr(speed_ability, mac->advertising); in hclge_update_speed_advertising()
3112 static void hclge_update_fec_advertising(struct hclge_mac *mac) in hclge_update_fec_advertising() argument
3114 if (mac->fec_mode & BIT(HNAE3_FEC_RS)) in hclge_update_fec_advertising()
3116 mac->advertising); in hclge_update_fec_advertising()
3117 else if (mac->fec_mode & BIT(HNAE3_FEC_LLRS)) in hclge_update_fec_advertising()
3119 mac->advertising); in hclge_update_fec_advertising()
3120 else if (mac->fec_mode & BIT(HNAE3_FEC_BASER)) in hclge_update_fec_advertising()
3122 mac->advertising); in hclge_update_fec_advertising()
3125 mac->advertising); in hclge_update_fec_advertising()
3130 struct hclge_mac *mac = &hdev->hw.mac; in hclge_update_pause_advertising() local
3152 linkmode_set_pause(mac->advertising, tx_en, rx_en); in hclge_update_pause_advertising()
3157 struct hclge_mac *mac = &hdev->hw.mac; in hclge_update_advertising() local
3159 linkmode_zero(mac->advertising); in hclge_update_advertising()
3160 hclge_update_speed_advertising(mac); in hclge_update_advertising()
3161 hclge_update_fec_advertising(mac); in hclge_update_advertising()
3166 struct hclge_mac *mac) in hclge_update_port_capability() argument
3169 hclge_convert_setting_fec(mac); in hclge_update_port_capability()
3174 if (mac->media_type == HNAE3_MEDIA_TYPE_BACKPLANE && in hclge_update_port_capability()
3175 mac->module_type == HNAE3_MODULE_TYPE_UNKNOWN) in hclge_update_port_capability()
3176 mac->module_type = HNAE3_MODULE_TYPE_KR; in hclge_update_port_capability()
3177 else if (mac->media_type == HNAE3_MEDIA_TYPE_COPPER) in hclge_update_port_capability()
3178 mac->module_type = HNAE3_MODULE_TYPE_TP; in hclge_update_port_capability()
3180 if (mac->support_autoneg) { in hclge_update_port_capability()
3181 linkmode_set_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, mac->supported); in hclge_update_port_capability()
3182 linkmode_copy(mac->advertising, mac->supported); in hclge_update_port_capability()
3185 mac->supported); in hclge_update_port_capability()
3213 static int hclge_get_sfp_info(struct hclge_dev *hdev, struct hclge_mac *mac) in hclge_get_sfp_info() argument
3240 mac->speed = le32_to_cpu(resp->speed); in hclge_get_sfp_info()
3245 mac->module_type = le32_to_cpu(resp->module_type); in hclge_get_sfp_info()
3246 mac->speed_ability = le32_to_cpu(resp->speed_ability); in hclge_get_sfp_info()
3247 mac->autoneg = resp->autoneg; in hclge_get_sfp_info()
3248 mac->support_autoneg = resp->autoneg_ability; in hclge_get_sfp_info()
3249 mac->speed_type = QUERY_ACTIVE_SPEED; in hclge_get_sfp_info()
3250 mac->lane_num = resp->lane_num; in hclge_get_sfp_info()
3252 mac->fec_mode = 0; in hclge_get_sfp_info()
3254 mac->fec_mode = BIT(resp->active_fec); in hclge_get_sfp_info()
3255 mac->fec_ability = resp->fec_ability; in hclge_get_sfp_info()
3257 mac->speed_type = QUERY_SFP_SPEED; in hclge_get_sfp_info()
3356 hdev->hw.mac.req_autoneg = cmd->base.autoneg; in hclge_set_phy_link_ksettings()
3357 hdev->hw.mac.req_speed = cmd->base.speed; in hclge_set_phy_link_ksettings()
3358 hdev->hw.mac.req_duplex = cmd->base.duplex; in hclge_set_phy_link_ksettings()
3359 linkmode_copy(hdev->hw.mac.advertising, cmd->link_modes.advertising); in hclge_set_phy_link_ksettings()
3376 hdev->hw.mac.autoneg = cmd.base.autoneg; in hclge_update_tp_port_info()
3377 hdev->hw.mac.speed = cmd.base.speed; in hclge_update_tp_port_info()
3378 hdev->hw.mac.duplex = cmd.base.duplex; in hclge_update_tp_port_info()
3379 linkmode_copy(hdev->hw.mac.advertising, cmd.link_modes.advertising); in hclge_update_tp_port_info()
3391 cmd.base.autoneg = hdev->hw.mac.req_autoneg; in hclge_tp_port_init()
3392 cmd.base.speed = hdev->hw.mac.req_speed; in hclge_tp_port_init()
3393 cmd.base.duplex = hdev->hw.mac.req_duplex; in hclge_tp_port_init()
3394 linkmode_copy(cmd.link_modes.advertising, hdev->hw.mac.advertising); in hclge_tp_port_init()
3401 struct hclge_mac *mac = &hdev->hw.mac; in hclge_update_port_info() local
3406 if (mac->media_type == HNAE3_MEDIA_TYPE_COPPER) in hclge_update_port_info()
3414 speed = mac->speed; in hclge_update_port_info()
3415 ret = hclge_get_sfp_info(hdev, mac); in hclge_update_port_info()
3429 if (mac->speed_type == QUERY_ACTIVE_SPEED) { in hclge_update_port_info()
3430 hclge_update_port_capability(hdev, mac); in hclge_update_port_info()
3431 if (mac->speed != speed) in hclge_update_port_info()
3435 return hclge_cfg_mac_speed_dup(hdev, mac->speed, in hclge_update_port_info()
3436 HCLGE_MAC_FULL, mac->lane_num); in hclge_update_port_info()
3453 return hdev->hw.mac.link; in hclge_get_status()
3495 ether_addr_copy(ivf->mac, vport->vf_info.mac); in hclge_get_vf_config()
7584 struct phy_device *phydev = hdev->hw.mac.phydev; in hclge_phy_link_status_wait()
7812 struct phy_device *phydev = hdev->hw.mac.phydev; in hclge_set_phy_loopback()
7978 hdev->hw.mac.link = 0; in hclge_ae_start()
9157 if (ether_addr_equal(mac_addr, vport->vf_info.mac)) { in hclge_set_vf_mac()
9164 ether_addr_copy(vport->vf_info.mac, mac_addr); in hclge_set_vf_mac()
9232 ether_addr_copy(p, hdev->hw.mac.mac_addr); in hclge_get_mac_addr()
9309 old_addr = hdev->hw.mac.mac_addr; in hclge_set_mac_addr()
9328 ether_addr_copy(hdev->hw.mac.mac_addr, new_addr); in hclge_set_mac_addr()
9345 data->phy_id = hdev->hw.mac.phy_addr; in hclge_mii_ioctl()
9371 if (!hdev->hw.mac.phydev) in hclge_do_ioctl()
9375 return phy_mii_ioctl(hdev->hw.mac.phydev, ifr, cmd); in hclge_do_ioctl()
10858 struct phy_device *phydev = hdev->hw.mac.phydev; in hclge_set_flowctrl_adv()
10883 struct phy_device *phydev = hdev->hw.mac.phydev; in hclge_cfg_flowctrl()
10921 u8 media_type = hdev->hw.mac.media_type; in hclge_get_pauseparam()
10967 struct phy_device *phydev = hdev->hw.mac.phydev; in hclge_set_pauseparam()
11005 *speed = hdev->hw.mac.speed; in hclge_get_ksettings_an_result()
11007 *duplex = hdev->hw.mac.duplex; in hclge_get_ksettings_an_result()
11009 *auto_neg = hdev->hw.mac.autoneg; in hclge_get_ksettings_an_result()
11011 *lane_num = hdev->hw.mac.lane_num; in hclge_get_ksettings_an_result()
11027 *media_type = hdev->hw.mac.media_type; in hclge_get_media_type()
11030 *module_type = hdev->hw.mac.module_type; in hclge_get_media_type()
11038 struct phy_device *phydev = hdev->hw.mac.phydev; in hclge_get_mdix_mode()
11504 return &vport->back->hw.mac.wol; in hclge_get_wol_info()
11553 struct hclge_wol_info *wol_info = &hdev->hw.mac.wol; in hclge_update_wol()
11563 struct hclge_wol_info *wol_info = &hdev->hw.mac.wol; in hclge_init_wol()
11701 if (hdev->hw.mac.media_type == HNAE3_MEDIA_TYPE_COPPER) { in hclge_init_ae_dev()
11832 if (hdev->hw.mac.phydev) in hclge_init_ae_dev()
11833 mdiobus_unregister(hdev->hw.mac.mdio_bus); in hclge_init_ae_dev()
11988 max_tx_rate < 0 || max_tx_rate > hdev->hw.mac.max_speed) { in hclge_vf_rate_param_check()
11991 min_tx_rate, max_tx_rate, hdev->hw.mac.max_speed); in hclge_vf_rate_param_check()
12211 struct hclge_mac *mac = &hdev->hw.mac; in hclge_uninit_ae_dev() local
12221 if (mac->phydev) in hclge_uninit_ae_dev()
12222 mdiobus_unregister(mac->mdio_bus); in hclge_uninit_ae_dev()
12404 supported[idx] = hdev->hw.mac.supported[idx]; in hclge_get_link_mode()
12405 advertising[idx] = hdev->hw.mac.advertising[idx]; in hclge_get_link_mode()
12573 if (hdev->hw.mac.media_type != HNAE3_MEDIA_TYPE_FIBER) in hclge_get_module_eeprom()