linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: bcmgenet: skip invalid partial checksums
@ 2022-03-17  1:28 Doug Berger
  2022-03-17  1:55 ` Florian Fainelli
  2022-03-17 16:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Doug Berger @ 2022-03-17  1:28 UTC (permalink / raw)
  To: David S. Miller
  Cc: Florian Fainelli, Jakub Kicinski, Paolo Abeni,
	bcm-kernel-feedback-list, netdev, linux-kernel, Doug Berger

The RXCHK block will return a partial checksum of 0 if it encounters
a problem while receiving a packet. Since a 1's complement sum can
only produce this result if no bits are set in the received data
stream it is fair to treat it as an invalid partial checksum and
not pass it up the stack.

Fixes: 810155397890 ("net: bcmgenet: use CHECKSUM_COMPLETE for NETIF_F_RXCSUM")
Signed-off-by: Doug Berger <opendmb@gmail.com>
---
 drivers/net/ethernet/broadcom/genet/bcmgenet.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 87f1056e29ff..2da804f84b48 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -2287,8 +2287,10 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_rx_ring *ring,
 		dma_length_status = status->length_status;
 		if (dev->features & NETIF_F_RXCSUM) {
 			rx_csum = (__force __be16)(status->rx_csum & 0xffff);
-			skb->csum = (__force __wsum)ntohs(rx_csum);
-			skb->ip_summed = CHECKSUM_COMPLETE;
+			if (rx_csum) {
+				skb->csum = (__force __wsum)ntohs(rx_csum);
+				skb->ip_summed = CHECKSUM_COMPLETE;
+			}
 		}
 
 		/* DMA flags and length are still valid no matter how
-- 
2.25.1


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

* Re: [PATCH net] net: bcmgenet: skip invalid partial checksums
  2022-03-17  1:28 [PATCH net] net: bcmgenet: skip invalid partial checksums Doug Berger
@ 2022-03-17  1:55 ` Florian Fainelli
  2022-03-17 16:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Florian Fainelli @ 2022-03-17  1:55 UTC (permalink / raw)
  To: Doug Berger, David S. Miller
  Cc: Jakub Kicinski, Paolo Abeni, bcm-kernel-feedback-list, netdev,
	linux-kernel



On 3/16/2022 6:28 PM, Doug Berger wrote:
> The RXCHK block will return a partial checksum of 0 if it encounters
> a problem while receiving a packet. Since a 1's complement sum can
> only produce this result if no bits are set in the received data
> stream it is fair to treat it as an invalid partial checksum and
> not pass it up the stack.
> 
> Fixes: 810155397890 ("net: bcmgenet: use CHECKSUM_COMPLETE for NETIF_F_RXCSUM")
> Signed-off-by: Doug Berger <opendmb@gmail.com>

Acked-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

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

* Re: [PATCH net] net: bcmgenet: skip invalid partial checksums
  2022-03-17  1:28 [PATCH net] net: bcmgenet: skip invalid partial checksums Doug Berger
  2022-03-17  1:55 ` Florian Fainelli
@ 2022-03-17 16:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-03-17 16:40 UTC (permalink / raw)
  To: Doug Berger
  Cc: davem, f.fainelli, kuba, pabeni, bcm-kernel-feedback-list,
	netdev, linux-kernel

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 16 Mar 2022 18:28:12 -0700 you wrote:
> The RXCHK block will return a partial checksum of 0 if it encounters
> a problem while receiving a packet. Since a 1's complement sum can
> only produce this result if no bits are set in the received data
> stream it is fair to treat it as an invalid partial checksum and
> not pass it up the stack.
> 
> Fixes: 810155397890 ("net: bcmgenet: use CHECKSUM_COMPLETE for NETIF_F_RXCSUM")
> Signed-off-by: Doug Berger <opendmb@gmail.com>
> 
> [...]

Here is the summary with links:
  - [net] net: bcmgenet: skip invalid partial checksums
    https://git.kernel.org/netdev/net/c/0f643c88c8d2

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2022-03-17 16:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-17  1:28 [PATCH net] net: bcmgenet: skip invalid partial checksums Doug Berger
2022-03-17  1:55 ` Florian Fainelli
2022-03-17 16:40 ` patchwork-bot+netdevbpf

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).