Commit Graph

162 Commits

Author SHA1 Message Date
Dario Nieuwenhuis
aaaf5f23a8 net: move stack into lib.rs 2022-12-13 16:18:39 +01:00
Dario Nieuwenhuis
ac74613b5a net: remove packet pool.
The pool was prone to deadlocks, especially due to having a single pool
for rx+tx. If the pool got full with rx'd packets it would deadlock because
processing a rx packet requires doing another allocation on the pool, for
the possibly tx'd response, before deallocating the rx'd packet.

This also allows Device impls to allocate the packet memory in a particular
RAM kind, if needed for example to do DMA.

The `Device` trait is now token-based, like smoltcp's. In the end, this
is better because it allows callers to manage memory however they want (including
with a pool if they want to).
2022-12-13 16:18:39 +01:00
Dario Nieuwenhuis
f7fe0c1441 net: update smoltcp 2022-12-07 00:28:38 +01:00
Dario Nieuwenhuis
02abe00439 net: don't use UnsafeCell.
The "must not be called reentrantly" invariant is too "global" to
maintain comfortably, and the cost of the RefCell is negligible,
so this was a case of premature optimization.
2022-12-03 00:56:16 +01:00
Dario Nieuwenhuis
1e2fb0459d Switch to async-fn-in-trait 2022-11-25 21:02:06 +01:00
Dario Nieuwenhuis
eeb072d9cb Update Rust nightly. 2022-10-26 16:47:29 +02:00
Dario Nieuwenhuis
a0487380da Replace futures::future::poll_fn -> core::future::poll_fn. 2022-09-22 16:42:49 +02:00
Dario Nieuwenhuis
897b72c872 Update Rust nightly.
Removes feature(generic_associated_types)
2022-09-22 16:38:14 +02:00
Dario Nieuwenhuis
464ae67108 net: feature-gate nightly-only async traits to allow building on stable. 2022-08-30 19:43:32 +02:00
Dario Nieuwenhuis
21072bee48 split embassy-util into embassy-futures, embassy-sync. 2022-08-22 22:18:13 +02:00
Dario Nieuwenhuis
5daa173ce4 Split embassy-time from embassy-executor. 2022-08-18 01:22:30 +02:00
bors[bot]
6ffca81a38
Merge #880
880: Add UDP socket support r=Dirbaio a=arturkow2000



Co-authored-by: Artur Kowalski <artur.kowalski@3mdeb.com>
Co-authored-by: Artur Kowalski <arturkow2000@gmail.com>
2022-08-11 14:17:11 +00:00
Artur Kowalski
ef473827a2 Remove UdpIo struct
UdpIo was shared by split sender/receives halves. Since split() API is
no more UdpIo is not needed and its APIs may be moved into UdpSocket.
2022-08-11 15:52:32 +02:00
Dario Nieuwenhuis
0a98f9f48e
net: make TcpIo private.
It's just an implementation detail to share code between Socket, Reader, Writer. It wasn't supposed to be public.
2022-08-11 13:58:13 +02:00
Artur Kowalski
b97983242d Simplify UDP code
Drop unneeded APIs: remove impls of embedded_io error traits, remove
flush() and split() methods.
2022-08-11 08:23:18 +02:00
Artur Kowalski
d5ab0d3ebb Add UDP socket support 2022-08-10 19:40:35 +02:00
Ulf Lilleengen
87401c49b7 Fix formatting 2022-08-09 14:51:32 +02:00
Ulf Lilleengen
80c1551153 Wrap buffers in a single state type 2022-08-09 14:43:55 +02:00
Ulf Lilleengen
18671b94ba Implement embedded-nal-async traits for embassy-net 2022-08-08 16:51:34 +02:00
Dario Nieuwenhuis
a0f1b0ee01 Split embassy crate into embassy-executor, embassy-util. 2022-07-29 23:40:36 +02:00
Dario Nieuwenhuis
a8703b7598 Run rustfmt. 2022-06-12 22:22:31 +02:00
Ulf Lilleengen
8b676e65ad Add embedded-io implementation of ConnectError 2022-06-01 13:48:28 +02:00
Ulf Lilleengen
39cffdd123 Add reexport for ipv6 types with proto-ipv6 2022-06-01 13:48:09 +02:00
Dario Nieuwenhuis
a5aea995a8 WIP embassy-net v2 2022-05-25 19:56:22 +02:00
Dario Nieuwenhuis
e3b8e35498 Make embassy-net nightly-only.
It's useless without async traits, so juggling the `nightly` feature
around is not worth the pain.
2022-05-19 06:15:01 +02:00
Dario Nieuwenhuis
0b2f43c391 net: add split() to tcpsocket 2022-05-19 06:14:05 +02:00
Dario Nieuwenhuis
931a137f8c Replace embassy::io with embedded_io. 2022-05-07 01:45:54 +02:00
Dario Nieuwenhuis
a5f5c3a844 net: add functions to get current Eth and IP config 2022-05-02 16:19:34 +02:00
Matous Hybl
3a3ed27c30 net: Add support for packet pools with size 64 and 128 2022-04-27 21:27:28 +02:00
Dario Nieuwenhuis
50e1d257bd net: change listen() to accept(), which waits until the connection is established. 2022-04-24 04:35:29 +02:00
Dario Nieuwenhuis
0d3758ad6b net: make run() noreturn. 2022-04-13 17:27:20 +02:00
huntc
5d502ec0af Fix missing flush for tcp 2021-12-10 14:38:28 +11:00
Dario Nieuwenhuis
524eed5db5 Update smoltcp, fix build issues with no ethernet. 2021-11-26 21:09:44 +01:00
Dario Nieuwenhuis
c257893da9 net: update smoltcp 2021-11-26 04:12:14 +01:00
bors[bot]
5322e293bd
Merge #461
461: nrf: add initial nrf5340 support r=Dirbaio a=Dirbaio

Thanks to `@diondokter's` work on DPPI this was quite easy! :) 

TODO:
- [ ] Add config option to enable 128mhz
- [ ] Add config option to unlock APPROTECT automatically.
- [ ] Add a way to boot net (config option or API?)
- [ ] Support WDT (there's WDT0, WDT1. Needs some refactor)
- [ ] Support NVMC
- [ ] Support TEMP

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2021-11-07 22:58:27 +00:00
Matous Hybl
d742d0252e Add TCP listen. 2021-11-04 13:34:13 +01:00
Dario Nieuwenhuis
663141b4e4 nrf: add initial nrf5340 support 2021-10-28 03:36:25 +02:00
Dario Nieuwenhuis
a2e7c24e00 Clippy fixes 2021-10-18 01:05:29 +02:00
Dario Nieuwenhuis
ead987245d embassy: Refactor module structure to remove kitchen-sink util. 2021-09-11 02:35:35 +02:00
Dario Nieuwenhuis
de2039fd1d net: fix build with medium-ip 2021-08-20 15:06:06 +02:00
Thales Fragoso
aca0fb1065 net: Make the user pass in the StackResources in init
By having the user pass in the resources, we can make them generic, this way
the user can choose the size of the individual resources
2021-06-20 17:15:18 -03:00
Dario Nieuwenhuis
d94feb9fcd net/tcp: Fix panic when consuming 0 bytes at EOF 2021-06-18 01:58:14 +02:00
Thales Fragoso
3396a51938 net: Add features for pool size and remove unwrap on smoltcp device 2021-06-16 16:48:35 +02:00
Thales Fragoso
46e1bae9e3 eth-v2: Start Ethernet peripheral implementation 2021-06-16 16:48:35 +02:00
Dario Nieuwenhuis
3be49d3e79 fmt: Add dunmy use to avoid "unused variable" errors when no log is enabled. 2021-06-07 03:21:37 +02:00
Dario Nieuwenhuis
ef1ebefec0 fmt: use absolute paths 2021-06-07 03:15:05 +02:00
Dario Nieuwenhuis
e7dc5c0939 fmt: make all macros macro_rules so scoping is consistent. 2021-06-07 00:16:39 +02:00
Dario Nieuwenhuis
7d869bdec8 Update heapless 2021-06-04 01:35:04 +02:00
Dario Nieuwenhuis
b4c11695cf Update smoltcp 2021-05-28 22:34:07 +02:00
Dario Nieuwenhuis
773c3570e7 Update deps 2021-05-18 17:07:05 +02:00
Dario Nieuwenhuis
4eecb3cfa9 add is_link_up, is_config_up 2021-04-13 17:14:23 +02:00
Dario Nieuwenhuis
4f528d8fae Add medium-ip, medium-ethernet Cargo features 2021-04-12 21:00:23 +02:00
Dario Nieuwenhuis
439092dc59 derive Eq for config 2021-04-12 18:13:22 +02:00
Dario Nieuwenhuis
ccdcd9df17 publish config::Event 2021-04-12 17:24:52 +02:00
Dario Nieuwenhuis
54d6b6ec48 Correctly randomize source port 2021-04-12 15:35:54 +02:00
Dario Nieuwenhuis
9c5a8b945a Update to latest embassy, atomic-pool, smoltcp 2021-04-07 19:06:45 +02:00
Dario Nieuwenhuis
9bee576fd2 Update embassy 2021-03-02 21:20:00 +01:00
Dario Nieuwenhuis
f100383b3c Make ethernet address configurable from the Device 2021-02-24 22:31:07 +01:00
Dario Nieuwenhuis
7d3878466c reexport smoltcp error/result 2021-02-12 01:48:21 +01:00
Dario Nieuwenhuis
a7d1d02be0 Remove use of feature(const_in_array_repeat_expressions) 2021-02-03 05:25:25 +01:00
Dario Nieuwenhuis
10cd5bddc9 Add CI 2021-02-03 05:15:13 +01:00
Dario Nieuwenhuis
cb5931d583 🌈 2021-02-03 05:09:37 +01:00