1 Star 0 Fork 48

flying-eagle/lwip

forked from src-openEuler/lwip 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0077-adpat-event-for-rtc-mode.patch 3.59 KB
一键复制 编辑 原始数据 按行查看 历史
jinag12 提交于 2023-10-27 19:51 . adapt rtc mode
From e719fde7f90a1dff8daeb23170febb5ff38903c9 Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Fri, 27 Oct 2023 19:19:42 +0800
Subject: [PATCH 77/77] adpat event for rtc mode
---
src/api/api_msg.c | 8 ++------
src/api/sockets.c | 33 ++++++++++++++++++++++++++++++---
src/include/eventpoll.h | 4 ++++
3 files changed, 36 insertions(+), 9 deletions(-)
diff --git a/src/api/api_msg.c b/src/api/api_msg.c
index 9a8992a..5e09505 100644
--- a/src/api/api_msg.c
+++ b/src/api/api_msg.c
@@ -293,11 +293,9 @@ recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p,
#endif /* LWIP_SO_RCVBUF */
#if GAZELLE_UDP_ENABLE
do_lwip_add_recvlist(conn->socket);
- LWIP_UNUSED_ARG(len);
-#else /* GAZELLE_UDP_ENABLE */
+#endif /* GAZELLE_UDP_ENABLE */
/* Register event with callback */
API_EVENT(conn, NETCONN_EVT_RCVPLUS, len);
-#endif /* GAZELLE_UDP_ENABLE */
}
}
#endif /* LWIP_UDP */
@@ -357,11 +355,9 @@ recv_tcp(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
#endif /* LWIP_SO_RCVBUF */
#if GAZELLE_ENABLE
do_lwip_add_recvlist(conn->socket);
- LWIP_UNUSED_ARG(len);
-#else
+#endif
/* Register event with callback */
API_EVENT(conn, NETCONN_EVT_RCVPLUS, len);
-#endif
}
return ERR_OK;
diff --git a/src/api/sockets.c b/src/api/sockets.c
index 1d71427..d62290d 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -2744,29 +2744,56 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
check_waiters = 0;
}
#if GAZELLE_ENABLE
- if (conn->acceptmbox != NULL && !sys_mbox_empty(conn->acceptmbox)) {
- add_sock_event(sock, POLLIN);
+ if (netif_is_rtc_mode(netif_default)) {
+ if (sock->rcvevent == 1) {
+ add_sock_event_nolock(sock, POLLIN);
+ }
+ } else {
+ if (conn->acceptmbox != NULL && !sys_mbox_empty(conn->acceptmbox)) {
+ add_sock_event(sock, POLLIN);
+ }
}
#endif
break;
case NETCONN_EVT_RCVMINUS:
sock->rcvevent--;
check_waiters = 0;
+#if GAZELLE_ENABLE
+ if (netif_is_rtc_mode(netif_default)) {
+ if (sock->rcvevent == 0) {
+ del_sock_event_nolock(sock, POLLIN);
+ }
+ }
+#endif
break;
case NETCONN_EVT_SENDPLUS:
if (sock->sendevent) {
check_waiters = 0;
}
sock->sendevent = 1;
+#if GAZELLE_ENABLE
+ if (netif_is_rtc_mode(netif_default)) {
+ add_sock_event_nolock(sock, POLLOUT);
+ }
+#endif
break;
case NETCONN_EVT_SENDMINUS:
sock->sendevent = 0;
check_waiters = 0;
+#if GAZELLE_ENABLE
+ if (netif_is_rtc_mode(netif_default)) {
+ del_sock_event_nolock(sock, POLLOUT);
+ }
+#endif
break;
case NETCONN_EVT_ERROR:
sock->errevent = 1;
#if GAZELLE_ENABLE
- add_sock_event(sock, EPOLLERR);
+ if (netif_is_rtc_mode(netif_default)) {
+ add_sock_event_nolock(sock, EPOLLERR);
+ } else {
+ add_sock_event(sock, EPOLLERR);
+ }
#endif
break;
default:
diff --git a/src/include/eventpoll.h b/src/include/eventpoll.h
index dd65a4d..5bc5206 100644
--- a/src/include/eventpoll.h
+++ b/src/include/eventpoll.h
@@ -66,6 +66,10 @@ struct libos_epoll {
struct lwip_sock;
extern void add_sock_event(struct lwip_sock *sock, uint32_t event);
+extern void add_sock_event_nolock(struct lwip_sock *sock, uint32_t event);
+extern void del_sock_event(struct lwip_sock *sock, uint32_t event);
+extern void del_sock_event_nolock(struct lwip_sock *sock, uint32_t event);
+
extern int32_t lstack_epoll_close(int32_t);
#endif /* __EVENTPOLL_H__ */
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/flying-eagle12138/lwip.git
git@gitee.com:flying-eagle12138/lwip.git
flying-eagle12138
lwip
lwip
master

搜索帮助