[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM_iQpWDp3kFfCDL0JJ4c1_e9FZQ_-Wg+5HV0txz=KrTgWsq-w@mail.gmail.com>
Date: Tue, 16 May 2017 15:17:11 -0700
From: Cong Wang <xiyou.wangcong@...il.com>
To: Jiri Pirko <jiri@...nulli.us>
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
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()?
> + 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()?
Powered by blists - more mailing lists