[dpdk-dev] [PATCH v2 1/3] net/af_xdp: allow bigger batch sizes
Loftus, Ciara
ciara.loftus at intel.com
Wed Mar 10 08:21:29 CET 2021
>
> On 3/9/2021 10:19 AM, Ciara Loftus wrote:
> > Prior to this commit, the maximum batch sizes for zero-copy and copy-
> mode
> > rx and copy-mode tx were set to 32. Apart from zero-copy tx, the user
> > could never rx/tx any more than 32 packets at a time and without
> inspecting
> > the code the user wouldn't be aware of this.
> >
> > This commit removes these upper limits placed on the user and instead
> > sets an internal batch size equal to the default ring size (2048). Batches
> > larger than this are still processed, however they are split into smaller
> > batches similar to how it's done in other drivers. This is necessary
> > because some arrays used during rx/tx need to be sized at compile-time.
> >
> > Allowing a larger batch size allows for fewer batches and thus larger bulk
> > operations, fewer ring accesses and fewer syscalls which should yield
> > improved performance.
> >
> > Signed-off-by: Ciara Loftus <ciara.loftus at intel.com>
> > ---
> > drivers/net/af_xdp/rte_eth_af_xdp.c | 67
> ++++++++++++++++++++++++-----
> > 1 file changed, 57 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c
> b/drivers/net/af_xdp/rte_eth_af_xdp.c
> > index 3957227bf0..be524e4784 100644
> > --- a/drivers/net/af_xdp/rte_eth_af_xdp.c
> > +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
> > @@ -66,8 +66,8 @@ RTE_LOG_REGISTER(af_xdp_logtype,
> pmd.net.af_xdp, NOTICE);
> > #define ETH_AF_XDP_DFLT_START_QUEUE_IDX 0
> > #define ETH_AF_XDP_DFLT_QUEUE_COUNT 1
> >
> > -#define ETH_AF_XDP_RX_BATCH_SIZE 32
> > -#define ETH_AF_XDP_TX_BATCH_SIZE 32
> > +#define ETH_AF_XDP_RX_BATCH_SIZE
> XSK_RING_CONS__DEFAULT_NUM_DESCS
> > +#define ETH_AF_XDP_TX_BATCH_SIZE
> XSK_RING_CONS__DEFAULT_NUM_DESCS
> >
>
> Just to double check, can there be a library version that these macros not
> defined, should it be checked?
There can't be a library version with AF_XDP support without these macros, as they've been around since the very beginning:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1cad078842396
We only build the PMD if xsk.h is available, and since these macros have been in the file since it has existed, we're safe.
More information about the dev
mailing list