Announcement

Collapse
No announcement yet.

Rust Porting Begins For Intel's "e1000" Linux Network Driver

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Rust Porting Begins For Intel's "e1000" Linux Network Driver

    Phoronix: Rust Porting Begins For Intel's "e1000" Linux Network Driver

    Adding to the growing examples and early drivers being worked on for the Linux kernel to showcase the possibilities of using the Rust programming language within the kernel, an early port of Intel's e1000 wired networking driver has started...

    Phoronix, Linux Hardware Reviews, Linux hardware benchmarks, Linux server benchmarks, Linux benchmarking, Desktop Linux, Linux performance, Open Source graphics, Linux How To, Ubuntu benchmarks, Ubuntu hardware, Phoronix Test Suite

  • #2
    In this source unit: https://github.com/fujita/rust-e1000.../rust_e1000.rs

    48 unsafe keywords in 1224 lines. And that is generous because many unsafe sections span many lines. An example of a longer one is this:
    https://github.com/fujita/rust-e1000..._e1000.rs#L219

    Is that really worth it? Perhaps in future there will be more infrastructure to access the raw parts in a safer manner.

    That said, it is very fun to see drivers written in higher level languages. A cool project!
    Last edited by kpedersen; 19 September 2022, 06:32 AM.

    Comment


    • #3
      Originally posted by kpedersen View Post
      Is that really worth it? Perhaps in future there will be more infrastructure to access the raw parts in a safer manner.
      It is even mentioned in article and in GitHub project: for figuring out proper Rust PCI, DMA, network abstraction APIs for NIC drivers. Someone has to be first and unsafe

      Comment


      • #4
        Also that is what unsave is for: interfering with low level hardware stuff. Probably some unsafe sections can be done in safe rust, time will show.

        If you get a strange error you atleast know where to look at.

        Comment


        • #5
          Originally posted by kpedersen View Post
          In this source unit: https://github.com/fujita/rust-e1000.../rust_e1000.rs

          48 unsafe keywords in 1224 lines. And that is generous because many unsafe sections span many lines. An example of a longer one is this:
          https://github.com/fujita/rust-e1000..._e1000.rs#L219

          Is that really worth it? Perhaps in future there will be more infrastructure to access the raw parts in a safer manner.

          That said, it is very fun to see drivers written in higher level languages. A cool project!
          Well most of those lines are for directly interacting with hardware in that case it makes sense to use unsafe because Rust compiler can't know what hardware is doing. Rust unsafe is still safer then C/C++

          Comment


          • #6
            Cool!

            What driver or subsystem of Linux would you like to see ported to Rust?

            Comment


            • #7
              Originally posted by kpedersen View Post
              i += 1;​

              Really? Also 'let this, let that'. This is some js syntax bullshit. Couldn't they keep it more C like?

              Comment


              • #8
                Originally posted by uid313 View Post
                Cool!

                What driver or subsystem of Linux would you like to see ported to Rust?
                Are you a developer collecting requests?
                I'd like to have memory management, filesystems and process management as well as networking. Take your time and thanks.
                Last edited by Anux; 19 September 2022, 08:15 AM.

                Comment


                • #9
                  Unsafe usage in of itself is not a bad thing; it's necessary for the kind of low level hardware interactions required for a driver. As long as each call site is kept to a minimal scope where the invariants can be reasoned about, there's no problem.

                  Comment


                  • #10
                    Originally posted by uid313 View Post
                    Cool!

                    What driver or subsystem of Linux would you like to see ported to Rust?
                    none.

                    Comment

                    Working...
                    X