netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Petr Machata <petrm@mellanox.com>
Cc: Ido Schimmel <idosch@idosch.org>,
	netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org,
	jiri@mellanox.com, mlxsw@mellanox.com, michael.chan@broadcom.com,
	saeedm@mellanox.com, leon@kernel.org, kadlec@netfilter.org,
	fw@strlen.de, jhs@mojatatu.com, xiyou.wangcong@gmail.com,
	simon.horman@netronome.com, Ido Schimmel <idosch@mellanox.com>
Subject: Re: [PATCH net-next 01/13] net: sched: Pass qdisc reference in struct flow_block_offload
Date: Fri, 10 Jul 2020 17:26:48 +0200	[thread overview]
Message-ID: <20200710152648.GA14902@salvia> (raw)
In-Reply-To: <87sgdzflk4.fsf@mellanox.com>

On Fri, Jul 10, 2020 at 05:15:39PM +0200, Petr Machata wrote:
> 
> Pablo Neira Ayuso <pablo@netfilter.org> writes:
> 
> > On Fri, Jul 10, 2020 at 04:56:54PM +0300, Ido Schimmel wrote:
> >> From: Petr Machata <petrm@mellanox.com>
> >>
> >> Previously, shared blocks were only relevant for the pseudo-qdiscs ingress
> >> and clsact. Recently, a qevent facility was introduced, which allows to
> >> bind blocks to well-defined slots of a qdisc instance. RED in particular
> >> got two qevents: early_drop and mark. Drivers that wish to offload these
> >> blocks will be sent the usual notification, and need to know which qdisc it
> >> is related to.
> >>
> >> To that end, extend flow_block_offload with a "sch" pointer, and initialize
> >> as appropriate. This prompts changes in the indirect block facility, which
> >> now tracks the scheduler instead of the netdevice. Update signatures of
> >> several functions similarly. Deduce the device from the scheduler when
> >> necessary.
> >>
> >> Signed-off-by: Petr Machata <petrm@mellanox.com>
> >> Reviewed-by: Jiri Pirko <jiri@mellanox.com>
> >> Signed-off-by: Ido Schimmel <idosch@mellanox.com>
> >> ---
> >>  drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c  | 11 ++++++----
> >>  .../ethernet/mellanox/mlx5/core/en/rep/tc.c   | 11 +++++-----
> >>  .../net/ethernet/netronome/nfp/flower/main.h  |  2 +-
> >>  .../ethernet/netronome/nfp/flower/offload.c   | 11 ++++++----
> >>  include/net/flow_offload.h                    |  9 ++++----
> >>  net/core/flow_offload.c                       | 12 +++++------
> >>  net/netfilter/nf_flow_table_offload.c         | 17 +++++++--------
> >>  net/netfilter/nf_tables_offload.c             | 20 ++++++++++--------
> >>  net/sched/cls_api.c                           | 21 +++++++++++--------
> >>  9 files changed, 63 insertions(+), 51 deletions(-)
> >>
> > [...]
> >> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c
> >> index eefeb1cdc2ee..4fc42c1955ff 100644
> >> --- a/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c
> >> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c
> >> @@ -404,7 +404,7 @@ static void mlx5e_rep_indr_block_unbind(void *cb_priv)
> >>  static LIST_HEAD(mlx5e_block_cb_list);
> >>
> >>  static int
> >> -mlx5e_rep_indr_setup_block(struct net_device *netdev,
> >> +mlx5e_rep_indr_setup_block(struct Qdisc *sch,
> >>  			   struct mlx5e_rep_priv *rpriv,
> >>  			   struct flow_block_offload *f,
> >>  			   flow_setup_cb_t *setup_cb,
> >> @@ -412,6 +412,7 @@ mlx5e_rep_indr_setup_block(struct net_device *netdev,
> >>  			   void (*cleanup)(struct flow_block_cb *block_cb))
> >>  {
> >>  	struct mlx5e_priv *priv = netdev_priv(rpriv->netdev);
> >> +	struct net_device *netdev = sch->dev_queue->dev;
> >
> > This break indirect block support for netfilter since the driver
> > is assuming a Qdisc object.
> 
> Sorry, I don't follow. You mean mlx5 driver? What does it mean to
> "assume a qdisc object"?
> 
> Is it incorrect to rely on the fact that the netdevice can be deduced
> from a qdisc, or that there is always a qdisc associated with a block
> binding point?

The drivers assume that the xyz_indr_setup_block() always gets a sch
object, which is not always true. Are you really sure this will work
for the TC CT offload?

--- a/net/netfilter/nf_flow_table_offload.c
+++ b/net/netfilter/nf_flow_table_offload.c
@@ -928,26 +928,27 @@ static int nf_flow_table_block_setup(struct nf_flowtable *flowtable,
 }

 static void nf_flow_table_block_offload_init(struct flow_block_offload *bo,
-                                            struct net *net,
+                                            struct net_device *dev,
                                             enum flow_block_command cmd,
                                             struct nf_flowtable *flowtable,
                                             struct netlink_ext_ack *extack)
 {
        memset(bo, 0, sizeof(*bo));
-       bo->net         = net;
+       bo->net         = dev_net(dev);
        bo->block       = &flowtable->flow_block;
        bo->command     = cmd;
        bo->binder_type = FLOW_BLOCK_BINDER_TYPE_CLSACT_INGRESS;
        bo->extack      = extack;
+       bo->sch         = dev_ingress_queue(dev)->qdisc_sleeping;
        INIT_LIST_HEAD(&bo->cb_list);
 }

 static void nf_flow_table_indr_cleanup(struct flow_block_cb *block_cb)
 {
        struct nf_flowtable *flowtable = block_cb->indr.data;
-       struct net_device *dev = block_cb->indr.dev;
+       struct Qdisc *sch = block_cb->indr.sch;

-       nf_flow_table_gc_cleanup(flowtable, dev);
+       nf_flow_table_gc_cleanup(flowtable, sch->dev_queue->dev);
        down_write(&flowtable->flow_block_lock);
        list_del(&block_cb->list);
        list_del(&block_cb->driver_list);

Moreover, the flow_offload infrastructure should also remain
independent from the front-end, either tc/netfilter/ethtool, this is
pulling in tc specific stuff into it, eg.

diff --git a/include/net/flow_offload.h b/include/net/flow_offload.h
index de395498440d..fda29140bdc5 100644
--- a/include/net/flow_offload.h
+++ b/include/net/flow_offload.h
@@ -444,6 +444,7 @@ struct flow_block_offload {
        struct list_head cb_list;
        struct list_head *driver_block_list;
        struct netlink_ext_ack *extack;
+       struct Qdisc *sch;
 };

 enum tc_setup_type;
@@ -454,7 +455,7 @@ struct flow_block_cb;

 struct flow_block_indr {
        struct list_head                list;
-       struct net_device               *dev;
+       struct Qdisc                    *sch;
        enum flow_block_binder_type     binder_type;
        void                            *data;
        void                            *cb_priv;
@@ -479,7 +480,7 @@ struct flow_block_cb *flow_indr_block_cb_alloc(flow_setup_cb_t *cb,
                                               void *cb_ident, void *cb_priv,
                                               void (*release)(void *cb_priv),
                                               struct flow_block_offload *bo,
-                                              struct net_device *dev, void *data,
+                                              struct Qdisc *sch, void *data,
                                               void *indr_cb_priv,
                                               void (*cleanup)(struct flow_block_cb *block_cb));
 void flow_block_cb_free(struct flow_block_cb *block_cb);

  reply	other threads:[~2020-07-10 15:26 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-10 13:56 [PATCH net-next 00/13] mlxsw: Add support for buffer drops mirroring Ido Schimmel
2020-07-10 13:56 ` [PATCH net-next 01/13] net: sched: Pass qdisc reference in struct flow_block_offload Ido Schimmel
2020-07-10 14:15   ` Pablo Neira Ayuso
2020-07-10 15:15     ` Petr Machata
2020-07-10 15:26       ` Pablo Neira Ayuso [this message]
2020-07-10 16:22         ` Petr Machata
2020-07-10 17:13           ` Pablo Neira Ayuso
2020-07-10 18:01             ` Petr Machata
2020-07-10 13:56 ` [PATCH net-next 02/13] mlxsw: reg: Add Monitoring Mirror Trigger Enable Register Ido Schimmel
2020-07-10 13:56 ` [PATCH net-next 03/13] mlxsw: reg: Add Monitoring Port Analyzer Global Register Ido Schimmel
2020-07-10 13:56 ` [PATCH net-next 04/13] mlxsw: spectrum_span: Move SPAN operations out of global file Ido Schimmel
2020-07-10 13:56 ` [PATCH net-next 05/13] mlxsw: spectrum_span: Prepare for global mirroring triggers Ido Schimmel
2020-07-10 13:56 ` [PATCH net-next 06/13] mlxsw: spectrum_span: Add support " Ido Schimmel
2020-07-10 13:57 ` [PATCH net-next 07/13] mlxsw: spectrum_span: Add APIs to enable / disable " Ido Schimmel
2020-07-10 13:57 ` [PATCH net-next 08/13] mlxsw: spectrum_flow: Convert a goto to a return Ido Schimmel
2020-07-10 13:57 ` [PATCH net-next 09/13] mlxsw: spectrum_flow: Drop an unused field Ido Schimmel
2020-07-10 13:57 ` [PATCH net-next 10/13] mlxsw: spectrum_matchall: Publish matchall data structures Ido Schimmel
2020-07-10 13:57 ` [PATCH net-next 11/13] mlxsw: spectrum_flow: Promote binder-type dispatch to spectrum.c Ido Schimmel
2020-07-10 13:57 ` [PATCH net-next 12/13] mlxsw: spectrum_qdisc: Offload mirroring on RED qevent early_drop Ido Schimmel
2020-07-10 13:57 ` [PATCH net-next 13/13] selftests: mlxsw: RED: Test offload of mirror on RED early_drop qevent Ido Schimmel

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=20200710152648.GA14902@salvia \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=fw@strlen.de \
    --cc=idosch@idosch.org \
    --cc=idosch@mellanox.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@mellanox.com \
    --cc=kadlec@netfilter.org \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=michael.chan@broadcom.com \
    --cc=mlxsw@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=petrm@mellanox.com \
    --cc=saeedm@mellanox.com \
    --cc=simon.horman@netronome.com \
    --cc=xiyou.wangcong@gmail.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).