[PATCH v1 1/5] net/zxdh: add support for modifying queue depth

Stephen Hemminger stephen at networkplumber.org
Wed Dec 31 20:15:29 CET 2025


On Sat, 20 Dec 2025 14:15:17 +0800
Junlong Wang <wang.junlong1 at zte.com.cn> wrote:

>  
> +static unsigned int
> +log2above(unsigned int v)
> +{
> +	unsigned int l;
> +	unsigned int r;
> +
> +	for (l = 0, r = 0; (v >> 1); ++l, v >>= 1)
> +		r |= (v & 1);
> +	return l + r;
> +}
> +

It is only used during initalization so performance is not a big issue,
but this could could be optimized by using the compiler builtins.

static uint32_t
log2above(uint32_t v)
{
	if (v <= 1)
		return 0;
	return 32 - __rte_clz32(v - 1);
}

Will merge as is.


More information about the dev mailing list