All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/6] RED: Introduce an ECN tail-dropping mode
@ 2020-03-11 17:33 Petr Machata
  2020-03-11 17:33 ` [PATCH net-next v2 1/6] selftests: qdiscs: Add TDC test for RED Petr Machata
                   ` (6 more replies)
  0 siblings, 7 replies; 21+ messages in thread
From: Petr Machata @ 2020-03-11 17:33 UTC (permalink / raw)
  To: netdev
  Cc: Petr Machata, Jakub Kicinski, Roman Mashak, jhs, xiyou.wangcong,
	davem, jiri, mlxsw

When the RED qdisc is currently configured to enable ECN, the RED algorithm
is used to decide whether a certain SKB should be marked. If that SKB is
not ECN-capable, it is early-dropped.

It is also possible to keep all traffic in the queue, and just mark the
ECN-capable subset of it, as appropriate under the RED algorithm. Some
switches support this mode, and some installations make use of it.
There is currently no way to put the RED qdiscs to this mode.

Therefore this patchset adds a new RED flag, TC_RED_TAILDROP. When the
qdisc is configured with this flag, non-ECT traffic is enqueued (and
tail-dropped when the queue size is exhausted) instead of being
early-dropped.

Unfortunately, adding a new RED flag is not as simple as it sounds. RED
flags are passed in tc_red_qopt.flags. However RED neglects to validate the
flag field, and just copies it over wholesale to its internal structure,
and later dumps it back.

A broken userspace can therefore configure a RED qdisc with arbitrary
unsupported flags, and later expect to see the flags on qdisc dump. The
current ABI thus allows storage of 5 bits of custom data along with the
qdisc instance.

GRED, SFQ and CHOKE qdiscs are in the same situation. (GRED validates VQ
flags, but not the flags for the main queue.) E.g. if SFQ ever needs to
support TC_RED_ADAPTATIVE, it needs another way of doing it, and at the
same time it needs to retain the possibility to store 6 bits of
uninterpreted data.

For RED, this problem is resolved in patch #2, which adds a new attribute,
and a way to separate flags from userbits that can be reused by other
qdiscs. The flag itself and related behavioral changes are added in patch
#3. In patch #4, the new mode is offloaded by mlxsw.

To test the new feature, patch #1 first introduces a TDC testsuite that
covers the existing RED flags. Patch #5 later extends it with taildrop
coverage. Patch #6 contains a forwarding selftest for the offloaded
datapath.

To test the SW datapath, I took the mlxsw selftest and adapted it in mostly
obvious ways. The test is stable enough to verify that RED, ECN and ECN
taildrop actually work. However, I have no confidence in its portability to
other people's machines or mildly different configurations. I therefore do
not find it suitable for upstreaming.

GRED and CHOKE can use the same method as RED if they ever need to support
extra flags. SFQ uses the length of TCA_OPTIONS to dispatch on binary
control structure version, and would therefore need a different approach.

v2:
- Patch #1
    - Require nsPlugin in each RED test
    - Match end-of-line to catch cases of more flags reported than
      requested
- Patch #2:
    - Replaced with another patch.
- Patch #3:
    - Fix red_use_taildrop() condition in red_enqueue switch for
      probabilistic case.
- Patch #5:
    - Require nsPlugin in each RED test
    - Match end-of-line to catch cases of more flags reported than
      requested
    - Add a test for creation of non-ECN taildrop, which should fail

Petr Machata (6):
  selftests: qdiscs: Add TDC test for RED
  net: sched: Allow extending set of supported RED flags
  net: sched: RED: Introduce an ECN tail-dropping mode
  mlxsw: spectrum_qdisc: Offload RED ECN tail-dropping mode
  selftests: qdiscs: RED: Add taildrop tests
  selftests: mlxsw: RED: Test RED ECN taildrop offload

 .../ethernet/mellanox/mlxsw/spectrum_qdisc.c  |   9 +-
 include/net/pkt_cls.h                         |   1 +
 include/net/red.h                             |  30 +++
 include/uapi/linux/pkt_sched.h                |  17 ++
 net/sched/sch_red.c                           |  53 ++++-
 .../drivers/net/mlxsw/sch_red_core.sh         |  50 ++++-
 .../drivers/net/mlxsw/sch_red_ets.sh          |  11 ++
 .../drivers/net/mlxsw/sch_red_root.sh         |   8 +
 .../tc-testing/tc-tests/qdiscs/red.json       | 185 ++++++++++++++++++
 9 files changed, 344 insertions(+), 20 deletions(-)
 create mode 100644 tools/testing/selftests/tc-testing/tc-tests/qdiscs/red.json

-- 
2.20.1


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH net-next v2 1/6] selftests: qdiscs: Add TDC test for RED
  2020-03-11 17:33 [PATCH net-next v2 0/6] RED: Introduce an ECN tail-dropping mode Petr Machata
@ 2020-03-11 17:33 ` Petr Machata
  2020-03-12  2:20   ` Roman Mashak
  2020-03-11 17:33 ` [PATCH net-next v2 2/6] net: sched: Allow extending set of supported RED flags Petr Machata
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 21+ messages in thread
From: Petr Machata @ 2020-03-11 17:33 UTC (permalink / raw)
  To: netdev
  Cc: Petr Machata, Jakub Kicinski, Roman Mashak, jhs, xiyou.wangcong,
	davem, jiri, mlxsw

Add a handful of tests for creating RED with different flags.

Signed-off-by: Petr Machata <petrm@mellanox.com>
---

Notes:
    v2:
    - Require nsPlugin in each RED test
    - Match end-of-line to catch cases of more flags reported than
      requested

 .../tc-testing/tc-tests/qdiscs/red.json       | 117 ++++++++++++++++++
 1 file changed, 117 insertions(+)
 create mode 100644 tools/testing/selftests/tc-testing/tc-tests/qdiscs/red.json

diff --git a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/red.json b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/red.json
new file mode 100644
index 000000000000..b70a54464897
--- /dev/null
+++ b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/red.json
@@ -0,0 +1,117 @@
+[
+    {
+        "id": "8b6e",
+        "name": "Create RED with no flags",
+        "category": [
+            "qdisc",
+            "red"
+        ],
+        "plugins": {
+            "requires": "nsPlugin"
+        },
+        "setup": [
+            "$IP link add dev $DUMMY type dummy || /bin/true"
+        ],
+        "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root red limit 1M avpkt 1500 min 100K max 300K",
+        "expExitCode": "0",
+        "verifyCmd": "$TC qdisc show dev $DUMMY",
+        "matchPattern": "qdisc red 1: root .* limit 1Mb min 100Kb max 300Kb $",
+        "matchCount": "1",
+        "teardown": [
+            "$TC qdisc del dev $DUMMY handle 1: root",
+            "$IP link del dev $DUMMY type dummy"
+        ]
+    },
+    {
+        "id": "342e",
+        "name": "Create RED with adaptive flag",
+        "category": [
+            "qdisc",
+            "red"
+        ],
+        "plugins": {
+            "requires": "nsPlugin"
+        },
+        "setup": [
+            "$IP link add dev $DUMMY type dummy || /bin/true"
+        ],
+        "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root red adaptive limit 1M avpkt 1500 min 100K max 300K",
+        "expExitCode": "0",
+        "verifyCmd": "$TC qdisc show dev $DUMMY",
+        "matchPattern": "qdisc red 1: root .* limit 1Mb min 100Kb max 300Kb adaptive $",
+        "matchCount": "1",
+        "teardown": [
+            "$TC qdisc del dev $DUMMY handle 1: root",
+            "$IP link del dev $DUMMY type dummy"
+        ]
+    },
+    {
+        "id": "2d4b",
+        "name": "Create RED with ECN flag",
+        "category": [
+            "qdisc",
+            "red"
+        ],
+        "plugins": {
+            "requires": "nsPlugin"
+        },
+        "setup": [
+            "$IP link add dev $DUMMY type dummy || /bin/true"
+        ],
+        "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root red ecn limit 1M avpkt 1500 min 100K max 300K",
+        "expExitCode": "0",
+        "verifyCmd": "$TC qdisc show dev $DUMMY",
+        "matchPattern": "qdisc red 1: root .* limit 1Mb min 100Kb max 300Kb ecn $",
+        "matchCount": "1",
+        "teardown": [
+            "$TC qdisc del dev $DUMMY handle 1: root",
+            "$IP link del dev $DUMMY type dummy"
+        ]
+    },
+    {
+        "id": "650f",
+        "name": "Create RED with flags ECN, adaptive",
+        "category": [
+            "qdisc",
+            "red"
+        ],
+        "plugins": {
+            "requires": "nsPlugin"
+        },
+        "setup": [
+            "$IP link add dev $DUMMY type dummy || /bin/true"
+        ],
+        "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root red ecn adaptive limit 1M avpkt 1500 min 100K max 300K",
+        "expExitCode": "0",
+        "verifyCmd": "$TC qdisc show dev $DUMMY",
+        "matchPattern": "qdisc red 1: root .* limit 1Mb min 100Kb max 300Kb ecn adaptive $",
+        "matchCount": "1",
+        "teardown": [
+            "$TC qdisc del dev $DUMMY handle 1: root",
+            "$IP link del dev $DUMMY type dummy"
+        ]
+    },
+    {
+        "id": "5f15",
+        "name": "Create RED with flags ECN, harddrop",
+        "category": [
+            "qdisc",
+            "red"
+        ],
+        "plugins": {
+            "requires": "nsPlugin"
+        },
+        "setup": [
+            "$IP link add dev $DUMMY type dummy || /bin/true"
+        ],
+        "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root red ecn harddrop limit 1M avpkt 1500 min 100K max 300K",
+        "expExitCode": "0",
+        "verifyCmd": "$TC qdisc show dev $DUMMY",
+        "matchPattern": "qdisc red 1: root .* limit 1Mb min 100Kb max 300Kb ecn harddrop $",
+        "matchCount": "1",
+        "teardown": [
+            "$TC qdisc del dev $DUMMY handle 1: root",
+            "$IP link del dev $DUMMY type dummy"
+        ]
+    }
+]
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH net-next v2 2/6] net: sched: Allow extending set of supported RED flags
  2020-03-11 17:33 [PATCH net-next v2 0/6] RED: Introduce an ECN tail-dropping mode Petr Machata
  2020-03-11 17:33 ` [PATCH net-next v2 1/6] selftests: qdiscs: Add TDC test for RED Petr Machata
@ 2020-03-11 17:33 ` Petr Machata
  2020-03-11 22:09   ` Jakub Kicinski
  2020-03-11 17:33 ` [PATCH net-next v2 3/6] net: sched: RED: Introduce an ECN tail-dropping mode Petr Machata
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 21+ messages in thread
From: Petr Machata @ 2020-03-11 17:33 UTC (permalink / raw)
  To: netdev
  Cc: Petr Machata, Jakub Kicinski, Roman Mashak, jhs, xiyou.wangcong,
	davem, jiri, mlxsw

The qdiscs RED, GRED, SFQ and CHOKE use different subsets of the same pool
of global RED flags. These are passed in tc_red_qopt.flags. However none of
these qdiscs validate the flag field, and just copy it over wholesale to
internal structures, and later dump it back. (An exception is GRED, which
does validate for VQs -- however not for the main setup.)

A broken userspace can therefore configure a qdisc with arbitrary
unsupported flags, and later expect to see the flags on qdisc dump. The
current ABI therefore allows storage of several bits of custom data to
qdisc instances of the types mentioned above. How many bits, depends on
which flags are meaningful for the qdisc in question. E.g. SFQ recognizes
flags ECN and HARDDROP, and the rest is not interpreted.

If SFQ ever needs to support ADAPTATIVE, it needs another way of doing it,
and at the same time it needs to retain the possibility to store 6 bits of
uninterpreted data. Likewise RED, which adds a new flag later in this
patchset.

To that end, this patch adds a new function, red_get_flags(), to split the
passed flags of RED-like qdiscs to flags and user bits, and to validate the
flags that are passed in. It further adds a new attribute, TCA_RED_FLAGS,
to pass arbitrary flags.

Signed-off-by: Petr Machata <petrm@mellanox.com>
---

Notes:
    v2:
    - This patch is new.

 include/net/red.h              | 25 +++++++++++++++++++++++++
 include/uapi/linux/pkt_sched.h | 16 ++++++++++++++++
 net/sched/sch_red.c            | 24 +++++++++++++++++++++---
 3 files changed, 62 insertions(+), 3 deletions(-)

diff --git a/include/net/red.h b/include/net/red.h
index 9665582c4687..5718d2b25637 100644
--- a/include/net/red.h
+++ b/include/net/red.h
@@ -179,6 +179,31 @@ static inline bool red_check_params(u32 qth_min, u32 qth_max, u8 Wlog)
 	return true;
 }
 
+static inline bool red_get_flags(unsigned char flags,
+				 unsigned char historic_mask,
+				 struct nlattr *flags_attr,
+				 unsigned int supported_mask,
+				 unsigned int *p_flags, unsigned char *p_userbits,
+				 struct netlink_ext_ack *extack)
+{
+	if (flags && flags_attr) {
+		NL_SET_ERR_MSG_MOD(extack, "flags should be passed either through qopt, or through a dedicated attribute");
+		return false;
+	}
+
+	*p_flags = flags & historic_mask;
+	if (flags_attr)
+		*p_flags |= nla_get_u32(flags_attr);
+
+	if (*p_flags & ~supported_mask) {
+		NL_SET_ERR_MSG_MOD(extack, "unsupported RED flags specified");
+		return false;
+	}
+
+	*p_userbits = flags & ~historic_mask;
+	return true;
+}
+
 static inline void red_set_parms(struct red_parms *p,
 				 u32 qth_min, u32 qth_max, u8 Wlog, u8 Plog,
 				 u8 Scell_log, u8 *stab, u32 max_P)
diff --git a/include/uapi/linux/pkt_sched.h b/include/uapi/linux/pkt_sched.h
index bbe791b24168..277df546e1a9 100644
--- a/include/uapi/linux/pkt_sched.h
+++ b/include/uapi/linux/pkt_sched.h
@@ -256,6 +256,7 @@ enum {
 	TCA_RED_PARMS,
 	TCA_RED_STAB,
 	TCA_RED_MAX_P,
+	TCA_RED_FLAGS,		/* u32 */
 	__TCA_RED_MAX,
 };
 
@@ -268,12 +269,27 @@ struct tc_red_qopt {
 	unsigned char   Wlog;		/* log(W)		*/
 	unsigned char   Plog;		/* log(P_max/(qth_max-qth_min))	*/
 	unsigned char   Scell_log;	/* cell size for idle damping */
+
+	/* This field can be used for flags that a RED-like qdisc has
+	 * historically supported. E.g. when configuring RED, it can be used for
+	 * ECN, HARDDROP and ADAPTATIVE. For SFQ it can be used for ECN,
+	 * HARDDROP. Etc. Because this field has not been validated, and is
+	 * copied back on dump, any bits besides those to which a given qdisc
+	 * has assigned a historical meaning need to be considered for free use
+	 * by userspace tools.
+	 *
+	 * Any further flags need to be passed differently, e.g. through an
+	 * attribute (such as TCA_RED_FLAGS above). Such attribute should allow
+	 * passing both recent and historic flags in one value.
+	 */
 	unsigned char	flags;
 #define TC_RED_ECN		1
 #define TC_RED_HARDDROP		2
 #define TC_RED_ADAPTATIVE	4
 };
 
+#define TC_RED_HISTORIC_FLAGS (TC_RED_ECN | TC_RED_HARDDROP | TC_RED_ADAPTATIVE)
+
 struct tc_red_xstats {
 	__u32           early;          /* Early drops */
 	__u32           pdrop;          /* Drops due to queue limits */
diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c
index 1695421333e3..61d7c5a61279 100644
--- a/net/sched/sch_red.c
+++ b/net/sched/sch_red.c
@@ -35,7 +35,11 @@
 
 struct red_sched_data {
 	u32			limit;		/* HARD maximal queue length */
-	unsigned char		flags;
+
+	u32			flags;
+	/* Non-flags in tc_red_qopt.flags. */
+	unsigned char		userbits;
+
 	struct timer_list	adapt_timer;
 	struct Qdisc		*sch;
 	struct red_parms	parms;
@@ -44,6 +48,8 @@ struct red_sched_data {
 	struct Qdisc		*qdisc;
 };
 
+#define RED_SUPPORTED_FLAGS TC_RED_HISTORIC_FLAGS
+
 static inline int red_use_ecn(struct red_sched_data *q)
 {
 	return q->flags & TC_RED_ECN;
@@ -186,6 +192,7 @@ static const struct nla_policy red_policy[TCA_RED_MAX + 1] = {
 	[TCA_RED_PARMS]	= { .len = sizeof(struct tc_red_qopt) },
 	[TCA_RED_STAB]	= { .len = RED_STAB_SIZE },
 	[TCA_RED_MAX_P] = { .type = NLA_U32 },
+	[TCA_RED_FLAGS] = { .type = NLA_U32 },
 };
 
 static int red_change(struct Qdisc *sch, struct nlattr *opt,
@@ -195,6 +202,8 @@ static int red_change(struct Qdisc *sch, struct nlattr *opt,
 	struct red_sched_data *q = qdisc_priv(sch);
 	struct nlattr *tb[TCA_RED_MAX + 1];
 	struct tc_red_qopt *ctl;
+	unsigned char userbits;
+	u32 flags;
 	int err;
 	u32 max_P;
 
@@ -216,6 +225,11 @@ static int red_change(struct Qdisc *sch, struct nlattr *opt,
 	if (!red_check_params(ctl->qth_min, ctl->qth_max, ctl->Wlog))
 		return -EINVAL;
 
+	if (!red_get_flags(ctl->flags, TC_RED_HISTORIC_FLAGS,
+			   tb[TCA_RED_FLAGS], RED_SUPPORTED_FLAGS,
+			   &flags, &userbits, extack))
+		return -EINVAL;
+
 	if (ctl->limit > 0) {
 		child = fifo_create_dflt(sch, &bfifo_qdisc_ops, ctl->limit,
 					 extack);
@@ -227,7 +241,8 @@ static int red_change(struct Qdisc *sch, struct nlattr *opt,
 	}
 
 	sch_tree_lock(sch);
-	q->flags = ctl->flags;
+	q->flags = flags;
+	q->userbits = userbits;
 	q->limit = ctl->limit;
 	if (child) {
 		qdisc_tree_flush_backlog(q->qdisc);
@@ -302,7 +317,8 @@ static int red_dump(struct Qdisc *sch, struct sk_buff *skb)
 	struct nlattr *opts = NULL;
 	struct tc_red_qopt opt = {
 		.limit		= q->limit,
-		.flags		= q->flags,
+		.flags		= ((q->flags & TC_RED_HISTORIC_FLAGS) |
+				   q->userbits),
 		.qth_min	= q->parms.qth_min >> q->parms.Wlog,
 		.qth_max	= q->parms.qth_max >> q->parms.Wlog,
 		.Wlog		= q->parms.Wlog,
@@ -321,6 +337,8 @@ static int red_dump(struct Qdisc *sch, struct sk_buff *skb)
 	if (nla_put(skb, TCA_RED_PARMS, sizeof(opt), &opt) ||
 	    nla_put_u32(skb, TCA_RED_MAX_P, q->parms.max_P))
 		goto nla_put_failure;
+	if (q->flags & ~TC_RED_HISTORIC_FLAGS)
+		nla_put_u32(skb, TCA_RED_FLAGS, q->flags);
 	return nla_nest_end(skb, opts);
 
 nla_put_failure:
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH net-next v2 3/6] net: sched: RED: Introduce an ECN tail-dropping mode
  2020-03-11 17:33 [PATCH net-next v2 0/6] RED: Introduce an ECN tail-dropping mode Petr Machata
  2020-03-11 17:33 ` [PATCH net-next v2 1/6] selftests: qdiscs: Add TDC test for RED Petr Machata
  2020-03-11 17:33 ` [PATCH net-next v2 2/6] net: sched: Allow extending set of supported RED flags Petr Machata
@ 2020-03-11 17:33 ` Petr Machata
  2020-03-11 18:36   ` Eric Dumazet
  2020-03-12 10:17   ` Petr Machata
  2020-03-11 17:33 ` [PATCH net-next v2 4/6] mlxsw: spectrum_qdisc: Offload RED " Petr Machata
                   ` (3 subsequent siblings)
  6 siblings, 2 replies; 21+ messages in thread
From: Petr Machata @ 2020-03-11 17:33 UTC (permalink / raw)
  To: netdev
  Cc: Petr Machata, Jakub Kicinski, Roman Mashak, jhs, xiyou.wangcong,
	davem, jiri, mlxsw

When the RED Qdisc is currently configured to enable ECN, the RED algorithm
is used to decide whether a certain SKB should be marked. If that SKB is
not ECN-capable, it is early-dropped.

It is also possible to keep all traffic in the queue, and just mark the
ECN-capable subset of it, as appropriate under the RED algorithm. Some
switches support this mode, and some installations make use of it.

To that end, add a new RED flag, TC_RED_TAILDROP. When the Qdisc is
configured with this flag, non-ECT traffic is enqueued (and tail-dropped
when the queue size is exhausted) instead of being early-dropped.

Signed-off-by: Petr Machata <petrm@mellanox.com>
---

Notes:
    v2:
    - Fix red_use_taildrop() condition in red_enqueue switch for
      probabilistic case.

 include/net/pkt_cls.h          |  1 +
 include/net/red.h              |  5 +++++
 include/uapi/linux/pkt_sched.h |  1 +
 net/sched/sch_red.c            | 31 +++++++++++++++++++++++++------
 4 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index 341a66af8d59..9ad369aba678 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -727,6 +727,7 @@ struct tc_red_qopt_offload_params {
 	u32 limit;
 	bool is_ecn;
 	bool is_harddrop;
+	bool is_taildrop;
 	struct gnet_stats_queue *qstats;
 };
 
diff --git a/include/net/red.h b/include/net/red.h
index 5718d2b25637..372b4988118c 100644
--- a/include/net/red.h
+++ b/include/net/red.h
@@ -200,6 +200,11 @@ static inline bool red_get_flags(unsigned char flags,
 		return false;
 	}
 
+	if ((*p_flags & TC_RED_TAILDROP) && !(*p_flags & TC_RED_ECN)) {
+		NL_SET_ERR_MSG_MOD(extack, "taildrop mode is only meaningful with ECN");
+		return false;
+	}
+
 	*p_userbits = flags & ~historic_mask;
 	return true;
 }
diff --git a/include/uapi/linux/pkt_sched.h b/include/uapi/linux/pkt_sched.h
index 277df546e1a9..45d1c0e6444e 100644
--- a/include/uapi/linux/pkt_sched.h
+++ b/include/uapi/linux/pkt_sched.h
@@ -286,6 +286,7 @@ struct tc_red_qopt {
 #define TC_RED_ECN		1
 #define TC_RED_HARDDROP		2
 #define TC_RED_ADAPTATIVE	4
+#define TC_RED_TAILDROP		8
 };
 
 #define TC_RED_HISTORIC_FLAGS (TC_RED_ECN | TC_RED_HARDDROP | TC_RED_ADAPTATIVE)
diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c
index 61d7c5a61279..1474f973ec6d 100644
--- a/net/sched/sch_red.c
+++ b/net/sched/sch_red.c
@@ -48,7 +48,7 @@ struct red_sched_data {
 	struct Qdisc		*qdisc;
 };
 
-#define RED_SUPPORTED_FLAGS TC_RED_HISTORIC_FLAGS
+#define RED_SUPPORTED_FLAGS (TC_RED_HISTORIC_FLAGS | TC_RED_TAILDROP)
 
 static inline int red_use_ecn(struct red_sched_data *q)
 {
@@ -60,6 +60,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)
+{
+	return q->flags & TC_RED_TAILDROP;
+}
+
 static int red_enqueue(struct sk_buff *skb, struct Qdisc *sch,
 		       struct sk_buff **to_free)
 {
@@ -80,23 +85,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)) {
+			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;
 		}
 
-		q->stats.forced_mark++;
+		if (INET_ECN_set_ce(skb)) {
+			q->stats.forced_mark++;
+		} else if (!red_use_taildrop(q)) {
+			q->stats.forced_drop++;
+			goto congestion_drop;
+		}
+
+		/* Non-ECT packet in ECN taildrop mode: queue it. */
 		break;
 	}
 
@@ -171,6 +189,7 @@ static int red_offload(struct Qdisc *sch, bool enable)
 		opt.set.limit = q->limit;
 		opt.set.is_ecn = red_use_ecn(q);
 		opt.set.is_harddrop = red_use_harddrop(q);
+		opt.set.is_taildrop = red_use_taildrop(q);
 		opt.set.qstats = &sch->qstats;
 	} else {
 		opt.command = TC_RED_DESTROY;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH net-next v2 4/6] mlxsw: spectrum_qdisc: Offload RED ECN tail-dropping mode
  2020-03-11 17:33 [PATCH net-next v2 0/6] RED: Introduce an ECN tail-dropping mode Petr Machata
                   ` (2 preceding siblings ...)
  2020-03-11 17:33 ` [PATCH net-next v2 3/6] net: sched: RED: Introduce an ECN tail-dropping mode Petr Machata
@ 2020-03-11 17:33 ` Petr Machata
  2020-03-11 17:33 ` [PATCH net-next v2 5/6] selftests: qdiscs: RED: Add taildrop tests Petr Machata
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 21+ messages in thread
From: Petr Machata @ 2020-03-11 17:33 UTC (permalink / raw)
  To: netdev
  Cc: Petr Machata, Jakub Kicinski, Roman Mashak, jhs, xiyou.wangcong,
	davem, jiri, mlxsw, Ido Schimmel

RED ECN tail-dropping mode means that non-ECT traffic should not be
early-dropped, but enqueued normally instead. In Spectrum systems, this is
achieved by disabling CWTPM.ew (enable WRED) for a given traffic class.

So far CWTPM.ew was unconditionally enabled. Instead disable it when the
RED qdisc is in taildrop mode.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c
index b9f429ec0db4..dee89298122c 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c
@@ -323,7 +323,7 @@ mlxsw_sp_qdisc_get_tc_stats(struct mlxsw_sp_port *mlxsw_sp_port,
 static int
 mlxsw_sp_tclass_congestion_enable(struct mlxsw_sp_port *mlxsw_sp_port,
 				  int tclass_num, u32 min, u32 max,
-				  u32 probability, bool is_ecn)
+				  u32 probability, bool is_wred, bool is_ecn)
 {
 	char cwtpm_cmd[MLXSW_REG_CWTPM_LEN];
 	char cwtp_cmd[MLXSW_REG_CWTP_LEN];
@@ -341,7 +341,7 @@ mlxsw_sp_tclass_congestion_enable(struct mlxsw_sp_port *mlxsw_sp_port,
 		return err;
 
 	mlxsw_reg_cwtpm_pack(cwtpm_cmd, mlxsw_sp_port->local_port, tclass_num,
-			     MLXSW_REG_CWTP_DEFAULT_PROFILE, true, is_ecn);
+			     MLXSW_REG_CWTP_DEFAULT_PROFILE, is_wred, is_ecn);
 
 	return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(cwtpm), cwtpm_cmd);
 }
@@ -445,8 +445,9 @@ mlxsw_sp_qdisc_red_replace(struct mlxsw_sp_port *mlxsw_sp_port, u32 handle,
 	prob = DIV_ROUND_UP(prob, 1 << 16);
 	min = mlxsw_sp_bytes_cells(mlxsw_sp, p->min);
 	max = mlxsw_sp_bytes_cells(mlxsw_sp, p->max);
-	return mlxsw_sp_tclass_congestion_enable(mlxsw_sp_port, tclass_num, min,
-						 max, prob, p->is_ecn);
+	return mlxsw_sp_tclass_congestion_enable(mlxsw_sp_port, tclass_num,
+						 min, max, prob,
+						 !p->is_taildrop, p->is_ecn);
 }
 
 static void
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH net-next v2 5/6] selftests: qdiscs: RED: Add taildrop tests
  2020-03-11 17:33 [PATCH net-next v2 0/6] RED: Introduce an ECN tail-dropping mode Petr Machata
                   ` (3 preceding siblings ...)
  2020-03-11 17:33 ` [PATCH net-next v2 4/6] mlxsw: spectrum_qdisc: Offload RED " Petr Machata
@ 2020-03-11 17:33 ` Petr Machata
  2020-03-12  2:21   ` Roman Mashak
  2020-03-11 17:33 ` [PATCH net-next v2 6/6] selftests: mlxsw: RED: Test RED ECN taildrop offload Petr Machata
  2020-03-15  4:04 ` [PATCH net-next v2 0/6] RED: Introduce an ECN tail-dropping mode David Miller
  6 siblings, 1 reply; 21+ messages in thread
From: Petr Machata @ 2020-03-11 17:33 UTC (permalink / raw)
  To: netdev
  Cc: Petr Machata, Jakub Kicinski, Roman Mashak, jhs, xiyou.wangcong,
	davem, jiri, mlxsw

Add tests for the new "taildrop" flag.

Signed-off-by: Petr Machata <petrm@mellanox.com>
---

Notes:
    v2:
    - Require nsPlugin in each RED test
    - Match end-of-line to catch cases of more flags reported than
      requested
    - Add a test for creation of non-ECN taildrop, which should fail

 .../tc-testing/tc-tests/qdiscs/red.json       | 68 +++++++++++++++++++
 1 file changed, 68 insertions(+)

diff --git a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/red.json b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/red.json
index b70a54464897..72676073c658 100644
--- a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/red.json
+++ b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/red.json
@@ -113,5 +113,73 @@
             "$TC qdisc del dev $DUMMY handle 1: root",
             "$IP link del dev $DUMMY type dummy"
         ]
+    },
+    {
+        "id": "53e8",
+        "name": "Create RED with flags ECN, taildrop",
+        "category": [
+            "qdisc",
+            "red"
+        ],
+        "plugins": {
+            "requires": "nsPlugin"
+        },
+        "setup": [
+            "$IP link add dev $DUMMY type dummy || /bin/true"
+        ],
+        "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root red ecn taildrop limit 1M avpkt 1500 min 100K max 300K",
+        "expExitCode": "0",
+        "verifyCmd": "$TC qdisc show dev $DUMMY",
+        "matchPattern": "qdisc red 1: root .* limit 1Mb min 100Kb max 300Kb ecn taildrop $",
+        "matchCount": "1",
+        "teardown": [
+            "$TC qdisc del dev $DUMMY handle 1: root",
+            "$IP link del dev $DUMMY type dummy"
+        ]
+    },
+    {
+        "id": "d091",
+        "name": "Fail to create RED with only taildrop flag",
+        "category": [
+            "qdisc",
+            "red"
+        ],
+        "plugins": {
+            "requires": "nsPlugin"
+        },
+        "setup": [
+            "$IP link add dev $DUMMY type dummy || /bin/true"
+        ],
+        "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root red taildrop limit 1M avpkt 1500 min 100K max 300K",
+        "expExitCode": "2",
+        "verifyCmd": "$TC qdisc show dev $DUMMY",
+        "matchPattern": "qdisc red",
+        "matchCount": "0",
+        "teardown": [
+            "$IP link del dev $DUMMY type dummy"
+        ]
+    },
+    {
+        "id": "af8e",
+        "name": "Create RED with flags ECN, taildrop, harddrop",
+        "category": [
+            "qdisc",
+            "red"
+        ],
+        "plugins": {
+            "requires": "nsPlugin"
+        },
+        "setup": [
+            "$IP link add dev $DUMMY type dummy || /bin/true"
+        ],
+        "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root red ecn harddrop taildrop limit 1M avpkt 1500 min 100K max 300K",
+        "expExitCode": "0",
+        "verifyCmd": "$TC qdisc show dev $DUMMY",
+        "matchPattern": "qdisc red 1: root .* limit 1Mb min 100Kb max 300Kb ecn harddrop taildrop $",
+        "matchCount": "1",
+        "teardown": [
+            "$TC qdisc del dev $DUMMY handle 1: root",
+            "$IP link del dev $DUMMY type dummy"
+        ]
     }
 ]
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH net-next v2 6/6] selftests: mlxsw: RED: Test RED ECN taildrop offload
  2020-03-11 17:33 [PATCH net-next v2 0/6] RED: Introduce an ECN tail-dropping mode Petr Machata
                   ` (4 preceding siblings ...)
  2020-03-11 17:33 ` [PATCH net-next v2 5/6] selftests: qdiscs: RED: Add taildrop tests Petr Machata
@ 2020-03-11 17:33 ` Petr Machata
  2020-03-15  4:04 ` [PATCH net-next v2 0/6] RED: Introduce an ECN tail-dropping mode David Miller
  6 siblings, 0 replies; 21+ messages in thread
From: Petr Machata @ 2020-03-11 17:33 UTC (permalink / raw)
  To: netdev
  Cc: Petr Machata, Jakub Kicinski, Roman Mashak, jhs, xiyou.wangcong,
	davem, jiri, mlxsw, Ido Schimmel

Extend RED testsuite to cover the new "taildropping" mode of RED-ECN. This
test is really similar to ECN test, diverging only in the last step, where
UDP traffic should go to backlog instead of being dropped. Thus extract a
common helper, ecn_test_common(), make do_ecn_test() into a relatively
simple wrapper, and add another one, do_ecn_taildrop_test().

Signed-off-by: Petr Machata <petrm@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
---
 .../drivers/net/mlxsw/sch_red_core.sh         | 50 ++++++++++++++++---
 .../drivers/net/mlxsw/sch_red_ets.sh          | 11 ++++
 .../drivers/net/mlxsw/sch_red_root.sh         |  8 +++
 3 files changed, 61 insertions(+), 8 deletions(-)

diff --git a/tools/testing/selftests/drivers/net/mlxsw/sch_red_core.sh b/tools/testing/selftests/drivers/net/mlxsw/sch_red_core.sh
index 8f833678ac4d..fc7986db3fe0 100644
--- a/tools/testing/selftests/drivers/net/mlxsw/sch_red_core.sh
+++ b/tools/testing/selftests/drivers/net/mlxsw/sch_red_core.sh
@@ -389,17 +389,14 @@ check_marking()
 	((pct $cond))
 }
 
-do_ecn_test()
+ecn_test_common()
 {
+	local name=$1; shift
 	local vlan=$1; shift
 	local limit=$1; shift
 	local backlog
 	local pct
 
-	# Main stream.
-	start_tcp_traffic $h1.$vlan $(ipaddr 1 $vlan) $(ipaddr 3 $vlan) \
-			  $h3_mac tos=0x01
-
 	# Build the below-the-limit backlog using UDP. We could use TCP just
 	# fine, but this way we get a proof that UDP is accepted when queue
 	# length is below the limit. The main stream is using TCP, and if the
@@ -409,7 +406,7 @@ do_ecn_test()
 	check_err $? "Could not build the requested backlog"
 	pct=$(check_marking $vlan "== 0")
 	check_err $? "backlog $backlog / $limit Got $pct% marked packets, expected == 0."
-	log_test "TC $((vlan - 10)): ECN backlog < limit"
+	log_test "TC $((vlan - 10)): $name backlog < limit"
 
 	# Now push TCP, because non-TCP traffic would be early-dropped after the
 	# backlog crosses the limit, and we want to make sure that the backlog
@@ -419,7 +416,20 @@ do_ecn_test()
 	check_err $? "Could not build the requested backlog"
 	pct=$(check_marking $vlan ">= 95")
 	check_err $? "backlog $backlog / $limit Got $pct% marked packets, expected >= 95."
-	log_test "TC $((vlan - 10)): ECN backlog > limit"
+	log_test "TC $((vlan - 10)): $name backlog > limit"
+}
+
+do_ecn_test()
+{
+	local vlan=$1; shift
+	local limit=$1; shift
+	local name=ECN
+
+	start_tcp_traffic $h1.$vlan $(ipaddr 1 $vlan) $(ipaddr 3 $vlan) \
+			  $h3_mac tos=0x01
+	sleep 1
+
+	ecn_test_common "$name" $vlan $limit
 
 	# Up there we saw that UDP gets accepted when backlog is below the
 	# limit. Now that it is above, it should all get dropped, and backlog
@@ -427,7 +437,31 @@ do_ecn_test()
 	RET=0
 	build_backlog $vlan $((2 * limit)) udp >/dev/null
 	check_fail $? "UDP traffic went into backlog instead of being early-dropped"
-	log_test "TC $((vlan - 10)): ECN backlog > limit: UDP early-dropped"
+	log_test "TC $((vlan - 10)): $name backlog > limit: UDP early-dropped"
+
+	stop_traffic
+	sleep 1
+}
+
+do_ecn_taildrop_test()
+{
+	local vlan=$1; shift
+	local limit=$1; shift
+	local name="ECN taildrop"
+
+	start_tcp_traffic $h1.$vlan $(ipaddr 1 $vlan) $(ipaddr 3 $vlan) \
+			  $h3_mac tos=0x01
+	sleep 1
+
+	ecn_test_common "$name" $vlan $limit
+
+	# Up there we saw that UDP gets accepted when backlog is below the
+	# limit. Now that it is above, in taildrop mode, make sure it goes to
+	# backlog as well.
+	RET=0
+	build_backlog $vlan $((2 * limit)) udp >/dev/null
+	check_err $? "UDP traffic was early-dropped instead of getting into backlog"
+	log_test "TC $((vlan - 10)): $name backlog > limit: UDP tail-dropped"
 
 	stop_traffic
 	sleep 1
diff --git a/tools/testing/selftests/drivers/net/mlxsw/sch_red_ets.sh b/tools/testing/selftests/drivers/net/mlxsw/sch_red_ets.sh
index af83efe9ccf1..042a33cc13f4 100755
--- a/tools/testing/selftests/drivers/net/mlxsw/sch_red_ets.sh
+++ b/tools/testing/selftests/drivers/net/mlxsw/sch_red_ets.sh
@@ -4,6 +4,7 @@
 ALL_TESTS="
 	ping_ipv4
 	ecn_test
+	ecn_taildrop_test
 	red_test
 	mc_backlog_test
 "
@@ -50,6 +51,16 @@ ecn_test()
 	uninstall_qdisc
 }
 
+ecn_taildrop_test()
+{
+	install_qdisc ecn taildrop
+
+	do_ecn_taildrop_test 10 $BACKLOG1
+	do_ecn_taildrop_test 11 $BACKLOG2
+
+	uninstall_qdisc
+}
+
 red_test()
 {
 	install_qdisc
diff --git a/tools/testing/selftests/drivers/net/mlxsw/sch_red_root.sh b/tools/testing/selftests/drivers/net/mlxsw/sch_red_root.sh
index b2217493a88e..af55672dc335 100755
--- a/tools/testing/selftests/drivers/net/mlxsw/sch_red_root.sh
+++ b/tools/testing/selftests/drivers/net/mlxsw/sch_red_root.sh
@@ -4,6 +4,7 @@
 ALL_TESTS="
 	ping_ipv4
 	ecn_test
+	ecn_taildrop_test
 	red_test
 	mc_backlog_test
 "
@@ -33,6 +34,13 @@ ecn_test()
 	uninstall_qdisc
 }
 
+ecn_taildrop_test()
+{
+	install_qdisc ecn taildrop
+	do_ecn_taildrop_test 10 $BACKLOG
+	uninstall_qdisc
+}
+
 red_test()
 {
 	install_qdisc
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH net-next v2 3/6] net: sched: RED: Introduce an ECN tail-dropping mode
  2020-03-11 17:33 ` [PATCH net-next v2 3/6] net: sched: RED: Introduce an ECN tail-dropping mode Petr Machata
@ 2020-03-11 18:36   ` Eric Dumazet
  2020-03-12  0:42     ` Petr Machata
  2020-03-12 10:17   ` Petr Machata
  1 sibling, 1 reply; 21+ messages in thread
From: Eric Dumazet @ 2020-03-11 18:36 UTC (permalink / raw)
  To: Petr Machata, netdev
  Cc: Jakub Kicinski, Roman Mashak, jhs, xiyou.wangcong, davem, jiri, mlxsw



On 3/11/20 10:33 AM, Petr Machata wrote:
> When the RED Qdisc is currently configured to enable ECN, the RED algorithm
> is used to decide whether a certain SKB should be marked. If that SKB is
> not ECN-capable, it is early-dropped.
> 
> It is also possible to keep all traffic in the queue, and just mark the
> ECN-capable subset of it, as appropriate under the RED algorithm. Some
> switches support this mode, and some installations make use of it.
> 
> To that end, add a new RED flag, TC_RED_TAILDROP. When the Qdisc is
> configured with this flag, non-ECT traffic is enqueued (and tail-dropped
> when the queue size is exhausted) instead of being early-dropped.
> 

I find the naming of the feature very confusing.

When enabling this new feature, we no longer drop packets
that could not be CE marked.

Tail drop is already in the packet scheduler, you want to disable it.


How this feature has been named elsewhere ???
(you mentioned in your cover letter : 
"Some switches support this mode, and some installations make use of it.")


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net-next v2 2/6] net: sched: Allow extending set of supported RED flags
  2020-03-11 17:33 ` [PATCH net-next v2 2/6] net: sched: Allow extending set of supported RED flags Petr Machata
@ 2020-03-11 22:09   ` Jakub Kicinski
  2020-03-12  0:12     ` Petr Machata
  0 siblings, 1 reply; 21+ messages in thread
From: Jakub Kicinski @ 2020-03-11 22:09 UTC (permalink / raw)
  To: Petr Machata
  Cc: netdev, Roman Mashak, jhs, xiyou.wangcong, davem, jiri, mlxsw

On Wed, 11 Mar 2020 19:33:52 +0200 Petr Machata wrote:
> diff --git a/include/net/red.h b/include/net/red.h
> index 9665582c4687..5718d2b25637 100644
> --- a/include/net/red.h
> +++ b/include/net/red.h
> @@ -179,6 +179,31 @@ static inline bool red_check_params(u32 qth_min, u32 qth_max, u8 Wlog)
>  	return true;
>  }
>  
> +static inline bool red_get_flags(unsigned char flags,
> +				 unsigned char historic_mask,
> +				 struct nlattr *flags_attr,
> +				 unsigned int supported_mask,
> +				 unsigned int *p_flags, unsigned char *p_userbits,
> +				 struct netlink_ext_ack *extack)
> +{
> +	if (flags && flags_attr) {
> +		NL_SET_ERR_MSG_MOD(extack, "flags should be passed either through qopt, or through a dedicated attribute");
> +		return false;
> +	}
> +
> +	*p_flags = flags & historic_mask;
> +	if (flags_attr)
> +		*p_flags |= nla_get_u32(flags_attr);

It's less error prone for callers not to modify the output parameters
until we're sure the call won't fail.

> +	if (*p_flags & ~supported_mask) {
> +		NL_SET_ERR_MSG_MOD(extack, "unsupported RED flags specified");
> +		return false;
> +	}
> +
> +	*p_userbits = flags & ~historic_mask;
> +	return true;
> +}
> +

> +#define TC_RED_HISTORIC_FLAGS (TC_RED_ECN | TC_RED_HARDDROP | TC_RED_ADAPTATIVE)
> +
>  struct tc_red_xstats {
>  	__u32           early;          /* Early drops */
>  	__u32           pdrop;          /* Drops due to queue limits */
> diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c
> index 1695421333e3..61d7c5a61279 100644
> --- a/net/sched/sch_red.c
> +++ b/net/sched/sch_red.c
> @@ -35,7 +35,11 @@
>  
>  struct red_sched_data {
>  	u32			limit;		/* HARD maximal queue length */
> -	unsigned char		flags;
> +
> +	u32			flags;

Can we stick to uchar until the number of flags grows?

> +	/* Non-flags in tc_red_qopt.flags. */
> +	unsigned char		userbits;
> +
>  	struct timer_list	adapt_timer;
>  	struct Qdisc		*sch;
>  	struct red_parms	parms;
> @@ -44,6 +48,8 @@ struct red_sched_data {
>  	struct Qdisc		*qdisc;
>  };
>  
> +#define RED_SUPPORTED_FLAGS TC_RED_HISTORIC_FLAGS
> +
>  static inline int red_use_ecn(struct red_sched_data *q)
>  {
>  	return q->flags & TC_RED_ECN;
> @@ -186,6 +192,7 @@ static const struct nla_policy red_policy[TCA_RED_MAX + 1] = {
>  	[TCA_RED_PARMS]	= { .len = sizeof(struct tc_red_qopt) },
>  	[TCA_RED_STAB]	= { .len = RED_STAB_SIZE },
>  	[TCA_RED_MAX_P] = { .type = NLA_U32 },
> +	[TCA_RED_FLAGS] = { .type = NLA_U32 },

BITFIELD32? And then perhaps turn the define into a const validation
data?

Also policy needs a .strict_start_type now.

>  };
>  
>  static int red_change(struct Qdisc *sch, struct nlattr *opt,

> @@ -302,7 +317,8 @@ static int red_dump(struct Qdisc *sch, struct sk_buff *skb)
>  	struct nlattr *opts = NULL;
>  	struct tc_red_qopt opt = {
>  		.limit		= q->limit,
> -		.flags		= q->flags,
> +		.flags		= ((q->flags & TC_RED_HISTORIC_FLAGS) |
> +				   q->userbits),

nit: parens unnecessary

>  		.qth_min	= q->parms.qth_min >> q->parms.Wlog,
>  		.qth_max	= q->parms.qth_max >> q->parms.Wlog,
>  		.Wlog		= q->parms.Wlog,
> @@ -321,6 +337,8 @@ static int red_dump(struct Qdisc *sch, struct sk_buff *skb)
>  	if (nla_put(skb, TCA_RED_PARMS, sizeof(opt), &opt) ||
>  	    nla_put_u32(skb, TCA_RED_MAX_P, q->parms.max_P))
>  		goto nla_put_failure;
> +	if (q->flags & ~TC_RED_HISTORIC_FLAGS)
> +		nla_put_u32(skb, TCA_RED_FLAGS, q->flags);

Not 100% sure if conditional is needed, but please check the return
code.

>  	return nla_nest_end(skb, opts);
>  
>  nla_put_failure:


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net-next v2 2/6] net: sched: Allow extending set of supported RED flags
  2020-03-11 22:09   ` Jakub Kicinski
@ 2020-03-12  0:12     ` Petr Machata
  0 siblings, 0 replies; 21+ messages in thread
From: Petr Machata @ 2020-03-12  0:12 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: netdev, Roman Mashak, jhs, xiyou.wangcong, davem, jiri, mlxsw


Jakub Kicinski <kuba@kernel.org> writes:

> On Wed, 11 Mar 2020 19:33:52 +0200 Petr Machata wrote:
>> diff --git a/include/net/red.h b/include/net/red.h
>> index 9665582c4687..5718d2b25637 100644
>> --- a/include/net/red.h
>> +++ b/include/net/red.h
>> @@ -179,6 +179,31 @@ static inline bool red_check_params(u32 qth_min, u32 qth_max, u8 Wlog)
>>  	return true;
>>  }
>>  
>> +static inline bool red_get_flags(unsigned char flags,
>> +				 unsigned char historic_mask,
>> +				 struct nlattr *flags_attr,
>> +				 unsigned int supported_mask,
>> +				 unsigned int *p_flags, unsigned char *p_userbits,
>> +				 struct netlink_ext_ack *extack)
>> +{
>> +	if (flags && flags_attr) {
>> +		NL_SET_ERR_MSG_MOD(extack, "flags should be passed either through qopt, or through a dedicated attribute");
>> +		return false;
>> +	}
>> +
>> +	*p_flags = flags & historic_mask;
>> +	if (flags_attr)
>> +		*p_flags |= nla_get_u32(flags_attr);
>
> It's less error prone for callers not to modify the output parameters
> until we're sure the call won't fail.

Ack.

>> +	if (*p_flags & ~supported_mask) {
>> +		NL_SET_ERR_MSG_MOD(extack, "unsupported RED flags specified");
>> +		return false;
>> +	}
>> +
>> +	*p_userbits = flags & ~historic_mask;
>> +	return true;
>> +}
>> +
>
>> +#define TC_RED_HISTORIC_FLAGS (TC_RED_ECN | TC_RED_HARDDROP | TC_RED_ADAPTATIVE)
>> +
>>  struct tc_red_xstats {
>>  	__u32           early;          /* Early drops */
>>  	__u32           pdrop;          /* Drops due to queue limits */
>> diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c
>> index 1695421333e3..61d7c5a61279 100644
>> --- a/net/sched/sch_red.c
>> +++ b/net/sched/sch_red.c
>> @@ -35,7 +35,11 @@
>>  
>>  struct red_sched_data {
>>  	u32			limit;		/* HARD maximal queue length */
>> -	unsigned char		flags;
>> +
>> +	u32			flags;
>
> Can we stick to uchar until the number of flags grows?

No problem, but the attribute is u32.

>> +	/* Non-flags in tc_red_qopt.flags. */
>> +	unsigned char		userbits;
>> +
>>  	struct timer_list	adapt_timer;
>>  	struct Qdisc		*sch;
>>  	struct red_parms	parms;
>> @@ -44,6 +48,8 @@ struct red_sched_data {
>>  	struct Qdisc		*qdisc;
>>  };
>>  
>> +#define RED_SUPPORTED_FLAGS TC_RED_HISTORIC_FLAGS
>> +
>>  static inline int red_use_ecn(struct red_sched_data *q)
>>  {
>>  	return q->flags & TC_RED_ECN;
>> @@ -186,6 +192,7 @@ static const struct nla_policy red_policy[TCA_RED_MAX + 1] = {
>>  	[TCA_RED_PARMS]	= { .len = sizeof(struct tc_red_qopt) },
>>  	[TCA_RED_STAB]	= { .len = RED_STAB_SIZE },
>>  	[TCA_RED_MAX_P] = { .type = NLA_U32 },
>> +	[TCA_RED_FLAGS] = { .type = NLA_U32 },
>
> BITFIELD32? And then perhaps turn the define into a const validation
> data?

Nice.

> Also policy needs a .strict_start_type now.

OK.

>>  };
>>  
>>  static int red_change(struct Qdisc *sch, struct nlattr *opt,
>
>> @@ -302,7 +317,8 @@ static int red_dump(struct Qdisc *sch, struct sk_buff *skb)
>>  	struct nlattr *opts = NULL;
>>  	struct tc_red_qopt opt = {
>>  		.limit		= q->limit,
>> -		.flags		= q->flags,
>> +		.flags		= ((q->flags & TC_RED_HISTORIC_FLAGS) |
>> +				   q->userbits),
>
> nit: parens unnecessary

I'll drop them.

>>  		.qth_min	= q->parms.qth_min >> q->parms.Wlog,
>>  		.qth_max	= q->parms.qth_max >> q->parms.Wlog,
>>  		.Wlog		= q->parms.Wlog,
>> @@ -321,6 +337,8 @@ static int red_dump(struct Qdisc *sch, struct sk_buff *skb)
>>  	if (nla_put(skb, TCA_RED_PARMS, sizeof(opt), &opt) ||
>>  	    nla_put_u32(skb, TCA_RED_MAX_P, q->parms.max_P))
>>  		goto nla_put_failure;
>> +	if (q->flags & ~TC_RED_HISTORIC_FLAGS)
>> +		nla_put_u32(skb, TCA_RED_FLAGS, q->flags);
>
> Not 100% sure if conditional is needed, but please check the return
> code.

I didn't want to bother old-style clients with the new attribute.

I'll add the check.

>>  	return nla_nest_end(skb, opts);
>>  
>>  nla_put_failure:


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net-next v2 3/6] net: sched: RED: Introduce an ECN tail-dropping mode
  2020-03-11 18:36   ` Eric Dumazet
@ 2020-03-12  0:42     ` Petr Machata
  2020-03-12  1:01       ` Eric Dumazet
  0 siblings, 1 reply; 21+ messages in thread
From: Petr Machata @ 2020-03-12  0:42 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: netdev, Jakub Kicinski, Roman Mashak, jhs, xiyou.wangcong, davem,
	jiri, mlxsw


Eric Dumazet <eric.dumazet@gmail.com> writes:

> On 3/11/20 10:33 AM, Petr Machata wrote:
>> When the RED Qdisc is currently configured to enable ECN, the RED algorithm
>> is used to decide whether a certain SKB should be marked. If that SKB is
>> not ECN-capable, it is early-dropped.
>>
>> It is also possible to keep all traffic in the queue, and just mark the
>> ECN-capable subset of it, as appropriate under the RED algorithm. Some
>> switches support this mode, and some installations make use of it.
>>
>> To that end, add a new RED flag, TC_RED_TAILDROP. When the Qdisc is
>> configured with this flag, non-ECT traffic is enqueued (and tail-dropped
>> when the queue size is exhausted) instead of being early-dropped.
>>
>
> I find the naming of the feature very confusing.
>
> When enabling this new feature, we no longer drop packets
> that could not be CE marked.
> Tail drop is already in the packet scheduler, you want to disable it.
>
>
> How this feature has been named elsewhere ???
> (you mentioned in your cover letter :
> "Some switches support this mode, and some installations make use of it.")

The two interfaces that I know about are Juniper and Cumulus. I don't
know either from direct experience, but from the manual, Cumulus seems
to allow enablement of either ECN on its own[0], or ECN with RED[1]. (Or
RED on its own I presume, but I couldn't actually find that.)

In Juniper likewise, "on ECN-enabled queues, the switch [...] uses the
tail-drop algorithm to drop non-ECN-capable packets during periods of
congestion"[2]. You need to direct non-ECT traffic to a different queue
and configure RED on that to get the RED+ECN behavior ala Linux.

So this is unlike the RED qdisc, where RED is implied, and needs to be
turned off again by an anti-RED flag. The logic behind the chosen flag
name is that the opposite of early dropping is tail dropping. Note that
Juniper actually calls it that as well.

That said, I agree that from the perspective of the qdisc itself the
name does not make sense. We can make it "nodrop", or "nored", or maybe
"keep_non_ect"... I guess "nored" is closest to the desired effect.

[0] https://docs.cumulusnetworks.com/cumulus-linux-40/Layer-1-and-Switch-Ports/Buffer-and-Queue-Management/
[1] https://docs.cumulusnetworks.com/version/cumulus-linux-37/Network-Solutions/RDMA-over-Converged-Ethernet-RoCE/
[2] https://www.juniper.net/documentation/en_US/junos/topics/concept/cos-qfx-series-tail-drop-understanding.html

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net-next v2 3/6] net: sched: RED: Introduce an ECN tail-dropping mode
  2020-03-12  0:42     ` Petr Machata
@ 2020-03-12  1:01       ` Eric Dumazet
  2020-03-12  2:25         ` Jakub Kicinski
  0 siblings, 1 reply; 21+ messages in thread
From: Eric Dumazet @ 2020-03-12  1:01 UTC (permalink / raw)
  To: Petr Machata
  Cc: netdev, Jakub Kicinski, Roman Mashak, jhs, xiyou.wangcong, davem,
	jiri, mlxsw



On 3/11/20 5:42 PM, Petr Machata wrote:
> 
> Eric Dumazet <eric.dumazet@gmail.com> writes:
> 
>> On 3/11/20 10:33 AM, Petr Machata wrote:
>>> When the RED Qdisc is currently configured to enable ECN, the RED algorithm
>>> is used to decide whether a certain SKB should be marked. If that SKB is
>>> not ECN-capable, it is early-dropped.
>>>
>>> It is also possible to keep all traffic in the queue, and just mark the
>>> ECN-capable subset of it, as appropriate under the RED algorithm. Some
>>> switches support this mode, and some installations make use of it.
>>>
>>> To that end, add a new RED flag, TC_RED_TAILDROP. When the Qdisc is
>>> configured with this flag, non-ECT traffic is enqueued (and tail-dropped
>>> when the queue size is exhausted) instead of being early-dropped.
>>>
>>
>> I find the naming of the feature very confusing.
>>
>> When enabling this new feature, we no longer drop packets
>> that could not be CE marked.
>> Tail drop is already in the packet scheduler, you want to disable it.
>>
>>
>> How this feature has been named elsewhere ???
>> (you mentioned in your cover letter :
>> "Some switches support this mode, and some installations make use of it.")
> 
> The two interfaces that I know about are Juniper and Cumulus. I don't
> know either from direct experience, but from the manual, Cumulus seems
> to allow enablement of either ECN on its own[0], or ECN with RED[1]. (Or
> RED on its own I presume, but I couldn't actually find that.)
> 
> In Juniper likewise, "on ECN-enabled queues, the switch [...] uses the
> tail-drop algorithm to drop non-ECN-capable packets during periods of
> congestion"[2]. You need to direct non-ECT traffic to a different queue
> and configure RED on that to get the RED+ECN behavior ala Linux.
> 
> So this is unlike the RED qdisc, where RED is implied, and needs to be
> turned off again by an anti-RED flag. The logic behind the chosen flag
> name is that the opposite of early dropping is tail dropping. Note that
> Juniper actually calls it that as well.
> 
> That said, I agree that from the perspective of the qdisc itself the
> name does not make sense. We can make it "nodrop", or "nored", or maybe
> "keep_non_ect"... I guess "nored" is closest to the desired effect.

Well, red algo is still used to decide if we attempt ECN marking, so "nodrop"
seems better to me :)

> 
> [0] https://docs.cumulusnetworks.com/cumulus-linux-40/Layer-1-and-Switch-Ports/Buffer-and-Queue-Management/
> [1] https://docs.cumulusnetworks.com/version/cumulus-linux-37/Network-Solutions/RDMA-over-Converged-Ethernet-RoCE/
> [2] https://www.juniper.net/documentation/en_US/junos/topics/concept/cos-qfx-series-tail-drop-understanding.html
> 

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net-next v2 1/6] selftests: qdiscs: Add TDC test for RED
  2020-03-11 17:33 ` [PATCH net-next v2 1/6] selftests: qdiscs: Add TDC test for RED Petr Machata
@ 2020-03-12  2:20   ` Roman Mashak
  0 siblings, 0 replies; 21+ messages in thread
From: Roman Mashak @ 2020-03-12  2:20 UTC (permalink / raw)
  To: Petr Machata
  Cc: netdev, Jakub Kicinski, jhs, xiyou.wangcong, davem, jiri, mlxsw

Petr Machata <petrm@mellanox.com> writes:

> Add a handful of tests for creating RED with different flags.
>
> Signed-off-by: Petr Machata <petrm@mellanox.com>
> ---
>
> Notes:
>     v2:
>     - Require nsPlugin in each RED test
>     - Match end-of-line to catch cases of more flags reported than
>       requested
>
>  .../tc-testing/tc-tests/qdiscs/red.json       | 117 ++++++++++++++++++
>  1 file changed, 117 insertions(+)
>  create mode 100644 tools/testing/selftests/tc-testing/tc-tests/qdiscs/red.json
>
> diff --git a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/red.json b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/red.json
> new file mode 100644
> index 000000000000..b70a54464897
> --- /dev/null
> +++ b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/red.json
> @@ -0,0 +1,117 @@
> +[
> +    {
> +        "id": "8b6e",
> +        "name": "Create RED with no flags",
> +        "category": [
> +            "qdisc",
> +            "red"
> +        ],
> +        "plugins": {
> +            "requires": "nsPlugin"
> +        },
> +        "setup": [
> +            "$IP link add dev $DUMMY type dummy || /bin/true"
> +        ],
> +        "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root red limit 1M avpkt 1500 min 100K max 300K",
> +        "expExitCode": "0",
> +        "verifyCmd": "$TC qdisc show dev $DUMMY",
> +        "matchPattern": "qdisc red 1: root .* limit 1Mb min 100Kb max 300Kb $",
> +        "matchCount": "1",
> +        "teardown": [
> +            "$TC qdisc del dev $DUMMY handle 1: root",
> +            "$IP link del dev $DUMMY type dummy"
> +        ]
> +    },
> +    {
> +        "id": "342e",
> +        "name": "Create RED with adaptive flag",
> +        "category": [
> +            "qdisc",
> +            "red"
> +        ],
> +        "plugins": {
> +            "requires": "nsPlugin"
> +        },
> +        "setup": [
> +            "$IP link add dev $DUMMY type dummy || /bin/true"
> +        ],
> +        "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root red adaptive limit 1M avpkt 1500 min 100K max 300K",
> +        "expExitCode": "0",
> +        "verifyCmd": "$TC qdisc show dev $DUMMY",
> +        "matchPattern": "qdisc red 1: root .* limit 1Mb min 100Kb max 300Kb adaptive $",
> +        "matchCount": "1",
> +        "teardown": [
> +            "$TC qdisc del dev $DUMMY handle 1: root",
> +            "$IP link del dev $DUMMY type dummy"
> +        ]
> +    },
> +    {
> +        "id": "2d4b",
> +        "name": "Create RED with ECN flag",
> +        "category": [
> +            "qdisc",
> +            "red"
> +        ],
> +        "plugins": {
> +            "requires": "nsPlugin"
> +        },
> +        "setup": [
> +            "$IP link add dev $DUMMY type dummy || /bin/true"
> +        ],
> +        "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root red ecn limit 1M avpkt 1500 min 100K max 300K",
> +        "expExitCode": "0",
> +        "verifyCmd": "$TC qdisc show dev $DUMMY",
> +        "matchPattern": "qdisc red 1: root .* limit 1Mb min 100Kb max 300Kb ecn $",
> +        "matchCount": "1",
> +        "teardown": [
> +            "$TC qdisc del dev $DUMMY handle 1: root",
> +            "$IP link del dev $DUMMY type dummy"
> +        ]
> +    },
> +    {
> +        "id": "650f",
> +        "name": "Create RED with flags ECN, adaptive",
> +        "category": [
> +            "qdisc",
> +            "red"
> +        ],
> +        "plugins": {
> +            "requires": "nsPlugin"
> +        },
> +        "setup": [
> +            "$IP link add dev $DUMMY type dummy || /bin/true"
> +        ],
> +        "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root red ecn adaptive limit 1M avpkt 1500 min 100K max 300K",
> +        "expExitCode": "0",
> +        "verifyCmd": "$TC qdisc show dev $DUMMY",
> +        "matchPattern": "qdisc red 1: root .* limit 1Mb min 100Kb max 300Kb ecn adaptive $",
> +        "matchCount": "1",
> +        "teardown": [
> +            "$TC qdisc del dev $DUMMY handle 1: root",
> +            "$IP link del dev $DUMMY type dummy"
> +        ]
> +    },
> +    {
> +        "id": "5f15",
> +        "name": "Create RED with flags ECN, harddrop",
> +        "category": [
> +            "qdisc",
> +            "red"
> +        ],
> +        "plugins": {
> +            "requires": "nsPlugin"
> +        },
> +        "setup": [
> +            "$IP link add dev $DUMMY type dummy || /bin/true"
> +        ],
> +        "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root red ecn harddrop limit 1M avpkt 1500 min 100K max 300K",
> +        "expExitCode": "0",
> +        "verifyCmd": "$TC qdisc show dev $DUMMY",
> +        "matchPattern": "qdisc red 1: root .* limit 1Mb min 100Kb max 300Kb ecn harddrop $",
> +        "matchCount": "1",
> +        "teardown": [
> +            "$TC qdisc del dev $DUMMY handle 1: root",
> +            "$IP link del dev $DUMMY type dummy"
> +        ]
> +    }
> +]

Reviewed-by: Roman Mashak <mrv@mojatatu.com>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net-next v2 5/6] selftests: qdiscs: RED: Add taildrop tests
  2020-03-11 17:33 ` [PATCH net-next v2 5/6] selftests: qdiscs: RED: Add taildrop tests Petr Machata
@ 2020-03-12  2:21   ` Roman Mashak
  0 siblings, 0 replies; 21+ messages in thread
From: Roman Mashak @ 2020-03-12  2:21 UTC (permalink / raw)
  To: Petr Machata
  Cc: netdev, Jakub Kicinski, jhs, xiyou.wangcong, davem, jiri, mlxsw

Petr Machata <petrm@mellanox.com> writes:

> Add tests for the new "taildrop" flag.
>
> Signed-off-by: Petr Machata <petrm@mellanox.com>
> ---
>
> Notes:
>     v2:
>     - Require nsPlugin in each RED test
>     - Match end-of-line to catch cases of more flags reported than
>       requested
>     - Add a test for creation of non-ECN taildrop, which should fail
>
>  .../tc-testing/tc-tests/qdiscs/red.json       | 68 +++++++++++++++++++
>  1 file changed, 68 insertions(+)
>
> diff --git a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/red.json b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/red.json
> index b70a54464897..72676073c658 100644
> --- a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/red.json
> +++ b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/red.json
> @@ -113,5 +113,73 @@
>              "$TC qdisc del dev $DUMMY handle 1: root",
>              "$IP link del dev $DUMMY type dummy"
>          ]
> +    },
> +    {
> +        "id": "53e8",
> +        "name": "Create RED with flags ECN, taildrop",
> +        "category": [
> +            "qdisc",
> +            "red"
> +        ],
> +        "plugins": {
> +            "requires": "nsPlugin"
> +        },
> +        "setup": [
> +            "$IP link add dev $DUMMY type dummy || /bin/true"
> +        ],
> +        "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root red ecn taildrop limit 1M avpkt 1500 min 100K max 300K",
> +        "expExitCode": "0",
> +        "verifyCmd": "$TC qdisc show dev $DUMMY",
> +        "matchPattern": "qdisc red 1: root .* limit 1Mb min 100Kb max 300Kb ecn taildrop $",
> +        "matchCount": "1",
> +        "teardown": [
> +            "$TC qdisc del dev $DUMMY handle 1: root",
> +            "$IP link del dev $DUMMY type dummy"
> +        ]
> +    },
> +    {
> +        "id": "d091",
> +        "name": "Fail to create RED with only taildrop flag",
> +        "category": [
> +            "qdisc",
> +            "red"
> +        ],
> +        "plugins": {
> +            "requires": "nsPlugin"
> +        },
> +        "setup": [
> +            "$IP link add dev $DUMMY type dummy || /bin/true"
> +        ],
> +        "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root red taildrop limit 1M avpkt 1500 min 100K max 300K",
> +        "expExitCode": "2",
> +        "verifyCmd": "$TC qdisc show dev $DUMMY",
> +        "matchPattern": "qdisc red",
> +        "matchCount": "0",
> +        "teardown": [
> +            "$IP link del dev $DUMMY type dummy"
> +        ]
> +    },
> +    {
> +        "id": "af8e",
> +        "name": "Create RED with flags ECN, taildrop, harddrop",
> +        "category": [
> +            "qdisc",
> +            "red"
> +        ],
> +        "plugins": {
> +            "requires": "nsPlugin"
> +        },
> +        "setup": [
> +            "$IP link add dev $DUMMY type dummy || /bin/true"
> +        ],
> +        "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root red ecn harddrop taildrop limit 1M avpkt 1500 min 100K max 300K",
> +        "expExitCode": "0",
> +        "verifyCmd": "$TC qdisc show dev $DUMMY",
> +        "matchPattern": "qdisc red 1: root .* limit 1Mb min 100Kb max 300Kb ecn harddrop taildrop $",
> +        "matchCount": "1",
> +        "teardown": [
> +            "$TC qdisc del dev $DUMMY handle 1: root",
> +            "$IP link del dev $DUMMY type dummy"
> +        ]
>      }
>  ]

Reviewed-by: Roman Mashak <mrv@mojatatu.com>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net-next v2 3/6] net: sched: RED: Introduce an ECN tail-dropping mode
  2020-03-12  1:01       ` Eric Dumazet
@ 2020-03-12  2:25         ` Jakub Kicinski
  2020-03-12 10:16           ` Petr Machata
  0 siblings, 1 reply; 21+ messages in thread
From: Jakub Kicinski @ 2020-03-12  2:25 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Petr Machata, netdev, Roman Mashak, jhs, xiyou.wangcong, davem,
	jiri, mlxsw

On Wed, 11 Mar 2020 18:01:38 -0700 Eric Dumazet wrote:
> > That said, I agree that from the perspective of the qdisc itself the
> > name does not make sense. We can make it "nodrop", or "nored", or maybe
> > "keep_non_ect"... I guess "nored" is closest to the desired effect.  
> 
> Well, red algo is still used to decide if we attempt ECN marking, so "nodrop"
> seems better to me :)

nodrop + harddrop is a valid combination and that'd look a little
strange. Maybe something like ect-only?

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net-next v2 3/6] net: sched: RED: Introduce an ECN tail-dropping mode
  2020-03-12  2:25         ` Jakub Kicinski
@ 2020-03-12 10:16           ` Petr Machata
  0 siblings, 0 replies; 21+ messages in thread
From: Petr Machata @ 2020-03-12 10:16 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Eric Dumazet, netdev, Roman Mashak, jhs, xiyou.wangcong, davem,
	jiri, mlxsw


Jakub Kicinski <kuba@kernel.org> writes:

> On Wed, 11 Mar 2020 18:01:38 -0700 Eric Dumazet wrote:
>> > That said, I agree that from the perspective of the qdisc itself the
>> > name does not make sense. We can make it "nodrop", or "nored", or maybe
>> > "keep_non_ect"... I guess "nored" is closest to the desired effect.
>>
>> Well, red algo is still used to decide if we attempt ECN marking, so "nodrop"
>> seems better to me :)

I know that the D in RED could stand for "detection", but the one in RED
as a qdisc kind certainly stands for "drop" :)

> nodrop + harddrop is a valid combination and that'd look a little
> strange. Maybe something like ect-only?

But then "ecn ect_only" would look equally strange. Like, of course ECN
is ECT only...

I don't actually mind "nodrop harddrop". You can't guess what these
flags do from just their names anyway, so the fact they don't seem to
make sense next to each other is not an issue. And "nodrop" does
describe what the immediate behavior in context of the RED qdisc is.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net-next v2 3/6] net: sched: RED: Introduce an ECN tail-dropping mode
  2020-03-11 17:33 ` [PATCH net-next v2 3/6] net: sched: RED: Introduce an ECN tail-dropping mode Petr Machata
  2020-03-11 18:36   ` Eric Dumazet
@ 2020-03-12 10:17   ` Petr Machata
  1 sibling, 0 replies; 21+ messages in thread
From: Petr Machata @ 2020-03-12 10:17 UTC (permalink / raw)
  To: netdev
  Cc: Petr Machata, Jakub Kicinski, Roman Mashak, jhs, xiyou.wangcong,
	davem, jiri, mlxsw


Petr Machata <petrm@mellanox.com> writes:

> @@ -60,6 +60,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)

Forgot to take care of the static inline :-|

> +{
> +	return q->flags & TC_RED_TAILDROP;
> +}
> +

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net-next v2 0/6] RED: Introduce an ECN tail-dropping mode
  2020-03-11 17:33 [PATCH net-next v2 0/6] RED: Introduce an ECN tail-dropping mode Petr Machata
                   ` (5 preceding siblings ...)
  2020-03-11 17:33 ` [PATCH net-next v2 6/6] selftests: mlxsw: RED: Test RED ECN taildrop offload Petr Machata
@ 2020-03-15  4:04 ` David Miller
  2020-03-16 10:54   ` Petr Machata
  6 siblings, 1 reply; 21+ messages in thread
From: David Miller @ 2020-03-15  4:04 UTC (permalink / raw)
  To: petrm; +Cc: netdev, kuba, mrv, jhs, xiyou.wangcong, jiri, mlxsw

From: Petr Machata <petrm@mellanox.com>
Date: Wed, 11 Mar 2020 19:33:50 +0200

> When the RED qdisc is currently configured to enable ECN, the RED algorithm
> is used to decide whether a certain SKB should be marked. If that SKB is
> not ECN-capable, it is early-dropped.
> 
> It is also possible to keep all traffic in the queue, and just mark the
> ECN-capable subset of it, as appropriate under the RED algorithm. Some
> switches support this mode, and some installations make use of it.
> There is currently no way to put the RED qdiscs to this mode.
> 
> Therefore this patchset adds a new RED flag, TC_RED_TAILDROP. When the
> qdisc is configured with this flag, non-ECT traffic is enqueued (and
> tail-dropped when the queue size is exhausted) instead of being
> early-dropped.
 ...

Series applied, thank you.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net-next v2 0/6] RED: Introduce an ECN tail-dropping mode
  2020-03-15  4:04 ` [PATCH net-next v2 0/6] RED: Introduce an ECN tail-dropping mode David Miller
@ 2020-03-16 10:54   ` Petr Machata
  2020-03-16 21:55     ` David Miller
  0 siblings, 1 reply; 21+ messages in thread
From: Petr Machata @ 2020-03-16 10:54 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, kuba, mrv, jhs, xiyou.wangcong, jiri, mlxsw


David Miller <davem@davemloft.net> writes:

> From: Petr Machata <petrm@mellanox.com>
> Date: Wed, 11 Mar 2020 19:33:50 +0200
>
>> When the RED qdisc is currently configured to enable ECN, the RED algorithm
>> is used to decide whether a certain SKB should be marked. If that SKB is
>> not ECN-capable, it is early-dropped.
>>
>> It is also possible to keep all traffic in the queue, and just mark the
>> ECN-capable subset of it, as appropriate under the RED algorithm. Some
>> switches support this mode, and some installations make use of it.
>> There is currently no way to put the RED qdiscs to this mode.
>>
>> Therefore this patchset adds a new RED flag, TC_RED_TAILDROP. When the
>> qdisc is configured with this flag, non-ECT traffic is enqueued (and
>> tail-dropped when the queue size is exhausted) instead of being
>> early-dropped.
>  ...
>
> Series applied, thank you.

Dave, there were v3 and v4 for this patchset as well. They had a
different subject, s/taildrop/nodrop/, hence the confusion I think.
Should I send a delta patch with just the changes, or do you want to
revert-and-reapply, or...?

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net-next v2 0/6] RED: Introduce an ECN tail-dropping mode
  2020-03-16 10:54   ` Petr Machata
@ 2020-03-16 21:55     ` David Miller
  2020-03-17 12:43       ` Petr Machata
  0 siblings, 1 reply; 21+ messages in thread
From: David Miller @ 2020-03-16 21:55 UTC (permalink / raw)
  To: petrm; +Cc: netdev, kuba, mrv, jhs, xiyou.wangcong, jiri, mlxsw

From: Petr Machata <petrm@mellanox.com>
Date: Mon, 16 Mar 2020 11:54:51 +0100

> Dave, there were v3 and v4 for this patchset as well. They had a
> different subject, s/taildrop/nodrop/, hence the confusion I think.
> Should I send a delta patch with just the changes, or do you want to
> revert-and-reapply, or...?

I prefer deltas, thank you.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net-next v2 0/6] RED: Introduce an ECN tail-dropping mode
  2020-03-16 21:55     ` David Miller
@ 2020-03-17 12:43       ` Petr Machata
  0 siblings, 0 replies; 21+ messages in thread
From: Petr Machata @ 2020-03-17 12:43 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, kuba, mrv, jhs, xiyou.wangcong, jiri, mlxsw


David Miller <davem@davemloft.net> writes:

> From: Petr Machata <petrm@mellanox.com>
> Date: Mon, 16 Mar 2020 11:54:51 +0100
>
>> Dave, there were v3 and v4 for this patchset as well. They had a
>> different subject, s/taildrop/nodrop/, hence the confusion I think.
>> Should I send a delta patch with just the changes, or do you want to
>> revert-and-reapply, or...?
>
> I prefer deltas, thank you.

Never mind, it's just the merge commit that contains v2, the actual
patches are v4.

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2020-03-17 12:44 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-11 17:33 [PATCH net-next v2 0/6] RED: Introduce an ECN tail-dropping mode Petr Machata
2020-03-11 17:33 ` [PATCH net-next v2 1/6] selftests: qdiscs: Add TDC test for RED Petr Machata
2020-03-12  2:20   ` Roman Mashak
2020-03-11 17:33 ` [PATCH net-next v2 2/6] net: sched: Allow extending set of supported RED flags Petr Machata
2020-03-11 22:09   ` Jakub Kicinski
2020-03-12  0:12     ` Petr Machata
2020-03-11 17:33 ` [PATCH net-next v2 3/6] net: sched: RED: Introduce an ECN tail-dropping mode Petr Machata
2020-03-11 18:36   ` Eric Dumazet
2020-03-12  0:42     ` Petr Machata
2020-03-12  1:01       ` Eric Dumazet
2020-03-12  2:25         ` Jakub Kicinski
2020-03-12 10:16           ` Petr Machata
2020-03-12 10:17   ` Petr Machata
2020-03-11 17:33 ` [PATCH net-next v2 4/6] mlxsw: spectrum_qdisc: Offload RED " Petr Machata
2020-03-11 17:33 ` [PATCH net-next v2 5/6] selftests: qdiscs: RED: Add taildrop tests Petr Machata
2020-03-12  2:21   ` Roman Mashak
2020-03-11 17:33 ` [PATCH net-next v2 6/6] selftests: mlxsw: RED: Test RED ECN taildrop offload Petr Machata
2020-03-15  4:04 ` [PATCH net-next v2 0/6] RED: Introduce an ECN tail-dropping mode David Miller
2020-03-16 10:54   ` Petr Machata
2020-03-16 21:55     ` David Miller
2020-03-17 12:43       ` Petr Machata

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.