BPF List
 help / color / mirror / Atom feed
From: Roger Quadros <rogerq@kernel.org>
To: Simon Horman <horms@kernel.org>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Jesper Dangaard Brouer <hawk@kernel.org>,
	John Fastabend <john.fastabend@gmail.com>,
	Siddharth Vadapalli <s-vadapalli@ti.com>,
	Md Danish Anwar <danishanwar@ti.com>,
	srk@ti.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	bpf@vger.kernel.org
Subject: Re: [PATCH net-next 4/5] net: ethernet: ti: am65_cpsw: move am65_cpsw_put_page() out of am65_cpsw_run_xdp()
Date: Mon, 24 Feb 2025 15:00:17 +0200	[thread overview]
Message-ID: <870ae0a7-dc04-4ae2-8485-df9db23db697@kernel.org> (raw)
In-Reply-To: <20250218180340.GF1615191@kernel.org>



On 18/02/2025 20:03, Simon Horman wrote:
> On Mon, Feb 17, 2025 at 09:31:49AM +0200, Roger Quadros wrote:
>> This allows us to re-use am65_cpsw_run_xdp() for zero copy
>> case. Add AM65_CPSW_XDP_TX case for successful XDP_TX so we don't
>> free the page while in flight.
>>
>> Signed-off-by: Roger Quadros <rogerq@kernel.org>
> 
> Reviewed-by: Simon Horman <horms@kernel.org>
> 
>> ---
>>  drivers/net/ethernet/ti/am65-cpsw-nuss.c | 13 ++++++++-----
>>  1 file changed, 8 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
> 
> ...
> 
>> @@ -1230,9 +1230,6 @@ static int am65_cpsw_run_xdp(struct am65_cpsw_rx_flow *flow,
>>  		ndev->stats.rx_dropped++;
>>  	}
>>  
>> -	page = virt_to_head_page(xdp->data);
>> -	am65_cpsw_put_page(flow, page, true);
>> -
>>  	return ret;
> 
> It seems that before and after this patch ret is always initialised to
> AM65_CPSW_XDP_CONSUMED and never changed. So it can be removed.
> 
> Given that with this patch the function only returns after the switch
> statement, I think this would be a nice follow-up.
> 
> diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
> index 20a4fc3e579f..4052c9153632 100644
> --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c
> +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
> @@ -1172,7 +1172,6 @@ static int am65_cpsw_run_xdp(struct am65_cpsw_rx_flow *flow,
>  {
>  	struct am65_cpsw_common *common = flow->common;
>  	struct net_device *ndev = port->ndev;
> -	int ret = AM65_CPSW_XDP_CONSUMED;
>  	struct am65_cpsw_tx_chn *tx_chn;
>  	struct netdev_queue *netif_txq;
>  	int cpu = smp_processor_id();
> @@ -1228,9 +1227,8 @@ static int am65_cpsw_run_xdp(struct am65_cpsw_rx_flow *flow,
>  		fallthrough;
>  	case XDP_DROP:
>  		ndev->stats.rx_dropped++;
> +		return AM65_CPSW_XDP_CONSUMED;
>  	}
> -
> -	return ret;
>  }
>  
>  /* RX psdata[2] word format - checksum information */
> 
> ...

Thank you for this suggestion. I will add this cleanup in my next set of patches.

-- 
cheers,
-roger


  reply	other threads:[~2025-02-24 13:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-17  7:31 [PATCH net-next 0/5] net: ethernet: ti: am65-cpsw: drop multiple functions and code cleanup Roger Quadros
2025-02-17  7:31 ` [PATCH net-next 1/5] net: ethernet: ti: am65-cpsw: remove am65_cpsw_nuss_tx_compl_packets_2g() Roger Quadros
2025-02-18 18:01   ` Simon Horman
2025-02-17  7:31 ` [PATCH net-next 2/5] net: ethernet: ti: am65_cpsw: remove cpu argument am65_cpsw_run_xdp Roger Quadros
2025-02-18 18:01   ` Simon Horman
2025-02-17  7:31 ` [PATCH net-next 3/5] net: ethernet: ti: am65-cpsw: use return instead of goto in am65_cpsw_run_xdp() Roger Quadros
2025-02-18 18:02   ` Simon Horman
2025-02-17  7:31 ` [PATCH net-next 4/5] net: ethernet: ti: am65_cpsw: move am65_cpsw_put_page() out of am65_cpsw_run_xdp() Roger Quadros
2025-02-18 18:03   ` Simon Horman
2025-02-24 13:00     ` Roger Quadros [this message]
2025-02-17  7:31 ` [PATCH net-next 5/5] net: ethernet: ti am65_cpsw: Drop separate TX completion functions Roger Quadros
2025-02-18 18:04   ` Simon Horman
2025-02-19 12:00 ` [PATCH net-next 0/5] net: ethernet: ti: am65-cpsw: drop multiple functions and code cleanup 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=870ae0a7-dc04-4ae2-8485-df9db23db697@kernel.org \
    --to=rogerq@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=danishanwar@ti.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=horms@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=s-vadapalli@ti.com \
    --cc=srk@ti.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