Commit 12f4ee31 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'net_sched-gso_skb-flushing'



Cong Wang says:

====================
net_sched: Fix gso_skb flushing during qdisc change

This patchset contains a bug fix and its test cases, please check each
patch description for more details. To keep the bug fix minimum, I
intentionally limit the code changes to the cases reported here.

---
v2: added a missing qlen--
    fixed the new boolean parameter for two qdiscs

====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 6b3ab7f2 16ce349b
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -1031,6 +1031,21 @@ static inline struct sk_buff *__qdisc_dequeue_head(struct qdisc_skb_head *qh)
	return skb;
}

static inline struct sk_buff *qdisc_dequeue_internal(struct Qdisc *sch, bool direct)
{
	struct sk_buff *skb;

	skb = __skb_dequeue(&sch->gso_skb);
	if (skb) {
		sch->q.qlen--;
		return skb;
	}
	if (direct)
		return __qdisc_dequeue_head(&sch->q);
	else
		return sch->dequeue(sch);
}

static inline struct sk_buff *qdisc_dequeue_head(struct Qdisc *sch)
{
	struct sk_buff *skb = __qdisc_dequeue_head(&sch->q);
+1 −1
Original line number Diff line number Diff line
@@ -144,7 +144,7 @@ static int codel_change(struct Qdisc *sch, struct nlattr *opt,

	qlen = sch->q.qlen;
	while (sch->q.qlen > sch->limit) {
		struct sk_buff *skb = __qdisc_dequeue_head(&sch->q);
		struct sk_buff *skb = qdisc_dequeue_internal(sch, true);

		dropped += qdisc_pkt_len(skb);
		qdisc_qstats_backlog_dec(sch, skb);
+1 −1
Original line number Diff line number Diff line
@@ -1136,7 +1136,7 @@ static int fq_change(struct Qdisc *sch, struct nlattr *opt,
		sch_tree_lock(sch);
	}
	while (sch->q.qlen > sch->limit) {
		struct sk_buff *skb = fq_dequeue(sch);
		struct sk_buff *skb = qdisc_dequeue_internal(sch, false);

		if (!skb)
			break;
+1 −1
Original line number Diff line number Diff line
@@ -441,7 +441,7 @@ static int fq_codel_change(struct Qdisc *sch, struct nlattr *opt,

	while (sch->q.qlen > sch->limit ||
	       q->memory_usage > q->memory_limit) {
		struct sk_buff *skb = fq_codel_dequeue(sch);
		struct sk_buff *skb = qdisc_dequeue_internal(sch, false);

		q->cstats.drop_len += qdisc_pkt_len(skb);
		rtnl_kfree_skbs(skb, skb);
+1 −1
Original line number Diff line number Diff line
@@ -366,7 +366,7 @@ static int fq_pie_change(struct Qdisc *sch, struct nlattr *opt,

	/* Drop excess packets if new limit is lower */
	while (sch->q.qlen > sch->limit) {
		struct sk_buff *skb = fq_pie_qdisc_dequeue(sch);
		struct sk_buff *skb = qdisc_dequeue_internal(sch, false);

		len_dropped += qdisc_pkt_len(skb);
		num_dropped += 1;
Loading