[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170516003857.52c3f31b@cakuba.netronome.com>
Date: Tue, 16 May 2017 00:38:57 -0700
From: Jakub Kicinski <kubakici@...pl>
To: Simon Horman <simon.horman@...ronome.com>
Cc: netdev@...r.kernel.org, oss-drivers@...ronome.com
Subject: Re: [oss-drivers] [PATCH net-next 8/9] nfp: add a helper for
wrapping descriptor index
On Tue, 16 May 2017 09:08:08 +0200, Simon Horman wrote:
> On Mon, May 15, 2017 at 05:55:22PM -0700, Jakub Kicinski wrote:
> > We have a number of places where we calculate the descriptor
> > index based on a value which may have overflown. Create a
> > macro for masking with the ring size.
> >
> > Signed-off-by: Jakub Kicinski <jakub.kicinski@...ronome.com>
> > ---
> > drivers/net/ethernet/netronome/nfp/nfp_net.h | 3 +++
> > drivers/net/ethernet/netronome/nfp/nfp_net_common.c | 21 ++++++++++-----------
> > 2 files changed, 13 insertions(+), 11 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net.h b/drivers/net/ethernet/netronome/nfp/nfp_net.h
> > index 66319a1026bb..7b9518cbe965 100644
> > --- a/drivers/net/ethernet/netronome/nfp/nfp_net.h
> > +++ b/drivers/net/ethernet/netronome/nfp/nfp_net.h
> > @@ -117,6 +117,9 @@ struct nfp_eth_table_port;
> > struct nfp_net;
> > struct nfp_net_r_vector;
> >
> > +/* Convenience macro for wrapping descriptor index on ring size */
> > +#define D_IDX(ring, idx) ((idx) & ((ring)->cnt - 1))
>
> Any reason not to make this a function?
This is to be able to use the same macro for both RX and TX rings. If
you look below in the code I have a macro for setting dma addresses on
descriptors also regardless of the type.
It makes the code a tiny bit cleaner IMHO and should be acceptable for
trivial macros.
> That notwithstanding:
>
> Reviewed-by: Simon Horman <simon.horman@...ronome.com>
Thanks for the reviews!
Powered by blists - more mailing lists