Skip to content

Commit cb3d4f9

Browse files
akiyanodavem330
authored andcommitted
net: ena: Fix wrong rx request id by resetting device
A wrong request id received from the device is a sign that something is wrong with it, therefore trigger a device reset. Also add some debug info to the "Page is NULL" print to make it easier to debug. Fixes: 1738cd3 ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)") Signed-off-by: Arthur Kiyanovski <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c255a34 commit cb3d4f9

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1428,6 +1428,7 @@ static struct sk_buff *ena_rx_skb(struct ena_ring *rx_ring,
14281428
u16 *next_to_clean)
14291429
{
14301430
struct ena_rx_buffer *rx_info;
1431+
struct ena_adapter *adapter;
14311432
u16 len, req_id, buf = 0;
14321433
struct sk_buff *skb;
14331434
void *page_addr;
@@ -1440,8 +1441,14 @@ static struct sk_buff *ena_rx_skb(struct ena_ring *rx_ring,
14401441
rx_info = &rx_ring->rx_buffer_info[req_id];
14411442

14421443
if (unlikely(!rx_info->page)) {
1443-
netif_err(rx_ring->adapter, rx_err, rx_ring->netdev,
1444-
"Page is NULL\n");
1444+
adapter = rx_ring->adapter;
1445+
netif_err(adapter, rx_err, rx_ring->netdev,
1446+
"Page is NULL. qid %u req_id %u\n", rx_ring->qid, req_id);
1447+
ena_increase_stat(&rx_ring->rx_stats.bad_req_id, 1, &rx_ring->syncp);
1448+
adapter->reset_reason = ENA_REGS_RESET_INV_RX_REQ_ID;
1449+
/* Make sure reset reason is set before triggering the reset */
1450+
smp_mb__before_atomic();
1451+
set_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags);
14451452
return NULL;
14461453
}
14471454

0 commit comments

Comments
 (0)