From: Jason Wang <jasowang@redhat.com>
To: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: netdev@vger.kernel.org,
virtualization@lists.linux-foundation.org,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
Mat Martineau <mathew.j.martineau@linux.intel.com>
Subject: Re: [PATCH net-next v3] virtio-net: page_to_skb() use build_skb when there's sufficient tailroom
Date: Wed, 28 Apr 2021 09:21:58 +0800 [thread overview]
Message-ID: <2d6b1c0b-7a3f-dbf4-785a-9af3c6000f98@redhat.com> (raw)
In-Reply-To: <1619491565.7682261-1-xuanzhuo@linux.alibaba.com>
在 2021/4/27 上午10:46, Xuan Zhuo 写道:
> On Tue, 20 Apr 2021 10:41:03 +0800, Jason Wang <jasowang@redhat.com> wrote:
>>
>> Btw, since the patch modifies a critical path of virtio-net I suggest to
>> test the following cases:
>>
>> 1) netperf TCP stream
>> 2) netperf UDP with packet size from 64 to PAGE_SIZE
>> 3) XDP_PASS with 1)
>> 4) XDP_PASS with 2)
>> 5) XDP metadata with 1)
>> 6) XDP metadata with 2)
> I have completed the above test on the latest net-next branch. The tested script
> and xdp code are as follows. The kernel is with KCOV and everything is normal
> without exception.
>
> Thanks.
Looks good.
Thanks for the testing.
>
> ## test script:
> #!/usr/bin/env sh
>
>
> for s in $(seq 64 4096)
> do
> netperf -H 192.168.122.202 -t UDP_STREAM -- -m $s
> done
>
> for s in $(seq 64 4096)
> do
> netperf -H 192.168.122.202 -t TCP_STREAM -- -m $s
> done
>
> ## xdp pass:
>
> #define KBUILD_MODNAME "foo"
> #include <linux/bpf.h>
> #include <linux/in.h>
> #include <linux/if_ether.h>
> #include <linux/if_packet.h>
> #include <linux/if_vlan.h>
> #include <linux/ip.h>
> #include <linux/icmp.h>
>
> #define DEFAULT_TTL 64
> #define MAX_PCKT_SIZE 600
> #define ICMP_TOOBIG_SIZE 98
> #define ICMP_TOOBIG_PAYLOAD_SIZE 92
>
>
> #define SEC(NAME) __attribute__((section(NAME), used))
>
>
> SEC("xdp")
> int _xdp(struct xdp_md *xdp)
> {
> return XDP_PASS;
> }
>
> char _license[] SEC("license") = "GPL";
>
> ## xdp metadata:
>
> #define KBUILD_MODNAME "foo"
> #include <linux/bpf.h>
> #include <linux/in.h>
> #include <linux/if_ether.h>
> #include <linux/if_packet.h>
> #include <linux/if_vlan.h>
> #include <linux/ip.h>
> #include <linux/icmp.h>
>
> static long (*bpf_xdp_adjust_meta)(struct xdp_md *xdp_md, int delta) = (void *) 54;
>
>
> #define SEC(NAME) __attribute__((section(NAME), used))
>
> struct meta_info {
> __u32 mark;
> } __attribute__((aligned(4)));
>
> SEC("xdp_mark")
> int _xdp_mark(struct xdp_md *ctx)
> {
> struct meta_info *meta;
> void *data, *data_end;
> int ret;
>
> /* Reserve space in-front of data pointer for our meta info.
> * (Notice drivers not supporting data_meta will fail here!)
> */
> ret = bpf_xdp_adjust_meta(ctx, -(int)sizeof(*meta));
> if (ret < 0)
> return XDP_ABORTED;
>
> /* Notice: Kernel-side verifier requires that loading of
> * ctx->data MUST happen _after_ helper bpf_xdp_adjust_meta(),
> * as pkt-data pointers are invalidated. Helpers that require
> * this are determined/marked by bpf_helper_changes_pkt_data()
> */
> data = (void *)(unsigned long)ctx->data;
>
> /* Check data_meta have room for meta_info struct */
> meta = (void *)(unsigned long)ctx->data_meta;
> if ((void *)(meta + 1) > data)
> return XDP_ABORTED;
>
> meta->mark = 42;
>
> return XDP_PASS;
> }
>
>
> char _license[] SEC("license") = "GPL";
>
next parent reply other threads:[~2021-04-28 1:22 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1619491565.7682261-1-xuanzhuo@linux.alibaba.com>
2021-04-28 1:21 ` Jason Wang [this message]
[not found] <1618922142.0493622-1-xuanzhuo@linux.alibaba.com>
2021-04-21 3:26 ` [PATCH net-next v3] virtio-net: page_to_skb() use build_skb when there's sufficient tailroom Jason Wang
2021-04-16 9:16 Xuan Zhuo
2021-04-19 3:10 ` Jason Wang
2021-04-19 16:48 ` David Ahern
2021-04-20 2:49 ` Jason Wang
2021-04-19 23:29 ` Mat Martineau
2021-04-20 2:38 ` Jason Wang
2021-04-20 2:41 ` Jason Wang
2021-04-20 9:28 ` Eric Dumazet
2021-04-22 11:13 ` Ido Schimmel
[not found] ` <1619093551.9680612-1-xuanzhuo@linux.alibaba.com>
2021-04-22 12:55 ` Ido Schimmel
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=2d6b1c0b-7a3f-dbf4-785a-9af3c6000f98@redhat.com \
--to=jasowang@redhat.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=mathew.j.martineau@linux.intel.com \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=virtualization@lists.linux-foundation.org \
--cc=xuanzhuo@linux.alibaba.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).