Skip to content

Commit

Permalink
[PKT_SCHED]: Qdisc drop operation is optional
Browse files Browse the repository at this point in the history
The drop operation is optional and qdiscs must check if childs support it.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Patrick McHardy authored and David S. Miller committed Mar 21, 2006
1 parent a85d771 commit 6d037a2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions net/sched/sch_netem.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,9 @@ static int netem_requeue(struct sk_buff *skb, struct Qdisc *sch)
static unsigned int netem_drop(struct Qdisc* 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->qstats.drops++;
}
Expand Down
2 changes: 1 addition & 1 deletion net/sched/sch_prio.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ static unsigned int prio_drop(struct Qdisc* sch)

for (prio = q->bands-1; prio >= 0; 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--;
return len;
}
Expand Down
4 changes: 2 additions & 2 deletions net/sched/sch_tbf.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ static int tbf_requeue(struct sk_buff *skb, struct Qdisc* sch)
static unsigned int tbf_drop(struct Qdisc* 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->qstats.drops++;
}
Expand Down

0 comments on commit 6d037a2

Please sign in to comment.