public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli•us>
To: Pablo Neira Ayuso <pablo@netfilter•org>
Cc: netdev@vger•kernel.org, davem@davemloft•net,
	thomas.lendacky@amd•com, f.fainelli@gmail•com,
	ariel.elior@cavium•com, michael.chan@broadcom•com,
	madalin.bucur@nxp•com, yisen.zhuang@huawei•com,
	salil.mehta@huawei•com, jeffrey.t.kirsher@intel•com,
	tariqt@mellanox•com, saeedm@mellanox•com, jiri@mellanox•com,
	idosch@mellanox•com, jakub.kicinski@netronome•com,
	peppe.cavallaro@st•com, grygorii.strashko@ti•com, andrew@lunn•ch,
	vivien.didelot@gmail•com, alexandre.torgue@st•com,
	joabreu@synopsys•com, linux-net-drivers@solarflare•com,
	ogerlitz@mellanox•com, Manish.Chopra@cavium•com,
	marcelo.leitner@gmail•com, mkubecek@suse•cz,
	venkatkumar.duvvuru@broadcom•com, maxime.chevallier@bootlin•com,
	cphealy@gmail•com, phil@nwl•cc, netfilter-devel@vger•kernel.org
Subject: Re: [PATCH net-next,v4 08/12] drivers: net: use flow block API
Date: Wed, 10 Jul 2019 10:01:23 +0200	[thread overview]
Message-ID: <20190710080123.GE2282@nanopsycho> (raw)
In-Reply-To: <20190709205550.3160-9-pablo@netfilter.org>

Tue, Jul 09, 2019 at 10:55:46PM CEST, pablo@netfilter•org wrote:

[...]	
	
> static int
> mlxsw_sp_setup_tc_block_flower_bind(struct mlxsw_sp_port *mlxsw_sp_port,
>-				    struct tcf_block *block, bool ingress,
>-				    struct netlink_ext_ack *extack)
>+			            struct flow_block_offload *f, bool ingress)
> {
> 	struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
> 	struct mlxsw_sp_acl_block *acl_block;
>-	struct tcf_block_cb *block_cb;
>+	struct flow_block_cb *block_cb;
>+	bool register_block = false;
> 	int err;
> 
>-	block_cb = tcf_block_cb_lookup(block, mlxsw_sp_setup_tc_block_cb_flower,
>-				       mlxsw_sp);
>+	block_cb = flow_block_cb_lookup(f, mlxsw_sp_setup_tc_block_cb_flower,
>+					mlxsw_sp);
> 	if (!block_cb) {
>-		acl_block = mlxsw_sp_acl_block_create(mlxsw_sp, block->net);
>+		acl_block = mlxsw_sp_acl_block_create(mlxsw_sp, f->net);
> 		if (!acl_block)
> 			return -ENOMEM;
>-		block_cb = __tcf_block_cb_register(block,
>-						   mlxsw_sp_setup_tc_block_cb_flower,
>-						   mlxsw_sp, acl_block, extack);
>+		block_cb = flow_block_cb_alloc(f->net,
>+					       mlxsw_sp_setup_tc_block_cb_flower,
>+					       mlxsw_sp, acl_block,
>+					       mlxsw_sp_tc_block_flower_release);
> 		if (IS_ERR(block_cb)) {
>+			mlxsw_sp_acl_block_destroy(acl_block);
> 			err = PTR_ERR(block_cb);
> 			goto err_cb_register;
> 		}
>+		register_block = true;
> 	} else {
>-		acl_block = tcf_block_cb_priv(block_cb);
>+		acl_block = flow_block_cb_priv(block_cb);
> 	}
>-	tcf_block_cb_incref(block_cb);
>+	flow_block_cb_incref(block_cb);
> 	err = mlxsw_sp_acl_block_bind(mlxsw_sp, acl_block,
> 				      mlxsw_sp_port, ingress);
> 	if (err)
>@@ -1622,28 +1634,31 @@ mlxsw_sp_setup_tc_block_flower_bind(struct mlxsw_sp_port *mlxsw_sp_port,
> 	else
> 		mlxsw_sp_port->eg_acl_block = acl_block;
> 
>+	if (register_block) {
>+		flow_block_cb_add(block_cb, f);
>+		list_add_tail(&block_cb->driver_list, &mlxsw_sp_block_cb_list);
>+	}

What prevents you from doing these 2 above right after
flow_block_cb_alloc?

More than that, what prevents you do maintain the same flow as was there
originally? You just need struct flow_block as a replacement of
struct tcf_block and have it contained in both struct nft_base_chain
and struct tcf_block.

And you would push pointer to struct flow_block down to drivers
in struct flow_block_offload.


[...]


  reply	other threads:[~2019-07-10  8:01 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-09 20:55 [PATCH net-next,v4 00/11] netfilter: add hardware offload infrastructure Pablo Neira Ayuso
2019-07-09 20:55 ` [PATCH net-next,v4 01/12] net: flow_offload: add flow_block_cb_setup_simple() Pablo Neira Ayuso
2019-07-09 20:55 ` [PATCH net-next,v4 02/12] net: flow_offload: rename TC_BLOCK_{UN}BIND to FLOW_BLOCK_{UN}BIND Pablo Neira Ayuso
2019-07-09 20:55 ` [PATCH net-next,v4 03/12] net: flow_offload: rename TCF_BLOCK_BINDER_TYPE_* to FLOW_BLOCK_BINDER_TYPE_* Pablo Neira Ayuso
2019-07-09 20:55 ` [PATCH net-next,v4 04/12] net: flow_offload: add flow_block_cb_alloc() and flow_block_cb_free() Pablo Neira Ayuso
2019-07-09 20:55 ` [PATCH net-next,v4 05/12] net: flow_offload: add list handling functions Pablo Neira Ayuso
2019-07-10  7:36   ` Jiri Pirko
2019-07-10  9:06     ` Jiri Pirko
2019-07-09 20:55 ` [PATCH net-next,v4 06/12] net: flow_offload: add flow_block_cb_{priv,incref,decref}() Pablo Neira Ayuso
2019-07-09 20:55 ` [PATCH net-next,v4 07/12] net: sched: use flow block API Pablo Neira Ayuso
2019-08-14 16:32   ` Edward Cree
2019-08-16  1:10     ` Pablo Neira Ayuso
2019-07-09 20:55 ` [PATCH net-next,v4 08/12] drivers: net: " Pablo Neira Ayuso
2019-07-10  8:01   ` Jiri Pirko [this message]
2019-08-12 17:50   ` Edward Cree
2019-08-13 19:51     ` Pablo Neira Ayuso
2019-08-14 16:17       ` Edward Cree
2019-08-16  1:04         ` Pablo Neira Ayuso
2019-08-16 17:00           ` Edward Cree
2019-07-09 20:55 ` [PATCH net-next,v4 09/12] net: sched: remove tcf " Pablo Neira Ayuso
2019-07-09 20:55 ` [PATCH net-next,v4 10/12] net: flow_offload: add flow_block_cb_is_busy() and use it Pablo Neira Ayuso
2019-07-09 20:55 ` [PATCH net-next,v4 11/12] net: flow_offload: rename tc_cls_flower_offload to flow_cls_offload Pablo Neira Ayuso
2019-07-09 20:55 ` [PATCH net-next,v4 12/12] netfilter: nf_tables: add hardware offload support Pablo Neira Ayuso
2019-07-10  7:52   ` Jiri Pirko
2019-07-11  0:18     ` Pablo Neira Ayuso
2019-07-09 21:43 ` [PATCH net-next,v4 00/11] netfilter: add hardware offload infrastructure David Miller

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=20190710080123.GE2282@nanopsycho \
    --to=jiri@resnulli$(echo .)us \
    --cc=Manish.Chopra@cavium$(echo .)com \
    --cc=alexandre.torgue@st$(echo .)com \
    --cc=andrew@lunn$(echo .)ch \
    --cc=ariel.elior@cavium$(echo .)com \
    --cc=cphealy@gmail$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=f.fainelli@gmail$(echo .)com \
    --cc=grygorii.strashko@ti$(echo .)com \
    --cc=idosch@mellanox$(echo .)com \
    --cc=jakub.kicinski@netronome$(echo .)com \
    --cc=jeffrey.t.kirsher@intel$(echo .)com \
    --cc=jiri@mellanox$(echo .)com \
    --cc=joabreu@synopsys$(echo .)com \
    --cc=linux-net-drivers@solarflare$(echo .)com \
    --cc=madalin.bucur@nxp$(echo .)com \
    --cc=marcelo.leitner@gmail$(echo .)com \
    --cc=maxime.chevallier@bootlin$(echo .)com \
    --cc=michael.chan@broadcom$(echo .)com \
    --cc=mkubecek@suse$(echo .)cz \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=netfilter-devel@vger$(echo .)kernel.org \
    --cc=ogerlitz@mellanox$(echo .)com \
    --cc=pablo@netfilter$(echo .)org \
    --cc=peppe.cavallaro@st$(echo .)com \
    --cc=phil@nwl$(echo .)cc \
    --cc=saeedm@mellanox$(echo .)com \
    --cc=salil.mehta@huawei$(echo .)com \
    --cc=tariqt@mellanox$(echo .)com \
    --cc=thomas.lendacky@amd$(echo .)com \
    --cc=venkatkumar.duvvuru@broadcom$(echo .)com \
    --cc=vivien.didelot@gmail$(echo .)com \
    --cc=yisen.zhuang@huawei$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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