Commit 89099d85 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'flow_offload-fixes'



Pablo Neira Ayuso says:

====================
flow_offload fixes

The following patchset contains fixes for the flow_offload infrastructure:

1) Fix possible build breakage before patch 3/4. Both the flow_offload
   infrastructure and OVS define the flow_stats structure. Patch 3/4 in
   this batch indirectly pulls in the flow_stats definition from
   include/net/flow_offload.h into OVS, leading to structure redefinition
   compile-time errors.

2) Remove netns parameter from flow_block_cb_alloc(), this is not
   required as Jiri suggests. The flow_block_cb_is_busy() function uses
   the per-driver block list to check for used blocks which was the
   original intention for this parameter.

3) Rename tc_setup_cb_t to flow_setup_cb_t. This callback is not
   exclusive of tc anymore, this might confuse the reader as Jiri
   suggests, fix this semantic inconsistency.

   Add #include <linux/list.h> to include/net/netfilter/nf_tables_offload.h
   to avoid a compile break with CONFIG_HEADER_TEST=y.

4) Fix block sharing feature: Add flow_block structure and use it,
   update flow_block_cb_lookup() to use this flow_block object.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 9a2f97bb 14bfb13f
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -735,8 +735,7 @@ mlx5e_rep_indr_setup_tc_block(struct net_device *netdev,
		list_add(&indr_priv->list,
			 &rpriv->uplink_priv.tc_indr_block_priv_list);

		block_cb = flow_block_cb_alloc(f->net,
					       mlx5e_rep_indr_setup_block_cb,
		block_cb = flow_block_cb_alloc(mlx5e_rep_indr_setup_block_cb,
					       indr_priv, indr_priv,
					       mlx5e_rep_indr_tc_block_unbind);
		if (IS_ERR(block_cb)) {
@@ -753,7 +752,7 @@ mlx5e_rep_indr_setup_tc_block(struct net_device *netdev,
		if (!indr_priv)
			return -ENOENT;

		block_cb = flow_block_cb_lookup(f,
		block_cb = flow_block_cb_lookup(f->block,
						mlx5e_rep_indr_setup_block_cb,
						indr_priv);
		if (!block_cb)
+8 −7
Original line number Diff line number Diff line
@@ -1604,14 +1604,14 @@ mlxsw_sp_setup_tc_block_flower_bind(struct mlxsw_sp_port *mlxsw_sp_port,
	bool register_block = false;
	int err;

	block_cb = flow_block_cb_lookup(f, mlxsw_sp_setup_tc_block_cb_flower,
	block_cb = flow_block_cb_lookup(f->block,
					mlxsw_sp_setup_tc_block_cb_flower,
					mlxsw_sp);
	if (!block_cb) {
		acl_block = mlxsw_sp_acl_block_create(mlxsw_sp, f->net);
		if (!acl_block)
			return -ENOMEM;
		block_cb = flow_block_cb_alloc(f->net,
					       mlxsw_sp_setup_tc_block_cb_flower,
		block_cb = flow_block_cb_alloc(mlxsw_sp_setup_tc_block_cb_flower,
					       mlxsw_sp, acl_block,
					       mlxsw_sp_tc_block_flower_release);
		if (IS_ERR(block_cb)) {
@@ -1657,7 +1657,8 @@ mlxsw_sp_setup_tc_block_flower_unbind(struct mlxsw_sp_port *mlxsw_sp_port,
	struct flow_block_cb *block_cb;
	int err;

	block_cb = flow_block_cb_lookup(f, mlxsw_sp_setup_tc_block_cb_flower,
	block_cb = flow_block_cb_lookup(f->block,
					mlxsw_sp_setup_tc_block_cb_flower,
					mlxsw_sp);
	if (!block_cb)
		return;
@@ -1680,7 +1681,7 @@ static int mlxsw_sp_setup_tc_block(struct mlxsw_sp_port *mlxsw_sp_port,
				   struct flow_block_offload *f)
{
	struct flow_block_cb *block_cb;
	tc_setup_cb_t *cb;
	flow_setup_cb_t *cb;
	bool ingress;
	int err;

@@ -1702,7 +1703,7 @@ static int mlxsw_sp_setup_tc_block(struct mlxsw_sp_port *mlxsw_sp_port,
					  &mlxsw_sp_block_cb_list))
			return -EBUSY;

		block_cb = flow_block_cb_alloc(f->net, cb, mlxsw_sp_port,
		block_cb = flow_block_cb_alloc(cb, mlxsw_sp_port,
					       mlxsw_sp_port, NULL);
		if (IS_ERR(block_cb))
			return PTR_ERR(block_cb);
@@ -1718,7 +1719,7 @@ static int mlxsw_sp_setup_tc_block(struct mlxsw_sp_port *mlxsw_sp_port,
	case FLOW_BLOCK_UNBIND:
		mlxsw_sp_setup_tc_block_flower_unbind(mlxsw_sp_port,
						      f, ingress);
		block_cb = flow_block_cb_lookup(f, cb, mlxsw_sp_port);
		block_cb = flow_block_cb_lookup(f->block, cb, mlxsw_sp_port);
		if (!block_cb)
			return -ENOENT;

+5 −6
Original line number Diff line number Diff line
@@ -316,15 +316,14 @@ int ocelot_setup_tc_block_flower_bind(struct ocelot_port *port,
	if (f->binder_type == FLOW_BLOCK_BINDER_TYPE_CLSACT_EGRESS)
		return -EOPNOTSUPP;

	block_cb = flow_block_cb_lookup(f, ocelot_setup_tc_block_cb_flower,
					port);
	block_cb = flow_block_cb_lookup(f->block,
					ocelot_setup_tc_block_cb_flower, port);
	if (!block_cb) {
		port_block = ocelot_port_block_create(port);
		if (!port_block)
			return -ENOMEM;

		block_cb = flow_block_cb_alloc(f->net,
					       ocelot_setup_tc_block_cb_flower,
		block_cb = flow_block_cb_alloc(ocelot_setup_tc_block_cb_flower,
					       port, port_block,
					       ocelot_tc_block_unbind);
		if (IS_ERR(block_cb)) {
@@ -351,8 +350,8 @@ void ocelot_setup_tc_block_flower_unbind(struct ocelot_port *port,
{
	struct flow_block_cb *block_cb;

	block_cb = flow_block_cb_lookup(f, ocelot_setup_tc_block_cb_flower,
					port);
	block_cb = flow_block_cb_lookup(f->block,
					ocelot_setup_tc_block_cb_flower, port);
	if (!block_cb)
		return;

+3 −3
Original line number Diff line number Diff line
@@ -134,7 +134,7 @@ static int ocelot_setup_tc_block(struct ocelot_port *port,
				 struct flow_block_offload *f)
{
	struct flow_block_cb *block_cb;
	tc_setup_cb_t *cb;
	flow_setup_cb_t *cb;
	int err;

	netdev_dbg(port->dev, "tc_block command %d, binder_type %d\n",
@@ -156,7 +156,7 @@ static int ocelot_setup_tc_block(struct ocelot_port *port,
		if (flow_block_cb_is_busy(cb, port, &ocelot_block_cb_list))
			return -EBUSY;

		block_cb = flow_block_cb_alloc(f->net, cb, port, port, NULL);
		block_cb = flow_block_cb_alloc(cb, port, port, NULL);
		if (IS_ERR(block_cb))
			return PTR_ERR(block_cb);

@@ -169,7 +169,7 @@ static int ocelot_setup_tc_block(struct ocelot_port *port,
		list_add_tail(&block_cb->driver_list, f->driver_block_list);
		return 0;
	case FLOW_BLOCK_UNBIND:
		block_cb = flow_block_cb_lookup(f, cb, port);
		block_cb = flow_block_cb_lookup(f->block, cb, port);
		if (!block_cb)
			return -ENOENT;

+5 −6
Original line number Diff line number Diff line
@@ -1318,8 +1318,7 @@ static int nfp_flower_setup_tc_block(struct net_device *netdev,
					  &nfp_block_cb_list))
			return -EBUSY;

		block_cb = flow_block_cb_alloc(f->net,
					       nfp_flower_setup_tc_block_cb,
		block_cb = flow_block_cb_alloc(nfp_flower_setup_tc_block_cb,
					       repr, repr, NULL);
		if (IS_ERR(block_cb))
			return PTR_ERR(block_cb);
@@ -1328,7 +1327,8 @@ static int nfp_flower_setup_tc_block(struct net_device *netdev,
		list_add_tail(&block_cb->driver_list, &nfp_block_cb_list);
		return 0;
	case FLOW_BLOCK_UNBIND:
		block_cb = flow_block_cb_lookup(f, nfp_flower_setup_tc_block_cb,
		block_cb = flow_block_cb_lookup(f->block,
						nfp_flower_setup_tc_block_cb,
						repr);
		if (!block_cb)
			return -ENOENT;
@@ -1424,8 +1424,7 @@ nfp_flower_setup_indr_tc_block(struct net_device *netdev, struct nfp_app *app,
		cb_priv->app = app;
		list_add(&cb_priv->list, &priv->indr_block_cb_priv);

		block_cb = flow_block_cb_alloc(f->net,
					       nfp_flower_setup_indr_block_cb,
		block_cb = flow_block_cb_alloc(nfp_flower_setup_indr_block_cb,
					       cb_priv, cb_priv,
					       nfp_flower_setup_indr_tc_release);
		if (IS_ERR(block_cb)) {
@@ -1442,7 +1441,7 @@ nfp_flower_setup_indr_tc_block(struct net_device *netdev, struct nfp_app *app,
		if (!cb_priv)
			return -ENOENT;

		block_cb = flow_block_cb_lookup(f,
		block_cb = flow_block_cb_lookup(f->block,
						nfp_flower_setup_indr_block_cb,
						cb_priv);
		if (!block_cb)
Loading