* [PATCH] net: alteon: migrate to dma_map_phys instead of map_page
@ 2025-10-21 2:09 Chu Guangqing
2025-10-22 23:52 ` Jacob Keller
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Chu Guangqing @ 2025-10-21 2:09 UTC (permalink / raw)
To: jes, andrew+netdev, davem, edumazet, kuba, pabeni
Cc: linux-acenic, netdev, linux-kernel, Chu Guangqing
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/alteon/acenic.c | 26 +++++++++++---------------
1 file changed, 11 insertions(+), 15 deletions(-)
diff --git a/drivers/net/ethernet/alteon/acenic.c b/drivers/net/ethernet/alteon/acenic.c
index 9e6f91df2ba0..090413f1eba7 100644
--- a/drivers/net/ethernet/alteon/acenic.c
+++ b/drivers/net/ethernet/alteon/acenic.c
@@ -1639,10 +1639,9 @@ static void ace_load_std_rx_ring(struct net_device *dev, int nr_bufs)
if (!skb)
break;
- mapping = dma_map_page(&ap->pdev->dev,
- virt_to_page(skb->data),
- offset_in_page(skb->data),
- ACE_STD_BUFSIZE, DMA_FROM_DEVICE);
+ mapping = dma_map_phys(&ap->pdev->dev,
+ virt_to_phys(skb->data),
+ ACE_STD_BUFSIZE, DMA_FROM_DEVICE, 0);
ap->skb->rx_std_skbuff[idx].skb = skb;
dma_unmap_addr_set(&ap->skb->rx_std_skbuff[idx],
mapping, mapping);
@@ -1700,10 +1699,9 @@ static void ace_load_mini_rx_ring(struct net_device *dev, int nr_bufs)
if (!skb)
break;
- mapping = dma_map_page(&ap->pdev->dev,
- virt_to_page(skb->data),
- offset_in_page(skb->data),
- ACE_MINI_BUFSIZE, DMA_FROM_DEVICE);
+ mapping = dma_map_phys(&ap->pdev->dev,
+ virt_to_phys(skb->data),
+ ACE_MINI_BUFSIZE, DMA_FROM_DEVICE, 0);
ap->skb->rx_mini_skbuff[idx].skb = skb;
dma_unmap_addr_set(&ap->skb->rx_mini_skbuff[idx],
mapping, mapping);
@@ -1756,10 +1754,9 @@ static void ace_load_jumbo_rx_ring(struct net_device *dev, int nr_bufs)
if (!skb)
break;
- mapping = dma_map_page(&ap->pdev->dev,
- virt_to_page(skb->data),
- offset_in_page(skb->data),
- ACE_JUMBO_BUFSIZE, DMA_FROM_DEVICE);
+ mapping = dma_map_phys(&ap->pdev->dev,
+ virt_to_phys(skb->data),
+ ACE_JUMBO_BUFSIZE, DMA_FROM_DEVICE, 0);
ap->skb->rx_jumbo_skbuff[idx].skb = skb;
dma_unmap_addr_set(&ap->skb->rx_jumbo_skbuff[idx],
mapping, mapping);
@@ -2362,9 +2359,8 @@ ace_map_tx_skb(struct ace_private *ap, struct sk_buff *skb,
dma_addr_t mapping;
struct tx_ring_info *info;
- mapping = dma_map_page(&ap->pdev->dev, virt_to_page(skb->data),
- offset_in_page(skb->data), skb->len,
- DMA_TO_DEVICE);
+ mapping = dma_map_phys(&ap->pdev->dev, skb->data,
+ skb->len, DMA_TO_DEVICE, 0);
info = ap->skb->tx_skbuff + idx;
info->skb = tail;
--
2.43.7
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] net: alteon: migrate to dma_map_phys instead of map_page
2025-10-21 2:09 [PATCH] net: alteon: migrate to dma_map_phys instead of map_page Chu Guangqing
@ 2025-10-22 23:52 ` Jacob Keller
2025-10-23 11:03 ` Paolo Abeni
2025-10-27 13:52 ` Leon Romanovsky
2 siblings, 0 replies; 4+ messages in thread
From: Jacob Keller @ 2025-10-22 23:52 UTC (permalink / raw)
To: Chu Guangqing, jes, andrew+netdev, davem, edumazet, kuba, pabeni
Cc: linux-acenic, netdev, linux-kernel
[-- Attachment #1.1: Type: text/plain, Size: 819 bytes --]
On 10/20/2025 7:09 PM, 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>
> ---
Subject should include the tree tag to help automation when determining
where to apply the patch. Since this isn't a fix, this should target the
next tree with [PATCH net-next]. In the future try to remember to
include the tree in your tags for the subject.
The change itself looks reasonable. This converts the chain of
virt_to_page and offset_in_page of the driver followed by page_to_phys
in the core dma_map_page code into just virt_to_phys in the driver.
Makes sense.
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net: alteon: migrate to dma_map_phys instead of map_page
2025-10-21 2:09 [PATCH] net: alteon: migrate to dma_map_phys instead of map_page Chu Guangqing
2025-10-22 23:52 ` Jacob Keller
@ 2025-10-23 11:03 ` Paolo Abeni
2025-10-27 13:52 ` Leon Romanovsky
2 siblings, 0 replies; 4+ messages in thread
From: Paolo Abeni @ 2025-10-23 11:03 UTC (permalink / raw)
To: Chu Guangqing, jes, andrew+netdev, davem, edumazet, kuba
Cc: linux-acenic, netdev, linux-kernel
On 10/21/25 4:09 AM, Chu Guangqing wrote:
> @@ -2362,9 +2359,8 @@ ace_map_tx_skb(struct ace_private *ap, struct sk_buff *skb,
> dma_addr_t mapping;
> struct tx_ring_info *info;
>
> - mapping = dma_map_page(&ap->pdev->dev, virt_to_page(skb->data),
> - offset_in_page(skb->data), skb->len,
> - DMA_TO_DEVICE);
> + mapping = dma_map_phys(&ap->pdev->dev, skb->data,
> + skb->len, DMA_TO_DEVICE, 0);
It looks like here a virt_to_phys() is missing around skb->data.
/P
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net: alteon: migrate to dma_map_phys instead of map_page
2025-10-21 2:09 [PATCH] net: alteon: migrate to dma_map_phys instead of map_page Chu Guangqing
2025-10-22 23:52 ` Jacob Keller
2025-10-23 11:03 ` Paolo Abeni
@ 2025-10-27 13:52 ` Leon Romanovsky
2 siblings, 0 replies; 4+ messages in thread
From: Leon Romanovsky @ 2025-10-27 13:52 UTC (permalink / raw)
To: Chu Guangqing
Cc: jes, andrew+netdev, davem, edumazet, kuba, pabeni, linux-acenic,
netdev, linux-kernel
On Tue, Oct 21, 2025 at 10:09:39AM +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/alteon/acenic.c | 26 +++++++++++---------------
> 1 file changed, 11 insertions(+), 15 deletions(-)
I don't see dma_unmap_phys() in this patch.
Thanks
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-10-27 13:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-21 2:09 [PATCH] net: alteon: migrate to dma_map_phys instead of map_page Chu Guangqing
2025-10-22 23:52 ` Jacob Keller
2025-10-23 11:03 ` Paolo Abeni
2025-10-27 13:52 ` Leon Romanovsky
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).