summaryrefslogtreecommitdiff
path: root/shaping/include/shaper.h
diff options
context:
space:
mode:
authorliuchang <[email protected]>2023-08-08 10:02:10 +0000
committerliuchang <[email protected]>2023-08-08 10:02:10 +0000
commitce5a1ae194daa8cee5f54fe86bc4a324f6a57fce (patch)
treea7b763fadb7799aee4ea8a16cb9540b66ea82ac1 /shaping/include/shaper.h
parent099951d0bd691f35c675df6dbff3031a1a522ee6 (diff)
add feature aqm temp codefeature_aqm
Diffstat (limited to 'shaping/include/shaper.h')
-rw-r--r--shaping/include/shaper.h42
1 files changed, 33 insertions, 9 deletions
diff --git a/shaping/include/shaper.h b/shaping/include/shaper.h
index 2be4d65..f629124 100644
--- a/shaping/include/shaper.h
+++ b/shaping/include/shaper.h
@@ -16,7 +16,6 @@
#define SHAPER_FLOW_POP_NUM_MAX 10
#define SESSION_CLOSE 0x1
-#define SESSION_UPDATE_PF_PRIO_LEN 0x2
#define CONFIRM_PRIORITY_PKTS 20
@@ -24,6 +23,10 @@
#define SHAPING_GLOBAL_CONF_FILE "./conf/shaping.conf"
+#define NANO_SECONDS_PER_MICRO_SEC 1000
+#define MICRO_SECONDS_PER_SEC 1000000
+#define NANO_SECONDS_PER_SEC 1000000000
+
struct shaping_system_conf {
unsigned int session_queue_len_max;
unsigned int priority_queue_len_max;
@@ -78,9 +81,26 @@ enum shaping_profile_type {
PROFILE_TYPE_SPLIT_BY_LOCAL_HOST
};
+enum shaper_aqm_type {
+ AQM_TYPE_NONE = 0,
+ AQM_TYPE_BLUE,
+ AQM_TYPE_CODEL,
+ AQM_TYPE_MAX
+};
+
+struct shaper_aqm_blue_para {
+ time_t update_time;
+ int queue_len_max;
+ int probability;
+ int queue_len;
+ //int d1;//increase delta
+ //int d2;//decrease delta
+};
+
struct shaping_profile_info {
int id;//profile_id
enum shaping_profile_type type;
+ enum shaper_aqm_type aqm_type;
int priority;
int in_deposit_token;
int out_deposit_token;
@@ -90,6 +110,10 @@ struct shaping_profile_info {
unsigned char is_priority_blocked;
unsigned char is_invalid;
struct shaping_stat_for_profile stat;
+ union {
+ struct shaper_aqm_blue_para blue_para;
+ //struct shaper_aqm_codel_para codel_para;
+ }aqm_para;
};
struct shaping_rule_info {
@@ -153,22 +177,22 @@ struct shaper;//instance of shaping, thread unsafe
struct shaping_flow* shaping_flow_new();
void shaping_flow_free(struct shaping_thread_ctx *ctx, struct shaping_flow *sf);
-struct shaper* shaper_new(unsigned int priority_queue_len_max);
-void shaper_free(struct shaper *sp);
+//struct shaper* shaper_new(unsigned int priority_queue_len_max);
+//void shaper_free(struct shaper *sp);
bool shaper_queue_empty(struct shaping_flow *sf);
-void shaper_packet_dequeue(struct shaping_flow *sf);
-struct shaping_packet_wrapper* shaper_first_pkt_get(struct shaping_flow *sf);
+//void shaper_packet_dequeue(struct shaping_flow *sf);
+//struct shaping_packet_wrapper* shaper_first_pkt_get(struct shaping_flow *sf);
void shaper_queue_clear(struct shaping_flow *sf, struct shaping_thread_ctx *ctx);
/*return value: 0 for success, -1 for failed*/
-int shaper_flow_push(struct shaping_thread_ctx *ctx, struct shaping_flow *sf, unsigned long long enqueue_time);
+//int shaper_flow_push(struct shaping_thread_ctx *ctx, struct shaping_flow *sf, unsigned long long enqueue_time);
/*return num of sf_ins*/
-void shaper_flow_pop(struct shaping_thread_ctx *ctx, struct shaping_flow *sf);
-int shaper_flow_in_order_get(struct shaper *sp, struct shaper_flow_instance sf_ins[], int priority, int max_sf_num);
+//void shaper_flow_pop(struct shaping_thread_ctx *ctx, struct shaping_flow *sf);
+//int shaper_flow_in_order_get(struct shaper *sp, struct shaper_flow_instance sf_ins[], int priority, int max_sf_num);
//enum shaping_packet_action shaper_pkt_action_decide(struct shaping_thread_ctx *ctx, struct shaping_flow *sf, int priority, int sf_in_queue);
-int shaper_global_conf_init(struct shaping_system_conf *conf);
+//int shaper_global_conf_init(struct shaping_system_conf *conf);
void shaper_packet_recv_and_process(struct shaping_thread_ctx *ctx);
void shaping_packet_process(struct shaping_thread_ctx *ctx, marsio_buff_t *rx_buff, struct metadata *meta, struct shaping_flow *sf);