浏览代码

pipelimit: remove mutiplying the limit with timer interval for TAILDROP alg

- the limit is documented as per interval, not per second (closes GH #1390)
- renamed macro for default limit to use module specific prefix
Daniel-Constantin Mierla 7 年之前
父节点
当前提交
1880f1f8be
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      src/modules/pipelimit/pipelimit.c

+ 4 - 4
src/modules/pipelimit/pipelimit.c

@@ -64,7 +64,7 @@ MODULE_VERSION
 /*
 /*
  * timer interval length in seconds, tunable via modparam
  * timer interval length in seconds, tunable via modparam
  */
  */
-#define RL_TIMER_INTERVAL 10
+#define PL_TIMER_INTERVAL 10
 
 
 /** SL API structure */
 /** SL API structure */
 sl_api_t slb;
 sl_api_t slb;
@@ -107,7 +107,7 @@ static int load_source_mp = LOAD_SOURCE_CPU;
 static int * load_source;
 static int * load_source;
 
 
 /* these only change in the mod_init() process -- no locking needed */
 /* these only change in the mod_init() process -- no locking needed */
-static int timer_interval = RL_TIMER_INTERVAL;
+static int timer_interval = PL_TIMER_INTERVAL;
 int _pl_cfg_setpoint;        /* desired load, used when reading modparams */
 int _pl_cfg_setpoint;        /* desired load, used when reading modparams */
 /* === */
 /* === */
 
 
@@ -565,7 +565,7 @@ static int pipe_push_direct(pl_pipe_t *pipe)
 			ret = 2;
 			ret = 2;
 			break;
 			break;
 		case PIPE_ALGO_TAILDROP:
 		case PIPE_ALGO_TAILDROP:
-			ret = (pipe->counter <= pipe->limit * timer_interval) ? 1 : -1;
+			ret = (pipe->counter <= pipe->limit) ? 1 : -1;
 			break;
 			break;
 		case PIPE_ALGO_RED:
 		case PIPE_ALGO_RED:
 			if (pipe->load == 0)
 			if (pipe->load == 0)
@@ -869,4 +869,4 @@ int mod_register(char *path, int *dlflags, void *p1, void *p2)
 {
 {
 	sr_kemi_modules_add(sr_kemi_pipelimit_exports);
 	sr_kemi_modules_add(sr_kemi_pipelimit_exports);
 	return 0;
 	return 0;
-}
+}