Subject: Re: [PATCH net-next v1] ps3_gelic_net: Use napi routines for RX SKB

From: Jakub Kicinski <[email-masked]>
Date: Mon, 4 Mar 2024 20:42:49 -0800

On Fri, 1 Mar 2024 17:20:11 +0900 Geoff Levand wrote:
> +	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);

After you called napi_build_skb() you should be operating (here:
freeing) the skb not the underlying buffer.
-- 
pw-bot: cr