Hi Syed,<div><br></div><div> Thanks for the response, in order to check whether the data is in page</div><div>or not, i tried printing the whole page data, i found that it is present in the page,</div><div>so i calculate the offset at which the data is present by using</div>
<div><b>(unsigned long) skb->data - (unsigned long) page_address(page)</b></div><div>seem like it working but my question is will it work in all case.</div><div><br></div><div>So am using the following code</div><div><br>
</div><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><b>.</b></div><div style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">
<b>.</b></div><div style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><b>struct page *page = virt_to_page(skb->data);</b></div><div style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">
<b>int offset = </b><b><span class="Apple-style-span" style="border-collapse: separate; font-family: arial; font-weight: normal; font-size: small; "><b>(unsigned long) skb->data - (unsigned long) page_address(page);</b></span></b></div>
<div style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><b>skb_add_rx_frag(master_skb, skb_shinfo(master_skb)->nr_frags, page, offset, skb->len)</b></div><div style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">
<b>.</b></div><div style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><b>.</b></div><div style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><b><br></b></div>
<div style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">is this the right way to do ?</div><div style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">i want to understand how the memory handling are happening in kernel,</div>
<div style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">can some one point me to right material.</div><div><br></div><div>Thank you,</div><div><br></div><div><br></div><br><div class="gmail_quote">
On Wed, Mar 30, 2011 at 1:10 AM, sk.syed2 <span dir="ltr"><<a href="mailto:sk.syed2@gmail.com">sk.syed2@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">> .<br>
> struct page *page = virt_to_page(skb->data);<br>
</div>If skb->data page aligned?<br>
<div class="im"><br>
> .<br>
> And can some one please tell what is the use of the functions like<br>
> virt_to_page and kmap_atomic_to_page,<br>
</div>Generally to lock the page in memory(esp while doing dma) using get_page().<br>
<div class="im"><br>
> i tried calling virt_to_page(skb->data), but when i print the data in the<br>
> page address ( page_address(page) ) and<br>
> the data in pointed by skb->data, i came to know its mapping to a wrong<br>
> page.<br>
</div> If skb->data is not page aligned then page_address(page) will be<br>
equal to skb->data+(somevalue) (on nearest page boundary).<br>
<br>
<br>
-syed<br>
</blockquote></div><br></div>