From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Nikita V. Shirokov" <tehnerd@tehnerd.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Jason Wang <jasowang@redhat.com>,
"David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org
Subject: Re: [PATCH bpf-next v3 07/11] bpf: make tun compatible w/ bpf_xdp_adjust_tail
Date: Wed, 18 Apr 2018 19:16:11 +0300 [thread overview]
Message-ID: <20180418191605-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20180418044223.17685-8-tehnerd@tehnerd.com>
On Tue, Apr 17, 2018 at 09:42:19PM -0700, Nikita V. Shirokov wrote:
> w/ bpf_xdp_adjust_tail helper xdp's data_end pointer could be changed as
> well (only "decrease" of pointer's location is going to be supported).
> changing of this pointer will change packet's size.
> for tun driver we need to adjust XDP_PASS handling by recalculating
> length of the packet if it was passed to the TCP/IP stack
> (in case if after xdp's prog run data_end pointer was adjusted)
>
> Reviewed-by: Jason Wang <jasowang@redhat.com>
> Signed-off-by: Nikita V. Shirokov <tehnerd@tehnerd.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> drivers/net/tun.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index 1e58be152d5c..901351a6ed21 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -1696,6 +1696,7 @@ static struct sk_buff *tun_build_skb(struct tun_struct *tun,
> return NULL;
> case XDP_PASS:
> delta = orig_data - xdp.data;
> + len = xdp.data_end - xdp.data;
> break;
> default:
> bpf_warn_invalid_xdp_action(act);
> @@ -1716,7 +1717,7 @@ static struct sk_buff *tun_build_skb(struct tun_struct *tun,
> }
>
> skb_reserve(skb, pad - delta);
> - skb_put(skb, len + delta);
> + skb_put(skb, len);
> get_page(alloc_frag->page);
> alloc_frag->offset += buflen;
>
> --
> 2.15.1
next prev parent reply other threads:[~2018-04-18 16:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-18 4:42 [PATCH bpf-next v3 00/11] introduction of bpf_xdp_adjust_tail Nikita V. Shirokov
2018-04-18 4:42 ` [PATCH bpf-next v3 01/11] bpf: adding bpf_xdp_adjust_tail helper Nikita V. Shirokov
2018-04-18 17:01 ` Alexei Starovoitov
2018-04-18 4:42 ` [PATCH bpf-next v3 02/11] bpf: make generic xdp compatible w/ bpf_xdp_adjust_tail Nikita V. Shirokov
2018-04-18 4:42 ` [PATCH bpf-next v3 03/11] bpf: make mlx4 " Nikita V. Shirokov
2018-04-18 4:42 ` [PATCH bpf-next v3 04/11] bpf: make bnxt " Nikita V. Shirokov
2018-04-18 17:39 ` Michael Chan
2018-04-18 4:42 ` [PATCH bpf-next v3 05/11] bpf: make cavium thunder " Nikita V. Shirokov
2018-04-18 4:42 ` [PATCH bpf-next v3 06/11] bpf: make netronome nfp " Nikita V. Shirokov
2018-04-18 4:42 ` [PATCH bpf-next v3 07/11] bpf: make tun " Nikita V. Shirokov
2018-04-18 16:16 ` Michael S. Tsirkin [this message]
2018-04-18 4:42 ` [PATCH bpf-next v3 08/11] bpf: make virtio " Nikita V. Shirokov
2018-04-18 4:42 ` [PATCH bpf-next v3 09/11] bpf: making bpf_prog_test run aware of possible data_end ptr change Nikita V. Shirokov
2018-04-18 4:42 ` [PATCH bpf-next v3 10/11] bpf: adding tests for bpf_xdp_adjust_tail Nikita V. Shirokov
2018-04-18 4:42 ` [PATCH bpf-next v3 11/11] bpf: add bpf_xdp_adjust_tail sample prog Nikita V. Shirokov
2018-04-18 22:05 ` [PATCH bpf-next v3 00/11] introduction of bpf_xdp_adjust_tail Daniel Borkmann
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=20180418191605-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=jasowang@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=tehnerd@tehnerd.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).