* [PATCH net-next 0/2] net: skb: Remove skb_data_area_size()
@ 2022-05-13 17:33 Ricardo Martinez
2022-05-13 17:33 ` [PATCH net-next 1/2] net: wwan: t7xx: Avoid calls to skb_data_area_size() Ricardo Martinez
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Ricardo Martinez @ 2022-05-13 17:33 UTC (permalink / raw)
To: netdev, linux-wireless
Cc: kuba, davem, johannes, ryazanov.s.a, loic.poulain,
m.chetan.kumar, chandrashekar.devegowda, linuxwwan,
chiranjeevi.rapolu, haijun.liu, andriy.shevchenko, dinesh.sharma,
ilpo.jarvinen, moises.veleta, sreehari.kancharla,
Ricardo Martinez
This patch series removes the skb_data_area_size() helper,
replacing it in t7xx driver with the size used during skb allocation.
https://lore.kernel.org/netdev/CAHNKnsTmH-rGgWi3jtyC=ktM1DW2W1VJkYoTMJV2Z_Bt498bsg@mail.gmail.com/
Ricardo Martinez (2):
net: wwan: t7xx: Avoid calls to skb_data_area_size()
net: skb: Remove skb_data_area_size()
drivers/net/wwan/t7xx/t7xx_hif_cldma.c | 7 +++----
drivers/net/wwan/t7xx/t7xx_hif_dpmaif_rx.c | 6 ++----
include/linux/skbuff.h | 5 -----
3 files changed, 5 insertions(+), 13 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH net-next 1/2] net: wwan: t7xx: Avoid calls to skb_data_area_size()
2022-05-13 17:33 [PATCH net-next 0/2] net: skb: Remove skb_data_area_size() Ricardo Martinez
@ 2022-05-13 17:33 ` Ricardo Martinez
2022-05-13 17:34 ` [PATCH net-next 2/2] net: skb: Remove skb_data_area_size() Ricardo Martinez
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Ricardo Martinez @ 2022-05-13 17:33 UTC (permalink / raw)
To: netdev, linux-wireless
Cc: kuba, davem, johannes, ryazanov.s.a, loic.poulain,
m.chetan.kumar, chandrashekar.devegowda, linuxwwan,
chiranjeevi.rapolu, haijun.liu, andriy.shevchenko, dinesh.sharma,
ilpo.jarvinen, moises.veleta, sreehari.kancharla,
Ricardo Martinez
skb_data_area_size() helper was used to calculate the size of the
DMA mapped buffer passed to the HW. Instead of doing this, use the
size passed to allocate the skbs.
Signed-off-by: Ricardo Martinez <ricardo.martinez@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/net/wwan/t7xx/t7xx_hif_cldma.c | 7 +++----
drivers/net/wwan/t7xx/t7xx_hif_dpmaif_rx.c | 6 ++----
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/drivers/net/wwan/t7xx/t7xx_hif_cldma.c b/drivers/net/wwan/t7xx/t7xx_hif_cldma.c
index 46066dcd2607..0c52801ed0de 100644
--- a/drivers/net/wwan/t7xx/t7xx_hif_cldma.c
+++ b/drivers/net/wwan/t7xx/t7xx_hif_cldma.c
@@ -97,8 +97,7 @@ static int t7xx_cldma_alloc_and_map_skb(struct cldma_ctrl *md_ctrl, struct cldma
if (!req->skb)
return -ENOMEM;
- req->mapped_buff = dma_map_single(md_ctrl->dev, req->skb->data,
- skb_data_area_size(req->skb), DMA_FROM_DEVICE);
+ req->mapped_buff = dma_map_single(md_ctrl->dev, req->skb->data, size, DMA_FROM_DEVICE);
if (dma_mapping_error(md_ctrl->dev, req->mapped_buff)) {
dev_kfree_skb_any(req->skb);
req->skb = NULL;
@@ -154,7 +153,7 @@ static int t7xx_cldma_gpd_rx_from_q(struct cldma_queue *queue, int budget, bool
if (req->mapped_buff) {
dma_unmap_single(md_ctrl->dev, req->mapped_buff,
- skb_data_area_size(skb), DMA_FROM_DEVICE);
+ queue->tr_ring->pkt_size, DMA_FROM_DEVICE);
req->mapped_buff = 0;
}
@@ -376,7 +375,7 @@ static void t7xx_cldma_ring_free(struct cldma_ctrl *md_ctrl,
list_for_each_entry_safe(req_cur, req_next, &ring->gpd_ring, entry) {
if (req_cur->mapped_buff && req_cur->skb) {
dma_unmap_single(md_ctrl->dev, req_cur->mapped_buff,
- skb_data_area_size(req_cur->skb), tx_rx);
+ ring->pkt_size, tx_rx);
req_cur->mapped_buff = 0;
}
diff --git a/drivers/net/wwan/t7xx/t7xx_hif_dpmaif_rx.c b/drivers/net/wwan/t7xx/t7xx_hif_dpmaif_rx.c
index 35a8a0d7c1ee..91a0eb19e0d8 100644
--- a/drivers/net/wwan/t7xx/t7xx_hif_dpmaif_rx.c
+++ b/drivers/net/wwan/t7xx/t7xx_hif_dpmaif_rx.c
@@ -151,14 +151,12 @@ static bool t7xx_alloc_and_map_skb_info(const struct dpmaif_ctrl *dpmaif_ctrl,
{
dma_addr_t data_bus_addr;
struct sk_buff *skb;
- size_t data_len;
skb = __dev_alloc_skb(size, GFP_KERNEL);
if (!skb)
return false;
- data_len = skb_data_area_size(skb);
- data_bus_addr = dma_map_single(dpmaif_ctrl->dev, skb->data, data_len, DMA_FROM_DEVICE);
+ data_bus_addr = dma_map_single(dpmaif_ctrl->dev, skb->data, size, DMA_FROM_DEVICE);
if (dma_mapping_error(dpmaif_ctrl->dev, data_bus_addr)) {
dev_err_ratelimited(dpmaif_ctrl->dev, "DMA mapping error\n");
dev_kfree_skb_any(skb);
@@ -167,7 +165,7 @@ static bool t7xx_alloc_and_map_skb_info(const struct dpmaif_ctrl *dpmaif_ctrl,
cur_skb->skb = skb;
cur_skb->data_bus_addr = data_bus_addr;
- cur_skb->data_len = data_len;
+ cur_skb->data_len = size;
return true;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next 2/2] net: skb: Remove skb_data_area_size()
2022-05-13 17:33 [PATCH net-next 0/2] net: skb: Remove skb_data_area_size() Ricardo Martinez
2022-05-13 17:33 ` [PATCH net-next 1/2] net: wwan: t7xx: Avoid calls to skb_data_area_size() Ricardo Martinez
@ 2022-05-13 17:34 ` Ricardo Martinez
2022-05-16 20:16 ` [PATCH net-next 0/2] " Jakub Kicinski
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Ricardo Martinez @ 2022-05-13 17:34 UTC (permalink / raw)
To: netdev, linux-wireless
Cc: kuba, davem, johannes, ryazanov.s.a, loic.poulain,
m.chetan.kumar, chandrashekar.devegowda, linuxwwan,
chiranjeevi.rapolu, haijun.liu, andriy.shevchenko, dinesh.sharma,
ilpo.jarvinen, moises.veleta, sreehari.kancharla,
Ricardo Martinez
skb_data_area_size() is not needed. As Jakub pointed out [1]:
For Rx, drivers can use the size passed during skb allocation or
use skb_tailroom().
For Tx, drivers should use skb_headlen().
[1] https://lore.kernel.org/netdev/CAHNKnsTmH-rGgWi3jtyC=ktM1DW2W1VJkYoTMJV2Z_Bt498bsg@mail.gmail.com/
Signed-off-by: Ricardo Martinez <ricardo.martinez@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
include/linux/skbuff.h | 5 -----
1 file changed, 5 deletions(-)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 9d82a8b6c8f1..2810a3abe81a 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -1764,11 +1764,6 @@ static inline void skb_set_end_offset(struct sk_buff *skb, unsigned int offset)
}
#endif
-static inline unsigned int skb_data_area_size(struct sk_buff *skb)
-{
- return skb_end_pointer(skb) - skb->data;
-}
-
struct ubuf_info *msg_zerocopy_realloc(struct sock *sk, size_t size,
struct ubuf_info *uarg);
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 0/2] net: skb: Remove skb_data_area_size()
2022-05-13 17:33 [PATCH net-next 0/2] net: skb: Remove skb_data_area_size() Ricardo Martinez
2022-05-13 17:33 ` [PATCH net-next 1/2] net: wwan: t7xx: Avoid calls to skb_data_area_size() Ricardo Martinez
2022-05-13 17:34 ` [PATCH net-next 2/2] net: skb: Remove skb_data_area_size() Ricardo Martinez
@ 2022-05-16 20:16 ` Jakub Kicinski
2022-05-16 20:39 ` Sergey Ryazanov
2022-05-16 22:40 ` patchwork-bot+netdevbpf
4 siblings, 0 replies; 6+ messages in thread
From: Jakub Kicinski @ 2022-05-16 20:16 UTC (permalink / raw)
To: Ricardo Martinez
Cc: netdev, linux-wireless, davem, johannes, ryazanov.s.a,
loic.poulain, m.chetan.kumar, chandrashekar.devegowda, linuxwwan,
chiranjeevi.rapolu, haijun.liu, andriy.shevchenko, dinesh.sharma,
ilpo.jarvinen, moises.veleta, sreehari.kancharla
On Fri, 13 May 2022 10:33:58 -0700 Ricardo Martinez wrote:
> This patch series removes the skb_data_area_size() helper,
> replacing it in t7xx driver with the size used during skb allocation.
>
> https://lore.kernel.org/netdev/CAHNKnsTmH-rGgWi3jtyC=ktM1DW2W1VJkYoTMJV2Z_Bt498bsg@mail.gmail.com/
Thanks for following up!
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 0/2] net: skb: Remove skb_data_area_size()
2022-05-13 17:33 [PATCH net-next 0/2] net: skb: Remove skb_data_area_size() Ricardo Martinez
` (2 preceding siblings ...)
2022-05-16 20:16 ` [PATCH net-next 0/2] " Jakub Kicinski
@ 2022-05-16 20:39 ` Sergey Ryazanov
2022-05-16 22:40 ` patchwork-bot+netdevbpf
4 siblings, 0 replies; 6+ messages in thread
From: Sergey Ryazanov @ 2022-05-16 20:39 UTC (permalink / raw)
To: Ricardo Martinez
Cc: netdev, linux-wireless, Jakub Kicinski, David Miller,
Johannes Berg, Loic Poulain, M Chetan Kumar, Devegowda,
Chandrashekar, Intel Corporation, chiranjeevi.rapolu,
Haijun Liu (刘海军),
Andy Shevchenko, Sharma, Dinesh, Ilpo Järvinen, Veleta,
Moises, Kancharla, Sreehari
Hello Ricardo,
On Fri, May 13, 2022 at 8:35 PM Ricardo Martinez
<ricardo.martinez@linux.intel.com> wrote:
> This patch series removes the skb_data_area_size() helper,
> replacing it in t7xx driver with the size used during skb allocation.
>
> https://lore.kernel.org/netdev/CAHNKnsTmH-rGgWi3jtyC=ktM1DW2W1VJkYoTMJV2Z_Bt498bsg@mail.gmail.com/
>
> Ricardo Martinez (2):
> net: wwan: t7xx: Avoid calls to skb_data_area_size()
> net: skb: Remove skb_data_area_size()
>
> drivers/net/wwan/t7xx/t7xx_hif_cldma.c | 7 +++----
> drivers/net/wwan/t7xx/t7xx_hif_dpmaif_rx.c | 6 ++----
> include/linux/skbuff.h | 5 -----
> 3 files changed, 5 insertions(+), 13 deletions(-)
Thank you for taking care of this!
Reviewed-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 0/2] net: skb: Remove skb_data_area_size()
2022-05-13 17:33 [PATCH net-next 0/2] net: skb: Remove skb_data_area_size() Ricardo Martinez
` (3 preceding siblings ...)
2022-05-16 20:39 ` Sergey Ryazanov
@ 2022-05-16 22:40 ` patchwork-bot+netdevbpf
4 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-05-16 22:40 UTC (permalink / raw)
To: Martinez, Ricardo
Cc: netdev, linux-wireless, kuba, davem, johannes, ryazanov.s.a,
loic.poulain, m.chetan.kumar, chandrashekar.devegowda, linuxwwan,
chiranjeevi.rapolu, haijun.liu, andriy.shevchenko, dinesh.sharma,
ilpo.jarvinen, moises.veleta, sreehari.kancharla
Hello:
This series was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:
On Fri, 13 May 2022 10:33:58 -0700 you wrote:
> This patch series removes the skb_data_area_size() helper,
> replacing it in t7xx driver with the size used during skb allocation.
>
> https://lore.kernel.org/netdev/CAHNKnsTmH-rGgWi3jtyC=ktM1DW2W1VJkYoTMJV2Z_Bt498bsg@mail.gmail.com/
>
> Ricardo Martinez (2):
> net: wwan: t7xx: Avoid calls to skb_data_area_size()
> net: skb: Remove skb_data_area_size()
>
> [...]
Here is the summary with links:
- [net-next,1/2] net: wwan: t7xx: Avoid calls to skb_data_area_size()
https://git.kernel.org/netdev/net-next/c/262d98b1193f
- [net-next,2/2] net: skb: Remove skb_data_area_size()
https://git.kernel.org/netdev/net-next/c/89af2ce2d95c
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-05-16 22:40 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-13 17:33 [PATCH net-next 0/2] net: skb: Remove skb_data_area_size() Ricardo Martinez
2022-05-13 17:33 ` [PATCH net-next 1/2] net: wwan: t7xx: Avoid calls to skb_data_area_size() Ricardo Martinez
2022-05-13 17:34 ` [PATCH net-next 2/2] net: skb: Remove skb_data_area_size() Ricardo Martinez
2022-05-16 20:16 ` [PATCH net-next 0/2] " Jakub Kicinski
2022-05-16 20:39 ` Sergey Ryazanov
2022-05-16 22:40 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.