mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-29 17:22:07 +00:00
net/sched: Add drop reasons for AQM-based qdiscs
Now that we have generic QDISC_CONGESTED and QDISC_OVERLIMIT drop reasons, let's have all the qdiscs that contain an AQM apply them consistently when dropping packets. Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com> Link: https://patch.msgid.link/20241214-fq-codel-drop-reasons-v1-1-2a814e884c37@redhat.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
963b7895ef
commit
ff9f17ce2e
@ -52,7 +52,7 @@ static void drop_func(struct sk_buff *skb, void *ctx)
|
||||
{
|
||||
struct Qdisc *sch = ctx;
|
||||
|
||||
kfree_skb(skb);
|
||||
kfree_skb_reason(skb, SKB_DROP_REASON_QDISC_CONGESTED);
|
||||
qdisc_qstats_drop(sch);
|
||||
}
|
||||
|
||||
@ -89,7 +89,8 @@ static int codel_qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch,
|
||||
}
|
||||
q = qdisc_priv(sch);
|
||||
q->drop_overlimit++;
|
||||
return qdisc_drop(skb, sch, to_free);
|
||||
return qdisc_drop_reason(skb, sch, to_free,
|
||||
SKB_DROP_REASON_QDISC_OVERLIMIT);
|
||||
}
|
||||
|
||||
static const struct nla_policy codel_policy[TCA_CODEL_MAX + 1] = {
|
||||
|
@ -168,6 +168,7 @@ static unsigned int fq_codel_drop(struct Qdisc *sch, unsigned int max_packets,
|
||||
skb = dequeue_head(flow);
|
||||
len += qdisc_pkt_len(skb);
|
||||
mem += get_codel_cb(skb)->mem_usage;
|
||||
tcf_set_drop_reason(skb, SKB_DROP_REASON_QDISC_OVERLIMIT);
|
||||
__qdisc_drop(skb, to_free);
|
||||
} while (++i < max_packets && len < threshold);
|
||||
|
||||
@ -274,7 +275,7 @@ static void drop_func(struct sk_buff *skb, void *ctx)
|
||||
{
|
||||
struct Qdisc *sch = ctx;
|
||||
|
||||
kfree_skb(skb);
|
||||
kfree_skb_reason(skb, SKB_DROP_REASON_QDISC_CONGESTED);
|
||||
qdisc_qstats_drop(sch);
|
||||
}
|
||||
|
||||
|
@ -130,6 +130,7 @@ static inline void flow_queue_add(struct fq_pie_flow *flow,
|
||||
static int fq_pie_qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch,
|
||||
struct sk_buff **to_free)
|
||||
{
|
||||
enum skb_drop_reason reason = SKB_DROP_REASON_QDISC_OVERLIMIT;
|
||||
struct fq_pie_sched_data *q = qdisc_priv(sch);
|
||||
struct fq_pie_flow *sel_flow;
|
||||
int ret;
|
||||
@ -161,6 +162,8 @@ static int fq_pie_qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch,
|
||||
q->overmemory++;
|
||||
}
|
||||
|
||||
reason = SKB_DROP_REASON_QDISC_CONGESTED;
|
||||
|
||||
if (!pie_drop_early(sch, &q->p_params, &sel_flow->vars,
|
||||
sel_flow->backlog, skb->len)) {
|
||||
enqueue = true;
|
||||
@ -198,8 +201,7 @@ static int fq_pie_qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch,
|
||||
out:
|
||||
q->stats.dropped++;
|
||||
sel_flow->vars.accu_prob = 0;
|
||||
__qdisc_drop(skb, to_free);
|
||||
qdisc_qstats_drop(sch);
|
||||
qdisc_drop_reason(skb, sch, to_free, reason);
|
||||
return NET_XMIT_CN;
|
||||
}
|
||||
|
||||
|
@ -251,10 +251,10 @@ static int gred_enqueue(struct sk_buff *skb, struct Qdisc *sch,
|
||||
|
||||
q->stats.pdrop++;
|
||||
drop:
|
||||
return qdisc_drop(skb, sch, to_free);
|
||||
return qdisc_drop_reason(skb, sch, to_free, SKB_DROP_REASON_QDISC_OVERLIMIT);
|
||||
|
||||
congestion_drop:
|
||||
qdisc_drop(skb, sch, to_free);
|
||||
qdisc_drop_reason(skb, sch, to_free, SKB_DROP_REASON_QDISC_CONGESTED);
|
||||
return NET_XMIT_CN;
|
||||
}
|
||||
|
||||
|
@ -85,6 +85,7 @@ EXPORT_SYMBOL_GPL(pie_drop_early);
|
||||
static int pie_qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch,
|
||||
struct sk_buff **to_free)
|
||||
{
|
||||
enum skb_drop_reason reason = SKB_DROP_REASON_QDISC_OVERLIMIT;
|
||||
struct pie_sched_data *q = qdisc_priv(sch);
|
||||
bool enqueue = false;
|
||||
|
||||
@ -93,6 +94,8 @@ static int pie_qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch,
|
||||
goto out;
|
||||
}
|
||||
|
||||
reason = SKB_DROP_REASON_QDISC_CONGESTED;
|
||||
|
||||
if (!pie_drop_early(sch, &q->params, &q->vars, sch->qstats.backlog,
|
||||
skb->len)) {
|
||||
enqueue = true;
|
||||
@ -121,7 +124,7 @@ static int pie_qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch,
|
||||
out:
|
||||
q->stats.dropped++;
|
||||
q->vars.accu_prob = 0;
|
||||
return qdisc_drop(skb, sch, to_free);
|
||||
return qdisc_drop_reason(skb, sch, to_free, reason);
|
||||
}
|
||||
|
||||
static const struct nla_policy pie_policy[TCA_PIE_MAX + 1] = {
|
||||
|
@ -70,6 +70,7 @@ static int red_use_nodrop(struct red_sched_data *q)
|
||||
static int red_enqueue(struct sk_buff *skb, struct Qdisc *sch,
|
||||
struct sk_buff **to_free)
|
||||
{
|
||||
enum skb_drop_reason reason = SKB_DROP_REASON_QDISC_CONGESTED;
|
||||
struct red_sched_data *q = qdisc_priv(sch);
|
||||
struct Qdisc *child = q->qdisc;
|
||||
unsigned int len;
|
||||
@ -107,6 +108,7 @@ static int red_enqueue(struct sk_buff *skb, struct Qdisc *sch,
|
||||
break;
|
||||
|
||||
case RED_HARD_MARK:
|
||||
reason = SKB_DROP_REASON_QDISC_OVERLIMIT;
|
||||
qdisc_qstats_overlimit(sch);
|
||||
if (red_use_harddrop(q) || !red_use_ecn(q)) {
|
||||
q->stats.forced_drop++;
|
||||
@ -143,7 +145,7 @@ static int red_enqueue(struct sk_buff *skb, struct Qdisc *sch,
|
||||
if (!skb)
|
||||
return NET_XMIT_CN | ret;
|
||||
|
||||
qdisc_drop(skb, sch, to_free);
|
||||
qdisc_drop_reason(skb, sch, to_free, reason);
|
||||
return NET_XMIT_CN;
|
||||
}
|
||||
|
||||
|
@ -280,6 +280,7 @@ static int sfb_enqueue(struct sk_buff *skb, struct Qdisc *sch,
|
||||
struct sk_buff **to_free)
|
||||
{
|
||||
|
||||
enum skb_drop_reason reason = SKB_DROP_REASON_QDISC_OVERLIMIT;
|
||||
struct sfb_sched_data *q = qdisc_priv(sch);
|
||||
unsigned int len = qdisc_pkt_len(skb);
|
||||
struct Qdisc *child = q->qdisc;
|
||||
@ -380,6 +381,7 @@ static int sfb_enqueue(struct sk_buff *skb, struct Qdisc *sch,
|
||||
}
|
||||
|
||||
r = get_random_u16() & SFB_MAX_PROB;
|
||||
reason = SKB_DROP_REASON_QDISC_CONGESTED;
|
||||
|
||||
if (unlikely(r < p_min)) {
|
||||
if (unlikely(p_min > SFB_MAX_PROB / 2)) {
|
||||
@ -414,7 +416,7 @@ static int sfb_enqueue(struct sk_buff *skb, struct Qdisc *sch,
|
||||
return ret;
|
||||
|
||||
drop:
|
||||
qdisc_drop(skb, sch, to_free);
|
||||
qdisc_drop_reason(skb, sch, to_free, reason);
|
||||
return NET_XMIT_CN;
|
||||
other_drop:
|
||||
if (ret & __NET_XMIT_BYPASS)
|
||||
|
Loading…
Reference in New Issue
Block a user