Commit Graph

32 Commits

Author SHA1 Message Date
Michael Birtwell 50dbda4f43 Use new ip_addr_storage module instead of net_settings
Necessary to avoid needing the alloc only trait impls in net_settings
when compiling the bootloader.
2022-04-24 10:10:43 +08:00
Michael Birtwell 95378cf9c9 Centralise all uses of the IPv4 index in net_settings.rs 2022-04-24 10:10:43 +08:00
Michael Birtwell 671453938b Require explicitly closing TcpStreams
Instead of automatically closing and draining the TcpStream in the Drop
implementation instead expect the user to call TcpStream::close.
Add close called to all users of TcpStream.
Document the requirement to call close on TcpListener::accept, this seems
to be the only way to get a new TcpStream at the moment.
2022-04-24 10:10:43 +08:00
Michael Birtwell 73082d116f Ensure that pending data is sent when closing sockets
This is only necessary if close hasn't been called on the socket
but that's not always done. e.g. by the core analyzer server.
2022-04-24 10:10:43 +08:00
Michael Birtwell 6ffb1f83ee DHCP support for core device firmware
DHCP is enabled by setting the `ip` config entry to "use_dhcp". Reusing this
config field rather than creating a new one means that there is no ambiguity
over which config field takes precedence.

Adds a thread to configure the interface based on DHCP events
Adds a `Dhcpv4Socket` as a wrapper around smoltcp's version
Formalises the storage of the IP addresses so that we can update one in
another module.

There's also a workaround for the first DHCP discover packet frequently
going missing.

Signed-off-by: Michael Birtwell <michael.birtwell@oxionics.com>
2022-04-24 10:10:14 +08:00
Michael Birtwell c60de48a30 Upgrade smoltcp 0.6.0 -> 0.8.0
Main changes:
Deal with interfaces now being generic over mediums, update interface name
and initialisation.
Interfaces now own their sockets. So we store a reference to the Interface
instead of the SocketSet in Scheduler and IO.
Sockets are no longer reference counted. We never called the function to
increase the socket's reference count, so now we just remove it where it
was previously released. This will result in the socket being dropped at
a different time, but I think that should be fine.

Tested firmware upload to the bootloader and spamming artiq_coremgmt log
calls to download the log from the firmware.

Signed-off-by: Michael Birtwell <michael.birtwell@oxionics.com>
2022-04-24 10:09:27 +08:00
occheung 46326716fd runtime: bump libfringe, impl ecall abi
See libfringe PR: M-Labs/libfringe#1
2021-10-16 17:42:24 +08:00
occheung eecd825d23 firmware: suppress warning 2021-09-10 13:25:12 +08:00
occheung c113cd6bf5 libfringe: bump 2021-09-10 13:25:12 +08:00
occheung c800b6c8d3 runtime: update rust alloc, managed 2021-09-10 13:25:09 +08:00
Sebastien Bourdeauducq 62642957cd runtime: fix DRTIO aux channel race condition 2018-09-19 11:16:21 +08:00
whitequark c33f74dabe firmware: derive Clone for Mutex. 2018-09-15 15:24:44 +00:00
whitequark 1990ab35d3 firmware: implement mutexes. 2018-09-15 07:35:35 +00:00
whitequark 2648b1b7a1 firmware: migrate to Rust 1.28.0.
This also updates / is a prerequisite for updating smoltcp.

Rationale for changes made:
  * compiler_builtins is now shipped in the rust prefix.
  * rustc's libpanic_unwind no longer works for us because it
    has a hard dependency on Box (and it's a horrible hack);
    fortunately, we only ever needed a personality function
    from it.
  * panic and oom handlers are now set in a completely different
    way.
  * allocators are quite different (and finally stable).
  * NLL caused internal compiler errors in runtime, so code using
    NLL was rewritten to not rely on it and it was turned off.
2018-08-12 19:17:45 +00:00
whitequark 9347f6e00c firmware: use a dedicated error type in the scheduler.
After this commit, error handling does not normally allocate
(session::Error::{Load,Unexpected} still allocate, but those two
are very rare).

Good riddance to libstd_artiq.
2018-05-15 14:19:44 +00:00
whitequark 5ead27f2e1 firmware: eliminate uses of std_artiq::io::{Read,Write} from runtime. 2018-05-14 19:11:57 +00:00
whitequark cf33ba748d firmware: eliminate non-io uses of std_artiq from runtime.
Just replace these with references to alloc.
2018-05-14 19:11:57 +00:00
whitequark 02b8426f60 firmware: rename libboard to libboard_misoc.
By analogy with libbuild_misoc. Hopefully one day it actually gets
moved to misoc...
2018-05-14 18:09:44 +00:00
whitequark 0d5fd1e83d runtime: fix race condition in log extraction code paths (#979).
The core device used to panic if certain combinations of borrows
of the log buffer happened. Now they all use .try_borrow_mut().
2018-04-20 15:26:00 +00:00
whitequark 5a2cbe7088 runtime: remove borrow_mut!() in favor of backtraces. 2017-12-27 19:15:25 +00:00
whitequark 6bdeddd201 runtime: remove UDP-related code. 2017-10-25 02:55:01 +00:00
whitequark cdba330845 Update smoltcp.
Fixes #840.
2017-10-25 02:31:27 +00:00
whitequark c00b3fe8cd firmware: update smoltcp. 2017-09-24 22:57:27 +00:00
whitequark 74b7010d67 runtime: allow safely pulling logs even on TRACE log level.
Before this commit, this resulted in a packet flood, because
sending a TRACE log message to the host caused more TRACE log
messages to be emitted.
2017-08-31 14:13:51 +00:00
whitequark f5e1d9568d firmware: update smoltcp. 2017-08-24 05:50:59 +00:00
whitequark 1e2603572a runtime: fix a bug causing sockets to get stuck in CLOSE-WAIT. 2017-07-05 16:27:36 +00:00
whitequark 680a7067a8 firmware: use ? instead of try! everywhere. 2017-01-31 22:18:59 +00:00
whitequark be0953d98f firmware: unbreak Io::sleep().
Fixes #663.
2017-01-27 18:18:02 +00:00
whitequark 6414e40deb firmware: fix race condition between TCP listen and accept. 2017-01-25 00:17:46 +00:00
whitequark 527b1e986c firmware: integrate smoltcp instead of lwip. 2017-01-23 13:59:34 +00:00
Sebastien Bourdeauducq 26e7f68b5d firmware: move clock to libboard 2017-01-01 18:23:27 +01:00
Sebastien Bourdeauducq 9967dfc5ca runtime: reorganize to support DRTIO satellite firmware 2016-12-16 19:11:19 +08:00