netdev
[Top] [All Lists]

Re: I need sk_buff frag_list info.

To: acmay@xxxxxxxxxxxxxxxx
Subject: Re: I need sk_buff frag_list info.
From: "Mark Wisner" <markwiz@xxxxxxxxxx>
Date: Mon, 18 Mar 2002 07:34:39 -0500
Cc: ak@xxxxxxx, netdev@xxxxxxxxxxx
Importance: Normal
Sender: owner-netdev@xxxxxxxxxxx
I'll try to be a little more clear on what I need to do.

The hardware has a size limit to a single buffer of 4K. It also has a
receive buffer size register. If I wanted to receive a 9K packet, JUMBO, I
could define a receive buffer size of 4k. If a packet came in that was 9K
It would fill three buffers. If a 64Byte packet came in, it would use 1 of
the 4K buffers.
We can determine how many buffers are being used by "first" & "last" bits
in the descriptor. The first 4K of the packet, Ethernet and IP header, will
be in the first buffer and the FCS will be in the last buffer.
 I know netif_rx() expects an SKB with all the data in one contiguous
buffer. I want to avoid the overhead of an additional memcpy() in the
device driver, just to put the packet into a contiguous buffer.
I would like to allocate receive SKBs  with a 4K buffer in each. If a
packet comes in that uses more than 1 SKB/buffer, I would like to link the
additional SKBs to the first one and send it up with netif_rx().

This is an extreme case but it also has applications when handling smaller
packets. For example, many embedded applications are memory constrained. If
an application developer knows most of the Ethernet traffic is less than
512 bytes, he/she would want to allocate 512 Byte buffers. If a larger than
512 byte packet comes in, it would be received over multiple buffers.

If it is correct , Linux will in reality only allocate buffers of multiples
of 2K, this may be inefficient and it could put Linux at a disadvantage
when competing against other embedded OSs.

Andi, what is "RTFS"?


Mark K. Wisner
Advisory Software Engineer
IBM Microelectronics
3039 Cornwallis Rd
RTP, NC 27709
Tel. 919-254-7191
Fax 919-543-7575


Andi Kleen <ak@xxxxxxx> on 03/15/2002 07:54:34 PM

To:   andrew may <acmay@xxxxxxxxxxxxxxxx>
cc:   Andi Kleen <ak@xxxxxxx>, Mark Wisner/Raleigh/IBM@IBMUS,
      netdev@xxxxxxxxxxx
Subject:  Re: I need sk_buff frag_list info.



On Fri, Mar 15, 2002 at 04:47:21PM -0800, andrew may wrote:
> So if you suggest to use ->frags should the skb->data be left alone?
> I can see no way off knowing ahead of time wether the ptr's giving to
> hardware for a rx will be used for the start of a packet.

The headers should be in skb->data if possible. If not the stack will do
some copying.
So you could put some arbitary first fragment (e.g. 128 bytes) there.

-Andi



<Prev in Thread] Current Thread [Next in Thread>