[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87k04gw54m.fsf@nvidia.com>
Date: Mon, 31 Oct 2022 13:24:23 +0100
From: Petr Machata <petrm@...dia.com>
To: Daniel Machon <daniel.machon@...rochip.com>
CC: <netdev@...r.kernel.org>, <davem@...emloft.net>,
<petrm@...dia.com>, <maxime.chevallier@...tlin.com>,
<thomas.petazzoni@...tlin.com>, <edumazet@...gle.com>,
<kuba@...nel.org>, <pabeni@...hat.com>,
<lars.povlsen@...rochip.com>, <Steen.Hegelund@...rochip.com>,
<UNGLinuxDriver@...rochip.com>, <joe@...ches.com>,
<linux@...linux.org.uk>, <horatiu.vultur@...rochip.com>,
<Julia.Lawall@...ia.fr>, <vladimir.oltean@....com>,
<linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH net-next v4 2/6] net: dcb: add new apptrust attribute
Daniel Machon <daniel.machon@...rochip.com> 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?
Powered by blists - more mailing lists