On Fri, 11 May 2018 20:12:12 +0200 Jesper Dangaard Brouer <bro...@redhat.com> 
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

Reply via email to