netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Copy data from one SKB to another
@ 2007-02-22 11:59 kristrev
  2007-02-24  9:37 ` kalash nainwal
  0 siblings, 1 reply; 4+ messages in thread
From: kristrev @ 2007-02-22 11:59 UTC (permalink / raw)
  To: netdev; +Cc: linux-net

Hello,

I am working on optimizing the TCP-code for a certain type of TCP-stream,
and to make one of my optimizations work I need to copy data from one SKB
(the data field of the skb) to another SKB (data field).

Currently I am using memcpy, and it does what it is supposed to, but I am
curious as to if there are any other (potentially faster/more efficient)
ways of doing it. I have checked out the skb_add_data (used when you can
copy data from the msg you are sending into the most recent skb added to
the queue), but from what I can understand it only copies from userspace
into kernelspace (whereas I need to copy kernel-kernel).

Does anyone have any hints, suggestions, solutions or something else they
think might help?

Thanks,
Kristian


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Copy data from one SKB to another
  2007-02-22 11:59 Copy data from one SKB to another kristrev
@ 2007-02-24  9:37 ` kalash nainwal
  2007-02-24 10:53   ` LDB
  0 siblings, 1 reply; 4+ messages in thread
From: kalash nainwal @ 2007-02-24  9:37 UTC (permalink / raw)
  To: kristrev@student.matnat.uio.no; +Cc: netdev, linux-net

On 2/22/07, kristrev@student.matnat.uio.no
<kristrev@student.matnat.uio.no> wrote:
> Hello,
>
> I am working on optimizing the TCP-code for a certain type of TCP-stream,
> and to make one of my optimizations work I need to copy data from one SKB
> (the data field of the skb) to another SKB (data field).
>
> Currently I am using memcpy, and it does what it is supposed to, but I am
> curious as to if there are any other (potentially faster/more efficient)
> ways of doing it. I have checked out the skb_add_data (used when you can
> copy data from the msg you are sending into the most recent skb added to
> the queue), but from what I can understand it only copies from userspace
> into kernelspace (whereas I need to copy kernel-kernel).
>
> Does anyone have any hints, suggestions, solutions or something else they
> think might help?
>
> Thanks,
> Kristian
>
> -

How about cloning? Is that an option?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Copy data from one SKB to another
  2007-02-24  9:37 ` kalash nainwal
@ 2007-02-24 10:53   ` LDB
  2007-02-24 11:32     ` Kristian Evensen
  0 siblings, 1 reply; 4+ messages in thread
From: LDB @ 2007-02-24 10:53 UTC (permalink / raw)
  To: kalash nainwal; +Cc: kristrev@student.matnat.uio.no, netdev, linux-net

kalash nainwal wrote:
> On 2/22/07, kristrev@student.matnat.uio.no
> <kristrev@student.matnat.uio.no> wrote:
>> Hello,
>>
>> I am working on optimizing the TCP-code for a certain type of TCP-stream,
>> and to make one of my optimizations work I need to copy data from one SKB
>> (the data field of the skb) to another SKB (data field).
>>
>> Currently I am using memcpy, and it does what it is supposed to, but I am
>> curious as to if there are any other (potentially faster/more efficient)
>> ways of doing it. I have checked out the skb_add_data (used when you can
>> copy data from the msg you are sending into the most recent skb added to
>> the queue), but from what I can understand it only copies from userspace
>> into kernelspace (whereas I need to copy kernel-kernel).
>>
>> Does anyone have any hints, suggestions, solutions or something else they
>> think might help?
>>
>> Thanks,
>> Kristian
>>
>> -
> 
> How about cloning? Is that an option?
> -
> To unsubscribe from this list: send the line "unsubscribe linux-net" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 

skb_clone is an option but you cannot modify any data - correct me if I am wrong.

The other options are pskb_copy and skb_copy used when modifications are
necessary - correct if I am wrong.

You just have to chose which is appropriate for your specific needs.

LDB

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Copy data from one SKB to another
  2007-02-24 10:53   ` LDB
@ 2007-02-24 11:32     ` Kristian Evensen
  0 siblings, 0 replies; 4+ messages in thread
From: Kristian Evensen @ 2007-02-24 11:32 UTC (permalink / raw)
  To: LDB; +Cc: kalash nainwal, kristrev@student.matnat.uio.no, netdev, linux-net

LDB wrote:
> kalash nainwal wrote:
>   
>> On 2/22/07, kristrev@student.matnat.uio.no
>> <kristrev@student.matnat.uio.no> wrote:
>>     
>>> Hello,
>>>
>>> I am working on optimizing the TCP-code for a certain type of TCP-stream,
>>> and to make one of my optimizations work I need to copy data from one SKB
>>> (the data field of the skb) to another SKB (data field).
>>>
>>> Currently I am using memcpy, and it does what it is supposed to, but I am
>>> curious as to if there are any other (potentially faster/more efficient)
>>> ways of doing it. I have checked out the skb_add_data (used when you can
>>> copy data from the msg you are sending into the most recent skb added to
>>> the queue), but from what I can understand it only copies from userspace
>>> into kernelspace (whereas I need to copy kernel-kernel).
>>>
>>> Does anyone have any hints, suggestions, solutions or something else they
>>> think might help?
>>>
>>> Thanks,
>>> Kristian
>>>
>>> -
>>>       
>> How about cloning? Is that an option?
>> -
>> To unsubscribe from this list: send the line "unsubscribe linux-net" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>>
>>     
>
> skb_clone is an option but you cannot modify any data - correct me if I am wrong.
>
> The other options are pskb_copy and skb_copy used when modifications are
> necessary - correct if I am wrong.
>
> You just have to chose which is appropriate for your specific needs.
>
> LDB
>   
Thank you very much for all your replies. I have spent the day today 
looking into the different clone/copy-functions for skb's, but I cant 
help feeling that they are a bit to advanced for what I want to do. All 
my code is going to do is to copy the skb->data field (the payload) from 
one skb to another (to perform some aggressive bundling, the potentially 
redundant data will be removed when ack occurs).

Since the data copied might be from the retransmission queue, the  
function I see might be useful is the skb_copy function to copy the 
packet that I copy the data from (if it is in the retransmission queue). 
This is also what led to my question about exactly how TCP treats 
acks/sends on the same socket.

My current implementation (using memcopy) copies the data, but some 
weird behaviour occurs (and after days of looking into it I havent found 
the cause). If a dupAck occurs, it rightly sends as many packets from 
the retrans-queue as it is supposed to (and allowed to) do but then 
eveything stops working. Even though the sequence number is correct, I 
only recieves more dupAcks. If someone has experienced similar behaviour 
when working with the TCP-code or have any ideas to what might be wrong, 
please let me know :)

Have a nice weekend!

Thanks,
Kristian

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-02-24 11:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-22 11:59 Copy data from one SKB to another kristrev
2007-02-24  9:37 ` kalash nainwal
2007-02-24 10:53   ` LDB
2007-02-24 11:32     ` Kristian Evensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).