Thank you for your explanation, David.

But pci_map_page should work fine if we have multiple contiguous pages
in one frag that are allocated using alloc_pages, ie:

 frag->page = alloc_pages(GFP_KERNEL, 2); // get 4 pages
 frag->page_offset = 0;
 frag->size = 4 * PAGE_SIZE;

 dma_addr = pci_map_page(frag->page, frag->page_offset, frag->size, ..);

The reason I asked this is that I saw the following code in forthdeth drvier:

#define NV_TX2_TSO_MAX_SHIFT) 14
/* add fragments to entries count */
for (i = 0; i < fragments; i++) {
   entries += (skb_shinfo(skb)->frags[i].size >> NV_TX2_TSO_MAX_SHIFT) +
                   ((skb_shinfo(skb)->frags[i].size &
(NV_TX2_TSO_MAX_SIZE-1)) ? 1 : 0);
}

This looks unnecessary if each frag is guaranteed not to span pages.

Ronghua

On 10/10/06, David Miller <[EMAIL PROTECTED]> wrote:
From: "Ronghua Zhang" <[EMAIL PROTECTED]>
Date: Tue, 10 Oct 2006 15:37:04 -0700

> >From the code of tcp_sendmsg, it seems to me that each frag is at most
> one page. Is it a guaranteed property or the driver should not assume
> it? Thanks

This assumption basically already exists everywhere since
all drivers that create DMA mappings of the frags call
pci_map_page().

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to