From patchwork Tue Jun 1 12:30:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Sukholitko X-Patchwork-Id: 451812 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, 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 C2C3EC47080 for ; Tue, 1 Jun 2021 12:31:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AA7596008E for ; Tue, 1 Jun 2021 12:31:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233862AbhFAMdh (ORCPT ); Tue, 1 Jun 2021 08:33:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233729AbhFAMdg (ORCPT ); Tue, 1 Jun 2021 08:33:36 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55A49C06174A for ; Tue, 1 Jun 2021 05:31:55 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id c12so11283452pfl.3 for ; Tue, 01 Jun 2021 05:31:55 -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=tt4UTl0/yqgJqUHNbTVL9Kn2l5BHF4ZUzzcqwX/hqwc=; b=FzpNB4LjDlKJR3acBA9pUSNGBJ28AYfzcq2EizFg14KS38SrfA3F1EyLUxm2R4/wkE kcX0CxyWYKa1ZK+F+9TTR9nDqHwZQyL3xmlUohdzBwTst2QZ0J8g2tlc2Nn80DpAdaEv QuWD4aZZbio9mWVme3wU6Foak65OQFMnXxCJ4= 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=tt4UTl0/yqgJqUHNbTVL9Kn2l5BHF4ZUzzcqwX/hqwc=; b=R/44CfoPLs8xTUaYnZvaoLg/hbkSVG+te9tNBNJcM4JsD1VdDu/zCzJHWxdmfcJVHp LYOInahwKEqUwJ7of5+L9f6qiL11UbJ6bjylZTMyCJ+pcedbwQZXgPUUMCCEltrhQWMj 6doFEA07wkEaN51FBwq0cHi02AQgsE1pOM/IRQ5HrIbtCWT+YlfHd3gjhs4yL+U++j8P uXBRUhzWG9ZqwSESe5cXU5Unczz9iaamSdnzbbMS2/MMKNPDvlv25SifObXe0AcOb1YR 9lY1+ZbO9x8+cOG5F+FGrC4jSrgnOihhjec0+JX+gZhCp6dqnztS+QzKCv8hnnTGtUrg 3+OA== X-Gm-Message-State: AOAM5303UuoMhTwx8/hM1qKuFNMZxIwPCABqhxKVTb07mTYRanWfWNrG aSnhHfOh+/79kIZVYDqimOzqqWOyBcNF10FG4dhex7V7kZ/yb+6DU1NvRXe9VgBl8B02+4TW25P g6Z024DetwBEYWco73/+bCjWfZWe6RMeLUvuDAtB3FXlAS/TRQyQur9TX30UczHilwIonMSLYSF DdaSGzUVE= X-Google-Smtp-Source: ABdhPJwJkFXTN6FLAJNRsylgU5zl2Y7CVxK1p4yYEGQbNlns+tv0DaSvJiZgreIMIaQoa45XxfPHPw== X-Received: by 2002:a63:f154:: with SMTP id o20mr1931315pgk.53.1622550714233; Tue, 01 Jun 2021 05:31:54 -0700 (PDT) Received: from localhost.localdomain ([192.19.250.250]) by smtp.gmail.com with ESMTPSA id p19sm13887734pgi.59.2021.06.01.05.31.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Jun 2021 05:31:53 -0700 (PDT) From: Boris Sukholitko To: netdev@vger.kernel.org, Jamal Hadi Salim , Jiri Pirko , Cong Wang Cc: "David S . Miller" , linux-kselftest@vger.kernel.org, shuah@kernel.org, Ilya Lifshits , Shmulik Ladkani , Jakub Kicinski , Davide Caratti , Boris Sukholitko Subject: [PATCH net-next v4 2/3] net/sched: act_vlan: No dump for unset priority Date: Tue, 1 Jun 2021 15:30:51 +0300 Message-Id: <20210601123052.3887-3-boris.sukholitko@broadcom.com> X-Mailer: git-send-email 2.29.3 In-Reply-To: <20210601123052.3887-1-boris.sukholitko@broadcom.com> References: <20210601123052.3887-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 ++-- tools/testing/selftests/tc-testing/tc-tests/actions/vlan.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/net/sched/act_vlan.c b/net/sched/act_vlan.c index a108469c664f..71f2015c70ca 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 527ce5410314..1d9d261aa0b3 100644 --- a/tools/testing/selftests/tc-testing/tc-tests/actions/vlan.json +++ b/tools/testing/selftests/tc-testing/tc-tests/actions/vlan.json @@ -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"