From patchwork Tue Apr 26 09:14:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Sukholitko X-Patchwork-Id: 12826748 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 DC063C433F5 for ; Tue, 26 Apr 2022 09:54:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345166AbiDZJ5R (ORCPT ); Tue, 26 Apr 2022 05:57:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347850AbiDZJ4w (ORCPT ); Tue, 26 Apr 2022 05:56:52 -0400 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16E7735A83 for ; Tue, 26 Apr 2022 02:14:53 -0700 (PDT) Received: by mail-pl1-x633.google.com with SMTP id p6so1742040plf.9 for ; Tue, 26 Apr 2022 02:14:53 -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=Ylfo6LQgoTLIH9G48v53LryPtOynF+I+OX8S7pJO2O4=; b=S9RQ9e77PAJdx3VOdJN7no4cA2AfD6KYxitqsYPV+so/ZPn0hMiA4Ld15evY+ZzzuB BuRisuGmh4UoP2vNIi6wPJ6JSRnofeHXvHO+FhY9en5WIY+F5I5ia2znwAg8/TPHirqP 8iH51JCwRnxmMI+L0bahrwURGO8FQIGwZzdlk= 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=Ylfo6LQgoTLIH9G48v53LryPtOynF+I+OX8S7pJO2O4=; b=SRVfzd5Nam+Zzkef6qdOTgZwzZCEn9PjlfL/nxjWdXQn+Ii97r5HpgYxL3/XZplGWB /4pwfrIYTPcbrp2eLRlInyBmzH+5jZ7pcOgsYCBoQY2/7LCtEfJDCb5Uuuj/esNexGov p30p60TqP8iMFzaXw5Rz8bGT/+6YJWXCjwk6lXWv7tnBuKLZB2+yHxMap4ndc2u36Vhh muDWQNU++cpszuRCwOwZIeNVGtYGe0imF38k/zS2MW74kNOiajVfa6YWu4Ncj6hthSBX zISwGiJtjpSEHJPwxnpIchJ0FHvUb2LpOXueT/ZfvMYaUMuXtUqPnXjUbSFghbrUWoqY Wevg== X-Gm-Message-State: AOAM530D8rf5wtAzqodQLrpURHe0D07BDzf7cq2OeJEJy/ab5TbqVVIS UOa5yqWgtP8TZIHc2du62NsYGKxzwz6GtQMIJlsqC9pYku4kcAohNmvZayf0EodkkuCNsdK7AJ0 QDuX+820bFCcCZ4AMSdR5BN8s4Qk2tQEehE/eTDNC0dM5fQp3nK9vh71naRcpzdi+cW51WtwgOn z5o9mD X-Google-Smtp-Source: ABdhPJyLJIn6EpHFSIB5X3xB7awYNJUr6hcowCLB86XBWgfxLC+jGCyc9E8jj7Ikn04bAB8z1a4Adg== X-Received: by 2002:a17:90a:c002:b0:1d9:250a:73c8 with SMTP id p2-20020a17090ac00200b001d9250a73c8mr19683382pjt.133.1650964491922; Tue, 26 Apr 2022 02:14:51 -0700 (PDT) Received: from localhost.localdomain ([192.19.250.250]) by smtp.gmail.com with ESMTPSA id z10-20020a62d10a000000b0050d3c3668bcsm7593829pfg.137.2022.04.26.02.14.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Apr 2022 02:14:51 -0700 (PDT) From: Boris Sukholitko To: netdev@vger.kernel.org, David Ahern Cc: Ilya Lifshits , Boris Sukholitko Subject: [PATCH iproute2-next v3 0/2] f_flower: match on the number of vlan tags Date: Tue, 26 Apr 2022 12:14:15 +0300 Message-Id: <20220426091417.7153-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: dsahern@gmail.com 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 Also, from our logs, we have redirect rules such that: tc filter add dev $GPON ingress flower num_of_vlans $N \ action mirred egress redirect dev $DEV where N can range from 0 to 3 and $DEV is the function of $N. Also there are rules setting skb mark based on the number of vlans: tc filter add dev $GPON ingress flower num_of_vlans $N vlan_prio \ $P action skbedit mark $M Thanks, Boris. - v3: rebased to the latest iproute2-next - v2: add missing f_flower subject prefix Boris Sukholitko (2): f_flower: Add num of vlans parameter f_flower: Check args with num_of_vlans tc/f_flower.c | 57 ++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 16 deletions(-)