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

Yuri Pankov yuri.pankov at gmail.com
Sat Feb 5 08:54:16 PST 2011


On Sat, Feb 05, 2011 at 07:34:56AM -0800, Garrett D'Amore wrote:
> 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

Thanks Garrett.

I just wasn't able to find any driver in tree using sgllen = -1 (that
was just some grepping though) and I don't really see how allocation
could succeed given the codepath. Could you please provide some examples
of drivers using sgllen = -1? Sorry if I'm missing something obvious
here, have much to learn yet..


TIA,
Yuri



More information about the Developer mailing list