On 07/12/2024 4:10, Jakub Kicinski wrote:
On Thu, 5 Dec 2024 00:09:27 +0200 Tariq Toukan wrote:
+ min: 0
+ max: 100
Are full percentage points sufficient granularity?
Yes, we think so.
+ 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.
I'll fix.
+ 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?
If we enforce by policy we need to use the constant 7, not the macro
IEEE_8021QAZ_MAX_TCS-1.
I'll keep it.
+ 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
I'll fix.
+ return -EINVAL;
+ }