linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: hns3: Fix for geneve tx checksum bug
@ 2020-08-26  5:11 Yi Li
  2020-08-26 14:27 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Yi Li @ 2020-08-26  5:11 UTC (permalink / raw)
  To: linux-kernel, netdev
  Cc: yilikernel, yili, yisen.zhuang, salil.mehta, davem, kuba, Li Bing

when skb->encapsulation is 0, skb->ip_summed is CHECKSUM_PARTIAL
and it is udp packet, which has a dest port as the IANA assigned.
the hardware is expected to do the checksum offload, but the
hardware will not do the checksum offload when udp dest port is
6081.

This patch fixes it by doing the checksum in software.

Reported-by: Li Bing <libing@winhong.com>
Signed-off-by: Yi Li <yili@winhong.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
index 87776ce3539b..7d83c45369c2 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
@@ -21,6 +21,7 @@
 #include <net/pkt_cls.h>
 #include <net/tcp.h>
 #include <net/vxlan.h>
+#include <net/geneve.h>
 
 #include "hnae3.h"
 #include "hns3_enet.h"
@@ -780,7 +781,7 @@ static int hns3_get_l4_protocol(struct sk_buff *skb, u8 *ol4_proto,
  * and it is udp packet, which has a dest port as the IANA assigned.
  * the hardware is expected to do the checksum offload, but the
  * hardware will not do the checksum offload when udp dest port is
- * 4789.
+ * 4789 or 6081.
  */
 static bool hns3_tunnel_csum_bug(struct sk_buff *skb)
 {
@@ -789,7 +790,8 @@ static bool hns3_tunnel_csum_bug(struct sk_buff *skb)
 	l4.hdr = skb_transport_header(skb);
 
 	if (!(!skb->encapsulation &&
-	      l4.udp->dest == htons(IANA_VXLAN_UDP_PORT)))
+	      (l4.udp->dest == htons(IANA_VXLAN_UDP_PORT) ||
+	      l4.udp->dest == htons(GENEVE_UDP_PORT))))
 		return false;
 
 	skb_checksum_help(skb);
-- 
2.25.3




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

* Re: [PATCH] net: hns3: Fix for geneve tx checksum bug
  2020-08-26  5:11 [PATCH] net: hns3: Fix for geneve tx checksum bug Yi Li
@ 2020-08-26 14:27 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-08-26 14:27 UTC (permalink / raw)
  To: yili
  Cc: linux-kernel, netdev, yilikernel, yisen.zhuang, salil.mehta,
	kuba, libing

From: Yi Li <yili@winhong.com>
Date: Wed, 26 Aug 2020 13:11:50 +0800

> when skb->encapsulation is 0, skb->ip_summed is CHECKSUM_PARTIAL
> and it is udp packet, which has a dest port as the IANA assigned.
> the hardware is expected to do the checksum offload, but the
> hardware will not do the checksum offload when udp dest port is
> 6081.
> 
> This patch fixes it by doing the checksum in software.
> 
> Reported-by: Li Bing <libing@winhong.com>
> Signed-off-by: Yi Li <yili@winhong.com>

Applied, thank you.

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

end of thread, other threads:[~2020-08-26 14:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-26  5:11 [PATCH] net: hns3: Fix for geneve tx checksum bug Yi Li
2020-08-26 14:27 ` David Miller

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