[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231014.213114.1223712652378299068.fujita.tomonori@gmail.com>
Date: Sat, 14 Oct 2023 21:31:14 +0900 (JST)
From: FUJITA Tomonori <fujita.tomonori@...il.com>
To: miguel.ojeda.sandonis@...il.com
Cc: fujita.tomonori@...il.com, andrew@...n.ch, gregkh@...uxfoundation.org,
netdev@...r.kernel.org, rust-for-linux@...r.kernel.org, tmgross@...ch.edu,
wedsonaf@...il.com
Subject: Re: [PATCH net-next v3 1/3] rust: core abstractions for network
PHY drivers
On Fri, 13 Oct 2023 20:33:58 +0200
Miguel Ojeda <miguel.ojeda.sandonis@...il.com> wrote:
> On Fri, Oct 13, 2023 at 5:15 PM FUJITA Tomonori
> <fujita.tomonori@...il.com> wrote:
>>
>> I meant that defining Rust's enum corresponding to the kernel's enum
>> phy_state like.
>>
>> +pub enum DeviceState {
>> + /// PHY device and driver are not ready for anything.
>> + Down,
>> + /// PHY is ready to send and receive packets.
>> + Ready,
>> + /// PHY is up, but no polling or interrupts are done.
>> + Halted,
>> + /// PHY is up, but is in an error state.
>> + Error,
>> + /// PHY and attached device are ready to do work.
>> + Up,
>> + /// PHY is currently running.
>> + Running,
>> + /// PHY is up, but not currently plugged in.
>> + NoLink,
>> + /// PHY is performing a cable test.
>> + CableTest,
>> +}
>>
>> Then write match code by hand.
>
> Yes, but that alone is not enough -- that is what we do normally, but
> we can still diverge with the C side. That is what the `bindgen`
> proposal would solve (plus better maintenance). The workaround also
> solves that, but with more maintenance effort. We could even go
> further, but I don't think it is worth it given that we really want to
> have it in `bindgen`.
Now there is separate entry for PHYLIB [RUST] in MAINTAINERS so it
makes clear that I have to do more maintenance effort. So hopefully,
it's fine by Andrew.
I'll use your workaround in the next version.
I expect that you don't want a commit introducing UD so I squash your
patch with the explanation to the commit log. If you want to merge
your work to the patchset in a different way, please let me know.
Thanks a lot!
Powered by blists - more mailing lists