From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <thomas.monjalon@6wind.com>
Received: from mail-wg0-f42.google.com (mail-wg0-f42.google.com [74.125.82.42])
 by dpdk.org (Postfix) with ESMTP id 1D282B379
 for <dev@dpdk.org>; Sat, 30 Aug 2014 16:47:55 +0200 (CEST)
Received: by mail-wg0-f42.google.com with SMTP id b13so3336979wgh.13
 for <dev@dpdk.org>; Sat, 30 Aug 2014 07:52:13 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:organization
 :user-agent:in-reply-to:references:mime-version
 :content-transfer-encoding:content-type;
 bh=gDcHomppMnoQOB+8zEsSoQj0zS2QoY7T8ycvU4jUtj8=;
 b=I0W8Tt+lCeX9blARGyH8GJqeGmbzGPHnLh5d/p6NWfp+ogBw2VWodgC7HwCdLDec+9
 IlxozbmBOPnjOj5I/SSTzJayqhatljU4H55ovCLUKtAOj2++6oseLMl9LHoita7HR1Qk
 rhdwkJLfKcAty93lLdbmcHAxyQGvUHraaFbE81y6AXXCE++njLBYKYhzEAjOWZI0GsAi
 UpxzS8KkhtzTn/zFUzpszLqGCQ9S/uV/iNLiT9B34rorg+pwHXaSJCbXFcLPTsEnQ6jt
 M3zgkW5zKI/AM/rlPwpf2fEbQjJCwPqaYBHcLbh6fGTWPv46YilYuM6MPk5eNmOyXsFw
 v3xw==
X-Gm-Message-State: ALoCoQm0wR7g4WhEva6Xe5ZlKDdaahRynfFzAMXfrtpDOoJtIvjXz2fNR/LKDMOjOwdeysXw6BKw
X-Received: by 10.180.21.141 with SMTP id v13mr10911686wie.48.1409410333642;
 Sat, 30 Aug 2014 07:52:13 -0700 (PDT)
Received: from xps13.localnet (APoitiers-651-1-232-7.w2-6.abo.wanadoo.fr.
 [2.6.255.7])
 by mx.google.com with ESMTPSA id iy10sm7175220wic.8.2014.08.30.07.52.12
 for <multiple recipients>
 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Sat, 30 Aug 2014 07:52:12 -0700 (PDT)
From: Thomas Monjalon <thomas.monjalon@6wind.com>
To: Helin Zhang <helin.zhang@intel.com>
Date: Sat, 30 Aug 2014 16:52:04 +0200
Message-ID: <1869800.0euLpIG2Cy@xps13>
Organization: 6WIND
User-Agent: KMail/4.13.3 (Linux/3.15.8-1-ARCH; KDE/4.13.3; x86_64; ; )
In-Reply-To: <1408505611-6959-3-git-send-email-helin.zhang@intel.com>
References: <1408505611-6959-1-git-send-email-helin.zhang@intel.com>
 <1408505611-6959-3-git-send-email-helin.zhang@intel.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH 2/3] i40evf: support
	I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EX in i40e VF PMD
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Sat, 30 Aug 2014 14:47:55 -0000

2014-08-20 11:33, Helin Zhang:
> To support configurable CRC in VF, use operation of
> I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES_EX to carry more
> information from VM to PF host, if the peer is DPDK
> PF host. Otherwise assume it is Linux PF host and
> just use operation of I40E_VIRTCHNL_OP_CONFIG_VSI_QUEUES.
[...]
> +/* It configures VSI queues to co-work with Linux PF host */
>  static int
> -i40evf_configure_queues(struct rte_eth_dev *dev)
> +i40evf_configure_vsi_queues(struct rte_eth_dev *dev)
>  {
>  	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
> -	struct i40e_virtchnl_vsi_queue_config_info *queue_info;
> -	struct i40e_virtchnl_queue_pair_info *queue_cfg;
>  	struct i40e_rx_queue **rxq =
>  		(struct i40e_rx_queue **)dev->data->rx_queues;
>  	struct i40e_tx_queue **txq =
>  		(struct i40e_tx_queue **)dev->data->tx_queues;
> -	int i, len, nb_qpairs, num_rxq, num_txq;
> -	int err;
> +	struct i40e_virtchnl_vsi_queue_config_info *vc_vqci;
> +	struct i40e_virtchnl_queue_pair_info *vc_qpi;
>  	struct vf_cmd_info args;
> -	struct rte_pktmbuf_pool_private *mbp_priv;
> -
> -	nb_qpairs = vf->num_queue_pairs;
> -	len = sizeof(*queue_info) + sizeof(*queue_cfg) * nb_qpairs;
> -	queue_info = rte_zmalloc("queue_info", len, 0);
> -	if (queue_info == NULL) {
> -		PMD_INIT_LOG(ERR, "failed alloc memory for queue_info\n");
> -		return -1;
> +	int size, i, nb_qp, ret;
> +
> +	nb_qp = vf->num_queue_pairs;
> +	size = sizeof(struct i40e_virtchnl_vsi_queue_config_info) +
> +		sizeof(struct i40e_virtchnl_queue_pair_info) * nb_qp;
> +	vc_vqci = rte_zmalloc("queue_info", size, 0);
> +	if (!vc_vqci) {
> +		PMD_DRV_LOG(ERR, "Failed to allocate memory for VF "
> +					"configuring queues\n");
> +		return -ENOMEM;
>  	}
> -	queue_info->vsi_id = vf->vsi_res->vsi_id;
> -	queue_info->num_queue_pairs = nb_qpairs;
> -	queue_cfg = queue_info->qpair;
> -
> -	num_rxq = dev->data->nb_rx_queues;
> -	num_txq = dev->data->nb_tx_queues;
> -	/*
> -	 * PF host driver required to configure queues in pairs, which means
> -	 * rxq_num should equals to txq_num. The actual usage won't always
> -	 * work that way. The solution is fills 0 with HW ring option in case
> -	 * they are not equal.
> -	 */
> -	for (i = 0; i < nb_qpairs; i++) {
> -		/*Fill TX info */
> -		queue_cfg->txq.vsi_id = queue_info->vsi_id;
> -		queue_cfg->txq.queue_id = i;
> -		if (i < num_txq) {
> -			queue_cfg->txq.ring_len = txq[i]->nb_tx_desc;
> -			queue_cfg->txq.dma_ring_addr = txq[i]->tx_ring_phys_addr;
> -		} else {
> -			queue_cfg->txq.ring_len = 0;
> -			queue_cfg->txq.dma_ring_addr = 0;
> +	vc_vqci->vsi_id = vf->vsi_res->vsi_id;
> +	vc_vqci->num_queue_pairs = nb_qp;
> +
> +	for (i = 0, vc_qpi = vc_vqci->qpair; i < nb_qp; i++, vc_qpi++) {
> +		vc_qpi->txq.vsi_id = vc_vqci->vsi_id;
> +		vc_qpi->txq.queue_id = i;
> +		if (i < dev->data->nb_tx_queues) {
> +			vc_qpi->txq.ring_len = txq[i]->nb_tx_desc;
> +			vc_qpi->txq.dma_ring_addr = txq[i]->tx_ring_phys_addr;
>  		}
>  
> -		/* Fill RX info */
> -		queue_cfg->rxq.vsi_id = queue_info->vsi_id;
> -		queue_cfg->rxq.queue_id = i;
> -		queue_cfg->rxq.max_pkt_size = vf->max_pkt_len;
> -		if (i < num_rxq) {
> +		vc_qpi->rxq.vsi_id = vc_vqci->vsi_id;
> +		vc_qpi->rxq.queue_id = i;
> +		vc_qpi->rxq.max_pkt_size = vf->max_pkt_len;
> +		if (i < dev->data->nb_rx_queues) {
> +			struct rte_pktmbuf_pool_private *mbp_priv;
> +
> +			vc_qpi->rxq.ring_len = rxq[i]->nb_rx_desc;
> +			vc_qpi->rxq.dma_ring_addr = rxq[i]->rx_ring_phys_addr;
>  			mbp_priv = rte_mempool_get_priv(rxq[i]->mp);
> -			queue_cfg->rxq.databuffer_size = mbp_priv->mbuf_data_room_size -
> -						   RTE_PKTMBUF_HEADROOM;;
> -			queue_cfg->rxq.ring_len = rxq[i]->nb_rx_desc;
> -			queue_cfg->rxq.dma_ring_addr = rxq[i]->rx_ring_phys_addr;;
> -		} else {
> -			queue_cfg->rxq.ring_len = 0;
> -			queue_cfg->rxq.dma_ring_addr = 0;
> -			queue_cfg->rxq.databuffer_size = 0;
> +			vc_qpi->rxq.databuffer_size =
> +				mbp_priv->mbuf_data_room_size -
> +					RTE_PKTMBUF_HEADROOM;
>  		}
> -		queue_cfg++;
>  	}

It's not clear why you reworked the legacy function.
Please explain it in the commit log and move renamings in a separated patch.

Thanks
-- 
Thomas