* [PATCH net v1] mlxbf_gige: disable port during stop()
@ 2024-08-16 20:48 David Thompson
2024-08-19 18:55 ` Benjamin Poirier
0 siblings, 1 reply; 5+ messages in thread
From: David Thompson @ 2024-08-16 20:48 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, andriy.shevchenko, u.kleine-koenig
Cc: asmaa, netdev, linux-kernel, David Thompson
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.
Fixes: f92e1869d74e ("Add Mellanox BlueField Gigabit Ethernet driver")
Reviewed-by: Asmaa Mnebhi <asmaa@nvidia.com>
Signed-off-by: David Thompson <davthompson@nvidia.com>
---
drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c
index 385a56ac7348..12942a50e1bb 100644
--- a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c
+++ b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c
@@ -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);
--
2.30.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net v1] mlxbf_gige: disable port during stop()
2024-08-16 20:48 [PATCH net v1] mlxbf_gige: disable port during stop() David Thompson
@ 2024-08-19 18:55 ` Benjamin Poirier
2024-08-20 0:47 ` Jakub Kicinski
0 siblings, 1 reply; 5+ messages in thread
From: Benjamin Poirier @ 2024-08-19 18:55 UTC (permalink / raw)
To: David Thompson
Cc: davem, edumazet, kuba, pabeni, andriy.shevchenko, u.kleine-koenig,
asmaa, netdev, linux-kernel
On 2024-08-16 16:48 -0400, David Thompson wrote:
> 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.
>
> Fixes: f92e1869d74e ("Add Mellanox BlueField Gigabit Ethernet driver")
> Reviewed-by: Asmaa Mnebhi <asmaa@nvidia.com>
> Signed-off-by: David Thompson <davthompson@nvidia.com>
> ---
> drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c
> index 385a56ac7348..12942a50e1bb 100644
> --- a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c
> +++ b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c
> @@ -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();
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?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net v1] mlxbf_gige: disable port during stop()
2024-08-19 18:55 ` Benjamin Poirier
@ 2024-08-20 0:47 ` Jakub Kicinski
2024-08-28 21:37 ` David Thompson
0 siblings, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2024-08-20 0:47 UTC (permalink / raw)
To: David Thompson
Cc: Benjamin Poirier, davem, edumazet, pabeni, andriy.shevchenko,
u.kleine-koenig, asmaa, netdev, linux-kernel
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.
--
pw-bot: cr
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH net v1] mlxbf_gige: disable port during stop()
2024-08-20 0:47 ` Jakub Kicinski
@ 2024-08-28 21:37 ` David Thompson
2024-08-28 22:55 ` Jakub Kicinski
0 siblings, 1 reply; 5+ messages in thread
From: David Thompson @ 2024-08-28 21:37 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Benjamin Poirier, davem@davemloft.net, edumazet@google.com,
pabeni@redhat.com, andriy.shevchenko@linux.intel.com,
u.kleine-koenig@pengutronix.de, Asmaa Mnebhi,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
> -----Original Message-----
> From: Jakub Kicinski <kuba@kernel.org>
> Sent: Monday, August 19, 2024 8:47 PM
> To: David Thompson <davthompson@nvidia.com>
> Cc: Benjamin Poirier <benjamin.poirier@gmail.com>; davem@davemloft.net;
> edumazet@google.com; pabeni@redhat.com;
> andriy.shevchenko@linux.intel.com; u.kleine-koenig@pengutronix.de; Asmaa
> Mnebhi <asmaa@nvidia.com>; netdev@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Subject: Re: [PATCH net v1] mlxbf_gige: disable port during stop()
>
> 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.
> --
> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net v1] mlxbf_gige: disable port during stop()
2024-08-28 21:37 ` David Thompson
@ 2024-08-28 22:55 ` Jakub Kicinski
0 siblings, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2024-08-28 22:55 UTC (permalink / raw)
To: David Thompson
Cc: Benjamin Poirier, davem@davemloft.net, edumazet@google.com,
pabeni@redhat.com, andriy.shevchenko@linux.intel.com,
u.kleine-koenig@pengutronix.de, Asmaa Mnebhi,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
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..
> 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?
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-08-28 22:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-16 20:48 [PATCH net v1] mlxbf_gige: disable port during stop() David Thompson
2024-08-19 18:55 ` Benjamin Poirier
2024-08-20 0:47 ` Jakub Kicinski
2024-08-28 21:37 ` David Thompson
2024-08-28 22:55 ` Jakub Kicinski
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).