Skip to content

Commit

Permalink
Merge pull request #419 from betrusted-io/smoltcp-port
Browse files Browse the repository at this point in the history
let's get it into ci, it's passing all the local tests
  • Loading branch information
bunnie authored Oct 3, 2023
2 parents 7e20460 + d330376 commit 81a8720
Show file tree
Hide file tree
Showing 16 changed files with 710 additions and 593 deletions.
147 changes: 70 additions & 77 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ rev="4296c2e7904898766cf7d8d589759a129794783b" # use the commitref because we're
path = "./utralib"
[patch.crates-io.svd2utra]
path = "./svd2utra"
# [patch.crates-io.xous]
# path = "./xous-rs"
[patch.crates-io.xous]
path = "./xous-rs"
# [patch.crates-io.xous-ipc]
# path = "./xous-ipc"
# [patch.crates-io.xous-api-names]
Expand Down
3 changes: 3 additions & 0 deletions RELEASE-v0.9.md
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,9 @@ perform the Xous firmware upgrade. This requires running manual update commands,
## New in v0.9.15
- refresh item cache after leaving vault host readout mode
- Regressions have bee found in Rust 1.72. We suspect the llvm back-end for RV32 is emitting invalid code, see issue #416 and #417 for more details. For now, the optimization level has been set to `s` as a work-around.
- Network stack is updated to work with the `main` branch of `smoltcp`. This is not intended as a release configuration -- this note is here so that when a release is snapshotted out, we remember to pin to a particular commit (or ideally an official release, if one happens in time).
- This fixes a number of long-standing issues, including #210 and #407.
- Fairly major overhaul to the network stack. We now use mspc primitives to implement the wait/poll loop, which should make the net stack much more efficient and robust.

## Roadmap
- Lots of testing and bug fixes
Expand Down
5 changes: 3 additions & 2 deletions services/net/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ xous-semver = "0.1.2"
[dependencies.smoltcp]
# some historical notes for development on branches in the future
# path = "../../../smoltcp"
#git = "https://github.com/smoltcp-rs/smoltcp.git"
git = "https://github.com/smoltcp-rs/smoltcp.git"
branch = "main"
#git = "https://github.com/betrusted-io/smoltcp.git"
#rev = "35c8ec3d30c846442a1faae01fb0537641aef898"
# 0.8.1 drops the rand_core dep and doesn't have the breaking IPv4 change (see issue #613)
version = "0.8.1"
# version = "0.8.1"
default-features = false
features = [
"std", "log", # needed for `cargo test --no-default-features --features default` :/
Expand Down
5 changes: 3 additions & 2 deletions services/net/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ pub const MIN_EC_REV: SemVer = SemVer {
};

/// Dispatch opcodes to the Net crate main loop.
#[derive(num_derive::FromPrimitive, num_derive::ToPrimitive, Debug)]
#[derive(num_derive::FromPrimitive, num_derive::ToPrimitive, Debug, PartialEq, Eq)]
#[repr(C)]
pub(crate) enum Opcode {
SetupMpsc = 0,
SetDebug = 1,
/// Calls for UDP implementation (now deprecated to libstd)
//UdpBind = 0,
//UdpClose = 1,
Expand Down Expand Up @@ -457,7 +459,6 @@ pub fn ipaddress_to_ipaddr(other: IpAddress) -> IpAddr {
let octets = ipv6.0;
IpAddr::V6(Ipv6Addr::from(octets))
}
_ => unimplemented!(),
}
}

Expand Down
3 changes: 0 additions & 3 deletions services/net/src/api/rkyv_enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ impl From<IpAddress> for NetIpAddr {
match other {
IpAddress::Ipv4(ipv4) => NetIpAddr::Ipv4(ipv4.0),
IpAddress::Ipv6(ipv6) => NetIpAddr::Ipv6(ipv6.0),
_ => {
panic!("Invalid IpAddress")
}
}
}
}
Expand Down
283 changes: 209 additions & 74 deletions services/net/src/device.rs

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions services/net/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ impl NetManager {
wifi_state_sid: None,
}
}
pub fn set_debug_level(&self, level: log::LevelFilter) {
let code = match level {
log::LevelFilter::Info => 0,
log::LevelFilter::Debug => 1,
log::LevelFilter::Trace => 2,
_ => 0,
};
send_message(
self.netconn.conn(),
Message::new_scalar(Opcode::SetDebug.to_usize().unwrap(), code, 0, 0, 0),
).expect("couldn't set debug");
}
pub fn get_ipv4_config(&self) -> Option<Ipv4Conf> {
let storage = Some(Ipv4Conf::default().encode_u16());
let mut buf = Buffer::into_buf(storage).expect("Couldn't convert to memory structure");
Expand Down
Loading

0 comments on commit 81a8720

Please sign in to comment.