Re: [PATCH net-next v4 2/6] net: dcb: add new apptrust attribute

From: Petr Machata
Date: Mon Oct 31 2022 - 08:27:59 EST



Daniel Machon <daniel.machon@xxxxxxxxxxxxx> writes:

> + if (ieee[DCB_ATTR_DCB_APP_TRUST_TABLE]) {
> + u8 selectors[IEEE_8021QAZ_APP_SEL_MAX + 1] = {0};
> + struct nlattr *attr;
> + int nselectors = 0;
> + u8 selector;
> + int rem, i;
> +
> + if (!ops->dcbnl_setapptrust) {
> + err = -EOPNOTSUPP;
> + goto err;
> + }
> +
> + nla_for_each_nested(attr, ieee[DCB_ATTR_DCB_APP_TRUST_TABLE],
> + rem) {
> + if (nla_type(attr) != DCB_ATTR_DCB_APP_TRUST ||
> + nla_len(attr) != 1 ||
> + nselectors >= sizeof(selectors)) {
> + err = -EINVAL;
> + goto err;
> + }
> +
> + selector = nla_get_u8(attr);
> + switch (selector) {
> + case IEEE_8021QAZ_APP_SEL_ETHERTYPE:
> + case IEEE_8021QAZ_APP_SEL_STREAM:
> + case IEEE_8021QAZ_APP_SEL_DGRAM:
> + case IEEE_8021QAZ_APP_SEL_ANY:
> + case IEEE_8021QAZ_APP_SEL_DSCP:
> + case DCB_APP_SEL_PCP:

This assumes that the range of DCB attributes will never overlap with
the range of IEEE attributes. Wasn't the original reason for introducing
the DCB nest to not have to make this assumption?

I.e. now that we split DCB and IEEE attributes in the APP_TABLE
attribute, shouldn't it be done here as well?