diff mbox series

[net,v2,4/4] selftests: tc-testing: add test for qfq with stab overhead

Message ID 20230707220000.461410-5-pctammela@mojatatu.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series net/sched: fixes for sch_qfq | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/cc_maintainers warning 1 maintainers not CCed: linux-kselftest@vger.kernel.org
netdev/build_clang success Errors and warnings before: 8 this patch: 8
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 43 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Pedro Tammela July 7, 2023, 10 p.m. UTC
A packet with stab overhead greater than QFQ_MAX_LMAX should be dropped
by the QFQ qdisc as it can't handle such lengths.

Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>
---
 .../tc-testing/tc-tests/qdiscs/qfq.json       | 38 +++++++++++++++++++
 1 file changed, 38 insertions(+)

Comments

shaozhengchao July 8, 2023, 6:43 a.m. UTC | #1
On 2023/7/8 6:00, Pedro Tammela wrote:
> A packet with stab overhead greater than QFQ_MAX_LMAX should be dropped
> by the QFQ qdisc as it can't handle such lengths.
> 
> Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
> Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>
> ---
>   .../tc-testing/tc-tests/qdiscs/qfq.json       | 38 +++++++++++++++++++
>   1 file changed, 38 insertions(+)
> 
> diff --git a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/qfq.json b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/qfq.json
> index 965da7622dac..6b8798f8dd04 100644
> --- a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/qfq.json
> +++ b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/qfq.json
> @@ -261,5 +261,43 @@
>           "teardown": [
>               "$IP link del dev $DUMMY type dummy"
>           ]
> +    },
> +    {
> +        "id": "5993",
> +        "name": "QFQ with stab overhead greater than max packet len",
> +        "category": [
> +            "qdisc",
> +            "qfq",
> +            "scapy"
> +        ],
> +        "plugins": {
> +            "requires": [
> +                "nsPlugin",
> +                "scapyPlugin"
> +            ]
> +        },
> +        "setup": [
> +            "$IP link add dev $DUMMY type dummy || /bin/true",
> +            "$IP link set dev $DUMMY up || /bin/true",
> +            "$TC qdisc add dev $DUMMY handle 1: stab mtu 2048 tsize 512 mpu 0 overhead 999999999 linklayer ethernet root qfq",
> +            "$TC class add dev $DUMMY parent 1: classid 1:1 qfq weight 100",
> +            "$TC qdisc add dev $DEV1 clsact",
> +            "$TC filter add dev $DEV1 ingress matchall action mirred egress mirror dev $DUMMY"
> +        ],
> +        "cmdUnderTest": "$TC filter add dev $DUMMY parent 1: matchall classid 1:1",
> +        "scapy": [
> +            {
> +                "iface": "$DEV0",
> +                "count": 22,
> +                "packet": "Ether(type=0x800)/IP(src='10.0.0.10',dst='10.0.0.10')/TCP(sport=5000,dport=10)"
> +            }
> +        ],
> +        "expExitCode": "0",
> +        "verifyCmd": "$TC -s qdisc ls dev $DUMMY",
> +        "matchPattern": "dropped 22",
Hi Pedro:
	I test this patch, but the number of dropped packets in each
test is random, but is always greater than 22. My local machine tests
are not ok. Here's my test results:
All test results:

1..1
not ok 1 5993 - QFQ with stab overhead greater than max packet len
         Could not match regex pattern. Verify command output:
qdisc qfq 1: root refcnt 2
  Sent 0 bytes 0 pkt (dropped 26, overlimits 0 requeues 0)
  backlog 0b 0p requeues 0

Zhengchao Shao

> +        "matchCount": "1",
> +        "teardown": [
> +            "$TC qdisc del dev $DUMMY handle 1: root qfq"
> +        ]
>       }
>   ]
Pedro Tammela July 10, 2023, 4:21 p.m. UTC | #2
On 08/07/2023 03:43, shaozhengchao wrote:
> 
> 
> On 2023/7/8 6:00, Pedro Tammela wrote:
>> A packet with stab overhead greater than QFQ_MAX_LMAX should be dropped
>> by the QFQ qdisc as it can't handle such lengths.
>>
>> Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
>> Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>
>> ---
>>   .../tc-testing/tc-tests/qdiscs/qfq.json       | 38 +++++++++++++++++++
>>   1 file changed, 38 insertions(+)
>>
>> diff --git 
>> a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/qfq.json 
>> b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/qfq.json
>> index 965da7622dac..6b8798f8dd04 100644
>> --- a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/qfq.json
>> +++ b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/qfq.json
>> @@ -261,5 +261,43 @@
>>           "teardown": [
>>               "$IP link del dev $DUMMY type dummy"
>>           ]
>> +    },
>> +    {
>> +        "id": "5993",
>> +        "name": "QFQ with stab overhead greater than max packet len",
>> +        "category": [
>> +            "qdisc",
>> +            "qfq",
>> +            "scapy"
>> +        ],
>> +        "plugins": {
>> +            "requires": [
>> +                "nsPlugin",
>> +                "scapyPlugin"
>> +            ]
>> +        },
>> +        "setup": [
>> +            "$IP link add dev $DUMMY type dummy || /bin/true",
>> +            "$IP link set dev $DUMMY up || /bin/true",
>> +            "$TC qdisc add dev $DUMMY handle 1: stab mtu 2048 tsize 
>> 512 mpu 0 overhead 999999999 linklayer ethernet root qfq",
>> +            "$TC class add dev $DUMMY parent 1: classid 1:1 qfq 
>> weight 100",
>> +            "$TC qdisc add dev $DEV1 clsact",
>> +            "$TC filter add dev $DEV1 ingress matchall action mirred 
>> egress mirror dev $DUMMY"
>> +        ],
>> +        "cmdUnderTest": "$TC filter add dev $DUMMY parent 1: matchall 
>> classid 1:1",
>> +        "scapy": [
>> +            {
>> +                "iface": "$DEV0",
>> +                "count": 22,
>> +                "packet": 
>> "Ether(type=0x800)/IP(src='10.0.0.10',dst='10.0.0.10')/TCP(sport=5000,dport=10)"
>> +            }
>> +        ],
>> +        "expExitCode": "0",
>> +        "verifyCmd": "$TC -s qdisc ls dev $DUMMY",
>> +        "matchPattern": "dropped 22",
> Hi Pedro:
>      I test this patch, but the number of dropped packets in each
> test is random, but is always greater than 22. My local machine tests
> are not ok. Here's my test results:
> All test results:
> 
> 1..1
> not ok 1 5993 - QFQ with stab overhead greater than max packet len
>          Could not match regex pattern. Verify command output:
> qdisc qfq 1: root refcnt 2
>   Sent 0 bytes 0 pkt (dropped 26, overlimits 0 requeues 0)
>   backlog 0b 0p requeues 0

I see, looks like some IPv6 probes / ARP / etc... are going through.
I will fix it, thank you!

> 
> Zhengchao Shao
> 
>> +        "matchCount": "1",
>> +        "teardown": [
>> +            "$TC qdisc del dev $DUMMY handle 1: root qfq"
>> +        ]
>>       }
>>   ]
diff mbox series

Patch

diff --git a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/qfq.json b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/qfq.json
index 965da7622dac..6b8798f8dd04 100644
--- a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/qfq.json
+++ b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/qfq.json
@@ -261,5 +261,43 @@ 
         "teardown": [
             "$IP link del dev $DUMMY type dummy"
         ]
+    },
+    {
+        "id": "5993",
+        "name": "QFQ with stab overhead greater than max packet len",
+        "category": [
+            "qdisc",
+            "qfq",
+            "scapy"
+        ],
+        "plugins": {
+            "requires": [
+                "nsPlugin",
+                "scapyPlugin"
+            ]
+        },
+        "setup": [
+            "$IP link add dev $DUMMY type dummy || /bin/true",
+            "$IP link set dev $DUMMY up || /bin/true",
+            "$TC qdisc add dev $DUMMY handle 1: stab mtu 2048 tsize 512 mpu 0 overhead 999999999 linklayer ethernet root qfq",
+            "$TC class add dev $DUMMY parent 1: classid 1:1 qfq weight 100",
+            "$TC qdisc add dev $DEV1 clsact",
+            "$TC filter add dev $DEV1 ingress matchall action mirred egress mirror dev $DUMMY"
+        ],
+        "cmdUnderTest": "$TC filter add dev $DUMMY parent 1: matchall classid 1:1",
+        "scapy": [
+            {
+                "iface": "$DEV0",
+                "count": 22,
+                "packet": "Ether(type=0x800)/IP(src='10.0.0.10',dst='10.0.0.10')/TCP(sport=5000,dport=10)"
+            }
+        ],
+        "expExitCode": "0",
+        "verifyCmd": "$TC -s qdisc ls dev $DUMMY",
+        "matchPattern": "dropped 22",
+        "matchCount": "1",
+        "teardown": [
+            "$TC qdisc del dev $DUMMY handle 1: root qfq"
+        ]
     }
 ]