src/dpdk/drivers/net/ice/base/ice_common.c
void ice_set_safe_mode_caps(struct ice_hw *hw)
{
	struct ice_hw_func_caps *func_caps = &hw->func_caps;
	struct ice_hw_dev_caps *dev_caps = &hw->dev_caps;
	struct ice_hw_common_caps cached_caps;
	u32 num_funcs;

	/* cache some func_caps values that should be restored after memset */
	cached_caps = func_caps->common_cap;

	/* unset func capabilities */
	memset(func_caps, 0, sizeof(*func_caps));

#define ICE_RESTORE_FUNC_CAP(name) \
	func_caps->common_cap.name = cached_caps.name

	/* restore cached values */
	ICE_RESTORE_FUNC_CAP(valid_functions);
	ICE_RESTORE_FUNC_CAP(txq_first_id);
	ICE_RESTORE_FUNC_CAP(rxq_first_id);
	ICE_RESTORE_FUNC_CAP(msix_vector_first_id);
	ICE_RESTORE_FUNC_CAP(max_mtu);
	ICE_RESTORE_FUNC_CAP(nvm_unified_update);

	/* one Tx and one Rx queue in safe mode */
	func_caps->common_cap.num_rxq = 1;
	func_caps->common_cap.num_txq = 1;

	/* two MSIX vectors, one for traffic and one for misc causes */
	func_caps->common_cap.num_msix_vectors = 2;
	func_caps->guar_num_vsi = 1;

	/* cache some dev_caps values that should be restored after memset */
	cached_caps = dev_caps->common_cap;
	num_funcs = dev_caps->num_funcs;

	/* unset dev capabilities */
	memset(dev_caps, 0, sizeof(*dev_caps));

#define ICE_RESTORE_DEV_CAP(name) \
	dev_caps->common_cap.name = cached_caps.name

	/* restore cached values */
	ICE_RESTORE_DEV_CAP(valid_functions);
	ICE_RESTORE_DEV_CAP(txq_first_id);
	ICE_RESTORE_DEV_CAP(rxq_first_id);
	ICE_RESTORE_DEV_CAP(msix_vector_first_id);
	ICE_RESTORE_DEV_CAP(max_mtu);
	ICE_RESTORE_DEV_CAP(nvm_unified_update);
	dev_caps->num_funcs = num_funcs;

	/* one Tx and one Rx queue per function in safe mode */
	dev_caps->common_cap.num_rxq = num_funcs;
	dev_caps->common_cap.num_txq = num_funcs;

	/* two MSIX vectors per function */
	dev_caps->common_cap.num_msix_vectors = 2 * num_funcs;
}
/**
 * ice_set_safe_mode_caps - Override dev/func capabilities when in safe mode
 * @hw: pointer to the hardware structure
 */
Override dev/func capabilities when in safe mode
@hw: pointer to the hardware structure
Override dev / func capabilities when in safe mode @hw : pointer to the hardware structure
void ice_set_safe_mode_caps(struct ice_hw *hw)
{
	struct ice_hw_func_caps *func_caps = &hw->func_caps;
	struct ice_hw_dev_caps *dev_caps = &hw->dev_caps;
	struct ice_hw_common_caps cached_caps;
	u32 num_funcs;
	cached_caps = func_caps->common_cap;
	memset(func_caps, 0, sizeof(*func_caps));
#define ICE_RESTORE_FUNC_CAP(name) \
	func_caps->common_cap.name = cached_caps.name
	ICE_RESTORE_FUNC_CAP(valid_functions);
	ICE_RESTORE_FUNC_CAP(txq_first_id);
	ICE_RESTORE_FUNC_CAP(rxq_first_id);
	ICE_RESTORE_FUNC_CAP(msix_vector_first_id);
	ICE_RESTORE_FUNC_CAP(max_mtu);
	ICE_RESTORE_FUNC_CAP(nvm_unified_update);
	func_caps->common_cap.num_rxq = 1;
	func_caps->common_cap.num_txq = 1;
	func_caps->common_cap.num_msix_vectors = 2;
	func_caps->guar_num_vsi = 1;
	cached_caps = dev_caps->common_cap;
	num_funcs = dev_caps->num_funcs;
	memset(dev_caps, 0, sizeof(*dev_caps));
#define ICE_RESTORE_DEV_CAP(name) \
	dev_caps->common_cap.name = cached_caps.name
	ICE_RESTORE_DEV_CAP(valid_functions);
	ICE_RESTORE_DEV_CAP(txq_first_id);
	ICE_RESTORE_DEV_CAP(rxq_first_id);
	ICE_RESTORE_DEV_CAP(msix_vector_first_id);
	ICE_RESTORE_DEV_CAP(max_mtu);
	ICE_RESTORE_DEV_CAP(nvm_unified_update);
	dev_caps->num_funcs = num_funcs;
	dev_caps->common_cap.num_rxq = num_funcs;
	dev_caps->common_cap.num_txq = num_funcs;
	dev_caps->common_cap.num_msix_vectors = 2 * num_funcs;
}
void ice_set_safe_mode_caps ( struct ice_hw * hw ) { struct ice_hw_func_caps * func_caps = & hw -> func_caps ; struct ice_hw_dev_caps * dev_caps = & hw -> dev_caps ; struct ice_hw_common_caps cached_caps ; u32 num_funcs ; cached_caps = func_caps -> common_cap ; memset ( func_caps , 0 , sizeof ( * func_caps ) ) ; #define ICE_RESTORE_FUNC_CAP ( name )  \
	func_caps->common_cap.name = cached_caps.name ICE_RESTORE_FUNC_CAP ( valid_functions ) ; ICE_RESTORE_FUNC_CAP ( txq_first_id ) ; ICE_RESTORE_FUNC_CAP ( rxq_first_id ) ; ICE_RESTORE_FUNC_CAP ( msix_vector_first_id ) ; ICE_RESTORE_FUNC_CAP ( max_mtu ) ; ICE_RESTORE_FUNC_CAP ( nvm_unified_update ) ; func_caps -> common_cap . num_rxq = 1 ; func_caps -> common_cap . num_txq = 1 ; func_caps -> common_cap . num_msix_vectors = 2 ; func_caps -> guar_num_vsi = 1 ; cached_caps = dev_caps -> common_cap ; num_funcs = dev_caps -> num_funcs ; memset ( dev_caps , 0 , sizeof ( * dev_caps ) ) ; #define ICE_RESTORE_DEV_CAP ( name )  \
	dev_caps->common_cap.name = cached_caps.name ICE_RESTORE_DEV_CAP ( valid_functions ) ; ICE_RESTORE_DEV_CAP ( txq_first_id ) ; ICE_RESTORE_DEV_CAP ( rxq_first_id ) ; ICE_RESTORE_DEV_CAP ( msix_vector_first_id ) ; ICE_RESTORE_DEV_CAP ( max_mtu ) ; ICE_RESTORE_DEV_CAP ( nvm_unified_update ) ; dev_caps -> num_funcs = num_funcs ; dev_caps -> common_cap . num_rxq = num_funcs ; dev_caps -> common_cap . num_txq = num_funcs ; dev_caps -> common_cap . num_msix_vectors = 2 * num_funcs ; }
ice_set_safe_mode_caps - Override dev/func capabilities when in safe mode
 @hw: pointer to the hardware structure
ice_set_safe_mode_caps - Override dev / func capabilities when in safe mode @hw : pointer to the hardware structure
/* cache some func_caps values that should be restored after memset */ /* unset func capabilities */ /* restore cached values */ /* one Tx and one Rx queue in safe mode */ /* two MSIX vectors, one for traffic and one for misc causes */ /* cache some dev_caps values that should be restored after memset */ /* unset dev capabilities */ /* restore cached values */ /* one Tx and one Rx queue per function in safe mode */ /* two MSIX vectors per function */