From owner-svn-src-head@FreeBSD.ORG Thu Jan 9 00:26:42 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 72F10714; Thu, 9 Jan 2014 00:26:42 +0000 (UTC) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D325B1169; Thu, 9 Jan 2014 00:26:41 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.7/8.14.7) with ESMTP id s090Qd9j089400 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 9 Jan 2014 04:26:39 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.7/8.14.7/Submit) id s090Qdcv089399; Thu, 9 Jan 2014 04:26:39 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Thu, 9 Jan 2014 04:26:39 +0400 From: Gleb Smirnoff To: Eric Davis Subject: Re: svn commit: r260415 - head/sys/dev/bxe Message-ID: <20140109002639.GL71033@FreeBSD.org> References: <201401072226.s07MQKqh026817@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201401072226.s07MQKqh026817@svn.freebsd.org> User-Agent: Mutt/1.5.22 (2013-10-16) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Jan 2014 00:26:42 -0000 Eric, On Tue, Jan 07, 2014 at 10:26:20PM +0000, Eric Davis wrote: E> Author: edavis E> Date: Tue Jan 7 22:26:20 2014 E> New Revision: 260415 E> URL: http://svnweb.freebsd.org/changeset/base/260415 E> E> Log: E> defragment mbuf chains longer than hw segment limit before dropping E> E> Approved by: davidch E> E> Modified: E> head/sys/dev/bxe/bxe.c E> head/sys/dev/bxe/ecore_hsi.h E> E> Modified: head/sys/dev/bxe/bxe.c E> ============================================================================== E> --- head/sys/dev/bxe/bxe.c Tue Jan 7 21:25:18 2014 (r260414) E> +++ head/sys/dev/bxe/bxe.c Tue Jan 7 22:26:20 2014 (r260415) E> @@ -34,7 +34,7 @@ E> #include E> __FBSDID("$FreeBSD$"); E> E> -#define BXE_DRIVER_VERSION "1.78.76" E> +#define BXE_DRIVER_VERSION "1.78.77" E> E> #include "bxe.h" E> #include "ecore_sp.h" E> @@ -5501,10 +5501,31 @@ bxe_tx_encap(struct bxe_fastpath *fp, st E> fp->eth_q_stats.tx_window_violation_std++; E> } E> E> - /* XXX I don't like this, change to double copy packet */ E> + /* lets try to defragment this mbuf */ E> + fp->eth_q_stats.mbuf_defrag_attempts++; E> E> - /* no sense trying to defrag again, just drop the frame */ E> - rc = ENODEV; E> + m0 = m_defrag(*m_head, M_DONTWAIT); It is already more than a decade as M_DONTWAIT shouldn't be used. Generic malloc(9) flag of M_NOWAIT should be used. I wonder, why did you use it in new code? Is that just through habit, or do we still got somewhere outdated piece of documentation? E> + if (m0 == NULL) { E> + fp->eth_q_stats.mbuf_defrag_failures++; E> + /* Ugh, just drop the frame... :( */ E> + rc = ENOBUFS; E> + } else { E> + /* defrag successful, try mapping again */ E> + *m_head = m0; E> + error = bus_dmamap_load_mbuf_sg(fp->tx_mbuf_tag, E> + tx_buf->m_map, m0, E> + segs, &nsegs, BUS_DMA_NOWAIT); E> + if (error) { E> + fp->eth_q_stats.tx_dma_mapping_failure++; E> + /* No sense in trying to defrag/copy chain, drop it. :( */ E> + rc = error; E> + } E> + E> + /* if the chain is still too long then drop it */ E> + if (__predict_false(nsegs > 12)) { E> + rc = ENODEV; E> + } E> + } E> } -- Totus tuus, Glebius.