[PKT_SCHED]: Qdisc drop operation is optional

The drop operation is optional and qdiscs must check if childs support it.

Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]>

---
commit a69d87ea9357e7f1e8979328dd4878a5c79e6f02
tree f68f812188bc0cec40e6b674d9bc5ddd24f6835c
parent 25bf368b3d98668c5d5f38e2201d8bca16e52680
author Patrick McHardy <[EMAIL PROTECTED]> Mon, 13 Feb 2006 20:56:01 +0100
committer Patrick McHardy <[EMAIL PROTECTED]> Mon, 13 Feb 2006 20:56:01 +0100

 net/sched/sch_netem.c |    4 ++--
 net/sched/sch_prio.c  |    2 +-
 net/sched/sch_tbf.c   |    4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
index ba52832..7228d30 100644
--- a/net/sched/sch_netem.c
+++ b/net/sched/sch_netem.c
@@ -252,9 +252,9 @@ static int netem_requeue(struct sk_buff 
 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++;
        }
diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c
index 1641db3..3395ca7 100644
--- a/net/sched/sch_prio.c
+++ b/net/sched/sch_prio.c
@@ -165,7 +165,7 @@ static unsigned int prio_drop(struct Qdi
 
        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;
                }
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
index cb9711e..e9e4734 100644
--- a/net/sched/sch_tbf.c
+++ b/net/sched/sch_tbf.c
@@ -177,9 +177,9 @@ static int tbf_requeue(struct sk_buff *s
 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++;
        }
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to