mac80211: calculate hash for fq without holding fq->lock in itxq enqueue
Reduces lock contention on enqueue/dequeue of iTXQ packets Signed-off-by: Felix Fietkau <nbd@nbd.name> Acked-by: Toke Høiland-Jørgensen <toke@redhat.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
committed by
Johannes Berg
parent
ef618b1bd6
commit
f2af2df800
@@ -107,21 +107,23 @@ begin:
|
||||
return skb;
|
||||
}
|
||||
|
||||
static u32 fq_flow_idx(struct fq *fq, struct sk_buff *skb)
|
||||
{
|
||||
u32 hash = skb_get_hash_perturb(skb, fq->perturbation);
|
||||
|
||||
return reciprocal_scale(hash, fq->flows_cnt);
|
||||
}
|
||||
|
||||
static struct fq_flow *fq_flow_classify(struct fq *fq,
|
||||
struct fq_tin *tin,
|
||||
struct fq_tin *tin, u32 idx,
|
||||
struct sk_buff *skb,
|
||||
fq_flow_get_default_t get_default_func)
|
||||
{
|
||||
struct fq_flow *flow;
|
||||
u32 hash;
|
||||
u32 idx;
|
||||
|
||||
lockdep_assert_held(&fq->lock);
|
||||
|
||||
hash = skb_get_hash_perturb(skb, fq->perturbation);
|
||||
idx = reciprocal_scale(hash, fq->flows_cnt);
|
||||
flow = &fq->flows[idx];
|
||||
|
||||
if (flow->tin && flow->tin != tin) {
|
||||
flow = get_default_func(fq, tin, idx, skb);
|
||||
tin->collisions++;
|
||||
@@ -153,7 +155,7 @@ static void fq_recalc_backlog(struct fq *fq,
|
||||
}
|
||||
|
||||
static void fq_tin_enqueue(struct fq *fq,
|
||||
struct fq_tin *tin,
|
||||
struct fq_tin *tin, u32 idx,
|
||||
struct sk_buff *skb,
|
||||
fq_skb_free_t free_func,
|
||||
fq_flow_get_default_t get_default_func)
|
||||
@@ -163,7 +165,7 @@ static void fq_tin_enqueue(struct fq *fq,
|
||||
|
||||
lockdep_assert_held(&fq->lock);
|
||||
|
||||
flow = fq_flow_classify(fq, tin, skb, get_default_func);
|
||||
flow = fq_flow_classify(fq, tin, idx, skb, get_default_func);
|
||||
|
||||
flow->tin = tin;
|
||||
flow->backlog += skb->len;
|
||||
|
||||
Reference in New Issue
Block a user