Re: [PATCH net-next] sfc: trace_xdp_exception on XDP failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/11/2019 10:51, 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 to
> easily monitor this from userspace.
>
> This mirrors the behavior of other drivers.
>
> Signed-off-by: Arthur Fabre <afabre@xxxxxxxxxxxxxx>
> ---
>  drivers/net/ethernet/sfc/rx.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c
> index a7d9841105d8..5bfe1f6112a1 100644
> --- a/drivers/net/ethernet/sfc/rx.c
> +++ b/drivers/net/ethernet/sfc/rx.c
> @@ -678,6 +678,7 @@ static bool efx_do_xdp(struct efx_nic *efx, struct efx_channel *channel,
>  				  "XDP is not possible with multiple receive fragments (%d)\n",
>  				  channel->rx_pkt_n_frags);
>  		channel->n_rx_xdp_bad_drops++;
> +		trace_xdp_exception(efx->net_dev, xdp_prog, xdp_act);
>  		return false;
>  	}
AIUI trace_xdp_exception() is improper here as we have not run
 the XDP program (and xdp_act is thus uninitialised).

The other three, below, appear to be correct.
-Ed

>  
> @@ -724,6 +725,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 +739,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 +749,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:




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux