DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jiawen Wu <jiawenwu@trustnetic.com>
To: dev@dpdk.org
Cc: Jiawen Wu <jiawenwu@trustnetic.com>
Subject: [PATCH 17/19] net/ngbe: support Rx interrupt
Date: Tue, 18 Jun 2024 15:11:48 +0800	[thread overview]
Message-ID: <20240618071150.21564-18-jiawenwu@trustnetic.com> (raw)
In-Reply-To: <20240618071150.21564-1-jiawenwu@trustnetic.com>

Implement Rx queue interrupt enable/disable functions.

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
---
 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,
-- 
2.27.0


  parent reply	other threads:[~2024-06-18  7:15 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-18  7:11 [PATCH 00/19] Wangxun fixes and supports Jiawen Wu
2024-06-18  7:11 ` [PATCH 01/19] net/txgbe: fix to parse tunnel packets Jiawen Wu
2024-06-18  7:11 ` [PATCH 02/19] net/txgbe: fix flow filters in VT mode Jiawen Wu
2024-06-18  7:11 ` [PATCH 03/19] net/txgbe: fix Tx hang on queue disable Jiawen Wu
2024-06-18  7:11 ` [PATCH 04/19] net/txgbe: restrict the configuration of VLAN strip offload Jiawen Wu
2024-06-18  7:11 ` [PATCH 05/19] net/txgbe: reconfigure more MAC Rx registers Jiawen Wu
2024-06-18  7:11 ` [PATCH 06/19] net/txgbe: fix VF promiscuous and allmulticast Jiawen Wu
2024-06-18  7:11 ` [PATCH 07/19] net/ngbe: special config for YT8531SH-CA PHY Jiawen Wu
2024-06-18  7:11 ` [PATCH 08/19] net/ngbe: keep PHY power down while device probing Jiawen Wu
2024-06-18  7:11 ` [PATCH 09/19] net/ngbe: add WOL and NCSI capability Jiawen Wu
2024-06-18  7:11 ` [PATCH 10/19] net/txgbe: fix hotplug remove Jiawen Wu
2024-06-18  7:11 ` [PATCH 11/19] net/ngbe: " Jiawen Wu
2024-06-18  7:11 ` [PATCH 12/19] net/txgbe: correct valid MTU range Jiawen Wu
2024-06-18  7:11 ` [PATCH 13/19] net/ngbe: " Jiawen Wu
2024-06-18  7:11 ` [PATCH 14/19] net/txgbe: fix memory leak Jiawen Wu
2024-06-18  7:11 ` [PATCH 15/19] net/ngbe: " Jiawen Wu
2024-06-18  7:11 ` [PATCH 16/19] net/txgbe: fix Rx interrupt Jiawen Wu
2024-06-18  7:11 ` Jiawen Wu [this message]
2024-06-18  7:11 ` [PATCH 18/19] net/txgbe: disable LLDP by default Jiawen Wu
2024-06-18  7:11 ` [PATCH 19/19] net/ngbe: " Jiawen Wu
2024-06-25  1:51 ` [PATCH 00/19] Wangxun fixes and supports Jiawen Wu
2024-07-05  8:11   ` Jiawen Wu
2024-07-06  3:39     ` Ferruh Yigit
2024-07-11 11:53       ` David Marchand
2024-07-12  9:32         ` David Marchand
2024-07-12 12:47           ` Ferruh Yigit
2024-07-12 15:30             ` Ferruh Yigit
2024-07-13  2:16               ` Jiawen Wu
2024-07-12 16:50             ` Thomas Monjalon
2024-07-16  8:16 ` [PATCH v2 1/2] net/txgbe: disable LLDP by default Jiawen Wu
2024-07-16  8:16   ` [PATCH v2 2/2] net/ngbe: " Jiawen Wu
2024-07-16 11:05     ` Ferruh Yigit
2024-07-17  2:14       ` Jiawen Wu
2024-07-17 10:22         ` Ferruh Yigit
2024-07-17 11:28   ` [PATCH v2 1/2] net/txgbe: " Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240618071150.21564-18-jiawenwu@trustnetic.com \
    --to=jiawenwu@trustnetic.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).