<br><br>On Monday, May 26, 2014, Ramana Reddy <<a href="mailto:gtvrreddy@gmail.com">gtvrreddy@gmail.com</a>> wrote:<br>> Hi Pranay Srivastava,<br>><br>> Thanks for your reply. I just want to copy the payload into the buffer with out cloning<br>
> or copying of skb to reduce the delay as it has to do on every packet.<br>> Is there any method in the linux kernel to get only the payload after stripping off the<br>> TCP header. <br><br>try not to do this in driver. because you'll need to strip quite some headers before you see your data. without moving the skb pointers it's going to be more messy. so i guess skb_clone you'll need to use at least.<br>
you can see that in the listen sock's data_ready callback. iam just guessing it might be doing this would need to see code. but nfs does like that so iam betting cifs must also be.<br><br>see if its possible to hookup sk_data_ready for sock. The point where the actual sock is allocated in cifs probably must be having a sk_data_ready handler. would be better to call the cifs data ready handler from your wrapper that you can install for that sk.<br>
<br>that way you wont have to mess around any header logic in your driver. perhaps you can pass around that skb to a thread that can read from cifs header in parallel since i doubt if that payload is going to be modified by cifs.<br>
<br>if Thats the case then you just do skb_clone for your processing since you might need to move pointers or maybe cifs handler does so. skb copy if cifs changes payload. copying would be costly cloning wont be that much.<br>
<br>><br>> Thanks,<br>> Ramana.<br>><br>><br>> On Mon, May 26, 2014 at 2:17 PM, Pranay Srivastava <<a href="mailto:pranjas@gmail.com">pranjas@gmail.com</a>> wrote:<br>>><br>>> On Mon, May 26, 2014 at 1:20 PM, Ramana Reddy <<a href="mailto:gtvrreddy@gmail.com">gtvrreddy@gmail.com</a>> wrote:<br>
>> > Thanks for your reply. First thing is that I do not want to modify the<br>>> > existing cifs driver.<br>>> > I have my own virtual Ethernet driver, where the skb buffer is available to<br>>> > parse. Now,<br>
>> > I want to extract the cifs header from this skb buffer, and based on the<br>>> > cifs header contents<br>>> > ( mainly I am looking for return status), I have to redirect the packet to<br>>> > different destination.<br>
>><br>>> skb_clone in case you won't modify the packet. (Data isn't copied here).<br>>><br>>> skb_copy if you or the intended recipient would modify the skb.(Data<br>>> is copied here). Gives you a free pass to do anything.<br>
>><br>>> For UDP packets I guess you'll also need to take off the UDP header<br>>> (last time I tried to read from skb of a UDP) but for TCP you'll have<br>>> your data ready no need<br>>> to strip off the TCP header. Just check in case the skb you've<br>
>> contains fragments(For TCP connection) but since you only need CIFS<br>>> header I don't think you'll have to bother about that, as CIFS header<br>>> isn't that big.<br>>><br>>> ><br>
>> > Thanks,<br>>> > Ramana.<br>>> ><br>>> ><br>>> > On Mon, May 26, 2014 at 12:34 PM, <<a href="mailto:Valdis.Kletnieks@vt.edu">Valdis.Kletnieks@vt.edu</a>> wrote:<br>>> >><br>
>> >> On Mon, 26 May 2014 12:21:12 +0530, Ramana Reddy said:<br>>> >><br>>> >> > I would like to know how to extract the cifs protocol header from skb<br>>> >> > buffer in the linux<br>
>> >> > kernel. I want to parse the cifs header and do some stuff based on the<br>>> >> > content of the header.<br>>> >><br>>> >> Depending what you are trying to do, it may be best to add your code<br>
>> >> to the CIFS driver at the points where the driver is examining the<br>>> >> header fields in question.<br>>> >><br>>> >> What "do some stuff" are you trying to achieve?<br>
>> ><br>>> ><br>>> ><br>>> > _______________________________________________<br>>> > Kernelnewbies mailing list<br>>> > <a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
>> > <a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>>> ><br>>><br>>><br>>><br>>> --<br>
>> ---P.K.S<br>><br>><br><br>-- <br> ---P.K.S<br><br>