[net,1/1] net: stmmac: ensure tx function is not running in stmmac_xdp_release()

Message ID 20221110064552.22504-1-noor.azura.ahmad.tarmizi@linux.intel.com
State New
Headers
Series [net,1/1] net: stmmac: ensure tx function is not running in stmmac_xdp_release() |

Commit Message

Noor Azura Ahmad Tarmizi Nov. 10, 2022, 6:45 a.m. UTC
  From: Mohd Faizal Abdul Rahim <faizal.abdul.rahim@intel.com>

When stmmac_xdp_release() is called, there is a possibility that tx
function is still running on other queues which will lead to tx queue
timed out and reset adapter.

This commit ensure that tx function is not running xdp before release
flow continue to run.

Fixes: ac746c8520d9 ("net: stmmac: enhance XDP ZC driver level switching performance")
Signed-off-by: Song Yoong Siang <yoong.siang.song@intel.com>
Signed-off-by: Mohd Faizal Abdul Rahim <faizal.abdul.rahim@intel.com>
Signed-off-by: Noor Azura Ahmad Tarmizi <noor.azura.ahmad.tarmizi@intel.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

Jakub Kicinski Nov. 12, 2022, 4:05 a.m. UTC | #1
On Thu, 10 Nov 2022 14:45:52 +0800 Noor Azura Ahmad Tarmizi wrote:
> When stmmac_xdp_release() is called, there is a possibility that tx
> function is still running on other queues which will lead to tx queue
> timed out and reset adapter.
> 
> This commit ensure that tx function is not running xdp before release
> flow continue to run.

Do we still need that netif_trans_update() later in the function?
That looks odd.
  
patchwork-bot+netdevbpf@kernel.org Nov. 12, 2022, 5:10 a.m. UTC | #2
Hello:

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

On Thu, 10 Nov 2022 14:45:52 +0800 you wrote:
> From: Mohd Faizal Abdul Rahim <faizal.abdul.rahim@intel.com>
> 
> When stmmac_xdp_release() is called, there is a possibility that tx
> function is still running on other queues which will lead to tx queue
> timed out and reset adapter.
> 
> This commit ensure that tx function is not running xdp before release
> flow continue to run.
> 
> [...]

Here is the summary with links:
  - [net,1/1] net: stmmac: ensure tx function is not running in stmmac_xdp_release()
    https://git.kernel.org/netdev/net/c/77711683a504

You are awesome, thank you!
  

Patch

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 8273e6a175c8..6b43da78cdf0 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -6548,6 +6548,9 @@  void stmmac_xdp_release(struct net_device *dev)
 	struct stmmac_priv *priv = netdev_priv(dev);
 	u32 chan;
 
+	/* Ensure tx function is not running */
+	netif_tx_disable(dev);
+
 	/* Disable NAPI process */
 	stmmac_disable_all_queues(priv);