All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: sch: prio: Set bands to default on delete instead of noop
@ 2018-04-26 13:32 Nogah Frankel
  2018-04-27 18:20 ` Cong Wang
  2018-04-27 23:56 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Nogah Frankel @ 2018-04-26 13:32 UTC (permalink / raw)
  To: netdev; +Cc: davem, jiri, jhs, xiyou.wangcong, mlxsw, Nogah Frankel

When a band is created, it is set to the default qdisc, which is
"invisible" pfifo.
However, if a band is set to a qdisc that is later being deleted, it will
be set to noop qdisc. This can cause a packet loss, while there is no clear
user indication for it. ("invisible" qdisc are not being shown by default).
This patch sets a band to the default qdisc, rather then the noop qdisc, on
delete operation.

Signed-off-by: Nogah Frankel <nogahf@mellanox.com>
---
 net/sched/sch_prio.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c
index 222e53d..6862d23 100644
--- a/net/sched/sch_prio.c
+++ b/net/sched/sch_prio.c
@@ -314,8 +314,15 @@ static int prio_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
 	bool any_qdisc_is_offloaded;
 	int err;
 
-	if (new == NULL)
-		new = &noop_qdisc;
+	if (!new) {
+		new = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops,
+					TC_H_MAKE(sch->handle, band + 1),
+					extack);
+		if (!new)
+			new = &noop_qdisc;
+		else
+			qdisc_hash_add(new, true);
+	}
 
 	*old = qdisc_replace(sch, new, &q->queues[band]);
 
@@ -332,7 +339,7 @@ static int prio_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
 					    &graft_offload);
 
 	/* Don't report error if the graft is part of destroy operation. */
-	if (err && new != &noop_qdisc) {
+	if (err && new->handle) {
 		/* Don't report error if the parent, the old child and the new
 		 * one are not offloaded.
 		 */
-- 
2.4.11

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

* Re: [PATCH net-next] net: sch: prio: Set bands to default on delete instead of noop
  2018-04-26 13:32 [PATCH net-next] net: sch: prio: Set bands to default on delete instead of noop Nogah Frankel
@ 2018-04-27 18:20 ` Cong Wang
  2018-04-27 23:56 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: Cong Wang @ 2018-04-27 18:20 UTC (permalink / raw)
  To: Nogah Frankel
  Cc: Linux Kernel Network Developers, David Miller, Jiri Pirko,
	Jamal Hadi Salim, mlxsw

On Thu, Apr 26, 2018 at 6:32 AM, Nogah Frankel <nogahf@mellanox.com> wrote:
> When a band is created, it is set to the default qdisc, which is
> "invisible" pfifo.


Isn't TCA_DUMP_INVISIBLE for dumping this invisible qdisc?


> However, if a band is set to a qdisc that is later being deleted, it will
> be set to noop qdisc. This can cause a packet loss, while there is no clear
> user indication for it. ("invisible" qdisc are not being shown by default).
> This patch sets a band to the default qdisc, rather then the noop qdisc, on
> delete operation.

It is set to noop historically, may be not reasonable but changing
it could break things.

What's wrong with using TCA_DUMP_INVISIBLE to dump it?

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

* Re: [PATCH net-next] net: sch: prio: Set bands to default on delete instead of noop
  2018-04-26 13:32 [PATCH net-next] net: sch: prio: Set bands to default on delete instead of noop Nogah Frankel
  2018-04-27 18:20 ` Cong Wang
@ 2018-04-27 23:56 ` David Miller
  2018-04-29  8:13   ` Nogah Frankel
  1 sibling, 1 reply; 4+ messages in thread
From: David Miller @ 2018-04-27 23:56 UTC (permalink / raw)
  To: nogahf; +Cc: netdev, jiri, jhs, xiyou.wangcong, mlxsw

From: Nogah Frankel <nogahf@mellanox.com>
Date: Thu, 26 Apr 2018 16:32:36 +0300

> When a band is created, it is set to the default qdisc, which is
> "invisible" pfifo.
> However, if a band is set to a qdisc that is later being deleted, it will
> be set to noop qdisc. This can cause a packet loss, while there is no clear
> user indication for it. ("invisible" qdisc are not being shown by default).
> This patch sets a band to the default qdisc, rather then the noop qdisc, on
> delete operation.
> 
> Signed-off-by: Nogah Frankel <nogahf@mellanox.com>

Like Cong, I'm worried this will break something.  The code has
behaved this way for 2 decades or longer.

If you want to put another qdisc there, and thus not drop any traffic,
modify the qdisc to a new one instead of performing a delete operation.

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

* RE: [PATCH net-next] net: sch: prio: Set bands to default on delete instead of noop
  2018-04-27 23:56 ` David Miller
@ 2018-04-29  8:13   ` Nogah Frankel
  0 siblings, 0 replies; 4+ messages in thread
From: Nogah Frankel @ 2018-04-29  8:13 UTC (permalink / raw)
  To: David Miller, xiyou.wangcong; +Cc: netdev, jiri, jhs, mlxsw

> > When a band is created, it is set to the default qdisc, which is
> > "invisible" pfifo.
> > However, if a band is set to a qdisc that is later being deleted, it will
> > be set to noop qdisc. This can cause a packet loss, while there is no clear
> > user indication for it. ("invisible" qdisc are not being shown by default).
> > This patch sets a band to the default qdisc, rather then the noop qdisc, on
> > delete operation.
> >
> > Signed-off-by: Nogah Frankel <nogahf@mellanox.com>
> 
> Like Cong, I'm worried this will break something.  The code has
> behaved this way for 2 decades or longer.
> 
> If you want to put another qdisc there, and thus not drop any traffic,
> modify the qdisc to a new one instead of performing a delete operation.

I believe that this historic behavior is quite bug like, especially because
TCA_DUMP_INVISIBLE is not set by default.
Yet I accept your judgment that changing it now might break things.
Thank you.
 
Nogah


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

end of thread, other threads:[~2018-04-29  8:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-26 13:32 [PATCH net-next] net: sch: prio: Set bands to default on delete instead of noop Nogah Frankel
2018-04-27 18:20 ` Cong Wang
2018-04-27 23:56 ` David Miller
2018-04-29  8:13   ` Nogah Frankel

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.