Don't set the mac address network config from drivers

The mac handle of the network scheme is now supported by all network
drivers.
This commit is contained in:
bjorn3
2024-02-28 09:36:42 +01:00
parent 9262d034bd
commit d33d7a91e5
15 changed files with 6 additions and 205 deletions
Generated
+6 -162
View File
@@ -43,7 +43,7 @@ version = "0.1.0"
dependencies = [
"bitflags 1.3.2",
"block-io-wrapper",
"byteorder 1.4.3",
"byteorder",
"common",
"log",
"partitionlib",
@@ -59,7 +59,6 @@ version = "0.1.0"
dependencies = [
"bitflags 1.3.2",
"common",
"netutils",
"redox-daemon",
"redox_event 0.1.0",
"redox_syscall 0.4.1",
@@ -72,7 +71,7 @@ source = "git+https://github.com/rw-vanc/acpi.git?branch=cumulative#e4eb93891367
dependencies = [
"bit_field",
"bitvec",
"byteorder 1.4.3",
"byteorder",
"log",
"spinning_top",
]
@@ -117,11 +116,6 @@ version = "1.0.75"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6"
[[package]]
name = "arg_parser"
version = "0.1.0"
source = "git+https://gitlab.redox-os.org/redox-os/arg-parser.git#1c434b55f3e1a0375ebcca85b3e88db7378e82fa"
[[package]]
name = "arrayvec"
version = "0.5.2"
@@ -222,12 +216,6 @@ version = "3.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1"
[[package]]
name = "byteorder"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855"
[[package]]
name = "byteorder"
version = "1.4.3"
@@ -332,16 +320,6 @@ dependencies = [
"maybe-uninit",
]
[[package]]
name = "crossbeam-channel"
version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200"
dependencies = [
"cfg-if 1.0.0",
"crossbeam-utils 0.8.16",
]
[[package]]
name = "crossbeam-queue"
version = "0.3.8"
@@ -387,7 +365,6 @@ dependencies = [
"bitflags 1.3.2",
"common",
"driver-network",
"netutils",
"pcid",
"redox-daemon",
"redox_event 0.1.0",
@@ -527,7 +504,7 @@ checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427"
dependencies = [
"cfg-if 1.0.0",
"libc",
"wasi 0.11.0+wasi-snapshot-preview1",
"wasi",
]
[[package]]
@@ -603,17 +580,6 @@ dependencies = [
"redox_syscall 0.4.1",
]
[[package]]
name = "idna"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e"
dependencies = [
"matches",
"unicode-bidi",
"unicode-normalization",
]
[[package]]
name = "ihdad"
version = "0.1.0"
@@ -674,7 +640,6 @@ dependencies = [
"bitflags 1.3.2",
"common",
"driver-network",
"netutils",
"pcid",
"redox-daemon",
"redox_event 0.1.0",
@@ -749,12 +714,6 @@ version = "0.4.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
[[package]]
name = "matches"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5"
[[package]]
name = "maybe-uninit"
version = "2.0.0"
@@ -767,43 +726,6 @@ version = "2.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c"
[[package]]
name = "net2"
version = "0.2.37"
source = "git+https://gitlab.redox-os.org/redox-os/net2-rs.git?branch=master#db0604dcb0a355e6b2fa5bcaad8f175bd6aeb5aa"
dependencies = [
"cfg-if 0.1.10",
"libc",
"winapi",
]
[[package]]
name = "netutils"
version = "0.1.0"
source = "git+https://gitlab.redox-os.org/redox-os/netutils.git#d1998d5aa2809b7f0c433f2df3125eecfbfa5c86"
dependencies = [
"arg_parser",
"libc",
"net2",
"ntpclient",
"pbr",
"redox-daemon",
"redox_event 0.1.0",
"redox_syscall 0.3.5",
"redox_termios",
"termion",
"url",
]
[[package]]
name = "ntpclient"
version = "0.0.1"
source = "git+https://github.com/willem66745/ntpclient-rust#7e3bdf60eb940825789a8da5181025320e3050b0"
dependencies = [
"byteorder 0.5.3",
"time",
]
[[package]]
name = "num-derive"
version = "0.3.3"
@@ -838,7 +760,7 @@ dependencies = [
"bitflags 1.3.2",
"block-io-wrapper",
"common",
"crossbeam-channel 0.4.4",
"crossbeam-channel",
"futures",
"log",
"partitionlib",
@@ -965,17 +887,6 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f0b59668fe80c5afe998f0c0bf93322bf2cd66cafeeb80581f291716f3467f2"
[[package]]
name = "pbr"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed5827dfa0d69b6c92493d6c38e633bbaa5937c153d0d7c28bf12313f8c6d514"
dependencies = [
"crossbeam-channel 0.5.8",
"libc",
"winapi",
]
[[package]]
name = "pci_types"
version = "0.6.1"
@@ -993,7 +904,7 @@ dependencies = [
"bincode",
"bit_field",
"bitflags 1.3.2",
"byteorder 1.4.3",
"byteorder",
"common",
"libc",
"log",
@@ -1017,12 +928,6 @@ dependencies = [
"redox_syscall 0.4.1",
]
[[package]]
name = "percent-encoding"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831"
[[package]]
name = "pin-project-lite"
version = "0.2.13"
@@ -1230,7 +1135,6 @@ dependencies = [
"common",
"driver-network",
"log",
"netutils",
"pcid",
"redox-daemon",
"redox-log",
@@ -1246,7 +1150,6 @@ dependencies = [
"common",
"driver-network",
"log",
"netutils",
"pcid",
"redox-daemon",
"redox-log",
@@ -1526,32 +1429,6 @@ dependencies = [
"syn 2.0.31",
]
[[package]]
name = "time"
version = "0.1.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a"
dependencies = [
"libc",
"wasi 0.10.0+wasi-snapshot-preview1",
"winapi",
]
[[package]]
name = "tinyvec"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50"
dependencies = [
"tinyvec_macros",
]
[[package]]
name = "tinyvec_macros"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "toml"
version = "0.5.11"
@@ -1595,27 +1472,12 @@ dependencies = [
"winnow",
]
[[package]]
name = "unicode-bidi"
version = "0.3.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460"
[[package]]
name = "unicode-ident"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c"
[[package]]
name = "unicode-normalization"
version = "0.1.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921"
dependencies = [
"tinyvec",
]
[[package]]
name = "unicode-segmentation"
version = "1.10.1"
@@ -1628,17 +1490,6 @@ version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
[[package]]
name = "url"
version = "1.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a"
dependencies = [
"idna",
"matches",
"percent-encoding",
]
[[package]]
name = "usbctl"
version = "0.1.0"
@@ -1799,7 +1650,6 @@ dependencies = [
"driver-network",
"futures",
"log",
"netutils",
"pcid",
"redox-daemon",
"redox_syscall 0.4.1",
@@ -1816,12 +1666,6 @@ dependencies = [
"utf8parse",
]
[[package]]
name = "wasi"
version = "0.10.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
@@ -1995,7 +1839,7 @@ dependencies = [
"bitflags 1.3.2",
"chashmap",
"common",
"crossbeam-channel 0.4.4",
"crossbeam-channel",
"futures",
"lazy_static",
"log",
-1
View File
@@ -42,6 +42,5 @@ lto = "fat"
[patch.crates-io]
mio = { git = "https://gitlab.redox-os.org/redox-os/mio.git", branch = "redox-unix" }
net2 = { git = "https://gitlab.redox-os.org/redox-os/net2-rs.git", branch = "master" }
orbclient = { git = "https://gitlab.redox-os.org/redox-os/orbclient.git", version = "0.3.44" }
redox-daemon = { git = "https://gitlab.redox-os.org/redox-os/redox-daemon.git" }
-1
View File
@@ -5,7 +5,6 @@ edition = "2018"
[dependencies]
bitflags = "1"
netutils = { git = "https://gitlab.redox-os.org/redox-os/netutils.git" }
redox_event = { git = "https://gitlab.redox-os.org/redox-os/event.git" }
redox_syscall = "0.4"
redox-daemon = "0.1"
-2
View File
@@ -7,7 +7,6 @@ use syscall::io::{Io, Mmio};
use syscall::scheme;
use common::dma::Dma;
use netutils::setcfg;
use self::regs::*;
@@ -1706,7 +1705,6 @@ impl Alx {
let mac = self.get_perm_macaddr();
println!(" - MAC: {:>02X}:{:>02X}:{:>02X}:{:>02X}:{:>02X}:{:>02X}\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
let _ = setcfg("mac", &format!("{:>02X}-{:>02X}-{:>02X}-{:>02X}-{:>02X}-{:>02X}\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]));
if ! self.get_phy_info() {
println!(" - Identify PHY failed");
-1
View File
@@ -4,7 +4,6 @@
#![feature(concat_idents)]
extern crate event;
extern crate netutils;
extern crate syscall;
use std::cell::RefCell;
-1
View File
@@ -5,7 +5,6 @@ edition = "2018"
[dependencies]
bitflags = "1"
netutils = { git = "https://gitlab.redox-os.org/redox-os/netutils.git" }
redox-daemon = "0.1"
redox_event = { git = "https://gitlab.redox-os.org/redox-os/event.git" }
redox_syscall = "0.4"
-8
View File
@@ -2,7 +2,6 @@ use std::convert::TryInto;
use std::{cmp, mem, ptr, slice};
use driver_network::NetworkAdapter;
use netutils::setcfg;
use syscall::error::Result;
@@ -296,13 +295,6 @@ impl Intel8254x {
)
);
self.mac_address = mac;
let _ = setcfg(
"mac",
&format!(
"{:>02X}-{:>02X}-{:>02X}-{:>02X}-{:>02X}-{:>02X}\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]
),
);
//
// MTA => 0;
-1
View File
@@ -5,7 +5,6 @@ edition = "2021"
[dependencies]
bitflags = "1.0"
netutils = { git = "https://gitlab.redox-os.org/redox-os/netutils.git" }
redox_event = { git = "https://gitlab.redox-os.org/redox-os/event.git" }
redox_syscall = "0.4"
redox-daemon = "0.1"
-8
View File
@@ -6,7 +6,6 @@ use driver_network::NetworkAdapter;
use syscall::error::Result;
use common::dma::Dma;
use netutils::setcfg;
use crate::ixgbe::*;
@@ -285,13 +284,6 @@ impl Intel8259x {
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]
);
let _ = setcfg(
"mac",
&format!(
"{:>02X}-{:>02X}-{:>02X}-{:>02X}-{:>02X}-{:>02X}\n",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]
),
);
self.mac_address = mac;
// section 4.6.3 - wait for EEPROM auto read completion
-1
View File
@@ -6,7 +6,6 @@ edition = "2018"
[dependencies]
bitflags = "1"
log = "0.4"
netutils = { git = "https://gitlab.redox-os.org/redox-os/netutils.git" }
redox_event = { git = "https://gitlab.redox-os.org/redox-os/event.git" }
redox_syscall = "0.4"
redox-daemon = "0.1"
-2
View File
@@ -6,7 +6,6 @@ use syscall::error::{Error, EIO, EMSGSIZE, Result};
use syscall::io::{Mmio, Io, ReadOnly};
use common::dma::Dma;
use netutils::setcfg;
const RX_BUFFER_SIZE: usize = 64 * 1024;
@@ -272,7 +271,6 @@ impl Rtl8139 {
mac_high as u8,
(mac_high >> 8) as u8];
println!(" - MAC: {:>02X}:{:>02X}:{:>02X}:{:>02X}:{:>02X}:{:>02X}", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
let _ = setcfg("mac", &format!("{:>02X}-{:>02X}-{:>02X}-{:>02X}-{:>02X}-{:>02X}\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]));
self.mac_address = mac;
// Reset - this will disable tx and rx, reinitialize FIFOs, and set the system buffer pointer to the initial value
-1
View File
@@ -6,7 +6,6 @@ edition = "2018"
[dependencies]
bitflags = "1"
log = "0.4"
netutils = { git = "https://gitlab.redox-os.org/redox-os/netutils.git" }
redox_event = { git = "https://gitlab.redox-os.org/redox-os/event.git" }
redox_syscall = "0.4"
redox-daemon = "0.1"
-2
View File
@@ -6,7 +6,6 @@ use syscall::error::{Error, Result, EMSGSIZE};
use syscall::io::{Mmio, Io, ReadOnly};
use common::dma::Dma;
use netutils::setcfg;
#[repr(packed)]
struct Regs {
@@ -232,7 +231,6 @@ impl Rtl8168 {
mac_high as u8,
(mac_high >> 8) as u8];
println!(" - MAC: {:>02X}:{:>02X}:{:>02X}:{:>02X}:{:>02X}:{:>02X}", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
let _ = setcfg("mac", &format!("{:>02X}-{:>02X}-{:>02X}-{:>02X}-{:>02X}-{:>02X}\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]));
self.mac_address = mac;
// Reset - this will disable tx and rx, reinitialize FIFOs, and set the system buffer pointer to the initial value
-1
View File
@@ -15,4 +15,3 @@ driver-network = { path = "../driver-network" }
redox-daemon = "0.1"
redox_syscall = "0.4"
netutils = { git = "https://gitlab.redox-os.org/redox-os/netutils.git" }
-13
View File
@@ -95,19 +95,6 @@ fn deamon(daemon: redox_daemon::Daemon) -> Result<(), Box<dyn std::error::Error>
let device = VirtioNet::new(mac_address, rx_queue, tx_queue);
let mut scheme = NetworkScheme::new(device, "network");
let _ = netutils::setcfg(
"mac",
&format!(
"{:>02X}:{:>02X}:{:>02X}:{:>02X}:{:>02X}:{:>02X}",
mac_address[0],
mac_address[1],
mac_address[2],
mac_address[3],
mac_address[4],
mac_address[5]
),
);
let mut event_queue = File::open("event:")?;
event_queue.write(&syscall::Event {
id: scheme.event_handle() as usize,