On Wednesday, July 10, 2013 6:59:42 am lini...@freebsd.org wrote:
> Old Synopsis: Bad UDP checksum calc for fragmented packets
> New Synopsis: [ofed] [patch] Bad UDP checksum calc for fragmented packets
> 
> Responsible-Changed-From-To: freebsd-bugs->freebsd-net
> Responsible-Changed-By: linimon
> Responsible-Changed-When: Wed Jul 10 10:59:03 UTC 2013
> Responsible-Changed-Why: 
> Over to maintainer(s).
> 
> http://www.freebsd.org/cgi/query-pr.cgi?pr=180430

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 253202)
+++ 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
_______________________________________________
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "freebsd-net-unsubscr...@freebsd.org"

Reply via email to