rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/6] rust: Add IO polling
@ 2024-10-05 12:25 FUJITA Tomonori
  2024-10-05 12:25 ` [PATCH net-next v2 1/6] rust: time: Implement PartialEq and PartialOrd for Ktime FUJITA Tomonori
                   ` (6 more replies)
  0 siblings, 7 replies; 63+ messages in thread
From: FUJITA Tomonori @ 2024-10-05 12:25 UTC (permalink / raw)
  To: netdev
  Cc: rust-for-linux, andrew, hkallweit1, tmgross, ojeda, alex.gaynor,
	gary, bjorn3_gh, benno.lossin, a.hindborg, aliceryhl, anna-maria,
	frederic, tglx, arnd, linux-kernel

Add Rust version of read_poll_timeout (include/linux/iopoll.h), which
polls periodically until a condition is met or a timeout is reached.
By using the function, the 6th patch fixes QT2025 PHY driver to sleep
until the hardware becomes ready.

As a result of the past discussion, this introduces a new type
representing a span of time instead of using core::time::Duration or
time::Ktime.

Unlike the old rust branch, This adds a wrapper for fsleep() instead
of msleep(). fsleep() automatically chooses the best sleep method
based on a duration.

v2:
- Introduce time::Delta instead of core::time::Duration
- Add some trait to Ktime for calculating timeout
- Use read_poll_timeout in QT2025 driver instead of using fsleep directly
v1: https://lore.kernel.org/netdev/20241001112512.4861-1-fujita.tomonori@gmail.com/


FUJITA Tomonori (6):
  rust: time: Implement PartialEq and PartialOrd for Ktime
  rust: time: Introduce Delta type
  rust: time: Implement addition of Ktime and Delta
  rust: time: add wrapper for fsleep function
  rust: Add read_poll_timeout function
  net: phy: qt2025: wait until PHY becomes ready

 drivers/net/phy/qt2025.rs |  11 +++-
 rust/helpers/helpers.c    |   2 +
 rust/helpers/kernel.c     |  13 +++++
 rust/helpers/time.c       |  19 +++++++
 rust/kernel/error.rs      |   1 +
 rust/kernel/io.rs         |   5 ++
 rust/kernel/io/poll.rs    |  70 +++++++++++++++++++++++
 rust/kernel/lib.rs        |   1 +
 rust/kernel/time.rs       | 113 ++++++++++++++++++++++++++++++++++++++
 9 files changed, 234 insertions(+), 1 deletion(-)
 create mode 100644 rust/helpers/kernel.c
 create mode 100644 rust/helpers/time.c
 create mode 100644 rust/kernel/io.rs
 create mode 100644 rust/kernel/io/poll.rs


base-commit: d521db38f339709ccd23c5deb7663904e626c3a6
-- 
2.34.1


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

end of thread, other threads:[~2024-10-15 12:12 UTC | newest]

Thread overview: 63+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-05 12:25 [PATCH net-next v2 0/6] rust: Add IO polling FUJITA Tomonori
2024-10-05 12:25 ` [PATCH net-next v2 1/6] rust: time: Implement PartialEq and PartialOrd for Ktime FUJITA Tomonori
2024-10-06 10:28   ` Fiona Behrens
2024-10-07  5:37     ` FUJITA Tomonori
2024-10-07  8:28       ` Fiona Behrens
2024-10-07  8:41       ` Alice Ryhl
2024-10-07  9:29         ` FUJITA Tomonori
2024-10-07 13:15         ` Andrew Lunn
2024-10-07 13:59           ` Alice Ryhl
2024-10-05 12:25 ` [PATCH net-next v2 2/6] rust: time: Introduce Delta type FUJITA Tomonori
2024-10-05 18:02   ` Andrew Lunn
2024-10-05 18:16     ` Miguel Ojeda
2024-10-07  6:01     ` FUJITA Tomonori
2024-10-07 13:33       ` Andrew Lunn
2024-10-09 14:00         ` FUJITA Tomonori
2024-10-12 18:56           ` Gary Guo
2024-10-13  0:48             ` FUJITA Tomonori
2024-10-15 12:12     ` FUJITA Tomonori
2024-10-05 21:09   ` Andrew Lunn
2024-10-05 12:25 ` [PATCH net-next v2 3/6] rust: time: Implement addition of Ktime and Delta FUJITA Tomonori
2024-10-05 18:07   ` Andrew Lunn
2024-10-06 10:45     ` Fiona Behrens
2024-10-07  6:06       ` FUJITA Tomonori
2024-10-05 18:36   ` Miguel Ojeda
2024-10-07  6:17     ` FUJITA Tomonori
2024-10-07 14:24       ` Alice Ryhl
2024-10-09 12:50         ` FUJITA Tomonori
2024-10-05 12:25 ` [PATCH net-next v2 4/6] rust: time: add wrapper for fsleep function FUJITA Tomonori
2024-10-07 12:24   ` Alice Ryhl
2024-10-09 13:28     ` FUJITA Tomonori
2024-10-05 12:25 ` [PATCH net-next v2 5/6] rust: Add read_poll_timeout function FUJITA Tomonori
2024-10-05 18:32   ` Andrew Lunn
2024-10-05 22:22     ` Boqun Feng
2024-10-06 14:45       ` Andrew Lunn
2024-10-07  6:24         ` FUJITA Tomonori
2024-10-07 12:28         ` Boqun Feng
2024-10-07 13:48           ` Andrew Lunn
2024-10-07 14:06             ` Boqun Feng
2024-10-07 14:08             ` Alice Ryhl
2024-10-07 14:13               ` Boqun Feng
2024-10-07 14:16                 ` Alice Ryhl
2024-10-07 14:19                   ` Boqun Feng
2024-10-07 14:38                     ` Boqun Feng
2024-10-07 17:13                 ` Andrew Lunn
2024-10-07 23:12                   ` Boqun Feng
2024-10-08 12:12                     ` Andrew Lunn
2024-10-08 12:48                       ` Boqun Feng
2024-10-08 13:14                       ` Miguel Ojeda
2024-10-08 17:16                         ` Andrew Lunn
2024-10-08 21:53                           ` Boqun Feng
2024-10-08 21:57                             ` Boqun Feng
2024-10-08 22:26                             ` Andrew Lunn
2024-10-08 22:42                               ` Boqun Feng
2024-10-15  3:36       ` FUJITA Tomonori
2024-10-05 12:25 ` [PATCH net-next v2 6/6] net: phy: qt2025: wait until PHY becomes ready FUJITA Tomonori
2024-10-12 15:29 ` [PATCH net-next v2 0/6] rust: Add IO polling Boqun Feng
2024-10-13  1:15   ` FUJITA Tomonori
2024-10-13  2:50     ` FUJITA Tomonori
2024-10-13  3:16       ` Boqun Feng
2024-10-13  5:15         ` FUJITA Tomonori
2024-10-13  9:48           ` Miguel Ojeda
2024-10-14 21:18           ` Boqun Feng
2024-10-15  3:16             ` FUJITA Tomonori

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).