netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@nbd.name>
To: netdev@vger.kernel.org
Subject: [PATCH 2/2] sch_fq_codel: fix running with classifiers that don't set a classid
Date: Mon,  7 Mar 2022 19:26:02 +0100	[thread overview]
Message-ID: <20220307182602.16978-2-nbd@nbd.name> (raw)
In-Reply-To: <20220307182602.16978-1-nbd@nbd.name>

If no valid classid is provided, fall back to calculating the hash directly,
in order to avoid dropping packets

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 net/sched/sch_fq_codel.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c
index 839e1235db05..b2a13185bb63 100644
--- a/net/sched/sch_fq_codel.c
+++ b/net/sched/sch_fq_codel.c
@@ -88,7 +88,7 @@ static unsigned int fq_codel_classify(struct sk_buff *skb, struct Qdisc *sch,
 
 	filter = rcu_dereference_bh(q->filter_list);
 	if (!filter)
-		return fq_codel_hash(q, skb) + 1;
+		goto out;
 
 	*qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
 	result = tcf_classify(skb, NULL, filter, &res, false);
@@ -104,10 +104,13 @@ static unsigned int fq_codel_classify(struct sk_buff *skb, struct Qdisc *sch,
 			return 0;
 		}
 #endif
-		if (TC_H_MIN(res.classid) <= q->flows_cnt)
+		if (TC_H_MIN(res.classid) > 0 &&
+		    TC_H_MIN(res.classid) <= q->flows_cnt)
 			return TC_H_MIN(res.classid);
 	}
-	return 0;
+
+out:
+	return fq_codel_hash(q, skb) + 1;
 }
 
 /* helper functions : might be changed when/if skb use a standard list_head */
-- 
2.32.0 (Apple Git-132)


  reply	other threads:[~2022-03-07 18:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-07 18:26 [PATCH 1/2] sch_cake: allow setting TCA_CAKE_NAT with value 0 if conntrack is disabled Felix Fietkau
2022-03-07 18:26 ` Felix Fietkau [this message]
2022-03-07 20:41   ` [PATCH 2/2] sch_fq_codel: fix running with classifiers that don't set a classid Toke Høiland-Jørgensen
2022-03-07 22:43     ` Eric Dumazet
2022-03-07 20:37 ` [PATCH 1/2] sch_cake: allow setting TCA_CAKE_NAT with value 0 if conntrack is disabled Toke Høiland-Jørgensen

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=20220307182602.16978-2-nbd@nbd.name \
    --to=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    /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).