From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D903CA0093; Fri, 23 Dec 2022 03:52:53 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 611ED42D47; Fri, 23 Dec 2022 03:52:07 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 58DBB42D3D for ; Fri, 23 Dec 2022 03:52:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1671763925; x=1703299925; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vx+i2YSFa90Cr3L0UBi1cYoTYrlPZPX4fZR+jooq+Ck=; b=YUFCoPpcmbUNLBs7kz9vWuyr4AErZ4ov7XlV/wquMNTk+reScqNch8Ui zkQJMAlUwBgjaNgr4byCjMCaKSvGtdFzmuxl43wqJkDzh0wHrD/nCdBFW n50U9pPNTRtVSosqMFyyh36zWPt9pw1g05aw5i0ktTvS5TPKRJ2sQudzC 7Ptx2Ccv8Ne5c/30FWzjw+jPGn2VLIBTptA6asHCW49pQ5Ujqy9Hlu2jE U6BZhWxrgXbeeZKV+yoxpMlMdNJJOEUXNXf7jrLQkvpx84cJQVbXxH2jY WqWt8ylhvVm0rSto1n/hrxQmRVR5HAZ4AFgpQXB5eNfcCKYBq7pzAVIyC Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10569"; a="321467114" X-IronPort-AV: E=Sophos;i="5.96,267,1665471600"; d="scan'208";a="321467114" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Dec 2022 18:52:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10569"; a="629707176" X-IronPort-AV: E=Sophos;i="5.96,267,1665471600"; d="scan'208";a="629707176" Received: from dpdk-mingxial-01.sh.intel.com ([10.67.119.112]) by orsmga006.jf.intel.com with ESMTP; 22 Dec 2022 18:52:03 -0800 From: Mingxia Liu To: dev@dpdk.org Cc: jingjing.wu@intel.com, beilei.xing@intel.com, qi.z.zhang@intel.com, Mingxia Liu Subject: [PATCH 11/21] net/cpfl: support write back based on ITR expire Date: Fri, 23 Dec 2022 01:55:48 +0000 Message-Id: <20221223015558.3143279-12-mingxia.liu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221223015558.3143279-1-mingxia.liu@intel.com> References: <20221223015558.3143279-1-mingxia.liu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Enable write back on ITR expire, then packets can be received one by Signed-off-by: Mingxia Liu --- drivers/net/cpfl/cpfl_ethdev.c | 38 ++++++++++++++++++++++++++++++++++ drivers/net/cpfl/cpfl_ethdev.h | 2 ++ 2 files changed, 40 insertions(+) diff --git a/drivers/net/cpfl/cpfl_ethdev.c b/drivers/net/cpfl/cpfl_ethdev.c index d9ac3983aa..ccd9783f5c 100644 --- a/drivers/net/cpfl/cpfl_ethdev.c +++ b/drivers/net/cpfl/cpfl_ethdev.c @@ -198,6 +198,15 @@ cpfl_dev_configure(struct rte_eth_dev *dev) return 0; } +static int +cpfl_config_rx_queues_irqs(struct rte_eth_dev *dev) +{ + struct idpf_vport *vport = dev->data->dev_private; + uint16_t nb_rx_queues = dev->data->nb_rx_queues; + + return idpf_config_irq_map(vport, nb_rx_queues); +} + static int cpfl_start_queues(struct rte_eth_dev *dev) { @@ -235,6 +244,10 @@ static int cpfl_dev_start(struct rte_eth_dev *dev) { struct idpf_vport *vport = dev->data->dev_private; + struct idpf_adapter *base = vport->adapter; + struct cpfl_adapter_ext *adapter = CPFL_ADAPTER_TO_EXT(base); + uint16_t num_allocated_vectors = base->caps.num_allocated_vectors; + uint16_t req_vecs_num; int ret; vport->stopped = 0; @@ -247,6 +260,27 @@ cpfl_dev_start(struct rte_eth_dev *dev) vport->max_pkt_len = dev->data->mtu + CPFL_ETH_OVERHEAD; + req_vecs_num = CPFL_DFLT_Q_VEC_NUM; + if (req_vecs_num + adapter->used_vecs_num > num_allocated_vectors) { + PMD_DRV_LOG(ERR, "The accumulated request vectors' number should be less than %d", + num_allocated_vectors); + ret = -EINVAL; + goto err_mtu; + } + + ret = idpf_vc_alloc_vectors(vport, req_vecs_num); + if (ret != 0) { + PMD_DRV_LOG(ERR, "Failed to allocate interrupt vectors"); + goto err_mtu; + } + adapter->used_vecs_num += req_vecs_num; + + ret = cpfl_config_rx_queues_irqs(dev); + if (ret != 0) { + PMD_DRV_LOG(ERR, "Failed to configure irqs"); + goto err_mtu; + } + ret = cpfl_start_queues(dev); if (ret != 0) { PMD_DRV_LOG(ERR, "Failed to start queues"); @@ -282,6 +316,10 @@ cpfl_dev_stop(struct rte_eth_dev *dev) cpfl_stop_queues(dev); + idpf_config_irq_unmap(vport, dev->data->nb_rx_queues); + + idpf_vc_dealloc_vectors(vport); + vport->stopped = 1; return 0; diff --git a/drivers/net/cpfl/cpfl_ethdev.h b/drivers/net/cpfl/cpfl_ethdev.h index e24ecb614b..714149df32 100644 --- a/drivers/net/cpfl/cpfl_ethdev.h +++ b/drivers/net/cpfl/cpfl_ethdev.h @@ -24,6 +24,8 @@ #define CPFL_INVALID_VPORT_IDX 0xffff +#define CPFL_DFLT_Q_VEC_NUM 1 + #define CPFL_MIN_BUF_SIZE 1024 #define CPFL_MAX_FRAME_SIZE 9728 -- 2.25.1