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 36C6CA04A5; Wed, 17 Jun 2020 07:42:25 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0FA331BFE8; Wed, 17 Jun 2020 07:42:24 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 80B751BFD1; Wed, 17 Jun 2020 07:42:21 +0200 (CEST) IronPort-SDR: gvFXKISVhyCrF/e+DL6Ibyq4iVNfw3zUz9vO9S1TCDQrjoEIO5QnJUDuUzQmqGGRcaKejFET5F UuPY3do8po1w== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2020 22:42:20 -0700 IronPort-SDR: bJoqLMbzQdSuoPCCFChjWPxYhXywkxULv6fKrxaQUo1Si3lu7zMR20o6RtIokalzva5IDVImuo +4KEXqmIlZlw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,521,1583222400"; d="scan'208";a="299168360" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga004.fm.intel.com with ESMTP; 16 Jun 2020 22:42:19 -0700 Received: from fmsmsx115.amr.corp.intel.com (10.18.116.19) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 16 Jun 2020 22:42:20 -0700 Received: from cdsmsx151.ccr.corp.intel.com (172.17.4.38) by fmsmsx115.amr.corp.intel.com (10.18.116.19) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 16 Jun 2020 22:42:19 -0700 Received: from cdsmsx102.ccr.corp.intel.com ([169.254.2.8]) by CDSMSX151.ccr.corp.intel.com ([172.17.124.18]) with mapi id 14.03.0439.000; Wed, 17 Jun 2020 13:42:16 +0800 From: "Huang, ZhiminX" To: "Jiang, MaoX" CC: "dev@dpdk.org" , "stable@dpdk.org" , "Jiang, MaoX" Thread-Topic: [dpdk-dev] [PATCH 1/2] net/i40e: fix binding interrupt without msix vectors Thread-Index: AQHWPgeB+k7cYNzsm0WbzA/xep3IV6jcV3NQ Date: Wed, 17 Jun 2020 05:42:16 +0000 Message-ID: <1DCDE90B92229844B9E6C0E67C1C8D6B046D2DB1@CDSMSX102.ccr.corp.intel.com> References: <20200609022538.27665-1-maox.jiang@intel.com> In-Reply-To: <20200609022538.27665-1-maox.jiang@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.17.6.105] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [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" Tested-by: zhiminx.huang@intel.com Regards, HuangZhiMin -----Original Message----- From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jiang Mao Sent: Tuesday, June 9, 2020 10:26 AM To: Ye, Xiaolong Cc: dev@dpdk.org; stable@dpdk.org; Jiang, MaoX Subject: [dpdk-dev] [PATCH 1/2] net/i40e: fix binding interrupt without msi= x vectors The value of vsi->nb_msix shouldn`t be zero, otherwise, all of interrupts w= ill 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 | 41 +++++++++++++++++++++++----------- drivers/net/i40e/i40e_ethdev.h | 2 +- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.= c index 970a31cb2..33ed556c8 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -2013,7 +2013,7 @@ __vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t= msix_vect, I40E_WRITE_FLUSH(hw); } =20 -void +int i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx) { struct rte_eth_dev *dev =3D vsi->adapter->eth_dev; @@ -2033,10 +2033,14 @= @ i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx) =20 /* VF bind interrupt */ if (vsi->type =3D=3D I40E_VSI_SRIOV) { + if (vsi->nb_msix =3D=3D 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; + vsi->base_queue, vsi->nb_qps, + itr_idx); + return 0; } =20 /* PF & VMDq bind interrupt */ @@ -2053,16 +2057,19 @@ i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uin= t16_t itr_idx) } =20 for (i =3D 0; i < vsi->nb_used_qps; i++) { - if (nb_msix <=3D 1) { + if (vsi->nb_msix =3D=3D 0) { + PMD_DRV_LOG(ERR, "No msix resource"); + return -EINVAL; + } else if (nb_msix <=3D 1) { if (!rte_intr_allow_others(intr_handle)) /* allow to share MISC_VEC_ID */ msix_vect =3D I40E_MISC_VEC_ID; =20 /* no enough msix_vect, map all to one */ __vsi_queues_bind_intr(vsi, msix_vect, - vsi->base_queue + i, - vsi->nb_used_qps - i, - itr_idx); + vsi->base_queue + i, + vsi->nb_used_qps - i, + itr_idx); for (; !!record && i < vsi->nb_used_qps; i++) intr_handle->intr_vec[queue_idx + i] =3D msix_vect; @@ -2078,6 +2085,8 @@ i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint1= 6_t itr_idx) msix_vect++; nb_msix--; } + + return 0; } =20 static void @@ -2318,21 +2327,27 @@ i40e_dev_start(struct rte_eth_dev *dev) /* Map queues with MSIX interrupt */ main_vsi->nb_used_qps =3D 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 =3D i40e_vsi_queues_bind_intr(main_vsi, I40E_ITR_INDEX_DEFAULT); + if (ret < 0) + return ret; i40e_vsi_enable_queues_intr(main_vsi); =20 /* Map VMDQ VSI queues with MSIX interrupt */ for (i =3D 0; i < pf->nb_cfg_vmdq_vsi; i++) { pf->vmdq[i].vsi->nb_used_qps =3D RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM; - i40e_vsi_queues_bind_intr(pf->vmdq[i].vsi, - I40E_ITR_INDEX_DEFAULT); + ret =3D 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); } =20 /* enable FDIR MSIX interrupt */ if (pf->fdir.fdir_vsi) { - i40e_vsi_queues_bind_intr(pf->fdir.fdir_vsi, - I40E_ITR_INDEX_NONE); + ret =3D 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); } =20 diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.= h index e5d0ce53f..33fbe776b 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -1248,7 +1248,7 @@ void i40e_update_vsi_stats(struct i40e_vsi *vsi); vo= id i40e_pf_disable_irq0(struct i40e_hw *hw); void i40e_pf_enable_irq0(stru= ct i40e_hw *hw); int i40e_dev_link_update(struct rte_eth_dev *dev, int wai= t_to_complete); -void i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint1= 6_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); -- 2.17.1