From owner-svn-src-all@freebsd.org Thu Aug 24 19:09:43 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A33F3DE6366; Thu, 24 Aug 2017 19:09:43 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 71EF8355E; Thu, 24 Aug 2017 19:09:43 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7OJ9giY037062; Thu, 24 Aug 2017 19:09:42 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7OJ9gHD037061; Thu, 24 Aug 2017 19:09:42 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201708241909.v7OJ9gHD037061@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Thu, 24 Aug 2017 19:09:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322852 - head/sys/dev/qlnx/qlnxe X-SVN-Group: head X-SVN-Commit-Author: davidcs X-SVN-Commit-Paths: head/sys/dev/qlnx/qlnxe X-SVN-Commit-Revision: 322852 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 19:09:43 -0000 Author: davidcs Date: Thu Aug 24 19:09:42 2017 New Revision: 322852 URL: https://svnweb.freebsd.org/changeset/base/322852 Log: Fix qlnx_tso_check() so that every window of (ETH_TX_LSO_WINDOW_BDS_NUM - nbds_in_hdr) has atleast ETH_TX_LSO_WINDOW_MIN_LEN bytes MFC after:5 days Modified: head/sys/dev/qlnx/qlnxe/qlnx_os.c Modified: head/sys/dev/qlnx/qlnxe/qlnx_os.c ============================================================================== --- head/sys/dev/qlnx/qlnxe/qlnx_os.c Thu Aug 24 18:51:55 2017 (r322851) +++ head/sys/dev/qlnx/qlnxe/qlnx_os.c Thu Aug 24 19:09:42 2017 (r322852) @@ -2921,25 +2921,35 @@ qlnx_tso_check(struct qlnx_fastpath *fp, bus_dma_segme { int i; uint32_t sum, nbds_in_hdr = 1; - bus_dma_segment_t *t_segs = segs; + uint32_t window; + bus_dma_segment_t *s_seg; - /* count the number of segments spanned by TCP header */ + /* If the header spans mulitple segments, skip those segments */ + if (nsegs < ETH_TX_LSO_WINDOW_BDS_NUM) + return (0); + i = 0; - while ((i < nsegs) && (offset > t_segs->ds_len)) { - nbds_in_hdr++; - offset = offset - t_segs->ds_len; - t_segs++; + + while ((i < nsegs) && (offset >= segs->ds_len)) { + offset = offset - segs->ds_len; + segs++; i++; + nbds_in_hdr++; } - while (nsegs >= QLNX_MAX_SEGMENTS_NON_TSO) { + window = ETH_TX_LSO_WINDOW_BDS_NUM - nbds_in_hdr; + nsegs = nsegs - i; + + while (nsegs >= window) { + sum = 0; + s_seg = segs; - for (i = 0; i < (ETH_TX_LSO_WINDOW_BDS_NUM - nbds_in_hdr); i++){ - sum += segs->ds_len; - segs++; + for (i = 0; i < window; i++){ + sum += s_seg->ds_len; + s_seg++; } if (sum < ETH_TX_LSO_WINDOW_MIN_LEN) { @@ -2947,7 +2957,8 @@ qlnx_tso_check(struct qlnx_fastpath *fp, bus_dma_segme return (-1); } - nsegs -= QLNX_MAX_SEGMENTS_NON_TSO; + nsegs = nsegs - 1; + segs++; } return (0);