From: Alexei Starovoitov <ast@fb.com>
To: David Miller <davem@davemloft.net>
Cc: <daniel@iogearbox.net>, <kafai@fb.com>, <netdev@vger.kernel.org>
Subject: Re: test_progs packed...
Date: Mon, 24 Apr 2017 16:16:49 -0700 [thread overview]
Message-ID: <ba98a264-e398-af62-fc65-b5f34317b016@fb.com> (raw)
In-Reply-To: <20170424.190601.2066346847263955701.davem@davemloft.net>
On 4/24/17 4:06 PM, David Miller wrote:
>
> Alexei, why the packed attribute usage in test_progs.c?
>
> There should be no reason for this and it results in the object(s)
> having odd addresses (and thus be unaligned) on sparc.
because in:
static struct {
struct ethhdr eth;
struct iphdr iph;
struct tcphdr tcp;
} __packed pkt_v4 = {
iph is 4 byte aligned and eth is 2-byte.
We can add 2 byte hole in front of eth, but it's ugly since clean:
bpf_prog_test_run(prog_fd, 100000, &pkt_v4, sizeof(pkt_v4),
would need to deal with this extra padding explicitly.
It's only a user space thing and not in critical path,
so inefficient loads shouldn't be a problem.
You're bringing a good point that bpf_prog_test_run_skb() on
the kernel side should probably do:
skb_reserve(skb, NET_SKB_PAD + NET_IP_ALIGN);
prev parent reply other threads:[~2017-04-24 23:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-24 23:06 test_progs packed David Miller
2017-04-24 23:16 ` Alexei Starovoitov [this message]
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=ba98a264-e398-af62-fc65-b5f34317b016@fb.com \
--to=ast@fb.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=kafai@fb.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