netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Vladimir Oltean <olteanv@gmail.com>
Cc: Vladimir Oltean <vladimir.oltean@nxp.com>,
	netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Xiaoliang Yang <xiaoliang.yang_1@nxp.com>,
	Rui Sousa <rui.sousa@nxp.com>,
	Claudiu Manoil <claudiu.manoil@nxp.com>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	UNGLinuxDriver@microchip.com,
	Horatiu Vultur <horatiu.vultur@microchip.com>,
	Andrew Lunn <andrew@lunn.ch>,
	Vivien Didelot <vivien.didelot@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Michael Walle <michael@walle.cc>,
	Vinicius Costa Gomes <vinicius.gomes@intel.com>,
	Maxim Kochetkov <fido_max@inbox.ru>,
	Colin Foster <colin.foster@in-advantage.com>,
	Richie Pearn <richard.pearn@nxp.com>,
	Kurt Kanzenbach <kurt@linutronix.de>,
	Jesse Brandeburg <jesse.brandeburg@intel.com>,
	Tony Nguyen <anthony.l.nguyen@intel.com>,
	Giuseppe Cavallaro <peppe.cavallaro@st.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Jose Abreu <joabreu@synopsys.com>,
	Jamal Hadi Salim <jhs@mojatatu.com>,
	Cong Wang <xiyou.wangcong@gmail.com>,
	Jiri Pirko <jiri@resnulli.us>,
	Gerhard Engleder <gerhard@engleder-embedded.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 net-next 01/12] net/sched: taprio: allow user input of per-tc max SDU
Date: Tue, 27 Sep 2022 11:27:10 -0700	[thread overview]
Message-ID: <20220927112710.5fc7720f@kernel.org> (raw)
In-Reply-To: <20220927150921.ffjdliwljccusxad@skbuf>

On Tue, 27 Sep 2022 18:09:21 +0300 Vladimir Oltean wrote:
> On Mon, Sep 26, 2022 at 01:38:29PM -0700, Jakub Kicinski wrote:
> > On Fri, 23 Sep 2022 19:32:59 +0300 Vladimir Oltean wrote:  
> > > +	if (!tb[TCA_TAPRIO_TC_ENTRY_INDEX]) {
> > > +		NL_SET_ERR_MSG_MOD(extack, "TC entry index missing");  
> > 
> > NL_SET_ERR_ATTR_MISS() ?
> >   
> > > +		return -EINVAL;
> > > +	}
> > > +
> > > +	tc = nla_get_u32(tb[TCA_TAPRIO_TC_ENTRY_INDEX]);
> > > +	if (tc >= TC_QOPT_MAX_QUEUE) {
> > > +		NL_SET_ERR_MSG_MOD(extack, "TC entry index out of range");  
> > 
> > NLA_POLICY_MAX()
> > 
> > Are you not using those on purpose? :(  
> 
> I don't exactly see it as being super user friendly to leave it to the
> policy validator (or to use NL_SET_ERR_ATTR_MISS()) because all that
> will be reported back to user space will be the offset to the original
> attribute in the nlmsghdr, which is pretty hard to retrieve and
> re-interpret (at least in the iproute2 tc source code, I can't seem to
> find a way to stringify it or something like that). For the NLA_POLICY_MAX(),
> all I'll get now is an uninformative "Error: integer out of range."
> What integer?  What range?

I know, that's what I expected you'd say :(
You'd need a reverse parser which is a PITA to do unless you have
clearly specified bindings.

> I don't understand what is the gain of removing extack message strings
> and just pointing to the netlink attribute via NLMSGERR_ATTR_OFFS? Could
> I at least use the NL_SET_ERR_ATTR_MISS() helper *and* set a custom message?
> That's for the missing nlattr. Regarding the range checking in the
> policy, I'd like a custom message there as well, but the NLA_POLICY_MAX()
> doesn't provide one. However, I see that struct nla_policy has a const
> char *reject_message for NLA_REJECT types. Would it be an abuse to move
> this outside of the union and allow U32 policies and such to also
> provide it?

I'd rather you kept the code as is than make precedent for adding both
string and machine readable. If we do that people will try to stay on
the safe side and always add both.

The machine readable format is carries all the information you need.
It's just the user space is not clever enough to read it which is,
well, solvable.

  reply	other threads:[~2022-09-27 18:27 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-23 16:32 [PATCH v2 net-next 00/12] Add tc-taprio support for queueMaxSDU Vladimir Oltean
2022-09-23 16:32 ` [PATCH v2 net-next 01/12] net/sched: taprio: allow user input of per-tc max SDU Vladimir Oltean
2022-09-26 20:38   ` Jakub Kicinski
2022-09-27 15:09     ` Vladimir Oltean
2022-09-27 18:27       ` Jakub Kicinski [this message]
2022-09-27 21:23         ` Vladimir Oltean
2022-09-27 21:32           ` Jakub Kicinski
2022-09-23 16:33 ` [PATCH v2 net-next 02/12] tsnep: deny tc-taprio changes to " Vladimir Oltean
2022-09-26 20:40   ` Jakub Kicinski
2022-09-26 21:50     ` Vladimir Oltean
2022-09-26 23:29       ` Jakub Kicinski
2022-09-27  0:22         ` Vladimir Oltean
2022-09-27  0:43           ` Jakub Kicinski
2022-09-23 16:33 ` [PATCH v2 net-next 03/12] igc: " Vladimir Oltean
2022-09-23 16:33 ` [PATCH v2 net-next 04/12] net: stmmac: " Vladimir Oltean
2022-09-23 16:33 ` [PATCH v2 net-next 05/12] net: am65-cpsw: " Vladimir Oltean
2022-09-23 16:33 ` [PATCH v2 net-next 06/12] net: lan966x: " Vladimir Oltean
2022-09-23 16:33 ` [PATCH v2 net-next 07/12] net: dsa: sja1105: " Vladimir Oltean
2022-09-23 16:33 ` [PATCH v2 net-next 08/12] net: dsa: felix: offload per-tc max SDU from tc-taprio Vladimir Oltean
2022-09-23 16:33 ` [PATCH v2 net-next 09/12] net: dsa: hellcreek: Offload " Vladimir Oltean
2022-09-23 16:33 ` [PATCH v2 net-next 10/12] net: enetc: cache accesses to &priv->si->hw Vladimir Oltean
2022-09-23 16:33 ` [PATCH v2 net-next 11/12] net: enetc: use common naming scheme for PTGCR and PTGCAPR registers Vladimir Oltean
2022-09-23 16:33 ` [PATCH v2 net-next 12/12] net: enetc: offload per-tc max SDU from tc-taprio Vladimir Oltean

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220927112710.5fc7720f@kernel.org \
    --to=kuba@kernel.org \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andrew@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=claudiu.manoil@nxp.com \
    --cc=colin.foster@in-advantage.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=fido_max@inbox.ru \
    --cc=gerhard@engleder-embedded.com \
    --cc=horatiu.vultur@microchip.com \
    --cc=jesse.brandeburg@intel.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=joabreu@synopsys.com \
    --cc=kurt@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael@walle.cc \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=peppe.cavallaro@st.com \
    --cc=richard.pearn@nxp.com \
    --cc=rui.sousa@nxp.com \
    --cc=vinicius.gomes@intel.com \
    --cc=vivien.didelot@gmail.com \
    --cc=vladimir.oltean@nxp.com \
    --cc=xiaoliang.yang_1@nxp.com \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).