fixed HTB quantum 1514 instead of r2q
authorxchaos <xchaos@251d49ef-1d17-4917-a970-b30cf55b089b>
Sun, 27 Mar 2022 15:55:48 +0000 (15:55 +0000)
committerxchaos <xchaos@251d49ef-1d17-4917-a970-b30cf55b089b>
Sun, 27 Mar 2022 15:55:48 +0000 (15:55 +0000)
git-svn-id: https://dev.arachne.cz/repos/prometheus/trunk@279 251d49ef-1d17-4917-a970-b30cf55b089b

prometheus.c

index 4cc02a02543b8c2c23c1070fcb09a3b6807362da..9ddd593c3991661fde2cadeccb4454a2048d2eae 100644 (file)
@@ -7,7 +7,7 @@
 /* Credit: CZFree.Net,Martin Devera,Netdave,Aquarius,Gandalf  */\r
 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */\r
 \r
-/* Modified by: xChaos, 20200107\r
+/* Modified by: xChaos, 20220327\r
                  ludva, 20080415\r
  \r
    Prometheus QoS is free software; you can redistribute it and/or\r
@@ -29,7 +29,7 @@
 #include "cll1-0.6.2.h"\r
 #include "ipstruct.h"\r
 \r
-const char *version = "1.0.0-a";\r
+const char *version = "1.0.0-b";\r
 \r
 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */\r
 /* Versions: 0.9.0 is development release, 1.0 will be "stable"    */\r
@@ -118,7 +118,8 @@ int      overlimit_max = 512; /* maximum allowed bandwidth for all undefined hos
 int     qos_free_delay = 0; /* seconds to sleep before applying new QoS rules */\r
 int     digital_divide = 2; /* controls digital divide weirdness ratio, 1...3 */ \r
 int        max_nesting = 5; /* /include/uapi/linux/pkt_sched.h: #define TC_HTB_MAXDEPTH 8 [... - 3 parent classes] */\r
-int            htb_r2q = 256; /* should work for leaf values 512 kbps to 8 Mbps */\r
+//obsolete: int            htb_r2q = 256; /* should work for leaf values 512 kbps to 8 Mbps */\r
+int        htb_quantum = 1514; /* MTU + ethernet header */\r
 int              burst = 8; /* HTB burst (in kbits) */\r
 int         burst_main = 64;\r
 int        burst_group = 32;\r
@@ -333,7 +334,7 @@ void get_config(char *config_filename)
   ioption("htb-burst-main",burst_main);\r
   ioption("htb-burst-group",burst_group);\r
   ioption("htb-nesting-limit",max_nesting);\r
-  ioption("htb-r2q",htb_r2q);\r
+  ioption("htb-quantum",htb_quantum);\r
   ioption("magic-include-upload",include_upload);\r
   ioption("magic-treshold",magic_treshold);  \r
   option("filter-type", cnf);  \r
@@ -374,7 +375,7 @@ void get_config(char *config_filename)
 }\r
 \r
  \r
-/* ========== This function executes, logs OR ALSO prints command ========== */\r
+/* ========== This function executes, logs or also prints command ========== */\r
 \r
 void safe_run(char *cmd)\r
 {\r
@@ -979,16 +980,16 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
 \r
   for_each(interface, interfaces)\r
   {\r
-   sprintf(str, "%s qdisc add dev %s root handle 1: htb r2q %d default 1",\r
-                tc, interface->name, htb_r2q);\r
+   sprintf(str, "%s qdisc add dev %s root handle 1: htb default 1",\r
+                tc, interface->name);\r
    safe_run(str);\r
 \r
-   sprintf(str, "%s class add dev %s parent 1: classid 1:2 htb rate %s ceil %s burst %dk prio %d",\r
-                tc, interface->name, medium, medium, burst_main, highest_priority);\r
+   sprintf(str, "%s class add dev %s parent 1: classid 1:2 htb rate %s ceil %s burst %dk prio %d quantum %d",\r
+                tc, interface->name, medium, medium, burst_main, highest_priority, htb_quantum);\r
    safe_run(str);\r
 \r
-   sprintf(str, "%s class add dev %s parent 1:2 classid 1:1 htb rate %Ldkbit ceil %Ldkbit burst %dk prio %d",\r
-                tc, interface->name, interface->speed, interface->speed, burst_main, highest_priority);\r
+   sprintf(str, "%s class add dev %s parent 1:2 classid 1:1 htb rate %Ldkbit ceil %Ldkbit burst %dk prio %d quantum %d",\r
+                tc, interface->name, interface->speed, interface->speed, burst_main, highest_priority, htb_quantum);\r
    safe_run(str);\r
   }\r
  }\r
@@ -1015,8 +1016,8 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
   {\r
    if(!just_preview)\r
    {\r
-    sprintf(str, "%s class add dev %s parent 1:%d classid 1:%d htb rate %Ldkbit ceil %Ldkbit burst %dk prio %d #down desired %d", \r
-                  tc, interface->name, parent, group->id, rate, max, burst_group, highest_priority+1, group->desired);\r
+    sprintf(str, "%s class add dev %s parent 1:%d classid 1:%d htb rate %Ldkbit ceil %Ldkbit burst %dk prio %d quantum %d #down desired %d", \r
+                  tc, interface->name, parent, group->id, rate, max, burst_group, highest_priority+1, htb_quantum, group->desired);\r
     safe_run(str);\r
    }\r
 \r
@@ -1191,8 +1192,8 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
          {\r
           printf("[down %s: %dk-%dk wants %d]", interface->name, ip->min, ip->max, ip->desired);\r
          }\r
-         sprintf(str, "%s class change dev %s parent 1:%d classid 1:%d htb rate %dkbit ceil %dkbit burst %dk prio %d", \r
-                      tc, interface->name, ip->group, ip->mark, ip->min, ip->max, burst, ip->prio);\r
+         sprintf(str, "%s class change dev %s parent 1:%d classid 1:%d htb rate %dkbit ceil %dkbit burst %dk prio %d quantum %d", \r
+                      tc, interface->name, ip->group, ip->mark, ip->min, ip->max, burst, ip->prio, htb_quantum);\r
          safe_run(str);\r
         }\r
         else\r
@@ -1203,10 +1204,10 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
                                              (int)((ip->desired/ip->keyword->asymetry_ratio)-ip->keyword->asymetry_fixed),\r
                                              (int)((ip->desired/ip->keyword->asymetry_ratio)-ip->keyword->asymetry_fixed));\r
          }\r
-         sprintf(str,"%s class change dev %s parent 1:%d classid 1:%d htb rate %dkbit ceil %dkbit burst %dk prio %d",\r
+         sprintf(str,"%s class change dev %s parent 1:%d classid 1:%d htb rate %dkbit ceil %dkbit burst %dk prio %d quantum %d",\r
                       tc, interface->name, ip->group, ip->mark,\r
                       (int)((ip->min/ip->keyword->asymetry_ratio)-ip->keyword->asymetry_fixed),\r
-                      (int)((ip->max/ip->keyword->asymetry_ratio)-ip->keyword->asymetry_fixed), burst, ip->prio);\r
+                      (int)((ip->max/ip->keyword->asymetry_ratio)-ip->keyword->asymetry_fixed), burst, ip->prio, htb_quantum);\r
          safe_run(str);\r
         }\r
        }\r
@@ -1359,8 +1360,8 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
     printf("[down: %dk-%dk]", ip->min, ip->max);\r
  #endif\r
 \r
-    sprintf(str, "%s class add dev %s parent 1:%d classid 1:%d htb rate %dkbit ceil %dkbit burst %dk prio %d", \r
-                 tc, interface->name, ip->group, ip->mark, ip->min, ip->max, burst, ip->prio);\r
+    sprintf(str, "%s class add dev %s parent 1:%d classid 1:%d htb rate %dkbit ceil %dkbit burst %dk prio %d quantum %d", \r
+                 tc, interface->name, ip->group, ip->mark, ip->min, ip->max, burst, ip->prio, htb_quantum);\r
     safe_run(str);\r
 \r
     if(strcmpi(ip->keyword->leaf_discipline, "none"))\r
@@ -1431,8 +1432,8 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
    /*-----------------------------------------------------------------*/\r
    puts("Generating free bandwith class ...");\r
    /*-----------------------------------------------------------------*/\r
-   sprintf(str, "%s class add dev %s parent 1:%d classid 1:%d htb rate %dkbit ceil %dkbit burst %dk prio %d",\r
-                tc, interface->name, parent, FREE_CLASS, free_min, free_max,burst, lowest_priority);\r
+   sprintf(str, "%s class add dev %s parent 1:%d classid 1:%d htb rate %dkbit ceil %dkbit burst %dk prio %d quantum %d",\r
+                tc, interface->name, parent, FREE_CLASS, free_min, free_max,burst, lowest_priority, htb_quantum);\r
    safe_run(str);\r
    /* tc SFQ */\r
    if(strcmpi(qos_leaf, "none"))\r
@@ -1447,8 +1448,8 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
   /*-----------------------------------------------------------------*/\r
   puts("Generating bandwith class for overlimit packets...");\r
   /*-----------------------------------------------------------------*/\r
-  sprintf(str, "%s class add dev %s parent 1:%d classid 1:%d htb rate %dkbit ceil %dkbit burst %dk prio %d",\r
-               tc, interface->name, parent, OVERLIMIT_CLASS, overlimit_min, overlimit_max, burst, lowest_priority);\r
+  sprintf(str, "%s class add dev %s parent 1:%d classid 1:%d htb rate %dkbit ceil %dkbit burst %dk prio %d quantum %d",\r
+               tc, interface->name, parent, OVERLIMIT_CLASS, overlimit_min, overlimit_max, burst, lowest_priority, htb_quantum);\r
   safe_run(str);\r
  } \r
  printf("Total IP count: %d\n", i);\r
This page took 0.215441 seconds and 4 git commands to generate.