Skip to content

Commit 11095fd

Browse files
NetanelBelgazaldavem330
authored andcommitted
net: ena: add statistics for missed tx packets
Add a new statistic to ethtool stats that show the number of packets without transmit acknowledgement from ENA device. Signed-off-by: Netanel Belgazal <netanel@amazon.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 8c5c7ab commit 11095fd

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ static const struct ena_stats ena_stats_tx_strings[] = {
8181
ENA_STAT_TX_ENTRY(doorbells),
8282
ENA_STAT_TX_ENTRY(prepare_ctx_err),
8383
ENA_STAT_TX_ENTRY(bad_req_id),
84+
ENA_STAT_TX_ENTRY(missed_tx),
8485
};
8586

8687
static const struct ena_stats ena_stats_rx_strings[] = {

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

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2648,7 +2648,7 @@ static int check_missing_comp_in_queue(struct ena_adapter *adapter,
26482648
struct ena_tx_buffer *tx_buf;
26492649
unsigned long last_jiffies;
26502650
u32 missed_tx = 0;
2651-
int i;
2651+
int i, rc = 0;
26522652

26532653
for (i = 0; i < tx_ring->ring_size; i++) {
26542654
tx_buf = &tx_ring->tx_buffer_info[i];
@@ -2662,21 +2662,25 @@ static int check_missing_comp_in_queue(struct ena_adapter *adapter,
26622662

26632663
tx_buf->print_once = 1;
26642664
missed_tx++;
2665-
2666-
if (unlikely(missed_tx > adapter->missing_tx_completion_threshold)) {
2667-
netif_err(adapter, tx_err, adapter->netdev,
2668-
"The number of lost tx completions is above the threshold (%d > %d). Reset the device\n",
2669-
missed_tx,
2670-
adapter->missing_tx_completion_threshold);
2671-
adapter->reset_reason =
2672-
ENA_REGS_RESET_MISS_TX_CMPL;
2673-
set_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags);
2674-
return -EIO;
2675-
}
26762665
}
26772666
}
26782667

2679-
return 0;
2668+
if (unlikely(missed_tx > adapter->missing_tx_completion_threshold)) {
2669+
netif_err(adapter, tx_err, adapter->netdev,
2670+
"The number of lost tx completions is above the threshold (%d > %d). Reset the device\n",
2671+
missed_tx,
2672+
adapter->missing_tx_completion_threshold);
2673+
adapter->reset_reason =
2674+
ENA_REGS_RESET_MISS_TX_CMPL;
2675+
set_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags);
2676+
rc = -EIO;
2677+
}
2678+
2679+
u64_stats_update_begin(&tx_ring->syncp);
2680+
tx_ring->tx_stats.missed_tx = missed_tx;
2681+
u64_stats_update_end(&tx_ring->syncp);
2682+
2683+
return rc;
26802684
}
26812685

26822686
static void check_for_missing_tx_completions(struct ena_adapter *adapter)

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ struct ena_stats_tx {
185185
u64 tx_poll;
186186
u64 doorbells;
187187
u64 bad_req_id;
188+
u64 missed_tx;
188189
};
189190

190191
struct ena_stats_rx {

0 commit comments

Comments
 (0)