diff options
| author | root <[email protected]> | 2024-10-17 10:20:30 +0000 |
|---|---|---|
| committer | root <[email protected]> | 2024-10-17 10:20:30 +0000 |
| commit | d0d37d605abe3413ff8afca150e20e475880e78e (patch) | |
| tree | 296b4cf7b4fb3172a9d493bc8745fb7293b73463 /shaping/include | |
| parent | b0de64f0deb1672f0b183f72b99d615f00a73b3b (diff) | |
TSG-22757: 1.适配新版maat,加载json格式的规则 2.适配规则ID变为UUID
Diffstat (limited to 'shaping/include')
| -rw-r--r-- | shaping/include/shaper.h | 13 | ||||
| -rw-r--r-- | shaping/include/shaper_aqm.h | 5 | ||||
| -rw-r--r-- | shaping/include/shaper_maat.h | 38 | ||||
| -rw-r--r-- | shaping/include/shaper_marsio.h | 2 |
4 files changed, 27 insertions, 31 deletions
diff --git a/shaping/include/shaper.h b/shaping/include/shaper.h index a438242..c5d3dd9 100644 --- a/shaping/include/shaper.h +++ b/shaping/include/shaper.h @@ -8,6 +8,7 @@ #include "shaper_stat.h" #include "shaper_global_stat.h" #include "shaper_aqm.h" +#include <uuid/uuid.h> extern "C" { #include "timeout.h" } @@ -59,7 +60,6 @@ struct shaping_thread_ctx { struct shaping_global_stat *global_stat; struct shaping_marsio_info *marsio_info; struct swarmkv *swarmkv_db;//handle of swarmkv - struct shaping_maat_info *maat_info; struct session_table *session_table; struct timeouts *expires; time_t last_update_timeout_sec; @@ -70,7 +70,6 @@ struct shaping_thread_ctx { struct shaping_ctx { int thread_num; struct swarmkv *swarmkv_db;//handle of swarmkv - struct shaping_maat_info *maat_info; struct shaping_marsio_info *marsio_info; struct shaping_stat *stat; struct shaping_global_stat *global_stat; @@ -108,7 +107,7 @@ struct shaper_token_multiple { }; struct shaping_profile_hash_node { - int id; + uuid_t uuid; enum shaper_aqm_type aqm_type; enum shaping_profile_limit_direction limit_direction; long long in_deposit_token_bits[SHAPING_PRIORITY_NUM_MAX]; @@ -133,7 +132,7 @@ struct shaping_profile_hash_node { }; struct shaping_profile_info { - int id;//profile_id + uuid_t uuid;//profile_id enum shaping_profile_type type; int priority; unsigned char async_pass[SHAPING_DIR_MAX]; @@ -147,8 +146,8 @@ struct shaping_profile_info { }; struct shaping_rule_info { + uuid_t uuid;//rule_id int vsys_id; - int id;//rule_id int fair_factor; struct shaping_profile_info primary; struct shaping_profile_info borrowing[SHAPING_REF_PROFILE_NUM_MAX - 1]; @@ -162,7 +161,7 @@ struct shaping_packet_wrapper { unsigned long long enqueue_time_us;//first enqueue time unsigned int length; int rule_anchor; - int aqm_processed_pf_ids[SHAPING_REF_PROFILE_NUM_MAX]; + uuid_t aqm_processed_pf_uuids[SHAPING_REF_PROFILE_NUM_MAX]; TAILQ_ENTRY(shaping_packet_wrapper) node; }; TAILQ_HEAD(delay_queue, shaping_packet_wrapper); @@ -225,7 +224,7 @@ struct shaping_hincrby_cb_arg { long long start_time_us; long long queue_len; enum shaping_packet_dir dir; - int profile_id; + uuid_t profile_uuid; int priority; int retry_cnt; }; diff --git a/shaping/include/shaper_aqm.h b/shaping/include/shaper_aqm.h index 2367d92..3436eae 100644 --- a/shaping/include/shaper_aqm.h +++ b/shaping/include/shaper_aqm.h @@ -1,5 +1,6 @@ #pragma once #include <time.h> +#include <uuid/uuid.h> #include "shaper_stat.h" @@ -37,5 +38,5 @@ struct shaper_aqm_codel_para { }; 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 +int shaper_aqm_blue_need_drop(uuid_t profile_uuid, struct shaper_aqm_blue_para *para, int curr_queue_len); +int shaper_aqm_codel_need_drop(uuid_t profile_uuid, 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_maat.h b/shaping/include/shaper_maat.h index 3ec3259..78363fd 100644 --- a/shaping/include/shaper_maat.h +++ b/shaping/include/shaper_maat.h @@ -1,24 +1,20 @@ +#pragma once #include "shaper.h" -struct shaping_maat_info { - int rule_table_id; - int profile_table_id; -}; - struct shaping_rule { + uuid_t uuid; + uuid_t primary_pf_uuid; + uuid_t borrow_pf_uuid_array[SHAPING_REF_PROFILE_NUM_MAX]; + int borrow_pf_num; int vsys_id; - int id; int priority; - int primary_pf_id; - int borrow_pf_id_array[SHAPING_REF_PROFILE_NUM_MAX]; - int borrow_pf_num; int fair_factor; unsigned char dscp_enable; unsigned char dscp_value; }; struct shaping_profile { - int id; + uuid_t uuid; enum shaping_profile_type type; enum shaper_aqm_type aqm_type; enum shaping_profile_limit_direction limit_direction; @@ -28,17 +24,17 @@ struct shaping_profile { int valid; }; -void shaper_rule_ex_new(const char *table_name, int table_id, const char *key, const char *table_line, void **ad, long argl, void *argp); -void shaper_rule_ex_dup(int table_id, void **to, void **from, long argl, void *argp); -void shaper_rule_ex_free(int table_id, void **ad, long argl, void *argp); -void shaper_profile_ex_new(const char *table_name, int table_id, const char *key, const char *table_line, void **ad, long argl, void *argp); -void shaper_profile_ex_dup(int table_id, void **to, void **from, long argl, void *argp); -void shaper_profile_ex_free(int table_id, void **ad, long argl, void *argp); +void shaper_rule_ex_new(const char *table_name, const char *key, const char *table_line, void **ad, long argl, void *argp); +void shaper_rule_ex_dup(const char *table_name, void **to, void **from, long argl, void *argp); +void shaper_rule_ex_free(const char *table_name, void **ad, long argl, void *argp); +void shaper_profile_ex_new(const char *table_name, const char *key, const char *table_line, void **ad, long argl, void *argp); +void shaper_profile_ex_dup(const char *table_name, void **to, void **from, long argl, void *argp); +void shaper_profile_ex_free(const char *table_name, void **ad, long argl, void *argp); -int shaper_rule_is_enabled(struct shaping_thread_ctx *ctx, long long rule_id); +int shaper_rule_is_enabled(struct shaping_thread_ctx *ctx, uuid_t rule_uuid); -struct shaping_profile *shaper_maat_profile_get(struct shaping_thread_ctx *ctx, int profile_id); +struct shaping_profile *shaper_maat_profile_get(struct shaping_thread_ctx *ctx, uuid_t profile_uuid); -void shaper_rules_update(struct shaping_thread_ctx *ctx, struct shaping_flow *sf, long long *rule_compile_ids, int rule_num); -struct shaping_maat_info* shaper_maat_init(const char *instance_name); -void shaper_maat_destroy(struct shaping_maat_info *maat_info);
\ No newline at end of file +void shaper_rules_update(struct shaping_thread_ctx *ctx, struct shaping_flow *sf, uuid_t *rule_uuids, int rule_num); +int shaper_maat_init(const char *instance_name); +void shaper_maat_destroy();
\ No newline at end of file diff --git a/shaping/include/shaper_marsio.h b/shaping/include/shaper_marsio.h index fdc9c86..c530ee2 100644 --- a/shaping/include/shaper_marsio.h +++ b/shaping/include/shaper_marsio.h @@ -41,7 +41,7 @@ struct ctrl_pkt_data { uint64_t session_id; enum session_state state; - long long shaping_rule_ids[SHAPING_RULE_NUM_MAX]; + uuid_t shaping_rule_uuids[SHAPING_RULE_NUM_MAX]; int shaping_rule_num; }; |
