Update smoltcp.
This commit is contained in:
parent
d8c70c5c3e
commit
64cba950e5
@ -38,7 +38,7 @@ igmp = ["smoltcp/proto-igmp"]
|
|||||||
defmt = { version = "0.3", optional = true }
|
defmt = { version = "0.3", optional = true }
|
||||||
log = { version = "0.4.14", optional = true }
|
log = { version = "0.4.14", optional = true }
|
||||||
|
|
||||||
smoltcp = { version = "0.9.0", default-features = false, features = [
|
smoltcp = { git = "https://github.com/smoltcp-rs/smoltcp", rev = "803840b5ccac01cc0f108993958f637835f0adbe", default-features = false, features = [
|
||||||
"socket",
|
"socket",
|
||||||
"async",
|
"async",
|
||||||
] }
|
] }
|
||||||
|
@ -51,8 +51,9 @@ where
|
|||||||
Medium::Ethernet => phy::Medium::Ethernet,
|
Medium::Ethernet => phy::Medium::Ethernet,
|
||||||
#[cfg(feature = "medium-ip")]
|
#[cfg(feature = "medium-ip")]
|
||||||
Medium::Ip => phy::Medium::Ip,
|
Medium::Ip => phy::Medium::Ip,
|
||||||
|
#[allow(unreachable_patterns)]
|
||||||
_ => panic!(
|
_ => panic!(
|
||||||
"Unsupported medium {:?}. MAke sure to enable it in embassy-net's Cargo features.",
|
"Unsupported medium {:?}. Make sure to enable it in embassy-net's Cargo features.",
|
||||||
caps.medium
|
caps.medium
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
@ -235,12 +235,19 @@ impl<D: Driver + 'static> Stack<D> {
|
|||||||
#[cfg(feature = "medium-ethernet")]
|
#[cfg(feature = "medium-ethernet")]
|
||||||
let medium = device.capabilities().medium;
|
let medium = device.capabilities().medium;
|
||||||
|
|
||||||
let mut iface_cfg = smoltcp::iface::Config::new();
|
let hardware_addr = match medium {
|
||||||
iface_cfg.random_seed = random_seed;
|
|
||||||
#[cfg(feature = "medium-ethernet")]
|
#[cfg(feature = "medium-ethernet")]
|
||||||
if medium == Medium::Ethernet {
|
Medium::Ethernet => HardwareAddress::Ethernet(EthernetAddress(device.ethernet_address())),
|
||||||
iface_cfg.hardware_addr = Some(HardwareAddress::Ethernet(EthernetAddress(device.ethernet_address())));
|
#[cfg(feature = "medium-ip")]
|
||||||
}
|
Medium::Ip => HardwareAddress::Ip,
|
||||||
|
#[allow(unreachable_patterns)]
|
||||||
|
_ => panic!(
|
||||||
|
"Unsupported medium {:?}. Make sure to enable it in embassy-net's Cargo features.",
|
||||||
|
medium
|
||||||
|
),
|
||||||
|
};
|
||||||
|
let mut iface_cfg = smoltcp::iface::Config::new(hardware_addr);
|
||||||
|
iface_cfg.random_seed = random_seed;
|
||||||
|
|
||||||
let iface = Interface::new(
|
let iface = Interface::new(
|
||||||
iface_cfg,
|
iface_cfg,
|
||||||
@ -248,6 +255,7 @@ impl<D: Driver + 'static> Stack<D> {
|
|||||||
inner: &mut device,
|
inner: &mut device,
|
||||||
cx: None,
|
cx: None,
|
||||||
},
|
},
|
||||||
|
instant_to_smoltcp(Instant::now()),
|
||||||
);
|
);
|
||||||
|
|
||||||
let sockets = SocketSet::new(&mut resources.sockets[..]);
|
let sockets = SocketSet::new(&mut resources.sockets[..]);
|
||||||
|
@ -104,7 +104,7 @@ impl<'a> UdpSocket<'a> {
|
|||||||
pub async fn recv_from(&self, buf: &mut [u8]) -> Result<(usize, IpEndpoint), Error> {
|
pub async fn recv_from(&self, buf: &mut [u8]) -> Result<(usize, IpEndpoint), Error> {
|
||||||
poll_fn(move |cx| {
|
poll_fn(move |cx| {
|
||||||
self.with_mut(|s, _| match s.recv_slice(buf) {
|
self.with_mut(|s, _| match s.recv_slice(buf) {
|
||||||
Ok(x) => Poll::Ready(Ok(x)),
|
Ok((n, meta)) => Poll::Ready(Ok((n, meta.endpoint))),
|
||||||
// No data ready
|
// No data ready
|
||||||
Err(udp::RecvError::Exhausted) => {
|
Err(udp::RecvError::Exhausted) => {
|
||||||
s.register_recv_waker(cx.waker());
|
s.register_recv_waker(cx.waker());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user