All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
To: Denis Kirjanov <kirjanov@gmail.com>
Cc: Denis Kirjanov <kda@linux-powerpc.org>,
	netdev@vger.kernel.org, jgross@suse.com
Subject: Re: [PATCH net-next v2] xen-netfront: add basic XDP support
Date: Thu, 5 Mar 2020 15:31:14 +0200	[thread overview]
Message-ID: <20200305133114.GA574299@apalos.home> (raw)
In-Reply-To: <CAHj3AVndOjLsOkjC1h5WOb+NaswHaggC3MTaRq-r7mA6rGcCZw@mail.gmail.com>

On Thu, Mar 05, 2020 at 04:23:31PM +0300, Denis Kirjanov wrote:
> On 3/5/20, Ilias Apalodimas <ilias.apalodimas@linaro.org> wrote:
> > Hi Denis,
> >
> > There's a bunch of things still missing from my remarks on V1.
> > XDP is not supposed to allocate and free pages constantly as that's one of
> > the
> > things that's making it fast.
> 
> Hi Ilias,
> 
> I've removed the copying to an allocated page so there is no page
> allocation/free logic added.
> 
i
Yea that has been removed. I am not familiar with the driver though, so i'll
give you an example. 
Let's say the BPF program says the packet must be dropped. What will happen to
the page with the packet payload?
Ideally on XDP we want that page recycled back into the device descriptors, so
the driver won't have to allocate and map a fresh page.

> 
> >
> > You are also missing proper support for XDP_REDIRECT, ndo_xdp_xmit. We
> > usually
> > require the whole functionality to merge the driver.
> 
> I wanted to minimize changes and send follow-up patches
> 

Adding XDP_REDIRECT is pretty trivial and the ndo_xdp_xmit should be very
similar to XDP_TX. So assuming you'll fix XDP_TX adding the .ndo one will be
relatively small amount of code.

> >
> >
> > On Mon, Mar 02, 2020 at 05:21:14PM +0300, Denis Kirjanov wrote:
> >>
> > [...]
> >> +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)
> >> +{
> >> +	u32 len = rx->status;
> >> +	u32 act = XDP_PASS;
> >> +
> >> +	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->handle = 0;
> >> +
> >> +	act = bpf_prog_run_xdp(prog, xdp);
> >> +	switch (act) {
> >> +	case XDP_PASS:
> >> +	case XDP_TX:
> >> +	case XDP_DROP:
> >
> > Maybe i am missing something on the usage, but XDP_TX and XDROP are handled
> > similarly?
> > XDP_TX is supposed to sent the packet out of the interface it arrived.
> 
> Yep, you're right. I'll add it to the next version.
> 
> Thanks!
> 

Cheers
/Ilias

  reply	other threads:[~2020-03-05 13:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-02 14:21 [PATCH net-next v2] xen-netfront: add basic XDP support Denis Kirjanov
2020-03-02 15:29 ` Jürgen Groß
2020-03-02 19:31   ` David Miller
2020-03-04 13:10   ` Denis Kirjanov
2020-03-04 13:36     ` Jürgen Groß
2020-03-05  9:47       ` Denis Kirjanov
2020-03-05 10:33         ` Jürgen Groß
2020-03-06 18:22           ` Wei Liu
2020-03-05 13:04 ` Ilias Apalodimas
2020-03-05 13:23   ` Denis Kirjanov
2020-03-05 13:31     ` Ilias Apalodimas [this message]
2020-03-05 14:39       ` Jesper Dangaard Brouer
2020-03-05 14:04 ` Jesper Dangaard Brouer
2020-03-05 14:35 ` Jesper Dangaard Brouer
2020-03-06  9:48   ` 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=20200305133114.GA574299@apalos.home \
    --to=ilias.apalodimas@linaro.org \
    --cc=jgross@suse.com \
    --cc=kda@linux-powerpc.org \
    --cc=kirjanov@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.