Skip to contentSkip to conversation

Bug? xpcs-wx: read-modify-write to different registers?

DISCUSSION Russell King (Oracle) 2 participants 2 messages Sep 23, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

While making some cleanups to the XPCS driver, I spotted the following in pcs-xpcs-wx.c:

        val = txgbe_read_pma(xpcs, TXGBE_RX_GEN_CTL3);
        val = u16_replace_bits(val, 0x4, TXGBE_RX_GEN_CTL3_LOS_TRSHLD0);
        txgbe_write_pma(xpcs, TXGBE_RX_EQ_ATTN_CTL, val);

This reads from the TXGBE_RX_GEN_CTL3 register, changes a value in a field, and then writes it back to a different register, TXGBE_RX_EQ_ATTN_CTL. This doesn't look correct.

Please check whether this code is correct, if not please submit a fix.

Thanks.

Russell.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
#1 lore raw
Quoted 18 lines

-----Original Message-----
From: Russell King (Oracle) <[email protected]>
Sent: Monday, September 23, 2024 5:18 PM
To: Jiawen Wu <[email protected]>
Cc: [email protected]
Subject: Bug? xpcs-wx: read-modify-write to different registers?

Hi,

While making some cleanups to the XPCS driver, I spotted the following in pcs-xpcs-wx.c:

        val = txgbe_read_pma(xpcs, TXGBE_RX_GEN_CTL3);
        val = u16_replace_bits(val, 0x4, TXGBE_RX_GEN_CTL3_LOS_TRSHLD0);
        txgbe_write_pma(xpcs, TXGBE_RX_EQ_ATTN_CTL, val);
Quoted 7 lines

This reads from the TXGBE_RX_GEN_CTL3 register, changes a value in a field, and then writes it back to a different register, TXGBE_RX_EQ_ATTN_CTL. This doesn't look correct.

Please check whether this code is correct, if not please submit a fix.

Thanks.

OMG, it's a real bug. Register TXGBE_RX_GEN_CTL3 should be written back.

Thanks Russell, I'll send a patch to fix it.