|
|
Log in / Subscribe / Register

Rust abstractions for network PHY drivers

From:  FUJITA Tomonori <fujita.tomonori-AT-gmail.com>
To:  netdev-AT-vger.kernel.org
Subject:  [PATCH net-next v4 0/4] Rust abstractions for network PHY drivers
Date:  Thu, 12 Oct 2023 21:53:45 +0900
Message-ID:  <20231012125349.2702474-1-fujita.tomonori@gmail.com>
Cc:  rust-for-linux-AT-vger.kernel.org, andrew-AT-lunn.ch, miguel.ojeda.sandonis-AT-gmail.com, tmgross-AT-umich.edu, boqun.feng-AT-gmail.com, wedsonaf-AT-gmail.com, benno.lossin-AT-proton.me, greg-AT-kroah.com
Archive-link:  Article

This patchset adds Rust abstractions for phylib. It doesn't fully
cover the C APIs yet but I think that it's already useful. I implement
two PHY drivers (Asix AX88772A PHYs and Realtek Generic FE-GE). Seems
they work well with real hardware.

The first patch introduces Rust bindings for phylib.

The second patch add a macro to declare a kernel module for PHYs
drivers.

The third patch updates the ETHERNET PHY LIBRARY entry in MAINTAINERS
file; adds the binding file and me as a maintainer of the Rust
bindings (as Andrew Lunn suggested).

The last patch introduces the Rust version of Asix PHY drivers,
drivers/net/phy/ax88796b.c. The features are equivalent to the C
version. You can choose C (by default) or Rust version on kernel
configuration.

v4:
  - split the core patch
  - making Device::from_raw() private
  - comment improvement with code update
  - commit message improvement
  - avoiding using bindings::phy_driver in public functions
  - using an anonymous constant in module_phy_driver macro
v3: https://lore.kernel.org/netdev/20231011.231607.1747074555...
  - changes the base tree to net-next from rust-next
  - makes this feature optional; only enabled with CONFIG_RUST_PHYLIB_BINDINGS=y
  - cosmetic code and comment improvement
  - adds copyright
v2: https://lore.kernel.org/netdev/20231006094911.3305152-2-f...
  - build failure fix
  - function renaming
v1: https://lore.kernel.org/netdev/20231002085302.2274260-3-f...


FUJITA Tomonori (4):
  rust: core abstractions for network PHY drivers
  rust: net::phy add module_phy_driver macro
  MAINTAINERS: add Rust PHY abstractions to the ETHERNET PHY LIBRARY
  net: phy: add Rust Asix PHY driver

 MAINTAINERS                      |   2 +
 drivers/net/phy/Kconfig          |   8 +
 drivers/net/phy/Makefile         |   6 +-
 drivers/net/phy/ax88796b_rust.rs | 129 +++++
 init/Kconfig                     |   8 +
 rust/Makefile                    |   1 +
 rust/bindings/bindings_helper.h  |   3 +
 rust/kernel/lib.rs               |   3 +
 rust/kernel/net.rs               |   6 +
 rust/kernel/net/phy.rs           | 813 +++++++++++++++++++++++++++++++
 rust/uapi/uapi_helper.h          |   2 +
 11 files changed, 980 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/phy/ax88796b_rust.rs
 create mode 100644 rust/kernel/net.rs
 create mode 100644 rust/kernel/net/phy.rs


base-commit: 21b2e2624d2ec69b831cd2edd202ca30ac6beae1
-- 
2.34.1




Copyright © 2023, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds