[illumos-Developer] vmxnet3s driver failing on debug builds due to dma_attr_sgllen == -1 (Bug #422)

Garrett D'Amore garrett at nexenta.com
Sat Feb 5 07:34:56 PST 2011


On Sat, 2011-02-05 at 10:29 +0300, Yuri Pankov wrote:
> Hi,
> 
> While looking into the issue, I've found the following piece of code in
> usr/src/uts/i86pc/io/rootnex.c, called only in debug builds:
> 
> /*
>  * rootnex_valid_alloc_parms()
>  *    Called in ddi_dma_alloc_handle path to validate its parameters.
>  */
> static int
> rootnex_valid_alloc_parms(ddi_dma_attr_t *attr, uint_t maxsegmentsize)
> ...
>         if ((attr->dma_attr_seg & MMU_PAGEOFFSET) != MMU_PAGEOFFSET ||
>             MMU_PAGESIZE & (attr->dma_attr_granular - 1) ||
> ==>         attr->dma_attr_sgllen <= 0) {          <===
>                 return (DDI_DMA_BADATTR);
>         }
> ...
> 
> vmxnet3s driver uses dma_attr_sgllen == -1, which is pretty ok according
> to ddi_dma_attr(9S):
> ...
>      < 0    Device DMA engine is not constrained by the size, for
>             example, withDMA chaining.
> ...
> 
> Removing the check allows the driver to successfully start (and
> function, I haven't tested the 10Gbps speed due to the lack of hardware,
> but currently finishing 50GB transfer at 1Gbps speed). The check is
> there from the OpenSolaris launch, so the my real question is - what of
> the following sounds correct:
> - the check is bogus and should be removed (or changed to == 0, which is
>   reserved per manpage)
> or
> - documentation (ddi_dma_attr(9S), at least) should be updated and the
>   driver should be "fixed".
> 

I haven't looked yet, but lots of drivers have sgllen == -1.  That means
your driver can accept arbitrary chaining via linked lists.  I expect
there is something else going on here, and I'll look at more closely as
soon as I have time.

	- Garrett
> TIA,
> Yuri
> 
> _______________________________________________
> Developer mailing list
> Developer at lists.illumos.org
> http://lists.illumos.org/m/listinfo/developer





More information about the Developer mailing list