mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net-next] bnx2x: turn off FCoE if storage MAC-address setup failed
@ 2024-07-12 13:29 Nikita Kiryushin
  2024-07-13 14:41 ` Andrew Lunn
  0 siblings, 1 reply; 4+ messages in thread
From: Nikita Kiryushin @ 2024-07-12 13:29 UTC (permalink / raw)
  To: Sudarsana Kalluru
  Cc: Nikita Kiryushin, Manish Chopra, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev, linux-kernel, lvc-project

As of now, initial storage MAC setup (in bnx2x_init_one) is not checked.

This can lead to unexpected FCoE behavior (as address will be in unexpected
state) without notice.

Check dev_addr_add for storage MAC and if it failes produce error message
and turn off FCoE feature.

Signed-off-by: Nikita Kiryushin <kiryushin@ancud.ru>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 678829646cec..c5d5e85777d4 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -13988,8 +13988,12 @@ static int bnx2x_init_one(struct pci_dev *pdev,
 	if (!NO_FCOE(bp)) {
 		/* Add storage MAC address */
 		rtnl_lock();
-		dev_addr_add(bp->dev, bp->fip_mac, NETDEV_HW_ADDR_T_SAN);
+		rc = dev_addr_add(bp->dev, bp->fip_mac, NETDEV_HW_ADDR_T_SAN);
 		rtnl_unlock();
+		if (rc) {
+			dev_err(&pdev->dev, "Cannot add storage MAC address\n");
+			bp->flags |= NO_FCOE_FLAG;
+		}
 	}
 	BNX2X_DEV_INFO(
 	       "%s (%c%d) PCI-E found at mem %lx, IRQ %d, node addr %pM\n",
-- 
2.34.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] bnx2x: turn off FCoE if storage MAC-address setup failed
  2024-07-12 13:29 [PATCH net-next] bnx2x: turn off FCoE if storage MAC-address setup failed Nikita Kiryushin
@ 2024-07-13 14:41 ` Andrew Lunn
  2024-07-15 14:10   ` Nikita Kiryushin
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Lunn @ 2024-07-13 14:41 UTC (permalink / raw)
  To: Nikita Kiryushin
  Cc: Sudarsana Kalluru, Manish Chopra, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev, linux-kernel, lvc-project

On Fri, Jul 12, 2024 at 04:29:15PM +0300, Nikita Kiryushin wrote:
> As of now, initial storage MAC setup (in bnx2x_init_one) is not checked.
> 
> This can lead to unexpected FCoE behavior (as address will be in unexpected
> state) without notice.
> 
> Check dev_addr_add for storage MAC and if it failes produce error message
> and turn off FCoE feature.

How broken is it when this happens? This is called from .probe. So
returning the error code will fail the probe and the device will not
be created. Is that a better solution?

	Andrew

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] bnx2x: turn off FCoE if storage MAC-address setup failed
  2024-07-13 14:41 ` Andrew Lunn
@ 2024-07-15 14:10   ` Nikita Kiryushin
  2024-10-25 18:15     ` Nikita Kiryushin
  0 siblings, 1 reply; 4+ messages in thread
From: Nikita Kiryushin @ 2024-07-15 14:10 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Sudarsana Kalluru, Manish Chopra, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev, linux-kernel, lvc-project

> How broken is it when this happens?
I can not say what would happen exactly, if the address is not assigned
the way it should. But there would be at least an attempt to free unallocated
address (in __bnx2x_remove).

> This is called from .probe. So
> returning the error code will fail the probe and the device will not
> be created. Is that a better solution?
To me, it does not seem fatal, that is why I am not returning error,
just print it and disable FCoE. The "rc" set will not be returned (unless
jumped to error handlers, which we are not doing). Would it be better, if
I used some other result variable other than "rc"? The check could be the call,
but than handling would be inside a lock, which I think is a bad idea.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] bnx2x: turn off FCoE if storage MAC-address setup failed
  2024-07-15 14:10   ` Nikita Kiryushin
@ 2024-10-25 18:15     ` Nikita Kiryushin
  0 siblings, 0 replies; 4+ messages in thread
From: Nikita Kiryushin @ 2024-10-25 18:15 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Sudarsana Kalluru, Manish Chopra, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev, linux-kernel, lvc-project

On 7/15/24 17:10, Nikita Kiryushin wrote:
>> How broken is it when this happens?
> I can not say what would happen exactly, if the address is not assigned
> the way it should. But there would be at least an attempt to free unallocated
> address (in __bnx2x_remove).
>
>> This is called from .probe. So
>> returning the error code will fail the probe and the device will not
>> be created. Is that a better solution?
> To me, it does not seem fatal, that is why I am not returning error,
> just print it and disable FCoE. The "rc" set will not be returned (unless
> jumped to error handlers, which we are not doing). Would it be better, if
> I used some other result variable other than "rc"? The check could be the call,
> but than handling would be inside a lock, which I think is a bad idea.

The patch is marked as "Changes Requested" at the Patchwork,
but I am not sure, what has to be done with it.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-10-25 18:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-12 13:29 [PATCH net-next] bnx2x: turn off FCoE if storage MAC-address setup failed Nikita Kiryushin
2024-07-13 14:41 ` Andrew Lunn
2024-07-15 14:10   ` Nikita Kiryushin
2024-10-25 18:15     ` Nikita Kiryushin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®