netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: Nogah Frankel <nogah.frankel@gmail.com>
Cc: davem@davemloft.net, jiri@resnulli.us, xiyou.wangcong@gmail.com,
	john.fastabend@gmail.com, netdev@vger.kernel.org,
	oss-drivers@netronome.com, alexei.starovoitov@gmail.com,
	nogahf@mellanox.com, yuvalm@mellanox.com, gerlitz.or@gmail.com
Subject: Re: [PATCH net-next 05/14] nfp: abm: add simple RED offload
Date: Mon, 28 May 2018 16:05:07 -0700	[thread overview]
Message-ID: <20180528160507.4a2ff81a@cakuba> (raw)
In-Reply-To: <63246dc9-740d-ea72-e15e-599487b3a845@gmail.com>

Hi Nogah!

On Mon, 28 May 2018 18:49:51 +0300, Nogah Frankel wrote:
> > +static int
> > +nfp_abm_red_replace(struct net_device *netdev, struct nfp_abm_link *alink,
> > +		    struct tc_red_qopt_offload *opt)
> > +{
> > +	struct nfp_port *port = nfp_port_from_netdev(netdev);
> > +	int err;
> > +
> > +	if (opt->set.min != opt->set.max || !opt->set.is_ecn) {  
> 
> I am a bit worried about the min == max.
> sch_red doesn't really support it. It will calculate incorrect delta 
> value. (And that only if tc_red_eval_P in iproute2 won't reject it).
> You might maybe use max = min+1,  because in real life it will probably 
> act the same but without this problem.

I remember having a long think about this when I wrote the code.  
My conclusion was that the two would operate almost the same, and
setting min == max may be most obvious to the user.

If min + 1 == max sch_red would act probabilistically for qavg == min,
which is not what the card would do.

Userspace now does this:

tc_red_eval_P() {
	int i = qmax - qmin;
 
	if (!i)
		return 0;
	if (i < 0)
		return -1;
	...
}

And you've fixed delta to be treated as 1 to avoid division by 0 in
commit 5c472203421a ("net_sched: red: Avoid devision by zero"):

red_set_parms() {
	int delta = qth_max - qth_min;
	u32 max_p_delta;

	p->qth_min	= qth_min << Wlog;
	p->qth_max	= qth_max << Wlog;
	p->Wlog		= Wlog;
	p->Plog		= Plog;
	if (delta <= 0)
		delta = 1;
	p->qth_delta	= delta;
	...
}

So we should be safe.  Targets will match.  Probability adjustment for
adaptive should work correctly.  Which doesn't matter anyway, since we
will never use the probabilistic action...

> Nogah Frankel
> (from a new mail address)

Noted :)

  reply	other threads:[~2018-05-28 23:05 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-26  4:53 [PATCH net-next 00/14] nfp: abm: RED/MQ qdisc offload Jakub Kicinski
2018-05-26  4:53 ` [PATCH net-next 01/14] nfp: return -EOPNOTSUPP from .ndo_get_phys_port_name for VFs Jakub Kicinski
2018-05-26  4:53 ` [PATCH net-next 02/14] nfp: prefix vNIC phys_port_name with 'n' Jakub Kicinski
2018-05-26  4:53 ` [PATCH net-next 03/14] nfp: abm: enable advanced queuing on demand Jakub Kicinski
2018-05-26  4:53 ` [PATCH net-next 04/14] nfp: abm: add helpers for configuring queue marking levels Jakub Kicinski
2018-05-26  4:53 ` [PATCH net-next 05/14] nfp: abm: add simple RED offload Jakub Kicinski
2018-05-28 15:49   ` Nogah Frankel
2018-05-28 23:05     ` Jakub Kicinski [this message]
2018-05-29  7:53       ` Nogah Frankel
2018-05-26  4:53 ` [PATCH net-next 06/14] net: sched: add qstats.qlen to qlen Jakub Kicinski
2018-05-26  4:53 ` [PATCH net-next 07/14] nfp: abm: report statistics from RED offload Jakub Kicinski
2018-05-26  4:53 ` [PATCH net-next 08/14] nfp: allow apps to add extra stats to ports Jakub Kicinski
2018-05-26  4:53 ` [PATCH net-next 09/14] nfp: abm: expose the internal stats in ethtool Jakub Kicinski
2018-05-26  4:53 ` [PATCH net-next 10/14] nfp: abm: expose all PF queues Jakub Kicinski
2018-05-26  4:53 ` [PATCH net-next 11/14] net: sched: mq: add simple offload notification Jakub Kicinski
2018-05-26  4:53 ` [PATCH net-next 12/14] nfp: abm: multi-queue RED offload Jakub Kicinski
2018-05-26  4:53 ` [PATCH net-next 13/14] net: sched: mq: request stats from offloads Jakub Kicinski
2018-05-26  4:53 ` [PATCH net-next 14/14] nfp: abm: report correct MQ stats Jakub Kicinski
2018-05-29 13:51 ` [PATCH net-next 00/14] nfp: abm: RED/MQ qdisc offload David Miller

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=20180528160507.4a2ff81a@cakuba \
    --to=jakub.kicinski@netronome.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=davem@davemloft.net \
    --cc=gerlitz.or@gmail.com \
    --cc=jiri@resnulli.us \
    --cc=john.fastabend@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=nogah.frankel@gmail.com \
    --cc=nogahf@mellanox.com \
    --cc=oss-drivers@netronome.com \
    --cc=xiyou.wangcong@gmail.com \
    --cc=yuvalm@mellanox.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).