From patchwork Wed Sep 25 11:06:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Cui, LunyuanX" X-Patchwork-Id: 59690 X-Patchwork-Delegate: xiaolong.ye@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7091E2C2F; Wed, 25 Sep 2019 05:08:45 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id E80A02BF1 for ; Wed, 25 Sep 2019 05:08:43 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Sep 2019 20:08:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,546,1559545200"; d="scan'208";a="218846538" Received: from intel.sh.intel.com ([10.239.255.129]) by fmsmga002.fm.intel.com with ESMTP; 24 Sep 2019 20:08:39 -0700 From: "lunyuan.cui" To: 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 Cc: dev@dpdk.org, "lunyuan.cui" Date: Wed, 25 Sep 2019 11:06:11 +0000 Message-Id: <20190925110611.2959-1-lunyuanx.cui@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190916144308.119187-1-lunyuanx.cui@intel.com> References: <20190916144308.119187-1-lunyuanx.cui@intel.com> Subject: [dpdk-dev] [RFC v4] 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" 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. After PF sets the map to the register, all Rx queue interrupts will be received. In addition, vector id should less than the maximum vector value. When queue number is more than vector value, we set up a loop of interrupt vectors map. Signed-off-by: Lunyuan Cui --- v4: * remove the orginal limit on the interrupt vector value, change the limit value with the maximum value which is provided by PF. v3: * combined 2 lines into 1 line before: map_info->vecmap[i].rxq_map = 0; map_info->vecmap[i].rxq_map |= 1 << i; after: map_info->vecmap[i].rxq_map = 1 << i; v2: * set up a loop of interrupt vectors map from 1 to 4, and sent message from VF to PF by one time. --- drivers/net/i40e/i40e_ethdev_vf.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index 308fb9835..406b54fff 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -651,12 +651,13 @@ 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; uint32_t vector_id; int i, err; + uint16_t nb_msix; if (dev->data->dev_conf.intr_conf.rxq != 0 && rte_intr_allow_others(intr_handle)) @@ -664,19 +665,25 @@ i40evf_config_irq_map(struct rte_eth_dev *dev) else vector_id = I40E_MISC_VEC_ID; + nb_msix = RTE_MIN(vf->vf_res->max_vectors, + intr_handle->nb_efd); + 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 = 1 << i; if (rte_intr_dp_is_en(intr_handle)) intr_handle->intr_vec[i] = vector_id; + if (vector_id > I40E_MISC_VEC_ID) + vector_id++; + if (vector_id > nb_msix) + vector_id = I40E_RX_VEC_START; } args.ops = VIRTCHNL_OP_CONFIG_IRQ_MAP;