From patchwork Sun May 30 11:40: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: 450417 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 A5311C47089 for ; Sun, 30 May 2021 11:41:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 789A5610A8 for ; Sun, 30 May 2021 11:41:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229550AbhE3LnD (ORCPT ); Sun, 30 May 2021 07:43:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229500AbhE3LnC (ORCPT ); Sun, 30 May 2021 07:43:02 -0400 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30819C061574 for ; Sun, 30 May 2021 04:41:25 -0700 (PDT) Received: by mail-pl1-x630.google.com with SMTP id 11so302979plk.12 for ; Sun, 30 May 2021 04:41:25 -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=Q/7/HZqD+1pIRKZYM20y+57cC836+hkfzkDng0SbMng=; b=OqenIYKSXjTi/6W75kC0Tomcz7g88u4ZbqYi2rH4huBwrblKXrGybDAFiFA9NiKbkf eVzN8tNqyDqAuZTD90OnwnEbRizbJSXhgCJpUsilBDaH1C4fI/G8LHVI5Gk4+euEQU69 n3WDrTZ0eK3e9fScE2r2psR3978W6rS9o6naY= 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=Q/7/HZqD+1pIRKZYM20y+57cC836+hkfzkDng0SbMng=; b=ODJjV5d3dzNFnqOFq/noBViGf7AUabuaReLHO1VQWuI2nwixSSqWsx0JQRgdROFGDo Lf2dyCdQp1BdjSmhxmTMkDlAUi8q6KSMOpsZC216/GKD+a7ZUIcFojh1SEenl5fM0qsY fs4y/vHo6BKpDv+u/i1Zfs6lQbvmdZZHFlsFxKLWzwa2Bqjvh2YFYyDTzF5orUDbpmvZ NS+lIOZseczs7J9e+x1HbhsZdhv5dsZw3XWiJUuK+Lk376OcHv2+ZIfG/bTTiMbZghla gv5mmxu2WowPZD6wxks4Gsi1OmjCsMJ/Mx42x37vXEZSwn0YUiATNhgV5YzJTbfrjphG snqQ== X-Gm-Message-State: AOAM530ZS2xuUdMuAYtM/VxNrmPEPyV4KDevWRtBLLKbNlNBhL8d0b2Z 2ACpISmTqE0/fzrHNfHVSGih3Q== X-Google-Smtp-Source: ABdhPJzEDIYtJ6S1kW2faE6BHtoGjhcgRkhjoYRvO80xT46vjpKUhTMdK59NLo6gcoOk/0MAt4G6Lw== X-Received: by 2002:a17:902:8f93:b029:f0:ad44:35ee with SMTP id z19-20020a1709028f93b02900f0ad4435eemr15762448plo.43.1622374884495; Sun, 30 May 2021 04:41:24 -0700 (PDT) Received: from localhost.localdomain ([192.19.250.250]) by smtp.gmail.com with ESMTPSA id o17sm8126093pjp.33.2021.05.30.04.41.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 May 2021 04:41:23 -0700 (PDT) From: Boris Sukholitko To: netdev@vger.kernel.org, Jamal Hadi Salim , Jiri Pirko , Cong Wang Cc: linux-kselftest@vger.kernel.org, shuah@kernel.org, Ilya Lifshits , Shmulik Ladkani , Jakub Kicinski , Davide Caratti , Boris Sukholitko Subject: [PATCH net-next v3 0/3] net/sched: act_vlan: Fix modify to allow 0 Date: Sun, 30 May 2021 14:40:49 +0300 Message-Id: <20210530114052.16483-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: 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 | 26 ++++++++++++----- .../tc-testing/tc-tests/actions/vlan.json | 28 +++++++++++++++++-- 3 files changed, 46 insertions(+), 9 deletions(-) Reviewed-by: Davide Caratti Acked-by: Jamal Hadi Salim