diff mbox series

[net] Revert "net: stmmac: set PP_FLAG_DMA_SYNC_DEV only if XDP is enabled"

Message ID 20241004142115.910876-1-kuba@kernel.org (mailing list archive)
State Accepted
Commit 5546da79e6cc5bb3324bf25688ed05498fd3f86d
Delegated to: Netdev Maintainers
Headers show
Series [net] Revert "net: stmmac: set PP_FLAG_DMA_SYNC_DEV only if XDP is enabled" | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 6 this patch: 6
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 6 maintainers not CCed: bpf@vger.kernel.org ast@kernel.org linux-stm32@st-md-mailman.stormreply.com linux-arm-kernel@lists.infradead.org daniel@iogearbox.net john.fastabend@gmail.com
netdev/build_clang success Errors and warnings before: 6 this patch: 6
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 5 this patch: 5
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 38 this patch: 38
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-10-06--15-00 (tests: 775)

Commit Message

Jakub Kicinski Oct. 4, 2024, 2:21 p.m. UTC
This reverts commit b514c47ebf41a6536551ed28a05758036e6eca7c.

The commit describes that we don't have to sync the page when
recycling, and it tries to optimize that case. But we do need
to sync after allocation. Recycling side should be changed to
pass the right sync size instead.

Fixes: b514c47ebf41 ("net: stmmac: set PP_FLAG_DMA_SYNC_DEV only if XDP is enabled")
Reported-by: Jon Hunter <jonathanh@nvidia.com>
Link: https://lore.kernel.org/20241004070846.2502e9ea@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: alexandre.torgue@foss.st.com
CC: joabreu@synopsys.com
CC: mcoquelin.stm32@gmail.com
CC: hawk@kernel.org
CC: 0x1207@gmail.com
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jacob Keller Oct. 4, 2024, 10:52 p.m. UTC | #1
On 10/4/2024 7:21 AM, Jakub Kicinski wrote:
> This reverts commit b514c47ebf41a6536551ed28a05758036e6eca7c.
> 
> The commit describes that we don't have to sync the page when
> recycling, and it tries to optimize that case. But we do need
> to sync after allocation. Recycling side should be changed to
> pass the right sync size instead.

Makes sense. A proper fix would be to pass something in from the
recycling code to disable sink.

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>

> 
> Fixes: b514c47ebf41 ("net: stmmac: set PP_FLAG_DMA_SYNC_DEV only if XDP is enabled")
> Reported-by: Jon Hunter <jonathanh@nvidia.com>
> Link: https://lore.kernel.org/20241004070846.2502e9ea@kernel.org
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> CC: alexandre.torgue@foss.st.com
> CC: joabreu@synopsys.com
> CC: mcoquelin.stm32@gmail.com
> CC: hawk@kernel.org
> CC: 0x1207@gmail.com
> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index e2140482270a..d3895d7eecfc 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -2035,7 +2035,7 @@ static int __alloc_dma_rx_desc_resources(struct stmmac_priv *priv,
>  	rx_q->queue_index = queue;
>  	rx_q->priv_data = priv;
>  
> -	pp_params.flags = PP_FLAG_DMA_MAP | (xdp_prog ? PP_FLAG_DMA_SYNC_DEV : 0);
> +	pp_params.flags = PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV;
>  	pp_params.pool_size = dma_conf->dma_rx_size;
>  	num_pages = DIV_ROUND_UP(dma_conf->dma_buf_sz, PAGE_SIZE);
>  	pp_params.order = ilog2(num_pages);
Furong Xu Oct. 6, 2024, 11:27 a.m. UTC | #2
On Fri,  4 Oct 2024 07:21:15 -0700, Jakub Kicinski <kuba@kernel.org> wrote:

> This reverts commit b514c47ebf41a6536551ed28a05758036e6eca7c.
> 
> The commit describes that we don't have to sync the page when
> recycling, and it tries to optimize that case. But we do need
> to sync after allocation. Recycling side should be changed to
> pass the right sync size instead.

Thanks for pointing this regression out.

I will send a new patch that passes the right sync size as you
suggested after this revert is applied to all affected
kernel versions to finish what I have stared :)

Reviewed-by: Furong Xu <0x1207@gmail.com>

> 
> Fixes: b514c47ebf41 ("net: stmmac: set PP_FLAG_DMA_SYNC_DEV only if XDP is enabled")
> Reported-by: Jon Hunter <jonathanh@nvidia.com>
> Link: https://lore.kernel.org/20241004070846.2502e9ea@kernel.org
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> CC: alexandre.torgue@foss.st.com
> CC: joabreu@synopsys.com
> CC: mcoquelin.stm32@gmail.com
> CC: hawk@kernel.org
> CC: 0x1207@gmail.com
> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index e2140482270a..d3895d7eecfc 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -2035,7 +2035,7 @@ static int __alloc_dma_rx_desc_resources(struct stmmac_priv *priv,
>  	rx_q->queue_index = queue;
>  	rx_q->priv_data = priv;
>  
> -	pp_params.flags = PP_FLAG_DMA_MAP | (xdp_prog ? PP_FLAG_DMA_SYNC_DEV : 0);
> +	pp_params.flags = PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV;
>  	pp_params.pool_size = dma_conf->dma_rx_size;
>  	num_pages = DIV_ROUND_UP(dma_conf->dma_buf_sz, PAGE_SIZE);
>  	pp_params.order = ilog2(num_pages);
patchwork-bot+netdevbpf@kernel.org Oct. 8, 2024, midnight UTC | #3
Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Fri,  4 Oct 2024 07:21:15 -0700 you wrote:
> This reverts commit b514c47ebf41a6536551ed28a05758036e6eca7c.
> 
> The commit describes that we don't have to sync the page when
> recycling, and it tries to optimize that case. But we do need
> to sync after allocation. Recycling side should be changed to
> pass the right sync size instead.
> 
> [...]

Here is the summary with links:
  - [net] Revert "net: stmmac: set PP_FLAG_DMA_SYNC_DEV only if XDP is enabled"
    https://git.kernel.org/netdev/net/c/5546da79e6cc

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index e2140482270a..d3895d7eecfc 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -2035,7 +2035,7 @@  static int __alloc_dma_rx_desc_resources(struct stmmac_priv *priv,
 	rx_q->queue_index = queue;
 	rx_q->priv_data = priv;
 
-	pp_params.flags = PP_FLAG_DMA_MAP | (xdp_prog ? PP_FLAG_DMA_SYNC_DEV : 0);
+	pp_params.flags = PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV;
 	pp_params.pool_size = dma_conf->dma_rx_size;
 	num_pages = DIV_ROUND_UP(dma_conf->dma_buf_sz, PAGE_SIZE);
 	pp_params.order = ilog2(num_pages);