DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: "Loftus, Ciara" <ciara.loftus@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [RFC PATCH 10/14] net/intel: introduce infrastructure for Rx path selection
Date: Wed, 6 Aug 2025 11:36:11 +0100	[thread overview]
Message-ID: <aJMwG1wMe2DNByEn@bricha3-mobl1.ger.corp.intel.com> (raw)
In-Reply-To: <DM3PPF7D18F34A175CDB2701F500BBD0EF18E2DA@DM3PPF7D18F34A1.namprd11.prod.outlook.com>

On Wed, Aug 06, 2025 at 11:14:58AM +0100, Loftus, Ciara wrote:
> > 
> > On Fri, Jul 25, 2025 at 12:49:15PM +0000, Ciara Loftus wrote:
> > > The code for determining which Rx path to select during initialisation
> > > has become complicated in many intel drivers due to the amount of
> > > different paths and features available within each path. This commit
> > > aims to simplify and genericize the path selection logic.
> > >
> > > The following information about each Rx burst function is stored and
> > > used by the new common function to select the appropriate Rx path:
> > > - Rx Offloads
> > > - SIMD bitwidth
> > > - Flexible RXD usage
> > > - Bulk alloc function
> > > - Scattered function
> > >
> > > Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
> > > ---
> > 
> > This is a good idea to simplify things. Some comments inline below.
> > 
> > /Bruce
> > 
> > >  drivers/net/intel/common/rx.h | 110
> > ++++++++++++++++++++++++++++++++++
> > >  1 file changed, 110 insertions(+)
> > >
> > > diff --git a/drivers/net/intel/common/rx.h b/drivers/net/intel/common/rx.h
> > > index 70b597e8dc..6e9d81fecf 100644
> > > --- a/drivers/net/intel/common/rx.h
> > > +++ b/drivers/net/intel/common/rx.h
> > > @@ -10,6 +10,7 @@
> > >  #include <unistd.h>
> > >  #include <rte_mbuf.h>
> > >  #include <rte_ethdev.h>
> > > +#include <rte_vect.h>
> > >
> > >  #include "desc.h"
> > >
> > > @@ -20,6 +21,12 @@
> > >  #define CI_VPMD_DESCS_PER_LOOP_WIDE 8
> > >  #define CI_VPMD_RX_REARM_THRESH     64
> > >
> > > +#define CI_RX_BURST_NO_FEATURES		0
> > > +#define CI_RX_BURST_FEATURE_SCATTERED	RTE_BIT32(0)
> > > +#define CI_RX_BURST_FEATURE_FLEX	RTE_BIT32(1)
> > > +#define CI_RX_BURST_FEATURE_BULK_ALLOC	RTE_BIT32(2)
> > > +#define CI_RX_BURST_FEATURE_IS_DISABLED	RTE_BIT32(3)
> > > +
> > >  struct ci_rx_queue;
> > >
> > >  struct ci_rx_entry {
> > > @@ -125,6 +132,19 @@ struct ci_rx_queue {
> > >  	};
> > >  };
> > >
> > > +
> > > +struct ci_rx_burst_features {
> > > +	uint32_t rx_offloads;
> > > +	enum rte_vect_max_simd simd_width;
> > > +	uint32_t other_features_mask;
> > 
> > Rather than using a bitmask here and having to do bit ops, how about just
> > using individual boolean variables for each setting. Given that we only
> > have 4 settings right now (disabled, scattered, flex, and bulk-alloc), the
> > actual struct size here will be the same, but the code will be simpler.
> > Since this is not a datapath function, I'm not worried if the overall
> > struct size grows a bit over time.
> > 
> > I'd also note that in the structure below, we need an extra 4-bytes of
> > padding anyway, since the pointers require it to be 8-byte aligned, so we
> > can have up to 8 flags in the rx_burst_features struct without affecting
> > the size of the burst_info struct.
> 
> Thanks for the feedback on the series. No objections with the feedback on the other patches.
> 
> The choice to use a bitmask here wasn't for space-saving rather for readability in later patches when we define the ci_rx_burst_features for each path in each driver.
> For example, if a path just has the scattered feature, it's features can be defined like:
> {PATH_OFFLOADS, PATH_SIMD_WIDTH, CI_RX_BURST_FEATURE_SCATTERED}
> instead of the below if we were to split the mask into booleans:
> {PATH_OFFLOADS, PATH_SIMD_WIDTH, CI_RX_BURST_FEATURE_SCATTERED, 0, 0, 0}
> 
> Maybe it's not that much of an improvement in readability. And I suppose it introduces a little bit of extra complexity in the select() function when reading the values of the mask instead of reading simple booleans. So I'm happy to go the boolean route if you feel it's better.
> 

Hmm, good point. I suppose it doesn't matter much either way. In terms of
readability, if we do use bool values, we can omit any trailing zero values
at the end to shorten things. Alternatively, if using bool values, we may
switch to defining the structs using the ".name = value" syntax, again
omitting not-set values. [If you want, you can even make the boolean values
a separate struct, which means you can mix the two as:
{PATH_OFFLOADS, PATH_SIMD_WIDTH, { .scattered = true, .flex= true }}
though that may look a bit strange]

As I say, it doesn't really matter either way, so perhaps try implementing
with bool values and see what it looks like - then just decide which you
prefer. I'm happy to go along with whatever you decide works best here.

/Bruce

  reply	other threads:[~2025-08-06 10:36 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-25 12:49 [RFC PATCH 00/14] net/intel: rx path selection simplification Ciara Loftus
2025-07-25 12:49 ` [RFC PATCH 01/14] net/ice: use the same Rx path across process types Ciara Loftus
2025-07-25 13:40   ` Bruce Richardson
2025-07-25 12:49 ` [RFC PATCH 02/14] net/iavf: rename Rx/Tx function type variables Ciara Loftus
2025-07-25 13:40   ` Bruce Richardson
2025-07-25 12:49 ` [RFC PATCH 03/14] net/iavf: use the same Rx path across process types Ciara Loftus
2025-07-25 13:41   ` Bruce Richardson
2025-07-25 12:49 ` [RFC PATCH 04/14] net/i40e: " Ciara Loftus
2025-07-25 13:43   ` Bruce Richardson
2025-07-25 12:49 ` [RFC PATCH 05/14] net/intel: introduce common vector capability function Ciara Loftus
2025-07-25 13:45   ` Bruce Richardson
2025-07-25 12:49 ` [RFC PATCH 06/14] net/ice: use the new " Ciara Loftus
2025-07-25 13:56   ` Bruce Richardson
2025-08-06 14:46     ` Loftus, Ciara
2025-07-25 12:49 ` [RFC PATCH 07/14] net/iavf: " Ciara Loftus
2025-07-25 12:49 ` [RFC PATCH 08/14] net/i40e: " Ciara Loftus
2025-07-25 12:49 ` [RFC PATCH 09/14] net/iavf: remove redundant field from iavf adapter struct Ciara Loftus
2025-07-25 14:51   ` Bruce Richardson
2025-07-25 12:49 ` [RFC PATCH 10/14] net/intel: introduce infrastructure for Rx path selection Ciara Loftus
2025-07-25 15:21   ` Bruce Richardson
2025-08-06 10:14     ` Loftus, Ciara
2025-08-06 10:36       ` Bruce Richardson [this message]
2025-07-25 12:49 ` [RFC PATCH 11/14] net/ice: remove unsupported Rx offload Ciara Loftus
2025-07-25 15:22   ` Bruce Richardson
2025-07-25 12:49 ` [RFC PATCH 12/14] net/ice: use the common Rx path selection infrastructure Ciara Loftus
2025-07-25 12:49 ` [RFC PATCH 13/14] net/iavf: " Ciara Loftus
2025-07-25 12:49 ` [RFC PATCH 14/14] net/i40e: " Ciara Loftus
2025-08-07 12:39 ` [PATCH v2 00/15] net/intel: rx path selection simplification Ciara Loftus
2025-08-07 12:39   ` [PATCH v2 01/15] net/ice: use the same Rx path across process types Ciara Loftus
2025-08-07 12:39   ` [PATCH v2 02/15] net/iavf: rename Rx/Tx function type variables Ciara Loftus
2025-08-07 12:39   ` [PATCH v2 03/15] net/iavf: use the same Rx path across process types Ciara Loftus
2025-08-07 12:39   ` [PATCH v2 04/15] net/i40e: " Ciara Loftus
2025-08-07 12:39   ` [PATCH v2 05/15] net/intel: introduce common vector capability function Ciara Loftus
2025-08-07 12:39   ` [PATCH v2 06/15] net/ice: use the new " Ciara Loftus
2025-08-07 12:39   ` [PATCH v2 07/15] net/iavf: " Ciara Loftus
2025-08-07 12:39   ` [PATCH v2 08/15] net/i40e: " Ciara Loftus
2025-08-07 12:39   ` [PATCH v2 09/15] net/iavf: remove redundant field from iavf adapter struct Ciara Loftus
2025-08-07 12:39   ` [PATCH v2 10/15] net/ice: remove unsupported Rx offload Ciara Loftus
2025-08-07 12:39   ` [PATCH v2 11/15] net/iavf: reorder enum of Rx function types Ciara Loftus
2025-08-07 12:39   ` [PATCH v2 12/15] net/intel: introduce infrastructure for Rx path selection Ciara Loftus
2025-08-07 12:39   ` [PATCH v2 13/15] net/ice: use the common Rx path selection infrastructure Ciara Loftus
2025-08-07 12:39   ` [PATCH v2 14/15] net/iavf: " Ciara Loftus
2025-08-07 12:39   ` [PATCH v2 15/15] net/i40e: " Ciara Loftus

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=aJMwG1wMe2DNByEn@bricha3-mobl1.ger.corp.intel.com \
    --to=bruce.richardson@intel.com \
    --cc=ciara.loftus@intel.com \
    --cc=dev@dpdk.org \
    /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).