net: Add features for pool size and remove unwrap on smoltcp device
This commit is contained in:
committed by
Dario Nieuwenhuis
parent
6cecc6d4b5
commit
3396a51938
@ -43,8 +43,8 @@ impl<'a> SmolDevice<'a> for DeviceAdapter {
|
||||
type TxToken = TxToken<'a>;
|
||||
|
||||
fn receive(&'a mut self) -> Option<(Self::RxToken, Self::TxToken)> {
|
||||
let tx_pkt = PacketBox::new(Packet::new())?;
|
||||
let rx_pkt = self.device.receive()?;
|
||||
let tx_pkt = PacketBox::new(Packet::new()).unwrap(); // TODO: not sure about unwrap
|
||||
let rx_token = RxToken { pkt: rx_pkt };
|
||||
let tx_token = TxToken {
|
||||
device: self.device,
|
||||
|
@ -4,8 +4,19 @@ use core::ops::{Deref, DerefMut, Range};
|
||||
use atomic_pool::{pool, Box};
|
||||
|
||||
pub const MTU: usize = 1516;
|
||||
|
||||
#[cfg(feature = "pool-4")]
|
||||
pub const PACKET_POOL_SIZE: usize = 4;
|
||||
|
||||
#[cfg(feature = "pool-8")]
|
||||
pub const PACKET_POOL_SIZE: usize = 8;
|
||||
|
||||
#[cfg(feature = "pool-16")]
|
||||
pub const PACKET_POOL_SIZE: usize = 16;
|
||||
|
||||
#[cfg(feature = "pool-32")]
|
||||
pub const PACKET_POOL_SIZE: usize = 32;
|
||||
|
||||
pool!(pub PacketPool: [Packet; PACKET_POOL_SIZE]);
|
||||
pub type PacketBox = Box<PacketPool>;
|
||||
|
||||
|
Reference in New Issue
Block a user