From: Denis Kirjanov <kda@linux-powerpc.org>
To: Jesper Dangaard Brouer <brouer@redhat.com>
Cc: netdev@vger.kernel.org, jgross@suse.com,
ilias.apalodimas@linaro.org, wei.liu@kernel.org, paul@xen.org
Subject: Re: [PATCH net-next v4] xen networking: add basic XDP support for xen-netfront
Date: Wed, 18 Mar 2020 15:31:50 +0300 [thread overview]
Message-ID: <CAOJe8K3RA7_kAN=KjCp7FN6=qY-nf1uqmAcOicDzqVnm4REsMA@mail.gmail.com> (raw)
In-Reply-To: <20200316164435.27751dbf@carbon>
On 3/16/20, Jesper Dangaard Brouer <brouer@redhat.com> wrote:
> On Mon, 16 Mar 2020 16:09:36 +0300
> Denis Kirjanov <kda@linux-powerpc.org> wrote:
>
>> diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
>> index 482c6c8..c06ae57 100644
>> --- a/drivers/net/xen-netfront.c
>> +++ b/drivers/net/xen-netfront.c
> [...]
>> @@ -778,6 +790,52 @@ static int xennet_get_extras(struct netfront_queue
>> *queue,
>> return err;
>> }
>>
>> +u32 xennet_run_xdp(struct netfront_queue *queue, struct page *pdata,
>> + struct xen_netif_rx_response *rx, struct bpf_prog *prog,
>> + struct xdp_buff *xdp)
>> +{
>> + struct xdp_frame *xdpf;
>> + u32 len = rx->status;
>> + u32 act = XDP_PASS;
>> + int err;
>> +
>> + xdp->data_hard_start = page_address(pdata);
>> + xdp->data = xdp->data_hard_start + XDP_PACKET_HEADROOM;
>> + xdp_set_data_meta_invalid(xdp);
>> + xdp->data_end = xdp->data + len;
>> + xdp->rxq = &queue->xdp_rxq;
>> + xdp->handle = 0;
>> +
>> + act = bpf_prog_run_xdp(prog, xdp);
>> + switch (act) {
>> + case XDP_TX:
>> + xdpf = convert_to_xdp_frame(xdp);
>> + err = xennet_xdp_xmit(queue->info->netdev, 1,
>> + &xdpf, 0);
>
> Strange line wrap, I don't think this is needed, please fix.
>
>
>> + if (unlikely(err < 0))
>> + trace_xdp_exception(queue->info->netdev, prog, act);
>> + break;
>> + case XDP_REDIRECT:
>> + err = xdp_do_redirect(queue->info->netdev, xdp, prog);
>
> What is the frame size of the packet memory?
It's XEN_PAGE_SIZE (4k)
>
>
>> + if (unlikely(err))
>> + trace_xdp_exception(queue->info->netdev, prog, act);
>> + xdp_do_flush();
>> + break;
>> + case XDP_PASS:
>> + case XDP_DROP:
>> + break;
>> +
>> + case XDP_ABORTED:
>> + trace_xdp_exception(queue->info->netdev, prog, act);
>> + break;
>> +
>> + default:
>> + bpf_warn_invalid_xdp_action(act);
>> + }
>> +
>> + return act;
>> +}
>> +
>
> --
> Best regards,
> Jesper Dangaard Brouer
> MSc.CS, Principal Kernel Engineer at Red Hat
> LinkedIn: http://www.linkedin.com/in/brouer
>
>
next prev parent reply other threads:[~2020-03-18 12:31 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-16 13:09 [PATCH net-next v4] xen networking: add basic XDP support for xen-netfront Denis Kirjanov
2020-03-16 15:44 ` Jesper Dangaard Brouer
2020-03-18 12:31 ` Denis Kirjanov [this message]
2020-03-16 15:52 ` Jesper Dangaard Brouer
2020-03-18 12:30 ` Denis Kirjanov
2020-03-18 10:27 ` Paul Durrant
2020-03-18 11:16 ` Jürgen Groß
2020-03-18 12:50 ` Denis Kirjanov
2020-03-18 13:11 ` Jürgen Groß
2020-03-23 10:15 ` Denis Kirjanov
2020-03-23 10:27 ` Jürgen Groß
2020-03-23 10:49 ` Denis Kirjanov
2020-03-23 11:00 ` Jürgen Groß
2020-03-30 12:16 ` Denis Kirjanov
2020-03-30 12:55 ` Jürgen Groß
2020-03-30 13:09 ` Denis Kirjanov
2020-03-30 13:13 ` Jürgen Groß
2020-03-30 13:18 ` Denis Kirjanov
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='CAOJe8K3RA7_kAN=KjCp7FN6=qY-nf1uqmAcOicDzqVnm4REsMA@mail.gmail.com' \
--to=kda@linux-powerpc.org \
--cc=brouer@redhat.com \
--cc=ilias.apalodimas@linaro.org \
--cc=jgross@suse.com \
--cc=netdev@vger.kernel.org \
--cc=paul@xen.org \
--cc=wei.liu@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).