P2: later
An appendix to the milestone.
-
Literal field values in the controller sequences. Finding:
receive_queue_modewrites1 << 7,0x3f << 14,0x3f << 8,0x3 << 14and0x1 << 8for the flow-control enable and its two thresholds (src/network_interface_controller.rs:203-208), with the source's names only in a comment.stoppolls the flush bit10_000times at 1 µs (src/network_interface_controller.rs:610) where the reset and the MDIO waits have named limits. A test checks the jumbo bit as1 << 16(src/network_interface_controller.rs:843). The module's own rule is that every bit it writes is a named constant with the source's spelling in an alias. Change: five constants inregisters(OpenBSD'sGMAC_MTL_CHAN_RX_OP_MODE_EHFC,_RFD_*and_RFA_*name them, not fetched for this review), aFLUSH_LIMIT_MICROSECONDS, and a named jumbo bit for the test. Door: two-way. Effort: S. Status: done in partsfoundry/designware_ethernet#9. The four flow-control constants areRECEIVE_QUEUE_0_OPERATION_MODE_HARDWARE_FLOW_CONTROL_ENABLEand the_FLOW_CONTROL_ACTIVATE_THRESHOLD_and_FLOW_CONTROL_DEACTIVATE_THRESHOLD_MASKandSHIFTpairs, the flush limit isTRANSMIT_FLUSH_LIMIT_MICROSECONDS, and the test bit isMAC_CONFIGURATION_JUMBO_PACKET_ENABLE. Names provisional, the maintainer's. -
A caller's short buffer loses the frame. Finding:
receivejudges each descriptor againstout.len()(src/data_plane.rs:140), so a frame longer than the buffer offered isDrop: consumed, counted and gone. The documentation ofreceivesays aDropis "a bad frame".componentsalways offersMAXIMUM_FRAME_BYTES, so no caller today meets it, and the proof that a delivered frame fits the room is what makes the contract safe. Change: say so atreceive, in one sentence; or return the length and leave the descriptor for a larger buffer, assmoltcp'sRxTokenhands the frame to a closure sized by the device. The sentence is enough before the tag. Door: two-way. Effort: XS for the sentence. Status: done in partsfoundry/designware_ethernet#9. The sentence is atreceiveand a test shows the drop and its count. A shortoutstays a drop; the length-returning shape is not taken (maintainer, provisional). -
The PHY's extended-address port comes back only on success. Finding:
configureandapply_speedsave the address port first and write it back last (src/motorcomm_physical_layer_device.rs:508,569,609,621); any?between leaves the port on the last extended register. The next access rewrites it, so the cost is one firmware access that lands on the wrong register, which the module says it is restoring the port to avoid. Change: restore in both arms, or say the restore is best effort. Door: two-way. Effort: XS. Status: done in partsfoundry/designware_ethernet#9. Both functions restore the port on every path, the body's error wins, and a test fails each data write in turn. -
An unknown drive current gets the part's default without a word. Finding:
drive_codereturns 3 for a(voltage, microamps)pair the table does not hold (src/motorcomm_physical_layer_device.rs:392-418), as OpenBSD does by the crate's account. Linux'smotorcomm.crefuses the probe for such a pair (from memory, not verified for this review). A tree with a typo inmotorcomm,rx-clk-drv-microampthen runs at the default drive and nobody learns of it. Change:Appliedcarries which codes were defaults, orSettingsSourcegains a variant; the kernel's report line can then print it. Door: two-way. Effort: S. Status: done in partsfoundry/designware_ethernet#9.Appliedcarriesreceive_clock_drive_defaultedandreceive_data_drive_defaulted, andSettingsSourcekeeps its variants. Names provisional, the maintainer's. -
The fallback settings claim both trees and the test checks half of it. Finding:
Settings::FALLBACK_GMAC0says both trees give these values (src/motorcomm_physical_layer_device.rs:339-351), with the transmit clock inverted at all three speeds; the test that compares the trees (src/motorcomm_physical_layer_device.rs:683-692) builds mainline's settings with[false, true, true]and compares delays and drives only. Which tree is right about 10 Mbit/s is not verified here. Change: compare the inversions too, or say in the fallback's documentation which tree it follows for the inversion and why. Door: two-way. Effort: XS. Status: the settings left the crate in partsfoundry/designware_ethernet#5 and arePORT_0_FALLBACK_SETTINGSincrates/machine_discovery/src/jh7110/designware_ethernet.rs. Its documentation now says the inversion follows the vendor tree and that mainline does not invert at 10 Mbit/s, and the test checks both (the pull request that carries this line). Which tree is right at 10 Mbit/s is open: bench. -
One verdict name covers two disagreements, and one precondition is unsaid. Finding:
classify's last arm (src/cache_coherence.rs:198) returnsTransmittedPayloadStalefor every delivered descriptor that is not aFrame(128)with a matching payload. That includes a descriptor reporting an error summary, or another length, over a payload that matches: the descriptor disagrees, not the payload. The module header does not say that MAC loopback needs the PHY's receive clock. The databook loops the transmit path back but not the clock, which is why the driver keeps that clock running (from the sources the crate cites, not verified here). Change: aDescriptorDisagreesverdict, or one sentence at the arm; one sentence in the header on the receive clock. Door: two-way (a new variant on a public enum before the tag). Effort: S. Status: done in partsfoundry/designware_ethernet#9. One sentence at the arm and in the verdict's documentation, and one in the header on the receive clock. No new variant (maintainer, provisional). -
The transport re-derives the data plane's peek. Finding:
components/src/designware_ethernet_transport.rs:143-148reads the next descriptor fromreceive_cursor()and judges it withreceive_verdictto know whether a frame waits, repeating the first two lines ofreceive. Change:DataPlane::is_frame_waiting(&self, region: &impl DirectMemoryAccessRegion) -> bool, and the transport calls it. Door: two-way (an addition). Effort: XS. Status: done. partsfoundry/designware_ethernet#9 addsDataPlane::is_frame_waiting, and the transport calls it from the pin bump that follows. -
starttwice desynchronizes the cursors. Finding:DataPlane::startreposts the ring and clears the transmit ring but leavesreceive_next,transmit_nextandtransmit_cleanwhere they were (src/data_plane.rs:106-124); the documentation says only to call it first. Change: reset the three cursors instart, or say it runs once afternew. Door: two-way. Effort: XS. Status: done in partsfoundry/designware_ethernet#9.startresets the three cursors, and a test runs a second start after a reset. -
Small text fixes. Finding: "current current" (
src/motorcomm_physical_layer_device.rs:390); the file usesMTLatsrc/registers.rs:7and expands it only at line 174;Identity::direct_memory_access_address_bitsis a width, and the address rule reads it as an address (src/network_interface_controller.rs:75):…_address_width_bitssays what it is. Door: two-way, the last one one-way at the tag. Effort: XS. Status: decision 4 settles the address width (direct_memory_access_physical_address_bits).registers.rsexpands MTL at its first use on main. partsfoundry/designware_ethernet#9 fixes "current current". -
The crate root re-exports 27 descriptor items. Finding:
lib.rsre-exports every descriptor bit and the two descriptor constructors at the crate root besideDataPlaneand the three traits (src/lib.rs:106-121), while the register map has its own module. A docs.rs reader meets thirteenRECEIVE_DESCRIPTOR_WORD_3_*constants beforeDataPlane. Change: a publicdescriptormodule and a shorter root, or leave it and say why. The maintainer decides before the tag; after it the paths stay fixed. Door: two-way now, one-way at the tag. Effort: S. Status: done in partsfoundry/designware_ethernet#9. The root keeps the data plane,Hardwareand the five size constants; every other descriptor item ispub(crate), as item 6's rule reads. No publicdescriptormodule (maintainer, provisional; adding a module later breaks nobody).