patch-2.4.23 linux-2.4.23/net/sched/sch_generic.c

Next file: linux-2.4.23/net/sched/sch_htb.c
Previous file: linux-2.4.23/net/netsyms.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.22/net/sched/sch_generic.c linux-2.4.23/net/sched/sch_generic.c
@@ -7,7 +7,7 @@
  *		2 of the License, or (at your option) any later version.
  *
  * Authors:	Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
- *              Jamal Hadi Salim, <hadi@nortelnetworks.com> 990601
+ *              Jamal Hadi Salim, <hadi@cyberus.ca> 990601
  *              - Ingress support
  */
 
@@ -283,6 +283,8 @@
 	if (list->qlen <= qdisc->dev->tx_queue_len) {
 		__skb_queue_tail(list, skb);
 		qdisc->q.qlen++;
+		qdisc->stats.bytes += skb->len;
+		qdisc->stats.packets++;
 		return 0;
 	}
 	qdisc->stats.drops++;
@@ -331,6 +333,21 @@
 	qdisc->q.qlen = 0;
 }
 
+static int pfifo_fast_dump(struct Qdisc *qdisc, struct sk_buff *skb)
+{
+	unsigned char	 *b = skb->tail;
+	struct tc_prio_qopt opt;
+
+	opt.bands = 3; 
+	memcpy(&opt.priomap, prio2band, TC_PRIO_MAX+1);
+	RTA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt);
+	return skb->len;
+
+rtattr_failure:
+	skb_trim(skb, b - skb->data);
+	return -1;
+}
+
 static int pfifo_fast_init(struct Qdisc *qdisc, struct rtattr *opt)
 {
 	int i;
@@ -358,6 +375,10 @@
 
 	pfifo_fast_init,
 	pfifo_fast_reset,
+	NULL,
+	NULL,
+	pfifo_fast_dump,
+
 };
 
 struct Qdisc * qdisc_create_dflt(struct net_device *dev, struct Qdisc_ops *ops)
@@ -406,7 +427,6 @@
 
 	dev = qdisc->dev;
 
-#ifdef CONFIG_NET_SCHED
 	if (dev) {
 		struct Qdisc *q, **qp;
 		for (qp = &qdisc->dev->qdisc_list; (q=*qp) != NULL; qp = &q->next) {
@@ -419,7 +439,6 @@
 #ifdef CONFIG_NET_ESTIMATOR
 	qdisc_kill_estimator(&qdisc->stats);
 #endif
-#endif
 	if (ops->reset)
 		ops->reset(qdisc);
 	if (ops->destroy)
@@ -445,6 +464,12 @@
 				printk(KERN_INFO "%s: activation failed\n", dev->name);
 				return;
 			}
+
+			write_lock(&qdisc_tree_lock);
+			qdisc->next = dev->qdisc_list;
+			dev->qdisc_list = qdisc;
+			write_unlock(&qdisc_tree_lock);
+
 		} else {
 			qdisc =  &noqueue_qdisc;
 		}

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)