diff options
author | Eric Dumazet <edumazet@google.com> | 2017-03-08 19:17:14 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-03-09 20:54:46 +0300 |
commit | 7d7bfc6a3f69d2debe104656fadd8d568fda0e5b (patch) | |
tree | 7ad16c7babfd64df6cc7e43a4294f391d44e75d0 /drivers/net/ethernet/mellanox/mlx4/en_rx.c | |
parent | 34db548bfb9580f33d9a7faecafe4da61a4428a3 (diff) | |
download | linux-7d7bfc6a3f69d2debe104656fadd8d568fda0e5b.tar.xz |
mlx4: add rx_alloc_pages counter in ethtool -S
This new counter tracks number of pages that we allocated for one port.
lpaa24:~# ethtool -S eth0 | egrep 'rx_alloc_pages|rx_packets'
rx_packets: 306755183
rx_alloc_pages: 932897
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx4/en_rx.c')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/en_rx.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c index 5edd0cf2999c..d3a425fa46b3 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c @@ -72,6 +72,7 @@ static int mlx4_alloc_page(struct mlx4_en_priv *priv, } static int mlx4_en_alloc_frags(struct mlx4_en_priv *priv, + struct mlx4_en_rx_ring *ring, struct mlx4_en_rx_desc *rx_desc, struct mlx4_en_rx_alloc *frags, gfp_t gfp) @@ -79,8 +80,11 @@ static int mlx4_en_alloc_frags(struct mlx4_en_priv *priv, int i; for (i = 0; i < priv->num_frags; i++, frags++) { - if (!frags->page && mlx4_alloc_page(priv, frags, gfp)) - return -ENOMEM; + if (!frags->page) { + if (mlx4_alloc_page(priv, frags, gfp)) + return -ENOMEM; + ring->rx_alloc_pages++; + } rx_desc->data[i].addr = cpu_to_be64(frags->dma + frags->page_offset); } @@ -133,7 +137,6 @@ static int mlx4_en_prepare_rx_desc(struct mlx4_en_priv *priv, struct mlx4_en_rx_desc *rx_desc = ring->buf + (index * ring->stride); struct mlx4_en_rx_alloc *frags = ring->rx_info + (index << priv->log_rx_info); - if (ring->page_cache.index > 0) { /* XDP uses a single page per frame */ if (!frags->page) { @@ -147,7 +150,7 @@ static int mlx4_en_prepare_rx_desc(struct mlx4_en_priv *priv, return 0; } - return mlx4_en_alloc_frags(priv, rx_desc, frags, gfp); + return mlx4_en_alloc_frags(priv, ring, rx_desc, frags, gfp); } static bool mlx4_en_is_ring_empty(const struct mlx4_en_rx_ring *ring) |