From patchwork Tue May 25 15:35:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Sukholitko X-Patchwork-Id: 448764 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 CD95CC2B9F8 for ; Tue, 25 May 2021 15:37:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B2925613E1 for ; Tue, 25 May 2021 15:37:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232972AbhEYPjV (ORCPT ); Tue, 25 May 2021 11:39:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232078AbhEYPjU (ORCPT ); Tue, 25 May 2021 11:39:20 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05E13C061574 for ; Tue, 25 May 2021 08:37:51 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id u7so7975474plq.4 for ; Tue, 25 May 2021 08:37:51 -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=8/8oWcAQ8WZAgDoNDxoPvPqw92sRS1HARKUVudT3Dwk=; b=CmtCDXpEVUTudB/zpvaCtOpKTqHx+oQnboFNSsDhvn8Mp7Yefxaf/RjJRy/HnDJaZc 1e745b9n8If3he49uFyh72zBXkxLO7CswN0S/5KZJ0Dd4m+2y23t1ZpElBP9U/QmTgSv 1EihrNDdVDHueBEbQ44/jpJoRByVssZl/v2m0= 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=8/8oWcAQ8WZAgDoNDxoPvPqw92sRS1HARKUVudT3Dwk=; b=iY/crnZYVZTGvvm/G5c/bzAn0KGqvAjzdRKQkNABeyfZLocGhJMoDtHDHDSTrigUYY 8uhvn6us8TMF0cSWLSq/uTF3Vvf1LXs/1G8GYX8+ifm4t1jKAcTkPFun/VvqOKSaDfRl jMQJCA4jjWec6HC15tXdJsfoKACmJxzckKoqoFv55qr5X9y7hgx6Hf71/Q6JxhcLzBzc uDWTqy88D6UCNN/G5d3nB7eS2ft+lClH5M8QJ40dnWLQMMKrYFHW8BXITMkwlSGZfLAh Gz98H3ZijiwlejUBf0dxMl2iYlctJciNbfWxTAhyJrZT8D3CXLItKQ2UlKroMDy7A6lw qNWA== X-Gm-Message-State: AOAM530Rq0SzRP6veDnfsHH0IiuoP78+W/Qh00Vlzvm0Q94Vdk2SETrM V5Pg6tGNXZ+yl5wqJkFyU3FAFnXLzpTIvsAyve51e5ufJqCWDQ2l+xZgbp7AqJPhW1p9hn49wmX iQpIvLH7TKIVrG4Dh+0R+WKcBfGGy/luZ2IE7VKtptNpy2jwOW0vFp15Eq5o1zHSegQxiBirMHQ 5d42iRWuY= X-Google-Smtp-Source: ABdhPJxCRuiTEMZp+oSXCinGTN9yp9GD3i5bZg7M93Hz1P3WGKeHrCo5RrPx2XiQFl0mtW12q8KjmQ== X-Received: by 2002:a17:902:650f:b029:ef:905f:e82f with SMTP id b15-20020a170902650fb02900ef905fe82fmr30871915plk.78.1621957069980; Tue, 25 May 2021 08:37:49 -0700 (PDT) Received: from localhost.localdomain ([192.19.250.250]) by smtp.gmail.com with ESMTPSA id f14sm13388369pjq.50.2021.05.25.08.37.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 May 2021 08:37:49 -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 0/3] net/sched: act_vlan: Fix modify to allow 0 Date: Tue, 25 May 2021 18:35:58 +0300 Message-Id: <20210525153601.6705-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: 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 | 42 +++++++++++++++---- 3 files changed, 41 insertions(+), 13 deletions(-)