Subject: Re: [PATCH net-next V5 07/11] devlink: Extend devlink rate API with traffic classes bandwidth management

From: Jakub Kicinski <[email-masked]>
Date: Fri, 6 Dec 2024 18:10:56 -0800

On Thu, 5 Dec 2024 00:09:27 +0200 Tariq Toukan wrote:
> +          min: 0
> +          max: 100

Are full percentage points sufficient granularity?

> +	if (!tb[DEVLINK_ATTR_RATE_TC_INDEX]) {

NL_SET_ERR_ATTR_MISS()

Please limit the string messages where error can be expressed in
machine readable form.

> +		NL_SET_ERR_MSG(extack, "Traffic class index is expected");
> +		return -EINVAL;
> +	}
> +
> +	tc_index = nla_get_u8(tb[DEVLINK_ATTR_RATE_TC_INDEX]);
> +
> +	if (tc_index >= IEEE_8021QAZ_MAX_TCS) {

This can't be enforced by the policy?

> +		NL_SET_ERR_MSG_FMT(extack,
> +				   "Provided traffic class index (%u) exceeds the maximum allowed value (%u)",
> +				   tc_index, IEEE_8021QAZ_MAX_TCS - 1);
> +		return -EINVAL;
> +	}
> +
> +	if (!tb[DEVLINK_ATTR_RATE_TC_BW]) {
> +		NL_SET_ERR_MSG(extack, "Traffic class bandwidth is expected");
> +		return -EINVAL;
> +	}
> +
> +	if (test_and_set_bit(tc_index, bitmap)) {
> +		NL_SET_ERR_MSG(extack, "Duplicate traffic class index specified");

always try to point to attr that caused the issue

> +		return -EINVAL;
> +	}
-- 
pw-bot: cr