Added a preprocessor option to limit exempt traffic and turned in on for now.
authorKevin Webb <kcwebb@ucsd.edu>
Tue, 2 Dec 2008 21:07:43 +0000 (21:07 +0000)
committerKevin Webb <kcwebb@ucsd.edu>
Tue, 2 Dec 2008 21:07:43 +0000 (21:07 +0000)
drl/ulogd_DRL.c

index bc82995..14de4fe 100644 (file)
@@ -990,15 +990,6 @@ static int create_htb_hierarchy(drl_instance_t *instance) {
     }
     printlog(LOG_DEBUG, "HTB_cmd: %s\n", cmd);
 
-    /* Add back 1:20. */
-    sprintf(cmd, "/sbin/tc class add dev eth0 parent 1:1 classid 1:20 htb rate 8bit ceil 1000mbit");
-
-    if (execute_cmd(cmd)) {
-        return 1;
-    }
-    printlog(LOG_DEBUG, "HTB_cmd: %s\n", cmd);
-
-
     /* Add machines. */
     for (i = 0; i < instance->machine_count; ++i) {
         sprintf(cmd, "/sbin/tc class add dev eth0 parent 1:%x classid 1:%x htb rate 8bit ceil %lubit",
@@ -1012,6 +1003,25 @@ static int create_htb_hierarchy(drl_instance_t *instance) {
         printlog(LOG_DEBUG, "HTB_cmd: %s\n", cmd);
     }
 
+#define LIMITEXEMPT
+
+    /* Add back 1:20. */
+#ifdef LIMITEXEMPT
+    if (instance->last_machine == NULL) {
+        sprintf(cmd, "/sbin/tc class add dev eth0 parent 1:1 classid 1:20 htb rate 8bit ceil 1000mbit");
+    } else {
+        sprintf(cmd, "/sbin/tc class add dev eth0 parent 1:%x classid 1:20 htb rate 8bit ceil 1000mbit",
+            instance->last_machine->htb_node);
+    }
+#else
+    sprintf(cmd, "/sbin/tc class add dev eth0 parent 1:1 classid 1:20 htb rate 8bit ceil 1000mbit");
+#endif
+
+    if (execute_cmd(cmd)) {
+        return 1;
+    }
+    printlog(LOG_DEBUG, "HTB_cmd: %s\n", cmd);
+
     /* Add sets. */
     for (j = (instance->set_count - 1); j >= 0; --j) {
         sprintf(cmd, "/sbin/tc class add dev eth0 parent 1:%x classid 1:%x htb rate 8bit ceil %lubit",
@@ -1110,16 +1120,6 @@ static int create_htb_hierarchy(drl_instance_t *instance) {
     /* End delay testing */
 #endif
 
-//#define SFQTEST
-
-#ifdef SFQTEST
-    sprintf(cmd, "/sbin/tc qdisc del dev eth0 parent 1:1000 handle 1000 pfifo");
-    execute_cmd(cmd);
-
-    sprintf(cmd, "/sbin/tc qdisc replace dev eth0 parent 1:1000 handle 1000 sfq perturb 20");
-    execute_cmd(cmd);
-#endif
-
     return 0;
 }