From 58c12b8f515806400b73bad1735987b59fcd595a Mon Sep 17 00:00:00 2001 From: whitequark Date: Mon, 2 Oct 2017 21:52:30 +0000 Subject: [PATCH] Reword checksum-related documentations. cc @steffengy --- src/phy/mod.rs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/phy/mod.rs b/src/phy/mod.rs index 0794b7759..e6ca01bf6 100644 --- a/src/phy/mod.rs +++ b/src/phy/mod.rs @@ -135,16 +135,16 @@ pub use self::tap_interface::TapInterface; /// A tracer device for Ethernet frames. pub type EthernetTracer = Tracer>; -/// The checksum configuration for a device +/// A description of checksum behavior for a particular protocol. #[derive(Debug, Clone, Copy)] pub enum Checksum { - /// Validate checksum when receiving and supply checksum when sending + /// Verify checksum when receiving and compute checksum when sending. Both, - /// Validate checksum when receiving + /// Verify checksum when receiving. Rx, - /// Supply checksum before sending + /// Compute checksum before sending. Tx, - /// Ignore checksum + /// Ignore checksum completely. None, } @@ -155,14 +155,16 @@ impl Default for Checksum { } impl Checksum { - pub(crate) fn rx(&self) -> bool { + /// Returns whether checksum should be verified when receiving. + pub fn rx(&self) -> bool { match *self { Checksum::Both | Checksum::Rx => true, _ => false } } - pub(crate) fn tx(&self) -> bool { + /// Returns whether checksum should be verified when sending. + pub fn tx(&self) -> bool { match *self { Checksum::Both | Checksum::Tx => true, _ => false @@ -170,7 +172,7 @@ impl Checksum { } } -/// Configuration of checksum capabilities for each applicable protocol +/// A description of checksum behavior for every supported protocol. #[derive(Debug, Clone, Default)] pub struct ChecksumCapabilities { pub ipv4: Checksum, @@ -204,7 +206,7 @@ pub struct DeviceCapabilities { /// dynamically allocated. pub max_burst_size: Option, - /// Checksum capabilities for the current device + /// The set of protocols for which checksum can be computed in hardware. pub checksum: ChecksumCapabilities, /// Only present to prevent people from trying to initialize every field of DeviceLimits,