From owner-svn-src-stable-10@FreeBSD.ORG Thu May 21 09:05:14 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AE0ABD1E; Thu, 21 May 2015 09:05:14 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 81FB11C54; Thu, 21 May 2015 09:05:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4L95EFg066804; Thu, 21 May 2015 09:05:14 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4L95Eiq066803; Thu, 21 May 2015 09:05:14 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201505210905.t4L95Eiq066803@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 21 May 2015 09:05:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r283206 - stable/10/sys/dev/sfxge X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 May 2015 09:05:14 -0000 Author: arybchik Date: Thu May 21 09:05:13 2015 New Revision: 283206 URL: https://svnweb.freebsd.org/changeset/base/283206 Log: MFC: r282940 sfxge: LRO may be done only if checksums are OK Also it is cheaper to check Rx descriptor flags than TCP protocol in IP header. Sponsored by: Solarflare Communications, Inc. Modified: stable/10/sys/dev/sfxge/sfxge_rx.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sfxge/sfxge_rx.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge_rx.c Thu May 21 09:03:18 2015 (r283205) +++ stable/10/sys/dev/sfxge/sfxge_rx.c Thu May 21 09:05:13 2015 (r283206) @@ -681,15 +681,18 @@ sfxge_lro(struct sfxge_rxq *rxq, struct */ if (l3_proto == htons(ETHERTYPE_IP)) { struct ip *iph = nh; - if ((iph->ip_p - IPPROTO_TCP) | - (iph->ip_hl - (sizeof(*iph) >> 2u)) | + + KASSERT(iph->ip_p == IPPROTO_TCP, + ("IPv4 protocol is not TCP, but packet marker is set")); + if ((iph->ip_hl - (sizeof(*iph) >> 2u)) | (iph->ip_off & htons(IP_MF | IP_OFFMASK))) goto deliver_now; th = (struct tcphdr *)(iph + 1); } else if (l3_proto == htons(ETHERTYPE_IPV6)) { struct ip6_hdr *iph = nh; - if (iph->ip6_nxt != IPPROTO_TCP) - goto deliver_now; + + KASSERT(iph->ip6_nxt == IPPROTO_TCP, + ("IPv6 next header is not TCP, but packet marker is set")); l2_id |= SFXGE_LRO_L2_ID_IPV6; th = (struct tcphdr *)(iph + 1); } else { @@ -834,7 +837,9 @@ sfxge_rx_qcomplete(struct sfxge_rxq *rxq /* Pass packet up the stack or into LRO (pipelined) */ if (prev != NULL) { - if (lro_enabled) + if (lro_enabled && + ((prev->flags & (EFX_PKT_TCP | EFX_CKSUM_TCPUDP)) == + (EFX_PKT_TCP | EFX_CKSUM_TCPUDP))) sfxge_lro(rxq, prev); else sfxge_rx_deliver(sc, prev); @@ -853,7 +858,9 @@ discard: /* Pass last packet up the stack or into LRO */ if (prev != NULL) { - if (lro_enabled) + if (lro_enabled && + ((prev->flags & (EFX_PKT_TCP | EFX_CKSUM_TCPUDP)) == + (EFX_PKT_TCP | EFX_CKSUM_TCPUDP))) sfxge_lro(rxq, prev); else sfxge_rx_deliver(sc, prev);