• Wesley W. Terpstra's avatar
    wr_endpoint: fix (one cause of) packet filter misclassification · 4177c4b6
    Wesley W. Terpstra authored
    The symptom of this bug is that about 3% of the time a WR endpoint will
    power-up such that it always fails to reach track phase state.  This is
    caused by the endpoint dropping the first PTP packet after calibration.
    
    The packet is dropped, because it is misclassified. This happens because
    it is possible for the U_match_buffer and fab_pipe in the RX path to
    become desynchronized. When this happens, packets receive the classification
    of the previous packet. Since calibration is slow, it is virtually assured
    that a BOOTP request is seen, leading to the misclassification of the
    following PTP packet.
    
    The U_match_buffer can become desynchronized multiple ways, but the one we
    saw "in the wild" is due to the lowering of PFCR0 in wrpc-sw during packet
    filter configuration.  Due to an unsafe transfer from clk_sys to clk_rx in
    ep_packet_filter:p_gen_status, it is possible for the transition of PFCR0 to
    cause a glitch that sets done_int high, even though there is no packet being
    processed.  This puts an excess class tag into U_match_buffer, which leads
    to the mismatch between packets and classes.  This patch fixes the transfer.
    
    Unfortunately, even after this patch, it is my opinion that this code
    remains completely unsafe.  The core problem is that desynchronization of
    U_match_buffer and fab_pipe is possible at all.  This is a very brittle
    design.  One can imagine many scenarios that can lead to this state, after
    which point the WR endpoint will never recover.  A simple example: consider
    a packet arriving while PFCR0 is switched.  ep_rx_path:mbuf_we can then
    pulse twice, once, or never for the packet depending on the race condition
    between ematch_done and pfilter_done.  If this happens, the RX path will
    remain permanently desynchronized.
    4177c4b6
Name
Last commit
Last update
..
Manifest.py Loading commit data...
build_wb.sh Loading commit data...
endpoint_pkg.vhd Loading commit data...
endpoint_private_pkg.vhd Loading commit data...
ep_1000basex_pcs.vhd Loading commit data...
ep_autonegotiation.vhd Loading commit data...
ep_clock_alignment_fifo.vhd Loading commit data...
ep_crc32_pkg.vhd Loading commit data...
ep_flow_control.vhd Loading commit data...
ep_leds_controller.vhd Loading commit data...
ep_packet_filter.vhd Loading commit data...
ep_pcs_tbi_mdio_wb.vhd Loading commit data...
ep_registers_pkg.vhd Loading commit data...
ep_rmon_counters.vhd Loading commit data...
ep_rtu_header_extract.vhd Loading commit data...
ep_rx_buffer.vhd Loading commit data...
ep_rx_bypass_queue.vhd Loading commit data...
ep_rx_crc_size_check.vhd Loading commit data...
ep_rx_early_address_match.vhd Loading commit data...
ep_rx_oob_insert.vhd Loading commit data...
ep_rx_path.vhd Loading commit data...
ep_rx_pcs_16bit.vhd Loading commit data...
ep_rx_pcs_8bit.vhd Loading commit data...
ep_rx_status_reg_insert.vhd Loading commit data...
ep_rx_vlan_unit.vhd Loading commit data...
ep_rx_wb_master.vhd Loading commit data...
ep_sync_detect.vhd Loading commit data...
ep_sync_detect_16bit.vhd Loading commit data...
ep_timestamping_unit.vhd Loading commit data...
ep_ts_counter.vhd Loading commit data...
ep_tx_framer.vhd Loading commit data...
ep_tx_header_processor.vhd Loading commit data...
ep_tx_pcs_16bit.vhd Loading commit data...
ep_tx_pcs_8bit.vhd Loading commit data...
ep_wishbone_controller.vhd Loading commit data...
ep_wishbone_controller.wb Loading commit data...
pcs_regs.wb Loading commit data...
wr_endpoint.vhd Loading commit data...
xwr_endpoint.vhd Loading commit data...