Skip to content

Commit 1553857

Browse files
committed
Merge branch 'ENA-driver-bug-fixes'
Arthur Kiyanovski says: ==================== ENA driver bug fixes ==================== Acked-by: Jakub Kicinski <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2 parents 872307a + dfdde13 commit 1553857

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

drivers/net/ethernet/amazon/ena/ena_netdev.c

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,13 +1018,9 @@ static int ena_refill_rx_bufs(struct ena_ring *rx_ring, u32 num)
10181018
struct ena_rx_buffer *rx_info;
10191019

10201020
req_id = rx_ring->free_ids[next_to_use];
1021-
rc = validate_rx_req_id(rx_ring, req_id);
1022-
if (unlikely(rc < 0))
1023-
break;
10241021

10251022
rx_info = &rx_ring->rx_buffer_info[req_id];
10261023

1027-
10281024
rc = ena_alloc_rx_page(rx_ring, rx_info,
10291025
GFP_ATOMIC | __GFP_COMP);
10301026
if (unlikely(rc < 0)) {
@@ -1379,9 +1375,15 @@ static struct sk_buff *ena_rx_skb(struct ena_ring *rx_ring,
13791375
struct ena_rx_buffer *rx_info;
13801376
u16 len, req_id, buf = 0;
13811377
void *va;
1378+
int rc;
13821379

13831380
len = ena_bufs[buf].len;
13841381
req_id = ena_bufs[buf].req_id;
1382+
1383+
rc = validate_rx_req_id(rx_ring, req_id);
1384+
if (unlikely(rc < 0))
1385+
return NULL;
1386+
13851387
rx_info = &rx_ring->rx_buffer_info[req_id];
13861388

13871389
if (unlikely(!rx_info->page)) {
@@ -1454,6 +1456,11 @@ static struct sk_buff *ena_rx_skb(struct ena_ring *rx_ring,
14541456
buf++;
14551457
len = ena_bufs[buf].len;
14561458
req_id = ena_bufs[buf].req_id;
1459+
1460+
rc = validate_rx_req_id(rx_ring, req_id);
1461+
if (unlikely(rc < 0))
1462+
return NULL;
1463+
14571464
rx_info = &rx_ring->rx_buffer_info[req_id];
14581465
} while (1);
14591466

@@ -1968,7 +1975,7 @@ static int ena_enable_msix(struct ena_adapter *adapter)
19681975
}
19691976

19701977
/* Reserved the max msix vectors we might need */
1971-
msix_vecs = ENA_MAX_MSIX_VEC(adapter->num_io_queues);
1978+
msix_vecs = ENA_MAX_MSIX_VEC(adapter->max_num_io_queues);
19721979
netif_dbg(adapter, probe, adapter->netdev,
19731980
"trying to enable MSI-X, vectors %d\n", msix_vecs);
19741981

@@ -2068,6 +2075,7 @@ static int ena_request_mgmnt_irq(struct ena_adapter *adapter)
20682075

20692076
static int ena_request_io_irq(struct ena_adapter *adapter)
20702077
{
2078+
u32 io_queue_count = adapter->num_io_queues + adapter->xdp_num_queues;
20712079
unsigned long flags = 0;
20722080
struct ena_irq *irq;
20732081
int rc = 0, i, k;
@@ -2078,7 +2086,7 @@ static int ena_request_io_irq(struct ena_adapter *adapter)
20782086
return -EINVAL;
20792087
}
20802088

2081-
for (i = ENA_IO_IRQ_FIRST_IDX; i < adapter->msix_vecs; i++) {
2089+
for (i = ENA_IO_IRQ_FIRST_IDX; i < ENA_MAX_MSIX_VEC(io_queue_count); i++) {
20822090
irq = &adapter->irq_tbl[i];
20832091
rc = request_irq(irq->vector, irq->handler, flags, irq->name,
20842092
irq->data);
@@ -2119,6 +2127,7 @@ static void ena_free_mgmnt_irq(struct ena_adapter *adapter)
21192127

21202128
static void ena_free_io_irq(struct ena_adapter *adapter)
21212129
{
2130+
u32 io_queue_count = adapter->num_io_queues + adapter->xdp_num_queues;
21222131
struct ena_irq *irq;
21232132
int i;
21242133

@@ -2129,7 +2138,7 @@ static void ena_free_io_irq(struct ena_adapter *adapter)
21292138
}
21302139
#endif /* CONFIG_RFS_ACCEL */
21312140

2132-
for (i = ENA_IO_IRQ_FIRST_IDX; i < adapter->msix_vecs; i++) {
2141+
for (i = ENA_IO_IRQ_FIRST_IDX; i < ENA_MAX_MSIX_VEC(io_queue_count); i++) {
21332142
irq = &adapter->irq_tbl[i];
21342143
irq_set_affinity_hint(irq->vector, NULL);
21352144
free_irq(irq->vector, irq->data);
@@ -2144,12 +2153,13 @@ static void ena_disable_msix(struct ena_adapter *adapter)
21442153

21452154
static void ena_disable_io_intr_sync(struct ena_adapter *adapter)
21462155
{
2156+
u32 io_queue_count = adapter->num_io_queues + adapter->xdp_num_queues;
21472157
int i;
21482158

21492159
if (!netif_running(adapter->netdev))
21502160
return;
21512161

2152-
for (i = ENA_IO_IRQ_FIRST_IDX; i < adapter->msix_vecs; i++)
2162+
for (i = ENA_IO_IRQ_FIRST_IDX; i < ENA_MAX_MSIX_VEC(io_queue_count); i++)
21532163
synchronize_irq(adapter->irq_tbl[i].vector);
21542164
}
21552165

@@ -3476,6 +3486,7 @@ static int ena_restore_device(struct ena_adapter *adapter)
34763486
netif_carrier_on(adapter->netdev);
34773487

34783488
mod_timer(&adapter->timer_service, round_jiffies(jiffies + HZ));
3489+
adapter->last_keep_alive_jiffies = jiffies;
34793490
dev_err(&pdev->dev,
34803491
"Device reset completed successfully, Driver info: %s\n",
34813492
version);

0 commit comments

Comments
 (0)