netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Po-Yu Chuang <ratbert.chuang@gmail.com>
To: "Michał Mirosław" <mirqus@gmail.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	bhutchings@solarflare.com, eric.dumazet@gmail.com,
	joe@perches.com, dilinger@queued.net,
	Po-Yu Chuang <ratbert@faraday-tech.com>
Subject: Re: [PATCH v4] net: add Faraday FTMAC100 10/100 Ethernet driver
Date: Tue, 1 Feb 2011 11:56:16 +0800	[thread overview]
Message-ID: <AANLkTikgDsM15DO7u2SP15xx=Y_pg6JdCLrie8ACobJP@mail.gmail.com> (raw)
In-Reply-To: <AANLkTimz7gx7BAQG8RBswDCxnTuVtt3u+YoBZk8+RgEz@mail.gmail.com>

Dear Michał

2011/1/25 Po-Yu Chuang <ratbert.chuang@gmail.com>:
> 2011/1/25 Michał Mirosław <mirqus@gmail.com>:
>>
>> Ah, I blindly assumed that you're just appending the buffers to the
>> skb (using skb_fill_page_desc() and friends). Since you have to mark
>> descriptors for the device anyway, it might be faster to allocate new
>> skbs and map those as rx buffers (changing the descriptor's buffer
>> address after every RX) instead of keeping static buffer and copying
>> every time. (For small packets it wastes lot of memory, though - so
>> the right choice depends on the expected workload.)
>
> The reason I chose to use memcpy rx buffer to skb is that I didn't know
> how to deal with multi-segment packets if I preallocated skb for each
> rx descriptor. This function seems to be what I need.
> Let me rework this. Thanks.

After looking at some drivers using skb_fill_page_desc(), I am still
confused.

It seems that this function is mainly for jumbo packet and the
beginning of data of received packet should still be in skb->data.

Scheme 1)
If I simply allocate a page for each rx ring entry, I still need to allocate
an skb and copy at least packet header in first page to skb->data. Then
add the page of rest of payload to skb by skb_fill_page_desc().

Scheme 2)
If I simply allocate an skb for each rx ring entry, zero copy can be easily
achieved if the packet contains only one segment (one rx ring entry).
However, if the received packet has more than one segment, I guess I
might need to allocate a bigger skb and copy data of all segments
(skb->data) to the new skb?


The problem is, in most cases, the received packets are one-segment only.
(TBH, I don't know when will multi-segment packets appear.)

If all packets are one-segment, I can just allocate an skb for each rx ring
enry and achieve zero-copy. However, since there might be multi-segment
packets, I need to deal with them.

How can I do?

best regards,
Po-Yu Chuang

  reply	other threads:[~2011-02-01  3:56 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-13 11:49 [PATCH] net: add Faraday FTMAC100 10/100 Ethernet driver Po-Yu Chuang
2011-01-13 14:03 ` Ben Hutchings
2011-01-14  5:37   ` Po-Yu Chuang
2011-01-13 14:22 ` Eric Dumazet
2011-01-13 16:29   ` Andres Salomon
2011-01-14  6:44     ` Po-Yu Chuang
2011-01-14  6:56   ` Po-Yu Chuang
2011-01-13 15:39 ` Joe Perches
2011-01-14  6:35   ` Po-Yu Chuang
     [not found] ` <1294959948.4114.189.camel@Joe-Laptop>
2011-01-14  6:49   ` Po-Yu Chuang
2011-01-17  9:21 ` [PATCH v2] " Po-Yu Chuang
2011-01-17 17:19   ` Joe Perches
2011-01-19  9:40     ` Po-Yu Chuang
2011-01-19 12:46       ` Ben Hutchings
2011-01-19 16:41       ` Joe Perches
2011-01-20  5:30         ` Po-Yu Chuang
2011-01-20  8:46           ` Joe Perches
2011-01-17 17:29   ` Eric Dumazet
2011-01-17 18:58     ` Ben Hutchings
2011-01-17 20:39       ` Eric Dumazet
2011-01-17 18:21   ` Eric Dumazet
2011-01-18  3:08     ` Po-Yu Chuang
2011-01-19  9:20     ` Po-Yu Chuang
2011-01-20 15:30   ` [PATCH v3] " Po-Yu Chuang
2011-01-20 15:35     ` Eric Dumazet
2011-01-20 15:43       ` Po-Yu Chuang
2011-01-20 15:41     ` Eric Dumazet
2011-01-20 15:54       ` Po-Yu Chuang
2011-01-20 17:56     ` Joe Perches
2011-01-21  3:35       ` Po-Yu Chuang
2011-01-20 19:00     ` Joe Perches
2011-01-21  5:03       ` Po-Yu Chuang
     [not found]         ` <1295592411.6795.10.camel@Joe-Laptop>
2011-01-21  7:06           ` Po-Yu Chuang
2011-01-20 19:01     ` Michał Mirosław
2011-01-21  3:37       ` Po-Yu Chuang
2011-01-21  7:55     ` [PATCH v4] " Po-Yu Chuang
2011-01-21  9:08       ` Eric Dumazet
2011-01-24  8:07         ` Po-Yu Chuang
2011-01-21 12:26       ` Michał Mirosław
2011-01-24  8:26         ` Po-Yu Chuang
2011-01-24 20:22           ` Michał Mirosław
2011-01-25  2:46             ` Po-Yu Chuang
2011-02-01  3:56               ` Po-Yu Chuang [this message]
2011-02-01  4:35                 ` David Miller
2011-02-24  7:27                   ` Po-Yu Chuang
2011-02-24  7:51                     ` David Miller
2011-02-24  8:07                       ` Po-Yu Chuang
2011-02-24  8:22                         ` Eric Dumazet
2011-02-24  9:29                           ` [PATCH ref0] " Po-Yu Chuang
2011-02-24 17:39                             ` Eric Dumazet
2011-02-24 17:48                               ` Eric Dumazet
2011-02-25  2:32                                 ` Po-Yu Chuang
2011-02-25  9:45                                   ` Po-Yu Chuang
2011-02-25 10:52                                     ` Eric Dumazet
2011-02-25 18:34                                       ` David Miller
2011-02-25 18:45                                         ` Eric Dumazet
2011-02-25 18:47                                           ` Eric Dumazet
2011-03-01  5:45                                             ` Po-Yu Chuang
2011-03-01  5:53                                               ` Eric Dumazet
2011-02-25  9:57                             ` [PATCH v6] " Po-Yu Chuang
2011-02-25 11:40                               ` Eric Dumazet
2011-03-01  5:20                                 ` Po-Yu Chuang
2011-03-01  5:26                                   ` Eric Dumazet
2011-03-01  5:45                                   ` Eric Dumazet
2011-03-01  5:51                                     ` Po-Yu Chuang
2011-03-01  5:54                                       ` Eric Dumazet
2011-03-01  5:59                                       ` Eric Dumazet
2011-03-01  6:48                               ` [PATCH] " Po-Yu Chuang
2011-03-01  7:27                                 ` Eric Dumazet
2011-03-03 20:19                                   ` David Miller
2011-02-24 18:43                         ` [PATCH v4] " David Miller
2011-01-24 12:39       ` [PATCH v5] " Po-Yu Chuang
2011-01-24 15:07         ` Eric Dumazet
2011-01-25  2:46           ` Po-Yu Chuang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTikgDsM15DO7u2SP15xx=Y_pg6JdCLrie8ACobJP@mail.gmail.com' \
    --to=ratbert.chuang@gmail.com \
    --cc=bhutchings@solarflare.com \
    --cc=dilinger@queued.net \
    --cc=eric.dumazet@gmail.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mirqus@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=ratbert@faraday-tech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).