Netdev List
 help / color / mirror / Atom feed
From: wenxu <wenxu@ucloud.cn>
To: Or Gerlitz <gerlitz.or@gmail.com>,
	Pieter Jansen van Vuuren  <pieter.jansenvanvuuren@netronome.com>,
	Oz Shlomo <ozsh@mellanox.com>,
	John Hurley <john.hurley@netronome.com>,
	Jakub Kicinski <jakub.kicinski@netronome.com>
Cc: David Miller <davem@davemloft.net>,
	Linux Netdev List <netdev@vger.kernel.org>,
	Roi Dayan <roid@mellanox.com>, Paul Blakey <paulb@mellanox.com>,
	Jiri Pirko <jiri@mellanox.com>
Subject: Re: [PATCH net v3] net/sched: cls_api: Fix nooffloaddevcnt counter when indr block call success
Date: Mon, 23 Sep 2019 12:19:56 +0800	[thread overview]
Message-ID: <cc63e5ba-661a-72c3-7531-7bd09694549b@ucloud.cn> (raw)
In-Reply-To: <CAJ3xEMhQTr=HPsMs-j3_V6XRKHa0Jo7iYVY+R4U8etoEu9R7jw@mail.gmail.com>

Hi John & Jakub

There are some limitations for indirect tc callback work with  skip_sw ?


BR

wenxu

On 9/19/2019 8:50 PM, Or Gerlitz wrote:
>
>> successfully bind with a real hw through indr block call, It also add
>> nooffloadcnt counter. This counter will lead the rule add failed in
>> fl_hw_replace_filter-->tc_setup_cb_call with skip_sw flags.
> wait.. indirect tc callbacks are typically used to do hw offloading
> for decap rules (tunnel key unset action) set on SW devices (gretap, vxlan).
>
> However, AFAIK, it's been couple of years since the kernel doesn't support
> skip_sw for such rules. Did we enable it again? when? I am somehow
> far from the details, so copied some folks..
>
> Or.
>
>
>> In the tc_setup_cb_call will check the nooffloaddevcnt and skip_sw flags
>> as following:
>> if (block->nooffloaddevcnt && err_stop)
>>         return -EOPNOTSUPP;
>>
>> So with this patch, if the indr block call success, it will not modify
>> the nooffloaddevcnt counter.
>>
>> Fixes: 7f76fa36754b ("net: sched: register callbacks for indirect tc block binds")
>> Signed-off-by: wenxu <wenxu@ucloud.cn>
>> ---
>> v3: rebase to the net
>>
>>  net/sched/cls_api.c | 30 +++++++++++++++++-------------
>>  1 file changed, 17 insertions(+), 13 deletions(-)
>>
>> diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
>> index 32577c2..c980127 100644
>> --- a/net/sched/cls_api.c
>> +++ b/net/sched/cls_api.c
>> @@ -607,11 +607,11 @@ static void tc_indr_block_get_and_ing_cmd(struct net_device *dev,
>>         tc_indr_block_ing_cmd(dev, block, cb, cb_priv, command);
>>  }
>>
>> -static void tc_indr_block_call(struct tcf_block *block,
>> -                              struct net_device *dev,
>> -                              struct tcf_block_ext_info *ei,
>> -                              enum flow_block_command command,
>> -                              struct netlink_ext_ack *extack)
>> +static int tc_indr_block_call(struct tcf_block *block,
>> +                             struct net_device *dev,
>> +                             struct tcf_block_ext_info *ei,
>> +                             enum flow_block_command command,
>> +                             struct netlink_ext_ack *extack)
>>  {
>>         struct flow_block_offload bo = {
>>                 .command        = command,
>> @@ -621,10 +621,15 @@ static void tc_indr_block_call(struct tcf_block *block,
>>                 .block_shared   = tcf_block_shared(block),
>>                 .extack         = extack,
>>         };
>> +
>>         INIT_LIST_HEAD(&bo.cb_list);
>>
>>         flow_indr_block_call(dev, &bo, command);
>> -       tcf_block_setup(block, &bo);
>> +
>> +       if (list_empty(&bo.cb_list))
>> +               return -EOPNOTSUPP;
>> +
>> +       return tcf_block_setup(block, &bo);
>>  }
>>
>>  static bool tcf_block_offload_in_use(struct tcf_block *block)
>> @@ -681,8 +686,6 @@ static int tcf_block_offload_bind(struct tcf_block *block, struct Qdisc *q,
>>                 goto no_offload_dev_inc;
>>         if (err)
>>                 goto err_unlock;
>> -
>> -       tc_indr_block_call(block, dev, ei, FLOW_BLOCK_BIND, extack);
>>         up_write(&block->cb_lock);
>>         return 0;
>>
>> @@ -691,9 +694,10 @@ static int tcf_block_offload_bind(struct tcf_block *block, struct Qdisc *q,
>>                 err = -EOPNOTSUPP;
>>                 goto err_unlock;
>>         }
>> +       err = tc_indr_block_call(block, dev, ei, FLOW_BLOCK_BIND, extack);
>> +       if (err)
>> +               block->nooffloaddevcnt++;
>>         err = 0;
>> -       block->nooffloaddevcnt++;
>> -       tc_indr_block_call(block, dev, ei, FLOW_BLOCK_BIND, extack);
>>  err_unlock:
>>         up_write(&block->cb_lock);
>>         return err;
>> @@ -706,8 +710,6 @@ static void tcf_block_offload_unbind(struct tcf_block *block, struct Qdisc *q,
>>         int err;
>>
>>         down_write(&block->cb_lock);
>> -       tc_indr_block_call(block, dev, ei, FLOW_BLOCK_UNBIND, NULL);
>> -
>>         if (!dev->netdev_ops->ndo_setup_tc)
>>                 goto no_offload_dev_dec;
>>         err = tcf_block_offload_cmd(block, dev, ei, FLOW_BLOCK_UNBIND, NULL);
>> @@ -717,7 +719,9 @@ static void tcf_block_offload_unbind(struct tcf_block *block, struct Qdisc *q,
>>         return;
>>
>>  no_offload_dev_dec:
>> -       WARN_ON(block->nooffloaddevcnt-- == 0);
>> +       err = tc_indr_block_call(block, dev, ei, FLOW_BLOCK_UNBIND, NULL);
>> +       if (err)
>> +               WARN_ON(block->nooffloaddevcnt-- == 0);
>>         up_write(&block->cb_lock);
>>  }
>>
>> --
>> 1.8.3.1
>>

  reply	other threads:[~2019-09-23  4:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-19  8:37 [PATCH net v3] net/sched: cls_api: Fix nooffloaddevcnt counter when indr block call success wenxu
2019-09-19  8:40 ` wenxu
2019-09-19 12:50 ` Or Gerlitz
2019-09-23  4:19   ` wenxu [this message]
2019-09-23  9:42     ` John Hurley
2019-09-23 14:18       ` wenxu
2019-09-24 10:33         ` Or Gerlitz

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=cc63e5ba-661a-72c3-7531-7bd09694549b@ucloud.cn \
    --to=wenxu@ucloud.cn \
    --cc=davem@davemloft.net \
    --cc=gerlitz.or@gmail.com \
    --cc=jakub.kicinski@netronome.com \
    --cc=jiri@mellanox.com \
    --cc=john.hurley@netronome.com \
    --cc=netdev@vger.kernel.org \
    --cc=ozsh@mellanox.com \
    --cc=paulb@mellanox.com \
    --cc=pieter.jansenvanvuuren@netronome.com \
    --cc=roid@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