[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170517055011.GC1832@nanopsycho>
Date: Wed, 17 May 2017 07:50:11 +0200
From: Jiri Pirko <jiri@...nulli.us>
To: Cong Wang <xiyou.wangcong@...il.com>
Cc: Linux Kernel Network Developers <netdev@...r.kernel.org>,
David Miller <davem@...emloft.net>,
Jamal Hadi Salim <jhs@...atatu.com>,
David Ahern <dsa@...ulusnetworks.com>,
Eric Dumazet <edumazet@...gle.com>,
Stephen Hemminger <stephen@...workplumber.org>,
Daniel Borkmann <daniel@...earbox.net>,
Alexander Duyck <alexander.h.duyck@...el.com>,
Simon Horman <simon.horman@...ronome.com>, mlxsw@...lanox.com
Subject: Re: [patch net-next v3 06/10] net: sched: introduce helpers to work
with filter chains
Wed, May 17, 2017 at 12:17:11AM CEST, xiyou.wangcong@...il.com wrote:
>On Tue, May 16, 2017 at 10:27 AM, Jiri Pirko <jiri@...nulli.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.
Powered by blists - more mailing lists