mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-21 16:33:24 +00:00
Bump smoltcp to newest git version
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
7db9ae23a3
commit
bb4751741a
46
Cargo.lock
generated
46
Cargo.lock
generated
@ -284,15 +284,6 @@ dependencies = [
|
||||
"bytemuck",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atomic-polyfill"
|
||||
version = "0.1.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3ff7eb3f316534d83a8a2c3d1674ace8a5a71198eba31e2e2b597833f699b28"
|
||||
dependencies = [
|
||||
"critical-section",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.1.0"
|
||||
@ -440,12 +431,6 @@ dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "critical-section"
|
||||
version = "1.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216"
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.16"
|
||||
@ -661,9 +646,9 @@ checksum = "e2e1d97fbe9722ba9bbd0c97051c2956e726562b61f86a25a4360398a40edfc9"
|
||||
|
||||
[[package]]
|
||||
name = "hash32"
|
||||
version = "0.2.1"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67"
|
||||
checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
]
|
||||
@ -680,14 +665,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "heapless"
|
||||
version = "0.7.16"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "db04bc24a18b9ea980628ecf00e6c0264f3c1426dac36c00cb49b6fbad8b0743"
|
||||
checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad"
|
||||
dependencies = [
|
||||
"atomic-polyfill",
|
||||
"hash32",
|
||||
"rustc_version",
|
||||
"spin 0.9.8",
|
||||
"stable_deref_trait",
|
||||
]
|
||||
|
||||
@ -1305,15 +1287,6 @@ dependencies = [
|
||||
"log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc_version"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
|
||||
dependencies = [
|
||||
"semver",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustversion"
|
||||
version = "1.0.14"
|
||||
@ -1326,12 +1299,6 @@ version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "1.0.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.196"
|
||||
@ -1369,9 +1336,8 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
|
||||
|
||||
[[package]]
|
||||
name = "smoltcp"
|
||||
version = "0.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7e9786ac45091b96f946693e05bfa4d8ca93e2d3341237d97a380107a6b38dea"
|
||||
version = "0.11.0"
|
||||
source = "git+https://github.com/smoltcp-rs/smoltcp?rev=dc08e0b#dc08e0b42e668c331bb2b6f8d80016301d0efe03"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"byteorder",
|
||||
|
@ -27,7 +27,7 @@ ascii = { version = "1.1", default-features = false, features = ["alloc"] }
|
||||
intrusive-collections = "0.9.5"
|
||||
paste = "1.0"
|
||||
time = { version = "0.3", default-features = false, features = ["alloc"] }
|
||||
smoltcp = { version = "0.9.1", default-features = false, features = [
|
||||
smoltcp = { git = "https://github.com/smoltcp-rs/smoltcp", rev = "dc08e0b", default-features = false, features = [
|
||||
"alloc",
|
||||
"log",
|
||||
"medium-ethernet",
|
||||
@ -51,7 +51,7 @@ bitflags = "1.3"
|
||||
ringbuf = { version = "0.3.2", default-features = false, features = ["alloc"] }
|
||||
keyable-arc = { path = "../libs/keyable-arc" }
|
||||
# unzip initramfs
|
||||
libflate = { version ="2", default-features = false }
|
||||
libflate = { version = "2", default-features = false }
|
||||
core2 = { version = "0.4", default-features = false, features = ["alloc"] }
|
||||
lending-iterator = "0.1.7"
|
||||
spin = "0.9.4"
|
||||
@ -60,7 +60,10 @@ lru = "0.12.3"
|
||||
log = "0.4"
|
||||
bitvec = { version = "1.0", default-features = false, features = ["alloc"] }
|
||||
hashbrown = "0.14"
|
||||
rand = { version = "0.8.5", default-features = false, features = ["small_rng", "std_rng"] }
|
||||
rand = { version = "0.8.5", default-features = false, features = [
|
||||
"small_rng",
|
||||
"std_rng",
|
||||
] }
|
||||
static_assertions = "1.1.0"
|
||||
inherit-methods-macro = { git = "https://github.com/asterinas/inherit-methods-macro", rev = "98f7e3e" }
|
||||
getset = "0.1.2"
|
||||
|
@ -164,7 +164,9 @@ impl IfaceCommon {
|
||||
let mut has_events = false;
|
||||
let mut poll_at;
|
||||
loop {
|
||||
has_events |= interface.poll(timestamp, device, &mut sockets);
|
||||
while interface.poll(timestamp, device, &mut sockets) {
|
||||
has_events = true;
|
||||
}
|
||||
poll_at = interface.poll_at(timestamp, &sockets);
|
||||
let Some(instant) = poll_at else {
|
||||
break;
|
||||
|
@ -8,7 +8,10 @@ use smoltcp::{
|
||||
|
||||
use super::{common::IfaceCommon, internal::IfaceInternal, Iface};
|
||||
use crate::{
|
||||
net::socket::ip::{IpAddress, Ipv4Address},
|
||||
net::{
|
||||
iface::time::get_network_timestamp,
|
||||
socket::ip::{IpAddress, Ipv4Address},
|
||||
},
|
||||
prelude::*,
|
||||
};
|
||||
|
||||
@ -28,8 +31,10 @@ impl IfaceLoopback {
|
||||
pub fn new() -> Arc<Self> {
|
||||
let mut loopback = Loopback::new(Medium::Ip);
|
||||
let interface = {
|
||||
let config = Config::new();
|
||||
let mut interface = smoltcp::iface::Interface::new(config, &mut loopback);
|
||||
let config = Config::new(smoltcp::wire::HardwareAddress::Ip);
|
||||
let now = get_network_timestamp();
|
||||
|
||||
let mut interface = smoltcp::iface::Interface::new(config, &mut loopback, now);
|
||||
interface.update_ip_addrs(|ip_addrs| {
|
||||
debug_assert!(ip_addrs.is_empty());
|
||||
let ip_addr = IpCidr::new(LOOPBACK_ADDRESS, LOOPBACK_ADDRESS_PREFIX_LEN);
|
||||
|
@ -9,7 +9,7 @@ use smoltcp::{
|
||||
wire::{self, IpCidr},
|
||||
};
|
||||
|
||||
use super::{common::IfaceCommon, internal::IfaceInternal, Iface};
|
||||
use super::{common::IfaceCommon, internal::IfaceInternal, time::get_network_timestamp, Iface};
|
||||
use crate::prelude::*;
|
||||
|
||||
pub struct IfaceVirtio {
|
||||
@ -25,14 +25,13 @@ impl IfaceVirtio {
|
||||
let interface = {
|
||||
let mac_addr = virtio_net.lock().mac_addr();
|
||||
let ip_addr = IpCidr::new(wire::IpAddress::Ipv4(wire::Ipv4Address::UNSPECIFIED), 0);
|
||||
let config = {
|
||||
let mut config = Config::new();
|
||||
config.hardware_addr = Some(wire::HardwareAddress::Ethernet(
|
||||
wire::EthernetAddress(mac_addr.0),
|
||||
));
|
||||
config
|
||||
};
|
||||
let mut interface = smoltcp::iface::Interface::new(config, &mut *virtio_net.lock());
|
||||
let config = Config::new(wire::HardwareAddress::Ethernet(wire::EthernetAddress(
|
||||
mac_addr.0,
|
||||
)));
|
||||
let now = get_network_timestamp();
|
||||
|
||||
let mut interface =
|
||||
smoltcp::iface::Interface::new(config, &mut *virtio_net.lock(), now);
|
||||
interface.update_ip_addrs(|ip_addrs| {
|
||||
debug_assert!(ip_addrs.is_empty());
|
||||
ip_addrs.push(ip_addr).unwrap();
|
||||
@ -110,6 +109,7 @@ impl Iface for IfaceVirtio {
|
||||
let hardware_addr = interface.hardware_addr();
|
||||
match hardware_addr {
|
||||
wire::HardwareAddress::Ethernet(ethe_address) => Some(ethe_address),
|
||||
wire::HardwareAddress::Ip => None,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,10 +43,13 @@ impl BoundDatagram {
|
||||
.bound_socket
|
||||
.raw_with(|socket: &mut RawUdpSocket| socket.recv_slice(buf));
|
||||
match result {
|
||||
Ok((recv_len, endpoint)) => Ok((recv_len, endpoint)),
|
||||
Ok((recv_len, udp_metadata)) => Ok((recv_len, udp_metadata.endpoint)),
|
||||
Err(RecvError::Exhausted) => {
|
||||
return_errno_with_message!(Errno::EAGAIN, "the receive buffer is empty")
|
||||
}
|
||||
Err(RecvError::Truncated) => {
|
||||
todo!();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,11 +10,24 @@ align_ext = { path = "../../../ostd/libs/align_ext" }
|
||||
aster-util = { path = "../../libs/aster-util" }
|
||||
aster-rights = { path = "../../libs/aster-rights" }
|
||||
bitflags = "1.3"
|
||||
bitvec = { version = "1.0.1", default-features = false, features = ["alloc"]}
|
||||
bitvec = { version = "1.0.1", default-features = false, features = ["alloc"] }
|
||||
component = { path = "../../libs/comp-sys/component" }
|
||||
int-to-c-enum = { path = "../../libs/int-to-c-enum" }
|
||||
log = "0.4"
|
||||
ostd = { path = "../../../ostd" }
|
||||
ringbuf = { version = "0.3.2", default-features = false, features = ["alloc"] }
|
||||
smoltcp = { version = "0.9.1", default-features = false, features = ["alloc", "log", "medium-ethernet", "medium-ip", "proto-dhcpv4", "proto-ipv4", "proto-igmp", "socket-icmp", "socket-udp", "socket-tcp", "socket-raw", "socket-dhcpv4"] }
|
||||
smoltcp = { git = "https://github.com/smoltcp-rs/smoltcp", rev = "dc08e0b", default-features = false, features = [
|
||||
"alloc",
|
||||
"log",
|
||||
"medium-ethernet",
|
||||
"medium-ip",
|
||||
"proto-dhcpv4",
|
||||
"proto-ipv4",
|
||||
"proto-igmp",
|
||||
"socket-icmp",
|
||||
"socket-udp",
|
||||
"socket-tcp",
|
||||
"socket-raw",
|
||||
"socket-dhcpv4",
|
||||
] }
|
||||
spin = "0.9.4"
|
||||
|
@ -37,12 +37,12 @@ pub struct RxToken(RxBuffer);
|
||||
impl phy::RxToken for RxToken {
|
||||
fn consume<R, F>(self, f: F) -> R
|
||||
where
|
||||
F: FnOnce(&mut [u8]) -> R,
|
||||
F: FnOnce(&[u8]) -> R,
|
||||
{
|
||||
let mut packet = self.0.packet();
|
||||
let mut buffer = vec![0u8; packet.remain()];
|
||||
packet.read(&mut VmWriter::from(&mut buffer as &mut [u8]));
|
||||
f(&mut buffer)
|
||||
f(&buffer)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ component = { path = "../../libs/comp-sys/component" }
|
||||
log = "0.4"
|
||||
bit_field = "0.10.1"
|
||||
int-to-c-enum = { path = "../../libs/int-to-c-enum" }
|
||||
smoltcp = { version = "0.9.1", default-features = false, features = [
|
||||
smoltcp = { git = "https://github.com/smoltcp-rs/smoltcp", rev = "dc08e0b", default-features = false, features = [
|
||||
"alloc",
|
||||
"log",
|
||||
"medium-ethernet",
|
||||
|
Reference in New Issue
Block a user