Re: [PATCH V8 net-next 05/11] net: hibmcge: Implement some .ndo functions
From: Andrew Lunn
Date: Mon Sep 09 2024 - 10:48:58 EST
> No, HBG_NIC_STATE_OPEN is not intended to ensure that hbg_net_open() and
> hbg_net_stop() are mutually exclusive.
>
> Actually, when the driver do reset or self-test(ethtool -t or ethtool --reset or FLR).
> We hope that no other data is transmitted or received at this time.
That is an invalid assumption. You could be receiving line rate
broadcast traffic for example, because there is a broadcast storm
happening.
I assume for testing, you are configuring a loopback somewhere? PHY
loopback or PCS loopback? I've seen some PHYs do 'broken' loopback
where egress traffic is looped back, but ingress traffic is also still
received. Is this true for your hardware? Is this why you make this
assumption?
What is your use case for ethtool --reset? Are you working around
hardware bugs? Why not simply return -EBUSY if the user tries to use
--reset when the interface is admin up. You then know the interface is
down, you don't need open/close to be re-entrant safe.
Same for testing. Return -ENETDOWN if the user tries to do self test
on an interface which is admin down.
Andrew