Regarding parsing of cifs header
Ramana Reddy
gtvrreddy at gmail.com
Mon May 26 12:09:50 EDT 2014
Thank you very much Pranay Srivastava. Will look at all your points and
revert back if I have any issues.
On Mon, May 26, 2014 at 8:36 PM, Pranay Srivastava <pranjas at gmail.com>wrote:
>
>
> On Monday, May 26, 2014, Ramana Reddy <gtvrreddy at gmail.com> wrote:
> > Hi Pranay Srivastava,
> >
> > Thanks for your reply. I just want to copy the payload into the buffer
> with out cloning
> > or copying of skb to reduce the delay as it has to do on every packet.
> > Is there any method in the linux kernel to get only the payload after
> stripping off the
> > TCP header.
>
> 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.
> 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.
>
> 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.
>
> 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.
>
> 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.
>
>
> >
> > Thanks,
> > Ramana.
> >
> >
> > On Mon, May 26, 2014 at 2:17 PM, Pranay Srivastava <pranjas at gmail.com>
> wrote:
> >>
> >> On Mon, May 26, 2014 at 1:20 PM, Ramana Reddy <gtvrreddy at gmail.com>
> wrote:
> >> > Thanks for your reply. First thing is that I do not want to modify the
> >> > existing cifs driver.
> >> > I have my own virtual Ethernet driver, where the skb buffer is
> available to
> >> > parse. Now,
> >> > I want to extract the cifs header from this skb buffer, and based on
> the
> >> > cifs header contents
> >> > ( mainly I am looking for return status), I have to redirect the
> packet to
> >> > different destination.
> >>
> >> skb_clone in case you won't modify the packet. (Data isn't copied here).
> >>
> >> skb_copy if you or the intended recipient would modify the skb.(Data
> >> is copied here). Gives you a free pass to do anything.
> >>
> >> For UDP packets I guess you'll also need to take off the UDP header
> >> (last time I tried to read from skb of a UDP) but for TCP you'll have
> >> your data ready no need
> >> to strip off the TCP header. Just check in case the skb you've
> >> contains fragments(For TCP connection) but since you only need CIFS
> >> header I don't think you'll have to bother about that, as CIFS header
> >> isn't that big.
> >>
> >> >
> >> > Thanks,
> >> > Ramana.
> >> >
> >> >
> >> > On Mon, May 26, 2014 at 12:34 PM, <Valdis.Kletnieks at vt.edu> wrote:
> >> >>
> >> >> On Mon, 26 May 2014 12:21:12 +0530, Ramana Reddy said:
> >> >>
> >> >> > I would like to know how to extract the cifs protocol header from
> skb
> >> >> > buffer in the linux
> >> >> > kernel. I want to parse the cifs header and do some stuff based on
> the
> >> >> > content of the header.
> >> >>
> >> >> Depending what you are trying to do, it may be best to add your code
> >> >> to the CIFS driver at the points where the driver is examining the
> >> >> header fields in question.
> >> >>
> >> >> What "do some stuff" are you trying to achieve?
> >> >
> >> >
> >> >
> >> > _______________________________________________
> >> > Kernelnewbies mailing list
> >> > Kernelnewbies at kernelnewbies.org
> >> > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> >> >
> >>
> >>
> >>
> >> --
> >> ---P.K.S
> >
> >
>
> --
> ---P.K.S
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140526/80c90e0a/attachment.html
More information about the Kernelnewbies
mailing list