[PATCH 1/1] net/mana: add 32 bit short doorbell

Long Li longli at microsoft.com
Wed Sep 13 23:11:07 CEST 2023


> Subject: [PATCH 1/1] net/mana: add 32 bit short doorbell
> 
> Add 32 bit short doorbell support. Ring short doorbell when running in 32 bit
> applicactions.
> 
> Cc: stable at dpdk.org
> 
> Signed-off-by: Wei Hu <weh at microsoft.com>

Please send this patch to

Ferruh Yigit <ferruh.yigit at amd.com>
Andrew Rybchenko <andrew.rybchenko at oktetlabs.ru>


> ---
>  drivers/net/mana/gdma.c | 95
> +++++++++++++++++++++++++++++++++++++++++
>  drivers/net/mana/mana.h | 25 +++++++++++
>  drivers/net/mana/rx.c   | 52 ++++++++++++++++++++++
>  drivers/net/mana/tx.c   | 28 ++++++++++++
>  4 files changed, 200 insertions(+)
> 
> diff --git a/drivers/net/mana/gdma.c b/drivers/net/mana/gdma.c index
> 65685fe236..d1da025d1b 100644
> --- a/drivers/net/mana/gdma.c
> +++ b/drivers/net/mana/gdma.c
> @@ -166,6 +166,97 @@ gdma_post_work_request(struct
> mana_gdma_queue *queue,
>  	return 0;
>  }
> 
> +#ifdef RTE_ARCH_32
> +union gdma_short_doorbell_entry {
> +	uint32_t     as_uint32;
> +
> +	struct {
> +		uint32_t tail_ptr_incr	: 16; /* Number of CQEs */
> +		uint32_t id		: 12;
> +		uint32_t reserved	: 3;
> +		uint32_t arm		: 1;
> +	} cq;
> +
> +	struct {
> +		uint32_t tail_ptr_incr	: 16; /* In number of bytes */
> +		uint32_t id		: 12;
> +		uint32_t reserved	: 4;
> +	} rq;
> +
> +	struct {
> +		uint32_t tail_ptr_incr	: 16; /* In number of bytes */
> +		uint32_t id		: 12;
> +		uint32_t reserved	: 4;
> +	} sq;
> +
> +	struct {
> +		uint32_t tail_ptr_incr	: 16; /* Number of EQEs */
> +		uint32_t id		: 12;
> +		uint32_t reserved	: 3;
> +		uint32_t arm		: 1;
> +	} eq;
> +}; /* HW DATA */
> +
> +enum {
> +	DOORBELL_SHORT_OFFSET_SQ = 0x10,
> +	DOORBELL_SHORT_OFFSET_RQ = 0x410,
> +	DOORBELL_SHORT_OFFSET_CQ = 0x810,
> +	DOORBELL_SHORT_OFFSET_EQ = 0xFF0,
> +};
> +
> +/*
> + * Write to hardware doorbell to notify new activity.
> + */
> +int
> +mana_ring_short_doorbell(void *db_page, enum gdma_queue_types
> queue_type,
> +			 uint32_t queue_id, uint32_t tail_incr, uint8_t arm) {
> +	uint8_t *addr = db_page;
> +	union gdma_short_doorbell_entry e = {};
> +
> +	if ((queue_id & ~GDMA_SHORT_DB_QID_MASK) ||
> +	    (tail_incr & ~GDMA_SHORT_DB_INC_MASK)) {
> +		DP_LOG(ERR, "%s: queue_id %u or "
> +		       "tail_incr %u overflowed, queue type %d",
> +		       __func__, queue_id, tail_incr, queue_type);

This should never happen.

What does "overflowed" mean? Is it a hardware error or software error? If this is a software error, the calling code needs to make sure it never overflows when using short doorbells.

Thanks,

Long


More information about the stable mailing list