Commit 5c665f8c authored by Sameeh Jubran's avatar Sameeh Jubran Committed by David S. Miller

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: default avatarIgor Chauskin <igorch@amazon.com>
Signed-off-by: default avatarGuy Tzalik <gtzalik@amazon.com>
Signed-off-by: default avatarArthur Kiyanovski <akiyano@amazon.com>
Signed-off-by: default avatarSameeh Jubran <sameehj@amazon.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d4a8b3bb
...@@ -404,6 +404,10 @@ struct ena_admin_basic_stats { ...@@ -404,6 +404,10 @@ struct ena_admin_basic_stats {
u32 rx_drops_low; u32 rx_drops_low;
u32 rx_drops_high; u32 rx_drops_high;
u32 tx_drops_low;
u32 tx_drops_high;
}; };
struct ena_admin_acq_get_stats_resp { struct ena_admin_acq_get_stats_resp {
...@@ -1017,6 +1021,10 @@ struct ena_admin_aenq_keep_alive_desc { ...@@ -1017,6 +1021,10 @@ struct ena_admin_aenq_keep_alive_desc {
u32 rx_drops_low; u32 rx_drops_low;
u32 rx_drops_high; u32 rx_drops_high;
u32 tx_drops_low;
u32 tx_drops_high;
}; };
struct ena_admin_ena_mmio_req_read_less_resp { struct ena_admin_ena_mmio_req_read_less_resp {
......
...@@ -3172,6 +3172,7 @@ static void ena_get_stats64(struct net_device *netdev, ...@@ -3172,6 +3172,7 @@ static void ena_get_stats64(struct net_device *netdev,
struct ena_ring *rx_ring, *tx_ring; struct ena_ring *rx_ring, *tx_ring;
unsigned int start; unsigned int start;
u64 rx_drops; u64 rx_drops;
u64 tx_drops;
int i; int i;
if (!test_bit(ENA_FLAG_DEV_UP, &adapter->flags)) if (!test_bit(ENA_FLAG_DEV_UP, &adapter->flags))
...@@ -3206,9 +3207,11 @@ static void ena_get_stats64(struct net_device *netdev, ...@@ -3206,9 +3207,11 @@ static void ena_get_stats64(struct net_device *netdev,
do { do {
start = u64_stats_fetch_begin_irq(&adapter->syncp); start = u64_stats_fetch_begin_irq(&adapter->syncp);
rx_drops = adapter->dev_stats.rx_drops; rx_drops = adapter->dev_stats.rx_drops;
tx_drops = adapter->dev_stats.tx_drops;
} while (u64_stats_fetch_retry_irq(&adapter->syncp, start)); } while (u64_stats_fetch_retry_irq(&adapter->syncp, start));
stats->rx_dropped = rx_drops; stats->rx_dropped = rx_drops;
stats->tx_dropped = tx_drops;
stats->multicast = 0; stats->multicast = 0;
stats->collisions = 0; stats->collisions = 0;
...@@ -4517,14 +4520,17 @@ static void ena_keep_alive_wd(void *adapter_data, ...@@ -4517,14 +4520,17 @@ static void ena_keep_alive_wd(void *adapter_data,
struct ena_adapter *adapter = (struct ena_adapter *)adapter_data; struct ena_adapter *adapter = (struct ena_adapter *)adapter_data;
struct ena_admin_aenq_keep_alive_desc *desc; struct ena_admin_aenq_keep_alive_desc *desc;
u64 rx_drops; u64 rx_drops;
u64 tx_drops;
desc = (struct ena_admin_aenq_keep_alive_desc *)aenq_e; desc = (struct ena_admin_aenq_keep_alive_desc *)aenq_e;
adapter->last_keep_alive_jiffies = jiffies; adapter->last_keep_alive_jiffies = jiffies;
rx_drops = ((u64)desc->rx_drops_high << 32) | desc->rx_drops_low; rx_drops = ((u64)desc->rx_drops_high << 32) | desc->rx_drops_low;
tx_drops = ((u64)desc->tx_drops_high << 32) | desc->tx_drops_low;
u64_stats_update_begin(&adapter->syncp); u64_stats_update_begin(&adapter->syncp);
adapter->dev_stats.rx_drops = rx_drops; adapter->dev_stats.rx_drops = rx_drops;
adapter->dev_stats.tx_drops = tx_drops;
u64_stats_update_end(&adapter->syncp); u64_stats_update_end(&adapter->syncp);
} }
......
...@@ -334,6 +334,7 @@ struct ena_stats_dev { ...@@ -334,6 +334,7 @@ struct ena_stats_dev {
u64 interface_down; u64 interface_down;
u64 admin_q_pause; u64 admin_q_pause;
u64 rx_drops; u64 rx_drops;
u64 tx_drops;
}; };
enum ena_flags_t { enum ena_flags_t {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment