SOURCES: iproute2-q_srr.v0.4.patch (NEW) - add sch_srr support
shadzik
shadzik at pld-linux.org
Wed Jul 18 18:20:35 CEST 2007
Author: shadzik Date: Wed Jul 18 16:20:35 2007 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- add sch_srr support
---- Files affected:
SOURCES:
iproute2-q_srr.v0.4.patch (NONE -> 1.1) (NEW)
---- Diffs:
================================================================
Index: SOURCES/iproute2-q_srr.v0.4.patch
diff -u /dev/null SOURCES/iproute2-q_srr.v0.4.patch:1.1
--- /dev/null Wed Jul 18 18:20:35 2007
+++ SOURCES/iproute2-q_srr.v0.4.patch Wed Jul 18 18:20:30 2007
@@ -0,0 +1,150 @@
+diff -ruN iproute-20041019/include/linux/pkt_sched.h iproute-20041019.srr.patched.v0.4/include/linux/pkt_sched.h
+--- iproute-20041019/include/linux/pkt_sched.h 2006-07-27 13:04:00.000000000 +0300
++++ iproute-20041019.srr.patched.v0.4/include/linux/pkt_sched.h 2006-07-27 13:11:36.000000000 +0300
+@@ -550,6 +550,14 @@
+ * to change these parameters in compile time.
+ */
+
++/* SRR section */
++struct tc_srr_qopt {
++ __u32 slots;
++ __u32 used_slots;
++ __u32 slot_limit;
++ __u32 slot_classify;
++};
++
+ /* RED section */
+
+ enum
+diff -ruN iproute-20041019/tc/q_srr.c iproute-20041019.srr.patched.v0.4/tc/q_srr.c
+--- iproute-20041019/tc/q_srr.c 1970-01-01 03:00:00.000000000 +0300
++++ iproute-20041019.srr.patched.v0.4/tc/q_srr.c 2006-07-27 12:59:27.000000000 +0300
+@@ -0,0 +1,118 @@
++#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"
++
++#define SRR_CL_SRC 0
++#define SRR_CL_DST 1
++#define SRR_CL_FWM 2
++
++static void explain(void)
++{
++ fprintf(stderr, "Usage: ... srr [ slots NUMBER ] [ limit NUMBER ] [ classify src/dst/fw ]\n");
++}
++
++#define usage() return(-1)
++
++static int srr_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n)
++{
++ int ok=0;
++ struct tc_srr_qopt opt;
++
++ memset(&opt, 0, sizeof(opt));
++
++ while ( argc > 0 ) {
++ if ( strcmp(*argv, "slots") == 0 ) {
++ NEXT_ARG();
++ if ( get_u32(&opt.slots, *argv, 0) ) {
++ fprintf(stderr, "Illegal \"slot\"\n");
++ return -1;
++ }
++ ok++;
++ }
++ else if ( strcmp(*argv, "limit") == 0 ) {
++ NEXT_ARG();
++ if ( get_u32(&opt.slot_limit, *argv, 0) ) {
++ fprintf(stderr, "Illegal \"limit\"\n");
++ }
++ ok++;
++ }
++ else if ( strcmp(*argv, "classify") == 0 ) {
++ NEXT_ARG();
++ if ( strcmp(*argv, "src") == 0 ) {
++ opt.slot_classify = SRR_CL_SRC;
++ goto cl_ok;
++ }
++ if ( strcmp(*argv, "dst") == 0 ) {
++ opt.slot_classify = SRR_CL_DST;
++ goto cl_ok;
++ }
++ if ( strcmp(*argv, "fw") == 0 ) {
++ opt.slot_classify = SRR_CL_FWM;
++ goto cl_ok;
++ }
++ fprintf(stderr, "Illegal \"classify\"\n");
++ return -1;
++
++ cl_ok: ok++;
++ }
++ else if ( strcmp(*argv, "help") == 0 ) {
++ explain();
++ return -1;
++ }
++ else {
++ fprintf(stderr, "What is \"%s\"?\n", *argv);
++ explain();
++ return -1;
++ }
++ argc--; argv++;
++ }
++
++ if ( ok )
++ addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt));
++ return 0;
++}
++
++static int srr_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
++{
++ struct tc_srr_qopt *qopt;
++
++ if ( opt == NULL )
++ return 0;
++
++ if (RTA_PAYLOAD(opt) < sizeof(*qopt))
++ return -1;
++
++ qopt = RTA_DATA(opt);
++ fprintf(f, "slots %u ", qopt->slots);
++ fprintf(f, "used %u/%u ", qopt->used_slots, qopt->slots);
++ fprintf(f, "qlimit %u ", qopt->slot_limit);
++ switch (qopt->slot_classify) {
++ case SRR_CL_SRC:
++ fprintf(f, "classify IP_SRC");
++ break;
++ case SRR_CL_DST:
++ fprintf(f, "classify IP_DST");
++ break;
++ case SRR_CL_FWM:
++ fprintf(f, "classify FW");
++ break;
++ default:
++ fprintf(f, "classify UNKNOW!!!");
++ }
++
++ return 0;
++}
++
++
++struct qdisc_util srr_qdisc_util = {
++ .id = "srr",
++ .parse_qopt = srr_parse_opt,
++ .print_qopt = srr_print_opt,
++};
+--- iproute-2.6.22-070710/tc/Makefile.orig 2007-07-18 18:15:46.749073720 +0200
++++ iproute-2.6.22-070710/tc/Makefile 2007-07-18 18:17:19.296663578 +0200
+@@ -8,6 +8,7 @@
+ TCMODULES += q_fifo.o
+ TCMODULES += q_sfq.o
+ TCMODULES += q_esfq.o
++TCMODULES += q_srr.o
+ TCMODULES += q_red.o
+ TCMODULES += q_prio.o
+ TCMODULES += q_tbf.o
================================================================
More information about the pld-cvs-commit
mailing list