Skip to content

Commit 5c665f8

Browse files
Sameeh Jubrandavem330
authored andcommitted
net: ena: add support for reporting of packet drops
1. Add support for getting tx drops from the device and saving them in the driver. 2. Report tx via netdev stats. Signed-off-by: Igor Chauskin <[email protected]> Signed-off-by: Guy Tzalik <[email protected]> Signed-off-by: Arthur Kiyanovski <[email protected]> Signed-off-by: Sameeh Jubran <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d4a8b3b commit 5c665f8

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,10 @@ struct ena_admin_basic_stats {
404404
u32 rx_drops_low;
405405

406406
u32 rx_drops_high;
407+
408+
u32 tx_drops_low;
409+
410+
u32 tx_drops_high;
407411
};
408412

409413
struct ena_admin_acq_get_stats_resp {
@@ -1017,6 +1021,10 @@ struct ena_admin_aenq_keep_alive_desc {
10171021
u32 rx_drops_low;
10181022

10191023
u32 rx_drops_high;
1024+
1025+
u32 tx_drops_low;
1026+
1027+
u32 tx_drops_high;
10201028
};
10211029

10221030
struct ena_admin_ena_mmio_req_read_less_resp {

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3172,6 +3172,7 @@ static void ena_get_stats64(struct net_device *netdev,
31723172
struct ena_ring *rx_ring, *tx_ring;
31733173
unsigned int start;
31743174
u64 rx_drops;
3175+
u64 tx_drops;
31753176
int i;
31763177

31773178
if (!test_bit(ENA_FLAG_DEV_UP, &adapter->flags))
@@ -3206,9 +3207,11 @@ static void ena_get_stats64(struct net_device *netdev,
32063207
do {
32073208
start = u64_stats_fetch_begin_irq(&adapter->syncp);
32083209
rx_drops = adapter->dev_stats.rx_drops;
3210+
tx_drops = adapter->dev_stats.tx_drops;
32093211
} while (u64_stats_fetch_retry_irq(&adapter->syncp, start));
32103212

32113213
stats->rx_dropped = rx_drops;
3214+
stats->tx_dropped = tx_drops;
32123215

32133216
stats->multicast = 0;
32143217
stats->collisions = 0;
@@ -4517,14 +4520,17 @@ static void ena_keep_alive_wd(void *adapter_data,
45174520
struct ena_adapter *adapter = (struct ena_adapter *)adapter_data;
45184521
struct ena_admin_aenq_keep_alive_desc *desc;
45194522
u64 rx_drops;
4523+
u64 tx_drops;
45204524

45214525
desc = (struct ena_admin_aenq_keep_alive_desc *)aenq_e;
45224526
adapter->last_keep_alive_jiffies = jiffies;
45234527

45244528
rx_drops = ((u64)desc->rx_drops_high << 32) | desc->rx_drops_low;
4529+
tx_drops = ((u64)desc->tx_drops_high << 32) | desc->tx_drops_low;
45254530

45264531
u64_stats_update_begin(&adapter->syncp);
45274532
adapter->dev_stats.rx_drops = rx_drops;
4533+
adapter->dev_stats.tx_drops = tx_drops;
45284534
u64_stats_update_end(&adapter->syncp);
45294535
}
45304536

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ struct ena_stats_dev {
334334
u64 interface_down;
335335
u64 admin_q_pause;
336336
u64 rx_drops;
337+
u64 tx_drops;
337338
};
338339

339340
enum ena_flags_t {

0 commit comments

Comments
 (0)