Commit a223643a authored by David Johnson's avatar David Johnson

sigh

parent aeafbab3
This diff is collapsed.
diff -urN iproute-2.6.20-070313/Makefile iproute-2.6.20-070313-emulab/Makefile
--- iproute-2.6.20-070313/Makefile 2007-03-13 15:50:56.000000000 -0600
+++ iproute-2.6.20-070313-emulab/Makefile 2007-08-09 14:55:52.000000000 -0600
@@ -1,9 +1,9 @@
-DESTDIR=
+DESTDIR?=
SBINDIR=/usr/sbin
CONFDIR=/etc/iproute2
DOCDIR=/usr/share/doc/iproute2
MANDIR=/usr/share/man
-KERNEL_INCLUDE=/usr/include
+KERNEL_INCLUDE?=/usr/include
# Path to db_185.h include
DBM_INCLUDE:=/usr/include
diff -urN iproute-2.6.20-070313/include/linux/pkt_sched.h iproute-2.6.20-070313-emulab/include/linux/pkt_sched.h
--- iproute-2.6.20-070313/include/linux/pkt_sched.h 2007-03-13 15:50:56.000000000 -0600
+++ iproute-2.6.20-070313-emulab/include/linux/pkt_sched.h 2007-08-09 15:50:25.000000000 -0600
@@ -90,6 +90,21 @@
__u32 limit; /* Queue length: bytes for bfifo, packets for pfifo */
};
+/* PLR section */
+
+struct tc_plr_qopt
+{
+ __u32 plr; /* % drop rate (0-100) */
+};
+
+/* DELAY section */
+
+struct tc_delay_qopt
+{
+ __u32 delay_usec; /* # of usecs to delay */
+ __u8 reset_time; /* flag: reset time on dequeue, or not */
+};
+
/* PRIO section */
#define TCQ_PRIO_BANDS 16
diff -urN iproute-2.6.20-070313/tc/Makefile iproute-2.6.20-070313-emulab/tc/Makefile
--- iproute-2.6.20-070313/tc/Makefile 2007-03-13 15:50:56.000000000 -0600
+++ iproute-2.6.20-070313-emulab/tc/Makefile 2007-08-09 14:37:43.000000000 -0600
@@ -16,6 +16,8 @@
TCMODULES += f_route.o
TCMODULES += f_fw.o
TCMODULES += f_basic.o
+TCMODULES += q_delay.o
+TCMODULES += q_plr.o
TCMODULES += q_dsmark.o
TCMODULES += q_gred.o
TCMODULES += f_tcindex.o
diff -urN iproute-2.6.20-070313/tc/q_delay.c iproute-2.6.20-070313-emulab/tc/q_delay.c
--- iproute-2.6.20-070313/tc/q_delay.c 1969-12-31 17:00:00.000000000 -0700
+++ iproute-2.6.20-070313-emulab/tc/q_delay.c 2007-09-24 21:27:29.000000000 -0600
@@ -0,0 +1,131 @@
+/*
+ * q_delay.c Delay.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Authors: David T. McWherter, <dtm@vramp.net>
+ * Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <syslog.h>
+#include <fcntl.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <string.h>
+
+#include "utils.h"
+#include "tc_util.h"
+
+static void explain(void)
+{
+ fprintf(stderr, "Usage: ... delay <microseconds> [reset_time (0|1)]\n");
+}
+
+static void explain1(char *arg)
+{
+ fprintf(stderr, "Illegal \"%s\"\n", arg);
+}
+
+
+#define usage() return(-1)
+
+static int
+delay_parse_opt
+ (struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n)
+{
+ struct tc_delay_qopt opt;
+ char *end;
+
+ memset(&opt, 0, sizeof(opt));
+
+ if ( argc > 4 ) {
+ fprintf(stderr, "Too many arguments (seen: %d, expected: 2 or 4)\n",
+ argc);
+ return -1;
+ } else if ( argc < 2 ) {
+ fprintf(stderr, "Too few arguments (seen: %d, expected: 2 or 4)\n",
+ argc);
+ return -1;
+ } else {
+
+ while ( argc > 0 ) {
+ if (!strcmp(*argv, "usecs")) {
+ NEXT_ARG();
+ opt.delay_usec = strtoul(*argv,&end,0);
+ if (*end) {
+ explain1("microseconds");
+ return -1;
+ }
+ fprintf( stdout, "Usecs: %u\n", opt.delay_usec );
+ }
+ else if (!strcmp(*argv, "reset_time")) {
+ NEXT_ARG();
+ opt.reset_time = strtoul(*argv,&end,0);
+ if (*end) {
+ explain1("reset_time");
+ return -1;
+ }
+ fprintf( stdout, "reset_time: %u\n", opt.reset_time );
+ }
+ argc--;
+ argv++;
+ }
+ }
+
+ addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt));
+
+ return 0;
+}
+
+static int
+delay_print_opt
+ (struct qdisc_util *qu, FILE *f, struct rtattr *opt)
+{
+ struct tc_delay_qopt *qopt;
+
+ if (opt == NULL)
+ return 0;
+
+ if ( RTA_PAYLOAD(opt) < sizeof(*qopt))
+ return -1;
+
+ qopt = RTA_DATA(opt);
+ fprintf( f, "delay { %u } reset_time { %u }",
+ qopt->delay_usec,
+ qopt->reset_time
+ );
+
+ return 0;
+}
+
+
+static int delay_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstats)
+{
+ return 0;
+}
+
+
+static int
+delay_parse_class_opt(struct qdisc_util *qu, int argc, char **argv,
+ struct nlmsghdr *n)
+{
+ return 0;
+}
+
+
+struct qdisc_util delay_qdisc_util = {
+ .id = "delay",
+ .parse_qopt = delay_parse_opt,
+ .print_qopt = delay_print_opt,
+ .print_xstats = delay_print_xstats,
+
+ .parse_copt = delay_parse_class_opt,
+ .print_copt = delay_print_opt,
+};
diff -urN iproute-2.6.20-070313/tc/q_plr.c iproute-2.6.20-070313-emulab/tc/q_plr.c
--- iproute-2.6.20-070313/tc/q_plr.c 1969-12-31 17:00:00.000000000 -0700
+++ iproute-2.6.20-070313-emulab/tc/q_plr.c 2007-09-24 21:29:18.000000000 -0600
@@ -0,0 +1,115 @@
+/*
+ * q_plr.c packet loss qdisc
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Authors: Kirk Webb, <kwebb@cs.utah.edu>
+ * Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <syslog.h>
+#include <fcntl.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <string.h>
+
+#include "utils.h"
+#include "tc_util.h"
+
+static void explain(void)
+{
+ fprintf(stderr, "Usage: ... plr <rate (%% loss: 0-100)>\n");
+}
+
+static void explain1(char *arg)
+{
+ fprintf(stderr, "Illegal \"%s\"\n", arg);
+}
+
+
+#define usage() return(-1)
+
+static int
+plr_parse_opt
+ (struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n)
+{
+ struct tc_plr_qopt opt;
+ double plr_rate = 0;
+ char *p;
+
+ memset(&opt, 0, sizeof(opt));
+
+ if ( argc > 1 ) {
+ fprintf(stderr, "Too many arguments (seen: %d, expected: %d)\n",
+ argc, 1);
+ return -1;
+ } else if ( argc < 1 ) {
+ fprintf(stderr, "Too few arguments (seen: %d, expected: %d)\n",
+ argc, 1);
+ return -1;
+ } else if ( argc == 1 ) {
+ plr_rate = strtod(*argv, &p);
+ if (p == *argv || plr_rate < 0 || plr_rate > 1) {
+ explain1("fraction (range 0-1)");
+ return -1;
+ }
+ }
+
+ opt.plr = (unsigned int)(plr_rate*0xffffffffUL);
+ fprintf( stdout, "PLR: %u\n", opt.plr );
+
+ addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt));
+
+ return 0;
+}
+
+static int
+plr_print_opt
+ (struct qdisc_util *qu, FILE *f, struct rtattr *opt)
+{
+ struct tc_plr_qopt *qopt;
+
+ if (opt == NULL)
+ return 0;
+
+ if ( RTA_PAYLOAD(opt) < sizeof(*qopt))
+ return -1;
+
+ qopt = RTA_DATA(opt);
+ fprintf( f, "PLR: %f",
+ qopt->plr / (double) 0xffffffff
+ );
+
+ return 0;
+}
+
+static int plr_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstats)
+{
+ return 0;
+}
+
+static int
+plr_parse_class_opt(struct qdisc_util *qu, int argc, char **argv,
+ struct nlmsghdr *n)
+{
+ return 0;
+}
+
+
+
+struct qdisc_util plr_qdisc_util = {
+ .id = "plr",
+ .parse_qopt = plr_parse_opt,
+ .print_qopt = plr_print_opt,
+ .print_xstats = plr_print_xstats,
+
+ .parse_copt = plr_parse_class_opt,
+ .print_copt = plr_print_opt,
+};
diff -urN iproute-2.6.20-070313/tc/tc_qdisc.c iproute-2.6.20-070313-emulab/tc/tc_qdisc.c
--- iproute-2.6.20-070313/tc/tc_qdisc.c 2007-03-13 15:50:56.000000000 -0600
+++ iproute-2.6.20-070313-emulab/tc/tc_qdisc.c 2007-08-09 14:42:02.000000000 -0600
@@ -36,7 +36,7 @@
fprintf(stderr, "\n");
fprintf(stderr, " tc qdisc show [ dev STRING ] [ingress]\n");
fprintf(stderr, "Where:\n");
- fprintf(stderr, "QDISC_KIND := { [p|b]fifo | tbf | prio | cbq | red | etc. }\n");
+ fprintf(stderr, "QDISC_KIND := { [p|b]fifo | delay | plr | tbf | prio | cbq | red | etc. }\n");
fprintf(stderr, "OPTIONS := ... try tc qdisc add <desired QDISC_KIND> help\n");
return -1;
}
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