On Fri, May 03, 2019 at 03:22:59PM +0000, Saleem, Shiraz wrote: > >This is because mask shouldn't start as zero - the highest possible mask is > >something like log2_ru(umem length) > > > >ie absent other considerations the page size at the NIC should be the size of the > >umem. > > > >Then we scan the sgl and reduce that value based on the physical address > >layout > > > >Then we reduce it again based on the uvirt vs address difference > > > >Oring a '0' into the mask means that step contributes no restriction. > > > >.. > > > >So I think the algorithm is just off as is, it should be more like > > > > // Page size can't be larger than the length of the MR mask = log2_ru(umem > >length); > > > > // offset into the first SGL for umem->addr pgoff = umem->address & > >PAGE_MASK; va = uvirt_addr; > > > > Did you mean pgoff = umem->address & ~PAGE_MASK? Yes... But really even that is not what it should be, the 'pgoff' should simply be the 'offset' member of the first sgl and we should set it correctly based on the umem->address when building the sgl in the core code. Jason