Commit graph

282 commits

Author SHA1 Message Date
bunnie
f2193d64b1 filter disallowed bindings for the TcpListener 2022-08-02 16:44:37 +08:00
bunnie
14dacd9941 handle WFXerror case more gracefully 2022-07-20 21:07:52 +08:00
bunnie
ef164871a1 move COM link error handling up the stack a bit
this allows us to have better error reporting and handle
the cases where the EC is updating and just generating random
vectors more...palatable.
2022-07-16 23:11:13 +08:00
bunnie
a90b5f2554 clean up autoupdate flow & clean up net link reset flow
We are now at a point where the EC update can be applied and the
net stack recovers gracefully, so no reboot is required in the
case of an EC update.
2022-07-11 15:07:53 +08:00
bunnie
8f3aa84e6d refresh the wlan stats cache on resume... 2022-07-11 05:06:01 +08:00
bunnie
ca5455635b add some heuristics to improve the connection manager
the CM can't always detect if the EC changes state; this is
especially true after an update or a forced reset where
the state caches are not reliably updated. If no packets are
seen for a while, poll the actual state and force a sync-up.

Also try to make sure that the interrupts are enabled correctly.
2022-07-11 04:58:48 +08:00
bunnie
e32ea4d3f5 fix #174 2022-06-10 21:36:53 +08:00
bunnie
21116a1693 fix another errant mut that wasn't needed in pddb 2022-06-01 00:06:55 +08:00
Sean Cross
3ae9d8abf0 apps/services: remove xous::xous_main macro usage
This macro will be removed, since it is no longer necessary. Remove this
macro across the project and replace it with a standard `main()`
function.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-05-31 13:33:30 +08:00
bunnie
62cbc86aeb add automation strings 2022-05-24 23:21:26 +08:00
bunnie
4cba739a81 remove improper warning message
this was a vestige of an earlier version that should have been
removed
2022-05-17 03:13:19 +08:00
bunnie
ca275308ef Merge branch 'usbdev' into main 2022-05-17 02:31:10 +08:00
bunnie
e9b627cab8 update release notes, clean up Cargo.toml, smoltcp to 0.8.1
smoltcp gave us a patch for our smoltcp issues! thank you @dirbaio!
2022-05-13 15:09:45 +08:00
bunnie
4ec84bf4dc implement deferred close on drop for TcpStream
streams are not closed until the txbuffer is empty
2022-05-13 14:51:07 +08:00
bunnie
b470588285 oops, fix a compile error. also try adding a flush()...this only made things worse?? 2022-05-13 02:25:35 +08:00
bunnie
56f9c654c0 debugging of TcpStream Drop dropping too fast
so far only able to confirm the problem happens, no effective
fixes yet.
2022-05-13 02:19:10 +08:00
bunnie
17e9a210ef add maintenanence notes referring to relevant smoltcp issues 2022-05-13 01:21:41 +08:00
bunnie
77e56a5a6e add notes about smoltcp integration 2022-05-13 01:17:25 +08:00
bunnie
c17219b6fe add icmpv4 fixes
a lot of debug spew is also enabled in this commit, intentionally,
because the next thing to chase out is the failure of TcpStream
on Drop.
2022-05-13 00:30:12 +08:00
bunnie
bac650808d force all UDP packets to respond on the local IP address
smoltcp is written to allow multiple adapters, so 0.0.0.0 as
the binding for UDP is illegal. However, in Rust, it seems that
0.0.0.0 is "totally fine" and most OSes will resolve this to
a "default" adapter.

this patch introduces the behavior of taking 0.0.0.0 and mapping
it to a default adapter. In fact, we only allow binding to the
default adapter. The reasoning behind this is that if our IP
address changes, we would expect that 0.0.0.0 resolves to that.

Where this scheme fails is if someone binds to 127.0.0.1 expecting
it to not respond to packets coming in from the outside, e.g.
they are using UDP as a loopback interface. I think this isn't
a common use case for Xous, but if it does become one I suppose
we could add a code path to also check for the 127.0.0.1 case
and try to handle it...
2022-05-12 22:26:38 +08:00
bunnie
94cbbddaa6 refactor follow-up scheduling vs smoltcp stack
smoltcp requires some polling to be done in the future for it
to work with low latency. It returns a time in the future for
the next poll.

This refactors the polling algorithm to:

1. use a fixed thread pool. This burns a little extra memory in
exchange for not having to allocate/de-allocate threads every
time a follow-up is needed.

2. use a short/long scheduler, where short delays (shorter than
the scheduler quantum) are grouped together, and only a single
follow-up is fired off within that time range if needed. Longer
delays have a larger window (roughly +/- 100ms) of grouping,
so fewer such events are also required in the distant future.

Empirically the delays seem to fall into two groups, either "short"
(less than 20ms) or "long" (around 700ms).

This improved scheduler uses fewer threads and generates less
messages, so instead of 16 threads and encountering exhaustion
we have 9 and have yet to see more than 7 used even under the
most strenuous tests (multiple while-true curl loops + fountain
test + ping simultaneously).

Some helpful debug is also printed now when scheduler runs out
of slots, so we can see the distribution of pending delays.
2022-05-12 17:49:27 +08:00
bunnie
caf91e18ca fix net reset
we no longer create a new interface on net reset, which means that
the socket handles don't blow up if we change IP addresses.
However, the ARP cache is still stale and there seems to be on way
to force it to flush....but I guess in theory, eventually it
should fix itself, if smoltcp is working correctly?
2022-05-12 10:34:19 +08:00
bunnie
cc7e7f97c7 update smoltcp to 0.8.0
the refactor changes the way sockets are handled, so now, when
the interface is rebound we are certain to get panics.

working on resolving this detail now, but at least the interface
is working now and it seems more stable than before.
2022-05-12 09:27:51 +08:00
bunnie
ccb3e495e1 hoist net thread exhaustion check to before we check the poll interval 2022-05-06 14:15:53 +08:00
bunnie
413b7153ac refactor wait timer for net pump 2022-05-06 13:44:03 +08:00
bunnie
709c087337 refactor wait timer for net pump 2022-05-06 13:35:33 +08:00
bunnie
2a4dd67564 hoist net thread exhaustion check to before we check the poll interval 2022-05-06 04:00:20 +08:00
bunnie
969b4ec868 refactor net firewall to use .forward() method 2022-04-25 18:30:24 +08:00
bunnie
8d28f130ea fix a missing case for hardware not caught by hosted mode 2022-04-24 21:53:18 +08:00
bunnie
f4f0812fb4 refactor API to use the None encoding for 0 on NonZeroUsize MemoryMessage fields
at the suggestion of @xobs, requires a new libstd to work with this.
2022-04-19 01:32:36 +08:00
bunnie
89ceba9674 tweak some parameters and debug infos
total threads in the net crate are around 10 right now, 32 max, so
increasing the sleeping thread limit to 16, since every now and then
we get exhaustion notes.
2022-04-17 18:49:27 +08:00
bunnie
ecd875e64f remove the legacy files 2022-04-17 05:00:51 +08:00
bunnie
12190b9184 strip out the legacy xous Tcp stack implementation 2022-04-17 04:59:10 +08:00
bunnie
a97b548f94 implement Shutdown for TcpStream 2022-04-17 04:07:54 +08:00
bunnie
806b09ec0d apply TcpStream fixes
- allow for zero-length tx/rx returns
- implement "shutdown" function, which is different from close:
shutdown requires any pending connections to return Ok(0) immediately,
but the socket is not dropped.
2022-04-17 04:06:05 +08:00
bunnie
9eb35ddd49 Merge remote-tracking branch 'origin/main' into bunnie-dev 2022-04-16 06:28:29 +08:00
bunnie
a555f0380e initial tcplistener draft 2022-04-16 06:26:08 +08:00
bunnie
cd8c762c55 patch up QR code PR, change method signature as discussed
now any modal notification can also render as a QR code
2022-04-08 15:19:56 +08:00
bunnie
12ced30f40 fix a minor typo 2022-04-07 17:37:20 +08:00
bunnie
92c6a93147 eliminate yield loop on blocking mount poller 2022-04-07 00:04:25 +08:00
bunnie
b7adbcff52 remove no longer used UDP API stubs 2022-04-05 18:43:16 +08:00
bunnie
dacc38808e fix blocking message detection clause in two places 2022-04-05 13:31:50 +08:00
bunnie
532c4a4f1f add NTP to time setting via SNTP library 2022-04-05 04:19:53 +08:00
bunnie
cbb1e3f944 fix various bugs related to UDP; prep for transition to libstd-only UDP 2022-04-05 00:39:56 +08:00
bunnie
067c603e03 strip out old UDP libraries, harmonize on just libstd UDP 2022-04-04 23:15:51 +08:00
bunnie
57339dfe2f udp libstd passing inital tests 2022-04-04 22:37:01 +08:00
bunnie
b5a6c436c2 first draft at some basic libstd UDP mechanics 2022-04-04 04:49:17 +08:00
bunnie
9dc75071ad split up the main.rs file
it's going to get unwieldy if we stick all of std::net into just main.rs
2022-04-02 17:57:50 +08:00
bunnie
d61622bcde add a 1-second delay on resume before telling connection manager to reconnect
now that the suspender is in its own thread, we can do this safely.
It's nice to have a bit of a delay because we want other system recovery
things to take precedence and settle out before we try pinging the COM
to see how the wifi changed while we were asleep.
2022-03-30 02:34:22 +08:00
bunnie
6a6c2aef0f add a thread to respond to suspend requests on the connection manager
the connection manager actually wants a ping on resume,
and when we suspend we suspend -- "it is what it is". However,
the connection manager is a hairball that can block for a while,
so, to prevent failures to suspend, we put the suspend listener
in its own thread, and on resume the suspend listener will
automagically kick out an event to tell the connection manager
to deal with stuff.
2022-03-30 02:29:09 +08:00
bunnie
b4c98528e8 add notes around names that are baked into libstd 2022-03-22 22:30:43 +08:00
bunnie
fe52756a3d convert the connection manager to use the new PDDB blocking call 2022-03-22 22:17:04 +08:00
Sean Cross
d6063d9992 net: don't close connection when setting fields
Due to overly liberal use of `.take()`, file handles were getting closed
when doing ordinary operations. This stops that.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-03-18 20:47:10 +08:00
Sean Cross
0b3fc8e98e net: add functions for setting ttl, nodelay
Signed-off-by: Sean Cross <sean@xobs.io>
2022-03-18 18:43:39 +08:00
Sean Cross
08b9f0bcfc services: net: add StdTcpPeek call
This is used to peek on a stream

Signed-off-by: Sean Cross <sean@xobs.io>
2022-03-18 15:24:01 +08:00
Sean Cross
9217c2227f services: net: add timeout to connect api
This now adds a `timeout` parameter to the connect() API call.
Additionally, connections will not be returned until they are determined
to be open, or until an error occurs (such as a timeout).

Signed-off-by: Sean Cross <sean@xobs.io>
2022-03-18 12:08:28 +08:00
Sean Cross
89442ff4cc net: add StdTcp calls
These calls have been tested to work to create tcp connections.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-03-17 20:38:21 +08:00
bunnie
21ad8d9283 change en-audio to en-tts 2022-03-10 15:38:55 +08:00
bunnie
526bc959af add some facilities for testing net in libstd 2022-03-02 20:43:01 +08:00
bunnie
760957154e add a crappy but slightly more accurate approximation of UDP to hosted mode
It's crappy because it uses a busy wait loop to poll the udp
rx socket in order to accurately emulate the Xous async callback
feature (which is _not_ emulated for Tcp, for example).

It's more accurate because this emulation happens. But it's a lot
more complicated to implement it because zero-cost async UDP callbacks
aren't really a host-native feature (but they are a Xous-native feature!),
and I didn't want to .. pull in tokio or mio code surface into
the Xous hosted mode, seemed a bit like crushing a fly by dropping
a house on it. Maybe that's a fine solution in Oz, but Xous doesn't live in Oz.
2022-02-21 00:54:46 +08:00
bunnie
0dbf1661cb add TCP to hosted mode emulation
Total bodge -- we lop off the TCP stack at the Xous API level, and
substitute it with a native host TCP stack.

Caveat hacker: this means that a lot of OS-specific net properties
will carry through to the hosted mode emulation. This is adequate
for "smoke testing" a build but do not be shocked, *shocked* if
there are more bugs to be found because of some weird host integration
issue.
2022-02-20 21:31:32 +08:00
bunnie
e01abb29e9 update min version requirement for EC compatibility 2022-02-04 01:44:34 +08:00
bunnie
955d0182d6 some very minor ergonomic improvements around network connection UX 2022-02-03 18:38:43 +08:00
bunnie
b7c0387186 connection manager: interpret DHCP state before concluding we're connected 2022-02-03 13:37:14 +08:00
bunnie
8f321d540e clean up a spurious dialog box in hosted mode 2022-02-02 23:59:37 +08:00
bunnie
562a930ce0 add APIs to pause the connection manager, and pause the CM while doing EC updates
It's not a good time to bug the EC to do network stuff when it's updating
itself.

...might even want to send the network into a disconnected state,
but, let's start with just turning off the connection manager
for now.
2022-02-02 02:38:19 +08:00
bunnie
13de52fa8d TcpListener debugging, just a little bit
Spent a couple hours chasing down a "bug" which is acutally just
something about how http works that I don't understand. TCP was
working just fine but there is ... idk some sort of keep alive
thing that occupies a socket so the "web server" blocks waiting
for a read. Anyways, I guess the "right" way to solve that would
be to make a multi-threaded web server

OH GOD STOP

right. it's just a demo to prove that TCP works. done.

Open an issue if you find a problem with TCP kthx!
2022-02-02 00:23:14 +08:00
bunnie
925d53f646 TCP listener is "working"
Good enough so that if you type `net server` and you hit the IP
address of the device, it'll respond with something like

Hello from Precursor!
I have been up for 86087 ms.

There's still all kinds of bugs, I'm sure. But ... I'm also not
sure /why/ you would want a web server on Precursor. This is more
just to make sure that the TCP stack isn't totally broken.

The "web server" as it may be is quite broken and doesn't parse
any headers and probably sends a bogus amount of data because
I can't figure out if the content length includes some new lines
or not. But really, this just isn't in scope. Works with Chrome,
Firefox shows the status page and then says "connection reset" and hides
all the information. Whatever, browser compatibility is well beyond
my pay grade!
2022-02-01 18:54:07 +08:00
bunnie
5c91645ede Merge branch 'i18n-jp' into bunnie-dev 2022-02-01 01:04:43 +08:00
bunnie
0910f7e373 tcpstream passing a simple demo test
not sure what other tests to run, not an expert in this stuff.
2022-01-31 14:35:55 +08:00
bunnie
4690075c40 clean build, but...much testing to do. 2022-01-31 04:03:31 +08:00
Jeanie
d1c443f62e
Merge branch 'i18n-jp' into i18n-jp 2022-01-30 19:25:33 +09:00
Jeanie
58e8120526 ja translations added 2022-01-30 19:23:49 +09:00
bunnie
177ad38db2 derive SSID scan on shellchat from the connection manager
The connection manager keeps track of all our SSIDs, not the COM.
2022-01-30 16:53:15 +08:00
bunnie
9b1c5e3f0c checkpoint to try something else 2022-01-30 15:30:21 +08:00
bunnie
2b7e428340 checkpoint, need to fix something else 2022-01-29 16:09:59 +08:00
bunnie
8592224af2 checkpoint partial TCP progress
server-side impl done, inter-crate API half-complete, now working on lib
2022-01-29 00:57:36 +08:00
bunnie
f7ea782e73 fix some ergonomics around the status bar 2022-01-28 16:28:06 +08:00
bunnie
25bccd9446 THE BALDEST YAK: keyboard injection now working
I wrote in a commit yesterday how there was no ROI on doing this
yet somehow I kept on doing it. I blame poor impulse control.

Turns out there was a series of race conditions and bugs that
caused this thing to "mostly work" on the first go at it but
really hard to debug and get very right.

1. Litex UART has a weird undocumented API. You advance the Rx
FIFO by writing `1` to the PENDING bit, and no other way. However,
you determine if there are any more characters to receive by
reading the EMPTY bit and seeing if it is 1. The previous method
wrote `1` to the PENDING bit and then used the PENDING bit to
see if a character was available, under the theory that the
PENDING bit would be set again if there was still a character.
This is somewhat true, except that the PENDING bit is set only
some amount of time later which is about comparable to a few
CPU instructions, so if you had a fast loop path the PENDING
bit would show as cleared and you'd exit, which would cause
no further interrupts to fire because the interrupt was
effecitvely not acknowledged.

This isn't written up anywhere but I figured this out by
just reading the source code for Litex UART and BIOS:
e8be391504/litex/soc/cores/uart.py (L264-L279)
ccd3ab17be/litex/soc/software/libbase/uart.c (L38-L44)

2. I had the Key Injector IP block in the `sys` domain, which
would have its clock cut when the CPU went to sleep, which would
cause input characters to disappear when the CPU went into power
saving. moving this to "always on" domain fixes that.

3. I had the UART PHY in the always on block (so you could
send or receive exactly one character), but not the
separate UART block (which contained the FIFOs).
The UART block would also go into power
savings, and this would cause FIFO entries to go missing.

4. Escape sequences get sent as a burst of characters. The Key Injector
originally did not have a FIFO of its own, so it would only
remember the *last* key of the sequence that was written, causing
some keys to be dropped occassionally. Adding a 16-deep FIFO
to the injector fixes this.

5. The code I had to read out the injector's results was designed with
the "strobe" bit (to indicate that the FIFO had characters) in the
same regsiter as the character itself. Thus the loop that 1. checked
if the fifo was empty then 2. read and forwarded the character
would actually perform two reads from the FIFO. However, this "mostly worked"
I think because the FIFO retains the last value that was written
even when it was empty, so if only one character was read at a time
everything was fine. It only didn't work when you stuffed two characters
in there, as you'd drop the first one. Reading the FIFO once and
then interpreting the code with a bitmask fixes this.

6. The escape sequences, in their full glory with no dropped characters,
required a refactored parsing routine, which I have now added.

7. backspace->delete mappings, the bane of computer engineers since 1960.

OK. very bald yak. Here I lay down the shears next to several
mooshi pillows stuffed with the finest Yak hair.
2022-01-28 15:17:47 +08:00
bunnie
5a1139a367 move cache flush on susres to just before the suspend event
- also nail down the interrupt handlers from firing from the COM
during suspend
- ensure that connects don't happen while scanning
2022-01-27 22:05:38 +08:00
bunnie
5daf4c4723 suppress connection manager polling when the pddb is not mounted
no point in trying to connect to APs when we have no AP list or keys.
2022-01-27 15:01:19 +08:00
bunnie
5ef7126ede add better handling for wfx HIF err condition 2022-01-27 14:02:28 +08:00
bunnie
3f2f304202 refactor connection manager to be more responsive to suspend/resume 2022-01-27 13:46:43 +08:00
bunnie
4c4ca1577f fix connection manager state machine
seems to work a lot better, but needs a lot more testing
2022-01-27 03:56:39 +08:00
bunnie
94a8a4736f make wlan status checks asynchronous
the synchronous method would lead to stutter in the animation
of the status bar during netork congestion.
2022-01-23 00:24:45 +08:00
bunnie
0cafd10e28 refactor status bar to take advantage of the new fonts 2022-01-22 18:25:39 +08:00
bunnie
18130cddae fix suspend/resume regression
had to pin down the correct order of events to avoid lockups on suspend
2022-01-17 22:46:18 +08:00
bunnie
77f4356620 Sync the EC to the SOC on boot
Always reset the EC on boot. If we have a cold-boot situation,
it's hard to know what state the EC is in versus our stack;
a hard reset on the EC guarantees we at least always start from
the same point.

Note that on suspend/resume, there is no reset - the EC continues
trundling onwards, but the system was designed for this.
2022-01-15 15:43:03 +08:00
bunnie
fbd0bc542f detect when the WF200 goes catatonic and reset it
This is not the fix I was hoping for for connection stability,
but unfortunately this is where we are at.

The problem is that at some point the WF200 throws a "host interface
error"; but the error codes show no specific error. After throwing
this error, it can respond to some basic commands (such as the one
asking what the current status and error codes are), but higher level
APIs seem to time out. There's no command to bring the WF200 stack
to a sane state (like a warm reset or buffer flush) as far as I
can see, so, the solution is to detect the issue and send a reset
to the WF200. This keeps the link up in the long term, but
you will experience drop-outs about once every 2-3 hours for
about 20 seconds while the system detects and fixes the problem.

I think for this one, more data will be needed from customer units
to see if this could be just a local network issue with my config
or a more pervasive problem.
2022-01-15 15:13:51 +08:00
bunnie
4f9374e860 add enhanced debugging to the COM for wf200 2022-01-14 15:27:24 +08:00
bunnie
a4bb889a5d update wlan status to a binary version with more detailed output 2022-01-14 02:23:57 +08:00
bunnie
994e3d7cfb refactor llio crate (phase 1): organize files into sub-systems 2022-01-11 12:02:27 +08:00
bunnie
b3788a54af clarify the dependency policy 2022-01-10 16:50:10 +08:00
bunnie
995915ed4e nail down a couple more dependencies, and add a policy note to Cargo.toml
Each Cargo.toml now includes a comment which remnids maintainers
of the dependency policy for Xous (that is, nail down every dependency
to the minor number).
2022-01-10 15:54:27 +08:00
bunnie
dd943c5416 pin down versions and harmonize versions across servers
Versions are pinned down to the minor number. Yes, this means that
we don't automatically pull in features and bug updates from crates.io,
but it also means we don't pull in new attack surfaces and code that
hasn't been tested or reviewed. I'd like this process to be very deliberate
and not automatic for Xous.

The `rand` crate is almost pinned down to a single version, except
for an odd dependency that's pulled in by hosted mode that depends
on rand 0.8.4 via a subordinate dependency via the `tempfile` crate.
Pondering if it's worth it to try and eliminate that, because the
0.8.4 version doesn't get compiled into any version that touches
real hardware. It just makes it harder to analyze the Cargo.lock
file, mostly. I think I'll leave it as-is.
2022-01-10 15:39:55 +08:00
bunnie
c5fe1bc99b add sequencing to suspend/resume order of operations
this is necessary because we want to make sure that the SPINOR
service does not shut down before the PDDB service finishes syncing
its disks.
2022-01-10 13:45:56 +08:00
bunnie
744d6ae091 reduce system workload checking network connection state
an activity_interval Arc::AtomicU32 is shared between the
connection manager thread and the main net thread. Every
time there is a packet received, the activity interval is
bumped to 0. If two interval polls pass, then a more
expensive wlan_status() call is issued to the COM to see
if we're really still connected.

On a typcial network, the ARP traffic alone is sufficient
to keep the status timeout from happening. The status interval
is currently set at slightly over 10 seconds, so if you fall
off the network entirely, about 20 seconds will pass before
an automatic rejoin is issued. This can be adjusted by tuning
the POLL_INTERVAL_MS variable inside the net service's
connection_manager.rs module.
2022-01-09 14:03:20 +08:00
bunnie
7aa2c7b054 a very basic e2e pddb application that tries to restore a network connection
lots of problems to solve still, but let's pick that up on the refactor
stage -- for now we want to get some evidence that the pddb API is
workable.
2022-01-09 01:29:28 +08:00
bunnie
489a26dd11 fix an issue where we don't decrement the connection counter on drop 2022-01-05 20:01:54 +08:00
bunnie
059513f228 refactor "net/backend" to "net/protocols" - slightly more descriptive 2021-10-31 02:07:55 +08:00
bunnie
060aa4fee2 remove a warning that crept in 2021-10-28 18:50:07 +08:00
bunnie
db454603ee improve resilience to ping flood attack
much better, but still eventually the stack can fall over eventually.
also, the stack doesn't behave well when you try to initiate new
commands in the middle of a flood, because the back-pressure mechanisms
are primarily in-stack at the moment.

I think i have an idea on how to fix that but this will have to be later.
2021-10-28 18:38:02 +08:00
bunnie
72ffee7f13 cleanup of debug chatter, clarify some comments 2021-10-28 05:12:03 +08:00
bunnie
2c7a35a36c fix various bugs in ping. behaves much more "as expected" now. 2021-10-28 04:30:44 +08:00
bunnie
765519ff32 major refactor of ping implementation
- moved most ping state into the Net crate proper, since the smoltcp
implementation assumes a tightly bound set of objects and lifetimes
in its icmp abstraction

- created various convenience abstractions for handling single and
multiple pings, blocking and non-blocking.

- refactored the "net" command to use the new form

Initial testing indicates there are still some bugs (seems to be
with the way we are handling timestamping and doing pong retirement)
but at least we're not getting tons of async callback errors like
we were before, and we're not shuttling obscene amounts of state
using Arc-Mutex between the input and output of the ping operations.
2021-10-27 04:38:09 +08:00
bunnie
f53c57ba3f fix up a number of issues in ping
Now that I understand how smoltcp does ping better I have regrets.
The demo example in smoltcp uses a funky macro that was a bit
misleading. I have gotten rid of that but I probably would have made
different decisions in implementing this had I understood the API better.

Anyways. It works, but has some trouble handling the cases of timeouts
sometimes.
2021-10-22 04:08:43 +08:00
bunnie
f1fe850820 ping was surprisingly hard.
not fully working yet, but the architecture is there and it builds.
smoltcp's ping implementation (or at least its demo code) was not
very amenable to splitting into modules, had to recode most of it.

the ipv6 is still a hack.
2021-10-21 06:28:11 +08:00
bunnie
1a77f0afae add formatter for net crate ip address 2021-10-20 14:10:31 +08:00
bunnie
643e9a7d62 dns. needs more work, but it is at least minimally functional. 2021-10-20 05:18:54 +08:00
bunnie
60b0e3df87 handle the expected error from the disconnect call
When disconnecting from a remote server that was destroyed, we
would expect (and get) a ServerNotFound error.
2021-10-19 15:01:36 +08:00
bunnie
2885890ee2 fix typo 2021-10-19 05:06:05 +08:00
bunnie
afeae79d45 add quit opcode to Net 2021-10-19 05:02:00 +08:00
bunnie
40771fbba7 flesh out UDP API...as much as we can
Multicast/Broadcast is not supported by smoltcp it seems, so those
calls are just unimplemented. But we are able to clone UdpSocket,
for the sick puppies who like to do that sort of thing.
2021-10-19 04:42:06 +08:00
bunnie
0cbca7fbe1 add UDP send and test routines 2021-10-19 01:41:22 +08:00
bunnie
84a8bf05f8 re-org api so each protocol has its own file 2021-10-18 17:33:20 +08:00
bunnie
98bbe848fc cleanup Udp Bind API
version for Xous internal use, and a version for integration into libstd.
2021-10-18 17:04:16 +08:00
bunnie
a8c6e8047f simple end-to-end demo of receiving UDP packets asynchronously 2021-10-18 05:55:42 +08:00
bunnie
e6643e725d implement UDP rx 2021-10-18 04:02:55 +08:00
bunnie
4a2445483d scoping. I heard that's a thing in Rust. 2021-10-17 16:47:08 +08:00
bunnie
a7d8a4c1e0 clear ARP cache on DHCP renew (AP change edge case) 2021-10-17 15:29:45 +08:00
bunnie
665d7d7713 only update net config if it's changed since the last renewal 2021-10-16 00:15:23 +08:00
bunnie
f1296d0dfd convert route table to use heap not static memory, since we have heap 2021-10-15 15:44:16 +08:00
bunnie
df9bdce6dc fix some cosmetic issues 2021-10-13 02:03:12 +08:00
bunnie
ec34b01bd9 pings working with smoltcp (can originate and respond) 2021-10-13 01:57:00 +08:00
bunnie
b93109cad2 cleaning up net event loop, still figuring out APIs and integration
currently there is some issue with ARPs not sure where it's breaking,
suspect issue on EC side...
2021-10-11 05:21:01 +08:00
bunnie
26069c023a intermediate commit trying to trace down how this receive process works. 2021-10-10 21:12:09 +08:00
bunnie
7a724a15cf fix permissions 2021-10-10 02:26:31 +08:00
bunnie
61e21cce19 would be helpful to add the devices.rs file 2021-10-10 02:26:15 +08:00
bunnie
c8decc85c2 std::time doesn't exist, make a wrapper around Ticktimer for smoltcp 2021-10-10 02:20:01 +08:00
bunnie
74a3c6df44 disastrous first draft of figuring out how to integrate smoltcp using a ping example. 2021-10-10 01:57:31 +08:00
bunnie
560c6e4197 something packet-oid is coming out of the serial port now? 2021-10-09 02:12:12 +08:00
bunnie
b43eb56346 add some skeleton for a net crate; testing COM interrupts 2021-10-08 20:01:13 +08:00