From: David Laight <david.laight.linux@gmail.com>
To: James <aslan.jnn@gmail.com>
Cc: Raju Rangoju <Raju.Rangoju@amd.com>,
Prashanth Kumar K R <PrashanthKumar.K.R@amd.com>,
netdev@vger.kernel.org, Thomas.Lendacky@amd.com,
Simon Horman <horms@kernel.org>, Jakub Kicinski <kuba@kernel.org>
Subject: Re: [PATCH net v2] net: amd-xgbe: support receiving packets with bad FCS
Date: Fri, 21 Aug 2026 21:36:46 +0100 [thread overview]
Message-ID: <20260821213646.7bbb94d6@pumpkin> (raw)
In-Reply-To: <20260819091656.23943-1-aslan.jnn@gmail.com>
On Wed, 19 Aug 2026 19:16:56 +1000
James <aslan.jnn@gmail.com> wrote:
> amd-xgbe driver currently sets the MAC_RCR.DCRCC bit whenever RX is
> enabled. This disables hardware FCS validation, causing packets with
> bad FCS to be accepted unconditionally.
>
> This change unsets DCRCC so that packets with bad FCS will be dropped,
> in-line with typical behaviours of many other network controllers.
>
> Tests:
> - Verified that packets with bad FCS are now dropped.
> - Verified that receiving packets with bad FCS will increment the
> `rx_crc_errors` counter.
>
> Signed-off-by: James Nugraha <aslan.jnn@gmail.com>
> ---
> Changes in v2:
> - Eliminated DCRCC toggling via RXALL: now it simply sets the
> correct default value on MAC Rx enable
> drivers/net/ethernet/amd/xgbe/xgbe-dev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
> index 2de974213..3ceb130a0 100644
> --- a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
> +++ b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
> @@ -3400,7 +3400,7 @@ static void xgbe_enable_rx(struct xgbe_prv_data *pdata)
> XGMAC_IOWRITE(pdata, MAC_RQC0R, reg_val);
>
> /* Enable MAC Rx */
> - XGMAC_IOWRITE_BITS(pdata, MAC_RCR, DCRCC, 1);
> + XGMAC_IOWRITE_BITS(pdata, MAC_RCR, DCRCC, 0);
> XGMAC_IOWRITE_BITS(pdata, MAC_RCR, CST, 1);
> XGMAC_IOWRITE_BITS(pdata, MAC_RCR, ACS, 1);
> XGMAC_IOWRITE_BITS(pdata, MAC_RCR, RE, 1);
>
You can delete the line in the disable function that turns it off.
But, really, you should be setting the required MAC_RCR bits in a single
write.
Doing RMW sequences on the hardware registers for each bit is really wrong.
You also need to start with a known value for all the bits, otherwise
'silly' things can happen is (say) some bios boot code set bits you don't
otherwise change.
David
next prev parent reply other threads:[~2026-08-21 20:36 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-12 9:16 [PATCH net] net: amd-xgbe: support receiving packets with bad FCS James
2026-08-14 10:09 ` Simon Horman
2026-08-19 2:36 ` James
2026-08-19 9:01 ` Simon Horman
2026-08-17 23:32 ` Jakub Kicinski
2026-08-19 6:31 ` James
2026-08-19 9:16 ` [PATCH net v2] " James
2026-08-21 10:39 ` Simon Horman
2026-08-21 20:36 ` David Laight [this message]
2026-08-19 11:43 ` [PATCH net] " David Laight
2026-08-20 0:38 ` James
2026-08-20 8:58 ` David Laight
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260821213646.7bbb94d6@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=PrashanthKumar.K.R@amd.com \
--cc=Raju.Rangoju@amd.com \
--cc=Thomas.Lendacky@amd.com \
--cc=aslan.jnn@gmail.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox