2 Star 0 Fork 32

我们17走/gazelle

forked from src-openEuler/gazelle 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0020-statck-the-for-loop-in-lstack-thread-is-defined-as-s.patch 4.46 KB
一键复制 编辑 原始数据 按行查看 历史
From 71defaec9e10ee23bf9b3e01989dac4feab94d82 Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Mon, 9 Oct 2023 10:28:30 +0800
Subject: [PATCH] statck: the for loop in lstack thread is defined as
stack_polling
---
src/lstack/core/lstack_protocol_stack.c | 85 ++++++++++++----------
src/lstack/include/lstack_protocol_stack.h | 1 +
2 files changed, 49 insertions(+), 37 deletions(-)
diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c
index 09cba14..ea85bc1 100644
--- a/src/lstack/core/lstack_protocol_stack.c
+++ b/src/lstack/core/lstack_protocol_stack.c
@@ -432,18 +432,60 @@ END:
return NULL;
}
-static void* gazelle_stack_thread(void *arg)
+void stack_polling(uint32_t wakeup_tick)
{
- struct thread_params *t_params = (struct thread_params*) arg;
-
- uint16_t queue_id = t_params->queue_id;
struct cfg_params *cfg = get_global_cfg_params();
uint8_t use_ltran_flag = cfg->use_ltran;
bool kni_switch = cfg->kni_switch;
bool use_sockmap = cfg->use_sockmap;
- uint32_t read_connect_number = cfg->read_connect_number;
+ bool stack_mode_rtc = cfg->stack_mode_rtc;
uint32_t rpc_number = cfg->rpc_number;
uint32_t nic_read_number = cfg->nic_read_number;
+ uint32_t read_connect_number = cfg->read_connect_number;
+ struct protocol_stack *stack = get_protocol_stack();
+
+ poll_rpc_msg(stack, rpc_number);
+ gazelle_eth_dev_poll(stack, use_ltran_flag, nic_read_number);
+ sys_timer_run();
+ if (cfg->low_power_mod != 0) {
+ low_power_idling(stack);
+ }
+
+ if (stack_mode_rtc) {
+ return;
+ }
+
+ do_lwip_read_recvlist(stack, read_connect_number);
+ if ((wakeup_tick & 0xf) == 0) {
+ wakeup_stack_epoll(stack);
+ }
+
+ /* run to completion mode currently does not support sockmap */
+ if (use_sockmap) {
+ netif_poll(&stack->netif);
+ /* reduce traversal times */
+ if ((wakeup_tick & 0xff) == 0) {
+ read_same_node_recv_list(stack);
+ }
+ }
+
+ /* run to completion mode currently does not support kni */
+ /* KNI requests are generally low-rate I/Os,
+ * so processing KNI requests only in the thread with queue_id No.0 is sufficient. */
+ if (kni_switch && !stack->queue_id && !(wakeup_tick & 0xfff)) {
+ rte_kni_handle_request(get_gazelle_kni());
+ if (get_kni_started()) {
+ kni_handle_rx(get_port_id());
+ }
+ }
+ return;
+}
+
+static void* gazelle_stack_thread(void *arg)
+{
+ struct thread_params *t_params = (struct thread_params*) arg;
+
+ uint16_t queue_id = t_params->queue_id;
uint32_t wakeup_tick = 0;
struct protocol_stack *stack = stack_thread_init(arg);
@@ -461,39 +503,8 @@ static void* gazelle_stack_thread(void *arg)
LSTACK_LOG(INFO, LSTACK, "stack_%02hu init success\n", queue_id);
for (;;) {
- poll_rpc_msg(stack, rpc_number);
-
- gazelle_eth_dev_poll(stack, use_ltran_flag, nic_read_number);
-
- if (use_sockmap) {
- netif_poll(&stack->netif);
- /* reduce traversal times */
- if ((wakeup_tick & 0xff) == 0) {
- read_same_node_recv_list(stack);
- }
- }
- do_lwip_read_recvlist(stack, read_connect_number);
-
- if ((wakeup_tick & 0xf) == 0) {
- wakeup_stack_epoll(stack);
- }
-
- /* KNI requests are generally low-rate I/Os,
- * so processing KNI requests only in the thread with queue_id No.0 is sufficient. */
- if (kni_switch && !queue_id && !(wakeup_tick & 0xfff)) {
- rte_kni_handle_request(get_gazelle_kni());
- if (get_kni_started()) {
- kni_handle_rx(get_port_id());
- }
- }
-
+ stack_polling(wakeup_tick);
wakeup_tick++;
-
- sys_timer_run();
-
- if (cfg->low_power_mod != 0) {
- low_power_idling(stack);
- }
}
return NULL;
diff --git a/src/lstack/include/lstack_protocol_stack.h b/src/lstack/include/lstack_protocol_stack.h
index a4f6ac2..7cb37bf 100644
--- a/src/lstack/include/lstack_protocol_stack.h
+++ b/src/lstack/include/lstack_protocol_stack.h
@@ -167,5 +167,6 @@ void stack_replenish_sendring(struct rpc_msg *msg);
void stack_get_conntable(struct rpc_msg *msg);
void stack_get_connnum(struct rpc_msg *msg);
void stack_recvlist_count(struct rpc_msg *msg);
+void stack_polling(uint32_t wakeup_tick);
void kni_handle_tx(struct rte_mbuf *mbuf);
#endif
--
2.27.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/together17/gazelle.git
git@gitee.com:together17/gazelle.git
together17
gazelle
gazelle
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385