Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Jul 2013 10:35:58 GMT
From:      Meny Yossefi <menyy@mellanox.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/180430: Bad UDP checksum calc for fragmented packets
Message-ID:  <201307101035.r6AAZwST095906@oldred.freebsd.org>
Resent-Message-ID: <201307101040.r6AAe0PE068034@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         180430
>Category:       misc
>Synopsis:       Bad UDP checksum calc for fragmented packets
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jul 10 10:40:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Meny Yossefi
>Release:        9.1.0
>Organization:
Mellanox
>Environment:
FreeBSD r-sw-freebsd01.mtr.labs.mlnx 9.1-RELEASE FreeBSD 9.1-RELEASE #0 r243825: Tue Dec  4 09:23:10 UTC 2012     root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
HW performs UDP checksum calculation and runs over the SW (tcp/ip stack) calculation.

In case of fragmented packets, HW calculation (For UDP csum) is wrong and packets get dropped on receiver side.

Solution: remove HW UDP csum calculation on fragmented packets.
>How-To-Repeat:
Send packets over MLNX interface with msg size larger than MTU.
>Fix:
HW will calculate UDP checksum only for un-fragmented packets.

Patch attached with submission follows:

--- ../clean_9.1.0/sys/ofed/drivers/net/mlx4/en_tx.c	2013-07-09 09:41:01.349506000 +0300
+++ ../9.1.0/sys/ofed/drivers/net/mlx4/en_tx.c	2013-07-09 10:56:18.910829000 +0300
@@ -780,8 +780,9 @@ retry:
 	tx_desc->ctrl.srcrb_flags = cpu_to_be32(MLX4_WQE_CTRL_CQ_UPDATE |
 						MLX4_WQE_CTRL_SOLICITED);
 	if (mb->m_pkthdr.csum_flags & (CSUM_IP|CSUM_TCP|CSUM_UDP)) {
-		tx_desc->ctrl.srcrb_flags |= cpu_to_be32(MLX4_WQE_CTRL_IP_CSUM |
-							 MLX4_WQE_CTRL_TCP_UDP_CSUM);
+		tx_desc->ctrl.srcrb_flags |= cpu_to_be32(MLX4_WQE_CTRL_IP_CSUM);
+		if ((mb->m_flags & M_FRAG) == 0)
+                        tx_desc->ctrl.srcrb_flags |= cpu_to_be32(MLX4_WQE_CTRL_TCP_UDP_CSUM);
 		priv->port_stats.tx_chksum_offload++;
 	}
 


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307101035.r6AAZwST095906>