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: David S. Miller <davem@davemloft.net>
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
+1
-1
@@ -564,7 +564,7 @@ static int hhf_change(struct Qdisc *sch, struct nlattr *opt,
|
||||
qlen = sch->q.qlen;
|
||||
prev_backlog = sch->qstats.backlog;
|
||||
while (sch->q.qlen > sch->limit) {
|
||||
struct sk_buff *skb = hhf_dequeue(sch);
|
||||
struct sk_buff *skb = qdisc_dequeue_internal(sch, false);
|
||||
|
||||
rtnl_kfree_skbs(skb, skb);
|
||||
}
|
||||
|
||||
+1
-1
@@ -195,7 +195,7 @@ static int pie_change(struct Qdisc *sch, struct nlattr *opt,
|
||||
/* Drop excess packets if new limit is lower */
|
||||
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);
|
||||
|
||||
@@ -189,5 +189,29 @@
|
||||
"teardown": [
|
||||
"$TC qdisc del dev $DUMMY handle 1: root"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "deb1",
|
||||
"name": "CODEL test qdisc limit trimming",
|
||||
"category": ["qdisc", "codel"],
|
||||
"plugins": {
|
||||
"requires": ["nsPlugin", "scapyPlugin"]
|
||||
},
|
||||
"setup": [
|
||||
"$TC qdisc add dev $DEV1 handle 1: root codel limit 10"
|
||||
],
|
||||
"scapy": [
|
||||
{
|
||||
"iface": "$DEV0",
|
||||
"count": 10,
|
||||
"packet": "Ether(type=0x800)/IP(src='10.0.0.10',dst='10.0.0.20')/TCP(sport=5000,dport=10)"
|
||||
}
|
||||
],
|
||||
"cmdUnderTest": "$TC qdisc change dev $DEV1 handle 1: root codel limit 1",
|
||||
"expExitCode": "0",
|
||||
"verifyCmd": "$TC qdisc show dev $DEV1",
|
||||
"matchPattern": "qdisc codel 1: root refcnt [0-9]+ limit 1p target 5ms interval 100ms",
|
||||
"matchCount": "1",
|
||||
"teardown": ["$TC qdisc del dev $DEV1 handle 1: root"]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -377,5 +377,27 @@
|
||||
"teardown": [
|
||||
"$TC qdisc del dev $DUMMY handle 1: root"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "9479",
|
||||
"name": "FQ test qdisc limit trimming",
|
||||
"category": ["qdisc", "fq"],
|
||||
"plugins": {"requires": ["nsPlugin", "scapyPlugin"]},
|
||||
"setup": [
|
||||
"$TC qdisc add dev $DEV1 handle 1: root fq limit 10"
|
||||
],
|
||||
"scapy": [
|
||||
{
|
||||
"iface": "$DEV0",
|
||||
"count": 10,
|
||||
"packet": "Ether(type=0x800)/IP(src='10.0.0.10',dst='10.0.0.20')/TCP(sport=5000,dport=10)"
|
||||
}
|
||||
],
|
||||
"cmdUnderTest": "$TC qdisc change dev $DEV1 handle 1: root fq limit 1",
|
||||
"expExitCode": "0",
|
||||
"verifyCmd": "$TC qdisc show dev $DEV1",
|
||||
"matchPattern": "qdisc fq 1: root refcnt [0-9]+ limit 1p",
|
||||
"matchCount": "1",
|
||||
"teardown": ["$TC qdisc del dev $DEV1 handle 1: root"]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -294,5 +294,27 @@
|
||||
"teardown": [
|
||||
"$TC qdisc del dev $DUMMY handle 1: root"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "0436",
|
||||
"name": "FQ_CODEL test qdisc limit trimming",
|
||||
"category": ["qdisc", "fq_codel"],
|
||||
"plugins": {"requires": ["nsPlugin", "scapyPlugin"]},
|
||||
"setup": [
|
||||
"$TC qdisc add dev $DEV1 handle 1: root fq_codel limit 10"
|
||||
],
|
||||
"scapy": [
|
||||
{
|
||||
"iface": "$DEV0",
|
||||
"count": 10,
|
||||
"packet": "Ether(type=0x800)/IP(src='10.0.0.10',dst='10.0.0.20')/TCP(sport=5000,dport=10)"
|
||||
}
|
||||
],
|
||||
"cmdUnderTest": "$TC qdisc change dev $DEV1 handle 1: root fq_codel limit 1",
|
||||
"expExitCode": "0",
|
||||
"verifyCmd": "$TC qdisc show dev $DEV1",
|
||||
"matchPattern": "qdisc fq_codel 1: root refcnt [0-9]+ limit 1p flows 1024 quantum.*target 5ms interval 100ms memory_limit 32Mb ecn drop_batch 64",
|
||||
"matchCount": "1",
|
||||
"teardown": ["$TC qdisc del dev $DEV1 handle 1: root"]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -18,5 +18,27 @@
|
||||
"matchCount": "1",
|
||||
"teardown": [
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "83bf",
|
||||
"name": "FQ_PIE test qdisc limit trimming",
|
||||
"category": ["qdisc", "fq_pie"],
|
||||
"plugins": {"requires": ["nsPlugin", "scapyPlugin"]},
|
||||
"setup": [
|
||||
"$TC qdisc add dev $DEV1 handle 1: root fq_pie limit 10"
|
||||
],
|
||||
"scapy": [
|
||||
{
|
||||
"iface": "$DEV0",
|
||||
"count": 10,
|
||||
"packet": "Ether(type=0x800)/IP(src='10.0.0.10',dst='10.0.0.20')/TCP(sport=5000,dport=10)"
|
||||
}
|
||||
],
|
||||
"cmdUnderTest": "$TC qdisc change dev $DEV1 handle 1: root fq_pie limit 1",
|
||||
"expExitCode": "0",
|
||||
"verifyCmd": "$TC qdisc show dev $DEV1",
|
||||
"matchPattern": "qdisc fq_pie 1: root refcnt [0-9]+ limit 1p",
|
||||
"matchCount": "1",
|
||||
"teardown": ["$TC qdisc del dev $DEV1 handle 1: root"]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -188,5 +188,27 @@
|
||||
"teardown": [
|
||||
"$TC qdisc del dev $DUMMY handle 1: root"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "385f",
|
||||
"name": "HHF test qdisc limit trimming",
|
||||
"category": ["qdisc", "hhf"],
|
||||
"plugins": {"requires": ["nsPlugin", "scapyPlugin"]},
|
||||
"setup": [
|
||||
"$TC qdisc add dev $DEV1 handle 1: root hhf limit 10"
|
||||
],
|
||||
"scapy": [
|
||||
{
|
||||
"iface": "$DEV0",
|
||||
"count": 10,
|
||||
"packet": "Ether(type=0x800)/IP(src='10.0.0.10',dst='10.0.0.20')/TCP(sport=5000,dport=10)"
|
||||
}
|
||||
],
|
||||
"cmdUnderTest": "$TC qdisc change dev $DEV1 handle 1: root hhf limit 1",
|
||||
"expExitCode": "0",
|
||||
"verifyCmd": "$TC qdisc show dev $DEV1",
|
||||
"matchPattern": "qdisc hhf 1: root refcnt [0-9]+ limit 1p.*hh_limit 2048 reset_timeout 40ms admit_bytes 128Kb evict_timeout 1s non_hh_weight 2",
|
||||
"matchCount": "1",
|
||||
"teardown": ["$TC qdisc del dev $DEV1 handle 1: root"]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
[
|
||||
{
|
||||
"id": "6158",
|
||||
"name": "PIE test qdisc limit trimming",
|
||||
"category": ["qdisc", "pie"],
|
||||
"plugins": {"requires": ["nsPlugin", "scapyPlugin"]},
|
||||
"setup": [
|
||||
"$TC qdisc add dev $DEV1 handle 1: root pie limit 10"
|
||||
],
|
||||
"scapy": [
|
||||
{
|
||||
"iface": "$DEV0",
|
||||
"count": 10,
|
||||
"packet": "Ether(type=0x800)/IP(src='10.0.0.10',dst='10.0.0.20')/TCP(sport=5000,dport=10)"
|
||||
}
|
||||
],
|
||||
"cmdUnderTest": "$TC qdisc change dev $DEV1 handle 1: root pie limit 1",
|
||||
"expExitCode": "0",
|
||||
"verifyCmd": "$TC qdisc show dev $DEV1",
|
||||
"matchPattern": "qdisc pie 1: root refcnt [0-9]+ limit 1p",
|
||||
"matchCount": "1",
|
||||
"teardown": ["$TC qdisc del dev $DEV1 handle 1: root"]
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user