Wed, May 17, 2017 at 12:17:11AM CEST, xiyou.wangc...@gmail.com wrote: >On Tue, May 16, 2017 at 10:27 AM, Jiri Pirko <j...@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.