mlxbf_gige: disable port during stop()
Subsystems (2)
PATCH 1/1 mlxbf_gige: disable port during stop()
The mlxbf_gige_open() routine initializes and enables the Gigabit Ethernet port from a hardware point of view. The mlxbf_gige_stop() routine must disable the port hardware to fully quiesce it.
--- drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c +6 -0
@@ -205,8 +205,14 @@ static int mlxbf_gige_open(struct net_device *netdev)static int mlxbf_gige_stop (struct net_device *netdev) {struct mlxbf_gige *priv =netdev_priv (netdev); +u64 control; + + control =readq (priv->base +MLXBF_GIGE_CONTROL ); + control &= ~MLXBF_GIGE_CONTROL_PORT_EN ; +writeq (control, priv->base +MLXBF_GIGE_CONTROL );writeq (0 , priv->base +MLXBF_GIGE_INT_EN ); +mb ();netif_stop_queue (netdev);napi_disable (&priv->napi);netif_napi_del (&priv->napi);
Signature · 1 line
2.30.1
Quoted 18 lines · David Thompson
The
mlxbf_gige_open()routine initializes and enables the Gigabit Ethernet port from a hardware point of view. Themlxbf_gige_stop()routine must disable the port hardware to fully quiesce it.Fixes f92e1869d74e ("Add Mellanox BlueField Gigabit Ethernet driver")Reviewed-by Asmaa Mnebhi <[email protected]>Signed-off-by David Thompson <[email protected]>--- drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c +0
-0@@ -205,8 +205,14 @@ static int mlxbf_gige_open(struct net_device *netdev)static int mlxbf_gige_stop (struct net_device *netdev)
drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c static int mlxbf_gige_open(struct net_device *netdev) · line 215
Quoted 10 lines
drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c +6
-0{struct mlxbf_gige *priv =netdev_priv (netdev); +u64 control; + + control =readq (priv->base +MLXBF_GIGE_CONTROL ); + control &= ~MLXBF_GIGE_CONTROL_PORT_EN ; +writeq (control, priv->base +MLXBF_GIGE_CONTROL );writeq (0 , priv->base +MLXBF_GIGE_INT_EN ); +mb ();
checkpatch says:
WARNING: memory barrier without comment
#37: FILE: drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c:215:
+ mb();
Is this memory barrier paired with another one?
Jakub Kicinski
maintainerQuoted 1 line · On Mon, 19 Aug 2024 14:55:12 -0400 Benjamin Poirier wrote:
Is this memory barrier paired with another one?
+1
You probably want synchronize_irq() here?
You should explain in the cover letter, the mb() seems to not be mentioned.
Signature · 1 line
pw-bot: cr
Quoted 11 lines
-----Original Message-----
From: Jakub Kicinski <[email protected]>
Sent: Monday, August 19, 2024 8:47 PM
To: David Thompson <[email protected]>
Cc: Benjamin Poirier <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Asmaa Mnebhi <[email protected]>; [email protected]; linux- [email protected]
Subject: Re: [PATCH net v1]mlxbf_gige: disable port duringstop()
Quoted 8 lines
Quoted 1 line · On Mon, 19 Aug 2024 14:55:12 -0400 Benjamin Poirier wrote:
Is this memory barrier paired with another one?
+1
You probably wantsynchronize_irq()here?
You should explain in the cover letter, themb()seems to not be mentioned. --
pw-bot: cr
Hello Jakub and Benjamin, thanks for your input.
I will post a v2 adding information about the "mb()" call.
Regarding the "synchronize_irq()" call, I did some research and noticed that some already merged driver patches (see list below for a sample) state that "synchronize_irq()" is unnecessary before "free_irq()":
3e0fcb782a9f i40e: Remove unnecessary synchronize_irq() before free_irq() 845517ed04ae RDMA/qedr: Remove unnecessary synchronize_irq() before free_irq() d1e7f009bfff net: qede: Remove unnecessary synchronize_irq() before free_irq() bd81bfb5a1d1 net: vxge: Remove unnecessary synchronize_irq() before free_irq() 29fd3ca1779f qed: Remove unnecessary synchronize_irq() before free_irq() 411dccf9d271 dmaengine: idxd: Remove unnecessary synchronize_irq() before free_irq() d887ae3247e0 octeontx2-pf: Remove unnecessary synchronize_irq() before free_irq()
Given the above information, does my mlxbf_gige driver patch still need to invoke "synchronize_irq()" in the stop() method? The "mlxbf_gige_free_irq()" call within the stop() method invokes "free_irq()" for each of the driver's IRQs, so sounds like this "synchronize_irq()" is implicitly being invoked?
Regards, Dave
Jakub Kicinski
maintainerQuoted 3 lines · On Wed, 28 Aug 2024 21:37:06 +0000 David Thompson wrote:
Hello Jakub and Benjamin, thanks for your input.
I will post a v2 adding information about the "
mb()" call.
Perhaps this information you're adding will shed more light..
Quoted 4 lines
Given the above information, does my
mlxbf_gigedriver patch still need to invoke "synchronize_irq()" in thestop()method? The "mlxbf_gige_free_irq()" call within thestop()method invokes "free_irq()" for each of the driver's IRQs, so sounds like this "synchronize_irq()" is implicitly being invoked?
I was talking about the point in which you add the mb(). IDK what you're trying to protect from but it's after what looks like disabling IRQ, and there's not free_irq() in that spot.