* [PATCH] linkstate: Add macros for link state up/down
@ 2022-09-06 8:37 Olliver Schinagl
2022-09-06 12:18 ` Andrew Lunn
0 siblings, 1 reply; 4+ messages in thread
From: Olliver Schinagl @ 2022-09-06 8:37 UTC (permalink / raw)
To: linux-kernel, netdev, Gustavo A . R . Silva
Cc: Alexandru Tachici, Hao Chen, Olliver Schinagl, Andrew Lunn,
David S . Miller, Ido Schimmel, Jakub Kicinski, Olliver Schinagl
The phylink_link_state.state property can be up or down, via 1 and 0.
The other link state's (speed, duplex) are defined in ethtool.h so lets
add defines for the link-state there as well so we can use macro's to
define our up/down states.
Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
---
include/uapi/linux/ethtool.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
index 2d5741fd44bb..3a00e2f64d87 100644
--- a/include/uapi/linux/ethtool.h
+++ b/include/uapi/linux/ethtool.h
@@ -1857,6 +1857,10 @@ static inline int ethtool_validate_duplex(__u8 duplex)
#define XCVR_DUMMY2 0x03
#define XCVR_DUMMY3 0x04
+/* Linkstate, Up or Down */
+#define LINKSTATE_DOWN 0x0
+#define LINKSTATE_UP 0x1
+
/* Enable or disable autonegotiation. */
#define AUTONEG_DISABLE 0x00
#define AUTONEG_ENABLE 0x01
--
2.37.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] linkstate: Add macros for link state up/down
2022-09-06 8:37 [PATCH] linkstate: Add macros for link state up/down Olliver Schinagl
@ 2022-09-06 12:18 ` Andrew Lunn
2022-09-06 13:38 ` Olliver Schinagl
2022-09-06 14:57 ` Olliver Schinagl
0 siblings, 2 replies; 4+ messages in thread
From: Andrew Lunn @ 2022-09-06 12:18 UTC (permalink / raw)
To: Olliver Schinagl
Cc: linux-kernel, netdev, Gustavo A . R . Silva, Alexandru Tachici,
Hao Chen, Olliver Schinagl, David S . Miller, Ido Schimmel,
Jakub Kicinski
On Tue, Sep 06, 2022 at 10:37:54AM +0200, Olliver Schinagl wrote:
> The phylink_link_state.state property can be up or down, via 1 and 0.
>
> The other link state's (speed, duplex) are defined in ethtool.h so lets
> add defines for the link-state there as well so we can use macro's to
> define our up/down states.
Hi Olliver
The change itself is fine, but we don't add to the API without
users. Please make use of these two new values somewhere, to show they
are really useful.
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] linkstate: Add macros for link state up/down
2022-09-06 12:18 ` Andrew Lunn
@ 2022-09-06 13:38 ` Olliver Schinagl
2022-09-06 14:57 ` Olliver Schinagl
1 sibling, 0 replies; 4+ messages in thread
From: Olliver Schinagl @ 2022-09-06 13:38 UTC (permalink / raw)
To: Andrew Lunn
Cc: linux-kernel, netdev, Gustavo A . R . Silva, Alexandru Tachici,
Hao Chen, Olliver Schinagl, David S . Miller, Ido Schimmel,
Jakub Kicinski
Hey Andrew,
On 06-09-2022 14:18, Andrew Lunn wrote:
> On Tue, Sep 06, 2022 at 10:37:54AM +0200, Olliver Schinagl wrote:
>> The phylink_link_state.state property can be up or down, via 1 and 0.
>>
>> The other link state's (speed, duplex) are defined in ethtool.h so lets
>> add defines for the link-state there as well so we can use macro's to
>> define our up/down states.
> Hi Olliver
>
> The change itself is fine, but we don't add to the API without
> users. Please make use of these two new values somewhere, to show they
> are really useful.
>
> Andrew
I actually ran into this need as I'm working on the realtek switch stuff
over on openwrt, where I see link-states being set with 0/1. I'll search
the kernel for these as well if that helps and can do a follow up of course.
Olliver
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] linkstate: Add macros for link state up/down
2022-09-06 12:18 ` Andrew Lunn
2022-09-06 13:38 ` Olliver Schinagl
@ 2022-09-06 14:57 ` Olliver Schinagl
1 sibling, 0 replies; 4+ messages in thread
From: Olliver Schinagl @ 2022-09-06 14:57 UTC (permalink / raw)
To: Andrew Lunn
Cc: linux-kernel, netdev, Gustavo A . R . Silva, Alexandru Tachici,
Hao Chen, Olliver Schinagl, David S . Miller, Ido Schimmel,
Jakub Kicinski
Hey Andrew,
On 06-09-2022 14:18, Andrew Lunn wrote:
> On Tue, Sep 06, 2022 at 10:37:54AM +0200, Olliver Schinagl wrote:
>> The phylink_link_state.state property can be up or down, via 1 and 0.
>>
>> The other link state's (speed, duplex) are defined in ethtool.h so lets
>> add defines for the link-state there as well so we can use macro's to
>> define our up/down states.
> Hi Olliver
>
> The change itself is fine, but we don't add to the API without
> users. Please make use of these two new values somewhere, to show they
> are really useful.
>
> Andrew
So I've found quite a lot of users, which I suppose is good. I've since
decided to turn it into an enum, and refer in the structs as `enum
phy_linkstate link:1` (is this even legal?) Would that ok for v2?
Olliver
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-09-06 15:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-06 8:37 [PATCH] linkstate: Add macros for link state up/down Olliver Schinagl
2022-09-06 12:18 ` Andrew Lunn
2022-09-06 13:38 ` Olliver Schinagl
2022-09-06 14:57 ` Olliver Schinagl
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®