From patchwork Tue Jun 1 12:30:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Sukholitko X-Patchwork-Id: 451813 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=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MIME_NO_TEXT, 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 BB177C47092 for ; Tue, 1 Jun 2021 12:31:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 94F9661009 for ; Tue, 1 Jun 2021 12:31:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233771AbhFAMdQ (ORCPT ); Tue, 1 Jun 2021 08:33:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231219AbhFAMdL (ORCPT ); Tue, 1 Jun 2021 08:33:11 -0400 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50B8EC06174A for ; Tue, 1 Jun 2021 05:31:30 -0700 (PDT) Received: by mail-pf1-x42a.google.com with SMTP id y15so7315265pfl.4 for ; Tue, 01 Jun 2021 05:31:30 -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:mime-version; bh=cKVMYw+0HTDTL921BaFm0P7eL0KS6KgxVOUFONB9/v0=; b=JwlP3BjHAgKSnDJkBMzz5iOUY0B74AjwmRh6nVbU05Hx+KlRO0R30j0mxXcPBtScq/ ZGkOMAOMRaZ7zoLvz3PD+EEXTWzMTMCbxJwxwPztgCeYYBPdDaTUlvwGDv2GeuYzXTLT UkezBHrzTYIMgZHB/B62vLAjV4pYKxyv38yMQ= 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:mime-version; bh=cKVMYw+0HTDTL921BaFm0P7eL0KS6KgxVOUFONB9/v0=; b=LVSg7TIUNLNnAYrYJU8mMXBtTJ2DbrEhbR1e364sriFRC8Yywt59N1HZD94RRVK1qX q9vFZL+LZ1MaxtqJTRcLESozxa27GjuPEJZGCqRHlH4AqF0TU/eHq0ZQPkureWGobdOe b2X7Bl0cvDab3Uq9LFL5NKBZhKVT7RluwCc27l/DdLPcxZARrVhWSADXz+SH9HPEL/L+ CZvNKwI0RN4xkbq4zGiLT3ZveH8e4NaGSqtkGJ2uXxvAQ9wJT7zBMJUXSJZBMNGV6Y8u VhhVr2/4miMtD5GJUIdPR8vFQP94yLgpxdscnFRW4EqI21kOj6bI/bXa+VDiKSgdz5VR nQag== X-Gm-Message-State: AOAM532JsyrG7CsZvZfFNQxlNIL7MDnT919WYZ5kApaC9O7B9QB6RDD7 +TeZGFSql39qiYce0wv71fPOR4ei2QhgAaTb9YQFAsRKFIzVR7i0vvwa62bYvIGyOWypz3BbzmI 671fnJlKi+aFWUFdMo1gbtLs9b+KAIrYegSCG7ty1X++0LxZ/dQl+8uXEUKVjykYEJ/WOLBSzQn UvmblDhOQ= X-Google-Smtp-Source: ABdhPJySIF29/6LqRONDg767wtyldbweRVtAfwMDp8S+K7/6Qq2Y3vuBk4xX4GhtOw5dIDxy05BnIw== X-Received: by 2002:a05:6a00:14cb:b029:2be:1466:5a28 with SMTP id w11-20020a056a0014cbb02902be14665a28mr21564880pfu.55.1622550689237; Tue, 01 Jun 2021 05:31:29 -0700 (PDT) Received: from localhost.localdomain ([192.19.250.250]) by smtp.gmail.com with ESMTPSA id p19sm13887734pgi.59.2021.06.01.05.31.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Jun 2021 05:31:28 -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 0/3] net/sched: act_vlan: Fix modify to allow 0 Date: Tue, 1 Jun 2021 15:30:49 +0300 Message-Id: <20210601123052.3887-1-boris.sukholitko@broadcom.com> X-Mailer: git-send-email 2.29.3 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Currently vlan modification action checks existence of vlan priority by comparing it to 0. Therefore it is impossible to modify existing vlan tag to have priority 0. For example, the following tc command will change the vlan id but will not affect vlan priority: tc filter add dev eth1 ingress matchall action vlan modify id 300 \ priority 0 pipe mirred egress redirect dev eth2 The incoming packet on eth1: ethertype 802.1Q (0x8100), vlan 200, p 4, ethertype IPv4 will be changed to: ethertype 802.1Q (0x8100), vlan 300, p 4, ethertype IPv4 although the user has intended to have p == 0. The fix is to add tcfv_push_prio_exists flag to struct tcf_vlan_params and rely on it when deciding to set the priority. The same flag is used to avoid dumping unset vlan priority. Change Log: v3 -> v4: - revert tcf_vlan_get_fill_size change: total size calculation may race vs dump v2 -> v3: - Push assumes that the priority is being set - tcf_vlan_get_fill_size accounts for priority existence v1 -> v2: - Do not dump unset priority and fix tests accordingly - Test for priority 0 modification Boris Sukholitko (3): net/sched: act_vlan: Fix modify to allow 0 net/sched: act_vlan: No dump for unset priority net/sched: act_vlan: Test priority 0 modification include/net/tc_act/tc_vlan.h | 1 + net/sched/act_vlan.c | 11 +++++--- .../tc-testing/tc-tests/actions/vlan.json | 28 +++++++++++++++++-- 3 files changed, 34 insertions(+), 6 deletions(-) Reviewed-by: Davide Caratti