From patchwork Tue Apr 12 10:02:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Sukholitko X-Patchwork-Id: 12810510 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 B0CFAC433EF for ; Tue, 12 Apr 2022 11:13:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240236AbiDLLPh (ORCPT ); Tue, 12 Apr 2022 07:15:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354842AbiDLLPK (ORCPT ); Tue, 12 Apr 2022 07:15:10 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 641DF95486 for ; Tue, 12 Apr 2022 03:03:07 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id mp16-20020a17090b191000b001cb5efbcab6so2281548pjb.4 for ; Tue, 12 Apr 2022 03:03:07 -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=V5nry2v3DMqn8TPnVprkiEG94jAO3ryOpyWaFU+T6Rc=; b=Y62aHcGd9xxU9GHlht+1VZYSjetwtBotbDznqeLT1l9pfSDzUaVQRRG6oh3MuoRBb+ NgoVREfSJvh71OWKuRTXXrbDHcsbSmAFQGnCY7Fm4vvQ1Id/YzdljXYn7w4ri7seT4xp 57hen5H3wFIRCBhefPJ++gT3ZkqrkE0x3U/bE= 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=V5nry2v3DMqn8TPnVprkiEG94jAO3ryOpyWaFU+T6Rc=; b=gHuz4ybruVHiuVU2Rtq5m2P0phbpefVPRtL0GBfdpEBVC/IpcFnaVTw2JAzEuudIWp QjNgDiLidx/KJ22aYUPDY/vZwuaV+5Ynj+vhoVcPuHIA9xTbJqlBs3wDdjqk5SClM38d xteEhpkWDhrHlcrCnalmW7GKXv9/uyIqhbO05bwx03iBxTc/93xMFeVx/iwRr06IERrz G/7Fg93Om7JdhFu3OpH3NwjxlHit8hskMYEPWPjXrfbPaFvWwZdBZJanYAVDW+dnwLm1 04DRcYHL6aJBuFzWGCNkMaBj9D95DEnNLxXO6ekfvRKm3ZWZ923w5Ygus37vObtlXKUC 8NbA== X-Gm-Message-State: AOAM531lrKvqKySDLpUvDl2VmvTEBC08+3uYmjip9OvIlMHis4lffDrw HpAi+mO9Rpjyw79C2K3nZaiHRNR2wC/hfr3qAefTyvXEHFs9YnkYTVu3Gb3YgfVSrX6Kn9AvBn1 gbu95mL54Axwqj3emBoRTn7mOf3K+H5n1W6PpIaIAlPnj1g7Ti0q771eGdaRJ/7e9QbPaUjRGsA bJZpX3bMlABw== X-Google-Smtp-Source: ABdhPJxCjm3eG80hzyiOCatVAogc7HtrC6LkFola2FoDlbQcE5THDKNk8WAx6F7/omqOUUHGXgTUtw== X-Received: by 2002:a17:902:f78d:b0:14d:522e:deb3 with SMTP id q13-20020a170902f78d00b0014d522edeb3mr36517589pln.173.1649757785596; Tue, 12 Apr 2022 03:03:05 -0700 (PDT) Received: from localhost.localdomain ([192.19.250.250]) by smtp.gmail.com with ESMTPSA id u17-20020a056a00159100b004faef351ebcsm37020020pfk.45.2022.04.12.03.03.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 03:03:04 -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 v2 0/5] net/sched: flower: match on the number of vlan tags Date: Tue, 12 Apr 2022 13:02:31 +0300 Message-Id: <20220412100236.27244-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. - v2: - add suitable subject prefixes - more evolved patch 5 description Boris Sukholitko (5): net/sched: flower: Helper function for vlan ethtype checks net/sched: flower: Reduce identation after is_key_vlan refactoring flow_dissector: Add number of vlan tags dissector net/sched: flower: Add number of vlan tags filter net/sched: flower: Consider the number of 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(-)