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: 12291241 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 4C0A8C4708F for ; Tue, 1 Jun 2021 12:31:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 22D7E613B1 for ; Tue, 1 Jun 2021 12:31:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233729AbhFAMdN (ORCPT ); Tue, 1 Jun 2021 08:33:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233741AbhFAMdL (ORCPT ); Tue, 1 Jun 2021 08:33:11 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2938C061574 for ; Tue, 1 Jun 2021 05:31:29 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id t8so4357616pgb.9 for ; Tue, 01 Jun 2021 05:31:29 -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=MCJik+jXFQgN11jLIJo3FsmnWJ2q5sQ2wUILuAp4Wy8=; b=Z7oCMoTOAAh69kQUkgI7xne5LP3pczEvDT9tOz5a7udxFW3jgLtQB99eP2squk1/Pu 7uXJ0mjWariY7ruPhLyJzTUq4we5oEqDHex7jUDKTFTEX6bCWSI58dZtuELvI0XJYuNi dahgHbbdBVKjDmEjtow5vz14hvz71GUxdwz6Y= 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=MCJik+jXFQgN11jLIJo3FsmnWJ2q5sQ2wUILuAp4Wy8=; b=dYq2XTChxtvWeqtPb8xPBN5EDyCPiBjYeg/Dy+hxXUmd5V33r/uTxekcyeplJOcvQt zQznt33LF/pqrIwojHT8K3p30z1P2DHGL3SwEy1AN+sYRYZ73aI7Qb3Zz7KXtYnMWOxX l85sxbZHouLgGuwzc7eElZ56K+fE+7tpzEDeTX9BCJ+kxNOBwvmsljfpFNn/EQTbGuUk f6j8BVHjJCVQ8oy99Otbz+SmsSw1YUbw0zQHjZkLO4OqK/IHd9/DxAWx3kYyGJG7Mi6Y uk3OtPfGnhf4ECTdAMaP14e8PVaOoYm3BwEBBL5DEiaz0E23LjrittjsFFUSHBz855T6 NdqA== X-Gm-Message-State: AOAM530NmL5vBND9vWgrz6/+tC5+IQZvsGI8vJKX0XiuSRXrShona0Sh aLb8FPsWD6sidaxMrt7wvoxc6w== 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: linux-kselftest@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