From 8b4a00685560919e261061b2ff6a26ec0323e89e Mon Sep 17 00:00:00 2001 From: whitequark Date: Tue, 26 Dec 2017 14:33:56 +0000 Subject: [PATCH] runtime: update smoltcp. --- artiq/firmware/Cargo.lock | 6 +++--- artiq/firmware/runtime/Cargo.toml | 4 ++-- artiq/firmware/runtime/lib.rs | 17 +++++++++++------ 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/artiq/firmware/Cargo.lock b/artiq/firmware/Cargo.lock index 353118496..0fcaac872 100644 --- a/artiq/firmware/Cargo.lock +++ b/artiq/firmware/Cargo.lock @@ -165,7 +165,7 @@ dependencies = [ "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "logger_artiq 0.0.0", "proto 0.0.0", - "smoltcp 0.4.0 (git+https://github.com/m-labs/smoltcp?rev=960b001)", + "smoltcp 0.4.0 (git+https://github.com/m-labs/smoltcp?rev=507d2fe)", "std_artiq 0.0.0", ] @@ -200,7 +200,7 @@ dependencies = [ [[package]] name = "smoltcp" version = "0.4.0" -source = "git+https://github.com/m-labs/smoltcp?rev=960b001#960b0012a09d37dde1d86b28bb5531316f606bfd" +source = "git+https://github.com/m-labs/smoltcp?rev=507d2fe#507d2fe0ea390ec309d2e900a9d0d4a70a3dfa3c" dependencies = [ "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -245,7 +245,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum managed 0.4.0 (git+https://github.com/m-labs/rust-managed.git?rev=629a6786a1cf1692015f464ed16c04eafa5cb8d1)" = "" "checksum rustc-cfg 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "56a596b5718bf5e059d59a30af12f7f462a152de147aa462b70892849ee18704" "checksum same-file 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d931a44fdaa43b8637009e7632a02adc4f2b2e0733c08caa4cf00e8da4a117a7" -"checksum smoltcp 0.4.0 (git+https://github.com/m-labs/smoltcp?rev=960b001)" = "" +"checksum smoltcp 0.4.0 (git+https://github.com/m-labs/smoltcp?rev=507d2fe)" = "" "checksum walkdir 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "bb08f9e670fab86099470b97cd2b252d6527f0b3cc1401acdb595ffc9dd288ff" "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 f9db55dee..00f1ca121 100644 --- a/artiq/firmware/runtime/Cargo.toml +++ b/artiq/firmware/runtime/Cargo.toml @@ -38,6 +38,6 @@ features = ["alloc"] [dependencies.smoltcp] git = "https://github.com/m-labs/smoltcp" -rev = "960b001" +rev = "507d2fe" default-features = false -features = ["alloc", "log", "socket-tcp"] +features = ["alloc", "log", "proto-ipv4", "socket-tcp"] diff --git a/artiq/firmware/runtime/lib.rs b/artiq/firmware/runtime/lib.rs index 784a42f45..fba23d853 100644 --- a/artiq/firmware/runtime/lib.rs +++ b/artiq/firmware/runtime/lib.rs @@ -141,7 +141,7 @@ fn startup_ethernet() { // where U: smoltcp::wire::pretty_print::PrettyPrint { // let seconds = timestamp / 1000; // let micros = timestamp % 1000 * 1000; - // print!("\x1b[37m[{:6}.{:06}s]\n{}\x1b[0m", seconds, micros, printer) + // print!("\x1b[37m[{:6}.{:06}s]\n{}\x1b[0m\n", seconds, micros, printer) // } let net_device = unsafe { ethmac::EthernetDevice::new() }; @@ -193,11 +193,16 @@ fn startup_ethernet() { loop { scheduler.run(); - match interface.poll(&mut *borrow_mut!(scheduler.sockets()), - board::clock::get_ms()) { - Ok(_poll_at) => (), - Err(smoltcp::Error::Unrecognized) => (), - Err(err) => warn!("network error: {}", err) + { + let sockets = &mut *borrow_mut!(scheduler.sockets()); + loop { + match interface.poll(sockets, board::clock::get_ms()) { + Ok(true) => (), + Ok(false) => break, + Err(smoltcp::Error::Unrecognized) => (), + Err(err) => warn!("network error: {}", err) + } + } } if let Some(_net_stats_diff) = net_stats.update() {