netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jesper Dangaard Brouer <brouer@redhat.com>
To: Edward Cree <ecree@solarflare.com>
Cc: Tom Herbert <tom@herbertland.com>,
	Linux Kernel Network Developers <netdev@vger.kernel.org>,
	Kernel Team <kernel-team@fb.com>,
	brouer@redhat.com
Subject: Re: [PATCH RFC v2 1/8] xdp: Infrastructure to generalize XDP
Date: Tue, 14 Feb 2017 23:29:35 +0100	[thread overview]
Message-ID: <20170214232935.34f9e6a1@redhat.com> (raw)
In-Reply-To: <6d605909-b049-9a8d-05a9-32b715c30527@solarflare.com>

On Tue, 14 Feb 2017 22:08:10 +0000
Edward Cree <ecree@solarflare.com> wrote:

> To me, the sensible interface (which makes the batching explicit to
>  the driver, which I think is necessary) is to have an int (or maybe
>  unsigned int, which is the return type of xdp_hookfn, I'm not sure
>  which is intended) member in struct xdp_buff.
>
> Then the driver can call something like
> 	XDP_RUN_ARRAY(napi, xdp_array, array_len);
> which is semantically equivalent to
> 	unsigned int i;
> 	for (i = 0; i < array_len; i++)
> 		xdp_array[i].ret = xdp_hook_run(napi, xdp_array + i);

Yes, exactly.

I imagined the xdp_array[i].ret would be the XDP action return code.

> except that it may run the hooks in 'row-major order'.
> No callbacks needed, the driver can just loop over xdp_array reading
>  the .ret and applying the relevant action to each packet.
> 
> This also has the advantage that the driver knows how many packets it
>  might have to process in a single batch (i.e. NAPI_POLL_WEIGHT) and
>  can allocate the array statically, whereas an XDP hook that tried to
>  transparently be 'helpful' would have to guess and/or use kmalloc.

I also think the driver need to be explicit about batching.

This related to the RX stages I'm talking about.  Saeed is working on
implementing that for mlx5, I got some PoC patches today and I'll soon
test that.

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer

  parent reply	other threads:[~2017-02-14 22:29 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-08 23:41 [PATCH RFC v2 0/8] xdp: Generalize XDP Tom Herbert
2017-02-08 23:41 ` [PATCH RFC v2 1/8] xdp: Infrastructure to generalize XDP Tom Herbert
2017-02-09  7:49   ` Jiri Pirko
2017-02-09 14:22   ` Mintz, Yuval
2017-02-09 22:17   ` David Miller
2017-02-09 22:26     ` Tom Herbert
2017-02-09 22:34       ` David Miller
2017-02-09 22:45         ` Tom Herbert
2017-02-10  1:42           ` David Miller
2017-02-10  2:29             ` Tom Herbert
2017-02-10  3:33               ` David Miller
2017-02-10  4:55                 ` Tom Herbert
2017-02-10 15:12                   ` David Miller
2017-02-09 23:08         ` Tom Herbert
2017-02-10  1:48           ` David Miller
2017-02-10  2:30             ` Tom Herbert
2017-02-10  5:42               ` Jason Wang
2017-02-13  2:41   ` [lkp-robot] [xdp] 543d41bf78: INFO:suspicious_RCU_usage kernel test robot
2017-02-14 20:31   ` [PATCH RFC v2 1/8] xdp: Infrastructure to generalize XDP Jesper Dangaard Brouer
2017-02-14 20:47     ` Tom Herbert
2017-02-14 21:07       ` Tom Herbert
2017-02-14 22:08         ` Edward Cree
2017-02-14 22:28           ` Tom Herbert
2017-02-14 22:29           ` Jesper Dangaard Brouer [this message]
2017-02-08 23:41 ` [PATCH RFC v2 2/8] mlx4: Changes to use generic XDP infrastructure Tom Herbert
2017-02-08 23:41 ` [PATCH RFC v2 3/8] nfp: " Tom Herbert
2017-02-08 23:41 ` [PATCH RFC v2 4/8] qede: " Tom Herbert
2017-02-08 23:41 ` [PATCH RFC v2 5/8] virt_net: " Tom Herbert
2017-02-08 23:41 ` [PATCH RFC v2 6/8] mlx5: " Tom Herbert
2017-02-08 23:41 ` [PATCH RFC v2 7/8] bnxt: " Tom Herbert
2017-02-08 23:41 ` [PATCH RFC v2 8/8] xdp: Cleanup after API changes Tom Herbert

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=20170214232935.34f9e6a1@redhat.com \
    --to=brouer@redhat.com \
    --cc=ecree@solarflare.com \
    --cc=kernel-team@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=tom@herbertland.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).