kern/180430: [ofed] [patch] Bad UDP checksum calc for fragmented packets

John Baldwin jhb at freebsd.org
Fri Jul 19 15:30:02 UTC 2013


The following reply was made to PR kern/180430; it has been noted by GNATS.

From: John Baldwin <jhb at freebsd.org>
To: bug-followup at freebsd.org,
 menyy at mellanox.com
Cc:  
Subject: Re: kern/180430: [ofed] [patch] Bad UDP checksum calc for fragmented packets
Date: Fri, 19 Jul 2013 11:13:44 -0400

 Oops, my previous reply didn't make it to the PR itself.
 
 Is the problem that the hardware checksum overwrites arbitrary data in the 
 packet (at the location where the UDP header would be)?
 
 Also, I've looked at other drivers, and they all look at the CSUM_*
 flags to determine the right settings.  IP fragments will not have
 CSUM_UDP or CSUM_TCP set, so I think the more correct fix is this:
 
 Index: en_tx.c
 ===================================================================
 --- en_tx.c	(revision 253470)
 +++ en_tx.c	(working copy)
 @@ -780,8 +780,12 @@ 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);
 +		if (mb->m_pkthdr.csum_flags & CSUM_IP)
 +			tx_desc->ctrl.srcrb_flags |=
 +			    cpu_to_be32(MLX4_WQE_CTRL_IP_CSUM);
 +		if (mb->m_pkthdr.csum_flags & (CSUM_TCP|CSUM_UDP))
 +			tx_desc->ctrl.srcrb_flags |=
 +			    cpu_to_be32(MLX4_WQE_CTRL_TCP_UDP_CSUM);
  		priv->port_stats.tx_chksum_offload++;
  	}
  
 
 -- 
 John Baldwin


More information about the freebsd-net mailing list