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 5921EA00BE; Wed, 8 Jul 2020 09:54:51 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7699D1DB13; Wed, 8 Jul 2020 09:54:50 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 55CE11DA26; Wed, 8 Jul 2020 09:54:47 +0200 (CEST) IronPort-SDR: v5D33zNWYW8L4pdigEPEI+bTBgaxofY3fQESSc7z5vKNeC30MPZCRVogDW04b3SJZLnR3wBlsw zzGLs1E9r/wA== X-IronPort-AV: E=McAfee;i="6000,8403,9675"; a="145857951" X-IronPort-AV: E=Sophos;i="5.75,327,1589266800"; d="scan'208";a="145857951" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jul 2020 00:54:47 -0700 IronPort-SDR: twveN78IJQ9IQuRDVyWA2PQizyX8gnee/wm65r+QoSjfwkb5lNa407ZpDxYxJV9i2OMHpDBUyv 4zE2L6puzH2g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,327,1589266800"; d="scan'208";a="388750073" Received: from dut85.sh.intel.com ([10.240.183.157]) by fmsmga001.fm.intel.com with ESMTP; 08 Jul 2020 00:54:45 -0700 From: Jiang Mao To: xiaolong.ye@intel.com Cc: dev@dpdk.org, stable@dpdk.org, maox.jiang@intel.com Date: Thu, 9 Jul 2020 03:50:34 +0800 Message-Id: <20200708195034.4495-1-maox.jiang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200609022538.27665-1-maox.jiang@intel.com> References: <20200609022538.27665-1-maox.jiang@intel.com> Subject: [dpdk-dev] [PATCH 1/2] net/i40e: fix binding interrupt without msix vectors 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" The value of vsi->nb_msix shouldn`t be zero, otherwise, all of interrupts will be bind to vector 0. Fixes: 4861cde461 (i40e: new poll mode driver) Cc: stable@dpdk.org Signed-off-by: Jiang Mao --- drivers/net/i40e/i40e_ethdev.c | 31 +++++++++++++++++++++++-------- drivers/net/i40e/i40e_ethdev.h | 2 +- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 777e149..16fcb8d 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -2001,7 +2001,7 @@ void i40e_flex_payload_reg_set_default(struct i40e_hw *hw) I40E_WRITE_FLUSH(hw); } -void +int i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx) { struct rte_eth_dev *dev = vsi->adapter->eth_dev; @@ -2021,10 +2021,14 @@ void i40e_flex_payload_reg_set_default(struct i40e_hw *hw) /* VF bind interrupt */ if (vsi->type == I40E_VSI_SRIOV) { + if (vsi->nb_msix == 0) { + PMD_DRV_LOG(ERR, "No msix resource"); + return -EINVAL; + } __vsi_queues_bind_intr(vsi, msix_vect, vsi->base_queue, vsi->nb_qps, itr_idx); - return; + return 0; } /* PF & VMDq bind interrupt */ @@ -2041,7 +2045,10 @@ void i40e_flex_payload_reg_set_default(struct i40e_hw *hw) } for (i = 0; i < vsi->nb_used_qps; i++) { - if (nb_msix <= 1) { + if (vsi->nb_msix == 0) { + PMD_DRV_LOG(ERR, "No msix resource"); + return -EINVAL; + } else if (nb_msix <= 1) { if (!rte_intr_allow_others(intr_handle)) /* allow to share MISC_VEC_ID */ msix_vect = I40E_MISC_VEC_ID; @@ -2066,6 +2073,8 @@ void i40e_flex_payload_reg_set_default(struct i40e_hw *hw) msix_vect++; nb_msix--; } + + return 0; } static void @@ -2306,21 +2315,27 @@ void i40e_flex_payload_reg_set_default(struct i40e_hw *hw) /* Map queues with MSIX interrupt */ main_vsi->nb_used_qps = dev->data->nb_rx_queues - pf->nb_cfg_vmdq_vsi * RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM; - i40e_vsi_queues_bind_intr(main_vsi, I40E_ITR_INDEX_DEFAULT); + ret = i40e_vsi_queues_bind_intr(main_vsi, I40E_ITR_INDEX_DEFAULT); + if (ret < 0) + return ret; i40e_vsi_enable_queues_intr(main_vsi); /* Map VMDQ VSI queues with MSIX interrupt */ for (i = 0; i < pf->nb_cfg_vmdq_vsi; i++) { pf->vmdq[i].vsi->nb_used_qps = RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM; - i40e_vsi_queues_bind_intr(pf->vmdq[i].vsi, - I40E_ITR_INDEX_DEFAULT); + ret = i40e_vsi_queues_bind_intr(pf->vmdq[i].vsi, + I40E_ITR_INDEX_DEFAULT); + if (ret < 0) + return ret; i40e_vsi_enable_queues_intr(pf->vmdq[i].vsi); } /* enable FDIR MSIX interrupt */ if (pf->fdir.fdir_vsi) { - i40e_vsi_queues_bind_intr(pf->fdir.fdir_vsi, - I40E_ITR_INDEX_NONE); + ret = i40e_vsi_queues_bind_intr(pf->fdir.fdir_vsi, + I40E_ITR_INDEX_NONE); + if (ret < 0) + return ret; i40e_vsi_enable_queues_intr(pf->fdir.fdir_vsi); } diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h index e5d0ce5..33fbe77 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -1248,7 +1248,7 @@ struct i40e_vsi *i40e_vsi_setup(struct i40e_pf *pf, void i40e_pf_disable_irq0(struct i40e_hw *hw); void i40e_pf_enable_irq0(struct i40e_hw *hw); int i40e_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete); -void i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx); +int i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx); void i40e_vsi_queues_unbind_intr(struct i40e_vsi *vsi); int i40e_vsi_vlan_pvid_set(struct i40e_vsi *vsi, struct i40e_vsi_vlan_pvid_info *info); -- 1.8.3.1