提交 6d037a26 编写于 作者: P Patrick McHardy 提交者: David S. Miller

[PKT_SCHED]: Qdisc drop operation is optional

The drop operation is optional and qdiscs must check if childs support it.
Signed-off-by: NPatrick McHardy <kaber@trash.net>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 a85d771e
...@@ -252,9 +252,9 @@ static int netem_requeue(struct sk_buff *skb, struct Qdisc *sch) ...@@ -252,9 +252,9 @@ static int netem_requeue(struct sk_buff *skb, struct Qdisc *sch)
static unsigned int netem_drop(struct Qdisc* sch) static unsigned int netem_drop(struct Qdisc* sch)
{ {
struct netem_sched_data *q = qdisc_priv(sch); struct netem_sched_data *q = qdisc_priv(sch);
unsigned int len; unsigned int len = 0;
if ((len = q->qdisc->ops->drop(q->qdisc)) != 0) { if (q->qdisc->ops->drop && (len = q->qdisc->ops->drop(q->qdisc)) != 0) {
sch->q.qlen--; sch->q.qlen--;
sch->qstats.drops++; sch->qstats.drops++;
} }
......
...@@ -165,7 +165,7 @@ static unsigned int prio_drop(struct Qdisc* sch) ...@@ -165,7 +165,7 @@ static unsigned int prio_drop(struct Qdisc* sch)
for (prio = q->bands-1; prio >= 0; prio--) { for (prio = q->bands-1; prio >= 0; prio--) {
qdisc = q->queues[prio]; qdisc = q->queues[prio];
if ((len = qdisc->ops->drop(qdisc)) != 0) { if (qdisc->ops->drop && (len = qdisc->ops->drop(qdisc)) != 0) {
sch->q.qlen--; sch->q.qlen--;
return len; return len;
} }
......
...@@ -177,9 +177,9 @@ static int tbf_requeue(struct sk_buff *skb, struct Qdisc* sch) ...@@ -177,9 +177,9 @@ static int tbf_requeue(struct sk_buff *skb, struct Qdisc* sch)
static unsigned int tbf_drop(struct Qdisc* sch) static unsigned int tbf_drop(struct Qdisc* sch)
{ {
struct tbf_sched_data *q = qdisc_priv(sch); struct tbf_sched_data *q = qdisc_priv(sch);
unsigned int len; unsigned int len = 0;
if ((len = q->qdisc->ops->drop(q->qdisc)) != 0) { if (q->qdisc->ops->drop && (len = q->qdisc->ops->drop(q->qdisc)) != 0) {
sch->q.qlen--; sch->q.qlen--;
sch->qstats.drops++; sch->qstats.drops++;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册