netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Bug? xpcs-wx: read-modify-write to different registers?
@ 2024-09-23  9:18 Russell King (Oracle)
  2024-09-23 10:12 ` Jiawen Wu
  0 siblings, 1 reply; 2+ messages in thread
From: Russell King (Oracle) @ 2024-09-23  9:18 UTC (permalink / raw)
  To: Jiawen Wu; +Cc: netdev

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.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: Bug? xpcs-wx: read-modify-write to different registers?
  2024-09-23  9:18 Bug? xpcs-wx: read-modify-write to different registers? Russell King (Oracle)
@ 2024-09-23 10:12 ` Jiawen Wu
  0 siblings, 0 replies; 2+ messages in thread
From: Jiawen Wu @ 2024-09-23 10:12 UTC (permalink / raw)
  To: 'Russell King (Oracle)'; +Cc: netdev



> -----Original Message-----
> From: Russell King (Oracle) <linux@armlinux.org.uk>
> Sent: Monday, September 23, 2024 5:18 PM
> To: Jiawen Wu <jiawenwu@trustnetic.com>
> Cc: netdev@vger.kernel.org
> 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);
> 
> 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.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-09-23 10:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-23  9:18 Bug? xpcs-wx: read-modify-write to different registers? Russell King (Oracle)
2024-09-23 10:12 ` Jiawen Wu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).