return 0;
}
+static uint32_t
+hns3_get_copper_port_speed_capa(uint32_t supported_speed)
+{
+ uint32_t speed_capa = 0;
+
+ if (supported_speed & HNS3_PHY_LINK_SPEED_10M_HD_BIT)
+ speed_capa |= ETH_LINK_SPEED_10M_HD;
+ if (supported_speed & HNS3_PHY_LINK_SPEED_10M_BIT)
+ speed_capa |= ETH_LINK_SPEED_10M;
+ if (supported_speed & HNS3_PHY_LINK_SPEED_100M_HD_BIT)
+ speed_capa |= ETH_LINK_SPEED_100M_HD;
+ if (supported_speed & HNS3_PHY_LINK_SPEED_100M_BIT)
+ speed_capa |= ETH_LINK_SPEED_100M;
+ if (supported_speed & HNS3_PHY_LINK_SPEED_1000M_BIT)
+ speed_capa |= ETH_LINK_SPEED_1G;
+
+ return speed_capa;
+}
+
+static uint32_t
+hns3_get_firber_port_speed_capa(uint32_t supported_speed)
+{
+ uint32_t speed_capa = 0;
+
+ if (supported_speed & HNS3_FIBER_LINK_SPEED_1G_BIT)
+ speed_capa |= ETH_LINK_SPEED_1G;
+ if (supported_speed & HNS3_FIBER_LINK_SPEED_10G_BIT)
+ speed_capa |= ETH_LINK_SPEED_10G;
+ if (supported_speed & HNS3_FIBER_LINK_SPEED_25G_BIT)
+ speed_capa |= ETH_LINK_SPEED_25G;
+ if (supported_speed & HNS3_FIBER_LINK_SPEED_40G_BIT)
+ speed_capa |= ETH_LINK_SPEED_40G;
+ if (supported_speed & HNS3_FIBER_LINK_SPEED_50G_BIT)
+ speed_capa |= ETH_LINK_SPEED_50G;
+ if (supported_speed & HNS3_FIBER_LINK_SPEED_100G_BIT)
+ speed_capa |= ETH_LINK_SPEED_100G;
+ if (supported_speed & HNS3_FIBER_LINK_SPEED_200G_BIT)
+ speed_capa |= ETH_LINK_SPEED_200G;
+
+ return speed_capa;
+}
+
+static uint32_t
+hns3_get_speed_capa(struct hns3_hw *hw)
+{
+ struct hns3_mac *mac = &hw->mac;
+ uint32_t speed_capa;
+
+ if (mac->media_type == HNS3_MEDIA_TYPE_COPPER)
+ speed_capa =
+ hns3_get_copper_port_speed_capa(mac->supported_speed);
+ else
+ speed_capa =
+ hns3_get_firber_port_speed_capa(mac->supported_speed);
+
+ if (mac->support_autoneg == 0)
+ speed_capa |= ETH_LINK_SPEED_FIXED;
+
+ return speed_capa;
+}
+
int
hns3_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info)
{
.nb_mtu_seg_max = hw->max_non_tso_bd_num,
};
+ info->speed_capa = hns3_get_speed_capa(hw);
info->default_rxconf = (struct rte_eth_rxconf) {
.rx_free_thresh = HNS3_DEFAULT_RX_FREE_THRESH,
/*
new_link->link_duplex = mac->link_duplex;
new_link->link_status = mac->link_status ? ETH_LINK_UP : ETH_LINK_DOWN;
- new_link->link_autoneg =
- !(eth_dev->data->dev_conf.link_speeds & ETH_LINK_SPEED_FIXED);
+ new_link->link_autoneg = mac->link_autoneg;
}
static int
return ret;
}
-static int
-hns3_firmware_compat_config(struct hns3_hw *hw, bool is_init)
-{
- struct hns3_firmware_compat_cmd *req;
- struct hns3_cmd_desc desc;
- uint32_t compat = 0;
-
- hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_FIRMWARE_COMPAT_CFG, false);
- req = (struct hns3_firmware_compat_cmd *)desc.data;
-
- if (is_init) {
- hns3_set_bit(compat, HNS3_LINK_EVENT_REPORT_EN_B, 1);
- hns3_set_bit(compat, HNS3_NCSI_ERROR_REPORT_EN_B, 0);
- if (hw->mac.media_type == HNS3_MEDIA_TYPE_COPPER)
- hns3_set_bit(compat, HNS3_FIRMWARE_PHY_DRIVER_EN_B, 1);
- }
-
- req->compat = rte_cpu_to_le_32(compat);
-
- return hns3_cmd_send(hw, &desc, 1);
-}
-
static int
hns3_mac_init(struct hns3_hw *hw)
{
}
static int
-hns3_get_sfp_speed(struct hns3_hw *hw, uint32_t *speed)
+hns3_get_sfp_info(struct hns3_hw *hw, struct hns3_mac *mac_info)
{
- struct hns3_sfp_speed_cmd *resp;
+ struct hns3_sfp_info_cmd *resp;
struct hns3_cmd_desc desc;
int ret;
- hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_SFP_GET_SPEED, true);
- resp = (struct hns3_sfp_speed_cmd *)desc.data;
+ hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_GET_SFP_INFO, true);
+ resp = (struct hns3_sfp_info_cmd *)desc.data;
+ resp->query_type = HNS3_ACTIVE_QUERY;
+
ret = hns3_cmd_send(hw, &desc, 1);
if (ret == -EOPNOTSUPP) {
- hns3_err(hw, "IMP do not support get SFP speed %d", ret);
+ hns3_warn(hw, "firmware does not support get SFP info,"
+ " ret = %d.", ret);
return ret;
} else if (ret) {
- hns3_err(hw, "get sfp speed failed %d", ret);
+ hns3_err(hw, "get sfp info failed, ret = %d.", ret);
return ret;
}
- *speed = resp->sfp_speed;
+ /*
+ * In some case, the speed of MAC obtained from firmware may be 0, it
+ * shouldn't be set to mac->speed.
+ */
+ if (!rte_le_to_cpu_32(resp->sfp_speed))
+ return 0;
+
+ mac_info->link_speed = rte_le_to_cpu_32(resp->sfp_speed);
+ /*
+ * if resp->supported_speed is 0, it means it's an old version
+ * firmware, do not update these params.
+ */
+ if (resp->supported_speed) {
+ mac_info->query_type = HNS3_ACTIVE_QUERY;
+ mac_info->supported_speed =
+ rte_le_to_cpu_32(resp->supported_speed);
+ mac_info->support_autoneg = resp->autoneg_ability;
+ mac_info->link_autoneg = (resp->autoneg == 0) ? ETH_LINK_FIXED
+ : ETH_LINK_AUTONEG;
+ } else {
+ mac_info->query_type = HNS3_DEFAULT_QUERY;
+ }
return 0;
}
hns3_update_fiber_link_info(struct hns3_hw *hw)
{
struct hns3_pf *pf = HNS3_DEV_HW_TO_PF(hw);
- uint32_t speed;
+ struct hns3_mac *mac = &hw->mac;
+ struct hns3_mac mac_info;
int ret;
- /* If IMP do not support get SFP/qSFP speed, return directly */
+ /* If firmware do not support get SFP/qSFP speed, return directly */
if (!pf->support_sfp_query)
return 0;
- ret = hns3_get_sfp_speed(hw, &speed);
+ memset(&mac_info, 0, sizeof(struct hns3_mac));
+ ret = hns3_get_sfp_info(hw, &mac_info);
if (ret == -EOPNOTSUPP) {
pf->support_sfp_query = false;
return ret;
} else if (ret)
return ret;
- if (speed == ETH_SPEED_NUM_NONE)
- return 0; /* do nothing if no SFP */
+ /* Do nothing if no SFP */
+ if (mac_info.link_speed == ETH_SPEED_NUM_NONE)
+ return 0;
+
+ /*
+ * If query_type is HNS3_ACTIVE_QUERY, it is no need
+ * to reconfigure the speed of MAC. Otherwise, it indicates
+ * that the current firmware only supports to obtain the
+ * speed of the SFP, and the speed of MAC needs to reconfigure.
+ */
+ mac->query_type = mac_info.query_type;
+ if (mac->query_type == HNS3_ACTIVE_QUERY) {
+ if (mac_info.link_speed != mac->link_speed) {
+ ret = hns3_port_shaper_update(hw, mac_info.link_speed);
+ if (ret)
+ return ret;
+ }
+
+ mac->link_speed = mac_info.link_speed;
+ mac->supported_speed = mac_info.supported_speed;
+ mac->support_autoneg = mac_info.support_autoneg;
+ mac->link_autoneg = mac_info.link_autoneg;
+
+ return 0;
+ }
/* Config full duplex for SFP */
- return hns3_cfg_mac_speed_dup(hw, speed, ETH_LINK_FULL_DUPLEX);
+ return hns3_cfg_mac_speed_dup(hw, mac_info.link_speed,
+ ETH_LINK_FULL_DUPLEX);
}
static void
hns3_parse_copper_phy_params(struct hns3_cmd_desc *desc, struct hns3_mac *mac)
{
+#define HNS3_PHY_SUPPORTED_SPEED_MASK 0x2f
+
struct hns3_phy_params_bd0_cmd *req;
+ uint32_t supported;
req = (struct hns3_phy_params_bd0_cmd *)desc[0].data;
mac->link_speed = rte_le_to_cpu_32(req->speed);
HNS3_PHY_DUPLEX_CFG_B);
mac->link_autoneg = hns3_get_bit(req->autoneg,
HNS3_PHY_AUTONEG_CFG_B);
- mac->supported_capa = rte_le_to_cpu_32(req->supported);
mac->advertising = rte_le_to_cpu_32(req->advertising);
mac->lp_advertising = rte_le_to_cpu_32(req->lp_advertising);
- mac->support_autoneg = !!(mac->supported_capa &
- HNS3_PHY_LINK_MODE_AUTONEG_BIT);
+ supported = rte_le_to_cpu_32(req->supported);
+ mac->supported_speed = supported & HNS3_PHY_SUPPORTED_SPEED_MASK;
+ mac->support_autoneg = !!(supported & HNS3_PHY_LINK_MODE_AUTONEG_BIT);
}
static int
mac->link_speed = mac_info.link_speed;
mac->link_duplex = mac_info.link_duplex;
mac->link_autoneg = mac_info.link_autoneg;
- mac->supported_capa = mac_info.supported_capa;
+ mac->supported_speed = mac_info.supported_speed;
mac->advertising = mac_info.advertising;
mac->lp_advertising = mac_info.lp_advertising;
mac->support_autoneg = mac_info.support_autoneg;
rte_eal_alarm_set(HNS3_SERVICE_INTERVAL, hns3_service_handler, eth_dev);
}
-static void
-hns3_update_dev_lsc_cap(struct hns3_hw *hw,
- int fw_compact_cmd_result)
-{
- struct rte_eth_dev *dev = &rte_eth_devices[hw->data->port_id];
-
- if (hw->adapter_state != HNS3_NIC_UNINITIALIZED)
- return;
-
- if (fw_compact_cmd_result != 0) {
- /*
- * If fw_compact_cmd_result is not zero, it means firmware don't
- * support link status change interrupt.
- * Framework already set RTE_ETH_DEV_INTR_LSC bit because driver
- * declared RTE_PCI_DRV_INTR_LSC in drv_flags. It need to clear
- * the RTE_ETH_DEV_INTR_LSC capability when detect firmware
- * don't support link status change interrupt.
- */
- dev->data->dev_flags &= ~RTE_ETH_DEV_INTR_LSC;
- }
-}
-
static int
hns3_init_hardware(struct hns3_adapter *hns)
{
goto err_mac_init;
}
- /*
- * Requiring firmware to enable some features, driver can
- * still work without it.
- */
- ret = hns3_firmware_compat_config(hw, true);
- if (ret)
- PMD_INIT_LOG(WARNING, "firmware compatible features not "
- "supported, ret = %d.", ret);
- hns3_update_dev_lsc_cap(hw, ret);
-
return 0;
err_mac_init:
hns3_write_dev(hw, HNS3_VECTOR0_OTER_EN_REG, val);
}
+static uint32_t
+hns3_set_firber_default_support_speed(struct hns3_hw *hw)
+{
+ struct hns3_mac *mac = &hw->mac;
+
+ switch (mac->link_speed) {
+ case ETH_SPEED_NUM_1G:
+ return HNS3_FIBER_LINK_SPEED_1G_BIT;
+ case ETH_SPEED_NUM_10G:
+ return HNS3_FIBER_LINK_SPEED_10G_BIT;
+ case ETH_SPEED_NUM_25G:
+ return HNS3_FIBER_LINK_SPEED_25G_BIT;
+ case ETH_SPEED_NUM_40G:
+ return HNS3_FIBER_LINK_SPEED_40G_BIT;
+ case ETH_SPEED_NUM_50G:
+ return HNS3_FIBER_LINK_SPEED_50G_BIT;
+ case ETH_SPEED_NUM_100G:
+ return HNS3_FIBER_LINK_SPEED_100G_BIT;
+ case ETH_SPEED_NUM_200G:
+ return HNS3_FIBER_LINK_SPEED_200G_BIT;
+ default:
+ hns3_warn(hw, "invalid speed %u Mbps.", mac->link_speed);
+ return 0;
+ }
+}
+
+/*
+ * Validity of supported_speed for firber and copper media type can be
+ * guaranteed by the following policy:
+ * Copper:
+ * Although the initialization of the phy in the firmware may not be
+ * completed, the firmware can guarantees that the supported_speed is
+ * an valid value.
+ * Firber:
+ * If the version of firmware supports the acitive query way of the
+ * HNS3_OPC_GET_SFP_INFO opcode, the supported_speed can be obtained
+ * through it. If unsupported, use the SFP's speed as the value of the
+ * supported_speed.
+ */
+static int
+hns3_get_port_supported_speed(struct rte_eth_dev *eth_dev)
+{
+ struct hns3_adapter *hns = eth_dev->data->dev_private;
+ struct hns3_hw *hw = &hns->hw;
+ struct hns3_mac *mac = &hw->mac;
+ int ret;
+
+ ret = hns3_update_link_info(eth_dev);
+ if (ret)
+ return ret;
+
+ if (mac->media_type == HNS3_MEDIA_TYPE_FIBER) {
+ /*
+ * Some firmware does not support the report of supported_speed,
+ * and only report the effective speed of SFP. In this case, it
+ * is necessary to use the SFP's speed as the supported_speed.
+ */
+ if (mac->supported_speed == 0)
+ mac->supported_speed =
+ hns3_set_firber_default_support_speed(hw);
+ }
+
+ return 0;
+}
+
static int
hns3_init_pf(struct rte_eth_dev *eth_dev)
{
goto err_enable_intr;
}
+ ret = hns3_get_port_supported_speed(eth_dev);
+ if (ret) {
+ PMD_INIT_LOG(ERR, "failed to get speed capabilities supported "
+ "by device, ret = %d.", ret);
+ goto err_supported_speed;
+ }
+
hns3_tm_conf_init(eth_dev);
return 0;
+err_supported_speed:
+ (void)hns3_enable_hw_error_intr(hns, false);
err_enable_intr:
hns3_fdir_filter_uninit(hns);
err_fdir:
- (void)hns3_firmware_compat_config(hw, false);
hns3_uninit_umv_space(hw);
err_init_hw:
hns3_tqp_stats_uninit(hw);
(void)hns3_config_gro(hw, false);
hns3_promisc_uninit(hw);
hns3_fdir_filter_uninit(hns);
- (void)hns3_firmware_compat_config(hw, false);
hns3_uninit_umv_space(hw);
hns3_tqp_stats_uninit(hw);
hns3_config_mac_tnl_int(hw, false);
hw->io_base = NULL;
}
+static int
+hns3_set_copper_port_link_speed(struct hns3_hw *hw,
+ struct hns3_set_link_speed_cfg *cfg)
+{
+ struct hns3_cmd_desc desc[HNS3_PHY_PARAM_CFG_BD_NUM];
+ struct hns3_phy_params_bd0_cmd *req;
+ uint16_t i;
+
+ for (i = 0; i < HNS3_PHY_PARAM_CFG_BD_NUM - 1; i++) {
+ hns3_cmd_setup_basic_desc(&desc[i], HNS3_OPC_PHY_PARAM_CFG,
+ false);
+ desc[i].flag |= rte_cpu_to_le_16(HNS3_CMD_FLAG_NEXT);
+ }
+ hns3_cmd_setup_basic_desc(&desc[i], HNS3_OPC_PHY_PARAM_CFG, false);
+ req = (struct hns3_phy_params_bd0_cmd *)desc[0].data;
+ req->autoneg = cfg->autoneg;
+
+ /*
+ * The full speed capability is used to negotiate when
+ * auto-negotiation is enabled.
+ */
+ if (cfg->autoneg) {
+ req->advertising = HNS3_PHY_LINK_SPEED_10M_BIT |
+ HNS3_PHY_LINK_SPEED_10M_HD_BIT |
+ HNS3_PHY_LINK_SPEED_100M_BIT |
+ HNS3_PHY_LINK_SPEED_100M_HD_BIT |
+ HNS3_PHY_LINK_SPEED_1000M_BIT;
+ }
+
+ return hns3_cmd_send(hw, desc, HNS3_PHY_PARAM_CFG_BD_NUM);
+}
+
+static int
+hns3_set_autoneg(struct hns3_hw *hw, bool enable)
+{
+ struct hns3_config_auto_neg_cmd *req;
+ struct hns3_cmd_desc desc;
+ uint32_t flag = 0;
+ int ret;
+
+ hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_CONFIG_AN_MODE, false);
+
+ req = (struct hns3_config_auto_neg_cmd *)desc.data;
+ if (enable)
+ hns3_set_bit(flag, HNS3_MAC_CFG_AN_EN_B, 1);
+ req->cfg_an_cmd_flag = rte_cpu_to_le_32(flag);
+
+ ret = hns3_cmd_send(hw, &desc, 1);
+ if (ret)
+ hns3_err(hw, "autoneg set cmd failed, ret = %d.", ret);
+
+ return ret;
+}
+
+static int
+hns3_set_fiber_port_link_speed(struct hns3_hw *hw,
+ struct hns3_set_link_speed_cfg *cfg)
+{
+ int ret;
+
+ if (hw->mac.support_autoneg) {
+ ret = hns3_set_autoneg(hw, cfg->autoneg);
+ if (ret) {
+ hns3_err(hw, "failed to configure auto-negotiation.");
+ return ret;
+ }
+
+ /*
+ * To enable auto-negotiation, we only need to open the switch
+ * of auto-negotiation, then firmware sets all speed
+ * capabilities.
+ */
+ if (cfg->autoneg)
+ return 0;
+ }
+
+ /*
+ * Some hardware doesn't support auto-negotiation, but users may not
+ * configure link_speeds (default 0), which means auto-negotiation
+ * In this case, a warning message need to be printed, instead of
+ * an error.
+ */
+ if (cfg->autoneg) {
+ hns3_warn(hw, "auto-negotiation is not supported.");
+ return 0;
+ }
+
+ return 0;
+}
+
+static int
+hns3_set_port_link_speed(struct hns3_hw *hw,
+ struct hns3_set_link_speed_cfg *cfg)
+{
+ int ret;
+
+ if (hw->mac.media_type == HNS3_MEDIA_TYPE_COPPER) {
+#if defined(RTE_HNS3_ONLY_1630_FPGA)
+ struct hns3_pf *pf = HNS3_DEV_HW_TO_PF(hw);
+ if (pf->is_tmp_phy)
+ return 0;
+#endif
+
+ ret = hns3_set_copper_port_link_speed(hw, cfg);
+ if (ret) {
+ hns3_err(hw, "failed to set copper port link speed,"
+ "ret = %d.", ret);
+ return ret;
+ }
+ } else if (hw->mac.media_type == HNS3_MEDIA_TYPE_FIBER) {
+ ret = hns3_set_fiber_port_link_speed(hw, cfg);
+ if (ret) {
+ hns3_err(hw, "failed to set fiber port link speed,"
+ "ret = %d.", ret);
+ return ret;
+ }
+ }
+
+ return 0;
+}
+
+static int
+hns3_apply_link_speed(struct hns3_hw *hw)
+{
+ struct rte_eth_conf *conf = &hw->data->dev_conf;
+ struct hns3_set_link_speed_cfg cfg;
+
+ memset(&cfg, 0, sizeof(struct hns3_set_link_speed_cfg));
+ cfg.autoneg = (conf->link_speeds == ETH_LINK_SPEED_AUTONEG) ?
+ ETH_LINK_AUTONEG : ETH_LINK_FIXED;
+ if (cfg.autoneg != ETH_LINK_AUTONEG) {
+ hns3_err(hw, "device doesn't support to force link speed.");
+ return -EOPNOTSUPP;
+ }
+
+ return hns3_set_port_link_speed(hw, &cfg);
+}
+
static int
hns3_do_start(struct hns3_adapter *hns, bool reset_queue)
{
PMD_INIT_LOG(ERR, "failed to enable MAC, ret = %d", ret);
goto err_config_mac_mode;
}
+
+ ret = hns3_apply_link_speed(hw);
+ if (ret)
+ goto err_config_mac_mode;
+
return 0;
err_config_mac_mode:
+ (void)hns3_cfg_mac_mode(hw, false);
hns3_dev_release_mbufs(hns);
/*
* Here is exception handling, hns3_reset_all_tqps will have the
fc_conf->pause_time = pf->pause_time;
- /* return fc current mode */
- switch (hw->current_mode) {
+ /*
+ * If fc auto-negotiation is not supported, the configured fc mode
+ * from user is the current fc mode.
+ */
+ switch (hw->requested_fc_mode) {
case HNS3_FC_FULL:
fc_conf->mode = RTE_FC_FULL;
break;
{
switch (mode) {
case RTE_FC_NONE:
- hw->requested_mode = HNS3_FC_NONE;
+ hw->requested_fc_mode = HNS3_FC_NONE;
break;
case RTE_FC_RX_PAUSE:
- hw->requested_mode = HNS3_FC_RX_PAUSE;
+ hw->requested_fc_mode = HNS3_FC_RX_PAUSE;
break;
case RTE_FC_TX_PAUSE:
- hw->requested_mode = HNS3_FC_TX_PAUSE;
+ hw->requested_fc_mode = HNS3_FC_TX_PAUSE;
break;
case RTE_FC_FULL:
- hw->requested_mode = HNS3_FC_FULL;
+ hw->requested_fc_mode = HNS3_FC_FULL;
break;
default:
- hw->requested_mode = HNS3_FC_NONE;
+ hw->requested_fc_mode = HNS3_FC_NONE;
hns3_warn(hw, "fc_mode(%u) exceeds member scope and is "
"configured to RTE_FC_NONE", mode);
break;
hns3_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
{
struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private);
int ret;
if (fc_conf->high_water || fc_conf->low_water ||
}
hns3_get_fc_mode(hw, fc_conf->mode);
- if (hw->requested_mode == hw->current_mode &&
- pf->pause_time == fc_conf->pause_time)
- return 0;
rte_spinlock_lock(&hw->lock);
ret = hns3_fc_enable(dev, fc_conf);
struct rte_eth_pfc_conf *pfc_conf)
{
struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private);
- uint8_t priority;
int ret;
if (!hns3_dev_dcb_supported(hw)) {
return -EOPNOTSUPP;
}
- priority = pfc_conf->priority;
hns3_get_fc_mode(hw, pfc_conf->fc.mode);
- if (hw->dcb_info.pfc_en & BIT(priority) &&
- hw->requested_mode == hw->current_mode &&
- pfc_conf->fc.pause_time == pf->pause_time)
- return 0;
rte_spinlock_lock(&hw->lock);
ret = hns3_dcb_pfc_enable(dev, pfc_conf);
static int
hns3_fec_get_internal(struct hns3_hw *hw, uint32_t *fec_capa)
{
-#define QUERY_ACTIVE_SPEED 1
- struct hns3_sfp_speed_cmd *resp;
+ struct hns3_sfp_info_cmd *resp;
uint32_t tmp_fec_capa;
uint8_t auto_state;
struct hns3_cmd_desc desc;
}
}
- hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_SFP_GET_SPEED, true);
- resp = (struct hns3_sfp_speed_cmd *)desc.data;
- resp->query_type = QUERY_ACTIVE_SPEED;
+ hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_GET_SFP_INFO, true);
+ resp = (struct hns3_sfp_info_cmd *)desc.data;
+ resp->query_type = HNS3_ACTIVE_QUERY;
ret = hns3_cmd_send(hw, &desc, 1);
if (ret == -EOPNOTSUPP) {