mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.e.keller@intel.com>
To: Wei Fang <wei.fang@nxp.com>, <davem@davemloft.net>,
	<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<ast@kernel.org>, <daniel@iogearbox.net>, <hawk@kernel.org>,
	<john.fastabend@gmail.com>, <shenwei.wang@nxp.com>,
	<xiaoning.wang@nxp.com>, <netdev@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <bpf@vger.kernel.org>,
	<linux-imx@nxp.com>
Subject: Re: [PATCH net-next] net: fec: add exception tracing for XDP
Date: Wed, 23 Aug 2023 12:44:28 -0700	[thread overview]
Message-ID: <f6a026c5-d86d-6016-c0f2-b14e801016ac@intel.com> (raw)
In-Reply-To: <20230822065255.606739-1-wei.fang@nxp.com>



On 8/21/2023 11:52 PM, Wei Fang wrote:
> As we already added the exception tracing for XDP_TX, I think it is
> necessary to add the exception tracing for other XDP actions, such
> as XDP_REDIRECT, XDP_ABORTED and unknown error actions.
> 
> Signed-off-by: Wei Fang <wei.fang@nxp.com>
> Suggested-by: Jakub Kicinski <kuba@kernel.org>
> ---

Makes sense to me, and it ends up being a bit less code.

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>

>  drivers/net/ethernet/freescale/fec_main.c | 26 ++++++++++-------------
>  1 file changed, 11 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
> index e23a55977183..8909899e9a31 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -1583,25 +1583,18 @@ fec_enet_run_xdp(struct fec_enet_private *fep, struct bpf_prog *prog,
>  	case XDP_REDIRECT:
>  		rxq->stats[RX_XDP_REDIRECT]++;
>  		err = xdp_do_redirect(fep->netdev, xdp, prog);
> -		if (!err) {
> -			ret = FEC_ENET_XDP_REDIR;
> -		} else {
> -			ret = FEC_ENET_XDP_CONSUMED;
> -			page = virt_to_head_page(xdp->data);
> -			page_pool_put_page(rxq->page_pool, page, sync, true);
> -		}
> +		if (unlikely(err))
> +			goto xdp_err;
> +
> +		ret = FEC_ENET_XDP_REDIR;
>  		break;
>  
>  	case XDP_TX:
>  		err = fec_enet_xdp_tx_xmit(fep, cpu, xdp, sync);
> -		if (unlikely(err)) {
> -			ret = FEC_ENET_XDP_CONSUMED;
> -			page = virt_to_head_page(xdp->data);
> -			page_pool_put_page(rxq->page_pool, page, sync, true);
> -			trace_xdp_exception(fep->netdev, prog, act);
> -		} else {
> -			ret = FEC_ENET_XDP_TX;
> -		}
> +		if (unlikely(err))
> +			goto xdp_err;
> +
> +		ret = FEC_ENET_XDP_TX;
>  		break;
>  
>  	default:
> @@ -1613,9 +1606,12 @@ fec_enet_run_xdp(struct fec_enet_private *fep, struct bpf_prog *prog,
>  
>  	case XDP_DROP:
>  		rxq->stats[RX_XDP_DROP]++;
> +xdp_err:
>  		ret = FEC_ENET_XDP_CONSUMED;
>  		page = virt_to_head_page(xdp->data);
>  		page_pool_put_page(rxq->page_pool, page, sync, true);

Ok, so we handle the cleaning up of the page and such here, which is
shared for both paths now. Nice!

> +		if (act != XDP_DROP)
> +			trace_xdp_exception(fep->netdev, prog, act);
>  		break;
>  	}
>  

  reply	other threads:[~2023-08-23 19:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-22  6:52 Wei Fang
2023-08-23 19:44 ` Jacob Keller [this message]
2023-08-24  2:30 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f6a026c5-d86d-6016-c0f2-b14e801016ac@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shenwei.wang@nxp.com \
    --cc=wei.fang@nxp.com \
    --cc=xiaoning.wang@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®