From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A9692A2EF7 for ; Mon, 16 Sep 2019 00:45:17 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 38B0C1C12F; Mon, 16 Sep 2019 00:45:16 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id E7A191BEBB for ; Mon, 16 Sep 2019 00:45:13 +0200 (CEST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Sep 2019 15:45:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,492,1559545200"; d="scan'208";a="176880546" Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.117.5]) by orsmga007.jf.intel.com with ESMTP; 15 Sep 2019 15:45:10 -0700 Date: Mon, 16 Sep 2019 06:42:41 +0800 From: Ye Xiaolong To: "lunyuan.cui" Cc: qiming.yang@intel.com, jingjing.wu@intel.com, beilei.xing@intel.com, qi.z.zhang@intel.com, shougangx.wang@intel.com, paul.m.stillwell.jr@intel.com, dev@dpdk.org Message-ID: <20190915224241.GD86692@intel.com> References: <20190909102927.145056-1-lunyuanx.cui@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190909102927.145056-1-lunyuanx.cui@intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [RFC v2] net/i40e: enable multi-queue Rx interrupt for VF X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 09/09, lunyuan.cui wrote: >This patch enables VF to support multi-queue Rx interrupt. > >Current implementation is that only one Rx queue can support interrupt, >because all queues are mapped in the same vector id in vfio_enable_msix(). >So VF can not support multi-queue Rx interrupt in the interrupt mode. > >In this patch, if the packet I/O interrupt on datapath is >enabled (rte_intr_dp_is_en(intr_handle) is true), >we map different interrupt vectors to each queue >and send this map to PF everytime. >After PF sets the map to the register, >all Rx queue interrupts will be received. > >In addition, because of the i40e performance in ioctl(), >the maximum supported interrupt vector id is 4. >If vector id is more than 4, i40e driver will fail to start. >So when queue number is more than 4, >we set up a loop of interrupt vectors map from 1 to 4. > >Signed-off-by: Lunyuan Cui >--- > drivers/net/i40e/i40e_ethdev_vf.c | 28 ++++++++++++++++++---------- > 1 file changed, 18 insertions(+), 10 deletions(-) > >diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c >index 308fb9835..ecfec46f8 100644 >--- a/drivers/net/i40e/i40e_ethdev_vf.c >+++ b/drivers/net/i40e/i40e_ethdev_vf.c >@@ -645,13 +645,15 @@ i40evf_configure_vsi_queues(struct rte_eth_dev *dev) > return ret; > } > >+#define RTE_LIBRTE_I40E_IRQ_NUM_PER_VF 4 >+ > static int > i40evf_config_irq_map(struct rte_eth_dev *dev) > { > struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); > struct vf_cmd_info args; > uint8_t cmd_buffer[sizeof(struct virtchnl_irq_map_info) + \ >- sizeof(struct virtchnl_vector_map)]; >+ sizeof(struct virtchnl_vector_map) * dev->data->nb_rx_queues]; > struct virtchnl_irq_map_info *map_info; > struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); > struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; >@@ -665,18 +667,24 @@ i40evf_config_irq_map(struct rte_eth_dev *dev) > vector_id = I40E_MISC_VEC_ID; > > map_info = (struct virtchnl_irq_map_info *)cmd_buffer; >- map_info->num_vectors = 1; >- map_info->vecmap[0].rxitr_idx = I40E_ITR_INDEX_DEFAULT; >- map_info->vecmap[0].vsi_id = vf->vsi_res->vsi_id; >- /* Alway use default dynamic MSIX interrupt */ >- map_info->vecmap[0].vector_id = vector_id; >- /* Don't map any tx queue */ >- map_info->vecmap[0].txq_map = 0; >- map_info->vecmap[0].rxq_map = 0; >+ map_info->num_vectors = dev->data->nb_rx_queues; > for (i = 0; i < dev->data->nb_rx_queues; i++) { >- map_info->vecmap[0].rxq_map |= 1 << i; >+ map_info->vecmap[i].rxitr_idx = I40E_ITR_INDEX_DEFAULT; >+ map_info->vecmap[i].vsi_id = vf->vsi_res->vsi_id; >+ /* Alway use default dynamic MSIX interrupt */ >+ map_info->vecmap[i].vector_id = vector_id; >+ /* Don't map any tx queue */ >+ map_info->vecmap[i].txq_map = 0; >+ map_info->vecmap[i].rxq_map = 0; >+ map_info->vecmap[i].rxq_map |= 1 << i; Above 2 lines can combined into map_info->vecmap[i].rxq_map = 1 << i; > if (rte_intr_dp_is_en(intr_handle)) > intr_handle->intr_vec[i] = vector_id; >+ if (vector_id > I40E_MISC_VEC_ID) { >+ if (vector_id < RTE_LIBRTE_I40E_IRQ_NUM_PER_VF) >+ vector_id++; >+ else >+ vector_id = I40E_RX_VEC_START; >+ } > } > > args.ops = VIRTCHNL_OP_CONFIG_IRQ_MAP; >-- >2.17.1 >