From patchwork Mon Sep 11 21:50:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Tammela X-Patchwork-Id: 13380166 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BFD2879FA for ; Mon, 11 Sep 2023 22:00:03 +0000 (UTC) Received: from mail-oo1-xc33.google.com (mail-oo1-xc33.google.com [IPv6:2607:f8b0:4864:20::c33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67B09659E for ; Mon, 11 Sep 2023 14:59:34 -0700 (PDT) Received: by mail-oo1-xc33.google.com with SMTP id 006d021491bc7-5733789a44cso2989056eaf.2 for ; Mon, 11 Sep 2023 14:59:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mojatatu-com.20230601.gappssmtp.com; s=20230601; t=1694469483; x=1695074283; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Uc1jvCNkawSJrIew2eCalHZSjtXqZFta5jKv8McjwD4=; b=XHK6wMbXdlEr3da8Vk+kkislE3AFbfp5KWWZ98AAvE+Dv9hfFKprGymjtatfYSJjHN 7SjD9eGTZGRgfMZ95ivGeL1Tt1Kbx66tJGvxkcGLG53/BVxcNmlzC+OWYJu2sPFi6jiP 3FwOdnCUkl2P9bV31uI40qLqTHazIpUNOYhcPDzdMjOfjOuvVc5j8uomfI+3GeX71N75 uBMEnqtdPwlSrlhAkbpngYcb1FQ9JSkCmxTJEuR4T1vbYqjk1QWRd/DrZnb5H0MKoEFE BRC4QOA7QRA9ND71iaAJhVIHOeTjGu/ABs74etN9QY8GASjJ9op87VBCKqW3yNXB+AKE bPug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694469483; x=1695074283; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Uc1jvCNkawSJrIew2eCalHZSjtXqZFta5jKv8McjwD4=; b=eLA84hW2vDBZ0Gb5OG78rXMy9Z0VwBf+7MUBAYBseOpCHqeRx4wkpnt/61KA0RcV52 o/7nK5vIRpgnEnVLBbWSQKmKP9RZFP0tavbkTto6xIqaMOnmNEXVT+uvwV5oEt/pSqlg 6O2bJPy2Lsd1fQmKPY738VYNaR1Bejb70zNZrRNTyfpxLKjDo3go8ZuSvW6FakbKaTa7 RLpRWTKvonvHqgV/5zpCo2a0kqwCjs36TFYJBVwchTdzWxWeXAZGBmKvFPJzBX3l+rtP rxtp1UrYjqsxDaZodY0Ra5V/Q0Z0Gyhx0Zb+MBY79F8zXo2Y9vydxLsujp4S0CmO9uVd XLuQ== X-Gm-Message-State: AOJu0Yy9wnYigW8MBlKuuA6fB0/rvibVHuEFqu20Rzdt5ZGdGUnqHGyA +/1ZFhzaDcYxscnIYplEuHTx8Q9XzPlL1p0IgIE= X-Google-Smtp-Source: AGHT+IGBaU2mYEnG1KyYC4Gds6CGOgZlPziXGYQphwsX0iVKhwhEzcJSgclF2lO7+L4Y0N0rv+UUrA== X-Received: by 2002:a05:6830:7:b0:6be:e412:22a with SMTP id c7-20020a056830000700b006bee412022amr12380124otp.10.1694469050839; Mon, 11 Sep 2023 14:50:50 -0700 (PDT) Received: from rogue-one.tail33bf8.ts.net ([2804:14d:5c5e:44fb:accd:6e1c:69ae:3f11]) by smtp.gmail.com with ESMTPSA id 3-20020a4a0603000000b0057635c1a4f2sm3776869ooj.25.2023.09.11.14.50.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 14:50:50 -0700 (PDT) From: Pedro Tammela To: netdev@vger.kernel.org Cc: jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, shuah@kernel.org, victor@mojatatu.com, Pedro Tammela Subject: [PATCH net-next v3 1/4] selftests/tc-testing: cls_fw: add tests for classid Date: Mon, 11 Sep 2023 18:50:13 -0300 Message-Id: <20230911215016.1096644-2-pctammela@mojatatu.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230911215016.1096644-1-pctammela@mojatatu.com> References: <20230911215016.1096644-1-pctammela@mojatatu.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org As discussed in '76e42ae83199', cls_fw was handling the use of classid incorrectly. Add a few tests to check if it's conforming to the correct behaviour. Reviewed-by: Victor Nogueira Signed-off-by: Pedro Tammela --- .../tc-testing/tc-tests/filters/fw.json | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/tools/testing/selftests/tc-testing/tc-tests/filters/fw.json b/tools/testing/selftests/tc-testing/tc-tests/filters/fw.json index 742ebc34e15c..a9b071e1354b 100644 --- a/tools/testing/selftests/tc-testing/tc-tests/filters/fw.json +++ b/tools/testing/selftests/tc-testing/tc-tests/filters/fw.json @@ -1343,5 +1343,54 @@ "teardown": [ "$TC qdisc del dev $DEV1 ingress" ] + }, + { + "id": "e470", + "name": "Try to delete class referenced by fw after a replace", + "category": [ + "filter", + "fw" + ], + "plugins": { + "requires": "nsPlugin" + }, + "setup": [ + "$TC qdisc add dev $DEV1 parent root handle 10: drr", + "$TC class add dev $DEV1 parent root classid 1 drr", + "$TC filter add dev $DEV1 parent 10: handle 1 prio 1 fw classid 10:1 action ok", + "$TC filter replace dev $DEV1 parent 10: handle 1 prio 1 fw classid 10:1 action drop" + ], + "cmdUnderTest": "$TC class delete dev $DEV1 parent 10: classid 10:1", + "expExitCode": "2", + "verifyCmd": "$TC class show dev $DEV1", + "matchPattern": "class drr 10:1", + "matchCount": "1", + "teardown": [ + "$TC qdisc del dev $DEV1 parent root drr" + ] + }, + { + "id": "ec1a", + "name": "Replace fw classid with nil", + "category": [ + "filter", + "fw" + ], + "plugins": { + "requires": "nsPlugin" + }, + "setup": [ + "$TC qdisc add dev $DEV1 parent root handle 10: drr", + "$TC class add dev $DEV1 parent root classid 1 drr", + "$TC filter add dev $DEV1 parent 10: handle 1 prio 1 fw classid 10:1 action ok" + ], + "cmdUnderTest": "$TC filter replace dev $DEV1 parent 10: handle 1 prio 1 fw action drop", + "expExitCode": "0", + "verifyCmd": "$TC filter show dev $DEV1 parent 10:", + "matchPattern": "fw chain 0 handle 0x1", + "matchCount": "1", + "teardown": [ + "$TC qdisc del dev $DEV1 parent root drr" + ] } ]