[Openib-windows] [PATCH] MT23108: Fix large buffer memoryregistration

Leonid Keller leonid at mellanox.co.il
Thu May 11 09:17:00 PDT 2006


Looks like right now. The question is whether this helps.
Guy, could you check it ?
TIA 

> -----Original Message-----
> From: ftillier.sst at gmail.com [mailto:ftillier.sst at gmail.com] 
> On Behalf Of Fabian Tillier
> Sent: Thursday, May 11, 2006 6:35 PM
> To: Leonid Keller
> Cc: Guy Corem; openib-windows at openib.org
> Subject: Re: [Openib-windows] [PATCH] MT23108: Fix large 
> buffer memoryregistration
> 
> On 5/11/06, Fabian Tillier <ftillier at silverstorm.com> wrote:
> > On 5/11/06, Leonid Keller <leonid at mellanox.co.il> wrote:
> > > I think, seg_size is worth to round also (for little buffers):
> > >        rdc += ...
> > >        seg_size = rdc;
> >
> > Yes, you're right.
> 
> Ok, here's yet another patch, hopefully this time correct.
> 
> Index: hw/mt23108/vapi/mlxsys/mosal/os_dep/win/mosal_iobuf.c
> ===================================================================
> --- hw/mt23108/vapi/mlxsys/mosal/os_dep/win/mosal_iobuf.c	
> (revision 337)
> +++ hw/mt23108/vapi/mlxsys/mosal/os_dep/win/mosal_iobuf.c	
> (working copy)
> @@ -267,10 +267,10 @@
>  {
>    call_result_t rc;
>    MOSAL_iobuf_t new_iobuf;	// new allocated IOBUF object
> -  MT_virt_addr_t seg_va = va;	// current segment start
> -  MT_size_t seg_size = size;	// current segment size
> -  MT_size_t rdc = size;			// remain data 
> counter - what is rest to lock
> -  MT_size_t delta;				// he size of 
> the last not full page of the first segment
> +  MT_virt_addr_t seg_va;	// current segment start
> +  MT_size_t seg_size;		// current segment size
> +  MT_size_t rdc;			// remain data counter 
> - what is rest to lock
> +  MT_size_t delta;			// he size of the last 
> not full page of the first segment
>    MOSAL_iobuf_seg_t iobuf_seg_p; 	// pointer to current 
> segment object
>    unsigned page_size;
> 
> @@ -297,6 +297,13 @@
>    MOSAL_dlist_init_head( &new_iobuf->seg_que );
>    new_iobuf->seg_num = 0;
> 
> +  // Round the seg_va down to a page boundary so that we 
> always get a 
> + seg_size  // that is an integral number of pages.
> +  delta = va & (PAGE_SIZE - 1);
> +  seg_va = va - delta;
> +  // Since we rounded down the seg_va, we need to round up 
> the rdc and size.
> +  seg_size = rdc = size + delta;
> +
>    // allocate segments
>    while (rdc > 0) {
>    	// map a segment
> 



More information about the ofw mailing list