Re: [PATCH V8 net-next 05/11] net: hibmcge: Implement some .ndo functions

From: Jijie Shao
Date: Tue Sep 10 2024 - 02:26:34 EST



on 2024/9/9 22:48, Andrew Lunn wrote:
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

Good idea. I'll remove priv->state first in v9. We'll discuss this internally. Thank you very much. Jiji Shao