Re: mapping address pointer to page structure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Syed,

      Thanks for the response, in order to check whether the data is in page
or not, i tried printing the whole page data, i found that it is present in the page,
so i calculate the offset at which the data is present by using
(unsigned long) skb->data - (unsigned long) page_address(page)
seem like it working but my question is will it work in all case.

So am using the following code

.
.
struct page *page = virt_to_page(skb->data);
int offset = (unsigned long) skb->data - (unsigned long) page_address(page);
skb_add_rx_frag(master_skb, skb_shinfo(master_skb)->nr_frags, page, offset, skb->len)
.
.

is this the right way to do ?
i want to understand how the memory handling are happening in kernel,
can some one point me to right material.

Thank you,



On Wed, Mar 30, 2011 at 1:10 AM, sk.syed2 <sk.syed2@xxxxxxxxx> wrote:
> .
> struct page *page = virt_to_page(skb->data);
If skb->data page aligned?

> .
> And can some one please tell what is the use of the functions like
> virt_to_page and kmap_atomic_to_page,
Generally to lock the page in memory(esp while doing dma) using get_page().

> i tried calling virt_to_page(skb->data), but when i print the data in the
> page address ( page_address(page) ) and
> the data in pointed by skb->data, i came to know its mapping to a wrong
> page.
 If skb->data is not page aligned then page_address(page) will be
equal to skb->data+(somevalue) (on nearest page boundary).


-syed

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux