28 Commits

Author SHA1 Message Date
Dario Nieuwenhuis
339545411a Clippy fixes. 2022-12-30 02:41:09 +01:00
Dario Nieuwenhuis
4300e7cc3b GAT-based Device trait.
The current `'a` lifetime in the `Device` trait is essentially a workaround for lack of GATs.
I'm just experimenting how this would look like, it'll have to wait until GATs are stable to go in.

The main benefit is structs implementing `Device` can now borrow stuff. This wasn't possible
before because the `for<'d> T: Device<'d>` bounds would essentially imply `T: 'static`.
2022-11-06 21:18:02 +01:00
Dario Nieuwenhuis
dfe8265772 phy: simplify PcapSink trait 2021-10-03 21:29:40 +02:00
Thibaut Vandervelden
f72e471eb0 Fix clippy because of MSV change 2021-09-16 19:44:26 +02:00
qiujiangkun
7dda148ad5 various clippy fix 2021-06-27 10:45:57 +02:00
Dario Nieuwenhuis
2cb407d62a rustfmt 2021-06-27 09:31:59 +02:00
Dario Nieuwenhuis
17cf2c8d47 phy: fix FaultInjector returning a too big buffer when simulating a drop on tx 2021-04-07 02:40:32 +02:00
Dario Nieuwenhuis
49fa987cdc Add defmt logging support 2021-04-01 01:30:47 +02:00
Dario Nieuwenhuis
1e40b934bf Update to Rust 2018. Fixes #271 2020-12-27 17:54:56 +01:00
jhwgh1968
e6a6b1630f Allow mutation of data buffer in RxToken
Closes: #294
Approved by: whitequark
2019-05-05 03:48:25 +08:00
Dan Robertson
470a08669f Update phy mod to use new time types
Update everything but the socket types to use the new time types instead
of a basic u64

Closes: #141
Approved by: whitequark
2018-02-16 10:44:03 +08:00
whitequark
32ee91da07 Add CODE_STYLE.md. 2017-11-03 23:34:12 +00:00
Philipp Oppermann
198fe239f1 Redesign the phy::Device trait to avoid Drop impls. 2017-11-03 23:15:07 +00:00
Steffen Butzer
9b1b0b4bde phy: introduce hardware based checksum settings, rename DeviceLimits
this contains a rename of occurrences of
DeviceLimits -> DeviceCapabilities.
2017-10-02 21:40:08 +00:00
whitequark
16e6e70d2f Fix many warnings. 2017-09-25 00:55:54 +00:00
whitequark
dc94c35da3 Unbreak traffic shaper in the fault injector. 2017-08-31 21:39:01 +00:00
whitequark
5bf64586cd Get rid of Result<_, ()>.
The use of this type has several drawbacks:
  * It does not allow distinguishing between different error
    conditions. In fact, we wrongly conflated some of them
    before this commit.
  * It does not allow propagation via ? and requires manual use
    of map_err, which is especially tiresome for downstream code.
  * It prevents us from expanding the set of error conditions
    even if right now we have only one.
  * It prevents us from blanket using Result<T> everywhere
    (a nitpick at most).

Instead, use Result<T, Error> everywhere, and differentiate error
conditions where applicable.
2017-07-27 13:55:47 +00:00
whitequark
d73c2bdb81 Update fault injector so that rate limiting works without std. 2017-07-23 15:10:57 +00:00
whitequark
ac988f699b Rename into_lower → into_inner. 2017-07-23 10:20:05 +00:00
whitequark
97499ac280 Clean up some type variable names and trait bounds. NFC. 2017-07-23 10:15:56 +00:00
whitequark
3a656c1529 Inject the current timestamp into Device::{transmit,receive}.
Various parts of smoltcp require an arrow of time; a monotonically
increasing timestamp. Most obviously this is TCP sockets, but
the tracer and the pcap writer devices also benefit from having
timestamps. There are a few ways this could be implemented:
  1. using a static Cell, global for the entire smoltcp crate;
  2. using a static method on Device;
  3. using an instance method on Device;
  4. passing the current timestamp into *Interface::poll.

The first two options are undesirable because they create a notion
of global clock, and interfere e.g. with mocking.
The third option is undesirable because not all devices are
inherently tied to a particular clock, e.g. a loopback device isn't.

Therefore, the timestamp is injected into both sockets and devices
through the *Interface::poll method.
2017-07-23 09:48:14 +00:00
whitequark
1c1489e5fb try! → ? 2017-06-24 16:34:32 +00:00
whitequark
5a6641a967 Fix no-std build. 2017-05-29 11:04:49 +00:00
whitequark
21900288cc Add packet shaping to the fault injector. 2017-05-29 10:53:30 +00:00
whitequark
7381e7f98b fn Device::mtu() -> usize → Device::limits() -> DeviceLimits 2017-03-07 11:10:26 +00:00
whitequark
5b4db5fe10 TCP: retransmit ACK when receiving duplicate SEQ. 2016-12-31 01:33:46 +00:00
whitequark
1c7f972a86 Fix length of tx buffers returned by fault injector. 2016-12-31 01:10:46 +00:00
whitequark
5860c365f5 Impement fault injection. 2016-12-31 01:05:29 +00:00