Skip to content

Commit daab2e9

Browse files
Tariq ToukanSaeed Mahameed
authored andcommitted
net/mlx5: Use generic definition for UMR KLM alignment
MLX5_UMR_KLM_ALIGNMENT is in units of number of entries, while MLX5_UMR_MTT_ALIGNMENT (generalized and renamed to MLX5_UMR_FLEX_ALIGNMENT) is in byte units. This is misleading and confusing. Replace this KLM definition with one based on the generic definition. Signed-off-by: Tariq Toukan <[email protected]> Reviewed-by: Gal Pressman <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 02648b4 commit daab2e9

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ struct page_pool;
160160
(((wqe_size) - sizeof(struct mlx5e_umr_wqe)) / sizeof(struct mlx5_klm))
161161

162162
#define MLX5E_KLM_ENTRIES_PER_WQE(wqe_size)\
163-
ALIGN_DOWN(MLX5E_KLM_MAX_ENTRIES_PER_WQE(wqe_size), MLX5_UMR_KLM_ALIGNMENT)
163+
ALIGN_DOWN(MLX5E_KLM_MAX_ENTRIES_PER_WQE(wqe_size), MLX5_UMR_KLM_NUM_ENTRIES_ALIGNMENT)
164164

165165
#define MLX5E_MAX_KLM_PER_WQE(mdev) \
166166
MLX5E_KLM_ENTRIES_PER_WQE(MLX5_SEND_WQE_BB * mlx5e_get_max_sq_aligned_wqebbs(mdev))

drivers/net/ethernet/mellanox/mlx5/core/en_rx.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -593,8 +593,8 @@ static int mlx5e_build_shampo_hd_umr(struct mlx5e_rq *rq,
593593
int headroom, i;
594594

595595
headroom = rq->buff.headroom;
596-
new_entries = klm_entries - (shampo->pi & (MLX5_UMR_KLM_ALIGNMENT - 1));
597-
entries = ALIGN(klm_entries, MLX5_UMR_KLM_ALIGNMENT);
596+
new_entries = klm_entries - (shampo->pi & (MLX5_UMR_KLM_NUM_ENTRIES_ALIGNMENT - 1));
597+
entries = ALIGN(klm_entries, MLX5_UMR_KLM_NUM_ENTRIES_ALIGNMENT);
598598
wqe_bbs = MLX5E_KLM_UMR_WQEBBS(entries);
599599
pi = mlx5e_icosq_get_next_pi(sq, wqe_bbs);
600600
umr_wqe = mlx5_wq_cyc_get_wqe(&sq->wq, pi);
@@ -603,7 +603,7 @@ static int mlx5e_build_shampo_hd_umr(struct mlx5e_rq *rq,
603603
for (i = 0; i < entries; i++, index++) {
604604
dma_info = &shampo->info[index];
605605
if (i >= klm_entries || (index < shampo->pi && shampo->pi - index <
606-
MLX5_UMR_KLM_ALIGNMENT))
606+
MLX5_UMR_KLM_NUM_ENTRIES_ALIGNMENT))
607607
goto update_klm;
608608
header_offset = (index & (MLX5E_SHAMPO_WQ_HEADER_PER_PAGE - 1)) <<
609609
MLX5E_SHAMPO_LOG_MAX_HEADER_ENTRY_SIZE;
@@ -668,8 +668,8 @@ static int mlx5e_alloc_rx_hd_mpwqe(struct mlx5e_rq *rq)
668668
if (!klm_entries)
669669
return 0;
670670

671-
klm_entries += (shampo->pi & (MLX5_UMR_KLM_ALIGNMENT - 1));
672-
index = ALIGN_DOWN(shampo->pi, MLX5_UMR_KLM_ALIGNMENT);
671+
klm_entries += (shampo->pi & (MLX5_UMR_KLM_NUM_ENTRIES_ALIGNMENT - 1));
672+
index = ALIGN_DOWN(shampo->pi, MLX5_UMR_KLM_NUM_ENTRIES_ALIGNMENT);
673673
entries_before = shampo->hd_per_wq - index;
674674

675675
if (unlikely(entries_before < klm_entries))

include/linux/mlx5/device.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,9 @@ enum {
290290
MLX5_UMR_INLINE = (1 << 7),
291291
};
292292

293-
#define MLX5_UMR_KLM_ALIGNMENT 4
294293
#define MLX5_UMR_FLEX_ALIGNMENT 0x40
295294
#define MLX5_UMR_MTT_NUM_ENTRIES_ALIGNMENT (MLX5_UMR_FLEX_ALIGNMENT / sizeof(struct mlx5_mtt))
295+
#define MLX5_UMR_KLM_NUM_ENTRIES_ALIGNMENT (MLX5_UMR_FLEX_ALIGNMENT / sizeof(struct mlx5_klm))
296296

297297
#define MLX5_USER_INDEX_LEN (MLX5_FLD_SZ_BYTES(qpc, user_index) * 8)
298298

0 commit comments

Comments
 (0)