Skip to content

Commit

Permalink
Merge branch 'ENA-driver-bug-fixes'
Browse files Browse the repository at this point in the history
Arthur Kiyanovski says:

====================
ENA driver bug fixes
====================

Acked-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Mar 18, 2020
2 parents 872307a + dfdde13 commit 1553857
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions drivers/net/ethernet/amazon/ena/ena_netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1018,13 +1018,9 @@ static int ena_refill_rx_bufs(struct ena_ring *rx_ring, u32 num)
struct ena_rx_buffer *rx_info;

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

rx_info = &rx_ring->rx_buffer_info[req_id];


rc = ena_alloc_rx_page(rx_ring, rx_info,
GFP_ATOMIC | __GFP_COMP);
if (unlikely(rc < 0)) {
Expand Down Expand Up @@ -1379,9 +1375,15 @@ static struct sk_buff *ena_rx_skb(struct ena_ring *rx_ring,
struct ena_rx_buffer *rx_info;
u16 len, req_id, buf = 0;
void *va;
int rc;

len = ena_bufs[buf].len;
req_id = ena_bufs[buf].req_id;

rc = validate_rx_req_id(rx_ring, req_id);
if (unlikely(rc < 0))
return NULL;

rx_info = &rx_ring->rx_buffer_info[req_id];

if (unlikely(!rx_info->page)) {
Expand Down Expand Up @@ -1454,6 +1456,11 @@ static struct sk_buff *ena_rx_skb(struct ena_ring *rx_ring,
buf++;
len = ena_bufs[buf].len;
req_id = ena_bufs[buf].req_id;

rc = validate_rx_req_id(rx_ring, req_id);
if (unlikely(rc < 0))
return NULL;

rx_info = &rx_ring->rx_buffer_info[req_id];
} while (1);

Expand Down Expand Up @@ -1968,7 +1975,7 @@ static int ena_enable_msix(struct ena_adapter *adapter)
}

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

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

static int ena_request_io_irq(struct ena_adapter *adapter)
{
u32 io_queue_count = adapter->num_io_queues + adapter->xdp_num_queues;
unsigned long flags = 0;
struct ena_irq *irq;
int rc = 0, i, k;
Expand All @@ -2078,7 +2086,7 @@ static int ena_request_io_irq(struct ena_adapter *adapter)
return -EINVAL;
}

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

static void ena_free_io_irq(struct ena_adapter *adapter)
{
u32 io_queue_count = adapter->num_io_queues + adapter->xdp_num_queues;
struct ena_irq *irq;
int i;

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

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

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

if (!netif_running(adapter->netdev))
return;

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

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

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

0 comments on commit 1553857

Please sign in to comment.