Commit e14ffdfd authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

net_sched: sch_fq: defer skb freeing

Both fq_change() and fq_reset() can use rtnl_kfree_skbs()
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b3d7e2b2
...@@ -514,17 +514,25 @@ static struct sk_buff *fq_dequeue(struct Qdisc *sch) ...@@ -514,17 +514,25 @@ static struct sk_buff *fq_dequeue(struct Qdisc *sch)
return skb; return skb;
} }
static void fq_flow_purge(struct fq_flow *flow)
{
rtnl_kfree_skbs(flow->head, flow->tail);
flow->head = NULL;
flow->qlen = 0;
}
static void fq_reset(struct Qdisc *sch) static void fq_reset(struct Qdisc *sch)
{ {
struct fq_sched_data *q = qdisc_priv(sch); struct fq_sched_data *q = qdisc_priv(sch);
struct rb_root *root; struct rb_root *root;
struct sk_buff *skb;
struct rb_node *p; struct rb_node *p;
struct fq_flow *f; struct fq_flow *f;
unsigned int idx; unsigned int idx;
while ((skb = fq_dequeue_head(sch, &q->internal)) != NULL) sch->q.qlen = 0;
kfree_skb(skb); sch->qstats.backlog = 0;
fq_flow_purge(&q->internal);
if (!q->fq_root) if (!q->fq_root)
return; return;
...@@ -535,8 +543,7 @@ static void fq_reset(struct Qdisc *sch) ...@@ -535,8 +543,7 @@ static void fq_reset(struct Qdisc *sch)
f = container_of(p, struct fq_flow, fq_node); f = container_of(p, struct fq_flow, fq_node);
rb_erase(p, root); rb_erase(p, root);
while ((skb = fq_dequeue_head(sch, f)) != NULL) fq_flow_purge(f);
kfree_skb(skb);
kmem_cache_free(fq_flow_cachep, f); kmem_cache_free(fq_flow_cachep, f);
} }
...@@ -737,7 +744,7 @@ static int fq_change(struct Qdisc *sch, struct nlattr *opt) ...@@ -737,7 +744,7 @@ static int fq_change(struct Qdisc *sch, struct nlattr *opt)
if (!skb) if (!skb)
break; break;
drop_len += qdisc_pkt_len(skb); drop_len += qdisc_pkt_len(skb);
kfree_skb(skb); rtnl_kfree_skbs(skb, skb);
drop_count++; drop_count++;
} }
qdisc_tree_reduce_backlog(sch, drop_count, drop_len); qdisc_tree_reduce_backlog(sch, drop_count, drop_len);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment