public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: Cong Wang <xiyou.wangcong@gmail.com>
Cc: Linux Kernel Network Developers <netdev@vger.kernel.org>,
	David Miller <davem@davemloft.net>,
	Jamal Hadi Salim <jhs@mojatatu.com>,
	David Ahern <dsa@cumulusnetworks.com>,
	Eric Dumazet <edumazet@google.com>,
	Stephen Hemminger <stephen@networkplumber.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Alexander Duyck <alexander.h.duyck@intel.com>,
	Simon Horman <simon.horman@netronome.com>,
	mlxsw@mellanox.com
Subject: Re: [patch net-next v3 06/10] net: sched: introduce helpers to work with filter chains
Date: Wed, 17 May 2017 07:50:11 +0200	[thread overview]
Message-ID: <20170517055011.GC1832@nanopsycho> (raw)
In-Reply-To: <CAM_iQpWDp3kFfCDL0JJ4c1_e9FZQ_-Wg+5HV0txz=KrTgWsq-w@mail.gmail.com>

Wed, May 17, 2017 at 12:17:11AM CEST, xiyou.wangcong@gmail.com wrote:
>On Tue, May 16, 2017 at 10:27 AM, Jiri Pirko <jiri@resnulli.us> wrote:
>> +static struct tcf_proto *tcf_chain_tp_prev(struct tcf_chain_info *chain_info)
>> +{
>> +       return rtnl_dereference(*chain_info->pprev);
>> +}
>> +
>> +static void tcf_chain_tp_insert(struct tcf_chain *chain,
>> +                               struct tcf_chain_info *chain_info,
>> +                               struct tcf_proto *tp)
>> +{
>> +       if (chain->p_filter_chain &&
>> +           *chain_info->pprev == chain->filter_chain)
>> +               *chain->p_filter_chain = tp;
>> +       RCU_INIT_POINTER(tp->next, rtnl_dereference(*chain_info->pprev));
>
>Use tcf_chain_tp_prev()?

Ok. Will do that.

>
>
>> +       rcu_assign_pointer(*chain_info->pprev, tp);
>> +}
>> +
>> +static void tcf_chain_tp_remove(struct tcf_chain *chain,
>> +                               struct tcf_chain_info *chain_info,
>> +                               struct tcf_proto *tp)
>> +{
>> +       struct tcf_proto *next = rtnl_dereference(chain_info->next);
>> +
>> +       if (chain->p_filter_chain && tp == chain->filter_chain)
>> +               *chain->p_filter_chain = next;
>> +       RCU_INIT_POINTER(*chain_info->pprev, next);
>> +}
>> +
>> +static struct tcf_proto *tcf_chain_tp_find(struct tcf_chain *chain,
>> +                                          struct tcf_chain_info *chain_info,
>> +                                          u32 protocol, u32 prio,
>> +                                          bool prio_allocate)
>> +{
>> +       struct tcf_proto **pprev;
>> +       struct tcf_proto *tp;
>> +
>> +       /* Check the chain for existence of proto-tcf with this priority */
>> +       for (pprev = &chain->filter_chain;
>> +            (tp = rtnl_dereference(*pprev)); pprev = &tp->next) {
>
>Use tcf_chain_tp_prev()?

Can't be done.

  reply	other threads:[~2017-05-17  5:50 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-16 17:27 [patch net-next v3 00/10] net: sched: introduce multichain support for filters Jiri Pirko
2017-05-16 17:27 ` [patch net-next v3 01/10] net: sched: move tc_classify function to cls_api.c Jiri Pirko
2017-05-16 20:25   ` Cong Wang
2017-05-16 21:00     ` Jiri Pirko
2017-05-16 21:03       ` Cong Wang
2017-05-16 21:05         ` Jiri Pirko
2017-05-16 17:27 ` [patch net-next v3 02/10] net: sched: introduce tcf block infractructure Jiri Pirko
2017-05-16 20:51   ` Cong Wang
2017-05-16 20:57     ` Jiri Pirko
2017-05-16 21:34     ` David Miller
2017-05-16 22:34       ` Cong Wang
2017-05-17  5:42         ` Jiri Pirko
2017-05-16 17:27 ` [patch net-next v3 03/10] net: sched: rename tcf_destroy_chain helper Jiri Pirko
2017-05-16 17:27 ` [patch net-next v3 04/10] net: sched: replace nprio by a bool to make the function more readable Jiri Pirko
2017-05-16 17:27 ` [patch net-next v3 05/10] net: sched: move TC_H_MAJ macro call into tcf_auto_prio Jiri Pirko
2017-05-16 21:01   ` Cong Wang
2017-05-16 21:03     ` Jiri Pirko
2017-05-16 22:38       ` Cong Wang
2017-05-17  5:47         ` Jiri Pirko
2017-05-17 12:47           ` Jamal Hadi Salim
2017-05-17 12:53             ` Jiri Pirko
2017-05-16 17:27 ` [patch net-next v3 06/10] net: sched: introduce helpers to work with filter chains Jiri Pirko
2017-05-16 22:17   ` Cong Wang
2017-05-17  5:50     ` Jiri Pirko [this message]
2017-05-16 17:27 ` [patch net-next v3 07/10] net: sched: push chain dump to a separate function Jiri Pirko
2017-05-16 17:28 ` [patch net-next v3 08/10] net: sched: introduce multichain support for filters Jiri Pirko
2017-05-16 17:28 ` [patch net-next v3 09/10] net: sched: push tp down to action init Jiri Pirko
2017-05-16 17:28 ` [patch net-next v3 10/10] net: sched: add termination action to allow goto chain Jiri Pirko
2017-05-16 17:29 ` [patch iproute2 v2 repost 1/3] tc_filter: add support for chain index Jiri Pirko
2017-05-16 18:16   ` Stephen Hemminger
2017-05-16 19:47     ` Jiri Pirko
2017-05-22 20:33   ` Stephen Hemminger
2017-05-23 13:40     ` Jiri Pirko
2017-05-26 19:48       ` Daniel Borkmann
2017-05-27  0:11         ` Stephen Hemminger
2017-05-27  0:24           ` Daniel Borkmann
2017-05-16 17:29 ` [patch iproute2 v2 repost 2/3] tc: actions: add helpers to parse and print control actions Jiri Pirko
2017-06-14 18:32   ` Jiri Benc
2017-06-14 19:18     ` Jiri Pirko
2017-06-14 19:28       ` Jiri Benc
2017-06-14 20:10         ` Jiri Pirko
2017-05-16 17:29 ` [patch iproute2 v2 repost 3/3] tc/actions: introduce support for goto chain action Jiri Pirko
2017-05-31 12:27   ` Jiri Benc
2017-06-02  8:15     ` Jiri Pirko
2017-06-02  8:22       ` Jiri Benc

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=20170517055011.GC1832@nanopsycho \
    --to=jiri@resnulli.us \
    --cc=alexander.h.duyck@intel.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dsa@cumulusnetworks.com \
    --cc=edumazet@google.com \
    --cc=jhs@mojatatu.com \
    --cc=mlxsw@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=simon.horman@netronome.com \
    --cc=stephen@networkplumber.org \
    --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