From patchwork Sat Sep 24 02:51:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: shaozhengchao X-Patchwork-Id: 12987357 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 459DDC6FA90 for ; Sat, 24 Sep 2022 02:51:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233375AbiIXCvc (ORCPT ); Fri, 23 Sep 2022 22:51:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233296AbiIXCvE (ORCPT ); Fri, 23 Sep 2022 22:51:04 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3839F12384C; Fri, 23 Sep 2022 19:51:03 -0700 (PDT) Received: from dggpeml500026.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MZD3G0CnMzpTyL; Sat, 24 Sep 2022 10:48:10 +0800 (CST) Received: from huawei.com (10.175.101.6) by dggpeml500026.china.huawei.com (7.185.36.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sat, 24 Sep 2022 10:51:01 +0800 From: Zhengchao Shao To: , , , , , , CC: , , Subject: [PATCH net-next,v3 09/15] selftests/tc-testing: add selftests for plug qdisc Date: Sat, 24 Sep 2022 10:51:51 +0800 Message-ID: <20220924025157.331635-10-shaozhengchao@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220924025157.331635-1-shaozhengchao@huawei.com> References: <20220924025157.331635-1-shaozhengchao@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml500026.china.huawei.com (7.185.36.106) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Test 3289: Create PLUG with default setting Test 0917: Create PLUG with block setting Test 483b: Create PLUG with release setting Test 4995: Create PLUG with release_indefinite setting Test 389c: Create PLUG with limit setting Test 384a: Delete PLUG with valid handle Test 439a: Replace PLUG with limit setting Test 9831: Change PLUG with limit setting Signed-off-by: Zhengchao Shao --- tools/testing/selftests/tc-testing/config | 1 + .../tc-testing/tc-tests/qdiscs/plug.json | 188 ++++++++++++++++++ 2 files changed, 189 insertions(+) create mode 100644 tools/testing/selftests/tc-testing/tc-tests/qdiscs/plug.json diff --git a/tools/testing/selftests/tc-testing/config b/tools/testing/selftests/tc-testing/config index 86d57d599d67..2a85ecc4a241 100644 --- a/tools/testing/selftests/tc-testing/config +++ b/tools/testing/selftests/tc-testing/config @@ -19,6 +19,7 @@ CONFIG_NET_SCH_ETF=m CONFIG_NET_SCH_FQ=m CONFIG_NET_SCH_GRED=m CONFIG_NET_SCH_HHF=m +CONFIG_NET_SCH_PLUG=m CONFIG_NET_SCH_PRIO=m CONFIG_NET_SCH_INGRESS=m diff --git a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/plug.json b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/plug.json new file mode 100644 index 000000000000..6454518af178 --- /dev/null +++ b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/plug.json @@ -0,0 +1,188 @@ +[ + { + "id": "3289", + "name": "Create PLUG with default setting", + "category": [ + "qdisc", + "plug" + ], + "plugins": { + "requires": "nsPlugin" + }, + "setup": [ + "$IP link add dev $DUMMY type dummy || /bin/true" + ], + "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root plug", + "expExitCode": "0", + "verifyCmd": "$TC qdisc show dev $DUMMY", + "matchPattern": "qdisc plug 1: root refcnt", + "matchCount": "1", + "teardown": [ + "$TC qdisc del dev $DUMMY handle 1: root", + "$IP link del dev $DUMMY type dummy" + ] + }, + { + "id": "0917", + "name": "Create PLUG with block setting", + "category": [ + "qdisc", + "plug" + ], + "plugins": { + "requires": "nsPlugin" + }, + "setup": [ + "$IP link add dev $DUMMY type dummy || /bin/true" + ], + "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root plug block", + "expExitCode": "0", + "verifyCmd": "$TC qdisc show dev $DUMMY", + "matchPattern": "qdisc plug 1: root refcnt", + "matchCount": "1", + "teardown": [ + "$TC qdisc del dev $DUMMY handle 1: root", + "$IP link del dev $DUMMY type dummy" + ] + }, + { + "id": "483b", + "name": "Create PLUG with release setting", + "category": [ + "qdisc", + "plug" + ], + "plugins": { + "requires": "nsPlugin" + }, + "setup": [ + "$IP link add dev $DUMMY type dummy || /bin/true" + ], + "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root plug release", + "expExitCode": "0", + "verifyCmd": "$TC qdisc show dev $DUMMY", + "matchPattern": "qdisc plug 1: root refcnt", + "matchCount": "1", + "teardown": [ + "$TC qdisc del dev $DUMMY handle 1: root", + "$IP link del dev $DUMMY type dummy" + ] + }, + { + "id": "4995", + "name": "Create PLUG with release_indefinite setting", + "category": [ + "qdisc", + "plug" + ], + "plugins": { + "requires": "nsPlugin" + }, + "setup": [ + "$IP link add dev $DUMMY type dummy || /bin/true" + ], + "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root plug release_indefinite", + "expExitCode": "0", + "verifyCmd": "$TC qdisc show dev $DUMMY", + "matchPattern": "qdisc plug 1: root refcnt", + "matchCount": "1", + "teardown": [ + "$TC qdisc del dev $DUMMY handle 1: root", + "$IP link del dev $DUMMY type dummy" + ] + }, + { + "id": "389c", + "name": "Create PLUG with limit setting", + "category": [ + "qdisc", + "plug" + ], + "plugins": { + "requires": "nsPlugin" + }, + "setup": [ + "$IP link add dev $DUMMY type dummy || /bin/true" + ], + "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root plug limit 100", + "expExitCode": "0", + "verifyCmd": "$TC qdisc show dev $DUMMY", + "matchPattern": "qdisc plug 1: root refcnt", + "matchCount": "1", + "teardown": [ + "$TC qdisc del dev $DUMMY handle 1: root", + "$IP link del dev $DUMMY type dummy" + ] + }, + { + "id": "384a", + "name": "Delete PLUG with valid handle", + "category": [ + "qdisc", + "plug" + ], + "plugins": { + "requires": "nsPlugin" + }, + "setup": [ + "$IP link add dev $DUMMY type dummy || /bin/true", + "$TC qdisc add dev $DUMMY handle 1: root plug" + ], + "cmdUnderTest": "$TC qdisc del dev $DUMMY handle 1: root", + "expExitCode": "0", + "verifyCmd": "$TC qdisc show dev $DUMMY", + "matchPattern": "qdisc plug 1: root refcnt", + "matchCount": "0", + "teardown": [ + "$IP link del dev $DUMMY type dummy" + ] + }, + { + "id": "439a", + "name": "Replace PLUG with limit setting", + "category": [ + "qdisc", + "plug" + ], + "plugins": { + "requires": "nsPlugin" + }, + "setup": [ + "$IP link add dev $DUMMY type dummy || /bin/true", + "$TC qdisc add dev $DUMMY handle 1: root plug" + ], + "cmdUnderTest": "$TC qdisc replace dev $DUMMY handle 1: root plug limit 1000", + "expExitCode": "0", + "verifyCmd": "$TC qdisc show dev $DUMMY", + "matchPattern": "qdisc plug 1: root refcnt", + "matchCount": "1", + "teardown": [ + "$TC qdisc del dev $DUMMY handle 1: root", + "$IP link del dev $DUMMY type dummy" + ] + }, + { + "id": "9831", + "name": "Change PLUG with limit setting", + "category": [ + "qdisc", + "plug" + ], + "plugins": { + "requires": "nsPlugin" + }, + "setup": [ + "$IP link add dev $DUMMY type dummy || /bin/true", + "$TC qdisc add dev $DUMMY handle 1: root plug" + ], + "cmdUnderTest": "$TC qdisc change dev $DUMMY handle 1: root plug limit 1000", + "expExitCode": "0", + "verifyCmd": "$TC qdisc show dev $DUMMY", + "matchPattern": "qdisc plug 1: root refcnt", + "matchCount": "1", + "teardown": [ + "$TC qdisc del dev $DUMMY handle 1: root", + "$IP link del dev $DUMMY type dummy" + ] + } +]