diff options
| author | yangwei <[email protected]> | 2024-07-12 18:33:09 +0800 |
|---|---|---|
| committer | yangwei <[email protected]> | 2024-07-12 19:24:26 +0800 |
| commit | 22585b931e6fad43a8db300a9359f6e3811ffdf4 (patch) | |
| tree | 1b2e6a934c41a265fd4756aef450bcf717083f81 /include/support | |
| parent | c27eacce8a0b21b0692774d90edc213dc1dd54ea (diff) | |
🌈 style(header file refomat): remove CN annotationv4.3.61
Diffstat (limited to 'include/support')
| -rw-r--r-- | include/support/cpu_limit.h | 28 | ||||
| -rw-r--r-- | include/support/grule.h | 6 | ||||
| -rw-r--r-- | include/support/marsio_for_view.h | 218 |
3 files changed, 15 insertions, 237 deletions
diff --git a/include/support/cpu_limit.h b/include/support/cpu_limit.h index 4f83004..39a2248 100644 --- a/include/support/cpu_limit.h +++ b/include/support/cpu_limit.h @@ -6,27 +6,27 @@ extern "C" { #endif typedef void * cpu_limit_handle; -typedef double (*cl_get_res_t)(cpu_limit_handle h, int thread_seq, void *user_arg);//thread_seq范围: [0,CL_OPT_THREAD_COUNT-1] -typedef double (*cl_get_factor_t)(cpu_limit_handle h, int thread_seq,void *user_arg);//thread_seq范围: [0,CL_OPT_THREAD_COUNT-1] +typedef double (*cl_get_res_t)(cpu_limit_handle h, int thread_seq, void *user_arg);//thread_seq: [0,CL_OPT_THREAD_COUNT-1] +typedef double (*cl_get_factor_t)(cpu_limit_handle h, int thread_seq,void *user_arg);//thread_seq: [0,CL_OPT_THREAD_COUNT-1] typedef void (*cl_destroy_cb_t)(cpu_limit_handle h, void *user_arg); typedef enum{ /* set options */ CL_OPT_DEBUG_LOG_FILE_NAME, - CL_OPT_RES_TRIGGER_THRESHOLD, //double, 把资源限制在某个数值内, 比如限速到1Mbps, CPU占用率最大60%, 等等 - CL_OPT_THREAD_COUNT, //int ,是否支持多线程模式, 线程数量, 默认是1, - CL_OPT_RES_SMOOTH_SCOPE, //int, 为了平滑资源占用统计, 避免抖动, 使用最近N次的平均值, 假如统计CPU占用率设成10, 即最近10次的CPU平均值. 如果无此选项, 默认是1 - CL_OPT_STAT_INTERVAL, //int ,获取当前资源占用时间间隔, 单位ms, 默认1000, 即1秒 - CL_OPT_OBSERVE_TIME, //int, 单位:秒, 为了避免抖动, 发现异常后, 即使降低到CL_OPT_RES_TRIGGER_THRESHOLD以下, 短时间内暂不恢复正常状态 - CL_OPT_RES_GET_FUN, // cl_get_res_t, 获取当前资源占用函数指针 - CL_OPT_FACTOR_GET_FUN, // 获取当前占用资源的操作因子数值, 比如pps, bps, new_link/s等, 函数指针 - CL_OPT_USER_ARG, //void *, 用户自定义字段 - CL_OPT_DESTROY_CALLBCAK_FUN, //释放资源callback, cl_destroy_cb_t - CL_OPT_FACTOR_DECREASE_RATIO, //double, 超过res阈值后, 抑制factor的递减率 - CL_OPT_FACTOR_INCREASE_RATIO, //double, 抑制factor低于res阈值后, 缓慢恢复的增长率 + CL_OPT_RES_TRIGGER_THRESHOLD, + CL_OPT_THREAD_COUNT, + CL_OPT_RES_SMOOTH_SCOPE, + CL_OPT_STAT_INTERVAL, + CL_OPT_OBSERVE_TIME, + CL_OPT_RES_GET_FUN, + CL_OPT_FACTOR_GET_FUN, + CL_OPT_USER_ARG, + CL_OPT_DESTROY_CALLBCAK_FUN, + CL_OPT_FACTOR_DECREASE_RATIO, + CL_OPT_FACTOR_INCREASE_RATIO, /* get options */ - CL_OPT_GLOBAL_BYPASS_STATE, //int, 全局bypass状态 + CL_OPT_GLOBAL_BYPASS_STATE, }cpu_limit_opt; cpu_limit_handle cpu_limit_create(void); diff --git a/include/support/grule.h b/include/support/grule.h index ca55909..032fc32 100644 --- a/include/support/grule.h +++ b/include/support/grule.h @@ -5,17 +5,13 @@ extern "C" {
#endif
-#include <stdint.h>
#include <netinet/ip.h>
typedef void * grule_hdl_t;
//typedef void * rule_item_t;
-/*
-* ע��:
-* ���е�ַ��ṹʹ��������(�����ģʽ)��������ʹ��������
-*/
+
#if __BYTE_ORDER != __LITTLE_ENDIAN
#error "machine is not little-endian"
diff --git a/include/support/marsio_for_view.h b/include/support/marsio_for_view.h deleted file mode 100644 index 6905dd0..0000000 --- a/include/support/marsio_for_view.h +++ /dev/null @@ -1,218 +0,0 @@ -/*
- * \brief MARSIO Userspace ZeroCopy Driver Version 4
- *
- * This is the user api header file of MARSIOv4 ZeroCopy Driver
- *
- * \author Qiuwen Lu<[email protected]>
- * Institute of Information Engineering, Chinese Academy of Sciences
- *
- * \date 2016-12-01
- */
-
-#pragma once
-
-typedef enum
-{
- /* 数据面线程数,没有缺省值 */
- MARSIO_OPT_THREAD_NUM,
- /* 数据面线程绑定掩码,没有缺省值
- * 设置该掩码后,数据面线程数选项将被忽略。
- */
- MARSIO_OPT_THREAD_MASK,
- /* 处理SIG信号,缺省值:类型:uint32_t,关闭(0)
- * 启用该选项后,将自动处理SIGINT、SIGTERM信号
- */
- MARSIO_OPT_EXIT_WHEN_ERR,
-
-} marsio_opt_type_t;
-
-typedef enum
-{
- /* 发送后不释放数据包,由应用自行释放数据包 */
- MARSIO_SEND_OPT_NO_FREE = 1 << 0,
- /* 发送时计算发包哈希值,用于分流 */
- MARSIO_SEND_OPT_REHASH = 1 << 1,
- /* 快速报文路径 */
- MARSIO_SEND_OPT_FAST = 1 << 2,
- /* 报文追踪标记 */
- MARSIO_SEND_OPT_TRACE = 1 << 3
-
-} marsio_opt_send_t;
-
-enum mr_sendpath_type
-{
- /* 去往特定虚设备的发包路径 */
- MR_SENDPATH_VDEV,
- /* 路由查表确定发包路径 */
- MR_SENDPATH_ROUTE_NORMAL,
- /* 特定设备路由查表确定发包路径 */
- MR_SENDPATH_ROUTE_SPEC_DEV,
- /* MAX标记 */
- MR_SENDPATH_MAX
-};
-
-enum mr_sendpath_option
-{
- /* 构建四层报文头 */
- MR_SENDPATH_OPT_BUILD_L4 = 0,
- /* 构建三层报文头 */
- MR_SENDPATH_OPT_BUILD_L3 = 1,
- /* 构建二层报文头 */
- MR_SENDPATH_OPT_BUILD_L2 = 2,
- /* 构建前Hook点回调 */
- MR_SENDPATH_OPT_HOOK_PREBUILD = 50,
- /* 构建后Hook点回调 */
- MR_SENDPATH_OPT_HOOK_POSTBUILD = 51,
-};
-
-enum mr_clone_options
-{
- /* 拷贝区域 */
- MR_BUFF_CLONE_DATA = 1 << 0,
- MR_BUFF_CLONE_BUFF = 1 << 1,
- MR_BUFF_CLONE_CTRLZONE = 1 << 2,
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdio.h>
-#include <stdint.h>
-#include <stddef.h>
-#include <netinet/in.h>
-
-#ifndef MARSIO_SOCKET_ID_ANY
-#define MARSIO_SOCKET_ID_ANY -1
-#endif
-
-#ifndef MARSIO_LCORE_ID_ANY
-#define MARSIO_LCORE_ID_ANY -1
-#endif
-
-typedef uint32_t device_id_t;
-typedef uint32_t port_id_t;
-typedef uint32_t queue_id_t;
-typedef uint32_t thread_id_t;
-typedef void marsio_buff_t;
-
-struct mr_sendpath;
-struct mr_instance;
-struct mr_vdev;
-
-struct mr_instance * marsio_create();
-struct mr_instance * marsio_current();
-
-typedef int(*fn_sendpath_hook_t)(struct mr_sendpath * sendpath,
- marsio_buff_t * mbuf[], unsigned int nr_mbuf, void * arg);
-
-int marsio_option_get(struct mr_instance * instance, int opt_type, void * out_opt, size_t out_opt_buffer);
-int marsio_option_set(struct mr_instance * instance, marsio_opt_type_t opt_type, void * opt, size_t sz_opt);
-int marsio_init(struct mr_instance * instance, const char * appsym);
-int marsio_thread_init(struct mr_instance * instance);
-int marsio_destory(struct mr_instance * instance);
-
-struct mr_vdev * marsio_open_device(struct mr_instance * instance,
- const char * devsym, unsigned int nr_rxstream, unsigned int nr_txstream);
-
-void marsio_close_device(struct mr_vdev * vdev);
-
-struct mr_vdev * marsio_device_lookup(struct mr_instance * instance, const char * devsym);
-
-int marsio_recv_burst(struct mr_vdev * vdev, queue_id_t qid, marsio_buff_t * mbufs[], int nr_mbufs);
-int marsio_recv_all_burst(struct mr_instance * instance, queue_id_t qid, marsio_buff_t * mbufs[], int nr_mbufs);
-int marsio_send_burst(struct mr_sendpath * sendpath, queue_id_t qid, marsio_buff_t * mbufs[], int nr_mbufs);
-int marsio_send_burst_with_options(struct mr_sendpath * sendpath, queue_id_t sid, marsio_buff_t * mbufs[],
- int nr_mbufs, uint16_t options);
-
-int marsio_udp_header_construct(marsio_buff_t * buff, uint16_t s_port, uint16_t d_port);
-int marsio_ipv4_header_construct(marsio_buff_t * buff, uint32_t s_ip, uint32_t d_ip, uint8_t proto);
-
-struct mr_sendpath * marsio_sendpath_create_by_droute(struct mr_vdev * dest_device, struct in_addr addr);
-struct mr_sendpath * marsio_sendpath_create_by_route(struct mr_instance * instance, struct in_addr addr);
-struct mr_sendpath * marsio_sendpath_create_by_vdev(struct mr_vdev * dest_device);
-
-struct mr_sendpath * marsio_sendpath_create(struct mr_instance * instance, int type, ...);
-int marsio_sendpath_option_set(struct mr_instance * instance, struct mr_sendpath * sendpath, int opt, ...);
-int marsio_sendpath_option_get(struct mr_instance * instance, struct mr_sendpath * sendpath, int opt, ...);
-void marsio_sendpath_destory(struct mr_sendpath * sendpath);
-
-//simply get control zone data ptr.
-void *marsio_buff_ctrlzone(marsio_buff_t *m, uint8_t id);
-
-//a safe way to read control zone data.
-void *marsio_buff_ctrlzone_data(marsio_buff_t *m, uint8_t id, uint8_t *size);
-
-//a safe way to set control zone data.
-void marsio_buff_ctrlzone_set(marsio_buff_t *m, uint8_t id, void* ptr_data, uint8_t size);
-
-void marsio_buff_reset(marsio_buff_t *m);
-
-marsio_buff_t *marsio_buff_getnext_seg(marsio_buff_t *m);
-marsio_buff_t *marsio_buff_getnext_pkt(marsio_buff_t *m);
-
-void marsio_buff_append_pkt(marsio_buff_t *head, marsio_buff_t *next);
-void marsio_buff_append_seg(marsio_buff_t *head, marsio_buff_t *next);
-void marsio_buff_chain_pkt(marsio_buff_t * pkt, marsio_buff_t * next);
-
-uint16_t marsio_buff_headroom(const marsio_buff_t *m);
-uint16_t marsio_buff_tailroom(const marsio_buff_t *m);
-
-marsio_buff_t *marsio_buff_getnext_seg(marsio_buff_t *m);
-marsio_buff_t *marsio_buff_getnext_pkt(marsio_buff_t *m);
-
-char *marsio_buff_mtod(marsio_buff_t *m);
-
-uint32_t marsio_buff_buflen(marsio_buff_t *m);
-
-uint32_t marsio_buff_datalen(marsio_buff_t *m);
-
-char *marsio_buff_prepend(marsio_buff_t *m, uint16_t len);
-
-char *marsio_buff_append(marsio_buff_t *m, uint16_t len);
-
-char *marsio_buff_adj(marsio_buff_t *m, uint16_t len);
-
-int marsio_buff_trim(marsio_buff_t *m, uint16_t len);
-
-uint16_t marsio_buff_headroom(const marsio_buff_t *m);
-
-uint16_t marsio_buff_tailroom(const marsio_buff_t *m);
-
-uint32_t marsio_get_pkt_type(marsio_buff_t *m);
-
-void marsio_pktmbuf_dump(FILE *f, const marsio_buff_t *m, unsigned dump_len);
-
-marsio_buff_t * marsio_buff_clone_deep(struct mr_instance * instance,
- marsio_buff_t * md, int socket_id, int thread_id);
-
-marsio_buff_t * marsio_buff_clone_with_options(struct mr_instance * instance,
- marsio_buff_t * md, int socket_id, int thread_id, uint16_t options);
-
-int marsio_buff_malloc_device(struct mr_vdev * vdev, marsio_buff_t *marsio_buff[],
- unsigned int nr_mbufs, int socket_id, int thread_id);
-
-int marsio_buff_malloc_global(struct mr_instance * instance, marsio_buff_t *marsio_buff[],
- unsigned int nr_mbufs, int socket_id, int thread_id);
-
-void marsio_buff_free(struct mr_instance * instance, marsio_buff_t *marsio_buff[],
- unsigned int nr_mbufs, int socket_id, int thread_id);
-
-int marsio_buff_is_ctrlbuf(marsio_buff_t * m);
-
-void marsio_buff_set_ctrlbuf(marsio_buff_t *m);
-
-
-uint64_t marsio_buff_get_timestamp(marsio_buff_t *m);
-void marsio_buff_set_timestamp(marsio_buff_t *m, uint64_t timestamp);
-int marsio_buff_get_timestamp_ex(marsio_buff_t * m, enum mr_timestamp_type ts_type, struct timespec * ts);
-
-void marsio_buff_set_rehash_index(marsio_buff_t *m, uint32_t hash);
-uint32_t marsio_buff_get_rehash_index(marsio_buff_t * m);
-
-void * marsio_shared_mem_alloc(struct mr_instance * instance, size_t len);
-void marsio_shared_mem_free(struct mr_instance * instance, void * mem);
-
-#ifdef __cplusplus
-}
-#endif
|
