From owner-svn-src-head@FreeBSD.ORG Thu Jan 9 01:04:40 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EA20E2D6; Thu, 9 Jan 2014 01:04:40 +0000 (UTC) Received: from mail-gw1-out.broadcom.com (mail-gw1-out.broadcom.com [216.31.210.62]) by mx1.freebsd.org (Postfix) with ESMTP id B253B1450; Thu, 9 Jan 2014 01:04:40 +0000 (UTC) X-IronPort-AV: E=Sophos;i="4.95,627,1384329600"; d="scan'208";a="8477598" Received: from irvexchcas06.broadcom.com (HELO IRVEXCHCAS06.corp.ad.broadcom.com) ([10.9.208.53]) by mail-gw1-out.broadcom.com with ESMTP; 08 Jan 2014 17:16:24 -0800 Received: from IRVEXCHSMTP1.corp.ad.broadcom.com (10.9.207.51) by IRVEXCHCAS06.corp.ad.broadcom.com (10.9.208.53) with Microsoft SMTP Server (TLS) id 14.1.438.0; Wed, 8 Jan 2014 17:04:34 -0800 Received: from mail-irva-13.broadcom.com (10.10.10.20) by IRVEXCHSMTP1.corp.ad.broadcom.com (10.9.207.51) with Microsoft SMTP Server id 14.1.438.0; Wed, 8 Jan 2014 17:04:33 -0800 Received: from localhost (dhcp-10-12-137-51.irv.broadcom.com [10.12.137.51]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id 0A043246C4; Wed, 8 Jan 2014 17:04:31 -0800 (PST) Date: Wed, 8 Jan 2014 17:04:31 -0800 From: Eric Davis To: Gleb Smirnoff Subject: Re: svn commit: r260415 - head/sys/dev/bxe Message-ID: <20140109010430.GB8780@broadcom.com> References: <201401072226.s07MQKqh026817@svn.freebsd.org> <20140109002639.GL71033@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="FkmkrVfFsRoUs1wW" Content-Disposition: inline In-Reply-To: <20140109002639.GL71033@FreeBSD.org> User-Agent: Mutt/1.5.21 (2012-12-30) 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 Reply-To: Eric Davis 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 01:04:41 -0000 --FkmkrVfFsRoUs1wW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jan 09, 2014 at 04:26:39AM +0400, Gleb Smirnoff wrote: > Eric, >=20 > 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>=20 > E> Log: > E> defragment mbuf chains longer than hw segment limit before dropping > E> =20 > E> Approved by: davidch > E>=20 > E> Modified: > E> head/sys/dev/bxe/bxe.c > E> head/sys/dev/bxe/ecore_hsi.h > E>=20 > E> Modified: head/sys/dev/bxe/bxe.c > E> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > 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> =20 > E> -#define BXE_DRIVER_VERSION "1.78.76" > E> +#define BXE_DRIVER_VERSION "1.78.77" > E> =20 > 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> =20 > 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> =20 > E> - /* no sense trying to defrag again, just drop the frame */ > E> - rc =3D ENODEV; > E> + m0 =3D m_defrag(*m_head, M_DONTWAIT); >=20 > It is already more than a decade as M_DONTWAIT shouldn't be used. Generic > malloc(9) flag of M_NOWAIT should be used. >=20 > 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? I did not know that. The new bxe driver did leverage some code from the older one and this block is definitely a copy-paste-and-tweak. I'll be sure to update those defines and make sure only M_WAITOK and M_NOWAIT is used by the driver. FWIW, I see there are a couple other drivers under head/sys/dev that are still using M_DONTWAIT as well. - e > E> + if (m0 =3D=3D NULL) { > E> + fp->eth_q_stats.mbuf_defrag_failures++; > E> + /* Ugh, just drop the frame... :( */ > E> + rc =3D ENOBUFS; > E> + } else { > E> + /* defrag successful, try mapping again */ > E> + *m_head =3D m0; > E> + error =3D bus_dmamap_load_mbuf_sg(fp->tx_mbuf_tag, > E> + tx_buf->m_map, m0, > E> + segs, &nsegs, BUS_DMA_NOW= AIT); > 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 =3D error; > E> + } > E> + > E> + /* if the chain is still too long then drop it */ > E> + if (__predict_false(nsegs > 12)) { > E> + rc =3D ENODEV; > E> + } > E> + } > E> } >=20 > --=20 > Totus tuus, Glebius. --FkmkrVfFsRoUs1wW Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQEcBAEBAgAGBQJSzfWeAAoJEPUt8GDsVYPdxYIIAMcoGuF47LRPxLg03Ah2z6tD gXfKSOpRZsPBEZ53jzVFD9KSxJsA/+9QWT7WMrCVlClzfMFFVRv7eLvVstPC5vd1 vY1J7n1PqdqZVJPE5xf1sP4RhRRFROZrA3mRAG+Y4PnQF9dZIOmq+EVB4AzrajkH m/QBpTjl3TPwUq1dCRe4XxTJeVkx4k1edHLoUl6bgWBBxQe3zShTh5lFYu0mn+0t 01sjqTwxynWX9fkS8RCs9gXNLWSPss3KbC1pVDVEA6AyyYNd6ZHEXB72DlqjKLgU 15jExgxvXlH5l5EklcfxT5m+Eunh2VOlhdsE0+v2np+RSTNzaB0mMIGKBfM42ug= =0lVb -----END PGP SIGNATURE----- --FkmkrVfFsRoUs1wW--