From: Viacheslav Ovsiienko Date: Tue, 21 Jul 2020 11:11:29 +0000 (+0000) Subject: common/mlx5: fix queue doorbell record size X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=44c1b52bc6a659e01e8038e1f5c42d9fa98b728f;p=dpdk.git common/mlx5: fix queue doorbell record size When Rx/Tx queue was being created with DevX the allocated doorbell record size was only uint64_t. That was definitely less than size of CPU cacheline and it might have happened the doorbell records attached to different queues handled by different cores were allocated within same cacheline. It might have caused the contention on doorbell record writing. This patch extends the allocated memory size for doorbell record to cacheline size. Fixes: 21cae8580fd0 ("net/mlx5: allocate door-bells via DevX") Cc: stable@dpdk.org Signed-off-by: Viacheslav Ovsiienko Acked-by: Matan Azrad --- diff --git a/drivers/common/mlx5/mlx5_common.c b/drivers/common/mlx5/mlx5_common.c index 79357e2e24..06f0a64006 100644 --- a/drivers/common/mlx5/mlx5_common.c +++ b/drivers/common/mlx5/mlx5_common.c @@ -198,7 +198,7 @@ mlx5_get_dbr(void *ctx, struct mlx5_dbr_page_list *head, page->dbr_bitmap[i] |= (UINT64_C(1) << j); page->dbr_count++; *dbr_page = page; - return (((i * 64) + j) * sizeof(uint64_t)); + return (i * CHAR_BIT * sizeof(uint64_t) + j) * MLX5_DBR_SIZE; } /** diff --git a/drivers/common/mlx5/mlx5_common.h b/drivers/common/mlx5/mlx5_common.h index 9154cbc6b1..2cdb226f38 100644 --- a/drivers/common/mlx5/mlx5_common.h +++ b/drivers/common/mlx5/mlx5_common.h @@ -215,10 +215,12 @@ enum mlx5_class { MLX5_CLASS_REGEX = RTE_BIT64(2), }; -#define MLX5_DBR_PAGE_SIZE 4096 /* Must be >= 512. */ -#define MLX5_DBR_SIZE 8 -#define MLX5_DBR_PER_PAGE (MLX5_DBR_PAGE_SIZE / MLX5_DBR_SIZE) -#define MLX5_DBR_BITMAP_SIZE (MLX5_DBR_PER_PAGE / 64) +#define MLX5_DBR_SIZE RTE_CACHE_LINE_SIZE +#define MLX5_DBR_PER_PAGE 64 +/* Must be >= CHAR_BIT * sizeof(uint64_t) */ +#define MLX5_DBR_PAGE_SIZE (MLX5_DBR_PER_PAGE * MLX5_DBR_SIZE) +/* Page size must be >= 512. */ +#define MLX5_DBR_BITMAP_SIZE (MLX5_DBR_PER_PAGE / (CHAR_BIT * sizeof(uint64_t))) struct mlx5_devx_dbr_page { /* Door-bell records, must be first member in structure. */