Skip to content

Commit 9440a87

Browse files
arthurfabredavem330
authored andcommitted
sfc: trace_xdp_exception on XDP failure
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 <[email protected]> Acked-by: Edward Cree <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 1e86606 commit 9440a87

File tree

1 file changed

+3
-0
lines changed
  • drivers/net/ethernet/sfc

1 file changed

+3
-0
lines changed

drivers/net/ethernet/sfc/rx.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,7 @@ static bool efx_do_xdp(struct efx_nic *efx, struct efx_channel *channel,
724724
netif_err(efx, rx_err, efx->net_dev,
725725
"XDP TX failed (%d)\n", err);
726726
channel->n_rx_xdp_bad_drops++;
727+
trace_xdp_exception(efx->net_dev, xdp_prog, xdp_act);
727728
} else {
728729
channel->n_rx_xdp_tx++;
729730
}
@@ -737,6 +738,7 @@ static bool efx_do_xdp(struct efx_nic *efx, struct efx_channel *channel,
737738
netif_err(efx, rx_err, efx->net_dev,
738739
"XDP redirect failed (%d)\n", err);
739740
channel->n_rx_xdp_bad_drops++;
741+
trace_xdp_exception(efx->net_dev, xdp_prog, xdp_act);
740742
} else {
741743
channel->n_rx_xdp_redirect++;
742744
}
@@ -746,6 +748,7 @@ static bool efx_do_xdp(struct efx_nic *efx, struct efx_channel *channel,
746748
bpf_warn_invalid_xdp_action(xdp_act);
747749
efx_free_rx_buffers(rx_queue, rx_buf, 1);
748750
channel->n_rx_xdp_bad_drops++;
751+
trace_xdp_exception(efx->net_dev, xdp_prog, xdp_act);
749752
break;
750753

751754
case XDP_ABORTED:

0 commit comments

Comments
 (0)