From patchwork Wed Mar 23 10:55:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Sukholitko X-Patchwork-Id: 12789672 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 73024C433EF for ; Wed, 23 Mar 2022 10:57:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243627AbiCWK6j (ORCPT ); Wed, 23 Mar 2022 06:58:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236170AbiCWK6h (ORCPT ); Wed, 23 Mar 2022 06:58:37 -0400 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 069D011C34 for ; Wed, 23 Mar 2022 03:57:08 -0700 (PDT) Received: by mail-pl1-x62a.google.com with SMTP id g3so1153866plo.6 for ; Wed, 23 Mar 2022 03:57:08 -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=YbcbueE4aqIvtdtSUNv42V5dfwFd5p1AaFx8VKWR7fM=; b=Wl+4tb6qw2EUpnK5slE+9Hvt8E1IwtpSyoZKidiMNmlv5iGyzGCsA0y9rrbSbT1QZo k0mBrIhPo6knLz6x8fjHn0foIwZkkCJ18SfaPEwl9byo/NwwNJWtJtwTB9e8gW0yAm35 +WmhApzTnsL+U15M9lPHdzqqDwould3m7QsSw= 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=YbcbueE4aqIvtdtSUNv42V5dfwFd5p1AaFx8VKWR7fM=; b=KpxZDJGzTvdyEAxjTRifZbNgFrUlObvpns2ohNX8lCHmb7VlyQE8hUp43Trc5Jz5H8 D6UTcBI+zlU5Dc5EjqIs6R5W8MnKWgHs75QgtDnVoaiJbf3mBTFa5Uqal5vs6G355wZc 62U0ndS2/XZsOM+hcxqSHFfFO5pk0HzowIVHeQ3m5xAx8EhCKsxsPYs0oa4vz415iShN jAyWv/eHT0u8VIdvfYmnHaW+lyvfOtIENKf3rwhTQ8l6OIs8ptFYElnnJrEciWsXNvZs mlXsFm1tODYE+DfR7YyZ33HuOJuhc+TcU7wKZgAiv+9ZgKanAdmtfDzR9DmBUyQR1/AS a+Gw== X-Gm-Message-State: AOAM530yqxT3wkR1yOT0vhKSrLphV5AVmzC7JagM4mBDdJ1b7/M0QXWH x69G//CwbOGr2Y3Kn3xpcf+Dg6E3C+/Vyl+iV8C2MTYR+na/zfYSJFIVlAlI/OaLkDRCCWOHqLM lbqLqJJYBuPXxrgADROY73//p5bsO2zNEIt46bIXgLp6pF6Cic28Avzj+bPBLjHWNMH9OAFpbMt cvZRBEp1wxew== X-Google-Smtp-Source: ABdhPJzLrgQk8584tUnmz1XwqiFypyAspeT5Evj45GODIzM8TPUA/2TxpQOyYZfIaXVm3/O2njRo+A== X-Received: by 2002:a17:90a:77c6:b0:1bd:5ce1:1966 with SMTP id e6-20020a17090a77c600b001bd5ce11966mr10811829pjs.230.1648033026743; Wed, 23 Mar 2022 03:57:06 -0700 (PDT) Received: from localhost.localdomain ([192.19.250.250]) by smtp.gmail.com with ESMTPSA id d11-20020aa7868b000000b004f768dfe93asm25535927pfo.176.2022.03.23.03.57.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Mar 2022 03:57:05 -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: Wed, 23 Mar 2022 12:55:57 +0200 Message-Id: <20220323105602.30072-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(-)