Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update smoltcp from 0.9.1 to 0.10.0 #510

Merged
merged 3 commits into from
Jun 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## Unreleased
- Update smoltcp from 0.9.1 to 0.10.0 ([#510](https://github.com/vinc/moros/pull/510))

## 0.10.0 (2023-06-21)
- Add cut/copy/paste to editor ([#456](https://github.com/vinc/moros/pull/456))
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ rand = { version = "0.8.5", default-features = false }
rand_hc = "0.3.1"
raw-cpuid = "11.0.1"
sha2 = { version = "0.10.7", default-features = false, features = ["force-soft"] }
smoltcp = { version = "0.9.1", default-features = false, features = ["alloc", "medium-ethernet", "socket-tcp", "socket-udp", "socket-dhcpv4", "proto-ipv4", "proto-dhcpv4"] }
smoltcp = { version = "0.10.0", default-features = false, features = ["alloc", "medium-ethernet", "socket-tcp", "socket-udp", "socket-dhcpv4", "proto-ipv4", "proto-dhcpv4"] }
spin = "0.9.8"
time = { version = "0.2.27", default-features = false }
uart_16550 = "0.2.18"
Expand Down
7 changes: 4 additions & 3 deletions src/sys/net/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use alloc::vec::Vec;
use core::sync::atomic::{AtomicBool, AtomicU64, Ordering};
use smoltcp::iface::Interface;
use smoltcp::phy::DeviceCapabilities;
use smoltcp::time::Instant;
use smoltcp::wire::EthernetAddress;
use spin::Mutex;

Expand Down Expand Up @@ -221,9 +222,9 @@ pub fn init() {
if let Some(mac) = device.config().mac() {
log!("NET {} MAC {}\n", name, mac);

let mut config = smoltcp::iface::Config::new();
config.hardware_addr = Some(mac.into());
let iface = Interface::new(config, &mut device);
let config = smoltcp::iface::Config::new(mac.into());
let time = Instant::from_micros((sys::clock::realtime() * 1000000.0) as i64);
let iface = Interface::new(config, &mut device, time);

*NET.lock() = Some((iface, device));
}
Expand Down
6 changes: 3 additions & 3 deletions src/usr/dhcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ pub fn main(args: &[&str]) -> Result<(), ExitCode> {
return Err(ExitCode::Failure);
}

let timestamp = Instant::from_micros((clock::realtime() * 1000000.0) as i64);
iface.poll(timestamp, device, &mut sockets);
let time = Instant::from_micros((clock::realtime() * 1000000.0) as i64);
iface.poll(time, device, &mut sockets);
let event = sockets.get_mut::<dhcpv4::Socket>(dhcp_handle).poll();

match event {
Expand All @@ -60,7 +60,7 @@ pub fn main(args: &[&str]) -> Result<(), ExitCode> {
}
}

if let Some(wait_duration) = iface.poll_delay(timestamp, &sockets) {
if let Some(wait_duration) = iface.poll_delay(time, &sockets) {
syscall::sleep((wait_duration.total_micros() as f64) / 1000000.0);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/usr/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ pub fn resolve(name: &str) -> Result<IpAddress, ResponseCode> {
return Err(ResponseCode::NetworkError);
}

let timestamp = Instant::from_micros((clock::realtime() * 1000000.0) as i64);
iface.poll(timestamp, device, &mut sockets);
let time = Instant::from_micros((clock::realtime() * 1000000.0) as i64);
iface.poll(time, device, &mut sockets);
let socket = sockets.get_mut::<udp::Socket>(udp_handle);

state = match state {
Expand Down Expand Up @@ -214,7 +214,7 @@ pub fn resolve(name: &str) -> Result<IpAddress, ResponseCode> {
_ => state
};

if let Some(wait_duration) = iface.poll_delay(timestamp, &sockets) {
if let Some(wait_duration) = iface.poll_delay(time, &sockets) {
syscall::sleep((wait_duration.total_micros() as f64) / 1000000.0);

}
Expand Down
6 changes: 3 additions & 3 deletions src/usr/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ pub fn main(args: &[&str]) -> Result<(), ExitCode> {
return Err(ExitCode::Failure);
}

let timestamp = Instant::from_micros((clock::realtime() * 1000000.0) as i64);
iface.poll(timestamp, device, &mut sockets);
let time = Instant::from_micros((clock::realtime() * 1000000.0) as i64);
iface.poll(time, device, &mut sockets);
let socket = sockets.get_mut::<tcp::Socket>(tcp_handle);
let cx = iface.context();

Expand Down Expand Up @@ -225,7 +225,7 @@ pub fn main(args: &[&str]) -> Result<(), ExitCode> {
_ => session_state
};

if let Some(wait_duration) = iface.poll_delay(timestamp, &sockets) {
if let Some(wait_duration) = iface.poll_delay(time, &sockets) {
syscall::sleep((wait_duration.total_micros() as f64) / 1000000.0);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/usr/httpd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ pub fn main(args: &[&str]) -> Result<(), ExitCode> {
return Ok(());
}

let timestamp = Instant::from_micros((clock::realtime() * 1000000.0) as i64);
iface.poll(timestamp, device, &mut sockets);
let time = Instant::from_micros((clock::realtime() * 1000000.0) as i64);
iface.poll(time, device, &mut sockets);

for (tcp_handle, send_queue, keep_alive) in &mut connections {
let socket = sockets.get_mut::<tcp::Socket>(*tcp_handle);
Expand Down Expand Up @@ -363,7 +363,7 @@ pub fn main(args: &[&str]) -> Result<(), ExitCode> {
send_queue.clear();
}
}
if let Some(wait_duration) = iface.poll_delay(timestamp, &sockets) {
if let Some(wait_duration) = iface.poll_delay(time, &sockets) {
let t = wait_duration.total_micros() / POLL_DELAY_DIV as u64;
if t > 0 {
syscall::sleep((t as f64) / 1000000.0);
Expand Down
4 changes: 2 additions & 2 deletions src/usr/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ pub fn main(args: &[&str]) -> Result<(), ExitCode> {
}
syscall::sleep(0.1);

let timestamp = Instant::from_micros((clock::realtime() * 1000000.0) as i64);
iface.poll(timestamp, device, &mut sockets);
let time = Instant::from_micros((clock::realtime() * 1000000.0) as i64);
iface.poll(time, device, &mut sockets);
let socket = sockets.get_mut::<tcp::Socket>(tcp_handle);
if socket.may_recv() {
socket.recv(|buffer| {
Expand Down
6 changes: 3 additions & 3 deletions src/usr/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ pub fn main(args: &[&str]) -> Result<(), ExitCode> {
return Err(ExitCode::Failure);
}

let timestamp = Instant::from_micros((clock::realtime() * 1000000.0) as i64);
iface.poll(timestamp, device, &mut sockets);
let time = Instant::from_micros((clock::realtime() * 1000000.0) as i64);
iface.poll(time, device, &mut sockets);
let socket = sockets.get_mut::<tcp::Socket>(tcp_handle);
let cx = iface.context();

Expand Down Expand Up @@ -211,7 +211,7 @@ pub fn main(args: &[&str]) -> Result<(), ExitCode> {
if interval > 0.0 {
syscall::sleep(interval);
}
if let Some(wait_duration) = iface.poll_delay(timestamp, &sockets) {
if let Some(wait_duration) = iface.poll_delay(time, &sockets) {
syscall::sleep((wait_duration.total_micros() as f64) / 1000000.0);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/usr/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ pub fn main(args: &[&str]) -> Result<(), ExitCode> {
return Err(ExitCode::Failure);
}

let timestamp = Instant::from_micros((clock::realtime() * 1000000.0) as i64);
iface.poll(timestamp, device, &mut sockets);
let time = Instant::from_micros((clock::realtime() * 1000000.0) as i64);
iface.poll(time, device, &mut sockets);
let socket = sockets.get_mut::<tcp::Socket>(tcp_handle);
let cx = iface.context();

Expand Down Expand Up @@ -121,7 +121,7 @@ pub fn main(args: &[&str]) -> Result<(), ExitCode> {
_ => state
};

if let Some(wait_duration) = iface.poll_delay(timestamp, &sockets) {
if let Some(wait_duration) = iface.poll_delay(time, &sockets) {
syscall::sleep((wait_duration.total_micros() as f64) / 1000000.0);
}
}
Expand Down