net: core: introduce mini_Qdisc and eliminate usage of tp->q for clsact fastpath
In sch_handle_egress and sch_handle_ingress tp->q is used only in order to update stats. So stats and filter list are the only things that are needed in clsact qdisc fastpath processing. Introduce new mini_Qdisc struct to hold those items. Also, introduce a helper to swap the mini_Qdisc structures in case filter list head changes. This removes need for tp->q usage without added overhead. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
c7eb7d7230
commit
46209401f8
@@ -1024,3 +1024,49 @@ void psched_ratecfg_precompute(struct psched_ratecfg *r,
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(psched_ratecfg_precompute);
|
||||
|
||||
static void mini_qdisc_rcu_func(struct rcu_head *head)
|
||||
{
|
||||
}
|
||||
|
||||
void mini_qdisc_pair_swap(struct mini_Qdisc_pair *miniqp,
|
||||
struct tcf_proto *tp_head)
|
||||
{
|
||||
struct mini_Qdisc *miniq_old = rtnl_dereference(*miniqp->p_miniq);
|
||||
struct mini_Qdisc *miniq;
|
||||
|
||||
if (!tp_head) {
|
||||
RCU_INIT_POINTER(*miniqp->p_miniq, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
miniq = !miniq_old || miniq_old == &miniqp->miniq2 ?
|
||||
&miniqp->miniq1 : &miniqp->miniq2;
|
||||
|
||||
/* We need to make sure that readers won't see the miniq
|
||||
* we are about to modify. So wait until previous call_rcu_bh callback
|
||||
* is done.
|
||||
*/
|
||||
rcu_barrier_bh();
|
||||
miniq->filter_list = tp_head;
|
||||
rcu_assign_pointer(*miniqp->p_miniq, miniq);
|
||||
|
||||
if (miniq_old)
|
||||
/* This is counterpart of the rcu barrier above. We need to
|
||||
* block potential new user of miniq_old until all readers
|
||||
* are not seeing it.
|
||||
*/
|
||||
call_rcu_bh(&miniq_old->rcu, mini_qdisc_rcu_func);
|
||||
}
|
||||
EXPORT_SYMBOL(mini_qdisc_pair_swap);
|
||||
|
||||
void mini_qdisc_pair_init(struct mini_Qdisc_pair *miniqp, struct Qdisc *qdisc,
|
||||
struct mini_Qdisc __rcu **p_miniq)
|
||||
{
|
||||
miniqp->miniq1.cpu_bstats = qdisc->cpu_bstats;
|
||||
miniqp->miniq1.cpu_qstats = qdisc->cpu_qstats;
|
||||
miniqp->miniq2.cpu_bstats = qdisc->cpu_bstats;
|
||||
miniqp->miniq2.cpu_qstats = qdisc->cpu_qstats;
|
||||
miniqp->p_miniq = p_miniq;
|
||||
}
|
||||
EXPORT_SYMBOL(mini_qdisc_pair_init);
|
||||
|
Reference in New Issue
Block a user