From patchwork Tue May 25 15:36:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Sukholitko X-Patchwork-Id: 448763 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E895AC2B9F8 for ; Tue, 25 May 2021 15:38:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BEA60613F1 for ; Tue, 25 May 2021 15:38:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232972AbhEYPjl (ORCPT ); Tue, 25 May 2021 11:39:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232078AbhEYPjl (ORCPT ); Tue, 25 May 2021 11:39:41 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A728C061574 for ; Tue, 25 May 2021 08:38:11 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id 22so23514594pfv.11 for ; Tue, 25 May 2021 08:38:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version; bh=ogsn444GQIucWh30gOBxNOOapMKLZy9nSGJLZxW0+Sk=; b=egaFYLiPTPXLuhx/+ef6YEifISRTpDR/hASJppy70kk1fQOhpGAAPUTy86CwaE8XHg xWUctMrgBHmXjQo012iDZPoH/CQ+RKVyVvougpWKfrdqdmnBeH80xeFXPMmjqdDmKvyS Cx79BrCkVwThXmBxAw193Iw8j+m0mqfPdosoU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version; bh=ogsn444GQIucWh30gOBxNOOapMKLZy9nSGJLZxW0+Sk=; b=tWVkxlfsuSo9N7sMFcZ+7gNNqaM77ub0HKEO/d/YloBvuOscxK708NTzJsxCe/tGih vMsst3rZqD7dd4xKXIWnBo2eU2hiILUXf3cXN0wSjOshhfFCzTV7F3ZZ/p7A+3/GZYPJ o6aQEE/+OYhWepOTd64jtbZsjt/b2z/Hmv1x8yLJHeGK8xml9jg2zNQZfF6RSwVfXpS+ hqtrRaN0oPmqXFH+y0KapRhMNFwBbt+zbynvTY2sTFnB1s2/iy1K+TuWcBJd2tD/+c82 m728jsspD2BebEuQdcTHR4DtoUByS50us5GX1YEBI4Z0B6wk61RorVRfdlKb3NWT7Rw6 ahxQ== X-Gm-Message-State: AOAM530xKDxKCsbM1X3UT9bgfH0sDi8EDdy+EyhTWHTqjeNxci4PsFrs c4q61d0Ct23h22OwFUOR6K+YCcMpY+dQyjYJiB+xJjJKd7HdIg+qinTxlxWtIcwCNTmQQAQaoFU nA+V6jBjhYGLYmMrkTYaJ+KbgxdkYf8VpGFUEQgcuoZhoGrFf35+G62MOTqxQDXxzYV+AR80WhO d/sOJt+FU= X-Google-Smtp-Source: ABdhPJyIZlm+bV4Z0Tb8MvthgcxEf1eB5Q1Y34Dxkni0d4SUXk5BRl96m97JODQXnKemy3GX4K23eQ== X-Received: by 2002:a63:d245:: with SMTP id t5mr19462103pgi.172.1621957090623; Tue, 25 May 2021 08:38:10 -0700 (PDT) Received: from localhost.localdomain ([192.19.250.250]) by smtp.gmail.com with ESMTPSA id f14sm13388369pjq.50.2021.05.25.08.38.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 May 2021 08:38:10 -0700 (PDT) From: Boris Sukholitko To: netdev@vger.kernel.org, Jamal Hadi Salim , Jiri Pirko , Cong Wang Cc: Ilya Lifshits , Shmulik Ladkani , Jakub Kicinski , Davide Caratti , Boris Sukholitko Subject: [PATCH net-next v2 2/3] net/sched: act_vlan: No dump for unset priority Date: Tue, 25 May 2021 18:36:00 +0300 Message-Id: <20210525153601.6705-3-boris.sukholitko@broadcom.com> X-Mailer: git-send-email 2.29.3 In-Reply-To: <20210525153601.6705-1-boris.sukholitko@broadcom.com> References: <20210525153601.6705-1-boris.sukholitko@broadcom.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Dump vlan priority only if it has been previously set. Fix the tests accordingly. Signed-off-by: Boris Sukholitko --- net/sched/act_vlan.c | 4 ++-- .../tc-testing/tc-tests/actions/vlan.json | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/net/sched/act_vlan.c b/net/sched/act_vlan.c index cca10b5e99c9..6765096b99b3 100644 --- a/net/sched/act_vlan.c +++ b/net/sched/act_vlan.c @@ -307,8 +307,8 @@ static int tcf_vlan_dump(struct sk_buff *skb, struct tc_action *a, (nla_put_u16(skb, TCA_VLAN_PUSH_VLAN_ID, p->tcfv_push_vid) || nla_put_be16(skb, TCA_VLAN_PUSH_VLAN_PROTOCOL, p->tcfv_push_proto) || - (nla_put_u8(skb, TCA_VLAN_PUSH_VLAN_PRIORITY, - p->tcfv_push_prio)))) + (p->tcfv_push_prio_exists && + nla_put_u8(skb, TCA_VLAN_PUSH_VLAN_PRIORITY, p->tcfv_push_prio)))) goto nla_put_failure; if (p->tcfv_action == TCA_VLAN_ACT_PUSH_ETH) { diff --git a/tools/testing/selftests/tc-testing/tc-tests/actions/vlan.json b/tools/testing/selftests/tc-testing/tc-tests/actions/vlan.json index 41d783254b08..4675f1c04d17 100644 --- a/tools/testing/selftests/tc-testing/tc-tests/actions/vlan.json +++ b/tools/testing/selftests/tc-testing/tc-tests/actions/vlan.json @@ -297,7 +297,7 @@ "cmdUnderTest": "$TC actions add action vlan push id 123 index 18", "expExitCode": "0", "verifyCmd": "$TC actions get action vlan index 18", - "matchPattern": "action order [0-9]+: vlan.*push id 123 protocol 802.1Q priority 0 pipe.*index 18 ref", + "matchPattern": "action order [0-9]+: vlan.*push id 123 protocol 802.1Q pipe.*index 18 ref", "matchCount": "1", "teardown": [ "$TC actions flush action vlan" @@ -345,7 +345,7 @@ "cmdUnderTest": "$TC actions add action vlan push id 1024 protocol 802.1AD pass index 10000", "expExitCode": "0", "verifyCmd": "$TC actions get action vlan index 10000", - "matchPattern": "action order [0-9]+: vlan.*push id 1024 protocol 802.1ad priority 0 pass.*index 10000 ref", + "matchPattern": "action order [0-9]+: vlan.*push id 1024 protocol 802.1ad pass.*index 10000 ref", "matchCount": "1", "teardown": [ "$TC actions flush action vlan" @@ -369,7 +369,7 @@ "cmdUnderTest": "$TC actions add action vlan push id 4094 index 1", "expExitCode": "0", "verifyCmd": "$TC actions get action vlan index 1", - "matchPattern": "action order [0-9]+: vlan.*push id 4094.*protocol 802.1Q.*priority 0.*index 1 ref", + "matchPattern": "action order [0-9]+: vlan.*push id 4094.*protocol 802.1Q.*index 1 ref", "matchCount": "1", "teardown": [ "$TC actions flush action vlan" @@ -463,7 +463,7 @@ "cmdUnderTest": "$TC actions add action vlan modify protocol 802.1Q id 5 index 100", "expExitCode": "0", "verifyCmd": "$TC actions get action vlan index 100", - "matchPattern": "action order [0-9]+: vlan.*modify id 100 protocol 802.1Q priority 0 pipe.*index 100 ref", + "matchPattern": "action order [0-9]+: vlan.*modify id 100 protocol 802.1Q pipe.*index 100 ref", "matchCount": "0", "teardown": [ "$TC actions flush action vlan" @@ -487,7 +487,7 @@ "cmdUnderTest": "$TC actions add action vlan modify protocol 802.1ad id 500 reclassify index 12", "expExitCode": "0", "verifyCmd": "$TC actions get action vlan index 12", - "matchPattern": "action order [0-9]+: vlan.*modify id 500 protocol 802.1ad priority 0 reclassify.*index 12 ref", + "matchPattern": "action order [0-9]+: vlan.*modify id 500 protocol 802.1ad reclassify.*index 12 ref", "matchCount": "1", "teardown": [ "$TC actions flush action vlan" @@ -512,7 +512,7 @@ "cmdUnderTest": "$TC actions replace action vlan push id 700 pipe index 12", "expExitCode": "0", "verifyCmd": "$TC actions get action vlan index 12", - "matchPattern": "action order [0-9]+: vlan.*push id 700 protocol 802.1Q priority 0 pipe.*index 12 ref", + "matchPattern": "action order [0-9]+: vlan.*push id 700 protocol 802.1Q pipe.*index 12 ref", "matchCount": "1", "teardown": [ "$TC actions flush action vlan" @@ -537,7 +537,7 @@ "cmdUnderTest": "$TC actions replace action vlan push id 1 protocol 802.1ad pipe index 1", "expExitCode": "0", "verifyCmd": "$TC actions get action vlan index 1", - "matchPattern": "action order [0-9]+: vlan.*push id 1 protocol 802.1ad priority 0 pipe.*index 1 ref", + "matchPattern": "action order [0-9]+: vlan.*push id 1 protocol 802.1ad pipe.*index 1 ref", "matchCount": "1", "teardown": [ "$TC actions flush action vlan" @@ -635,7 +635,7 @@ "cmdUnderTest": "$TC actions del action vlan index 999", "expExitCode": "0", "verifyCmd": "$TC actions list action vlan", - "matchPattern": "action order [0-9]+: vlan.*push id 4094 protocol 802.1Q priority 0 pipe.*index 999 ref", + "matchPattern": "action order [0-9]+: vlan.*push id 4094 protocol 802.1Q pipe.*index 999 ref", "matchCount": "0", "teardown": [] }, @@ -708,7 +708,7 @@ "cmdUnderTest": "$TC actions replace action vlan push id 500 goto chain 42 index 90 cookie c1a0c1a0", "expExitCode": "255", "verifyCmd": "$TC actions get action vlan index 90", - "matchPattern": "action order [0-9]+: vlan.*push id 500 protocol 802.1Q priority 0 pass.*index 90 ref", + "matchPattern": "action order [0-9]+: vlan.*push id 500 protocol 802.1Q pass.*index 90 ref", "matchCount": "1", "teardown": [ "$TC actions flush action vlan"