Date: Fri, 19 Jul 2013 15:30:01 GMT From: John Baldwin <jhb@freebsd.org> To: freebsd-net@FreeBSD.org Subject: Re: kern/180430: [ofed] [patch] Bad UDP checksum calc for fragmented packets Message-ID: <201307191530.r6JFU1uH046935@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/180430; it has been noted by GNATS. From: John Baldwin <jhb@freebsd.org> To: bug-followup@freebsd.org, menyy@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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307191530.r6JFU1uH046935>