[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4b7096cd-076d-42fd-b0cc-f842d3b64ee4@lunn.ch>
Date: Sat, 14 Oct 2023 04:12:57 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Benno Lossin <benno.lossin@...ton.me>
Cc: FUJITA Tomonori <fujita.tomonori@...il.com>, netdev@...r.kernel.org,
rust-for-linux@...r.kernel.org, miguel.ojeda.sandonis@...il.com,
tmgross@...ch.edu, boqun.feng@...il.com, wedsonaf@...il.com,
greg@...ah.com
Subject: Re: [PATCH net-next v4 1/4] rust: core abstractions for network PHY
drivers
> > +config RUST_PHYLIB_ABSTRACTIONS
> > + bool "PHYLIB abstractions support"
> > + depends on RUST
> > + depends on PHYLIB=y
> > + help
> > + Adds support needed for PHY drivers written in Rust. It provides
> > + a wrapper around the C phylib core.
> > +
>
> I find it a bit weird that this is its own option under "General". I think
> it would be reasonable to put it under "Rust", since that would also scale
> better when other subsystems do this.
To some extent, this is just a temporary location. Once the
restrictions of the build systems are solved, i expect this will move
into drivers/net/phy/Kconfig, inside the 'if PHYLIB'. However, i
agree, this should be under the Rust menu.
> > + }
> > +
> > + /// Reads a given C22 PHY register.
> > + pub fn read(&self, regnum: u16) -> Result<u16> {
>
> No idea if this function should be `&mut self` or `&self`. Would
> it be ok for mutltiple threads to call this function concurrently?
> If yes, then leave it as `&self`, if no then change it to `&mut self`.
The MDIO layer before has a lock, so its will serialize parallel
reads/writes. With the current Rust integration, it should never be
possible for multiple threads to be active at once, but if it does
happen, its not a problem anyway.
Andrew
Powered by blists - more mailing lists