From patchwork Tue Jun 18 07:11:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiawen Wu X-Patchwork-Id: 141248 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D8AFD45489; Tue, 18 Jun 2024 09:15:32 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 33DDB427E6; Tue, 18 Jun 2024 09:13:15 +0200 (CEST) Received: from smtpbg153.qq.com (smtpbg153.qq.com [13.245.218.24]) by mails.dpdk.org (Postfix) with ESMTP id 83F9A40E3F for ; Tue, 18 Jun 2024 09:12:33 +0200 (CEST) X-QQ-mid: bizesmtpsz1t1718694749t1aljvv X-QQ-Originating-IP: ZSjL6JBwJYUB4q0Xx5pgQhw5pIdEM7q81Pl5pJ+19xo= Received: from lap-jiawenwu.trustnetic.com ( [183.159.97.141]) by bizesmtp.qq.com (ESMTP) with id ; Tue, 18 Jun 2024 15:12:29 +0800 (CST) X-QQ-SSF: 0000000000000000000000000000000 X-QQ-GoodBg: 0 X-BIZMAIL-ID: 8176884446149523819 From: Jiawen Wu To: dev@dpdk.org Cc: Jiawen Wu Subject: [PATCH 17/19] net/ngbe: support Rx interrupt Date: Tue, 18 Jun 2024 15:11:48 +0800 Message-Id: <20240618071150.21564-18-jiawenwu@trustnetic.com> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20240618071150.21564-1-jiawenwu@trustnetic.com> References: <20240618071150.21564-1-jiawenwu@trustnetic.com> MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtpsz:trustnetic.com:qybglogicsvrgz:qybglogicsvrgz8a-1 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 Implement Rx queue interrupt enable/disable functions. Signed-off-by: Jiawen Wu --- doc/guides/nics/features/ngbe.ini | 1 + doc/guides/nics/ngbe.rst | 1 + drivers/net/ngbe/ngbe_ethdev.c | 33 ++++++++++++++++++++++++++++++- 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/doc/guides/nics/features/ngbe.ini b/doc/guides/nics/features/ngbe.ini index 1dfd92e96b..7b1f12bf95 100644 --- a/doc/guides/nics/features/ngbe.ini +++ b/doc/guides/nics/features/ngbe.ini @@ -8,6 +8,7 @@ Speed capabilities = Y Link speed configuration = Y Link status = Y Link status event = Y +Rx interrupt = Y Free Tx mbuf on demand = Y Queue start/stop = Y Burst mode info = Y diff --git a/doc/guides/nics/ngbe.rst b/doc/guides/nics/ngbe.rst index 44d34197a6..e31600c95a 100644 --- a/doc/guides/nics/ngbe.rst +++ b/doc/guides/nics/ngbe.rst @@ -27,6 +27,7 @@ Features - Scattered and gather for TX and RX - IEEE 1588 - FW version +- Interrupt mode for RX Prerequisites diff --git a/drivers/net/ngbe/ngbe_ethdev.c b/drivers/net/ngbe/ngbe_ethdev.c index d7fc4bc70b..b9618cc074 100644 --- a/drivers/net/ngbe/ngbe_ethdev.c +++ b/drivers/net/ngbe/ngbe_ethdev.c @@ -2743,6 +2743,35 @@ ngbe_uc_all_hash_table_set(struct rte_eth_dev *dev, uint8_t on) return 0; } +static int +ngbe_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id) +{ + struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); + struct rte_intr_handle *intr_handle = pci_dev->intr_handle; + struct ngbe_hw *hw = ngbe_dev_hw(dev); + uint32_t mask; + + mask = rd32(hw, NGBE_IMC(0)); + mask |= (1 << queue_id); + wr32(hw, NGBE_IMC(0), mask); + rte_intr_enable(intr_handle); + + return 0; +} + +static int +ngbe_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id) +{ + struct ngbe_hw *hw = ngbe_dev_hw(dev); + uint32_t mask; + + mask = rd32(hw, NGBE_IMS(0)); + mask |= (1 << queue_id); + wr32(hw, NGBE_IMS(0), mask); + + return 0; +} + /** * Set the IVAR registers, mapping interrupt causes to vectors * @param hw @@ -2770,7 +2799,7 @@ ngbe_set_ivar_map(struct ngbe_hw *hw, int8_t direction, wr32(hw, NGBE_IVARMISC, tmp); } else { /* rx or tx causes */ - /* Workaround for ICR lost */ + msix_vector |= NGBE_IVAR_VLD; /* Workaround for ICR lost */ idx = ((16 * (queue & 1)) + (8 * direction)); tmp = rd32(hw, NGBE_IVAR(queue >> 1)); tmp &= ~(0xFF << idx); @@ -3202,6 +3231,8 @@ static const struct eth_dev_ops ngbe_eth_dev_ops = { .rx_queue_release = ngbe_dev_rx_queue_release, .tx_queue_setup = ngbe_dev_tx_queue_setup, .tx_queue_release = ngbe_dev_tx_queue_release, + .rx_queue_intr_enable = ngbe_dev_rx_queue_intr_enable, + .rx_queue_intr_disable = ngbe_dev_rx_queue_intr_disable, .dev_led_on = ngbe_dev_led_on, .dev_led_off = ngbe_dev_led_off, .flow_ctrl_get = ngbe_flow_ctrl_get,