From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jesper Dangaard Brouer Subject: Re: [bpf-next V2 PATCH 4/4] xdp: change ndo_xdp_xmit API to support bulking Date: Fri, 11 May 2018 23:10:58 +0200 Message-ID: <20180511231058.2bb517a3@redhat.com> References: <152606228984.30376.4434523160732739487.stgit@firesoul> <152606233283.30376.3367467095674418599.stgit@firesoul> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Christoph Hellwig , =?UTF-8?B?QmrDtnJuVMO2cGVs?= , Magnus Karlsson To: netdev@vger.kernel.org, Daniel Borkmann , Alexei Starovoitov , Jesper Dangaard Brouer Return-path: Received: from mx3-rdu2.redhat.com ([66.187.233.73]:59350 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750798AbeEKVLC (ORCPT ); Fri, 11 May 2018 17:11:02 -0400 In-Reply-To: <152606233283.30376.3367467095674418599.stgit@firesoul> Sender: netdev-owner@vger.kernel.org List-ID: On Fri, 11 May 2018 20:12:12 +0200 Jesper Dangaard Brouer wrote: > diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h > index 03ed492c4e14..debdb6286170 100644 > --- a/include/linux/netdevice.h > +++ b/include/linux/netdevice.h > @@ -1185,9 +1185,13 @@ struct dev_ifalias { > * This function is used to set or query state related to XDP on the > * netdevice and manage BPF offload. See definition of > * enum bpf_netdev_command for details. > - * int (*ndo_xdp_xmit)(struct net_device *dev, struct xdp_frame *xdp); > - * This function is used to submit a XDP packet for transmit on a > - * netdevice. > + * int (*ndo_xdp_xmit)(struct net_device *dev, int n, struct xdp_frame **xdp); > + * This function is used to submit @n XDP packets for transmit on a > + * netdevice. Returns number of frames successfully transmitted, frames > + * that got dropped are freed/returned via xdp_return_frame(). > + * Returns negative number, means general error invoking ndo, meaning > + * no frames were xmit'ed and core-caller will free all frames. > + * TODO: Consider add flag to allow sending flush operation. Another reason for adding a flag to ndo_xdp_xmit, is to allow calling it from other contexts. Like from AF_XDP TX code path, which in the sendmsg is not protected by NAPI. > * void (*ndo_xdp_flush)(struct net_device *dev); > * This function is used to inform the driver to flush a particular > * xdp tx queue. Must be called on same CPU as xdp_xmit. > @@ -1375,8 +1379,8 @@ struct net_device_ops { > int needed_headroom); > int (*ndo_bpf)(struct net_device *dev, > struct netdev_bpf *bpf); > - int (*ndo_xdp_xmit)(struct net_device *dev, > - struct xdp_frame *xdp); > + int (*ndo_xdp_xmit)(struct net_device *dev, int n, > + struct xdp_frame **xdp); > void (*ndo_xdp_flush)(struct net_device *dev); > }; -- Best regards, Jesper Dangaard Brouer MSc.CS, Principal Kernel Engineer at Red Hat LinkedIn: http://www.linkedin.com/in/brouer