summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sfc/rx.c
diff options
context:
space:
mode:
authorCharles McLachlan <cmclachlan@solarflare.com>2019-10-31 11:24:23 +0100
committerDavid S. Miller <davem@davemloft.net>2019-10-31 22:14:53 +0100
commitcd846bef2d7464b58db01ecd2c6cb20652c5a7a8 (patch)
tree796a3dfa74da61556aec973b6921dc8876ebdb12 /drivers/net/ethernet/sfc/rx.c
parentsfc: handle XDP_TX outcomes of XDP eBPF programs (diff)
downloadlinux-cd846bef2d7464b58db01ecd2c6cb20652c5a7a8.tar.xz
linux-cd846bef2d7464b58db01ecd2c6cb20652c5a7a8.zip
sfc: add XDP counters to ethtool stats
Count XDP packet drops, error drops, transmissions and redirects and expose these counters via the ethtool stats command. Signed-off-by: Charles McLachlan <cmclachlan@solarflare.com> Acked-by: Jesper Dangaard Brouer <brouer@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/sfc/rx.c')
-rw-r--r--drivers/net/ethernet/sfc/rx.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c
index 91f6d5b9ceac..a7d9841105d8 100644
--- a/drivers/net/ethernet/sfc/rx.c
+++ b/drivers/net/ethernet/sfc/rx.c
@@ -677,6 +677,7 @@ static bool efx_do_xdp(struct efx_nic *efx, struct efx_channel *channel,
netif_err(efx, rx_err, efx->net_dev,
"XDP is not possible with multiple receive fragments (%d)\n",
channel->rx_pkt_n_frags);
+ channel->n_rx_xdp_bad_drops++;
return false;
}
@@ -722,6 +723,9 @@ static bool efx_do_xdp(struct efx_nic *efx, struct efx_channel *channel,
if (net_ratelimit())
netif_err(efx, rx_err, efx->net_dev,
"XDP TX failed (%d)\n", err);
+ channel->n_rx_xdp_bad_drops++;
+ } else {
+ channel->n_rx_xdp_tx++;
}
break;
@@ -732,12 +736,16 @@ static bool efx_do_xdp(struct efx_nic *efx, struct efx_channel *channel,
if (net_ratelimit())
netif_err(efx, rx_err, efx->net_dev,
"XDP redirect failed (%d)\n", err);
+ channel->n_rx_xdp_bad_drops++;
+ } else {
+ channel->n_rx_xdp_redirect++;
}
break;
default:
bpf_warn_invalid_xdp_action(xdp_act);
efx_free_rx_buffers(rx_queue, rx_buf, 1);
+ channel->n_rx_xdp_bad_drops++;
break;
case XDP_ABORTED:
@@ -745,6 +753,7 @@ static bool efx_do_xdp(struct efx_nic *efx, struct efx_channel *channel,
/* Fall through */
case XDP_DROP:
efx_free_rx_buffers(rx_queue, rx_buf, 1);
+ channel->n_rx_xdp_drops++;
break;
}