Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Jan 2014 17:04:31 -0800
From:      Eric Davis <edavis@FreeBSD.org>
To:        Gleb Smirnoff <glebius@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r260415 - head/sys/dev/bxe
Message-ID:  <20140109010430.GB8780@broadcom.com>
In-Reply-To: <20140109002639.GL71033@FreeBSD.org>
References:  <201401072226.s07MQKqh026817@svn.freebsd.org> <20140109002639.GL71033@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--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 <sys/cdefs.h>
> 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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140109010430.GB8780>