From 5bbb05362b72bd41a9e76090014bd0d50aca65f0 Mon Sep 17 00:00:00 2001 From: whitequark Date: Tue, 7 Mar 2017 07:25:00 +0000 Subject: [PATCH] runtime: update smoltcp. --- artiq/firmware/Cargo.lock | 14 +++++++------- artiq/firmware/runtime/Cargo.toml | 4 ++-- artiq/firmware/runtime/ethmac.rs | 9 +++++++-- artiq/firmware/runtime/lib.rs | 4 ++-- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/artiq/firmware/Cargo.lock b/artiq/firmware/Cargo.lock index efae082ed..8ed18c45a 100644 --- a/artiq/firmware/Cargo.lock +++ b/artiq/firmware/Cargo.lock @@ -136,7 +136,7 @@ dependencies = [ [[package]] name = "managed" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -166,7 +166,7 @@ dependencies = [ "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "logger_artiq 0.0.0", "proto 0.0.0", - "smoltcp 0.2.1 (git+https://github.com/m-labs/smoltcp?rev=e8ece3e)", + "smoltcp 0.4.0-pre (git+https://github.com/m-labs/smoltcp?rev=1622244)", "std_artiq 0.0.0", ] @@ -191,12 +191,12 @@ dependencies = [ [[package]] name = "smoltcp" -version = "0.2.1" -source = "git+https://github.com/m-labs/smoltcp?rev=e8ece3e#e8ece3e56775f38b41906c442db320c980b98c94" +version = "0.4.0-pre" +source = "git+https://github.com/m-labs/smoltcp?rev=1622244#16222445a6245d29a2ffb1671a9817747676fdd7" dependencies = [ "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "managed 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "managed 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -229,9 +229,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum libc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "a51822fc847e7a8101514d1d44e354ba2ffa7d4c194dcab48870740e327cac70" "checksum log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ab83497bf8bf4ed2a74259c1c802351fcd67a65baa86394b6ba73c36f4838054" "checksum log_buffer 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ec57723b84bbe7bdf76aa93169c9b59e67473317c6de3a83cb2a0f8ccb2aa493" -"checksum managed 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5981b4c6de5ce272aaf2caaa56adb8f6fd24a73206b38302db572ab9374aab10" +"checksum managed 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "61eb783b4fa77e8fa4d27ec400f97ed9168546b8b30341a120b7ba9cc6571aaf" "checksum rustc-cfg 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "56a596b5718bf5e059d59a30af12f7f462a152de147aa462b70892849ee18704" -"checksum smoltcp 0.2.1 (git+https://github.com/m-labs/smoltcp?rev=e8ece3e)" = "" +"checksum smoltcp 0.4.0-pre (git+https://github.com/m-labs/smoltcp?rev=1622244)" = "" "checksum walkdir 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "dd7c16466ecc507c7cb5988db03e6eab4aaeab89a5c37a29251fcfd3ac9b7afe" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" diff --git a/artiq/firmware/runtime/Cargo.toml b/artiq/firmware/runtime/Cargo.toml index 69575572f..64e73bc02 100644 --- a/artiq/firmware/runtime/Cargo.toml +++ b/artiq/firmware/runtime/Cargo.toml @@ -32,6 +32,6 @@ features = ["mem"] [dependencies.smoltcp] git = "https://github.com/m-labs/smoltcp" -rev = "e8ece3e" +rev = "1622244" default-features = false -features = ["use_alloc", "use_collections", "use_log"]#, "verbose"] +features = ["alloc", "collections", "log"]#, "verbose"] diff --git a/artiq/firmware/runtime/ethmac.rs b/artiq/firmware/runtime/ethmac.rs index b42d756fa..a2b4e281f 100644 --- a/artiq/firmware/runtime/ethmac.rs +++ b/artiq/firmware/runtime/ethmac.rs @@ -1,7 +1,7 @@ use core::slice; use board::{csr, mem}; use smoltcp::Error; -use smoltcp::phy::Device; +use smoltcp::phy::{DeviceLimits, Device}; const RX0_BASE: usize = mem::ETHMAC_BASE + 0x0000; const RX1_BASE: usize = mem::ETHMAC_BASE + 0x0800; @@ -23,7 +23,12 @@ impl Device for EthernetDevice { type RxBuffer = RxBuffer; type TxBuffer = TxBuffer; - fn mtu(&self) -> usize { 1500 } + fn limits(&self) -> DeviceLimits { + let mut limits = DeviceLimits::default(); + limits.max_transmission_unit = 1500; + limits.max_burst_size = Some(RX_BUFFERS.len()); + limits + } fn receive(&mut self) -> Result { unsafe { diff --git a/artiq/firmware/runtime/lib.rs b/artiq/firmware/runtime/lib.rs index a3c603c68..61e52920e 100644 --- a/artiq/firmware/runtime/lib.rs +++ b/artiq/firmware/runtime/lib.rs @@ -85,7 +85,7 @@ fn startup() { board::ad9154::init().expect("cannot initialize ad9154"); let hardware_addr; - match config::read_str("mac", |r| r.and_then(|s| EthernetAddress::parse(s))) { + match config::read_str("mac", |r| r?.parse()) { Err(()) => { hardware_addr = EthernetAddress([0x02, 0x00, 0x00, 0x00, 0x00, 0x01]); warn!("using default MAC address {}; consider changing it", hardware_addr); @@ -97,7 +97,7 @@ fn startup() { } let protocol_addr; - match config::read_str("ip", |r| r.and_then(|s| IpAddress::parse(s))) { + match config::read_str("ip", |r| r?.parse()) { Err(()) | Ok(IpAddress::Unspecified) => { protocol_addr = IpAddress::v4(192, 168, 1, 50); info!("using default IP address {}", protocol_addr);