From patchwork Mon Apr 11 13:30:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Sukholitko X-Patchwork-Id: 12809103 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40D71C433EF for ; Mon, 11 Apr 2022 13:31:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346505AbiDKNdk (ORCPT ); Mon, 11 Apr 2022 09:33:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346494AbiDKNdj (ORCPT ); Mon, 11 Apr 2022 09:33:39 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 295F3DF11 for ; Mon, 11 Apr 2022 06:31:25 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id b15so14605342pfm.5 for ; Mon, 11 Apr 2022 06:31: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=1D8cBDUIV+J9eoOmtpf1nyuwoHHpt+rjGe4uIZUUhgw=; b=cxIKiQTcjGbUQDTqT9722VMOlwdYB1cVnL4p2Nv/nC4DCFLW5YwJBwWEgasYWPSLSr 67+Yf1Rw65y2nU2K55NJ2dR6h72PZxZ2aErmssDo0awdLDcLaA/yn6yNCQUp/QOaZYjA sPs8JW4sgdH6j0OH1iLEnhTpn3iE4WAsDCvXY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version; bh=1D8cBDUIV+J9eoOmtpf1nyuwoHHpt+rjGe4uIZUUhgw=; b=mrcPKvOr5ln3laDptiway4Zywae0QKD/oHAv24hkI10ljLVW1pNIp/jaWpBWypK7Ns SHv8rR+sQTE+XYj5nm0Cb8Lnq/uRqzs4XkXob6kO+A7kAPqKZvrnLgnJ/+1zOUY/fVtv di//QXcZSBNmiEbb30mg3sc38mnldaoHl74GVB1YAbDV6OX0znXV+unx2YZ1QABtkYHX XGQR4y3W6UHkRw1CMqGG7YJrTHostzeXqGiwPcL7C9z9Yh8LqOc2Agx5e15dY0x9gbjb Oggq9NRk/8kvWhaqfr3PqfdJ+LQGz3r5y/eYW4FZHAm7xgCpigwINmrxvbZReYFarWg7 eKig== X-Gm-Message-State: AOAM530MTIlwBlP9era5aI//SERhe7CsaKUbSNm+Dz+OxA/O7RPh3Wyx gZBaMlB4jjgWNwg66VCDATcewnrgC191rUihHJ7PjjPc7E26unIXtJplYJGi1bR4z4Q3sWUWBNB 5LBCjzCckXGSyqFxg5NVPbuNOoBCIxH9FLVeaR1NgQpPoRzP1jw/HFBJO6qhagzftQA9Ndsmifw ndjkrpIIdnDw== X-Google-Smtp-Source: ABdhPJzZDTBM08cSOp4XL/YadA9YbGkprQHzQ76TSmuDhoBxkE7q2xFRnGC4sL6+pibARbigTnVysw== X-Received: by 2002:a62:bd07:0:b0:505:c3e2:8d5a with SMTP id a7-20020a62bd07000000b00505c3e28d5amr4854666pff.48.1649683884217; Mon, 11 Apr 2022 06:31:24 -0700 (PDT) Received: from localhost.localdomain ([192.19.250.250]) by smtp.gmail.com with ESMTPSA id a38-20020a056a001d2600b004f70d5e92basm35716311pfx.34.2022.04.11.06.31.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Apr 2022 06:31:23 -0700 (PDT) From: Boris Sukholitko To: netdev@vger.kernel.org, "David S . Miller" , Jakub Kicinski , Jamal Hadi Salim , Cong Wang , Jiri Pirko , "Gustavo A . R . Silva" , Vladimir Oltean , Eric Dumazet , zhang kai , Yoshiki Komachi Cc: Ilya Lifshits , Boris Sukholitko Subject: [PATCH net-next 0/5] flower: match on the number of vlan tags Date: Mon, 11 Apr 2022 16:30:55 +0300 Message-Id: <20220411133100.18126-1-boris.sukholitko@broadcom.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Hi, Our customers in the fiber telecom world have network configurations where they would like to control their traffic according to the number of tags appearing in the packet. For example, TR247 GPON conformance test suite specification mostly talks about untagged, single, double tagged packets and gives lax guidelines on the vlan protocol vs. number of vlan tags. This is different from the common IT networks where 802.1Q and 802.1ad protocols are usually describe single and double tagged packet. GPON configurations that we work with have arbitrary mix the above protocols and number of vlan tags in the packet. The following patch series implement number of vlans flower filter. They add num_of_vlans flower filter as an alternative to vlan ethtype protocol matching. The end result is that the following command becomes possible: tc filter add dev eth1 ingress flower \ num_of_vlans 1 vlan_prio 5 action drop More about the patch series: - patches 1-2 remove duplicate code by introducing is_key_vlan helper. - patch 3, 4 implement num_of_vlans in the dissector and in the flower. - patch 5 uses the num_of_vlans filter to allow further matching on vlan attributes. Complementary iproute2 patches are being sent separately. Thanks, Boris. Boris Sukholitko (5): Helper function for vlan ethtype checks Reduce identation after is_key_vlan refactoring Add number of vlan tags dissector Add number of vlan tags filter to the flower Consider the number of vlan tags for vlan filters include/net/flow_dissector.h | 9 ++++ include/uapi/linux/pkt_cls.h | 2 + net/core/flow_dissector.c | 20 +++++++++ net/sched/cls_flower.c | 86 +++++++++++++++++++++++------------- 4 files changed, 86 insertions(+), 31 deletions(-)