netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ratheesh Kannoth <rkannoth@marvell.com>
To: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: Ratheesh Kannoth <rkannoth@marvell.com>
Subject: Re: [PATCH v1] ps3_gelic_net: Use napi routines for RX SKB
Date: Tue, 5 Mar 2024 10:54:21 +0530	[thread overview]
Message-ID: <20240305052421.1180221-1-rkannoth@marvell.com> (raw)
In-Reply-To: <ddb7f076-06a7-45df-ae98-b4120d9dc275@infradead.org>

On 2024-03-01 at 13:50:11, Geoff Levand (geoff@infradead.org) wrote:
> +	if (unlikely(!napi_buff))
> +		return -ENOMEM;
>
> -	descr->skb = netdev_alloc_skb(*card->netdev, rx_skb_size);
> -	if (!descr->skb) {
> -		descr->hw_regs.payload.dev_addr = 0; /* tell DMAC don't touch memory */
> +	descr->skb = napi_build_skb(napi_buff, napi_buff_size);
> +
> +	if (unlikely(!descr->skb)) {
> +		skb_free_frag(napi_buff);
>  		return -ENOMEM;
>  	}
>
> -	offset = ((unsigned long)descr->skb->data) &
> -		(GELIC_NET_RXBUF_ALIGN - 1);
> -	if (offset)
> -		skb_reserve(descr->skb, GELIC_NET_RXBUF_ALIGN - offset);
> -	/* io-mmu-map the skb */
> -	cpu_addr = dma_map_single(ctodev(card), descr->skb->data,
> -				  GELIC_NET_MAX_FRAME, DMA_FROM_DEVICE);
> -	descr->hw_regs.payload.dev_addr = cpu_to_be32(cpu_addr);
> -	if (dma_mapping_error(ctodev(card), cpu_addr)) {
> -		dev_kfree_skb_any(descr->skb);
> +	cpu_addr = dma_map_single(dev, napi_buff, napi_buff_size,
> +				  DMA_FROM_DEVICE);
> +
> +	if (dma_mapping_error(dev, cpu_addr)) {
> +		skb_free_frag(napi_buff);
skb->head is freed; dont you need to free skb as well ?

>  		descr->skb = NULL;

      parent reply	other threads:[~2024-03-05  5:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-01  8:20 [PATCH net-next v1] ps3_gelic_net: Use napi routines for RX SKB Geoff Levand
2024-03-05  4:42 ` Jakub Kicinski
2024-03-05  5:24 ` Ratheesh Kannoth [this message]

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=20240305052421.1180221-1-rkannoth@marvell.com \
    --to=rkannoth@marvell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).