Re: [PATCH v4 net-next 6/9] net/sched: mqprio: allow per-TC user input of FP adminStatus

From: Jakub Kicinski
Date: Wed Apr 05 2023 - 21:13:42 EST


On Mon, 3 Apr 2023 13:34:37 +0300 Vladimir Oltean wrote:
> +static int mqprio_parse_tc_entry(u32 fp[TC_QOPT_MAX_QUEUE],
> + struct nlattr *opt,
> + unsigned long *seen_tcs,
> + struct netlink_ext_ack *extack)
> +{
> + struct nlattr *tb[TCA_MQPRIO_TC_ENTRY_MAX + 1] = { };

nit: no need to clear it nla_parse*() zeros the memory

> + int err, tc;
> +
> + err = nla_parse_nested(tb, TCA_MQPRIO_TC_ENTRY_MAX, opt,
> + mqprio_tc_entry_policy, extack);
> + if (err < 0)
> + return err;
> +
> + if (!tb[TCA_MQPRIO_TC_ENTRY_INDEX]) {
> + NL_SET_ERR_MSG(extack, "TC entry index missing");

Are you not using NL_REQ_ATTR_CHECK() because iproute can't actually
parse the result? :(

> + return -EINVAL;
> + }
> +
> + tc = nla_get_u32(tb[TCA_MQPRIO_TC_ENTRY_INDEX]);
> + if (*seen_tcs & BIT(tc)) {
> + NL_SET_ERR_MSG(extack, "Duplicate tc entry");

set attr in extack?


minor heads up - I'll take the trivial cleanup patch from Pedro
so make sure you rebase:
https://lore.kernel.org/all/20230404203449.1627033-1-pctammela@xxxxxxxxxxxx/