summaryrefslogtreecommitdiff
path: root/shaping/include
diff options
context:
space:
mode:
Diffstat (limited to 'shaping/include')
-rw-r--r--shaping/include/shaper.h16
-rw-r--r--shaping/include/shaper_aqm.h4
-rw-r--r--shaping/include/shaper_stat.h8
3 files changed, 16 insertions, 12 deletions
diff --git a/shaping/include/shaper.h b/shaping/include/shaper.h
index 9a1dca6..5e2f7c0 100644
--- a/shaping/include/shaper.h
+++ b/shaping/include/shaper.h
@@ -76,12 +76,6 @@ struct shaping_ctx {
struct shaping_thread_ctx *thread_ctx;
};
-enum shaping_packet_dir {
- SHAPING_DIR_IN = 0,
- SHAPING_DIR_OUT,
- SHAPING_DIR_MAX
-};
-
enum shaping_packet_action {
SHAPING_FORWARD = 0,
SHAPING_QUEUED,
@@ -120,11 +114,11 @@ struct shaping_profile_hash_node {
long long out_deposit_token_bits[SHAPING_PRIORITY_NUM_MAX];
long long bidirection_deposit_token_bits[SHAPING_PRIORITY_NUM_MAX];
long long last_failed_get_token_ms[SHAPING_DIR_MAX];
- long long last_hmget_ms;
- long long queue_len[SHAPING_PRIORITY_NUM_MAX];
- long long local_queue_len[SHAPING_PRIORITY_NUM_MAX];
+ long long last_hmget_ms[SHAPING_DIR_MAX];
+ long long queue_len[SHAPING_PRIORITY_NUM_MAX][SHAPING_DIR_MAX];
+ long long local_queue_len[SHAPING_PRIORITY_NUM_MAX][SHAPING_DIR_MAX];
long long local_queue_len_update_time_us[SHAPING_PRIORITY_NUM_MAX];
- long long priority_blocked_time_ms[SHAPING_PRIORITY_NUM_MAX];
+ long long priority_blocked_time_ms[SHAPING_PRIORITY_NUM_MAX][SHAPING_DIR_MAX];
int hmget_ref_cnt;
int tconsume_ref_cnt;
unsigned long long last_refresh_time_ms;
@@ -221,6 +215,7 @@ struct shaping_tconsume_cb_arg {
struct shaping_hmget_cb_arg {
struct shaping_thread_ctx *ctx;
struct shaping_profile_hash_node *pf_hash_node;
+ enum shaping_packet_dir dir;
long long start_time_us;
};
@@ -228,6 +223,7 @@ struct shaping_hincrby_cb_arg {
struct shaping_thread_ctx *ctx;
long long start_time_us;
long long queue_len;
+ enum shaping_packet_dir dir;
int profile_id;
int priority;
int retry_cnt;
diff --git a/shaping/include/shaper_aqm.h b/shaping/include/shaper_aqm.h
index 8575076..2367d92 100644
--- a/shaping/include/shaper_aqm.h
+++ b/shaping/include/shaper_aqm.h
@@ -1,6 +1,8 @@
#pragma once
#include <time.h>
+#include "shaper_stat.h"
+
#define BLUE_PROBABILITY_MAX 100
#define BLUE_INCREMENT 10
#define BLUE_DECREMENT 1
@@ -34,6 +36,6 @@ struct shaper_aqm_codel_para {
unsigned int drop_count;
};
-int shaper_aqm_need_drop(struct shaping_profile_info *profile, struct shaping_packet_wrapper *pkt_wrapper, struct timespec *curr_time, unsigned long long latency_us);
+int shaper_aqm_need_drop(struct shaping_profile_info *profile, struct shaping_packet_wrapper *pkt_wrapper, enum shaping_packet_dir dir, struct timespec *curr_time, unsigned long long latency_us);
int shaper_aqm_blue_need_drop(int profile_id, struct shaper_aqm_blue_para *para, int curr_queue_len);
int shaper_aqm_codel_need_drop(int profile_id, struct shaper_aqm_codel_para *para, unsigned long long curr_time_ms, unsigned long long latency_ms); \ No newline at end of file
diff --git a/shaping/include/shaper_stat.h b/shaping/include/shaper_stat.h
index 5c720a3..e6feeb3 100644
--- a/shaping/include/shaper_stat.h
+++ b/shaping/include/shaper_stat.h
@@ -4,6 +4,12 @@
#include "uthash.h"
#include <fieldstat.h>
+enum shaping_packet_dir {
+ SHAPING_DIR_IN = 0,
+ SHAPING_DIR_OUT,
+ SHAPING_DIR_MAX
+};
+
enum shaping_stat_tags_index {
TAG_VSYS_ID_IDX = 0,
TAG_RULE_ID_IDX,
@@ -37,7 +43,7 @@ struct shaping_stat_for_profile_dir {
struct shaping_stat_for_profile {
struct shaping_stat_for_profile_dir in;
struct shaping_stat_for_profile_dir out;
- long long priority_queue_len;
+ long long priority_queue_len[SHAPING_DIR_MAX];
};
struct shaping_stat {