[14/32] net/ngbe: support Rx interrupt
Checks
Commit Message
Support Rx queue interrupt.
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 | 35 +++++++++++++++++++++++++++++++
3 files changed, 37 insertions(+)
Comments
On 9/8/2021 9:37 AM, Jiawen Wu wrote:
> Support Rx queue interrupt.
>
> 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 | 35 +++++++++++++++++++++++++++++++
> 3 files changed, 37 insertions(+)
>
> diff --git a/doc/guides/nics/features/ngbe.ini b/doc/guides/nics/features/ngbe.ini
> index 1006c3935b..d14469eb43 100644
> --- a/doc/guides/nics/features/ngbe.ini
> +++ b/doc/guides/nics/features/ngbe.ini
> @@ -7,6 +7,7 @@
> Speed capabilities = Y
> Link status = Y
> Link status event = Y
> +Rx interrupt = Y
This also requires configuring Rx interrupts if user 'dev_conf.intr_conf.rxq'
config requests it.
Is an application can request and use Rx interrupts with current status of the
driver? Did you test it?
On September 16, 2021 12:54 AM, Ferruh Yigit wrote:
> On 9/8/2021 9:37 AM, Jiawen Wu wrote:
> > Support Rx queue interrupt.
> >
> > 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 | 35
> +++++++++++++++++++++++++++++++
> > 3 files changed, 37 insertions(+)
> >
> > diff --git a/doc/guides/nics/features/ngbe.ini
> > b/doc/guides/nics/features/ngbe.ini
> > index 1006c3935b..d14469eb43 100644
> > --- a/doc/guides/nics/features/ngbe.ini
> > +++ b/doc/guides/nics/features/ngbe.ini
> > @@ -7,6 +7,7 @@
> > Speed capabilities = Y
> > Link status = Y
> > Link status event = Y
> > +Rx interrupt = Y
>
> This also requires configuring Rx interrupts if user 'dev_conf.intr_conf.rxq'
> config requests it.
>
> Is an application can request and use Rx interrupts with current status of the
> driver? Did you test it?
I can't find the corresponding test case in examples, could you give me a suggestion?
I just configured almost the same registers as the kernel driver before.
But now I'll drop this feature first, and wait for a successful test result.
@@ -7,6 +7,7 @@
Speed capabilities = Y
Link status = Y
Link status event = Y
+Rx interrupt = Y
Queue start/stop = Y
MTU update = Y
Jumbo frame = Y
@@ -20,6 +20,7 @@ Features
- Port hardware statistics
- Jumbo frames
- Link state information
+- Interrupt mode for RX
- Scattered and gather for TX and RX
- FW version
@@ -2095,6 +2095,39 @@ ngbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
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;
+ uint32_t mask;
+ struct ngbe_hw *hw = ngbe_dev_hw(dev);
+
+ if (queue_id < 32) {
+ mask = rd32(hw, NGBE_IMS(0));
+ mask &= (1 << queue_id);
+ wr32(hw, NGBE_IMS(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)
+{
+ uint32_t mask;
+ struct ngbe_hw *hw = ngbe_dev_hw(dev);
+
+ if (queue_id < 32) {
+ 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
@@ -2215,6 +2248,8 @@ static const struct eth_dev_ops ngbe_eth_dev_ops = {
.tx_queue_start = ngbe_dev_tx_queue_start,
.tx_queue_stop = ngbe_dev_tx_queue_stop,
.rx_queue_setup = ngbe_dev_rx_queue_setup,
+ .rx_queue_intr_enable = ngbe_dev_rx_queue_intr_enable,
+ .rx_queue_intr_disable = ngbe_dev_rx_queue_intr_disable,
.rx_queue_release = ngbe_dev_rx_queue_release,
.tx_queue_setup = ngbe_dev_tx_queue_setup,
.tx_queue_release = ngbe_dev_tx_queue_release,