src/dpdk/drivers/net/bnx2x/bnx2x.c
static void bnx2x_calc_vn_min(struct bnx2x_softc *sc, struct cmng_init_input *input)
{
	uint32_t vn_cfg;
	uint32_t vn_min_rate;
	int all_zero = 1;
	int vn;

	for (vn = VN_0; vn < SC_MAX_VN_NUM(sc); vn++) {
		vn_cfg = sc->devinfo.mf_info.mf_config[vn];
		vn_min_rate = (((vn_cfg & FUNC_MF_CFG_MIN_BW_MASK) >>
				FUNC_MF_CFG_MIN_BW_SHIFT) * 100);

		if (vn_cfg & FUNC_MF_CFG_FUNC_HIDE) {
			/* skip hidden VNs */
			vn_min_rate = 0;
		} else if (!vn_min_rate) {
			/* If min rate is zero - set it to 100 */
			vn_min_rate = DEF_MIN_RATE;
		} else {
			all_zero = 0;
		}

		input->vnic_min_rate[vn] = vn_min_rate;
	}

	/* if ETS or all min rates are zeros - disable fairness */
	if (all_zero) {
		input->flags.cmng_enables &= ~CMNG_FLAGS_PER_PORT_FAIRNESS_VN;
	} else {
		input->flags.cmng_enables |= CMNG_FLAGS_PER_PORT_FAIRNESS_VN;
	}
}
/*
 * Calculates the sum of vn_min_rates.
 * It's needed for further normalizing of the min_rates.
 * Returns:
 *   sum of vn_min_rates.
 *     or
 *   0 - if all the min_rates are 0.
 * In the later case fainess algorithm should be deactivated.
 * If all min rates are not zero then those that are zeroes will be set to 1.
 */
Calculates the sum of vn_min_rates.
It's needed for further normalizing of the min_rates.
Returns:
sum of vn_min_rates.
or
0 - if all the min_rates are 0.
In the later case fainess algorithm should be deactivated.
If all min rates are not zero then those that are zeroes will be set to 1.
Calculates the sum of vn_min_rates . It ' s needed for further normalizing of the min_rates . Returns : sum of vn_min_rates . or 0 - if all the min_rates are 0 . In the later case fainess algorithm should be deactivated . If all min rates are not zero then those that are zeroes will be set to 1 .
static void bnx2x_calc_vn_min(struct bnx2x_softc *sc, struct cmng_init_input *input)
{
	uint32_t vn_cfg;
	uint32_t vn_min_rate;
	int all_zero = 1;
	int vn;
	for (vn = VN_0; vn < SC_MAX_VN_NUM(sc); vn++) {
		vn_cfg = sc->devinfo.mf_info.mf_config[vn];
		vn_min_rate = (((vn_cfg & FUNC_MF_CFG_MIN_BW_MASK) >>
				FUNC_MF_CFG_MIN_BW_SHIFT) * 100);
		if (vn_cfg & FUNC_MF_CFG_FUNC_HIDE) {
			vn_min_rate = 0;
		} else if (!vn_min_rate) {
			vn_min_rate = DEF_MIN_RATE;
		} else {
			all_zero = 0;
		}
		input->vnic_min_rate[vn] = vn_min_rate;
	}
	if (all_zero) {
		input->flags.cmng_enables &= ~CMNG_FLAGS_PER_PORT_FAIRNESS_VN;
	} else {
		input->flags.cmng_enables |= CMNG_FLAGS_PER_PORT_FAIRNESS_VN;
	}
}
static void bnx2x_calc_vn_min ( struct bnx2x_softc * sc , struct cmng_init_input * input ) { uint32_t vn_cfg ; uint32_t vn_min_rate ; int all_zero = 1 ; int vn ; for ( vn = VN_0 ; vn < SC_MAX_VN_NUM ( sc ) ; vn ++ ) { vn_cfg = sc -> devinfo . mf_info . mf_config [ vn ] ; vn_min_rate = ( ( ( vn_cfg & FUNC_MF_CFG_MIN_BW_MASK ) >> FUNC_MF_CFG_MIN_BW_SHIFT ) * 100 ) ; if ( vn_cfg & FUNC_MF_CFG_FUNC_HIDE ) { vn_min_rate = 0 ; } else if ( ! vn_min_rate ) { vn_min_rate = DEF_MIN_RATE ; } else { all_zero = 0 ; } input -> vnic_min_rate [ vn ] = vn_min_rate ; } if ( all_zero ) { input -> flags . cmng_enables &= ~ CMNG_FLAGS_PER_PORT_FAIRNESS_VN ; } else { input -> flags . cmng_enables |= CMNG_FLAGS_PER_PORT_FAIRNESS_VN ; } }
Calculates the sum of vn_min_rates.
Calculates the sum of vn_min_rates .
/* skip hidden VNs */ /* If min rate is zero - set it to 100 */ /* if ETS or all min rates are zeros - disable fairness */