[PATCH v1 10/14] net/zxdh: support hash tables write and delete ops

Stephen Hemminger stephen at networkplumber.org
Mon Feb 10 18:45:24 CET 2025


On Mon, 10 Feb 2025 09:50:13 +0800
Bingbin Chen <chen.bingbin at zte.com.cn> wrote:

> +static inline uint32_t
> +ZXDH_ZBLK_ADDR_CONV(uint32_t zblk_idx)

Do not name functions with all upper case, that is reserved for macros.

> +{
> +	return ((zblk_idx) / ZXDH_ZBLK_NUM_PER_ZGRP) * (1 << ZXDH_ZBLK_IDX_BT_WIDTH) + (zblk_idx)
> +	% ZXDH_ZBLK_NUM_PER_ZGRP;

Indent the previous line since it is contunation of expression

> +}

> +
> +static inline uint32_t
> +ZXDH_ZCELL_ADDR_CONV(uint32_t zcell_idx)
> +{
> +	uint32_t blk_grp_idx = (zcell_idx >> ZXDH_ZCELL_IDX_BT_WIDTH) &
> +			((1 << (ZXDH_ZBLK_IDX_BT_WIDTH + ZXDH_ZGRP_IDX_BT_WIDTH)) - 1);
> +
> +	uint32_t cell_idx = zcell_idx & ((1 << ZXDH_ZCELL_IDX_BT_WIDTH) - 1);
> +
> +	return (ZXDH_ZBLK_ADDR_CONV(blk_grp_idx) << ZXDH_ZCELL_IDX_BT_WIDTH) | cell_idx;
> +}


More information about the dev mailing list