• Vladimir Oltean's avatar
    net: enetc: remove bogus write to SIRXIDR from enetc_setup_rxbdr · 96a5223b
    Vladimir Oltean authored
    The Station Interface Receive Interrupt Detect Register (SIRXIDR)
    contains a 16-bit wide mask of 'interrupt detected' events for each ring
    associated with a port. Bit i is write-1-to-clean for RX ring i.
    
    I have no explanation whatsoever how this line of code came to be
    inserted in the blamed commit. I checked the downstream versions of that
    patch and none of them have it.
    
    The somewhat comical aspect of it is that we're writing a binary number
    to the SIRXIDR register, which is derived from enetc_bd_unused(rx_ring).
    Since the RX rings have 512 buffer descriptors, we end up writing 511 to
    this register, which is 0x1ff, so we are effectively clearing the
    'interrupt detected' event for rings 0-8.
    
    This register is not what is used for interrupt handling though - it
    only provides a summary for the entire SI. The hardware provides one
    separate Interrupt Detect Register per RX ring, which auto-clears upon
    read. So there doesn't seem to be any adverse effect caused by this
    bogus write.
    
    There is, however, one reason why this should be handled as a bugfix:
    next_to_clean _should_ be committed to hardware, just not to that
    register, and this was obscuring the fact that it wasn't. This is fixed
    in the next patch, and removing the bogus line now allows the fix patch
    to be backported beyond that point.
    
    Fixes: fd5736bf ("enetc: Workaround for MDIO register access issue")
    Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    96a5223b
enetc.c 44.7 KB