mbox series

[v4,bpf-next,0/2] introduce xdp_init_buff/xdp_prepare_buff

Message ID cover.1608399672.git.lorenzo@kernel.org (mailing list archive)
Headers show
Series introduce xdp_init_buff/xdp_prepare_buff | expand

Message

Lorenzo Bianconi Dec. 19, 2020, 5:54 p.m. UTC
Introduce xdp_init_buff and xdp_prepare_buff utility routines to initialize
xdp_buff data structure and remove duplicated code in all XDP capable
drivers.

Changes since v3:
- use __always_inline instead of inline for xdp_init_buff/xdp_prepare_buff
- add 'const bool meta_valid' to xdp_prepare_buff signature to avoid
  overwriting data_meta with xdp_set_data_meta_invalid()
- introduce removed comment in bnxt driver

Changes since v2:
- precompute xdp->data as hard_start + headroom and save it in a local
  variable to reuse it for xdp->data_end and xdp->data_meta in
  xdp_prepare_buff()

Changes since v1:
- introduce xdp_prepare_buff utility routine

Lorenzo Bianconi (2):
  net: xdp: introduce xdp_init_buff utility routine
  net: xdp: introduce xdp_prepare_buff utility routine

Acked-by: Martin Habets <habetsm.xilinx@gmail.com>
Acked-by: Camelia Groza <camelia.groza@nxp.com>

 drivers/net/ethernet/amazon/ena/ena_netdev.c  | 10 ++++------
 drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c |  9 +++------
 .../net/ethernet/cavium/thunder/nicvf_main.c  | 12 ++++++------
 .../net/ethernet/freescale/dpaa/dpaa_eth.c    | 10 ++++------
 .../net/ethernet/freescale/dpaa2/dpaa2-eth.c  | 14 +++++---------
 drivers/net/ethernet/intel/i40e/i40e_txrx.c   | 18 +++++++++---------
 drivers/net/ethernet/intel/ice/ice_txrx.c     | 15 ++++++++-------
 drivers/net/ethernet/intel/igb/igb_main.c     | 18 +++++++++---------
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 19 +++++++++----------
 .../net/ethernet/intel/ixgbevf/ixgbevf_main.c | 19 +++++++++----------
 drivers/net/ethernet/marvell/mvneta.c         | 10 +++-------
 .../net/ethernet/marvell/mvpp2/mvpp2_main.c   | 14 +++++++-------
 drivers/net/ethernet/mellanox/mlx4/en_rx.c    |  9 +++------
 .../net/ethernet/mellanox/mlx5/core/en_rx.c   |  8 ++------
 .../ethernet/netronome/nfp/nfp_net_common.c   | 12 ++++++------
 drivers/net/ethernet/qlogic/qede/qede_fp.c    |  9 +++------
 drivers/net/ethernet/sfc/rx.c                 | 10 +++-------
 drivers/net/ethernet/socionext/netsec.c       |  9 +++------
 drivers/net/ethernet/ti/cpsw.c                | 18 ++++++------------
 drivers/net/ethernet/ti/cpsw_new.c            | 18 ++++++------------
 drivers/net/hyperv/netvsc_bpf.c               |  8 ++------
 drivers/net/tun.c                             | 12 ++++--------
 drivers/net/veth.c                            | 14 +++++---------
 drivers/net/virtio_net.c                      | 18 ++++++------------
 drivers/net/xen-netfront.c                    | 10 ++++------
 include/net/xdp.h                             | 19 +++++++++++++++++++
 net/bpf/test_run.c                            |  9 +++------
 net/core/dev.c                                | 18 ++++++++----------
 28 files changed, 159 insertions(+), 210 deletions(-)

Comments

Shay Agroskin Dec. 20, 2020, 8:18 a.m. UTC | #1
Lorenzo Bianconi <lorenzo@kernel.org> writes:

> Introduce xdp_init_buff and xdp_prepare_buff utility routines to 
> initialize
> xdp_buff data structure and remove duplicated code in all XDP 
> capable
> drivers.
>
> Changes since v3:
> - use __always_inline instead of inline for 
> xdp_init_buff/xdp_prepare_buff
> - add 'const bool meta_valid' to xdp_prepare_buff signature to 
> avoid
>   overwriting data_meta with xdp_set_data_meta_invalid()
> - introduce removed comment in bnxt driver
>
> Changes since v2:
> - precompute xdp->data as hard_start + headroom and save it in a 
> local
>   variable to reuse it for xdp->data_end and xdp->data_meta in
>   xdp_prepare_buff()
>
> Changes since v1:
> - introduce xdp_prepare_buff utility routine
>
> Lorenzo Bianconi (2):
>   net: xdp: introduce xdp_init_buff utility routine
>   net: xdp: introduce xdp_prepare_buff utility routine
>
> Acked-by: Martin Habets <habetsm.xilinx@gmail.com>
> Acked-by: Camelia Groza <camelia.groza@nxp.com>
>
>  drivers/net/ethernet/amazon/ena/ena_netdev.c  | 10 ++++------

For changes in ena driver

Acked-by: Shay Agroskin <shayagr@amazon.com>

Also, wouldn't xdp_init_buff() change once the xdp_mb series is 
merged to take care of xdp.mb = 0 part ?
Maybe this series should wait until the other one is merged ?

>  drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c |  9 +++------
>  .../net/ethernet/cavium/thunder/nicvf_main.c  | 12 ++++++------
>  .../net/ethernet/freescale/dpaa/dpaa_eth.c    | 10 ++++------
>  .../net/ethernet/freescale/dpaa2/dpaa2-eth.c  | 14 
>  +++++---------
>  drivers/net/ethernet/intel/i40e/i40e_txrx.c   | 18 
>  +++++++++---------
>  drivers/net/ethernet/intel/ice/ice_txrx.c     | 15 
>  ++++++++-------
>  drivers/net/ethernet/intel/igb/igb_main.c     | 18 
>  +++++++++---------
>  drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 19 
>  +++++++++----------
>  .../net/ethernet/intel/ixgbevf/ixgbevf_main.c | 19 
>  +++++++++----------
>  drivers/net/ethernet/marvell/mvneta.c         | 10 +++-------
>  .../net/ethernet/marvell/mvpp2/mvpp2_main.c   | 14 
>  +++++++-------
>  drivers/net/ethernet/mellanox/mlx4/en_rx.c    |  9 +++------
>  .../net/ethernet/mellanox/mlx5/core/en_rx.c   |  8 ++------
>  .../ethernet/netronome/nfp/nfp_net_common.c   | 12 ++++++------
>  drivers/net/ethernet/qlogic/qede/qede_fp.c    |  9 +++------
>  drivers/net/ethernet/sfc/rx.c                 | 10 +++-------
>  drivers/net/ethernet/socionext/netsec.c       |  9 +++------
>  drivers/net/ethernet/ti/cpsw.c                | 18 
>  ++++++------------
>  drivers/net/ethernet/ti/cpsw_new.c            | 18 
>  ++++++------------
>  drivers/net/hyperv/netvsc_bpf.c               |  8 ++------
>  drivers/net/tun.c                             | 12 ++++--------
>  drivers/net/veth.c                            | 14 
>  +++++---------
>  drivers/net/virtio_net.c                      | 18 
>  ++++++------------
>  drivers/net/xen-netfront.c                    | 10 ++++------
>  include/net/xdp.h                             | 19 
>  +++++++++++++++++++
>  net/bpf/test_run.c                            |  9 +++------
>  net/core/dev.c                                | 18 
>  ++++++++----------
>  28 files changed, 159 insertions(+), 210 deletions(-)
Lorenzo Bianconi Dec. 20, 2020, 9:45 a.m. UTC | #2
>
>
> Lorenzo Bianconi <lorenzo@kernel.org> writes:
>
> > Introduce xdp_init_buff and xdp_prepare_buff utility routines to
> > initialize
> > xdp_buff data structure and remove duplicated code in all XDP
> > capable
> > drivers.
> >
> > Changes since v3:
> > - use __always_inline instead of inline for
> > xdp_init_buff/xdp_prepare_buff
> > - add 'const bool meta_valid' to xdp_prepare_buff signature to
> > avoid
> >   overwriting data_meta with xdp_set_data_meta_invalid()
> > - introduce removed comment in bnxt driver
> >
> > Changes since v2:
> > - precompute xdp->data as hard_start + headroom and save it in a
> > local
> >   variable to reuse it for xdp->data_end and xdp->data_meta in
> >   xdp_prepare_buff()
> >
> > Changes since v1:
> > - introduce xdp_prepare_buff utility routine
> >
> > Lorenzo Bianconi (2):
> >   net: xdp: introduce xdp_init_buff utility routine
> >   net: xdp: introduce xdp_prepare_buff utility routine
> >
> > Acked-by: Martin Habets <habetsm.xilinx@gmail.com>
> > Acked-by: Camelia Groza <camelia.groza@nxp.com>
> >
> >  drivers/net/ethernet/amazon/ena/ena_netdev.c  | 10 ++++------
>
> For changes in ena driver
>
> Acked-by: Shay Agroskin <shayagr@amazon.com>
>
> Also, wouldn't xdp_init_buff() change once the xdp_mb series is
> merged to take care of xdp.mb = 0 part ?
> Maybe this series should wait until the other one is merged ?
>

When this series is merged, I will rebase xdp multi-buff one on top of
it and I will initialize xdp.mb = 0 in xdp_init_buff() without
changing each driver.

Regards,
Lorenzo

> >  drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c |  9 +++------
> >  .../net/ethernet/cavium/thunder/nicvf_main.c  | 12 ++++++------
> >  .../net/ethernet/freescale/dpaa/dpaa_eth.c    | 10 ++++------
> >  .../net/ethernet/freescale/dpaa2/dpaa2-eth.c  | 14
> >  +++++---------
> >  drivers/net/ethernet/intel/i40e/i40e_txrx.c   | 18
> >  +++++++++---------
> >  drivers/net/ethernet/intel/ice/ice_txrx.c     | 15
> >  ++++++++-------
> >  drivers/net/ethernet/intel/igb/igb_main.c     | 18
> >  +++++++++---------
> >  drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 19
> >  +++++++++----------
> >  .../net/ethernet/intel/ixgbevf/ixgbevf_main.c | 19
> >  +++++++++----------
> >  drivers/net/ethernet/marvell/mvneta.c         | 10 +++-------
> >  .../net/ethernet/marvell/mvpp2/mvpp2_main.c   | 14
> >  +++++++-------
> >  drivers/net/ethernet/mellanox/mlx4/en_rx.c    |  9 +++------
> >  .../net/ethernet/mellanox/mlx5/core/en_rx.c   |  8 ++------
> >  .../ethernet/netronome/nfp/nfp_net_common.c   | 12 ++++++------
> >  drivers/net/ethernet/qlogic/qede/qede_fp.c    |  9 +++------
> >  drivers/net/ethernet/sfc/rx.c                 | 10 +++-------
> >  drivers/net/ethernet/socionext/netsec.c       |  9 +++------
> >  drivers/net/ethernet/ti/cpsw.c                | 18
> >  ++++++------------
> >  drivers/net/ethernet/ti/cpsw_new.c            | 18
> >  ++++++------------
> >  drivers/net/hyperv/netvsc_bpf.c               |  8 ++------
> >  drivers/net/tun.c                             | 12 ++++--------
> >  drivers/net/veth.c                            | 14
> >  +++++---------
> >  drivers/net/virtio_net.c                      | 18
> >  ++++++------------
> >  drivers/net/xen-netfront.c                    | 10 ++++------
> >  include/net/xdp.h                             | 19
> >  +++++++++++++++++++
> >  net/bpf/test_run.c                            |  9 +++------
> >  net/core/dev.c                                | 18
> >  ++++++++----------
> >  28 files changed, 159 insertions(+), 210 deletions(-)
>