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: 12288195 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 BA73DC47092 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 8A97F610CB for ; Sun, 30 May 2021 11:41:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229683AbhE3LnE (ORCPT ); Sun, 30 May 2021 07:43:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229580AbhE3LnD (ORCPT ); Sun, 30 May 2021 07:43:03 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86152C061574 for ; Sun, 30 May 2021 04:41:25 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id ot16so5034902pjb.3 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=42AwqpXwsWi3EwJvaWn6paCggPFyOXNRr44FlvApJk8=; b=SyEqM40hRfDFImS0c45Umd9+1CKubC9Osd5MCqJe0w866fajHCsNuCdY6lTkhCulfa tHLYcKcdk9kCUuYzuF91eUo3nGKM5VCPUWwUrBaPspjoRd1AJaru98oc4c8MgBGYSLK0 302m6kpAIjRbaPJi/g5ObV717dwQuO5Sq5j50= 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=42AwqpXwsWi3EwJvaWn6paCggPFyOXNRr44FlvApJk8=; b=FwIVctQCv19QKGoZEJp7rbgmI8l7EvbFu4N4KLBcHb8w5BNWgAsO7/Gil25Adaclby 5RYTqgiIzild2R79ZFZSvb4l3bT0AM/dVTdmq1G64A7Uxd9yutm41tRWhFFYzMX3+QF3 iOv2/OGDOs4iTqxQfclia0agZ9Wyuweg3sVvLLGdamKD3M8/oiGy2L9WjtvOYKWWlQT6 qJ6FieqTVSmXqrMrXy7D9PJzgY9LKsVMhhAaT/hCw/kJYpBaUuzhHLLJdxsY3duLPs13 4IxM72M8ndDZqmIOZhon7FSzibLP6XqjhT/8B/wIuu6N8v8UYL1tEjCc9rstjssG1oSY B06g== X-Gm-Message-State: AOAM531SmIUj4ws3UOBQIFpoT3PQiKfcx7p/OV5DCDA5yIg+XQEAtD6P ivvqzLD93kzbItU6AXEUZ26Lo6y2b3LAIMPShnNdzFDhFnjTn1xt3WkD+6SIqiWpTGRkS88PbtW GN5lCZtDHncMEo2YLOkWnK24ZfwXVWjxvvE5mxCnrWookGPMvNUGkvVpA0az7mA2FBp05+BFM6n bU+Tydruo= 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: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@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