diff options
| author | Dario Nieuwenhuis <[email protected]> | 2021-08-20 15:06:06 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2021-08-20 15:06:06 +0200 |
| commit | de2039fd1dce2ab6a060b5744116373854b35a7d (patch) | |
| tree | 4e5f24f8ee8378f0e06f67128773b3d7bc6f6185 /embassy-net/src/stack.rs | |
| parent | 17659e2e4473575c32fc8cad95fd859947fc493f (diff) | |
net: fix build with medium-ip
Diffstat (limited to 'embassy-net/src/stack.rs')
| -rw-r--r-- | embassy-net/src/stack.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/embassy-net/src/stack.rs b/embassy-net/src/stack.rs index 5e795a4fd..5f871bd1f 100644 --- a/embassy-net/src/stack.rs +++ b/embassy-net/src/stack.rs | |||
| @@ -9,13 +9,17 @@ use futures::pin_mut; | |||
| 9 | use smoltcp::iface::InterfaceBuilder; | 9 | use smoltcp::iface::InterfaceBuilder; |
| 10 | #[cfg(feature = "medium-ethernet")] | 10 | #[cfg(feature = "medium-ethernet")] |
| 11 | use smoltcp::iface::{Neighbor, NeighborCache, Route, Routes}; | 11 | use smoltcp::iface::{Neighbor, NeighborCache, Route, Routes}; |
| 12 | #[cfg(feature = "medium-ethernet")] | ||
| 12 | use smoltcp::phy::Device as _; | 13 | use smoltcp::phy::Device as _; |
| 14 | #[cfg(feature = "medium-ethernet")] | ||
| 13 | use smoltcp::phy::Medium; | 15 | use smoltcp::phy::Medium; |
| 14 | use smoltcp::socket::SocketSetItem; | 16 | use smoltcp::socket::SocketSetItem; |
| 15 | use smoltcp::time::Instant as SmolInstant; | 17 | use smoltcp::time::Instant as SmolInstant; |
| 16 | #[cfg(feature = "medium-ethernet")] | 18 | #[cfg(feature = "medium-ethernet")] |
| 17 | use smoltcp::wire::EthernetAddress; | 19 | use smoltcp::wire::EthernetAddress; |
| 18 | use smoltcp::wire::{IpAddress, IpCidr, Ipv4Address, Ipv4Cidr}; | 20 | #[cfg(feature = "medium-ethernet")] |
| 21 | use smoltcp::wire::IpAddress; | ||
| 22 | use smoltcp::wire::{IpCidr, Ipv4Address, Ipv4Cidr}; | ||
| 19 | 23 | ||
| 20 | use crate::config::Configurator; | 24 | use crate::config::Configurator; |
| 21 | use crate::config::Event; | 25 | use crate::config::Event; |
| @@ -44,7 +48,9 @@ impl<const ADDR: usize, const SOCK: usize, const NEIGHBOR: usize> | |||
| 44 | Self { | 48 | Self { |
| 45 | addresses: [IpCidr::new(Ipv4Address::UNSPECIFIED.into(), 32); ADDR], | 49 | addresses: [IpCidr::new(Ipv4Address::UNSPECIFIED.into(), 32); ADDR], |
| 46 | sockets: [NONE_SOCKET; SOCK], | 50 | sockets: [NONE_SOCKET; SOCK], |
| 51 | #[cfg(feature = "medium-ethernet")] | ||
| 47 | routes: [None; 1], | 52 | routes: [None; 1], |
| 53 | #[cfg(feature = "medium-ethernet")] | ||
| 48 | neighbor_cache: [None; NEIGHBOR], | 54 | neighbor_cache: [None; NEIGHBOR], |
| 49 | } | 55 | } |
| 50 | } | 56 | } |
| @@ -84,6 +90,7 @@ impl Stack { | |||
| 84 | } | 90 | } |
| 85 | 91 | ||
| 86 | fn poll_configurator(&mut self, timestamp: SmolInstant) { | 92 | fn poll_configurator(&mut self, timestamp: SmolInstant) { |
| 93 | #[cfg(feature = "medium-ethernet")] | ||
| 87 | let medium = self.iface.device().capabilities().medium; | 94 | let medium = self.iface.device().capabilities().medium; |
| 88 | 95 | ||
| 89 | match self | 96 | match self |
| @@ -180,6 +187,7 @@ pub fn init<const ADDR: usize, const SOCK: usize, const NEIGH: usize>( | |||
| 180 | configurator: &'static mut dyn Configurator, | 187 | configurator: &'static mut dyn Configurator, |
| 181 | resources: &'static mut StackResources<ADDR, SOCK, NEIGH>, | 188 | resources: &'static mut StackResources<ADDR, SOCK, NEIGH>, |
| 182 | ) { | 189 | ) { |
| 190 | #[cfg(feature = "medium-ethernet")] | ||
| 183 | let medium = device.capabilities().medium; | 191 | let medium = device.capabilities().medium; |
| 184 | 192 | ||
| 185 | #[cfg(feature = "medium-ethernet")] | 193 | #[cfg(feature = "medium-ethernet")] |
