All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Machata <petrm@mellanox.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Ido Schimmel <idosch@idosch.org>,
	netdev@vger.kernel.org, davem@davemloft.net, jiri@mellanox.com,
	jhs@mojatatu.com, xiyou.wangcong@gmail.com, mlxsw@mellanox.com,
	Ido Schimmel <idosch@mellanox.com>
Subject: Re: [PATCH net-next 3/6] net: sched: RED: Introduce an ECN tail-dropping mode
Date: Tue, 10 Mar 2020 10:48:17 +0100	[thread overview]
Message-ID: <87tv2wy1zy.fsf@mellanox.com> (raw)
In-Reply-To: <20200309151255.29bb3a4b@kicinski-fedora-PC1C0HJN>


Jakub Kicinski <kuba@kernel.org> writes:

> On Mon,  9 Mar 2020 20:35:00 +0200 Ido Schimmel wrote:
>> diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c
>> index f9839d68b811..d72db7643a37 100644
>> --- a/net/sched/sch_red.c
>> +++ b/net/sched/sch_red.c
>> @@ -44,7 +44,8 @@ struct red_sched_data {
>>  	struct Qdisc		*qdisc;
>>  };
>>
>> -#define RED_SUPPORTED_FLAGS (TC_RED_ECN | TC_RED_HARDDROP | TC_RED_ADAPTATIVE)
>> +#define RED_SUPPORTED_FLAGS (TC_RED_ECN | TC_RED_HARDDROP | \
>> +			     TC_RED_ADAPTATIVE | TC_RED_TAILDROP)
>>
>>  static inline int red_use_ecn(struct red_sched_data *q)
>>  {
>> @@ -56,6 +57,11 @@ static inline int red_use_harddrop(struct red_sched_data *q)
>>  	return q->flags & TC_RED_HARDDROP;
>>  }
>>
>> +static inline int red_use_taildrop(struct red_sched_data *q)
>
> Please don't do static inlines in C code, even if the neighboring code
> does.

Ok.

>> +{
>> +	return q->flags & TC_RED_TAILDROP;
>> +}
>> +
>>  static int red_enqueue(struct sk_buff *skb, struct Qdisc *sch,
>>  		       struct sk_buff **to_free)
>>  {
>> @@ -76,23 +82,36 @@ static int red_enqueue(struct sk_buff *skb, struct Qdisc *sch,
>>
>>  	case RED_PROB_MARK:
>>  		qdisc_qstats_overlimit(sch);
>> -		if (!red_use_ecn(q) || !INET_ECN_set_ce(skb)) {
>> +		if (!red_use_ecn(q)) {
>>  			q->stats.prob_drop++;
>>  			goto congestion_drop;
>>  		}
>>
>> -		q->stats.prob_mark++;
>> +		if (INET_ECN_set_ce(skb)) {
>> +			q->stats.prob_mark++;
>> +		} else if (red_use_taildrop(q)) {
>
> This condition is inverted, no?
>
> If user requested taildrop the packet should be queued.

Argh, yes! I was meddling with different ways of coding the if-else
after Ido reviewed it and screwed it up. Thanks for catching it.

My tests have not caught this, because they all hit the hard mark case
:(

>> +			q->stats.prob_drop++;
>> +			goto congestion_drop;
>> +		}
>> +
>> +		/* Non-ECT packet in ECN taildrop mode: queue it. */
>>  		break;
>>
>>  	case RED_HARD_MARK:
>>  		qdisc_qstats_overlimit(sch);
>> -		if (red_use_harddrop(q) || !red_use_ecn(q) ||
>> -		    !INET_ECN_set_ce(skb)) {
>> +		if (red_use_harddrop(q) || !red_use_ecn(q)) {
>> +			q->stats.forced_drop++;
>> +			goto congestion_drop;
>> +		}
>> +
>> +		if (INET_ECN_set_ce(skb)) {
>> +			q->stats.forced_mark++;
>> +		} else if (!red_use_taildrop(q)) {
>
> This one looks correct.
>
>>  			q->stats.forced_drop++;
>>  			goto congestion_drop;
>>  		}
>>
>> -		q->stats.forced_mark++;
>> +		/* Non-ECT packet in ECN taildrop mode: queue it. */
>>  		break;
>>  	}
>>

  reply	other threads:[~2020-03-10  9:48 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-09 18:34 [PATCH net-next 0/6] RED: Introduce an ECN tail-dropping mode Ido Schimmel
2020-03-09 18:34 ` [PATCH net-next 1/6] selftests: qdiscs: Add TDC test for RED Ido Schimmel
2020-03-10 15:40   ` Roman Mashak
2020-03-10 16:56     ` Petr Machata
2020-03-10 17:28       ` Roman Mashak
2020-03-09 18:34 ` [PATCH net-next 2/6] net: sched: Add centralized RED flag checking Ido Schimmel
2020-03-09 22:18   ` Jakub Kicinski
2020-03-10  9:48     ` Petr Machata
2020-03-10 19:53       ` Jakub Kicinski
2020-03-10 22:23         ` Petr Machata
2020-03-10 23:00           ` Jakub Kicinski
2020-03-10 23:53             ` Petr Machata
2020-03-09 18:35 ` [PATCH net-next 3/6] net: sched: RED: Introduce an ECN tail-dropping mode Ido Schimmel
2020-03-09 22:12   ` Jakub Kicinski
2020-03-10  9:48     ` Petr Machata [this message]
2020-03-09 18:35 ` [PATCH net-next 4/6] mlxsw: spectrum_qdisc: Offload RED " Ido Schimmel
2020-03-09 18:35 ` [PATCH net-next 5/6] selftests: qdiscs: RED: Add taildrop tests Ido Schimmel
2020-03-09 18:35 ` [PATCH net-next 6/6] selftests: mlxsw: RED: Test RED ECN taildrop offload Ido Schimmel

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=87tv2wy1zy.fsf@mellanox.com \
    --to=petrm@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=idosch@idosch.org \
    --cc=idosch@mellanox.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@mellanox.com \
    --cc=kuba@kernel.org \
    --cc=mlxsw@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.