Message ID | 20180116133347.2207-1-jiri@resnulli.us |
---|---|
Headers | show
Return-Path: <netdev-owner@vger.kernel.org> X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=<UNKNOWN>) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=resnulli-us.20150623.gappssmtp.com header.i=@resnulli-us.20150623.gappssmtp.com header.b="dsuoaD0B"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zLWQV0j71z9s7F for <patchwork-incoming@ozlabs.org>; Wed, 17 Jan 2018 00:33:54 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751306AbeAPNdv (ORCPT <rfc822;patchwork-incoming@ozlabs.org>); Tue, 16 Jan 2018 08:33:51 -0500 Received: from mail-wm0-f51.google.com ([74.125.82.51]:36664 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751178AbeAPNdu (ORCPT <rfc822;netdev@vger.kernel.org>); Tue, 16 Jan 2018 08:33:50 -0500 Received: by mail-wm0-f51.google.com with SMTP id f3so8713066wmc.1 for <netdev@vger.kernel.org>; Tue, 16 Jan 2018 05:33:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=sdlGt0uWUUfnafSrwDJhvaFGIqmrsEUK1CR0MwAkLYE=; b=dsuoaD0BnjZ6vqULvMg0rTeIYH3I/jnp1yKT2DE6uxWz07WFt4a55p3WUrFjGOiZwq +8htn/hL0nb6VL2zALQHgmTfBRSIyt7VJw18IQtRQNr9o4QNWd20Rb3OV+Qw1TVOzUpH +g1a7MTQjgSiFcK4+hgy8stSgem+72ABhuKLQCdQ1SOSM8j2Hsx+AFo4aPGopPNAJhrU fiEtYnp/kFtENsz5XwlbI3oHoc4zHeIa42HMTWLevc/zejOggjWjxJjXs8ssYlxEbhWC 0GhZsxwO6qQz7ekFlkJ5RPHOFgyPErWliw3pPCBGMpk7WGUTQQglDSo5ziJ+fEa3u7Vd Oh9Q== 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; bh=sdlGt0uWUUfnafSrwDJhvaFGIqmrsEUK1CR0MwAkLYE=; b=JvgJTJkeJXmNN9HovAy0beLvnk12HM///TzsGrlCgjbJvGwTM3w3oNSbAEn9CxmNIg kzZx2Xb82/t6DuFOp35+3rhCtxhhxqMmN8gTySCRfLX4yMsBaVWHsa/vyRj273bIaryC 0LsyTC+W1vlD1c6oI3utO1pi9cT8a6s7G3hLNucAc3ZPhJUXYIsQIHT2w5FneBs+sH1o oTGvbusICDYM2Rgvs0MT9Nf6EumTI5QkxWZcyoquwK5YlG2ZaD4i0Y+RVnXLnf0vvaHC CFQsn9/LziDJjWvYqNCaFRsRyvtXGP2DATJ5uR3eAcL4vFpChh/v376MqSvlN+CxsV86 9yzg== X-Gm-Message-State: AKwxyteefPnuhVqQJFCgSPXLYteW/6p3jdKK33qKN5zD2TVpzXeMp65v v56kIvisxw7VEKxGZAC+MeBDts59 X-Google-Smtp-Source: ACJfBosHAdkHAeUqx2u/OKnTRrdN1clBvkN9tPkPiWrv8SkDf6S0dAapHaxB00b8WY46zInLvSEWew== X-Received: by 10.28.139.66 with SMTP id n63mr5835732wmd.101.1516109628306; Tue, 16 Jan 2018 05:33:48 -0800 (PST) Received: from localhost (ip-89-177-135-29.net.upcbroadband.cz. [89.177.135.29]) by smtp.gmail.com with ESMTPSA id w7sm1843179wra.90.2018.01.16.05.33.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Jan 2018 05:33:47 -0800 (PST) From: Jiri Pirko <jiri@resnulli.us> To: netdev@vger.kernel.org Cc: davem@davemloft.net, jhs@mojatatu.com, xiyou.wangcong@gmail.com, mlxsw@mellanox.com, andrew@lunn.ch, vivien.didelot@savoirfairelinux.com, f.fainelli@gmail.com, michael.chan@broadcom.com, ganeshgr@chelsio.com, saeedm@mellanox.com, matanb@mellanox.com, leonro@mellanox.com, idosch@mellanox.com, jakub.kicinski@netronome.com, simon.horman@netronome.com, pieter.jansenvanvuuren@netronome.com, john.hurley@netronome.com, alexander.h.duyck@intel.com, ogerlitz@mellanox.com, john.fastabend@gmail.com, daniel@iogearbox.net, dsahern@gmail.com, roopa@cumulusnetworks.com Subject: [patch net-next v9 00/13] net: sched: allow qdiscs to share filter block instances Date: Tue, 16 Jan 2018 14:33:34 +0100 Message-Id: <20180116133347.2207-1-jiri@resnulli.us> X-Mailer: git-send-email 2.9.5 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: <netdev.vger.kernel.org> X-Mailing-List: netdev@vger.kernel.org |
Series |
net: sched: allow qdiscs to share filter block instances
|
expand
|
From: Jiri Pirko <jiri@mellanox.com> Currently the filters added to qdiscs are independent. So for example if you have 2 netdevices and you create ingress qdisc on both and you want to add identical filter rules both, you need to add them twice. This patchset makes this easier and mainly saves resources allowing to share all filters within a qdisc - I call it a "filter block". Also this helps to save resources when we do offload to hw for example to expensive TCAM. So back to the example. First, we create 2 qdiscs. Both will share block number 22. "22" is just an identification: $ tc qdisc add dev ens7 ingress_block 22 ingress ^^^^^^^^^^^^^^^^ $ tc qdisc add dev ens8 ingress_block 22 ingress ^^^^^^^^^^^^^^^^ If we don't specify "block" command line option, no shared block would be created: $ tc qdisc add dev ens9 ingress Now if we list the qdiscs, we will see the block index in the output: $ tc qdisc qdisc ingress ffff: dev ens7 parent ffff:fff1 ingress_block 22 qdisc ingress ffff: dev ens8 parent ffff:fff1 ingress_block 22 qdisc ingress ffff: dev ens9 parent ffff:fff1 To make is more visual, the situation looks like this: ens7 ingress qdisc ens7 ingress qdisc | | | | +----------> block 22 <----------+ Unlimited number of qdiscs may share the same block. Note that this patchset introduces block sharing support also for clsact qdisc: $ tc qdisc add dev ens10 ingress_block 23 egress_block 24 clsact $ tc qdisc show dev ens10 qdisc clsact ffff: dev ens10 parent ffff:fff1 ingress_block 23 egress_block 24 We can add filter using the block index: $ tc filter add block 22 protocol ip pref 25 flower dst_ip 192.168.0.0/16 action drop Note we cannot use the qdisc for filter manipulations of shared blocks: $ tc filter add dev ens8 ingress protocol ip pref 1 flower dst_ip 192.168.100.2 action drop Error: This filter block is shared. Please use the block index to manipulate the filters. We will see the same output if we list filters for ingress qdisc of ens7 and ens8, also for the block 22: $ tc filter show block 22 filter block 22 protocol ip pref 25 flower chain 0 filter block 22 protocol ip pref 25 flower chain 0 handle 0x1 ... $ tc filter show dev ens7 ingress filter block 22 protocol ip pref 25 flower chain 0 filter block 22 protocol ip pref 25 flower chain 0 handle 0x1 ... $ tc filter show dev ens8 ingress filter block 22 protocol ip pref 25 flower chain 0 filter block 22 protocol ip pref 25 flower chain 0 handle 0x1 ... --- v8->v9: - patch "net: sched: add rt netlink message type for block get" was removed, userspace check filter existence using qdisc dump v7->v8: - patch 7: - added comment to ifindex block magic - patch 9: - new patch - patch 10: - base this on the patch that introduces qdisc-generic block index attributes parsing/dumping - patch 13: - rebased on top of current net-next v6->v7: - patch 1: - unsquashed shared block patch that was previously squashed by mistake - fixed error path in block create - freeing chain 0 - patch 2: - new patch - splitted from the previous one as it got accidentaly squashed in the rebasing process in the past - converted to idr extended - removed auto-generating of block indexes. Callers have to explicily tell that the block is shared by passing non-zero block index - fixed error path in block get ext - freeing chain 0 - patch 7: - changed extack message for block index handle as suggested by DaveA - added extack message when block index does not exist - the block ifindex magic is in define and change to 0xffffffff as suggested by Jamal - patch 8: - new patch implementing RTM_GETBLOCK in order to query if the block with some index exists - patch 9: - adjust to the core changes and check block index attributes for being 0 v5->v6: - added patch 6 that introduces block handle v4->v5: - patch 5: - add tracking of binding of devs that are unable to offload and check that before block cbs call. v3->v4: - patch 1: - rebased on top of the current net-next - added some extack strings - patch 3: - rebased on top of the current net-next - patch 5: - propagate netdev_ops->ndo_setup_tc error up to tcf_block_offload_bind caller - patch 7: - rebased on top of the current net-next v2->v3: - removed original patch 1, removing tp->q cls_bpf dependency. Fixed by Jakub in the meantime. - patch 1: - rebased on top of the current net-next - patch 5: - new patch - patch 8: - removed "p_" prefix from block index function args - patch 10: - add tc offload feature handling Jiri Pirko (13): net: sched: introduce support for multiple filter chain pointers registration net: sched: introduce shared filter blocks infrastructure net: sched: avoid usage of tp->q in tcf_classify net: sched: introduce block mechanism to handle netif_keep_dst calls net: sched: remove classid and q fields from tcf_proto net: sched: keep track of offloaded filters and check tc offload feature net: sched: use block index as a handle instead of qdisc when block is shared net: sched: introduce ingress/egress block index attributes for qdisc net: sched: allow ingress and clsact qdiscs to share filter blocks mlxsw: spectrum_acl: Reshuffle code around mlxsw_sp_acl_ruleset_create/destroy mlxsw: spectrum_acl: Don't store netdev and ingress for ruleset unbind mlxsw: spectrum_acl: Implement TC block sharing mlxsw: spectrum_acl: Pass mlxsw_sp_port down to ruleset bind/unbind ops drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 182 +++++-- drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 43 +- drivers/net/ethernet/mellanox/mlxsw/spectrum_acl.c | 302 ++++++++--- .../ethernet/mellanox/mlxsw/spectrum_acl_tcam.c | 44 +- .../net/ethernet/mellanox/mlxsw/spectrum_flower.c | 41 +- include/net/pkt_cls.h | 8 + include/net/sch_generic.h | 34 +- include/uapi/linux/rtnetlink.h | 12 + net/sched/cls_api.c | 591 ++++++++++++++++----- net/sched/cls_bpf.c | 9 +- net/sched/cls_flow.c | 2 +- net/sched/cls_flower.c | 3 +- net/sched/cls_matchall.c | 3 +- net/sched/cls_route.c | 2 +- net/sched/cls_u32.c | 13 +- net/sched/sch_api.c | 60 +++ net/sched/sch_ingress.c | 76 ++- 17 files changed, 1105 insertions(+), 320 deletions(-)