[Openib-windows] [PATCH] MT23108: Fix large buffer memoryregistration
Fabian Tillier
ftillier at silverstorm.com
Thu May 11 08:34:41 PDT 2006
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
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mt23108_iobuf.patch.v3
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20060511/6f9417de/attachment.ksh>
More information about the ofw
mailing list