rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v7 0/5] Rust abstractions for network PHY drivers
@ 2023-10-26  0:10 FUJITA Tomonori
  2023-10-26  0:10 ` [PATCH net-next v7 1/5] rust: core " FUJITA Tomonori
                   ` (5 more replies)
  0 siblings, 6 replies; 108+ messages in thread
From: FUJITA Tomonori @ 2023-10-26  0:10 UTC (permalink / raw)
  To: netdev
  Cc: rust-for-linux, andrew, tmgross, miguel.ojeda.sandonis,
	benno.lossin, wedsonaf

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 add Miguel's work to make sure that the C's enum is
sync with Rust sides. If not, compiling fails. Note that this is a
temporary solution. It will be replaced with bindgen when it supports
generating the enum conversion code.

The fourth add the Rust ETHERNET PHY LIBRARY entry to MAINTAINERS
file; adds the binding file and me as a maintainer (as Andrew Lunn
suggested) with Trevor Gross as a reviewer.

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.

v7:
  - renames get_link() to is_link_up()
  - improves the macro format
  - improves the commit log in the third patch
  - improves comments
v6: https://lore.kernel.org/netdev/20231025.090243.1437967503809186729.fujita.tomonori@gmail.com/T/
  - improves comments
  - makes the requirement of phy_drivers_register clear
  - fixes Makefile of the third patch
v5: https://lore.kernel.org/all/20231019.094147.1808345526469629486.fujita.tomonori@gmail.com/T/
  - drops the rustified-enum option, writes match by hand; no *risk* of UB
  - adds Miguel's patch for enum checking
  - moves CONFIG_RUST_PHYLIB_ABSTRACTIONS to drivers/net/phy/Kconfig
  - adds a new entry for this abstractions in MAINTAINERS
  - changes some of Device's methods to take &mut self
  - comment improvment
v4: https://lore.kernel.org/netdev/20231012125349.2702474-1-fujita.tomonori@gmail.com/T/
  - 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.1747074555988728415.fujita.tomonori@gmail.com/T/
  - 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-fujita.tomonori@gmail.com/T/
  - build failure fix
  - function renaming
v1: https://lore.kernel.org/netdev/20231002085302.2274260-3-fujita.tomonori@gmail.com/T/


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

Miguel Ojeda (1):
  rust: add second `bindgen` pass for enum exhaustiveness checking

 MAINTAINERS                          |  16 +
 drivers/net/phy/Kconfig              |  16 +
 drivers/net/phy/Makefile             |   6 +-
 drivers/net/phy/ax88796b_rust.rs     | 129 ++++
 rust/.gitignore                      |   1 +
 rust/Makefile                        |  14 +
 rust/bindings/bindings_enum_check.rs |  36 ++
 rust/bindings/bindings_helper.h      |   3 +
 rust/kernel/lib.rs                   |   3 +
 rust/kernel/net.rs                   |   6 +
 rust/kernel/net/phy.rs               | 868 +++++++++++++++++++++++++++
 rust/uapi/uapi_helper.h              |   2 +
 12 files changed, 1099 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/phy/ax88796b_rust.rs
 create mode 100644 rust/bindings/bindings_enum_check.rs
 create mode 100644 rust/kernel/net.rs
 create mode 100644 rust/kernel/net/phy.rs


base-commit: 8846f9a04b10b7f61214425409838d764df7080d
-- 
2.34.1


^ permalink raw reply	[flat|nested] 108+ messages in thread

end of thread, other threads:[~2023-11-22 18:17 UTC | newest]

Thread overview: 108+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-26  0:10 [PATCH net-next v7 0/5] Rust abstractions for network PHY drivers FUJITA Tomonori
2023-10-26  0:10 ` [PATCH net-next v7 1/5] rust: core " FUJITA Tomonori
2023-10-27 19:09   ` Boqun Feng
2023-10-28 10:00     ` FUJITA Tomonori
2023-10-27 19:59   ` Boqun Feng
2023-10-27 21:19     ` Benno Lossin
2023-10-27 22:21       ` Boqun Feng
2023-10-27 22:36         ` Andrew Lunn
2023-10-27 22:50         ` Benno Lossin
2023-10-27 23:26           ` Boqun Feng
2023-10-27 23:52             ` Boqun Feng
2023-10-28  8:35             ` Benno Lossin
2023-10-27 22:40       ` Andrew Lunn
2023-10-28 15:16         ` Miguel Ojeda
2023-10-28 18:18           ` Andrew Lunn
2023-10-28  9:27       ` FUJITA Tomonori
2023-10-28 14:53         ` Andrew Lunn
2023-10-28 16:09           ` FUJITA Tomonori
2023-10-28 16:39             ` Benno Lossin
2023-10-28 19:06               ` Boqun Feng
2023-10-28 19:23                 ` Andrew Lunn
2023-10-28 23:26                   ` Boqun Feng
2023-10-28 16:37         ` Benno Lossin
2023-10-28 18:23           ` Andrew Lunn
2023-10-28 18:45             ` Benno Lossin
2023-10-29  4:21               ` FUJITA Tomonori
2023-10-29 16:48                 ` Boqun Feng
2023-10-29 18:09                   ` Boqun Feng
2023-10-29 18:26                     ` Boqun Feng
2023-10-29 19:39                     ` Andrew Lunn
2023-10-30 12:07                       ` Miguel Ojeda
2023-10-30 12:32                         ` Andrew Lunn
2023-10-29 22:58                   ` FUJITA Tomonori
2023-10-30  0:19                     ` Boqun Feng
2023-10-30  8:34                       ` Benno Lossin
2023-10-30 12:49                         ` FUJITA Tomonori
2023-10-30 16:45                           ` Benno Lossin
2023-11-08 10:46                             ` FUJITA Tomonori
2023-11-10 13:26                               ` Andrew Lunn
2023-10-29 17:32                 ` Andrew Lunn
2023-10-30  8:37                   ` Benno Lossin
2023-10-30 11:22             ` Miguel Ojeda
2023-11-17  9:39   ` Alice Ryhl
2023-11-17 13:34     ` Andrew Lunn
2023-11-17 15:42       ` Alice Ryhl
2023-11-17 16:28         ` Andrew Lunn
2023-11-17 18:27           ` Alice Ryhl
2023-11-21 12:47         ` FUJITA Tomonori
2023-11-17  9:39   ` Alice Ryhl
2023-11-17 13:53     ` Andrew Lunn
2023-11-17 19:50       ` Greg KH
2023-11-17 23:28         ` Boqun Feng
2023-11-18 15:32           ` Andrew Lunn
2023-11-18 15:54             ` Boqun Feng
2023-11-19 11:06               ` Trevor Gross
2023-11-21  2:13                 ` FUJITA Tomonori
2023-11-22 18:16                   ` Boqun Feng
2023-11-19 13:51     ` FUJITA Tomonori
2023-11-19 16:08       ` Andrew Lunn
2023-10-26  0:10 ` [PATCH net-next v7 2/5] rust: net::phy add module_phy_driver macro FUJITA Tomonori
2023-11-17  9:39   ` Alice Ryhl
2023-11-19 10:50     ` FUJITA Tomonori
2023-11-19 10:54       ` Benno Lossin
2023-11-17 22:21   ` Boqun Feng
2023-11-17 22:54     ` Andrew Lunn
2023-11-17 23:01       ` Benno Lossin
2023-11-17 23:18         ` Andrew Lunn
2023-11-19  9:41           ` FUJITA Tomonori
2023-11-19  9:25         ` FUJITA Tomonori
2023-11-19 15:50           ` Andrew Lunn
2023-11-20 13:54             ` FUJITA Tomonori
2023-11-20 14:13               ` Andrew Lunn
2023-11-21  0:49                 ` FUJITA Tomonori
2023-11-19  9:44     ` FUJITA Tomonori
2023-10-26  0:10 ` [PATCH net-next v7 3/5] rust: add second `bindgen` pass for enum exhaustiveness checking FUJITA Tomonori
2023-10-26 11:02   ` Miguel Ojeda
2023-10-26 11:54     ` FUJITA Tomonori
2023-10-26 12:22       ` Miguel Ojeda
2023-10-27  0:07         ` Andrew Lunn
2023-10-27 10:50           ` Miguel Ojeda
2023-10-26  0:10 ` [PATCH net-next v7 4/5] MAINTAINERS: add Rust PHY abstractions for ETHERNET PHY LIBRARY FUJITA Tomonori
2023-10-26 23:53   ` Andrew Lunn
2023-10-26  0:10 ` [PATCH net-next v7 5/5] net: phy: add Rust Asix PHY driver FUJITA Tomonori
2023-11-17  9:39   ` Alice Ryhl
2023-11-19  9:57     ` FUJITA Tomonori
2023-11-19 16:03       ` Andrew Lunn
2023-11-21  6:19         ` FUJITA Tomonori
2023-11-21  7:12           ` Greg KH
2023-10-26 10:39 ` [PATCH net-next v7 0/5] Rust abstractions for network PHY drivers Miguel Ojeda
2023-10-26 23:48   ` Andrew Lunn
2023-10-27  2:06     ` Boqun Feng
2023-10-27  2:47       ` Andrew Lunn
2023-10-27  3:11         ` Boqun Feng
2023-10-27  4:26           ` Boqun Feng
2023-10-27 14:26             ` Andrew Lunn
2023-10-27 16:41               ` Miguel Ojeda
2023-10-27 13:00           ` Andrew Lunn
2023-10-27 10:22         ` Miguel Ojeda
2023-10-27 13:09           ` Andrew Lunn
2023-10-27 10:21     ` Miguel Ojeda
2023-10-27 14:26       ` Jakub Kicinski
2023-10-27 16:36         ` Miguel Ojeda
2023-10-27 22:55           ` Andrew Lunn
2023-10-28 11:07             ` Miguel Ojeda
2023-10-28 11:41               ` Benno Lossin
2023-10-28 15:11                 ` Miguel Ojeda
2023-10-28 15:00               ` Andrew Lunn
2023-10-28 15:11                 ` Miguel Ojeda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).