Re: [v7, net-next 08/10] bng_en: Register rings with the firmware
From: Bhargava Chenna Marreddy
Date: Thu Sep 18 2025 - 06:41:27 EST
On Tue, Sep 16, 2025 at 9:21 PM Simon Horman <horms@xxxxxxxxxx> wrote:
>
> On Fri, Sep 12, 2025 at 01:05:03AM +0530, Bhargava Marreddy wrote:
> > Enable ring functionality by registering RX, AGG, TX, CMPL, and
> > NQ rings with the firmware. Initialise the doorbells associated
> > with the rings.
> >
> > Signed-off-by: Bhargava Marreddy <bhargava.marreddy@xxxxxxxxxxxx>
> > Reviewed-by: Vikas Gupta <vikas.gupta@xxxxxxxxxxxx>
> > Reviewed-by: Rajashekar Hudumula <rajashekar.hudumula@xxxxxxxxxxxx>
>
> ...
>
> > diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_db.h b/drivers/net/ethernet/broadcom/bnge/bnge_db.h
> > new file mode 100644
> > index 00000000000..950ed582f1d
> > --- /dev/null
> > +++ b/drivers/net/ethernet/broadcom/bnge/bnge_db.h
> > @@ -0,0 +1,34 @@
> > +/* SPDX-License-Identifier: GPL-2.0 */
> > +/* Copyright (c) 2025 Broadcom */
> > +
> > +#ifndef _BNGE_DB_H_
> > +#define _BNGE_DB_H_
> > +
> > +/* 64-bit doorbell */
> > +#define DBR_EPOCH_SFT 24
> > +#define DBR_TOGGLE_SFT 25
> > +#define DBR_XID_SFT 32
> > +#define DBR_PATH_L2 (0x1ULL << 56)
> > +#define DBR_VALID (0x1ULL << 58)
> > +#define DBR_TYPE_SQ (0x0ULL << 60)
> > +#define DBR_TYPE_SRQ (0x2ULL << 60)
> > +#define DBR_TYPE_CQ (0x4ULL << 60)
> > +#define DBR_TYPE_CQ_ARMALL (0x6ULL << 60)
> > +#define DBR_TYPE_NQ (0xaULL << 60)
> > +#define DBR_TYPE_NQ_ARM (0xbULL << 60)
> > +#define DBR_TYPE_NQ_MASK (0xeULL << 60)
>
> Perhaps BIT_ULL() and GENMASK_ULL() can be used here?
Thanks for the suggestion, Simon. Some macros have non-contiguous
bits, requiring combinations with "|",
which would make the definitions longer and harder to follow. Since
these Doorbell Register (DBR) values
are hardware-specified, I believe it's better to keep them as they
are. Please let me know if you see any issues.
>
> ...