All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Zhao1, Wei" <wei.zhao1@intel.com>
To: "Wu, Jingjing" <jingjing.wu@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [PATCH v5 1/3] net/i40e: queue region set and flush
Date: Fri, 29 Sep 2017 08:27:24 +0000	[thread overview]
Message-ID: <A2573D2ACFCADC41BB3BE09C6DE313CA07C6A26F@PGSMSX103.gar.corp.intel.com> (raw)
In-Reply-To: <9BB6961774997848B5B42BEC655768F810E834FF@SHSMSX103.ccr.corp.intel.com>

Hi, jingjing 
  All will be fix in v6

> -----Original Message-----
> From: Wu, Jingjing
> Sent: Friday, September 29, 2017 12:55 PM
> To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org
> Cc: Zhao1, Wei <wei.zhao1@intel.com>
> Subject: RE: [dpdk-dev] [PATCH v5 1/3] net/i40e: queue region set and flush
> 
> > +static int
> > +i40e_vsi_update_queue_region_mapping(struct i40e_hw *hw,
> > +			      struct i40e_pf *pf)
> > +{
> > +	uint16_t i;
> > +	struct i40e_vsi *vsi = pf->main_vsi;
> > +	uint16_t queue_offset, bsf, tc_index;
> > +	struct i40e_vsi_context ctxt;
> > +	struct i40e_aqc_vsi_properties_data *vsi_info;
> > +	struct i40e_queue_region_info *region_info =
> > +				&pf->queue_region;
> > +	int32_t ret = -EINVAL;
> > +
> > +	if (!region_info->queue_region_number) {
> > +		PMD_INIT_LOG(ERR, "there is no that region id been set
> before");
> > +		return ret;
> > +	}
> > +
> > +	memset(&ctxt, 0, sizeof(struct i40e_vsi_context));
> > +
> > +	/* Update Queue Pairs Mapping for currently enabled UPs */
> > +	ctxt.seid = vsi->seid;
> > +	ctxt.pf_num = hw->pf_id;
> > +	ctxt.vf_num = 0;
> > +	ctxt.uplink_seid = vsi->uplink_seid;
> > +	ctxt.info = vsi->info;
> > +	vsi_info = &ctxt.info;
> > +
> > +	memset(vsi_info->tc_mapping, 0, sizeof(uint16_t) * 8);
> > +	memset(vsi_info->queue_mapping, 0, sizeof(uint16_t) * 16);
> > +
> > +	/**
> > +	 * Configure queue region and queue mapping parameters,
> > +	 * for enabled queue region, allocate queues to this region.
> > +	 */
> > +
> > +	for (i = 0; i < region_info->queue_region_number; i++) {
> > +		tc_index = region_info->region[i].region_id;
> > +		bsf = rte_bsf32(region_info->region[i].queue_num);
> > +		queue_offset = region_info->region[i].queue_start_index;
> > +		vsi_info->tc_mapping[tc_index] = rte_cpu_to_le_16(
> > +			(queue_offset <<
> I40E_AQ_VSI_TC_QUE_OFFSET_SHIFT) |
> > +				(bsf <<
> I40E_AQ_VSI_TC_QUE_NUMBER_SHIFT));
> > +	}
> > +
> > +	/* Associate queue number with VSI, Keep vsi->nb_qps unchanged
> */
> > +	if (vsi->type == I40E_VSI_SRIOV) {
> You already assign the vsi to main_vsi in the beginning of the function, so It is
> impossible here the type is SRIOV. I think I already commented it in your v3
> patch set?
> 
> [......]
> > +static int
> > +i40e_queue_region_set_region(struct i40e_pf *pf,
> > +				struct rte_i40e_rss_region_conf *conf_ptr) {
> > +	uint16_t i;
> > +	struct i40e_vsi *main_vsi = pf->main_vsi;
> > +	struct i40e_queue_region_info *info = &pf->queue_region;
> > +	int32_t ret = -EINVAL;
> > +
> > +	if (!((rte_is_power_of_2(conf_ptr->queue_num)) &&
> > +				conf_ptr->queue_num <= 64)) {
> > +		PMD_DRV_LOG(ERR, "The region sizes should be any of the
> following
> > +values: 1,
> > 2, 4, 8, 16, 32, 64 as long as the "
> > +			"total number of queues do not exceed the VSI
> allocation");
> > +		return ret;
> > +	}
> > +
> > +	if (conf_ptr->region_id > I40E_REGION_MAX_INDEX) {
> > +		PMD_DRV_LOG(ERR, "the queue region max index is 7");
> > +		return ret;
> > +	}
> > +
> > +	if ((conf_ptr->queue_start_index + conf_ptr->queue_num)
> > +					> main_vsi->nb_used_qps) {
> > +		PMD_DRV_LOG(ERR, "the queue index exceeds the VSI
> range");
> > +		return ret;
> > +	}
> > +
> You are using nb_used_qps for the comparison, is that to say the function Is
> supposed to be called after dev_start?
> 
> > +	for (i = 0; i < info->queue_region_number; i++)
> > +		if (conf_ptr->region_id == info->region[i].region_id)
> > +			break;
> > +
> > +	if (i == info->queue_region_number &&
> > +				i <= I40E_REGION_MAX_INDEX) {
> > +		info->region[i].region_id = conf_ptr->region_id;
> > +		info->region[i].queue_num = conf_ptr->queue_num;
> > +		info->region[i].queue_start_index =
> > +			conf_ptr->queue_start_index;
> > +		info->queue_region_number++;
> > +	} else {
> > +		PMD_DRV_LOG(ERR, "queue region number exceeds
> maxnum 8 or the queue
> > region id has been set before");
> > +		return ret;
> > +	}
> > +
> > +	return 0;
> > +}
> > +
> > +static int
> > +i40e_queue_region_set_flowtype(struct i40e_pf *pf,
> > +			struct rte_i40e_rss_region_conf *rss_region_conf) {
> > +	int32_t ret = -EINVAL;
> > +	struct i40e_queue_region_info *info = &pf->queue_region;
> > +	uint16_t i, j, flowtype_set = 0;
> > +	uint16_t region_index, flowtype_index;
> > +
> > +	/**
> > +	 * For the pctype or hardware flowtype of packet,
> > +	 * the specific index for each type has been defined
> > +	 * in file i40e_type.h as enum i40e_filter_pctype.
> > +	 */
> > +
> Are you meeing the type of hw_flowtype in rss_region_conf Is defined in
> i40e_type.h?
> 
> > +	if (rss_region_conf->region_id > I40E_PFQF_HREGION_MAX_INDEX)
> {
> > +		PMD_DRV_LOG(ERR, "the queue region max index is 7");
> > +		return ret;
> > +	}
> > +
> > +	if (rss_region_conf->hw_flowtype >= I40E_FILTER_PCTYPE_MAX) {
> > +		PMD_DRV_LOG(ERR, "the hw_flowtype or PCTYPE max
> index is 63");
> > +		return ret;
> > +	}
> > +
> > +
> > +	for (i = 0; i < info->queue_region_number; i++)
> > +		if (rss_region_conf->region_id == info->region[i].region_id)
> > +			break;
> > +
> > +	if (i == info->queue_region_number) {
> > +		PMD_DRV_LOG(ERR, "that region id has not been set
> before");
> > +		ret = -ENODATA;
> > +		return ret;
> > +	}
> > +	region_index = i;
> > +
> > +	for (i = 0; i < info->queue_region_number; i++) {
> > +		for (j = 0; j < info->region[i].flowtype_num; j++) {
> > +			if (rss_region_conf->hw_flowtype ==
> > +				info->region[i].hw_flowtype[j]) {
> > +				flowtype_set = 1;
> > +				break;
> You can just return here?
> 
> > +			}
> > +		}
> > +	}
> > +
> 
>  [......]
> > +static int
> > +i40e_queue_region_set_user_priority(struct i40e_pf *pf,
> > +		struct rte_i40e_rss_region_conf *rss_region_conf) {
> > +	struct i40e_queue_region_info *info = &pf->queue_region;
> > +	int32_t ret = -EINVAL;
> > +	uint16_t i, j, region_index, user_priority_set = 0;
> > +
> > +	if (rss_region_conf->user_priority >= I40E_MAX_USER_PRIORITY) {
> > +		PMD_DRV_LOG(ERR, "the queue region max index is 7");
> > +		return ret;
> > +	}
> > +
> > +	if (rss_region_conf->region_id >= I40E_REGION_MAX_INDEX) {
> > +		PMD_DRV_LOG(ERR, "the region_id max index is 7");
> > +		return ret;
> > +	}
> > +
> > +	for (i = 0; i < info->queue_region_number; i++)
> > +		if (rss_region_conf->region_id == info->region[i].region_id)
> > +			break;
> > +
> > +	if (i == info->queue_region_number) {
> > +		PMD_DRV_LOG(ERR, "that region id has not been set
> before");
> > +		ret = -ENODATA;
> > +		return ret;
> > +	}
> > +	region_index = i;
> > +
> > +	for (i = 0; i < info->queue_region_number; i++) {
> > +		for (j = 0; j < info->region[i].user_priority_num; j++) {
> > +			if (info->region[i].user_priority[j] ==
> > +				rss_region_conf->user_priority) {
> > +				user_priority_set = 1;
> The same, you can return here.
> > +				break;
> 
> [......]
> > +
> > +static int
> > +i40e_queue_region_dcb_configure(struct i40e_hw *hw,
> > +				struct i40e_pf *pf)
> > +{
> > +	struct i40e_dcbx_config dcb_cfg_local;
> > +	struct i40e_dcbx_config *dcb_cfg;
> > +	struct i40e_queue_region_info *info = &pf->queue_region;
> > +	struct i40e_dcbx_config *old_cfg = &hw->local_dcbx_config;
> > +	int32_t ret = -EINVAL;
> > +	uint16_t i, j, prio_index, region_index;
> > +	uint8_t tc_map, tc_bw, bw_lf;
> > +
> > +	if (!info->queue_region_number) {
> > +		PMD_DRV_LOG(ERR, "there is no that region id been set
> before");
> > +		return ret;
> > +	}
> > +
> > +	dcb_cfg = &dcb_cfg_local;
> > +	memset(dcb_cfg, 0, sizeof(struct i40e_dcbx_config));
> > +
> > +	/* assume each tc has the same bw */
> > +	tc_bw = I40E_MAX_PERCENT / info->queue_region_number;
> > +	for (i = 0; i < info->queue_region_number; i++)
> > +		dcb_cfg->etscfg.tcbwtable[i] = tc_bw;
> > +	/* to ensure the sum of tcbw is equal to 100 */
> > +	bw_lf = I40E_MAX_PERCENT %  info->queue_region_number;
> > +	for (i = 0; i < bw_lf; i++)
> > +		dcb_cfg->etscfg.tcbwtable[i]++;
> > +
> > +	/* assume each tc has the same Transmission Selection Algorithm */
> > +	for (i = 0; i < info->queue_region_number; i++)
> > +		dcb_cfg->etscfg.tsatable[i] = I40E_IEEE_TSA_ETS;
> > +
> > +	for (i = 0; i < info->queue_region_number; i++) {
> > +		for (j = 0; j < info->region[i].user_priority_num; j++) {
> > +			prio_index = info->region[i].user_priority[j];
> > +			region_index = info->region[i].region_id;
> > +			dcb_cfg->etscfg.prioritytable[prio_index] =
> > +						region_index;
> > +		}
> > +	}
> > +
> > +	/* FW needs one App to configure HW */
> > +	dcb_cfg->numapps = I40E_DEFAULT_DCB_APP_NUM;
> > +	dcb_cfg->app[0].selector = I40E_APP_SEL_ETHTYPE;
> > +	dcb_cfg->app[0].priority = I40E_DEFAULT_DCB_APP_PRIO;
> > +	dcb_cfg->app[0].protocolid = I40E_APP_PROTOID_FCOE;
> > +
> > +	tc_map = RTE_LEN2MASK(info->queue_region_number, uint8_t);
> > +
> > +	dcb_cfg->pfc.willing = 0;
> > +	dcb_cfg->pfc.pfccap = I40E_MAX_TRAFFIC_CLASS;
> > +	dcb_cfg->pfc.pfcenable = tc_map;
> > +
> > +	/* Copy the new config to the current config */
> > +	*old_cfg = *dcb_cfg;
> > +	old_cfg->etsrec = old_cfg->etscfg;
> > +	ret = i40e_set_dcb_config(hw);
> > +
> > +	if (ret) {
> > +		PMD_DRV_LOG(ERR, "Set queue region DCB Config failed,
> err %s aq_err %s",
> > +			 i40e_stat_str(hw, ret),
> > +			 i40e_aq_str(hw, hw->aq.asq_last_status));
> > +		return ret;
> > +	}
> > +
> > +	return 0;
> > +}
> > +
> > +int
> > +i40e_flush_queue_region_all_conf(struct rte_eth_dev *dev,
> > +	struct i40e_hw *hw, struct i40e_pf *pf, uint16_t on) {
> > +	int32_t ret = -EINVAL;
> > +	struct i40e_queue_region_info *info = &pf->queue_region;
> > +
> > +	if (on) {
> > +		i40e_queue_region_pf_flowtype_conf(hw, pf);
> > +
> > +		ret = i40e_vsi_update_queue_region_mapping(hw, pf);
> > +		if (ret != I40E_SUCCESS) {
> > +			PMD_DRV_LOG(INFO, "Failed to flush queue region
> mapping.");
> > +			return ret;
> > +		}
> > +
> > +		ret = i40e_queue_region_dcb_configure(hw, pf);
> > +		if (ret != I40E_SUCCESS) {
> > +			PMD_DRV_LOG(INFO, "Failed to flush dcb.");
> > +			return ret;
> > +		}
> > +
> > +		return 0;
> > +	}
> > +
> > +	info->queue_region_number = 1;
> > +	info->region[0].queue_num = 64;
> > +	info->region[0].queue_start_index = 0;
> > +
> > +	ret = i40e_vsi_update_queue_region_mapping(hw, pf);
> > +	if (ret != I40E_SUCCESS)
> > +		PMD_DRV_LOG(INFO, "Failed to flush queue region
> mapping.");
> > +
> > +	ret = i40e_dcb_init_configure(dev, TRUE);
> > +	if (ret != I40E_SUCCESS) {
> > +		PMD_DRV_LOG(INFO, "Failed to flush dcb.");
> > +		pf->flags &= ~I40E_FLAG_DCB;
> > +	}
> > +
> > +	i40e_init_queue_region_conf(dev);
> > +
> > +	return 0;
> > +}
> > +
> > +static int
> > +i40e_queue_region_pf_check_rss(struct i40e_pf *pf) {
> > +	struct i40e_hw *hw = I40E_PF_TO_HW(pf);
> > +	uint64_t hena;
> > +
> > +	hena = (uint64_t)i40e_read_rx_ctl(hw, I40E_PFQF_HENA(0));
> > +	hena |= ((uint64_t)i40e_read_rx_ctl(hw, I40E_PFQF_HENA(1))) <<
> 32;
> > +	if (hw->mac.type == I40E_MAC_X722)
> > +		hena &= I40E_RSS_HENA_ALL_X722;
> > +	else
> > +		hena &= I40E_RSS_HENA_ALL;
> > +
> > +	if (!hena)
> > +		return -ENOTSUP;
> > +
> Why made such change? Will it be impacted by kiril's pctype patches and
> beilei's new pctype patches?
> 
> > +	return 0;
> > +}
> > +
> > +static void
> > +i40e_queue_region_get_all_info(struct i40e_pf *pf, uint16_t port_id)
> > +{
> In this function, it looks like you print all the information about queue region?
> If so, You can use "display" instead of "get".
> In my opinion, generally, we are getting info but not display info in API level.
> 
> [......]
> > +
> > +/**
> > + *  Option types of queue region.
> > + */
> > +enum rte_pmd_i40e_queue_region_op {
> > +	RTE_PMD_I40E_REGION_UNDEFINED,
> > +	RTE_PMD_I40E_QUEUE_REGION_SET,      /**< add queue region set
> */
> > +	RTE_PMD_I40E_REGION_FLOWTYPE_SET,   /**< add pf region
> pctype set */
> > +	/**< add queue region user priority set */
> If the comments is added before the definition, you need to use /** xxx */
> instead of /**< XX */ for doxygen-likely format you can check
> http://www.dpdk.org/doc/guides/contributing/documentation.html#doxyg
> en-guidelines
> 
> Thanks
> Jingjing

  reply	other threads:[~2017-09-29  8:27 UTC|newest]

Thread overview: 87+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-24  3:26 [PATCH 0/2] net/i40e: API to configure queue regions for RSS Wei Zhao
2017-08-24  3:26 ` [PATCH 1/2] net/i40e: queue region set and flush Wei Zhao
2017-08-31 16:18   ` Ferruh Yigit
2017-09-01  2:38     ` Zhao1, Wei
2017-09-06  9:11       ` Ferruh Yigit
2017-09-15 11:00         ` Ferruh Yigit
2017-09-20  3:20           ` Zhao1, Wei
2017-09-20 10:32             ` Ferruh Yigit
2017-09-18  3:38         ` Zhao1, Wei
2017-09-05 23:52   ` Chilikin, Andrey
2017-09-06  7:21     ` Zhao1, Wei
2017-08-24  3:26 ` [PATCH 2/2] app/testpmd: add API for configuration of queue region Wei Zhao
2017-09-13  6:04 ` [PATCH v2 0/2] net/i40e: API to configure queue regions for RSS Wei Zhao
2017-09-13  6:04   ` [PATCH v2 1/2] net/i40e: queue region set and flush Wei Zhao
2017-09-13  6:04   ` [PATCH v2 2/2] app/testpmd: add API for configuration of queue region Wei Zhao
2017-09-15  3:13   ` [PATCH v3 0/2] net/i40e: API to configure queue regions for RSS Wei Zhao
2017-09-15  3:13     ` [PATCH v3 1/2] net/i40e: queue region set and flush Wei Zhao
2017-09-20 10:36       ` Ferruh Yigit
2017-09-21  6:48         ` Zhao1, Wei
2017-09-21  7:10           ` Ferruh Yigit
2017-09-21  7:26             ` Zhao1, Wei
2017-09-21 15:45               ` Ferruh Yigit
2017-09-25  7:40         ` Zhao1, Wei
2017-09-25  9:31           ` Ferruh Yigit
2017-09-26  7:46             ` Zhao1, Wei
2017-09-26  8:54         ` Zhao1, Wei
2017-09-27 19:13           ` Ferruh Yigit
2017-09-28  2:40             ` Zhao1, Wei
2017-09-21 19:53       ` Chilikin, Andrey
2017-09-22  8:49         ` Zhao1, Wei
2017-09-22 20:13           ` Chilikin, Andrey
2017-09-25  2:55             ` Zhao1, Wei
2017-09-24 16:01       ` Wu, Jingjing
2017-09-25  3:26         ` Zhao1, Wei
2017-09-25  5:55         ` Zhao1, Wei
2017-09-15  3:13     ` [PATCH v3 2/2] app/testpmd: add API for configuration of queue region Wei Zhao
2017-09-20 10:45       ` Ferruh Yigit
2017-09-25  9:25         ` Zhao1, Wei
2017-09-25  9:43           ` Ferruh Yigit
2017-09-26  5:30             ` Zhao1, Wei
2017-09-28  9:04     ` [PATCH v4 0/3] net/i40e: API to configure queue regions for RSS Wei Zhao
2017-09-28  9:04       ` [PATCH v4 1/3] net/i40e: queue region set and flush Wei Zhao
2017-09-28  9:04       ` [PATCH v4 2/3] app/testpmd: add API for configuration of queue region Wei Zhao
2017-09-28  9:04       ` [PATCH v4 3/3] doc/testpmd_app_ug: add doc info for " Wei Zhao
2017-09-28  9:10     ` [PATCH v4 0/3] net/i40e: API to configure queue regions for RSS Wei Zhao
2017-09-28  9:10       ` [PATCH v4 1/3] net/i40e: queue region set and flush Wei Zhao
2017-09-28  9:10       ` [PATCH v4 2/3] app/testpmd: add API for configuration of queue region Wei Zhao
2017-09-28  9:10       ` [PATCH v4 3/3] doc/testpmd_app_ug: add doc info for " Wei Zhao
2017-09-29  2:56       ` [PATCH v5 0/3] net/i40e: API to configure queue regions for RSS Wei Zhao
2017-09-29  2:56         ` [PATCH v5 1/3] net/i40e: queue region set and flush Wei Zhao
2017-09-29  4:54           ` Wu, Jingjing
2017-09-29  8:27             ` Zhao1, Wei [this message]
2017-09-29  2:56         ` [PATCH v5 2/3] app/testpmd: add API for configuration of queue region Wei Zhao
2017-09-29  5:04           ` Wu, Jingjing
2017-09-29  5:21             ` Zhao1, Wei
2017-09-29  2:56         ` [PATCH v5 3/3] doc/testpmd_app_ug: add doc info for " Wei Zhao
2017-09-29  8:11         ` [PATCH v6] net/i40e: API to configure queue regions for RSS Wei Zhao
2017-09-29  8:11           ` [PATCH v6] app/testpmd: add API for configuration of queue region Wei Zhao
2017-09-29  8:11           ` [PATCH v6] net/i40e: queue region set and flush Wei Zhao
2017-09-29  9:00             ` Wu, Jingjing
2017-09-29  9:16           ` [PATCH v7 0/2] net/i40e: API to configure queue regions for RSS Wei Zhao
2017-09-29  9:16             ` [PATCH v7 1/2] net/i40e: queue region set and flush Wei Zhao
2017-09-29 12:22               ` Wu, Jingjing
2017-10-10  1:45                 ` Zhao1, Wei
2017-10-03 17:54               ` Ferruh Yigit
2017-10-10  6:11                 ` Zhao1, Wei
2017-09-29  9:16             ` [PATCH v7 2/2] app/testpmd: add API for configuration of queue region Wei Zhao
2017-09-29 14:29               ` Wu, Jingjing
2017-10-03 18:04               ` Ferruh Yigit
2017-10-10  1:46                 ` Zhao1, Wei
2017-10-10  2:55                 ` Zhao1, Wei
2017-10-10  3:01                 ` Zhao1, Wei
2017-10-11  2:15                   ` Ferruh Yigit
2017-09-29 10:15             ` [PATCH v7 0/2] net/i40e: API to configure queue regions for RSS Peng, Yuan
2017-10-11  8:49             ` [PATCH v8 " Wei Zhao
2017-10-11  8:49               ` [PATCH v8 1/2] net/i40e: queue region set and flush Wei Zhao
2017-10-11  8:49               ` [PATCH v8 2/2] app/testpmd: add API for configuration of queue region Wei Zhao
2017-10-11  8:55             ` [PATCH v8 0/2] net/i40e: API to configure queue regions for RSS Wei Zhao
2017-10-11  8:55               ` [PATCH v8 1/2] net/i40e: queue region set and flush Wei Zhao
2017-10-13 10:06                 ` Chilikin, Andrey
2017-10-18  3:00                   ` Zhao1, Wei
2017-10-18 13:00                     ` Chilikin, Andrey
2017-10-19  2:18                       ` Zhao1, Wei
2017-10-11  8:55               ` [PATCH v8 2/2] app/testpmd: add API for configuration of queue region Wei Zhao
2017-10-11 11:29               ` [PATCH v8 0/2] net/i40e: API to configure queue regions for RSS Peng, Yuan
2017-10-11 21:06               ` Ferruh Yigit
2017-10-13  1:52                 ` Zhao1, Wei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=A2573D2ACFCADC41BB3BE09C6DE313CA07C6A26F@PGSMSX103.gar.corp.intel.com \
    --to=wei.zhao1@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.