src/dpdk/drivers/net/ice/base/ice_common.c
static enum ice_status
ice_cfg_phy_fc(struct ice_port_info *pi, struct ice_aqc_set_phy_cfg_data *cfg,
	       enum ice_fc_mode req_mode)
{
	struct ice_phy_cache_mode_data cache_data;
	u8 pause_mask = 0x0;

	if (!pi || !cfg)
		return ICE_ERR_BAD_PTR;

	switch (req_mode) {
	case ICE_FC_AUTO:
	{
		struct ice_aqc_get_phy_caps_data *pcaps;
		enum ice_status status;

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

		/* Query the value of FC that both the NIC and attached media
		 * can do.
		 */
		status = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_TOPO_CAP_MEDIA,
					     pcaps, NULL);
		if (status) {
			ice_free(pi->hw, pcaps);
			return status;
		}

		pause_mask |= pcaps->caps & ICE_AQC_PHY_EN_TX_LINK_PAUSE;
		pause_mask |= pcaps->caps & ICE_AQC_PHY_EN_RX_LINK_PAUSE;

		ice_free(pi->hw, pcaps);
		break;
	}
	case ICE_FC_FULL:
		pause_mask |= ICE_AQC_PHY_EN_TX_LINK_PAUSE;
		pause_mask |= ICE_AQC_PHY_EN_RX_LINK_PAUSE;
		break;
	case ICE_FC_RX_PAUSE:
		pause_mask |= ICE_AQC_PHY_EN_RX_LINK_PAUSE;
		break;
	case ICE_FC_TX_PAUSE:
		pause_mask |= ICE_AQC_PHY_EN_TX_LINK_PAUSE;
		break;
	default:
		break;
	}

	/* clear the old pause settings */
	cfg->caps &= ~(ICE_AQC_PHY_EN_TX_LINK_PAUSE |
		ICE_AQC_PHY_EN_RX_LINK_PAUSE);

	/* set the new capabilities */
	cfg->caps |= pause_mask;

	/* Cache user FC request */
	cache_data.data.curr_user_fc_req = req_mode;
	ice_cache_phy_user_req(pi, cache_data, ICE_FC_MODE);

	return ICE_SUCCESS;
}
/**
 * ice_cfg_phy_fc - Configure PHY FC data based on FC mode
 * @pi: port information structure
 * @cfg: PHY configuration data to set FC mode
 * @req_mode: FC mode to configure
 */
Configure PHY FC data based on FC mode
@pi: port information structure
@cfg: PHY configuration data to set FC mode
@req_mode: FC mode to configure
Configure PHY FC data based on FC mode @pi : port information structure @cfg : PHY configuration data to set FC mode @req_mode : FC mode to configure
static enum ice_status
ice_cfg_phy_fc(struct ice_port_info *pi, struct ice_aqc_set_phy_cfg_data *cfg,
	       enum ice_fc_mode req_mode)
{
	struct ice_phy_cache_mode_data cache_data;
	u8 pause_mask = 0x0;
	if (!pi || !cfg)
		return ICE_ERR_BAD_PTR;
	switch (req_mode) {
	case ICE_FC_AUTO:
	{
		struct ice_aqc_get_phy_caps_data *pcaps;
		enum ice_status status;
		pcaps = (struct ice_aqc_get_phy_caps_data *)
			ice_malloc(pi->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_free(pi->hw, pcaps);
			return status;
		}
		pause_mask |= pcaps->caps & ICE_AQC_PHY_EN_TX_LINK_PAUSE;
		pause_mask |= pcaps->caps & ICE_AQC_PHY_EN_RX_LINK_PAUSE;
		ice_free(pi->hw, pcaps);
		break;
	}
	case ICE_FC_FULL:
		pause_mask |= ICE_AQC_PHY_EN_TX_LINK_PAUSE;
		pause_mask |= ICE_AQC_PHY_EN_RX_LINK_PAUSE;
		break;
	case ICE_FC_RX_PAUSE:
		pause_mask |= ICE_AQC_PHY_EN_RX_LINK_PAUSE;
		break;
	case ICE_FC_TX_PAUSE:
		pause_mask |= ICE_AQC_PHY_EN_TX_LINK_PAUSE;
		break;
	default:
		break;
	}
	cfg->caps &= ~(ICE_AQC_PHY_EN_TX_LINK_PAUSE |
		ICE_AQC_PHY_EN_RX_LINK_PAUSE);
	cfg->caps |= pause_mask;
	cache_data.data.curr_user_fc_req = req_mode;
	ice_cache_phy_user_req(pi, cache_data, ICE_FC_MODE);
	return ICE_SUCCESS;
}
static enum ice_status ice_cfg_phy_fc ( struct ice_port_info * pi , struct ice_aqc_set_phy_cfg_data * cfg , enum ice_fc_mode req_mode ) { struct ice_phy_cache_mode_data cache_data ; u8 pause_mask = 0x0 ; if ( ! pi || ! cfg ) return ICE_ERR_BAD_PTR ; switch ( req_mode ) { case ICE_FC_AUTO : { struct ice_aqc_get_phy_caps_data * pcaps ; enum ice_status status ; pcaps = ( struct ice_aqc_get_phy_caps_data * ) ice_malloc ( pi -> 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_free ( pi -> hw , pcaps ) ; return status ; } pause_mask |= pcaps -> caps & ICE_AQC_PHY_EN_TX_LINK_PAUSE ; pause_mask |= pcaps -> caps & ICE_AQC_PHY_EN_RX_LINK_PAUSE ; ice_free ( pi -> hw , pcaps ) ; break ; } case ICE_FC_FULL : pause_mask |= ICE_AQC_PHY_EN_TX_LINK_PAUSE ; pause_mask |= ICE_AQC_PHY_EN_RX_LINK_PAUSE ; break ; case ICE_FC_RX_PAUSE : pause_mask |= ICE_AQC_PHY_EN_RX_LINK_PAUSE ; break ; case ICE_FC_TX_PAUSE : pause_mask |= ICE_AQC_PHY_EN_TX_LINK_PAUSE ; break ; default : break ; } cfg -> caps &= ~ ( ICE_AQC_PHY_EN_TX_LINK_PAUSE | ICE_AQC_PHY_EN_RX_LINK_PAUSE ) ; cfg -> caps |= pause_mask ; cache_data . data . curr_user_fc_req = req_mode ; ice_cache_phy_user_req ( pi , cache_data , ICE_FC_MODE ) ; return ICE_SUCCESS ; }
ice_cfg_phy_fc - Configure PHY FC data based on FC mode
 @pi: port information structure
 @cfg: PHY configuration data to set FC mode
 @req_mode: FC mode to configure
ice_cfg_phy_fc - Configure PHY FC data based on FC mode @pi : port information structure @cfg : PHY configuration data to set FC mode @req_mode : FC mode to configure
/* Query the value of FC that both the NIC and attached media
		 * can do.
		 */ /* clear the old pause settings */ /* set the new capabilities */ /* Cache user FC request */