netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org, jiri@mellanox.com,
	john.hurley@netronome.com, jakub.kicinski@netronome.com,
	ogerlitz@mellanox.com
Subject: [PATCH net-next,RFC 0/9] net: sched: prepare to reuse per-block callbacks from netfilter
Date: Fri, 26 Apr 2019 02:33:37 +0200	[thread overview]
Message-ID: <20190426003348.30745-1-pablo@netfilter.org> (raw)

Hi,

This patchset aims to introduce changes to reuse the existing .ndo_setup_tc
netdev operations from netfilter.

The idea is to move tcf_block_cb to net/core/flow_offload.c and rename
it to flow_block_cb. This object provides the minimal infrastructure to
set up per-block callbacks that are called to offload policies to
hardware.

The tcf_block object is specific for TC to share policies between
ingress devices. This object has a list of tcf_block_cb objects that are
called to offload the policies to hardware. In netfilter, the idea is to
store the list of tcf_block_cb objects in a chain that would be bound to
several devices, eg.

  chain x {
	type filter hook ingress devices = { eth0, eth1 } priority 0;
	...
  }

Hence, this emulates the shared blocks available in TC that Jiri made.

Note that the list of tcf_block_cb objects will be called to offload
policies in this chain.

To reuse this infrastructure, I need remove the dependency with the
tcf_block object and tc/cls_api (see .reoffload) that is called from the
driver side, this patchset reworks the per-block callback infrastructure
to set up the tcf_block_cb object from the driver, then convey the list
of callbacks using the tc_block_offload object back to the core.

            cls_api                         driver
	TC_SETUP_BLOCK    ---------->  setup tcf_block_cb
       tc_block_offload           add it to tc_block_offload->cb_list
                                                |
          register     <------------------------'
         tcf_block_cb
         ->reoffload

Therefore, registration does not happen from drivers anymore, instead
it is done from the core. The driver just sets up the tcf_block_cb
object that wires up the connection between the offloaded block (chains
in case of netfilter) and the driver.

This patchset is compile tested only at this stage.

Comments welcome, thanks.

Pablo Neira Ayuso (9):
  net: sched: move tcf_block_cb before indr_block
  net: sched: add tcf_block_cb_alloc()
  net: sched: add tcf_block_cb_free()
  net: sched: add tcf_block_setup()
  net: sched: add release callback to struct tcf_block_cb
  net: sched: add tcf_setup_block_offload()
  net: use tcf_block_setup() infrastructure
  net: sched: remove tcf_block_cb_{register,unregister}()
  net: cls_api: do not expose tcf_block to drivers

 drivers/net/ethernet/broadcom/bnxt/bnxt.c          |  26 +-
 drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c      |  28 +-
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c    |  26 +-
 drivers/net/ethernet/intel/i40e/i40e_main.c        |  26 +-
 drivers/net/ethernet/intel/iavf/iavf_main.c        |  35 +-
 drivers/net/ethernet/intel/igb/igb_main.c          |  23 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c      |  27 +-
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c  |  27 +-
 drivers/net/ethernet/mellanox/mlx5/core/en_rep.c   |  59 +-
 drivers/net/ethernet/mellanox/mlxsw/spectrum.c     |  64 ++-
 drivers/net/ethernet/netronome/nfp/abm/cls.c       |  17 +-
 drivers/net/ethernet/netronome/nfp/bpf/main.c      |  29 +-
 .../net/ethernet/netronome/nfp/flower/offload.c    |  62 +--
 drivers/net/ethernet/qlogic/qede/qede_main.c       |  23 +-
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  |  22 +-
 drivers/net/netdevsim/netdev.c                     |  26 +-
 include/net/pkt_cls.h                              |  29 +-
 net/dsa/slave.c                                    |  15 +-
 net/sched/cls_api.c                                | 598 ++++++++++++---------
 19 files changed, 528 insertions(+), 634 deletions(-)

-- 
2.11.0

             reply	other threads:[~2019-04-26  0:33 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-26  0:33 Pablo Neira Ayuso [this message]
2019-04-26  0:33 ` [PATCH net-next,RFC 1/9] net: sched: move tcf_block_cb before indr_block Pablo Neira Ayuso
2019-04-26  0:33 ` [PATCH net-next,RFC 2/9] net: sched: add tcf_block_cb_alloc() Pablo Neira Ayuso
2019-04-26  0:33 ` [PATCH net-next,RFC 3/9] net: sched: add tcf_block_cb_free() Pablo Neira Ayuso
2019-04-26  0:33 ` [PATCH net-next,RFC 4/9] net: sched: add tcf_block_setup() Pablo Neira Ayuso
2019-04-26  0:33 ` [PATCH net-next,RFC 5/9] net: sched: add release callback to struct tcf_block_cb Pablo Neira Ayuso
2019-04-26  0:33 ` [PATCH net-next,RFC 6/9] net: sched: add tcf_setup_block_offload() Pablo Neira Ayuso
2019-04-26  0:33 ` [PATCH net-next,RFC 7/9] net: use tcf_block_setup() infrastructure Pablo Neira Ayuso
2019-04-26 14:27   ` Jiri Pirko
2019-04-26 16:12     ` Pablo Neira Ayuso
2019-04-26  0:33 ` [PATCH net-next,RFC 8/9] net: cls_api: do not expose tcf_block to drivers Pablo Neira Ayuso
2019-04-26  0:33 ` [PATCH net-next,RFC 8/9] net: sched: remove tcf_block_cb_{register,unregister}() Pablo Neira Ayuso
2019-04-26  0:33 ` [PATCH net-next,RFC 9/9] net: cls_api: do not expose tcf_block to drivers Pablo Neira Ayuso
2019-04-26 14:32 ` [PATCH net-next,RFC 0/9] net: sched: prepare to reuse per-block callbacks from netfilter Jiri Pirko
2019-04-26 16:28   ` Pablo Neira Ayuso
2019-04-26 18:29     ` Jakub Kicinski
2019-04-26 18:41       ` Pablo Neira Ayuso
2019-04-26 18:55         ` Jakub Kicinski
2019-04-26 19:14           ` Pablo Neira Ayuso
2019-04-26 19:22             ` Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190426003348.30745-1-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=jakub.kicinski@netronome.com \
    --cc=jiri@mellanox.com \
    --cc=john.hurley@netronome.com \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=ogerlitz@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).