[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZCBGfoqzid7PLcZE@corigine.com>
Date: Sun, 26 Mar 2023 15:19:58 +0200
From: Simon Horman <simon.horman@...igine.com>
To: Piotr Raczynski <piotr.raczynski@...el.com>
Cc: intel-wired-lan@...ts.osuosl.org, netdev@...r.kernel.org,
michal.swiatkowski@...el.com, shiraz.saleem@...el.com,
jacob.e.keller@...el.com, sridhar.samudrala@...el.com,
jesse.brandeburg@...el.com, aleksander.lobakin@...el.com,
lukasz.czapnik@...el.com,
Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>
Subject: Re: [PATCH net-next v3 7/8] ice: track interrupt vectors with xarray
On Thu, Mar 23, 2023 at 01:24:39PM +0100, Piotr Raczynski wrote:
> Replace custom interrupt tracker with generic xarray data structure.
> Remove all code responsible for searching for a new entry with xa_alloc,
> which always tries to allocate at the lowes possible index. As a result
> driver is always using a contiguous region of the MSIX vector table.
>
> New tracker keeps ice_irq_entry entries in xarray as opaque for the rest
> of the driver hiding the entry details from the caller.
>
> Reviewed-by: Jacob Keller <jacob.e.keller@...el.com>
> Reviewed-by: Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>
> Signed-off-by: Piotr Raczynski <piotr.raczynski@...el.com>
Reviewed-by: Simon Horman <simon.horman@...igine.com>
I've added a few comments inline for your consideration
if you need to respin for some other reason.
...
> diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h
> index 89d80a2b5feb..b7398abda26a 100644
> --- a/drivers/net/ethernet/intel/ice/ice.h
> +++ b/drivers/net/ethernet/intel/ice/ice.h
> @@ -104,7 +104,6 @@
> #define ICE_Q_WAIT_RETRY_LIMIT 10
> #define ICE_Q_WAIT_MAX_RETRY (5 * ICE_Q_WAIT_RETRY_LIMIT)
> #define ICE_MAX_LG_RSS_QS 256
> -#define ICE_RES_VALID_BIT 0x8000
nit: BIT() could be used here.
> #define ICE_INVAL_Q_INDEX 0xffff
>
> #define ICE_MAX_RXQS_PER_TC 256 /* Used when setting VSI context per TC Rx queues */
...
> diff --git a/drivers/net/ethernet/intel/ice/ice_irq.c b/drivers/net/ethernet/intel/ice/ice_irq.c
> index ca1a1de26766..20d4e9a6aefb 100644
> --- a/drivers/net/ethernet/intel/ice/ice_irq.c
> +++ b/drivers/net/ethernet/intel/ice/ice_irq.c
...
> +/**
> + * ice_get_irq_res - get an interrupt resource
> + * @pf: board private structure
> + *
> + * Allocate new irq entry in the free slot of the tracker. Since xarray
> + * is used, always allocate new entry at the lowest possible index. Set
> + * proper allocation limit for maximum tracker entries.
> + *
> + * Returns allocated irq entry or NULL on failure.
> + */
> +static struct ice_irq_entry *ice_get_irq_res(struct ice_pf *pf)
> +{
> + struct xa_limit limit = { .max = pf->irq_tracker.num_entries,
> + .min = 0 };
> + struct ice_irq_entry *entry;
> + unsigned int index;
> + int ret;
> +
> + entry = kzalloc(sizeof(*entry), GFP_KERNEL);
> + if (!entry)
> + goto exit;
nit: maybe it is simpler to return NULL here.
> +
> + ret = xa_alloc(&pf->irq_tracker.entries, &index, entry, limit,
> + GFP_KERNEL);
> +
> + if (ret) {
> + kfree(entry);
> + entry = NULL;
and here.
> + } else {
> + entry->index = index;
Which allows for more idiomatic code by moving this out of the else clause.
> + }
> +
> +exit:
And removal of this label.
> + return entry;
> +}
> +
Powered by blists - more mailing lists