bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 net-next] sfc: trace_xdp_exception on XDP failure
@ 2019-11-12 15:36 Arthur Fabre
  2019-11-12 16:42 ` Edward Cree
  2019-11-12 20:24 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Arthur Fabre @ 2019-11-12 15:36 UTC (permalink / raw)
  To: Solarflare linux maintainers, Edward Cree, Charles McLachlan,
	Martin Habets, David Miller, Alexei Starovoitov, Daniel Borkmann,
	Jakub Kicinski, Jesper Dangaard Brouer, John Fastabend, netdev,
	bpf
  Cc: kernel-team, Arthur Fabre

The sfc driver can drop packets processed with XDP, notably when running
out of buffer space on XDP_TX, or returning an unknown XDP action.
This increments the rx_xdp_bad_drops ethtool counter.

Call trace_xdp_exception everywhere rx_xdp_bad_drops is incremented,
except for fragmented RX packets as the XDP program hasn't run yet.
This allows it to easily be monitored from userspace.

This mirrors the behavior of other drivers.

Signed-off-by: Arthur Fabre <afabre@cloudflare.com>
---

Changes since v1:
- Removed trace_xdp_exception from receive fragements check, as XDP
  program hasn't been run yet

 drivers/net/ethernet/sfc/rx.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c
index a7d9841105d8..bec261905530 100644
--- a/drivers/net/ethernet/sfc/rx.c
+++ b/drivers/net/ethernet/sfc/rx.c
@@ -724,6 +724,7 @@ static bool efx_do_xdp(struct efx_nic *efx, struct efx_channel *channel,
 				netif_err(efx, rx_err, efx->net_dev,
 					  "XDP TX failed (%d)\n", err);
 			channel->n_rx_xdp_bad_drops++;
+			trace_xdp_exception(efx->net_dev, xdp_prog, xdp_act);
 		} else {
 			channel->n_rx_xdp_tx++;
 		}
@@ -737,6 +738,7 @@ static bool efx_do_xdp(struct efx_nic *efx, struct efx_channel *channel,
 				netif_err(efx, rx_err, efx->net_dev,
 					  "XDP redirect failed (%d)\n", err);
 			channel->n_rx_xdp_bad_drops++;
+			trace_xdp_exception(efx->net_dev, xdp_prog, xdp_act);
 		} else {
 			channel->n_rx_xdp_redirect++;
 		}
@@ -746,6 +748,7 @@ static bool efx_do_xdp(struct efx_nic *efx, struct efx_channel *channel,
 		bpf_warn_invalid_xdp_action(xdp_act);
 		efx_free_rx_buffers(rx_queue, rx_buf, 1);
 		channel->n_rx_xdp_bad_drops++;
+		trace_xdp_exception(efx->net_dev, xdp_prog, xdp_act);
 		break;
 
 	case XDP_ABORTED:
-- 
2.24.0.rc2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 net-next] sfc: trace_xdp_exception on XDP failure
  2019-11-12 15:36 [PATCH v2 net-next] sfc: trace_xdp_exception on XDP failure Arthur Fabre
@ 2019-11-12 16:42 ` Edward Cree
  2019-11-12 20:24 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Edward Cree @ 2019-11-12 16:42 UTC (permalink / raw)
  To: Arthur Fabre, Solarflare linux maintainers, Charles McLachlan,
	Martin Habets, David Miller, Alexei Starovoitov, Daniel Borkmann,
	Jakub Kicinski, Jesper Dangaard Brouer, John Fastabend, netdev,
	bpf
  Cc: kernel-team

On 12/11/2019 15:36, Arthur Fabre wrote:
> The sfc driver can drop packets processed with XDP, notably when running
> out of buffer space on XDP_TX, or returning an unknown XDP action.
> This increments the rx_xdp_bad_drops ethtool counter.
>
> Call trace_xdp_exception everywhere rx_xdp_bad_drops is incremented,
> except for fragmented RX packets as the XDP program hasn't run yet.
> This allows it to easily be monitored from userspace.
>
> This mirrors the behavior of other drivers.
>
> Signed-off-by: Arthur Fabre <afabre@cloudflare.com>
Acked-by: Edward Cree <ecree@solarflare.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 net-next] sfc: trace_xdp_exception on XDP failure
  2019-11-12 15:36 [PATCH v2 net-next] sfc: trace_xdp_exception on XDP failure Arthur Fabre
  2019-11-12 16:42 ` Edward Cree
@ 2019-11-12 20:24 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-11-12 20:24 UTC (permalink / raw)
  To: afabre
  Cc: linux-net-drivers, ecree, cmclachlan, mhabets, ast, daniel,
	jakub.kicinski, hawk, john.fastabend, netdev, bpf, kernel-team

From: Arthur Fabre <afabre@cloudflare.com>
Date: Tue, 12 Nov 2019 15:36:01 +0000

> The sfc driver can drop packets processed with XDP, notably when running
> out of buffer space on XDP_TX, or returning an unknown XDP action.
> This increments the rx_xdp_bad_drops ethtool counter.
> 
> Call trace_xdp_exception everywhere rx_xdp_bad_drops is incremented,
> except for fragmented RX packets as the XDP program hasn't run yet.
> This allows it to easily be monitored from userspace.
> 
> This mirrors the behavior of other drivers.
> 
> Signed-off-by: Arthur Fabre <afabre@cloudflare.com>

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-11-12 20:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-12 15:36 [PATCH v2 net-next] sfc: trace_xdp_exception on XDP failure Arthur Fabre
2019-11-12 16:42 ` Edward Cree
2019-11-12 20:24 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).