netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Chu Guangqing <chuguangqing@inspur.com>
Cc: cooldavid@cooldavid.org, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH for-next 1/1] net: jme: migrate to dma_map_phys instead of map_page
Date: Mon, 27 Oct 2025 16:35:16 +0200	[thread overview]
Message-ID: <20251027143516.GN12554@unreal> (raw)
In-Reply-To: <20251024070734.34353-2-chuguangqing@inspur.com>

On Fri, Oct 24, 2025 at 03:07:34PM +0800, Chu Guangqing wrote:
> After introduction of dma_map_phys(), there is no need to convert
> from physical address to struct page in order to map page. So let's
> use it directly.
> 
> Signed-off-by: Chu Guangqing <chuguangqing@inspur.com>
> ---
>  drivers/net/ethernet/jme.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/jme.c b/drivers/net/ethernet/jme.c
> index d8be0e4dcb07..7ceeb706939d 100644
> --- a/drivers/net/ethernet/jme.c
> +++ b/drivers/net/ethernet/jme.c
> @@ -735,9 +735,10 @@ jme_make_new_rx_buf(struct jme_adapter *jme, int i)
>  	if (unlikely(!skb))
>  		return -ENOMEM;
>  
> -	mapping = dma_map_page(&jme->pdev->dev, virt_to_page(skb->data),
> -			       offset_in_page(skb->data), skb_tailroom(skb),
> -			       DMA_FROM_DEVICE);
> +	mapping = dma_map_phys(&jme->pdev->dev, virt_to_phys(skb->data),
> +			       skb_tailroom(skb),
> +			       DMA_FROM_DEVICE,
> +			       0);

Same comment as before, dma_map_phys() should be paired with dma_unmap_phys().

Thanks

>  	if (unlikely(dma_mapping_error(&jme->pdev->dev, mapping))) {
>  		dev_kfree_skb(skb);
>  		return -ENOMEM;
> -- 
> 2.43.7
> 
> 

      parent reply	other threads:[~2025-10-27 14:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-24  7:07 [PATCH for-next 0/1] net: jme: migrate to dma_map_phys instead of map_page Chu Guangqing
2025-10-24  7:07 ` [PATCH for-next 1/1] " Chu Guangqing
2025-10-24 17:27   ` Simon Horman
2025-10-27 14:35   ` Leon Romanovsky [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=20251027143516.GN12554@unreal \
    --to=leon@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=chuguangqing@inspur.com \
    --cc=cooldavid@cooldavid.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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;
as well as URLs for NNTP newsgroup(s).