🐞 fix: 调整TFE conf 文件, 使用四元组分流; 调整metric接口调用位置
This commit is contained in:
@@ -120,7 +120,7 @@ enum tfe_cmsg_tlv_type
|
||||
#define TFE_CMSG_FLAG_USER1 0x2 // 1 << 1
|
||||
|
||||
struct tfe_cmsg* tfe_cmsg_init();
|
||||
void tfe_cmsg_destroy(struct tfe_cmsg *cmsg);
|
||||
void tfe_cmsg_destroy(struct tfe_cmsg **cmsg);
|
||||
|
||||
void tfe_cmsg_dup(struct tfe_cmsg *cmsg);
|
||||
void tfe_cmsg_set_flag(struct tfe_cmsg *cmsg, uint8_t flag);
|
||||
|
||||
@@ -52,20 +52,20 @@ struct tfe_cmsg* tfe_cmsg_init()
|
||||
return cmsg;
|
||||
}
|
||||
|
||||
void tfe_cmsg_destroy(struct tfe_cmsg *cmsg)
|
||||
void tfe_cmsg_destroy(struct tfe_cmsg **cmsg)
|
||||
{
|
||||
if(cmsg != NULL)
|
||||
if(*cmsg != NULL)
|
||||
{
|
||||
if ((__sync_sub_and_fetch(&cmsg->ref, 1) != 0))
|
||||
if ((__sync_sub_and_fetch(&((*cmsg)->ref), 1) != 0))
|
||||
return;
|
||||
pthread_rwlock_wrlock(&cmsg->rwlock);
|
||||
pthread_rwlock_wrlock(&((*cmsg)->rwlock));
|
||||
for(int i = 0; i < TFE_CMSG_TLV_NR_MAX; i++)
|
||||
{
|
||||
FREE(&(cmsg->tlvs[i]));
|
||||
FREE(&((*cmsg)->tlvs[i]));
|
||||
}
|
||||
pthread_rwlock_unlock(&cmsg->rwlock);
|
||||
pthread_rwlock_destroy(&cmsg->rwlock);
|
||||
FREE(&cmsg);
|
||||
pthread_rwlock_unlock(&((*cmsg)->rwlock));
|
||||
pthread_rwlock_destroy(&((*cmsg)->rwlock));
|
||||
FREE(cmsg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -296,6 +296,6 @@ int tfe_cmsg_deserialize(const unsigned char *data, uint16_t len, struct tfe_cms
|
||||
return 0;
|
||||
|
||||
error_out:
|
||||
tfe_cmsg_destroy(cmsg);
|
||||
tfe_cmsg_destroy(&cmsg);
|
||||
return TFE_CMSG_INVALID_FORMAT;
|
||||
}
|
||||
|
||||
@@ -363,7 +363,7 @@ succ:
|
||||
return 0;
|
||||
error:
|
||||
mpack_tree_destroy(&tree);
|
||||
tfe_cmsg_destroy(handler->cmsg);
|
||||
tfe_cmsg_destroy(&handler->cmsg);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -392,7 +392,7 @@ void ctrl_packet_parser_init(struct ctrl_pkt_parser *handler)
|
||||
void ctrl_packet_cmsg_destroy(struct ctrl_pkt_parser *handler)
|
||||
{
|
||||
if (handler) {
|
||||
tfe_cmsg_destroy(handler->cmsg);
|
||||
tfe_cmsg_destroy(&handler->cmsg);
|
||||
|
||||
if (handler->seq_header) {
|
||||
free(handler->seq_header);
|
||||
|
||||
@@ -257,7 +257,7 @@ static void session_ctx_free(struct session_ctx *ctx)
|
||||
|
||||
if (ctx->cmsg)
|
||||
{
|
||||
tfe_cmsg_destroy(ctx->cmsg);
|
||||
tfe_cmsg_destroy(&ctx->cmsg);
|
||||
}
|
||||
|
||||
if (ctx->raw_meta_i2e)
|
||||
@@ -1423,9 +1423,9 @@ static int handle_session_closing(struct metadata *meta, struct ctrl_pkt_parser
|
||||
{
|
||||
struct session_ctx *s_ctx = (struct session_ctx *)node->val_data;
|
||||
TFE_LOG_INFO(logger, "%s: session %lu closing", LOG_TAG_PKTIO, s_ctx->session_id);
|
||||
tfe_set_intercept_metric(s_ctx->cmsg, 1, s_ctx->c2s_info.rx.n_pkts, s_ctx->c2s_info.rx.n_bytes, s_ctx->s2c_info.rx.n_pkts, s_ctx->s2c_info.rx.n_bytes, thread_seq);
|
||||
session_table_delete_by_id(thread->session_table, meta->session_id);
|
||||
ATOMIC_DEC(&(packet_io_fs->session_num));
|
||||
tfe_set_intercept_metric(s_ctx->cmsg, 1, s_ctx->c2s_info.rx.n_pkts, s_ctx->c2s_info.rx.n_bytes, s_ctx->s2c_info.rx.n_pkts, s_ctx->s2c_info.rx.n_bytes, thread_seq);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ int main()
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
tfe_cmsg_destroy(cmsg_encode);
|
||||
tfe_cmsg_destroy(&cmsg_encode);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Get CMSG
|
||||
@@ -73,7 +73,7 @@ int main()
|
||||
assert(ret == 0);
|
||||
printf("cmsg_decode: TFE_CMSG_SSL_PASSTHROUGH_REASON, value is %s, size is %d\n", get_string_value, get_string_len);
|
||||
|
||||
tfe_cmsg_destroy(cmsg_decode);
|
||||
tfe_cmsg_destroy(&cmsg_decode);
|
||||
|
||||
free(temp_buff);
|
||||
return 0;
|
||||
|
||||
@@ -254,7 +254,7 @@ bpf_obj=/opt/tsg/tfe/resource/bpf/bpf_tun_rss_steering.o
|
||||
bpf_debug_log=0
|
||||
# 2: BPF 使用二元组分流
|
||||
# 4: BPF 使用四元组分流
|
||||
bpf_hash_mode=2
|
||||
bpf_hash_mode=4
|
||||
|
||||
# 配置 tap 网卡的 RPS
|
||||
tap_rps_enable=1
|
||||
|
||||
@@ -1465,7 +1465,7 @@ void tfe_stream_destory(struct tfe_stream_private * stream)
|
||||
if (stream->cmsg)
|
||||
{
|
||||
tfe_cmsg_set_flag(stream->cmsg, TFE_CMSG_FLAG_USER0);
|
||||
tfe_cmsg_destroy(stream->cmsg);
|
||||
tfe_cmsg_destroy(&stream->cmsg);
|
||||
}
|
||||
|
||||
FREE(&(stream->plugin_ctxs));
|
||||
|
||||
Reference in New Issue
Block a user