net: ena: Add first_interrupt field to napi struct
authorSameeh Jubran <sameehj@amazon.com>
Tue, 10 Dec 2019 13:12:14 +0000 (15:12 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 13 Dec 2019 01:14:01 +0000 (17:14 -0800)
The first_interrupt field is accessed in ena_intr_msix_io() upon
receiving an interrupt.The rx_ring and tx_ring fields of napi can
be NULL when receiving interrupt for xdp queues. This patch fixes
the issue by moving the field to the ena_napi struct.

Signed-off-by: Sameeh Jubran <sameehj@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/amazon/ena/ena_netdev.c
drivers/net/ethernet/amazon/ena/ena_netdev.h

index 55eeaab..d161537 100644 (file)
@@ -219,6 +219,7 @@ static int ena_xdp_io_poll(struct napi_struct *napi, int budget)
        int ret;
 
        xdp_ring = ena_napi->xdp_ring;
+       xdp_ring->first_interrupt = ena_napi->first_interrupt;
 
        xdp_budget = budget;
 
@@ -1869,6 +1870,9 @@ static int ena_io_poll(struct napi_struct *napi, int budget)
        tx_ring = ena_napi->tx_ring;
        rx_ring = ena_napi->rx_ring;
 
+       tx_ring->first_interrupt = ena_napi->first_interrupt;
+       rx_ring->first_interrupt = ena_napi->first_interrupt;
+
        tx_budget = tx_ring->ring_size / ENA_TX_POLL_BUDGET_DIVIDER;
 
        if (!test_bit(ENA_FLAG_DEV_UP, &tx_ring->adapter->flags) ||
@@ -1940,8 +1944,7 @@ static irqreturn_t ena_intr_msix_io(int irq, void *data)
 {
        struct ena_napi *ena_napi = data;
 
-       ena_napi->tx_ring->first_interrupt = true;
-       ena_napi->rx_ring->first_interrupt = true;
+       ena_napi->first_interrupt = true;
 
        napi_schedule_irqoff(&ena_napi->napi);
 
index 9bfb275..094324f 100644 (file)
@@ -169,6 +169,7 @@ struct ena_napi {
        struct ena_ring *tx_ring;
        struct ena_ring *rx_ring;
        struct ena_ring *xdp_ring;
+       bool first_interrupt;
        u32 qid;
        struct dim dim;
 };