src/dpdk/drivers/net/ice/base/ice_common.c
enum ice_status ice_update_link_info(struct ice_port_info *pi)
{
	struct ice_link_status *li;
	enum ice_status status;

	if (!pi)
		return ICE_ERR_PARAM;

	li = &pi->phy.link_info;

	status = ice_aq_get_link_info(pi, true, NULL, NULL);
	if (status)
		return status;

	if (li->link_info & ICE_AQ_MEDIA_AVAILABLE) {
		struct ice_aqc_get_phy_caps_data *pcaps;
		struct ice_hw *hw;

		hw = pi->hw;
		pcaps = (struct ice_aqc_get_phy_caps_data *)
			ice_malloc(hw, sizeof(*pcaps));
		if (!pcaps)
			return ICE_ERR_NO_MEMORY;

		status = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_TOPO_CAP_MEDIA,
					     pcaps, NULL);

		if (status == ICE_SUCCESS)
			ice_memcpy(li->module_type, &pcaps->module_type,
				   sizeof(li->module_type),
				   ICE_NONDMA_TO_NONDMA);

		ice_free(hw, pcaps);
	}

	return status;
}
/**
 * ice_update_link_info - update status of the HW network link
 * @pi: port info structure of the interested logical port
 */
update status of the HW network link
@pi: port info structure of the interested logical port
update status of the HW network link @pi : port info structure of the interested logical port
enum ice_status ice_update_link_info(struct ice_port_info *pi)
{
	struct ice_link_status *li;
	enum ice_status status;
	if (!pi)
		return ICE_ERR_PARAM;
	li = &pi->phy.link_info;
	status = ice_aq_get_link_info(pi, true, NULL, NULL);
	if (status)
		return status;
	if (li->link_info & ICE_AQ_MEDIA_AVAILABLE) {
		struct ice_aqc_get_phy_caps_data *pcaps;
		struct ice_hw *hw;
		hw = pi->hw;
		pcaps = (struct ice_aqc_get_phy_caps_data *)
			ice_malloc(hw, sizeof(*pcaps));
		if (!pcaps)
			return ICE_ERR_NO_MEMORY;
		status = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_TOPO_CAP_MEDIA,
					     pcaps, NULL);
		if (status == ICE_SUCCESS)
			ice_memcpy(li->module_type, &pcaps->module_type,
				   sizeof(li->module_type),
				   ICE_NONDMA_TO_NONDMA);
		ice_free(hw, pcaps);
	}
	return status;
}
enum ice_status ice_update_link_info ( struct ice_port_info * pi ) { struct ice_link_status * li ; enum ice_status status ; if ( ! pi ) return ICE_ERR_PARAM ; li = & pi -> phy . link_info ; status = ice_aq_get_link_info ( pi , true , NULL , NULL ) ; if ( status ) return status ; if ( li -> link_info & ICE_AQ_MEDIA_AVAILABLE ) { struct ice_aqc_get_phy_caps_data * pcaps ; struct ice_hw * hw ; hw = pi -> hw ; pcaps = ( struct ice_aqc_get_phy_caps_data * ) ice_malloc ( hw , sizeof ( * pcaps ) ) ; if ( ! pcaps ) return ICE_ERR_NO_MEMORY ; status = ice_aq_get_phy_caps ( pi , false , ICE_AQC_REPORT_TOPO_CAP_MEDIA , pcaps , NULL ) ; if ( status == ICE_SUCCESS ) ice_memcpy ( li -> module_type , & pcaps -> module_type , sizeof ( li -> module_type ) , ICE_NONDMA_TO_NONDMA ) ; ice_free ( hw , pcaps ) ; } return status ; }
ice_update_link_info - update status of the HW network link
 @pi: port info structure of the interested logical port
ice_update_link_info - update status of the HW network link @pi : port info structure of the interested logical port