svn commit: r291699 - in head/sys: modules/mlxen ofed/drivers/net/mlx4

Ian Lepore ian at freebsd.org
Thu Dec 3 15:49:16 UTC 2015


On Thu, 2015-12-03 at 14:56 +0000, Hans Petter Selasky wrote:
> Author: hselasky
> Date: Thu Dec  3 14:56:17 2015
> New Revision: 291699
> URL: https://svnweb.freebsd.org/changeset/base/291699
> 
> Log:
>   Convert the mlxen driver to use the BUSDMA(9) APIs instead of
>   vtophys() when loading mbufs for transmission and reception. While
> at
>   it all pointer arithmetic and cast qualifier issues were fixed,
> mostly
>   related to transmission and reception.
>   
>   MFC after:	1 week
>   Sponsored by:	Mellanox Technologies
>   Differential Revision:	https://reviews.freebsd.org/D4284
> 
> Modified:
>   head/sys/modules/mlxen/Makefile
>   head/sys/ofed/drivers/net/mlx4/en_netdev.c
>   head/sys/ofed/drivers/net/mlx4/en_rx.c
>   head/sys/ofed/drivers/net/mlx4/en_tx.c
>   head/sys/ofed/drivers/net/mlx4/mlx4_en.h
> 
> [...]
> +		/* load spare mbuf into BUSDMA */
> +		err = -bus_dmamap_load_mbuf_sg(ring->dma_tag, ring
> ->spare.dma_map,
> +		    mb, segs, &nsegs, BUS_DMA_NOWAIT);
> +		if (unlikely(err != 0)) {
> +			m_freem(mb);
> +			return (err);
> +		}
> +		KASSERT(nsegs == 1,
> +		    ("Number of segments is expected to be one"));
> +

This KASSERT() (and others like it following map loads) could never
fire, because the dma tag is created with maxsegs 1.  If the buffer
can't be mapped as a single segment the map load would return EFBIG
error.

-- Ian



More information about the svn-src-head mailing list