Re: NIU driver unmap_page call
From: David Miller <davem@davemloft.net>
Date: 2009-06-01 10:11:04
From: Andy Fleming <redacted> Date: Fri, 29 May 2009 17:38:50 -0500
I'm trying to figure out what this code does:
if ((page->index + rp->rbr_block_size) - rcr_size == addr) {
*link = (struct page *) page->mapping;
np->ops->unmap_page(np->device, page->index,
PAGE_SIZE, DMA_FROM_DEVICE);
page->index = 0;
page->mapping = NULL;
rp->rbr_refill_pending++;
} else
get_page(page);
It's clear it's taking the opportunity to remove the page from the
hash table, and to unmap the page, but I'm not familiar enough with
this nic to understand what the if statement is looking for. My first
thought was that it was looking to see if this was the first buffer in
the page?It's looking to see if this is the LAST chunk in the page, not the first. rcr_size is the size of the sub-buffers within the page that the chip is carving out of the page. Since when we allocated the page initially this obtained on reference to the page, we increment for every chunk given out to an SKB except the last one.