From: James Huang <jamesclhuang@gmail.com>
To: netdev@vger.kernel.org
Subject: skb_segment() questions
Date: Thu, 5 Mar 2009 00:08:38 +0000 (UTC) [thread overview]
Message-ID: <loom.20090305T000003-18@post.gmane.org> (raw)
Hi all,
After spending hours trying to understand how GSO and GRO works in the
latest Linux kernel (net-next-2.6.git), I am still quite confused about
the implementation of skb_segment():
(1) Comments about the roles of some critical variables in the routine will
help. Among them, len, hsize, and offset are not as confusing and I figured
they have the following meanings:
len: amount of payload to "copy" into nskb
hsize: amount of payload to copy into nskb's head buffer
offset: offset (from L2 header) of skb's payload to start "copy" into nskb
However, the variable "pos" is quite ambiguous. The value of "pos" at the
beginning of each iteration of the do loop seems to depend on the current
fragment being processed. If current fragment is the head buffer of skb, pos
is set to offset(end of the head buffer). But if the current fragment is a
page entry in skb or a skb in the frag_list, then pos is set to offset
(beginning of the current fragment).
(2) What is the purpose of the following check?
` if (pos >= offset + len)
continue;
If the payload in the head buffer of skb has at least mss bytes, this
check will succeed and no payload in skb’s head buffer will be copy into nskb
through a call to skb_copy_from_linear_data_offset(). Something seems to be
wrong here.
(3) Variable "hsize" seems to have a new meaning within the following if
statement:
if (!hsize && i >= nfrags) {
:
:
hsize = skb_end_pointer(nskb) - nskb->head;
if (skb_cow_head(nskb, doffset + headroom)) {
kfree_skb(nskb);
goto err;
}
nskb->truesize += skb_end_pointer(nskb) - nskb->head -
hsize; :
:
}
If so, it will be better to use a different variable here.
(4) When will the if condition (if (pos < offset + len)) just before
skip_faglist become true? When the if condition is true, nskb will have a non-
null frag_list. How do we know that the output interface's driver will support
such a skb?
(5) There are some assumptions about the input skb. These assumptions are
asserted by BUG_ON() statements throughout the routine. It will help to list
those assumptions at the very beginning of skb_segment().
Thanks,
James Huang
next reply other threads:[~2009-03-05 0:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-05 0:08 James Huang [this message]
[not found] <f0ed9b110903041912v6fba381fm4da792d49b1cbb91@mail.gmail.com>
2009-03-29 2:07 ` skb_segment() questions Herbert Xu
2009-03-29 6:39 ` David Miller
2009-03-30 8:50 ` Mark McLoughlin
2009-03-30 20:57 ` David Miller
2009-04-20 11:12 ` Mark McLoughlin
2009-04-20 11:57 ` David Miller
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=loom.20090305T000003-18@post.gmane.org \
--to=jamesclhuang@gmail.com \
--cc=netdev@vger.kernel.org \
/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).