From 259092f39041968a07b395c43ed9cd26250215d9 Mon Sep 17 00:00:00 2001
From: hantwofish <hankangkang5@huawei.com>
Date: Tue, 18 Jun 2024 11:29:58 +0800
Subject: [PATCH] [virtio]: flow_bifurcation switch

---
 src/lstack/core/lstack_cfg.c    | 12 ++++++++++++
 src/lstack/include/lstack_cfg.h |  1 +
 2 files changed, 13 insertions(+)

diff --git a/src/lstack/core/lstack_cfg.c b/src/lstack/core/lstack_cfg.c
index 56f290e..f0c5f4f 100644
--- a/src/lstack/core/lstack_cfg.c
+++ b/src/lstack/core/lstack_cfg.c
@@ -86,6 +86,7 @@ static int32_t parse_nic_vlan_mode(void);
 static int32_t parse_defaule_nonblock_mode(void);
 static int32_t parse_rpc_msg_max(void);
 static int32_t parse_send_cache_mode(void);
+static int32_t parse_flow_bifurcation(void);
 
 #define PARSE_ARG(_arg, _arg_string, _default_val, _min_val, _max_val, _ret) \
     do { \
@@ -152,6 +153,7 @@ static struct config_vector_t g_config_tbl[] = {
     { "nonblock_mode", parse_defaule_nonblock_mode },
     { "rpc_msg_max", parse_rpc_msg_max },
     { "send_cache_mode", parse_send_cache_mode },
+    { "flow_bifurcation", parse_flow_bifurcation},
     { NULL,           NULL }
 };
 
@@ -1393,3 +1395,13 @@ static int32_t parse_send_cache_mode(void)
     return ret;
 }
 
+static int32_t parse_flow_bifurcation(void)
+{
+    int32_t ret;
+    PARSE_ARG(g_config_params.flow_bifurcation, "flow_bifurcation", 0, 0, 1, ret);
+    if (ret != 0) {
+        LSTACK_PRE_LOG(LSTACK_ERR, "cfg: invalid flow_bifurcation value %d. only support 0 or 1\n",
+                       g_config_params.flow_bifurcation);
+    }
+    return ret;
+}
diff --git a/src/lstack/include/lstack_cfg.h b/src/lstack/include/lstack_cfg.h
index b9721ff..9649d73 100644
--- a/src/lstack/include/lstack_cfg.h
+++ b/src/lstack/include/lstack_cfg.h
@@ -122,6 +122,7 @@ struct cfg_params {
     bool nonblock_mode;
     uint32_t rpc_msg_max;
     bool send_cache_mode;
+    bool flow_bifurcation;
 };
 
 struct cfg_params *get_global_cfg_params(void);
-- 
2.33.0

