sync patch from 2003sp1

This commit is contained in:
yinbin6 2024-06-20 15:41:43 +08:00
parent a22fe95eba
commit 4e6203b697
88 changed files with 8828 additions and 1404 deletions

File diff suppressed because it is too large Load Diff

View File

@ -8,12 +8,12 @@ Subject: [PATCH] [Huawei]gazelle: fix lwip_accept memcpy sockaddr larger than
1 file changed, 2 insertions(+)
diff --git a/src/api/sockets.c b/src/api/sockets.c
index eccc7f9..e640945 100644
index 7ccac78..1c3d4a3 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -860,6 +860,8 @@ lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
if (*addrlen > tempaddr.sa.sa_len) {
*addrlen = tempaddr.sa.sa_len;
@@ -899,6 +899,8 @@ lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
if (*addrlen > IPADDR_SOCKADDR_GET_LEN(&tempaddr)) {
*addrlen = IPADDR_SOCKADDR_GET_LEN(&tempaddr);
}
+#else
+ *addrlen = LWIP_MIN(*addrlen, sizeof(tempaddr));

View File

@ -9,21 +9,21 @@ Subject: [PATCH] fix stack-buffer-overflow in lwip_sock_make_addr and
1 file changed, 4 insertions(+)
diff --git a/src/api/sockets.c b/src/api/sockets.c
index e640945..7ce9378 100644
index 1c3d4a3..3a8a74c 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -1319,6 +1319,8 @@ lwip_sock_make_addr(struct netconn *conn, ip_addr_t *fromaddr, u16_t port,
} else if (*fromlen > saddr.sa.sa_len) {
*fromlen = saddr.sa.sa_len;
@@ -1323,6 +1323,8 @@ lwip_recv_tcp_done:
add_epoll_event(sock->conn, EPOLLIN);
}
}
+#else
+ *fromlen = LWIP_MIN(*fromlen, sizeof(saddr));
#endif
MEMCPY(from, &saddr, *fromlen);
return truncated;
@@ -3133,6 +3135,8 @@ lwip_getaddrname(int s, struct sockaddr *name, socklen_t *namelen, u8_t local)
if (*namelen > saddr.sa.sa_len) {
*namelen = saddr.sa.sa_len;
set_errno(0);
return recvd;
@@ -3179,6 +3181,8 @@ lwip_getaddrname(int s, struct sockaddr *name, socklen_t *namelen, u8_t local)
if (*namelen > IPADDR_SOCKADDR_GET_LEN(&saddr)) {
*namelen = IPADDR_SOCKADDR_GET_LEN(&saddr);
}
+#else
+ *namelen = LWIP_MIN(*namelen, sizeof(saddr));

View File

@ -18,10 +18,10 @@ Subject: [PATCH] lstack support mysql mode
11 files changed, 85 insertions(+), 370 deletions(-)
diff --git a/src/api/api_msg.c b/src/api/api_msg.c
index d5a738f..3072dd9 100644
index d8d6339..0f3a5b6 100644
--- a/src/api/api_msg.c
+++ b/src/api/api_msg.c
@@ -342,6 +342,12 @@ recv_tcp(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
@@ -345,6 +345,12 @@ recv_tcp(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
#endif /* LWIP_SO_RCVBUF */
/* Register event with callback */
API_EVENT(conn, NETCONN_EVT_RCVPLUS, len);
@ -34,7 +34,7 @@ index d5a738f..3072dd9 100644
}
return ERR_OK;
@@ -457,14 +463,6 @@ err_tcp(void *arg, err_t err)
@@ -460,14 +466,6 @@ err_tcp(void *arg, err_t err)
old_state = conn->state;
conn->state = NETCONN_NONE;
@ -49,7 +49,7 @@ index d5a738f..3072dd9 100644
SYS_ARCH_UNPROTECT(lev);
/* Notify the user layer about a connection error. Used to signal select. */
@@ -479,6 +477,12 @@ err_tcp(void *arg, err_t err)
@@ -482,6 +480,12 @@ err_tcp(void *arg, err_t err)
if (NETCONN_MBOX_VALID(conn, &conn->recvmbox)) {
/* use trypost to prevent deadlock */
sys_mbox_trypost(&conn->recvmbox, mbox_msg);
@ -62,7 +62,7 @@ index d5a738f..3072dd9 100644
}
/* pass error message to acceptmbox to wake up pending accept */
if (NETCONN_MBOX_VALID(conn, &conn->acceptmbox)) {
@@ -1344,11 +1348,7 @@ lwip_netconn_do_connected(void *arg, struct tcp_pcb *pcb, err_t err)
@@ -1345,11 +1349,7 @@ lwip_netconn_do_connected(void *arg, struct tcp_pcb *pcb, err_t err)
int s = conn->socket;
struct lwip_sock *sock = get_socket_without_errno(s);
@ -94,12 +94,12 @@ index a917cea..eff9f46 100644
err_out:
diff --git a/src/api/sockets.c b/src/api/sockets.c
index f44c34f..b032ce9 100644
index 31dd51c..fe19d7d 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -90,14 +90,6 @@
#define API_SELECT_CB_VAR_ALLOC(name, retblock) API_VAR_ALLOC_EXT(struct lwip_select_cb, MEMP_SELECT_CB, name, retblock)
#define API_SELECT_CB_VAR_FREE(name) API_VAR_FREE(MEMP_SELECT_CB, name)
@@ -69,14 +69,6 @@
#include <string.h>
-#if USE_LIBOS
-enum KERNEL_LWIP_PATH {
@ -109,10 +109,10 @@ index f44c34f..b032ce9 100644
-};
-#endif
-
#if LWIP_IPV4
#if USE_LIBOS
#define IP4ADDR_PORT_TO_SOCKADDR(sin, ipaddr, port) do { \
@@ -604,8 +596,6 @@ alloc_socket(struct netconn *newconn, int accepted)
#ifdef LWIP_HOOK_FILENAME
#include LWIP_HOOK_FILENAME
#endif
@@ -644,8 +636,6 @@ alloc_socket(struct netconn *newconn, int accepted)
* (unless it has been created by accept()). */
sockets[i].sendevent = (NETCONNTYPE_GROUP(newconn->type) == NETCONN_TCP ? (accepted != 0) : 1);
sockets[i].errevent = 0;
@ -121,7 +121,7 @@ index f44c34f..b032ce9 100644
return i + LWIP_SOCKET_OFFSET;
}
@@ -714,13 +704,6 @@ free_socket(struct lwip_sock *sock, int is_tcp)
@@ -754,13 +744,6 @@ free_socket(struct lwip_sock *sock, int is_tcp)
/* Protect socket array */
SYS_ARCH_PROTECT(lev);
@ -135,7 +135,7 @@ index f44c34f..b032ce9 100644
freed = free_socket_locked(sock, is_tcp, &conn, &lastdata);
SYS_ARCH_UNPROTECT(lev);
/* don't use 'sock' after this line, as another task might have allocated it */
@@ -749,34 +732,11 @@ lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
@@ -789,34 +772,10 @@ lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
SYS_ARCH_DECL_PROTECT(lev);
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d)...\n", s));
@ -162,7 +162,6 @@ index f44c34f..b032ce9 100644
- }
- sys_errno = errno;
-#else
+
sock = get_socket(s);
if (!sock) {
return -1;
@ -171,8 +170,8 @@ index f44c34f..b032ce9 100644
/* wait for a new connection */
err = netconn_accept(sock->conn, &newconn);
@@ -790,9 +750,6 @@ lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
sock_set_errno(sock, err_to_errno(err));
@@ -830,9 +789,6 @@ lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
set_errno(err_to_errno(err));
}
done_socket(sock);
-#if USE_LIBOS
@ -181,7 +180,7 @@ index f44c34f..b032ce9 100644
return -1;
}
LWIP_ASSERT("newconn != NULL", newconn != NULL);
@@ -875,24 +832,11 @@ lwip_bind(int s, const struct sockaddr *name, socklen_t namelen)
@@ -915,24 +871,10 @@ lwip_bind(int s, const struct sockaddr *name, socklen_t namelen)
ip_addr_t local_addr;
u16_t local_port;
err_t err;
@ -198,7 +197,6 @@ index f44c34f..b032ce9 100644
- return -1;
- }
-#else
+
sock = get_socket(s);
if (!sock) {
return -1;
@ -207,7 +205,7 @@ index f44c34f..b032ce9 100644
if (!SOCK_ADDR_TYPE_MATCH(name, sock)) {
/* sockaddr does not match socket type (IPv4/IPv6) */
@@ -912,18 +856,6 @@ lwip_bind(int s, const struct sockaddr *name, socklen_t namelen)
@@ -952,18 +894,6 @@ lwip_bind(int s, const struct sockaddr *name, socklen_t namelen)
ip_addr_debug_print_val(SOCKETS_DEBUG, local_addr);
LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%"U16_F")\n", local_port));
@ -226,14 +224,14 @@ index f44c34f..b032ce9 100644
#if LWIP_IPV4 && LWIP_IPV6
/* Dual-stack: Unmap IPv4 mapped IPv6 addresses */
if (IP_IS_V6_VAL(local_addr) && ip6_addr_isipv4mappedipv6(ip_2_ip6(&local_addr))) {
@@ -953,32 +885,13 @@ lwip_close(int s)
@@ -993,32 +923,12 @@ lwip_close(int s)
struct lwip_sock *sock;
int is_tcp = 0;
err_t err;
- int ret = 0;
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_close(%d)\n", s));
-
-#if USE_LIBOS
- if (posix_api->is_epfd(s)) {
- return posix_api->epoll_close_fn(s);
@ -259,7 +257,7 @@ index f44c34f..b032ce9 100644
if (sock->conn != NULL) {
is_tcp = NETCONNTYPE_GROUP(netconn_type(sock->conn)) == NETCONN_TCP;
@@ -1004,7 +917,7 @@ lwip_close(int s)
@@ -1044,7 +954,7 @@ lwip_close(int s)
free_socket(sock, is_tcp);
set_errno(0);
@ -268,7 +266,7 @@ index f44c34f..b032ce9 100644
}
int
@@ -1013,28 +926,10 @@ lwip_connect(int s, const struct sockaddr *name, socklen_t namelen)
@@ -1053,28 +963,10 @@ lwip_connect(int s, const struct sockaddr *name, socklen_t namelen)
struct lwip_sock *sock;
err_t err;
@ -297,7 +295,7 @@ index f44c34f..b032ce9 100644
if (!SOCK_ADDR_TYPE_MATCH_OR_UNSPEC(name, sock)) {
/* sockaddr does not match socket type (IPv4/IPv6) */
@@ -1106,29 +1001,10 @@ lwip_listen(int s, int backlog)
@@ -1146,29 +1038,10 @@ lwip_listen(int s, int backlog)
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_listen(%d, backlog=%d)\n", s, backlog));
@ -327,7 +325,7 @@ index f44c34f..b032ce9 100644
/* limit the "backlog" parameter to fit in an u8_t */
backlog = LWIP_MIN(LWIP_MAX(backlog, 0), 0xff);
@@ -1160,11 +1036,12 @@ static ssize_t
@@ -1200,11 +1073,12 @@ static ssize_t
lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags)
{
u8_t apiflags = NETCONN_NOAUTORCVD;
@ -342,7 +340,7 @@ index f44c34f..b032ce9 100644
LWIP_ASSERT("no socket given", sock != NULL);
LWIP_ASSERT("this should be checked internally", NETCONNTYPE_GROUP(netconn_type(sock->conn)) == NETCONN_TCP);
@@ -1173,6 +1050,7 @@ lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags)
@@ -1213,6 +1087,7 @@ lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags)
apiflags |= NETCONN_DONTBLOCK;
}
@ -350,7 +348,7 @@ index f44c34f..b032ce9 100644
do {
struct pbuf *p;
err_t err;
@@ -1182,13 +1060,6 @@ lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags)
@@ -1222,13 +1097,6 @@ lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags)
/* Check if there is data left from the last recv operation. */
if (sock->lastdata.pbuf) {
p = sock->lastdata.pbuf;
@ -364,11 +362,9 @@ index f44c34f..b032ce9 100644
} else {
/* No data was left from the previous operation, so we try to get
some from the network. */
@@ -1258,23 +1129,21 @@ lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags)
apiflags |= NETCONN_DONTBLOCK | NETCONN_NOFIN;
@@ -1299,24 +1167,18 @@ lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags)
/* @todo: do we need to support peeking more than one pbuf? */
} while ((recv_left > 0) && !(flags & MSG_PEEK));
+
lwip_recv_tcp_done:
-#if USE_LIBOS
- if (apiflags & NETCONN_NOAUTORCVD)
@ -392,12 +388,13 @@ index f44c34f..b032ce9 100644
- add_epoll_event(sock->conn, EPOLLIN);
- }
- }
-#else
- *fromlen = LWIP_MIN(*fromlen, sizeof(saddr));
-#endif
+
sock_set_errno(sock, 0);
set_errno(0);
return recvd;
}
@@ -1461,37 +1330,6 @@ lwip_recvfrom_udp_raw(struct lwip_sock *sock, int flags, struct msghdr *msg, u16
@@ -1501,37 +1363,6 @@ lwip_recvfrom_udp_raw(struct lwip_sock *sock, int flags, struct msghdr *msg, u16
return ERR_OK;
}
@ -435,7 +432,7 @@ index f44c34f..b032ce9 100644
ssize_t
lwip_recvfrom(int s, void *mem, size_t len, int flags,
struct sockaddr *from, socklen_t *fromlen)
@@ -1499,15 +1337,6 @@ lwip_recvfrom(int s, void *mem, size_t len, int flags,
@@ -1539,15 +1370,6 @@ lwip_recvfrom(int s, void *mem, size_t len, int flags,
struct lwip_sock *sock;
ssize_t ret;
@ -451,7 +448,7 @@ index f44c34f..b032ce9 100644
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom(%d, %p, %"SZT_F", 0x%x, ..)\n", s, mem, len, flags));
sock = get_socket(s);
if (!sock) {
@@ -1557,14 +1386,6 @@ lwip_recvfrom(int s, void *mem, size_t len, int flags,
@@ -1597,14 +1419,6 @@ lwip_recvfrom(int s, void *mem, size_t len, int flags,
ssize_t
lwip_read(int s, void *mem, size_t len)
{
@ -466,8 +463,8 @@ index f44c34f..b032ce9 100644
return lwip_recvfrom(s, mem, len, 0, NULL, NULL);
}
@@ -1598,15 +1419,6 @@ lwip_recvmsg(int s, struct msghdr *message, int flags)
int i;
@@ -1638,15 +1452,6 @@ lwip_recvmsg(int s, struct msghdr *message, int flags)
msg_iovlen_t i;
ssize_t buflen;
-#if USE_LIBOS
@ -482,7 +479,7 @@ index f44c34f..b032ce9 100644
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvmsg(%d, message=%p, flags=0x%x)\n", s, (void *)message, flags));
LWIP_ERROR("lwip_recvmsg: invalid message pointer", message != NULL, return ERR_ARG;);
LWIP_ERROR("lwip_recvmsg: unsupported flags", (flags & ~(MSG_PEEK|MSG_DONTWAIT)) == 0,
@@ -1751,15 +1563,6 @@ lwip_sendmsg(int s, const struct msghdr *msg, int flags)
@@ -1791,15 +1596,6 @@ lwip_sendmsg(int s, const struct msghdr *msg, int flags)
#endif
err_t err = ERR_OK;
@ -498,7 +495,7 @@ index f44c34f..b032ce9 100644
sock = get_socket(s);
if (!sock) {
return -1;
@@ -1923,15 +1726,6 @@ lwip_sendto(int s, const void *data, size_t size, int flags,
@@ -1963,15 +1759,6 @@ lwip_sendto(int s, const void *data, size_t size, int flags,
u16_t remote_port;
struct netbuf buf;
@ -514,7 +511,7 @@ index f44c34f..b032ce9 100644
sock = get_socket(s);
if (!sock) {
return -1;
@@ -2030,11 +1824,6 @@ lwip_socket(int domain, int type, int protocol)
@@ -2070,11 +1857,6 @@ lwip_socket(int domain, int type, int protocol)
LWIP_UNUSED_ARG(domain); /* @todo: check this */
@ -526,7 +523,7 @@ index f44c34f..b032ce9 100644
/* create a netconn */
switch (type) {
case SOCK_RAW:
@@ -2091,14 +1880,6 @@ lwip_socket(int domain, int type, int protocol)
@@ -2131,14 +1913,6 @@ lwip_socket(int domain, int type, int protocol)
ssize_t
lwip_write(int s, const void *data, size_t size)
{
@ -541,7 +538,7 @@ index f44c34f..b032ce9 100644
return lwip_send(s, data, size, 0);
}
@@ -2884,20 +2665,16 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
@@ -2924,20 +2698,16 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
check_waiters = 0;
}
#if USE_LIBOS
@ -566,7 +563,7 @@ index f44c34f..b032ce9 100644
break;
case NETCONN_EVT_SENDPLUS:
if (sock->sendevent) {
@@ -2905,27 +2682,16 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
@@ -2945,27 +2715,16 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
}
sock->sendevent = 1;
#if USE_LIBOS
@ -594,7 +591,7 @@ index f44c34f..b032ce9 100644
add_epoll_event(conn, EPOLLERR);
#endif
break;
@@ -3139,41 +2905,12 @@ lwip_getaddrname(int s, struct sockaddr *name, socklen_t *namelen, u8_t local)
@@ -3179,41 +2938,12 @@ lwip_getaddrname(int s, struct sockaddr *name, socklen_t *namelen, u8_t local)
int
lwip_getpeername(int s, struct sockaddr *name, socklen_t *namelen)
{
@ -636,7 +633,7 @@ index f44c34f..b032ce9 100644
return lwip_getaddrname(s, name, namelen, 1);
}
@@ -3186,23 +2923,11 @@ lwip_getsockopt(int s, int level, int optname, void *optval, socklen_t *optlen)
@@ -3226,23 +2956,11 @@ lwip_getsockopt(int s, int level, int optname, void *optval, socklen_t *optlen)
LWIP_SETGETSOCKOPT_DATA_VAR_DECLARE(data);
#endif /* !LWIP_TCPIP_CORE_LOCKING */
@ -659,8 +656,8 @@ index f44c34f..b032ce9 100644
-#endif /* USE_LIBOS */
if ((NULL == optval) || (NULL == optlen)) {
sock_set_errno(sock, EFAULT);
@@ -3645,25 +3370,11 @@ lwip_setsockopt(int s, int level, int optname, const void *optval, socklen_t opt
set_errno(EFAULT);
@@ -3685,25 +3403,11 @@ lwip_setsockopt(int s, int level, int optname, const void *optval, socklen_t opt
LWIP_SETGETSOCKOPT_DATA_VAR_DECLARE(data);
#endif /* !LWIP_TCPIP_CORE_LOCKING */
@ -685,8 +682,8 @@ index f44c34f..b032ce9 100644
-#endif /* USE_LIBOS */
if (NULL == optval) {
sock_set_errno(sock, EFAULT);
@@ -4308,26 +4019,6 @@ lwip_ioctl(int s, long cmd, void *argp)
set_errno(EFAULT);
@@ -4348,26 +4052,6 @@ lwip_ioctl(int s, long cmd, void *argp)
* the flag O_NONBLOCK is implemented for F_SETFL.
*/
int
@ -713,7 +710,7 @@ index f44c34f..b032ce9 100644
lwip_fcntl(int s, int cmd, int val)
{
struct lwip_sock *sock = get_socket(s);
@@ -4337,7 +4028,6 @@ lwip_fcntl(int s, int cmd, int val)
@@ -4377,7 +4061,6 @@ lwip_fcntl(int s, int cmd, int val)
if (!sock) {
return -1;
}
@ -752,10 +749,10 @@ index 55561b1..9a92143 100644
uint32_t sys_now(void)
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
index dac498e..b99974d 100644
index 74b22b0..1164c56 100644
--- a/src/core/tcp_out.c
+++ b/src/core/tcp_out.c
@@ -472,6 +472,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
@@ -475,6 +475,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
* pos records progress as data is segmented.
*/
@ -763,7 +760,7 @@ index dac498e..b99974d 100644
/* Find the tail of the unsent queue. */
if (pcb->unsent != NULL) {
u16_t space;
@@ -587,6 +588,13 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
@@ -590,6 +591,13 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
pcb->unsent_oversize == 0);
#endif /* TCP_OVERSIZE */
}
@ -777,7 +774,7 @@ index dac498e..b99974d 100644
/*
* Phase 3: Create new segments.
@@ -604,6 +612,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
@@ -607,6 +615,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
u8_t chksum_swapped = 0;
#endif /* TCP_CHECKSUM_ON_COPY */
@ -785,7 +782,7 @@ index dac498e..b99974d 100644
if (apiflags & TCP_WRITE_FLAG_COPY) {
/* If copy is set, memory should be allocated and data copied
* into pbuf */
@@ -650,6 +659,10 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
@@ -653,6 +662,10 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
/* Concatenate the headers and data pbufs together. */
pbuf_cat(p/*header*/, p2/*data*/);
}
@ -813,10 +810,10 @@ index f525bc2..aacc1d2 100644
#endif /* __EVENTPOLL_H__ */
diff --git a/src/include/lwip/priv/tcp_priv.h b/src/include/lwip/priv/tcp_priv.h
index f771725..83208bf 100644
index f666f8f..783acf5 100644
--- a/src/include/lwip/priv/tcp_priv.h
+++ b/src/include/lwip/priv/tcp_priv.h
@@ -349,7 +349,7 @@ static inline int vdev_reg_done(enum reg_ring_type reg_type, const struct tcp_pc
@@ -346,7 +346,7 @@ static inline int vdev_reg_done(enum reg_ring_type reg_type, const struct tcp_pc
{
LWIP_ASSERT("Invalid parameter", pcb != NULL);
@ -826,10 +823,10 @@ index f771725..83208bf 100644
qtuple.src_ip = pcb->local_ip.addr;
qtuple.src_port = lwip_htons(pcb->local_port);
diff --git a/src/include/lwip/sockets.h b/src/include/lwip/sockets.h
index 345e26c..4e7e671 100644
index c8f0fab..1d63e8f 100644
--- a/src/include/lwip/sockets.h
+++ b/src/include/lwip/sockets.h
@@ -647,7 +647,7 @@ int lwip_poll(struct pollfd *fds, nfds_t nfds, int timeout);
@@ -666,7 +666,7 @@ int lwip_poll(struct pollfd *fds, nfds_t nfds, int timeout);
#if USE_LIBOS
int lwip_ioctl(int s, long cmd, ...);

View File

@ -22,7 +22,7 @@ Subject: [PATCH] refactor event and add HW checksum offload
create mode 100644 src/include/dpdk_cksum.h
diff --git a/src/api/api_msg.c b/src/api/api_msg.c
index 3072dd9..672f022 100644
index 0f3a5b6..8f20577 100644
--- a/src/api/api_msg.c
+++ b/src/api/api_msg.c
@@ -57,6 +57,7 @@
@ -33,7 +33,7 @@ index 3072dd9..672f022 100644
#endif
#include <string.h>
@@ -1758,7 +1759,15 @@ lwip_netconn_do_writemore(struct netconn *conn WRITE_DELAYED_PARAM)
@@ -1759,7 +1760,15 @@ lwip_netconn_do_writemore(struct netconn *conn WRITE_DELAYED_PARAM)
} else {
write_more = 0;
}
@ -70,7 +70,7 @@ index bce07f5..3f85bad 100644
{
/* the symbol we use here won't be NULL, so we don't need dlerror()
diff --git a/src/api/sockets.c b/src/api/sockets.c
index 21de5d9..3d94454 100644
index f041776..4216986 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -65,6 +65,7 @@
@ -81,7 +81,7 @@ index 21de5d9..3d94454 100644
#endif
#include <string.h>
@@ -2682,9 +2683,6 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
@@ -2724,9 +2725,6 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
check_waiters = 0;
}
sock->sendevent = 1;
@ -92,7 +92,7 @@ index 21de5d9..3d94454 100644
case NETCONN_EVT_SENDMINUS:
sock->sendevent = 0;
diff --git a/src/core/ipv4/icmp.c b/src/core/ipv4/icmp.c
index 59b493a..c58ae25 100644
index 9a82a67..0404608 100644
--- a/src/core/ipv4/icmp.c
+++ b/src/core/ipv4/icmp.c
@@ -51,6 +51,10 @@
@ -124,7 +124,7 @@ index 59b493a..c58ae25 100644
#endif /* CHECKSUM_GEN_IP */
diff --git a/src/core/ipv4/ip4.c b/src/core/ipv4/ip4.c
index c83afbe..1334cdc 100644
index ef7771f..4623096 100644
--- a/src/core/ipv4/ip4.c
+++ b/src/core/ipv4/ip4.c
@@ -59,6 +59,10 @@
@ -138,7 +138,7 @@ index c83afbe..1334cdc 100644
#ifdef LWIP_HOOK_FILENAME
#include LWIP_HOOK_FILENAME
#endif
@@ -503,8 +507,17 @@ ip4_input(struct pbuf *p, struct netif *inp)
@@ -537,8 +541,17 @@ ip4_input(struct pbuf *p, struct netif *inp)
/* verify checksum */
#if CHECKSUM_CHECK_IP
IF__NETIF_CHECKSUM_ENABLED(inp, NETIF_CHECKSUM_CHECK_IP) {
@ -157,7 +157,7 @@ index c83afbe..1334cdc 100644
LWIP_DEBUGF(IP_DEBUG | LWIP_DBG_LEVEL_SERIOUS,
("Checksum (0x%"X16_F") failed, IP packet dropped.\n", inet_chksum(iphdr, iphdr_hlen)));
ip4_debug_print(p);
@@ -972,7 +985,16 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d
@@ -1006,7 +1019,16 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d
IPH_CHKSUM_SET(iphdr, 0);
#if CHECKSUM_GEN_IP
IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_IP) {
@ -175,7 +175,7 @@ index c83afbe..1334cdc 100644
#endif /* CHECKSUM_GEN_IP */
#endif /* CHECKSUM_GEN_IP_INLINE */
diff --git a/src/core/ipv4/ip4_frag.c b/src/core/ipv4/ip4_frag.c
index a445530..17a4ccd 100644
index 5303144..15b61ee 100644
--- a/src/core/ipv4/ip4_frag.c
+++ b/src/core/ipv4/ip4_frag.c
@@ -51,6 +51,10 @@
@ -227,7 +227,7 @@ index a445530..17a4ccd 100644
/* No need for separate header pbuf - we allowed room for it in rambuf
diff --git a/src/core/pbuf.c b/src/core/pbuf.c
index cd6b558..247681d 100644
index 9d4e1c8..69a52b6 100644
--- a/src/core/pbuf.c
+++ b/src/core/pbuf.c
@@ -282,7 +282,7 @@ pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type)
@ -239,9 +239,9 @@ index cd6b558..247681d 100644
p = lwip_alloc_pbuf(layer, length, type);
#else
p = (struct pbuf *)mem_malloc(alloc_len);
@@ -1019,6 +1019,13 @@ pbuf_copy_partial_pbuf(struct pbuf *p_to, const struct pbuf *p_from, u16_t copy_
@@ -1016,6 +1016,13 @@ pbuf_copy_partial_pbuf(struct pbuf *p_to, const struct pbuf *p_from, u16_t copy_
/* current p_from does not fit into current p_to */
len_calc = p_to->len - offset_to;
len = p_to->len - offset_to;
}
+
+#if USE_LIBOS && (CHECKSUM_GEN_IP_HW || CHECKSUM_GEN_TCP_HW)
@ -250,11 +250,11 @@ index cd6b558..247681d 100644
+ p_to->ol_flags = p_from->ol_flags;
+#endif
+
len = (u16_t)LWIP_MIN(copy_len, len_calc);
len = LWIP_MIN(copy_len, len);
MEMCPY((u8_t *)p_to->payload + offset_to, (u8_t *)p_from->payload + offset_from, len);
offset_to += len;
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index 0d3a2f1..b1bbe00 100644
index 1dd0ed6..fa574ff 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -64,6 +64,10 @@
@ -294,7 +294,7 @@ index 0d3a2f1..b1bbe00 100644
TCP_STATS_INC(tcp.chkerr);
goto dropped;
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
index b99974d..1b0af8d 100644
index 1164c56..df26e53 100644
--- a/src/core/tcp_out.c
+++ b/src/core/tcp_out.c
@@ -80,6 +80,13 @@
@ -311,7 +311,7 @@ index b99974d..1b0af8d 100644
#ifdef LWIP_HOOK_FILENAME
#include LWIP_HOOK_FILENAME
#endif
@@ -660,8 +667,11 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
@@ -663,8 +670,11 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
pbuf_cat(p/*header*/, p2/*data*/);
}
#else /* USE_LIBOS */
@ -325,7 +325,7 @@ index b99974d..1b0af8d 100644
#endif /* USE_LIBOS */
queuelen += pbuf_clen(p);
@@ -789,8 +799,13 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
@@ -792,8 +802,13 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
/*
* Finally update the pcb state.
*/
@ -339,7 +339,7 @@ index b99974d..1b0af8d 100644
pcb->snd_queuelen = queuelen;
LWIP_DEBUGF(TCP_QLEN_DEBUG, ("tcp_write: %"S16_F" (after enqueued)\n",
@@ -1584,6 +1599,11 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
@@ -1587,6 +1602,11 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
#if CHECKSUM_GEN_TCP
IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_TCP) {
@ -351,7 +351,7 @@ index b99974d..1b0af8d 100644
#if TCP_CHECKSUM_ON_COPY
u32_t acc;
#if TCP_CHECKSUM_ON_COPY_SANITY_CHECK
@@ -1618,6 +1638,44 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
@@ -1621,6 +1641,44 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
seg->tcphdr->chksum = ip_chksum_pseudo(seg->p, IP_PROTO_TCP,
seg->p->tot_len, &pcb->local_ip, &pcb->remote_ip);
#endif /* TCP_CHECKSUM_ON_COPY */
@ -396,10 +396,10 @@ index b99974d..1b0af8d 100644
}
#endif /* CHECKSUM_GEN_TCP */
TCP_STATS_INC(tcp.xmit);
@@ -1959,8 +2017,18 @@ tcp_output_control_segment(const struct tcp_pcb *pcb, struct pbuf *p,
@@ -1979,8 +2037,18 @@ tcp_output_control_segment_netif(const struct tcp_pcb *pcb, struct pbuf *p,
#if CHECKSUM_GEN_TCP
IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_TCP) {
struct tcp_hdr *tcphdr = (struct tcp_hdr *)p->payload;
IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_TCP) {
struct tcp_hdr *tcphdr = (struct tcp_hdr *)p->payload;
+#if CHECKSUM_GEN_TCP_HW
+ if (get_eth_params_tx_ol() & DEV_TX_OFFLOAD_TCP_CKSUM) {
+ tcph_cksum_set(p, TCP_HLEN);
@ -409,12 +409,12 @@ index b99974d..1b0af8d 100644
+ src, dst);
+ }
+#else
tcphdr->chksum = ip_chksum_pseudo(p, IP_PROTO_TCP, p->tot_len,
src, dst);
tcphdr->chksum = ip_chksum_pseudo(p, IP_PROTO_TCP, p->tot_len,
src, dst);
+#endif
}
}
#endif
if (pcb != NULL) {
if (pcb != NULL) {
diff --git a/src/include/dpdk_cksum.h b/src/include/dpdk_cksum.h
new file mode 100644
index 0000000..e57be4d
@ -529,7 +529,7 @@ index 0000000..e57be4d
+#endif /* USE_LIBOS */
+#endif /* __DPDK_CKSUM_H__ */
diff --git a/src/include/lwip/pbuf.h b/src/include/lwip/pbuf.h
index 3894574..87cd960 100644
index b539ad6..fea7be9 100644
--- a/src/include/lwip/pbuf.h
+++ b/src/include/lwip/pbuf.h
@@ -220,6 +220,15 @@ struct pbuf {
@ -669,7 +669,7 @@ index 36bcaed..eec4e8e 100644
extern void gazelle_init_sock(int32_t fd);
#endif /* USE_LIBOS */
diff --git a/src/netif/ethernet.c b/src/netif/ethernet.c
index dd171e2..ab976a8 100644
index db5c514..0f21ad3 100644
--- a/src/netif/ethernet.c
+++ b/src/netif/ethernet.c
@@ -56,6 +56,10 @@
@ -683,7 +683,7 @@ index dd171e2..ab976a8 100644
#ifdef LWIP_HOOK_FILENAME
#include LWIP_HOOK_FILENAME
#endif
@@ -308,6 +312,10 @@ ethernet_output(struct netif * netif, struct pbuf * p,
@@ -316,6 +320,10 @@ ethernet_output(struct netif * netif, struct pbuf * p,
LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE,
("ethernet_output: sending packet %p\n", (void *)p));

View File

@ -15,10 +15,10 @@ Subject: [PATCH] refactor pkt read/send
8 files changed, 75 insertions(+), 45 deletions(-)
diff --git a/src/api/api_msg.c b/src/api/api_msg.c
index 672f022..7839526 100644
index 8f20577..ab3cfc1 100644
--- a/src/api/api_msg.c
+++ b/src/api/api_msg.c
@@ -341,13 +341,12 @@ recv_tcp(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
@@ -344,13 +344,12 @@ recv_tcp(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
#if LWIP_SO_RCVBUF
SYS_ARCH_INC(conn->recv_avail, len);
#endif /* LWIP_SO_RCVBUF */
@ -36,7 +36,7 @@ index 672f022..7839526 100644
#endif
}
@@ -479,10 +478,7 @@ err_tcp(void *arg, err_t err)
@@ -482,10 +481,7 @@ err_tcp(void *arg, err_t err)
/* use trypost to prevent deadlock */
sys_mbox_trypost(&conn->recvmbox, mbox_msg);
#if USE_LIBOS
@ -48,7 +48,7 @@ index 672f022..7839526 100644
#endif
}
/* pass error message to acceptmbox to wake up pending accept */
@@ -1356,6 +1352,7 @@ lwip_netconn_do_connected(void *arg, struct tcp_pcb *pcb, err_t err)
@@ -1357,6 +1353,7 @@ lwip_netconn_do_connected(void *arg, struct tcp_pcb *pcb, err_t err)
}
}
SET_CONN_TYPE_LIBOS(conn);
@ -79,10 +79,10 @@ index 3f85bad..6afb9c6 100644
err_out:
diff --git a/src/api/sockets.c b/src/api/sockets.c
index 3d94454..4d4cea1 100644
index 4216986..7cdb9d8 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -1039,11 +1039,7 @@ lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags)
@@ -1076,11 +1076,7 @@ lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags)
{
u8_t apiflags = NETCONN_NOAUTORCVD;
ssize_t recvd = 0;
@ -94,15 +94,15 @@ index 3d94454..4d4cea1 100644
LWIP_ASSERT("no socket given", sock != NULL);
LWIP_ASSERT("this should be checked internally", NETCONNTYPE_GROUP(netconn_type(sock->conn)) == NETCONN_TCP);
@@ -1134,6 +1130,7 @@ lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags)
@@ -1170,6 +1166,7 @@ lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags)
} while ((recv_left > 0) && !(flags & MSG_PEEK));
lwip_recv_tcp_done:
#else /* USE_LIBOS */
+ LWIP_UNUSED_ARG(recv_left);
recvd = read_lwip_data(sock, flags, apiflags);
if (recvd <= 0) {
return recvd;
@@ -2667,10 +2664,8 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
@@ -2709,10 +2706,8 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
check_waiters = 0;
}
#if USE_LIBOS

View File

@ -12,7 +12,7 @@ Signed-off-by: Honggang LI <honggangli@163.com>
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/include/arch/cc.h b/src/include/arch/cc.h
index 222b0c9..aa18573 100644
index 222b0c9..10d667b 100644
--- a/src/include/arch/cc.h
+++ b/src/include/arch/cc.h
@@ -62,7 +62,7 @@ void alloc_memp_##name##_base(void) \

View File

@ -23,10 +23,10 @@ index 6afb9c6..e721381 100644
CHECK_DLSYM_RET_RETURN(posix_api->epoll_wait_fn = dlsym(handle, "epoll_wait"));
CHECK_DLSYM_RET_RETURN(posix_api->fork_fn = dlsym(handle, "fork"));
diff --git a/src/api/sockets.c b/src/api/sockets.c
index 4d4cea1..c939899 100644
index 129f7cc..39376a5 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -543,10 +543,11 @@ get_socket_by_fd(int fd)
@@ -583,10 +583,11 @@ get_socket_by_fd(int fd)
* @param newconn the netconn for which to allocate a socket
* @param accepted 1 if socket has been created by accept(),
* 0 if socket has been created by socket()
@ -39,7 +39,7 @@ index 4d4cea1..c939899 100644
{
int i;
SYS_ARCH_DECL_PROTECT(lev);
@@ -570,12 +571,19 @@ alloc_socket(struct netconn *newconn, int accepted)
@@ -610,12 +611,19 @@ alloc_socket(struct netconn *newconn, int accepted)
break;
}
@ -59,7 +59,7 @@ index 4d4cea1..c939899 100644
if ((i < LWIP_SOCKET_OFFSET) || (i >= sockets_num + LWIP_SOCKET_OFFSET)) {
goto err;
}
@@ -721,7 +729,7 @@ free_socket(struct lwip_sock *sock, int is_tcp)
@@ -764,7 +772,7 @@ free_socket(struct lwip_sock *sock, int is_tcp)
*/
int
@ -68,7 +68,7 @@ index 4d4cea1..c939899 100644
{
struct lwip_sock *sock, *nsock;
struct netconn *newconn;
@@ -755,7 +763,7 @@ lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
@@ -797,7 +805,7 @@ lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
}
LWIP_ASSERT("newconn != NULL", newconn != NULL);
@ -76,8 +76,8 @@ index 4d4cea1..c939899 100644
+ newsock = alloc_socket(newconn, 1, flags);
if (newsock == -1) {
netconn_delete(newconn);
sock_set_errno(sock, ENFILE);
@@ -827,6 +835,12 @@ lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
set_errno(ENFILE);
@@ -869,6 +877,12 @@ lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
return newsock;
}
@ -90,7 +90,7 @@ index 4d4cea1..c939899 100644
int
lwip_bind(int s, const struct sockaddr *name, socklen_t namelen)
{
@@ -1823,6 +1837,10 @@ lwip_socket(int domain, int type, int protocol)
@@ -1868,6 +1882,10 @@ lwip_socket(int domain, int type, int protocol)
LWIP_UNUSED_ARG(domain); /* @todo: check this */
@ -101,7 +101,7 @@ index 4d4cea1..c939899 100644
/* create a netconn */
switch (type) {
case SOCK_RAW:
@@ -1862,7 +1880,15 @@ lwip_socket(int domain, int type, int protocol)
@@ -1907,7 +1925,15 @@ lwip_socket(int domain, int type, int protocol)
return -1;
}
@ -119,10 +119,10 @@ index 4d4cea1..c939899 100644
if (i == -1) {
netconn_delete(conn);
diff --git a/src/include/lwip/sockets.h b/src/include/lwip/sockets.h
index 4e7e671..3c5b87b 100644
index 1d63e8f..ca5bf6e 100644
--- a/src/include/lwip/sockets.h
+++ b/src/include/lwip/sockets.h
@@ -573,6 +573,7 @@ void lwip_socket_thread_cleanup(void); /* LWIP_NETCONN_SEM_PER_THREAD==1: destro
@@ -592,6 +592,7 @@ void lwip_socket_thread_cleanup(void); /* LWIP_NETCONN_SEM_PER_THREAD==1: destro
#if LWIP_COMPAT_SOCKETS == 2
/* This helps code parsers/code completion by not having the COMPAT functions as defines */
#define lwip_accept accept
@ -130,7 +130,7 @@ index 4e7e671..3c5b87b 100644
#define lwip_bind bind
#define lwip_shutdown shutdown
#define lwip_getpeername getpeername
@@ -614,7 +615,25 @@ int fcntl(int s, int cmd, ...);
@@ -633,7 +634,25 @@ int fcntl(int s, int cmd, ...);
#endif /* LWIP_POSIX_SOCKETS_IO_NAMES */
#endif /* LWIP_COMPAT_SOCKETS == 2 */
@ -156,7 +156,7 @@ index 4e7e671..3c5b87b 100644
int lwip_bind(int s, const struct sockaddr *name, socklen_t namelen);
int lwip_shutdown(int s, int how);
int lwip_getpeername (int s, struct sockaddr *name, socklen_t *namelen);
@@ -661,6 +680,8 @@ int lwip_inet_pton(int af, const char *src, void *dst);
@@ -680,6 +699,8 @@ int lwip_inet_pton(int af, const char *src, void *dst);
/** @ingroup socket */
#define accept(s,addr,addrlen) lwip_accept(s,addr,addrlen)
/** @ingroup socket */

View File

@ -1,19 +1,34 @@
diff -Nur lwip-2.1.3-org/src/core/init.c lwip-2.1.3/src/core/init.c
--- lwip-2.1.3-org/src/core/init.c 2022-12-06 14:40:45.280000000 +0000
+++ lwip-2.1.3/src/core/init.c 2022-12-06 14:41:01.452000000 +0000
@@ -306,7 +306,7 @@
#if TCP_SNDLOWAT >= TCP_SND_BUF
#error "lwip_sanity_check: WARNING: TCP_SNDLOWAT must be less than TCP_SND_BUF. If you know what you are doing, define LWIP_DISABLE_TCP_SANITY_CHECKS to 1 to disable this error."
From d9e656c6ca48367fdc174b00c64d6f3fb0584a38 Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Mon, 5 Feb 2024 15:09:14 +0800
Subject: [PATCH] add huge snd_buf
---
src/core/init.c | 2 +-
src/core/pbuf.c | 9 ++++++---
src/include/lwip/opt.h | 2 +-
src/include/lwip/pbuf.h | 2 +-
src/include/lwipopts.h | 2 +-
5 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/core/init.c b/src/core/init.c
index 5b60ed8..6841857 100644
--- a/src/core/init.c
+++ b/src/core/init.c
@@ -312,7 +312,7 @@ PACK_STRUCT_END
#if TCP_MSS >= ((16 * 1024) - 1)
#error "lwip_sanity_check: WARNING: TCP_MSS must be <= 16382 to prevent u16_t underflow in TCP_SNDLOWAT calculation!"
#endif
-#if TCP_SNDLOWAT >= (0xFFFF - (4 * TCP_MSS))
+#if TCP_SNDLOWAT >= (0xFFFFFFFF - (4 * TCP_MSS))
#error "lwip_sanity_check: WARNING: TCP_SNDLOWAT must at least be 4*MSS below u16_t overflow!"
#endif
#if TCP_SNDQUEUELOWAT >= TCP_SND_QUEUELEN
diff -Nur lwip-2.1.3-org/src/core/pbuf.c lwip-2.1.3/src/core/pbuf.c
--- lwip-2.1.3-org/src/core/pbuf.c 2022-12-06 14:40:45.280000000 +0000
+++ lwip-2.1.3/src/core/pbuf.c 2022-12-06 14:46:04.860000000 +0000
@@ -869,13 +869,13 @@
diff --git a/src/core/pbuf.c b/src/core/pbuf.c
index 69a52b6..bea0e81 100644
--- a/src/core/pbuf.c
+++ b/src/core/pbuf.c
@@ -871,13 +871,13 @@ pbuf_cat(struct pbuf *h, struct pbuf *t)
/* proceed to last pbuf of chain */
for (p = h; p->next != NULL; p = p->next) {
/* add total length of second chain to all totals of first chain */
@ -29,7 +44,7 @@ diff -Nur lwip-2.1.3-org/src/core/pbuf.c lwip-2.1.3/src/core/pbuf.c
/* chain last pbuf of head (p) with first of tail (t) */
p->next = t;
/* p->next now references t, but the caller will drop its reference to t,
@@ -1181,7 +1181,7 @@
@@ -1178,7 +1178,7 @@ void pbuf_split_64k(struct pbuf *p, struct pbuf **rest)
if (r != NULL) {
/* Update the tot_len field in the first part */
for (i = p; i != NULL; i = i->next) {
@ -38,7 +53,7 @@ diff -Nur lwip-2.1.3-org/src/core/pbuf.c lwip-2.1.3/src/core/pbuf.c
LWIP_ASSERT("tot_len/len mismatch in last pbuf",
(i->next != NULL) || (i->tot_len == i->len));
}
@@ -1192,6 +1192,9 @@
@@ -1189,6 +1189,9 @@ void pbuf_split_64k(struct pbuf *p, struct pbuf **rest)
/* tot_len field in rest does not need modifications */
/* reference counters do not need modifications */
*rest = r;
@ -48,10 +63,11 @@ diff -Nur lwip-2.1.3-org/src/core/pbuf.c lwip-2.1.3/src/core/pbuf.c
}
}
}
diff -Nur lwip-2.1.3-org/src/include/lwip/opt.h lwip-2.1.3/src/include/lwip/opt.h
--- lwip-2.1.3-org/src/include/lwip/opt.h 2022-12-06 14:40:45.292000000 +0000
+++ lwip-2.1.3/src/include/lwip/opt.h 2022-12-06 14:41:01.456000000 +0000
@@ -1482,7 +1482,7 @@
diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h
index b738460..570d2de 100644
--- a/src/include/lwip/opt.h
+++ b/src/include/lwip/opt.h
@@ -1533,7 +1533,7 @@
* send window while having a small receive window only.
*/
#if !defined LWIP_WND_SCALE || defined __DOXYGEN__
@ -60,10 +76,11 @@ diff -Nur lwip-2.1.3-org/src/include/lwip/opt.h lwip-2.1.3/src/include/lwip/opt.
#define TCP_RCV_SCALE 0
#endif
diff -Nur lwip-2.1.3-org/src/include/lwip/pbuf.h lwip-2.1.3/src/include/lwip/pbuf.h
--- lwip-2.1.3-org/src/include/lwip/pbuf.h 2022-12-06 14:40:45.284000000 +0000
+++ lwip-2.1.3/src/include/lwip/pbuf.h 2022-12-06 14:46:36.720000000 +0000
@@ -197,7 +197,7 @@
diff --git a/src/include/lwip/pbuf.h b/src/include/lwip/pbuf.h
index b362007..60d8d1a 100644
--- a/src/include/lwip/pbuf.h
+++ b/src/include/lwip/pbuf.h
@@ -197,7 +197,7 @@ struct pbuf {
* For non-queue packet chains this is the invariant:
* p->tot_len == p->len + (p->next? p->next->tot_len: 0)
*/
@ -72,9 +89,10 @@ diff -Nur lwip-2.1.3-org/src/include/lwip/pbuf.h lwip-2.1.3/src/include/lwip/pbu
/** length of this buffer */
u16_t len;
diff -Nur lwip-2.1.3-org/src/include/lwipopts.h lwip-2.1.3/src/include/lwipopts.h
--- lwip-2.1.3-org/src/include/lwipopts.h 2022-12-06 14:40:45.292000000 +0000
+++ lwip-2.1.3/src/include/lwipopts.h 2022-12-06 14:41:01.456000000 +0000
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
index 7c819d0..d7b9635 100644
--- a/src/include/lwipopts.h
+++ b/src/include/lwipopts.h
@@ -97,7 +97,7 @@
#define TCP_WND (40 * TCP_MSS)
@ -84,3 +102,6 @@ diff -Nur lwip-2.1.3-org/src/include/lwipopts.h lwip-2.1.3/src/include/lwipopts.
#define TCP_SND_QUEUELEN (8191)
--
2.33.0

View File

@ -13,10 +13,10 @@ Subject: [PATCH] optimite pcb-list limit , send size and ack now
6 files changed, 83 insertions(+), 43 deletions(-)
diff --git a/src/core/tcp.c b/src/core/tcp.c
index 51ada38..cb08f95 100644
index 699dda4..54d9ded 100644
--- a/src/core/tcp.c
+++ b/src/core/tcp.c
@@ -2297,6 +2297,7 @@ tcp_pcb_purge(struct tcp_pcb *pcb)
@@ -2303,6 +2303,7 @@ tcp_pcb_purge(struct tcp_pcb *pcb)
tcp_segs_free(pcb->unsent);
tcp_segs_free(pcb->unacked);
pcb->unacked = pcb->unsent = NULL;
@ -25,10 +25,10 @@ index 51ada38..cb08f95 100644
pcb->unsent_oversize = 0;
#endif /* TCP_OVERSIZE */
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index 2d6cb6a..78954bd 100644
index fa574ff..ef95238 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -976,8 +976,14 @@ tcp_process(struct tcp_pcb *pcb)
@@ -979,8 +979,14 @@ tcp_process(struct tcp_pcb *pcb)
rseg = pcb->unsent;
LWIP_ASSERT("no segment to free", rseg != NULL);
pcb->unsent = rseg->next;
@ -43,7 +43,7 @@ index 2d6cb6a..78954bd 100644
}
tcp_seg_free(rseg);
@@ -1393,6 +1399,8 @@ tcp_receive(struct tcp_pcb *pcb)
@@ -1389,6 +1395,8 @@ tcp_receive(struct tcp_pcb *pcb)
/* Remove segment from the unacknowledged list if the incoming
ACK acknowledges them. */
pcb->unacked = tcp_free_acked_segments(pcb, pcb->unacked, "unacked", pcb->unsent);
@ -52,7 +52,7 @@ index 2d6cb6a..78954bd 100644
/* We go through the ->unsent list to see if any of the segments
on the list are acknowledged by the ACK. This may seem
strange since an "unsent" segment shouldn't be acked. The
@@ -1400,6 +1408,8 @@ tcp_receive(struct tcp_pcb *pcb)
@@ -1396,6 +1404,8 @@ tcp_receive(struct tcp_pcb *pcb)
->unsent list after a retransmission, so these segments may
in fact have been sent once. */
pcb->unsent = tcp_free_acked_segments(pcb, pcb->unsent, "unsent", pcb->unacked);
@ -61,7 +61,7 @@ index 2d6cb6a..78954bd 100644
/* If there's nothing left to acknowledge, stop the retransmit
timer, otherwise reset it to start again */
@@ -1736,7 +1746,11 @@ tcp_receive(struct tcp_pcb *pcb)
@@ -1732,7 +1742,11 @@ tcp_receive(struct tcp_pcb *pcb)
/* Acknowledge the segment(s). */
@ -75,10 +75,10 @@ index 2d6cb6a..78954bd 100644
#if LWIP_TCP_SACK_OUT
if (LWIP_TCP_SACK_VALID(pcb, 0)) {
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
index f53750b..55053d8 100644
index b1d9f23..342f4aa 100644
--- a/src/core/tcp_out.c
+++ b/src/core/tcp_out.c
@@ -631,11 +631,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
@@ -634,11 +634,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
#endif /* TCP_OVERSIZE */
}
#else /* USE_LIBOS */
@ -91,7 +91,7 @@ index f53750b..55053d8 100644
#endif /* USE_LIBOS */
/*
@@ -851,6 +847,9 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
@@ -854,6 +850,9 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
* Finally update the pcb state.
*/
#if USE_LIBOS
@ -101,7 +101,7 @@ index f53750b..55053d8 100644
pcb->snd_lbb += pos;
pcb->snd_buf -= pos;
#else
@@ -1050,6 +1049,8 @@ tcp_split_unsent_seg(struct tcp_pcb *pcb, u16_t split)
@@ -1053,6 +1052,8 @@ tcp_split_unsent_seg(struct tcp_pcb *pcb, u16_t split)
/* Finally insert remainder into queue after split (which stays head) */
seg->next = useg->next;
useg->next = seg;
@ -110,7 +110,7 @@ index f53750b..55053d8 100644
#if TCP_OVERSIZE
/* If remainder is last segment on the unsent, ensure we clear the oversize amount
@@ -1086,9 +1087,7 @@ tcp_send_fin(struct tcp_pcb *pcb)
@@ -1089,9 +1090,7 @@ tcp_send_fin(struct tcp_pcb *pcb)
/* first, try to add the fin to the last unsent segment */
if (pcb->unsent != NULL) {
@ -121,7 +121,7 @@ index f53750b..55053d8 100644
if ((TCPH_FLAGS(last_unsent->tcphdr) & (TCP_SYN | TCP_FIN | TCP_RST)) == 0) {
/* no SYN/FIN/RST flag in the header, we can add the FIN flag */
@@ -1182,10 +1181,10 @@ tcp_enqueue_flags(struct tcp_pcb *pcb, u8_t flags)
@@ -1185,10 +1184,10 @@ tcp_enqueue_flags(struct tcp_pcb *pcb, u8_t flags)
if (pcb->unsent == NULL) {
pcb->unsent = seg;
} else {
@ -134,7 +134,7 @@ index f53750b..55053d8 100644
#if TCP_OVERSIZE
/* The new unsent tail has no space */
pcb->unsent_oversize = 0;
@@ -1314,6 +1313,7 @@ static struct tcp_seg *tcp_output_over(struct tcp_pcb *pcb, struct tcp_seg *seg,
@@ -1317,6 +1316,7 @@ static struct tcp_seg *tcp_output_over(struct tcp_pcb *pcb, struct tcp_seg *seg,
seg->next = NULL;
if (useg == NULL) {
pcb->unacked = seg;
@ -142,7 +142,7 @@ index f53750b..55053d8 100644
useg = seg;
} else {
if (TCP_SEQ_LT(lwip_ntohl(seg->tcphdr->seqno), lwip_ntohl(useg->tcphdr->seqno))) {
@@ -1329,6 +1329,7 @@ static struct tcp_seg *tcp_output_over(struct tcp_pcb *pcb, struct tcp_seg *seg,
@@ -1332,6 +1332,7 @@ static struct tcp_seg *tcp_output_over(struct tcp_pcb *pcb, struct tcp_seg *seg,
/* add segment to tail of unacked list */
useg->next = seg;
useg = seg;
@ -150,7 +150,7 @@ index f53750b..55053d8 100644
}
}
} else {
@@ -1460,15 +1461,14 @@ tcp_output(struct tcp_pcb *pcb)
@@ -1463,15 +1464,14 @@ tcp_output(struct tcp_pcb *pcb)
pcb->persist_backoff = 0;
/* useg should point to last segment on unacked queue */
@ -170,7 +170,7 @@ index f53750b..55053d8 100644
/**
* 1遍历unsent队列找到所有的待发送seg. 将seg的buf串起来
* 2) 生成新的seg, 调用tcp_output_segment, 新的seg释放掉
@@ -1510,6 +1510,7 @@ tcp_output(struct tcp_pcb *pcb)
@@ -1513,6 +1513,7 @@ tcp_output(struct tcp_pcb *pcb)
pre_pbuf->next = seg->p;
}
@ -178,7 +178,7 @@ index f53750b..55053d8 100644
pre_pbuf = seg->p;
next_seqno = seg_seqno + TCP_TCPLEN(seg);
seg = seg->next;
@@ -1519,8 +1520,11 @@ tcp_output(struct tcp_pcb *pcb)
@@ -1522,8 +1523,11 @@ tcp_output(struct tcp_pcb *pcb)
if (first_pbuf == NULL) {
err = tcp_output_seg(pcb, seg, netif, next_seqno + seg->len);
@ -191,7 +191,7 @@ index f53750b..55053d8 100644
pcb->unsent = seg->next;
useg = tcp_output_over(pcb, seg, useg);
seg = pcb->unsent;
@@ -1545,7 +1549,7 @@ tcp_output(struct tcp_pcb *pcb)
@@ -1548,7 +1552,7 @@ tcp_output(struct tcp_pcb *pcb)
} else
#endif
{
@ -200,7 +200,7 @@ index f53750b..55053d8 100644
lwip_ntohl(seg->tcphdr->seqno) - pcb->lastack + seg->len <= wnd) {
LWIP_ASSERT("RST not expected here!",
(TCPH_FLAGS(seg->tcphdr) & TCP_RST) == 0);
@@ -1560,6 +1564,7 @@ tcp_output(struct tcp_pcb *pcb)
@@ -1563,6 +1567,7 @@ tcp_output(struct tcp_pcb *pcb)
((pcb->flags & (TF_NAGLEMEMERR | TF_FIN)) == 0)) {
break;
}
@ -208,7 +208,7 @@ index f53750b..55053d8 100644
#if TCP_CWND_DEBUG
LWIP_DEBUGF(TCP_CWND_DEBUG, ("tcp_output: snd_wnd %"TCPWNDSIZE_F", cwnd %"TCPWNDSIZE_F", wnd %"U32_F", effwnd %"U32_F", seq %"U32_F", ack %"U32_F", i %"S16_F"\n",
pcb->snd_wnd, pcb->cwnd, wnd,
@@ -1577,6 +1582,8 @@ tcp_output(struct tcp_pcb *pcb)
@@ -1580,6 +1585,8 @@ tcp_output(struct tcp_pcb *pcb)
if (err != ERR_OK) {
/* segment could not be sent, for whatever reason */
tcp_set_flags(pcb, TF_NAGLEMEMERR);
@ -217,7 +217,7 @@ index f53750b..55053d8 100644
return err;
}
#if TCP_OVERSIZE_DBGCHECK
@@ -1596,6 +1603,7 @@ tcp_output(struct tcp_pcb *pcb)
@@ -1599,6 +1606,7 @@ tcp_output(struct tcp_pcb *pcb)
/* unacked list is empty? */
if (pcb->unacked == NULL) {
pcb->unacked = seg;
@ -225,7 +225,7 @@ index f53750b..55053d8 100644
useg = seg;
/* unacked list is not empty? */
} else {
@@ -1615,6 +1623,7 @@ tcp_output(struct tcp_pcb *pcb)
@@ -1618,6 +1626,7 @@ tcp_output(struct tcp_pcb *pcb)
/* add segment to tail of unacked list */
useg->next = seg;
useg = useg->next;
@ -233,7 +233,7 @@ index f53750b..55053d8 100644
}
}
/* do not queue empty segments on the unacked list */
@@ -1632,6 +1641,8 @@ tcp_output(struct tcp_pcb *pcb)
@@ -1635,6 +1644,8 @@ tcp_output(struct tcp_pcb *pcb)
#endif /* TCP_OVERSIZE */
output_done:
@ -242,7 +242,7 @@ index f53750b..55053d8 100644
tcp_clear_flags(pcb, TF_NAGLEMEMERR);
return ERR_OK;
}
@@ -1932,9 +1943,13 @@ tcp_rexmit_rto_prepare(struct tcp_pcb *pcb)
@@ -1935,9 +1946,13 @@ tcp_rexmit_rto_prepare(struct tcp_pcb *pcb)
}
#endif /* TCP_OVERSIZE_DBGCHECK */
/* unsent queue is the concatenated queue (of unacked, unsent) */
@ -256,7 +256,7 @@ index f53750b..55053d8 100644
/* Mark RTO in-progress */
tcp_set_flags(pcb, TF_RTO);
@@ -2004,32 +2019,42 @@ tcp_rexmit(struct tcp_pcb *pcb)
@@ -2007,32 +2022,42 @@ tcp_rexmit(struct tcp_pcb *pcb)
}
seg = pcb->unacked;
@ -320,8 +320,8 @@ index f53750b..55053d8 100644
if (pcb->nrtx < 0xFF) {
++pcb->nrtx;
}
@@ -2207,7 +2232,7 @@ tcp_output_control_segment(const struct tcp_pcb *pcb, struct pbuf *p,
struct tcp_hdr *tcphdr = (struct tcp_hdr *)p->payload;
@@ -2227,7 +2252,7 @@ tcp_output_control_segment_netif(const struct tcp_pcb *pcb, struct pbuf *p,
struct tcp_hdr *tcphdr = (struct tcp_hdr *)p->payload;
#if CHECKSUM_GEN_TCP_HW
if (get_eth_params_tx_ol() & DEV_TX_OFFLOAD_TCP_CKSUM) {
- tcph_cksum_set(p, TCP_HLEN);
@ -330,10 +330,10 @@ index f53750b..55053d8 100644
} else {
tcphdr->chksum = ip_chksum_pseudo(p, IP_PROTO_TCP, p->tot_len,
diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h
index 8294cdd..83e7e93 100644
index 570d2de..39fd224 100644
--- a/src/include/lwip/opt.h
+++ b/src/include/lwip/opt.h
@@ -1281,7 +1281,7 @@
@@ -1323,7 +1323,7 @@
* LWIP_TCP_SACK_OUT==1: TCP will support sending selective acknowledgements (SACKs).
*/
#if !defined LWIP_TCP_SACK_OUT || defined __DOXYGEN__
@ -343,7 +343,7 @@ index 8294cdd..83e7e93 100644
/**
diff --git a/src/include/lwip/tcp.h b/src/include/lwip/tcp.h
index b36bf33..b0ae02c 100644
index a19fb0e..9ebdbf2 100644
--- a/src/include/lwip/tcp.h
+++ b/src/include/lwip/tcp.h
@@ -356,7 +356,9 @@ struct tcp_pcb {

View File

@ -11,10 +11,10 @@ Subject: [PATCH] skip unnecessary tcp_route
4 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/src/core/tcp.c b/src/core/tcp.c
index 252f27f..abfcc00 100644
index 54d9ded..b2bee67 100644
--- a/src/core/tcp.c
+++ b/src/core/tcp.c
@@ -2294,6 +2294,7 @@ tcp_pcb_purge(struct tcp_pcb *pcb)
@@ -2304,6 +2304,7 @@ tcp_pcb_purge(struct tcp_pcb *pcb)
tcp_segs_free(pcb->unacked);
pcb->unacked = pcb->unsent = NULL;
pcb->last_unacked = pcb->last_unsent = NULL;
@ -23,10 +23,10 @@ index 252f27f..abfcc00 100644
pcb->unsent_oversize = 0;
#endif /* TCP_OVERSIZE */
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
index 25aeb23..1c5734b 100644
index e862f9e..99f8e66 100644
--- a/src/core/tcp_out.c
+++ b/src/core/tcp_out.c
@@ -1425,7 +1425,12 @@ tcp_output(struct tcp_pcb *pcb)
@@ -1428,7 +1428,12 @@ tcp_output(struct tcp_pcb *pcb)
lwip_ntohl(seg->tcphdr->seqno), pcb->lastack));
}
@ -40,7 +40,7 @@ index 25aeb23..1c5734b 100644
if (netif == NULL) {
return ERR_RTE;
}
@@ -2220,7 +2225,7 @@ tcp_output_fill_options(const struct tcp_pcb *pcb, struct pbuf *p, u8_t optflags
@@ -2223,14 +2228,21 @@ tcp_output_fill_options(const struct tcp_pcb *pcb, struct pbuf *p, u8_t optflags
* header checksum and calling ip_output_if while handling netif hints and stats.
*/
static err_t
@ -48,8 +48,7 @@ index 25aeb23..1c5734b 100644
+tcp_output_control_segment(struct tcp_pcb *pcb, struct pbuf *p,
const ip_addr_t *src, const ip_addr_t *dst)
{
err_t err;
@@ -2228,7 +2233,14 @@ tcp_output_control_segment(const struct tcp_pcb *pcb, struct pbuf *p,
struct netif *netif;
LWIP_ASSERT("tcp_output_control_segment: invalid pbuf", p != NULL);
@ -63,19 +62,10 @@ index 25aeb23..1c5734b 100644
+ netif = pcb->pcb_if;
+ }
if (netif == NULL) {
err = ERR_RTE;
} else {
@@ -2318,7 +2330,7 @@ tcp_rst(const struct tcp_pcb *pcb, u32_t seqno, u32_t ackno,
MIB2_STATS_INC(mib2.tcpoutrsts);
- tcp_output_control_segment(pcb, p, local_ip, remote_ip);
+ tcp_output_control_segment((struct tcp_pcb*)pcb, p, local_ip, remote_ip);
LWIP_DEBUGF(TCP_RST_DEBUG, ("tcp_rst: seqno %"U32_F" ackno %"U32_F".\n", seqno, ackno));
}
pbuf_free(p);
return ERR_RTE;
diff --git a/src/include/lwip/tcp.h b/src/include/lwip/tcp.h
index b0ae02c..2a61776 100644
index 9ebdbf2..07b7dc0 100644
--- a/src/include/lwip/tcp.h
+++ b/src/include/lwip/tcp.h
@@ -408,6 +408,7 @@ struct tcp_pcb {
@ -87,10 +77,10 @@ index b0ae02c..2a61776 100644
#if TCP_PCB_HASH
diff --git a/src/include/lwipsock.h b/src/include/lwipsock.h
index 62e5bf1..ec4d78c 100644
index bf0d753..3cf0062 100644
--- a/src/include/lwipsock.h
+++ b/src/include/lwipsock.h
@@ -111,6 +111,7 @@ struct lwip_sock {
@@ -110,6 +110,7 @@ struct lwip_sock {
/* stack thread all use */
struct list_node recv_list;
struct list_node send_list;

View File

@ -1,91 +0,0 @@
From 1aa27395a4c4b73b6db472c4ae75ed91637a11bf Mon Sep 17 00:00:00 2001
From: kircher <majun65@huawei.com>
Date: Wed, 21 Dec 2022 17:50:50 +0800
Subject: [PATCH] add dataack when recv too many acks with data
---
src/core/tcp_in.c | 22 ++++++++++++++++++++++
src/include/lwip/tcp.h | 1 +
src/include/lwipopts.h | 2 ++
3 files changed, 25 insertions(+)
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index 78954bd..35ec6d9 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -1260,6 +1260,7 @@ tcp_receive(struct tcp_pcb *pcb)
s16_t m;
u32_t right_wnd_edge;
int found_dupack = 0;
+ int found_dataack = 0;
LWIP_ASSERT("tcp_receive: invalid pcb", pcb != NULL);
LWIP_ASSERT("tcp_receive: wrong state", pcb->state >= ESTABLISHED);
@@ -1337,11 +1338,31 @@ tcp_receive(struct tcp_pcb *pcb)
}
}
}
+ /* fast rexmit when receive too many acks with data */
+ if (TCP_SEQ_LT(ackno + 1, pcb->snd_nxt)) {
+ if (pcb->snd_wl2 + pcb->snd_wnd == right_wnd_edge) {
+ if (pcb->rtime >= 0) {
+ if (pcb->lastack == ackno) {
+ found_dataack = 1;
+ ++pcb->dataacks;
+ if (pcb->dataacks > MAX_DATA_ACK_NUM) {
+ if (tcp_rexmit(pcb) == ERR_OK) {
+ pcb->rtime = 0;
+ pcb->dataacks = 0;
+ }
+ }
+ }
+ }
+ }
+ }
/* If Clause (1) or more is true, but not a duplicate ack, reset
* count of consecutive duplicate acks */
if (!found_dupack) {
pcb->dupacks = 0;
}
+ if (!found_dataack) {
+ pcb->dataacks = 0;
+ }
} else if (TCP_SEQ_BETWEEN(ackno, pcb->lastack + 1, pcb->snd_nxt)) {
/* We come here when the ACK acknowledges new data. */
tcpwnd_size_t acked;
@@ -1367,6 +1388,7 @@ tcp_receive(struct tcp_pcb *pcb)
/* Reset the fast retransmit variables. */
pcb->dupacks = 0;
pcb->lastack = ackno;
+ pcb->dataacks = 0;
/* Update the congestion control variables (cwnd and
ssthresh). */
diff --git a/src/include/lwip/tcp.h b/src/include/lwip/tcp.h
index 2a61776..97cb882 100644
--- a/src/include/lwip/tcp.h
+++ b/src/include/lwip/tcp.h
@@ -326,6 +326,7 @@ struct tcp_pcb {
/* fast retransmit/recovery */
u8_t dupacks;
+ u32_t dataacks;
u32_t lastack; /* Highest acknowledged seqno. */
/* congestion avoidance/control variables */
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
index 907c630..405cf11 100644
--- a/src/include/lwipopts.h
+++ b/src/include/lwipopts.h
@@ -177,6 +177,8 @@
#define MIN_TSO_SEG_LEN 256
+#define MAX_DATA_ACK_NUM 256
+
/* ---------------------------------------
* ------- NIC offloads --------
* ---------------------------------------
--
2.33.0

View File

@ -13,7 +13,7 @@ Subject: [PATCH] lwip reuse ip port
6 files changed, 104 insertions(+), 3 deletions(-)
diff --git a/src/core/tcp.c b/src/core/tcp.c
index f75d214..3171c5e 100644
index b2bee67..2cc1174 100644
--- a/src/core/tcp.c
+++ b/src/core/tcp.c
@@ -111,6 +111,7 @@
@ -85,10 +85,10 @@ index f75d214..3171c5e 100644
+ lpcb->master_lpcb = conn->is_master_fd;
+#endif
+
#if LWIP_IPV4 && LWIP_IPV6
IP_SET_TYPE_VAL(lpcb->remote_ip, pcb->local_ip.type);
#endif /* LWIP_IPV4 && LWIP_IPV6 */
@@ -979,7 +1005,15 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err)
#if LWIP_VLAN_PCP
lpcb->netif_hints.tci = pcb->netif_hints.tci;
#endif /* LWIP_VLAN_PCP */
@@ -982,7 +1008,15 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err)
lpcb->accepts_pending = 0;
tcp_backlog_set(lpcb, backlog);
#endif /* TCP_LISTEN_BACKLOG */
@ -106,7 +106,7 @@ index f75d214..3171c5e 100644
done:
if (err != NULL) {
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index 35ec6d9..9f5c34a 100644
index ef95238..77dd235 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -356,6 +356,9 @@ tcp_input(struct pbuf *p, struct netif *inp)
@ -121,7 +121,7 @@ index 35ec6d9..9f5c34a 100644
prev = NULL;
@@ -379,6 +382,30 @@ tcp_input(struct pbuf *p, struct netif *inp)
} else if (IP_ADDR_PCB_VERSION_MATCH_EXACT(lpcb, ip_current_dest_addr())) {
if (ip_addr_cmp(&lpcb->local_ip, ip_current_dest_addr())) {
if (ip_addr_eq(&lpcb->local_ip, ip_current_dest_addr())) {
/* found an exact match */
+#if REUSE_IPPORT
+ // check master fd
@ -164,7 +164,7 @@ index 35ec6d9..9f5c34a 100644
pbuf_free(p);
return;
diff --git a/src/include/lwip/api.h b/src/include/lwip/api.h
index 6dec8c0..430a7a0 100644
index 55fc413..d12312c 100644
--- a/src/include/lwip/api.h
+++ b/src/include/lwip/api.h
@@ -318,6 +318,10 @@ struct netconn {
@ -179,7 +179,7 @@ index 6dec8c0..430a7a0 100644
/** This vector type is passed to @ref netconn_write_vectors_partly to send
diff --git a/src/include/lwip/priv/tcp_priv.h b/src/include/lwip/priv/tcp_priv.h
index b242428..97f799e 100644
index 783acf5..02481da 100644
--- a/src/include/lwip/priv/tcp_priv.h
+++ b/src/include/lwip/priv/tcp_priv.h
@@ -353,6 +353,15 @@ static inline int vdev_reg_done(enum reg_ring_type reg_type, const struct tcp_pc
@ -216,7 +216,7 @@ index b242428..97f799e 100644
do { \
hlist_del_init(&(npcb)->tcp_node); \
diff --git a/src/include/lwip/tcp.h b/src/include/lwip/tcp.h
index 0b65b01..312320b 100644
index 9ebdbf2..c5e4654 100644
--- a/src/include/lwip/tcp.h
+++ b/src/include/lwip/tcp.h
@@ -252,6 +252,14 @@ struct tcp_pcb_listen {
@ -235,7 +235,7 @@ index 0b65b01..312320b 100644
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
index fedded9..be58ec3 100644
index 97e96ab..f8b3294 100644
--- a/src/include/lwipopts.h
+++ b/src/include/lwipopts.h
@@ -143,6 +143,10 @@

View File

@ -9,18 +9,18 @@ Subject: [PATCH] lwip_cnctl only support F_SETFL,F_GETFL, other opt return 0
1 file changed, 5 insertions(+)
diff --git a/src/api/sockets.c b/src/api/sockets.c
index 9b3f514..2cb6f22 100644
index 39376a5..e99bba7 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -4107,7 +4107,12 @@ lwip_fcntl(int s, int cmd, int val)
@@ -4149,7 +4149,12 @@ lwip_fcntl(int s, int cmd, int val)
break;
default:
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_fcntl(%d, UNIMPL: %d, %d)\n", s, cmd, val));
+#if USE_LIBOS
+ sock_set_errno(sock, 0); /* not yet implemented, but we return 0 for compatilbe with app */
+ sock_errno(sock, 0); /* not yet implemented, but we return 0 for compatilbe with app */
+ ret = 0;
+#else
sock_set_errno(sock, ENOSYS); /* not yet implemented */
set_errno(ENOSYS); /* not yet implemented */
+#endif
break;
}

File diff suppressed because it is too large Load Diff

View File

@ -9,10 +9,10 @@ Subject: [PATCH] fix tso small packet drop in kernel server
2 files changed, 130 insertions(+), 126 deletions(-)
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
index 8a0d653..b1c317d 100644
index 240148b..17e495d 100644
--- a/src/core/tcp_out.c
+++ b/src/core/tcp_out.c
@@ -1312,60 +1312,33 @@ tcp_build_wnd_scale_option(u32_t *opts)
@@ -1311,60 +1311,33 @@ tcp_build_wnd_scale_option(u32_t *opts)
#endif
#if GAZELLE_ENABLE
@ -100,7 +100,7 @@ index 8a0d653..b1c317d 100644
#endif
/**
* @ingroup tcp_raw
@@ -1471,97 +1444,127 @@ tcp_output(struct tcp_pcb *pcb)
@@ -1470,97 +1443,127 @@ tcp_output(struct tcp_pcb *pcb)
pcb->persist_backoff = 0;
/* useg should point to last segment on unacked queue */
@ -299,7 +299,7 @@ index 8a0d653..b1c317d 100644
lwip_ntohl(seg->tcphdr->seqno) - pcb->lastack + seg->len <= wnd) {
LWIP_ASSERT("RST not expected here!",
(TCPH_FLAGS(seg->tcphdr) & TCP_RST) == 0);
@@ -1576,7 +1579,6 @@ tcp_output(struct tcp_pcb *pcb)
@@ -1575,7 +1578,6 @@ tcp_output(struct tcp_pcb *pcb)
((pcb->flags & (TF_NAGLEMEMERR | TF_FIN)) == 0)) {
break;
}
@ -308,11 +308,11 @@ index 8a0d653..b1c317d 100644
LWIP_DEBUGF(TCP_CWND_DEBUG, ("tcp_output: snd_wnd %"TCPWNDSIZE_F", cwnd %"TCPWNDSIZE_F", wnd %"U32_F", effwnd %"U32_F", seq %"U32_F", ack %"U32_F", i %"S16_F"\n",
pcb->snd_wnd, pcb->cwnd, wnd,
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
index 742b4a9..0d2a6d9 100644
index 326edc1..9f8c923 100644
--- a/src/include/lwipopts.h
+++ b/src/include/lwipopts.h
@@ -55,6 +55,8 @@
@@ -54,6 +54,8 @@
#define GAZELLE_TCP_MAX_DATA_ACK_NUM 256
#define GAZELLE_TCP_MAX_PBUF_CHAIN_LEN 40
+#define GAZELLE_TCP_MIN_TSO_SEG_LEN 256

View File

@ -18,10 +18,10 @@ Subject: [PATCH] same node & gazellectl -a
11 files changed, 148 insertions(+), 3 deletions(-)
diff --git a/src/api/sockets.c b/src/api/sockets.c
index 356e345..7a5da26 100644
index 8ef89ab..7b5606f 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -605,6 +605,10 @@ alloc_socket(struct netconn *newconn, int accepted, int flags)
@@ -645,6 +645,10 @@ alloc_socket(struct netconn *newconn, int accepted, int flags)
* (unless it has been created by accept()). */
sockets[i].sendevent = (NETCONNTYPE_GROUP(newconn->type) == NETCONN_TCP ? (accepted != 0) : 1);
sockets[i].errevent = 0;
@ -32,7 +32,7 @@ index 356e345..7a5da26 100644
return i + LWIP_SOCKET_OFFSET;
} else {
lwip_close(i);
@@ -716,6 +720,11 @@ free_socket(struct lwip_sock *sock, int is_tcp)
@@ -756,6 +760,11 @@ free_socket(struct lwip_sock *sock, int is_tcp)
/* Protect socket array */
SYS_ARCH_PROTECT(lev);
@ -44,7 +44,7 @@ index 356e345..7a5da26 100644
freed = free_socket_locked(sock, is_tcp, &conn, &lastdata);
SYS_ARCH_UNPROTECT(lev);
/* don't use 'sock' after this line, as another task might have allocated it */
@@ -780,6 +789,18 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
@@ -819,6 +828,18 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
LWIP_ASSERT("invalid socket index", (newsock >= LWIP_SOCKET_OFFSET) && (newsock < NUM_SOCKETS + LWIP_SOCKET_OFFSET));
#endif /* GAZELLE_ENABLE */
nsock = &sockets[newsock - LWIP_SOCKET_OFFSET];
@ -64,7 +64,7 @@ index 356e345..7a5da26 100644
/* See event_callback: If data comes in right away after an accept, even
* though the server task might not have created a new socket yet.
diff --git a/src/core/ipv4/ip4_frag.c b/src/core/ipv4/ip4_frag.c
index f15b798..e01ea51 100644
index dadf395..b2462d2 100644
--- a/src/core/ipv4/ip4_frag.c
+++ b/src/core/ipv4/ip4_frag.c
@@ -729,6 +729,7 @@ ip_frag_free_pbuf_custom_ref(struct pbuf_custom_ref *p)
@ -94,10 +94,10 @@ index f15b798..e01ea51 100644
/* Add it to end of rambuf's chain, but using pbuf_cat, not pbuf_chain
* so that it is removed when pbuf_dechain is later called on rambuf.
diff --git a/src/core/netif.c b/src/core/netif.c
index 70392cb..86b74a0 100644
index ded3561..db3c718 100644
--- a/src/core/netif.c
+++ b/src/core/netif.c
@@ -1065,7 +1065,7 @@ netif_set_link_callback(struct netif *netif, netif_status_callback_fn link_callb
@@ -1101,7 +1101,7 @@ netif_set_link_callback(struct netif *netif, netif_status_callback_fn link_callb
}
#endif /* LWIP_NETIF_LINK_CALLBACK */
@ -106,7 +106,7 @@ index 70392cb..86b74a0 100644
/**
* @ingroup netif
* Send an IP packet to be received on the same netif (loopif-like).
@@ -1184,6 +1184,7 @@ netif_loop_output(struct netif *netif, struct pbuf *p)
@@ -1220,6 +1220,7 @@ netif_loop_output(struct netif *netif, struct pbuf *p)
return ERR_OK;
}
@ -114,7 +114,7 @@ index 70392cb..86b74a0 100644
#if LWIP_HAVE_LOOPIF
#if LWIP_IPV4
@@ -1205,7 +1206,7 @@ netif_loop_output_ipv6(struct netif *netif, struct pbuf *p, const ip6_addr_t *ad
@@ -1241,7 +1242,7 @@ netif_loop_output_ipv6(struct netif *netif, struct pbuf *p, const ip6_addr_t *ad
#endif /* LWIP_IPV6 */
#endif /* LWIP_HAVE_LOOPIF */
@ -123,7 +123,7 @@ index 70392cb..86b74a0 100644
/**
* Call netif_poll() in the main loop of your application. This is to prevent
* reentering non-reentrant functions like tcp_input(). Packets passed to
@@ -1277,6 +1278,7 @@ netif_poll(struct netif *netif)
@@ -1313,6 +1314,7 @@ netif_poll(struct netif *netif)
}
SYS_ARCH_UNPROTECT(lev);
}
@ -131,7 +131,7 @@ index 70392cb..86b74a0 100644
#if !LWIP_NETIF_LOOPBACK_MULTITHREADING
/**
@@ -1292,7 +1294,6 @@ netif_poll_all(void)
@@ -1328,7 +1330,6 @@ netif_poll_all(void)
}
}
#endif /* !LWIP_NETIF_LOOPBACK_MULTITHREADING */
@ -140,7 +140,7 @@ index 70392cb..86b74a0 100644
#if LWIP_NUM_NETIF_CLIENT_DATA > 0
/**
diff --git a/src/core/pbuf.c b/src/core/pbuf.c
index dd71519..2385e57 100644
index 112baeb..ab1edff 100644
--- a/src/core/pbuf.c
+++ b/src/core/pbuf.c
@@ -69,6 +69,7 @@
@ -159,7 +159,7 @@ index dd71519..2385e57 100644
}
/**
@@ -777,9 +779,13 @@ pbuf_free(struct pbuf *p)
@@ -779,9 +781,13 @@ pbuf_free(struct pbuf *p)
#if LWIP_SUPPORT_CUSTOM_PBUF
/* is this a custom pbuf? */
if ((p->flags & PBUF_FLAG_IS_CUSTOM) != 0) {
@ -174,7 +174,7 @@ index dd71519..2385e57 100644
#endif /* LWIP_SUPPORT_CUSTOM_PBUF */
{
diff --git a/src/core/tcp.c b/src/core/tcp.c
index 69a39f6..538a664 100644
index 9023dde..34e99df 100644
--- a/src/core/tcp.c
+++ b/src/core/tcp.c
@@ -116,6 +116,8 @@
@ -205,7 +205,7 @@ index 69a39f6..538a664 100644
vdev_unreg_done(pcb);
release_port(pcb->local_port);
#endif
@@ -996,6 +1010,15 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err)
@@ -999,6 +1013,15 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err)
/* pcb transfer to lpcb and reg into tcp_listen_pcbs. freeing pcb shouldn't release sock table in here.
* local_port=0 avoid to release sock table in tcp_free */
pcb->local_port = 0;
@ -221,7 +221,7 @@ index 69a39f6..538a664 100644
#endif
tcp_free(pcb);
#if LWIP_CALLBACK_API
@@ -1262,6 +1285,16 @@ tcp_connect(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port,
@@ -1265,6 +1288,16 @@ tcp_connect(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port,
#endif /* SO_REUSE */
}
@ -238,7 +238,7 @@ index 69a39f6..538a664 100644
iss = tcp_next_iss(pcb);
pcb->rcv_nxt = 0;
pcb->snd_nxt = iss;
@@ -2090,7 +2123,13 @@ tcp_alloc(u8_t prio)
@@ -2095,6 +2128,11 @@ tcp_alloc(u8_t prio)
pcb->keep_intvl = TCP_KEEPINTVL_DEFAULT;
pcb->keep_cnt = TCP_KEEPCNT_DEFAULT;
#endif /* LWIP_TCP_KEEPALIVE */
@ -247,13 +247,11 @@ index 69a39f6..538a664 100644
+ pcb->client_tx_ring = NULL;
+ pcb->free_ring = 0;
+#endif
pcb_tci_init(pcb);
}
+
return pcb;
}
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index dd83260..719cf04 100644
index 7126eed..a952903 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -42,6 +42,7 @@
@ -264,7 +262,7 @@ index dd83260..719cf04 100644
#if LWIP_TCP /* don't build if not configured for use in lwipopts.h */
@@ -806,6 +807,11 @@ tcp_listen_input(struct tcp_pcb_listen *pcb)
@@ -809,6 +810,11 @@ tcp_listen_input(struct tcp_pcb_listen *pcb)
#if GAZELLE_ENABLE
vdev_reg_done(REG_RING_TCP_CONNECT, npcb);
@ -277,10 +275,10 @@ index dd83260..719cf04 100644
/* Parse any options in the SYN. */
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
index 8100e18..b1c317d 100644
index 17e495d..7aad1b8 100644
--- a/src/core/tcp_out.c
+++ b/src/core/tcp_out.c
@@ -725,6 +725,10 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
@@ -728,6 +728,10 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
goto memerr;
}
@ -291,7 +289,7 @@ index 8100e18..b1c317d 100644
if ((seg = tcp_create_segment(pcb, p, 0, pcb->snd_lbb + pos, optflags)) == NULL) {
#if GAZELLE_ENABLE
if (pos > 0) {
@@ -1705,6 +1709,10 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
@@ -1708,6 +1712,10 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
int seg_chksum_was_swapped = 0;
#endif
@ -302,7 +300,7 @@ index 8100e18..b1c317d 100644
LWIP_ASSERT("tcp_output_segment: invalid seg", seg != NULL);
LWIP_ASSERT("tcp_output_segment: invalid pcb", pcb != NULL);
LWIP_ASSERT("tcp_output_segment: invalid netif", netif != NULL);
@@ -1899,6 +1907,8 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
@@ -1902,6 +1910,8 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
PERF_START(PERF_LAYER_IP, PERF_POINT_IP_SEND);
NETIF_SET_HINTS(netif, &(pcb->netif_hints));
@ -311,8 +309,8 @@ index 8100e18..b1c317d 100644
err = ip_output_if(seg->p, &pcb->local_ip, &pcb->remote_ip, pcb->ttl,
pcb->tos, IP_PROTO_TCP, netif);
NETIF_RESET_HINTS(netif);
@@ -2236,6 +2246,7 @@ tcp_output_control_segment(struct tcp_pcb *pcb, struct pbuf *p,
err_t err;
@@ -2238,6 +2248,7 @@ tcp_output_control_segment(struct tcp_pcb *pcb, struct pbuf *p,
{
struct netif *netif;
+ p->pcb = pcb;
@ -320,7 +318,7 @@ index 8100e18..b1c317d 100644
if (pcb == NULL || pcb->pcb_if == NULL) {
diff --git a/src/include/lwip/pbuf.h b/src/include/lwip/pbuf.h
index 6c4ca44..9321afc 100644
index ae8e5e7..46ff26a 100644
--- a/src/include/lwip/pbuf.h
+++ b/src/include/lwip/pbuf.h
@@ -235,6 +235,7 @@ struct pbuf {
@ -342,7 +340,7 @@ index 6c4ca44..9321afc 100644
#endif /* LWIP_SUPPORT_CUSTOM_PBUF */
diff --git a/src/include/lwip/tcp.h b/src/include/lwip/tcp.h
index b822f40..e13099c 100644
index edfdb68..f968441 100644
--- a/src/include/lwip/tcp.h
+++ b/src/include/lwip/tcp.h
@@ -260,6 +260,9 @@ struct tcp_pcb_listen {
@ -355,7 +353,7 @@ index b822f40..e13099c 100644
};
@@ -418,6 +421,13 @@ struct tcp_pcb {
@@ -417,6 +420,13 @@ struct tcp_pcb {
u8_t rcv_scale;
#endif
@ -370,10 +368,10 @@ index b822f40..e13099c 100644
};
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
index 414ead4..0d2a6d9 100644
index 9f8c923..5b6bf6e 100644
--- a/src/include/lwipopts.h
+++ b/src/include/lwipopts.h
@@ -235,4 +235,11 @@
@@ -227,4 +227,11 @@
#define SIOCSHIWAT 1

View File

@ -8,47 +8,11 @@ Subject: [PATCH] fix last_unsent/last_unacked
src/core/tcp_out.c | 18 +++++++++++++-----
2 files changed, 26 insertions(+), 17 deletions(-)
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index 719cf04..7e7d70a 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -1375,18 +1375,19 @@ tcp_receive(struct tcp_pcb *pcb)
}
}
}
- }
- /* fast rexmit when receive too many acks with data */
- if (TCP_SEQ_LT(ackno + 1, pcb->snd_nxt)) {
- if (pcb->snd_wl2 + pcb->snd_wnd == right_wnd_edge) {
- if (pcb->rtime >= 0) {
- if (pcb->lastack == ackno) {
- found_dataack = 1;
- ++pcb->dataacks;
- if (pcb->dataacks > GAZELLE_TCP_MAX_DATA_ACK_NUM) {
- if (tcp_rexmit(pcb) == ERR_OK) {
- pcb->rtime = 0;
- pcb->dataacks = 0;
+ } else {
+ /* fast rexmit when receive too many acks with data */
+ if (TCP_SEQ_LT(ackno + 1, pcb->snd_nxt)) {
+ if (pcb->snd_wl2 + pcb->snd_wnd == right_wnd_edge) {
+ if (pcb->rtime >= 0) {
+ if (pcb->lastack == ackno) {
+ found_dataack = 1;
+ ++pcb->dataacks;
+ if ((pcb->dataacks > GAZELLE_TCP_MAX_DATA_ACK_NUM) && (pcb->nrtx < (TCP_MAXRTX / 2))) {
+ if (tcp_rexmit(pcb) == ERR_OK) {
+ pcb->rtime = 0;
+ pcb->dataacks = 0;
+ }
}
}
}
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
index b1c317d..6250e6b 100644
index 7aad1b8..f6ec4f8 100644
--- a/src/core/tcp_out.c
+++ b/src/core/tcp_out.c
@@ -1444,10 +1444,7 @@ tcp_output(struct tcp_pcb *pcb)
@@ -1447,10 +1447,7 @@ tcp_output(struct tcp_pcb *pcb)
pcb->persist_backoff = 0;
/* useg should point to last segment on unacked queue */
@ -60,7 +24,7 @@ index b1c317d..6250e6b 100644
/* data available and window allows it to be sent? */
#if GAZELLE_ENABLE
@@ -1515,7 +1512,11 @@ tcp_output(struct tcp_pcb *pcb)
@@ -1518,7 +1515,11 @@ tcp_output(struct tcp_pcb *pcb)
return err;
}
@ -72,7 +36,7 @@ index b1c317d..6250e6b 100644
if (pcb->state != SYN_SENT) {
tcp_clear_flags(pcb, TF_ACK_DELAY | TF_ACK_NOW);
}
@@ -1535,6 +1536,7 @@ tcp_output(struct tcp_pcb *pcb)
@@ -1538,6 +1539,7 @@ tcp_output(struct tcp_pcb *pcb)
if (TCP_TCPLEN(tmp_seg) > 0) {
tmp_seg->next = NULL;
if (pcb->unacked == NULL) {
@ -80,7 +44,7 @@ index b1c317d..6250e6b 100644
pcb->unacked = tmp_seg;
useg = tmp_seg;
} else {
@@ -1550,6 +1552,9 @@ tcp_output(struct tcp_pcb *pcb)
@@ -1553,6 +1555,9 @@ tcp_output(struct tcp_pcb *pcb)
} else {
/* add segment to tail of unacked list */
useg->next = tmp_seg;
@ -90,7 +54,7 @@ index b1c317d..6250e6b 100644
useg = useg->next;
}
}
@@ -1603,6 +1608,9 @@ end_loop:
@@ -1606,6 +1611,9 @@ end_loop:
#if TCP_OVERSIZE_DBGCHECK
seg->oversize_left = 0;
#endif /* TCP_OVERSIZE_DBGCHECK */
@ -100,7 +64,7 @@ index b1c317d..6250e6b 100644
pcb->unsent = seg->next;
if (pcb->state != SYN_SENT) {
tcp_clear_flags(pcb, TF_ACK_DELAY | TF_ACK_NOW);
@@ -1709,7 +1717,7 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
@@ -1712,7 +1720,7 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
int seg_chksum_was_swapped = 0;
#endif

View File

@ -16,10 +16,10 @@ Subject: [PATCH] add udp multicast in support
9 files changed, 78 insertions(+), 8 deletions(-)
diff --git a/src/api/api_msg.c b/src/api/api_msg.c
index 1840c9d..0287c06 100644
index 5a2e689..98537b8 100644
--- a/src/api/api_msg.c
+++ b/src/api/api_msg.c
@@ -282,8 +282,13 @@ recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p,
@@ -285,8 +285,13 @@ recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p,
#if LWIP_SO_RCVBUF
SYS_ARCH_INC(conn->recv_avail, len);
#endif /* LWIP_SO_RCVBUF */
@ -34,7 +34,7 @@ index 1840c9d..0287c06 100644
}
#endif /* LWIP_UDP */
diff --git a/src/api/sockets.c b/src/api/sockets.c
index 7a5da26..a0f9d50 100644
index 7b5606f..bedb86b 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -54,6 +54,7 @@
@ -45,7 +45,7 @@ index 7a5da26..a0f9d50 100644
#if LWIP_CHECKSUM_ON_COPY
#include "lwip/inet_chksum.h"
#endif
@@ -1187,7 +1188,7 @@ lwip_recv_tcp_done:
@@ -1222,7 +1223,7 @@ lwip_recv_tcp_done:
#endif
/* Convert a netbuf's address data to struct sockaddr */
@ -54,7 +54,7 @@ index 7a5da26..a0f9d50 100644
lwip_sock_make_addr(struct netconn *conn, ip_addr_t *fromaddr, u16_t port,
struct sockaddr *from, socklen_t *fromlen)
{
@@ -1274,6 +1275,7 @@ lwip_recvfrom_udp_raw(struct lwip_sock *sock, int flags, struct msghdr *msg, u16
@@ -1307,6 +1308,7 @@ lwip_recvfrom_udp_raw(struct lwip_sock *sock, int flags, struct msghdr *msg, u16
apiflags = 0;
}
@ -62,7 +62,7 @@ index 7a5da26..a0f9d50 100644
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom_udp_raw[UDP/RAW]: top sock->lastdata=%p\n", (void *)sock->lastdata.netbuf));
/* Check if there is data left from the last recv operation. */
buf = sock->lastdata.netbuf;
@@ -1361,6 +1363,18 @@ lwip_recvfrom_udp_raw(struct lwip_sock *sock, int flags, struct msghdr *msg, u16
@@ -1394,6 +1396,18 @@ lwip_recvfrom_udp_raw(struct lwip_sock *sock, int flags, struct msghdr *msg, u16
sock->lastdata.netbuf = NULL;
netbuf_delete(buf);
}
@ -81,7 +81,7 @@ index 7a5da26..a0f9d50 100644
if (datagram_len) {
*datagram_len = buflen;
}
@@ -1409,6 +1423,7 @@ lwip_recvfrom(int s, void *mem, size_t len, int flags,
@@ -1451,6 +1465,7 @@ lwip_recvfrom(int s, void *mem, size_t len, int flags,
done_socket(sock);
return -1;
}
@ -89,7 +89,7 @@ index 7a5da26..a0f9d50 100644
ret = (ssize_t)LWIP_MIN(LWIP_MIN(len, datagram_len), SSIZE_MAX);
if (fromlen) {
*fromlen = msg.msg_namelen;
@@ -3956,6 +3971,10 @@ lwip_ioctl(int s, long cmd, ...)
@@ -3998,6 +4013,10 @@ lwip_ioctl(int s, long cmd, ...)
struct lwip_sock *sock = posix_api->get_socket(s);
u8_t val;
@ -113,7 +113,7 @@ index ebc01a5..57a9670 100644
$(eval $(call register_dir, core, $(SRC)))
diff --git a/src/core/udp.c b/src/core/udp.c
index a5f76b9..1398537 100644
index 24fc174..8a01c76 100644
--- a/src/core/udp.c
+++ b/src/core/udp.c
@@ -65,6 +65,12 @@
@ -207,7 +207,7 @@ index df2e2a5..e41644b 100644
const ip_addr_t *src, const ip_addr_t *dst)
{
diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h
index 0376f60..38c6e9b 100644
index 527f2d7..e61b3f1 100644
--- a/src/include/lwip/opt.h
+++ b/src/include/lwip/opt.h
@@ -133,6 +133,7 @@
@ -218,7 +218,7 @@ index 0376f60..38c6e9b 100644
#if !defined MEMCPY || defined __DOXYGEN__
#define MEMCPY(dst,src,len) memcpy(dst,src,len)
#endif
@@ -1083,7 +1084,7 @@
@@ -1123,7 +1124,7 @@
* LWIP_IGMP==1: Turn on IGMP module.
*/
#if !defined LWIP_IGMP || defined __DOXYGEN__
@ -227,7 +227,7 @@ index 0376f60..38c6e9b 100644
#endif
#if !LWIP_IPV4
#undef LWIP_IGMP
@@ -2030,7 +2031,7 @@
@@ -2092,7 +2093,7 @@
* LWIP_SO_RCVBUF==1: Enable SO_RCVBUF processing.
*/
#if !defined LWIP_SO_RCVBUF || defined __DOXYGEN__
@ -237,7 +237,7 @@ index 0376f60..38c6e9b 100644
/**
diff --git a/src/include/lwip/pbuf.h b/src/include/lwip/pbuf.h
index 9321afc..fb21134 100644
index 46ff26a..e08d4fa 100644
--- a/src/include/lwip/pbuf.h
+++ b/src/include/lwip/pbuf.h
@@ -40,6 +40,8 @@
@ -259,10 +259,10 @@ index 9321afc..fb21134 100644
/** In case the user needs to store data custom data on a pbuf */
diff --git a/src/include/lwip/sockets.h b/src/include/lwip/sockets.h
index 58acf0f..36a47eb 100644
index 8e41155..a7cec29 100644
--- a/src/include/lwip/sockets.h
+++ b/src/include/lwip/sockets.h
@@ -48,6 +48,7 @@
@@ -52,6 +52,7 @@
#include "lwip/err.h"
#include "lwip/inet.h"
#include "lwip/errno.h"
@ -270,7 +270,7 @@ index 58acf0f..36a47eb 100644
#include <string.h>
@@ -323,20 +324,31 @@ struct linger {
@@ -332,20 +333,31 @@ struct linger {
#if LWIP_MULTICAST_TX_OPTIONS
@ -302,7 +302,7 @@ index 58acf0f..36a47eb 100644
typedef struct ip_mreq {
struct in_addr imr_multiaddr; /* IP multicast address of group */
@@ -656,6 +668,7 @@ ssize_t lwip_sendto(int s, const void *dataptr, size_t size, int flags,
@@ -675,6 +687,7 @@ ssize_t lwip_sendto(int s, const void *dataptr, size_t size, int flags,
int lwip_socket(int domain, int type, int protocol);
ssize_t lwip_write(int s, const void *dataptr, size_t size);
ssize_t lwip_writev(int s, const struct iovec *iov, int iovcnt);
@ -310,7 +310,7 @@ index 58acf0f..36a47eb 100644
#if LWIP_SOCKET_SELECT
int lwip_select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset,
struct timeval *timeout);
@@ -667,6 +680,8 @@ int lwip_poll(struct pollfd *fds, nfds_t nfds, int timeout);
@@ -686,6 +699,8 @@ int lwip_poll(struct pollfd *fds, nfds_t nfds, int timeout);
#if GAZELLE_ENABLE
int lwip_ioctl(int s, long cmd, ...);
int lwip_fcntl(int s, int cmd, int val);
@ -320,18 +320,18 @@ index 58acf0f..36a47eb 100644
int lwip_ioctl(int s, long cmd, void *argp);
int lwip_fcntl(int s, int cmd, int val);
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
index 0d2a6d9..bcb0879 100644
index 5b6bf6e..abc3f15 100644
--- a/src/include/lwipopts.h
+++ b/src/include/lwipopts.h
@@ -175,7 +175,7 @@
@@ -169,7 +169,7 @@
---------- UDP options ----------
---------------------------------
*/
-#define LWIP_UDP 0
+#define LWIP_UDP 1
/*
---------------------------------
--
2.33.0

View File

@ -8,7 +8,7 @@ Subject: [PATCH] fix pbuf leak in udp connection
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/core/udp.c b/src/core/udp.c
index 1398537..9c3cdaa 100644
index 8a01c76..6261c86 100644
--- a/src/core/udp.c
+++ b/src/core/udp.c
@@ -933,8 +933,11 @@ udp_sendto_if_src_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *d

View File

@ -15,7 +15,7 @@ Subject: [PATCH] drop-netbuf-in-recv_udp-to-fix-mem-overflow
8 files changed, 52 insertions(+), 10 deletions(-)
diff --git a/src/api/api_lib.c b/src/api/api_lib.c
index ffa14d6..afdfc11 100644
index 4cdb965..b22b987 100644
--- a/src/api/api_lib.c
+++ b/src/api/api_lib.c
@@ -655,7 +655,11 @@ netconn_recv_data(struct netconn *conn, void **new_buf, u8_t apiflags)
@ -48,10 +48,18 @@ index ffa14d6..afdfc11 100644
* Receive data (in form of a netbuf) from a UDP or RAW netconn
*
diff --git a/src/api/api_msg.c b/src/api/api_msg.c
index 30929be..b82ebf2 100644
index 98537b8..35207cc 100644
--- a/src/api/api_msg.c
+++ b/src/api/api_msg.c
@@ -253,6 +253,14 @@ recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p,
@@ -227,7 +227,6 @@ recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p,
struct netbuf *buf;
struct netconn *conn;
u16_t len;
- err_t err;
#if LWIP_SO_RCVBUF
int recv_avail;
#endif /* LWIP_SO_RCVBUF */
@@ -255,6 +254,15 @@ recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p,
return;
}
@ -63,12 +71,13 @@ index 30929be..b82ebf2 100644
+ if (sys_mbox_trypost(&conn->recvmbox, p) != ERR_OK) {
+ return;
+#else /* GAZELLE_UDP_ENABLE */
+ err_t err;
buf = (struct netbuf *)memp_malloc(MEMP_NETBUF);
if (buf == NULL) {
pbuf_free(p);
@@ -277,17 +285,18 @@ recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p,
if (sys_mbox_trypost(&conn->recvmbox, buf) != ERR_OK) {
@@ -281,17 +289,18 @@ recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p,
netbuf_delete(buf);
LWIP_DEBUGF(API_MSG_DEBUG, ("recv_udp: sys_mbox_trypost failed, err=%d\n", err));
return;
+#endif /* GAZELLE_UDP_ENABLE */
} else {
@ -89,10 +98,10 @@ index 30929be..b82ebf2 100644
}
#endif /* LWIP_UDP */
diff --git a/src/api/sockets.c b/src/api/sockets.c
index dee9230..17691f7 100644
index bedb86b..a731453 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -1179,7 +1179,7 @@ lwip_recvfrom_udp_raw(struct lwip_sock *sock, int flags, struct msghdr *msg, u16
@@ -1308,7 +1308,7 @@ lwip_recvfrom_udp_raw(struct lwip_sock *sock, int flags, struct msghdr *msg, u16
apiflags = 0;
}
@ -101,7 +110,7 @@ index dee9230..17691f7 100644
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom_udp_raw[UDP/RAW]: top sock->lastdata=%p\n", (void *)sock->lastdata.netbuf));
/* Check if there is data left from the last recv operation. */
buf = sock->lastdata.netbuf;
@@ -1267,7 +1267,7 @@ lwip_recvfrom_udp_raw(struct lwip_sock *sock, int flags, struct msghdr *msg, u16
@@ -1396,7 +1396,7 @@ lwip_recvfrom_udp_raw(struct lwip_sock *sock, int flags, struct msghdr *msg, u16
sock->lastdata.netbuf = NULL;
netbuf_delete(buf);
}
@ -110,7 +119,7 @@ index dee9230..17691f7 100644
LWIP_UNUSED_ARG(copylen);
LWIP_UNUSED_ARG(buf);
LWIP_UNUSED_ARG(err);
@@ -1278,7 +1278,7 @@ lwip_recvfrom_udp_raw(struct lwip_sock *sock, int flags, struct msghdr *msg, u16
@@ -1407,7 +1407,7 @@ lwip_recvfrom_udp_raw(struct lwip_sock *sock, int flags, struct msghdr *msg, u16
return ERR_BUF;
}
@ -120,10 +129,10 @@ index dee9230..17691f7 100644
*datagram_len = buflen;
}
diff --git a/src/core/udp.c b/src/core/udp.c
index 170c911..1eb459d 100644
index 6261c86..5514295 100644
--- a/src/core/udp.c
+++ b/src/core/udp.c
@@ -599,6 +599,7 @@ udp_sendto_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip,
@@ -614,6 +614,7 @@ udp_sendto_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip,
UDP_STATS_INC(udp.rterr);
return ERR_RTE;
}
@ -131,7 +140,7 @@ index 170c911..1eb459d 100644
uint8_t apiflags = 0;
struct pbuf *udp_pbuf = write_lwip_data((struct lwip_sock *)(p->payload), p->tot_len, &apiflags);
@@ -611,14 +612,21 @@ udp_sendto_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip,
@@ -626,14 +627,21 @@ udp_sendto_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip,
}
if (p->port) {
@ -154,10 +163,10 @@ index 170c911..1eb459d 100644
/**
diff --git a/src/include/lwip/api.h b/src/include/lwip/api.h
index d3c4f02..6090cab 100644
index 6bf8b6a..6e6e52d 100644
--- a/src/include/lwip/api.h
+++ b/src/include/lwip/api.h
@@ -338,6 +338,9 @@ err_t netconn_accept(struct netconn *conn, struct netconn **new_conn);
@@ -373,6 +373,9 @@ err_t netconn_accept(struct netconn *conn, struct netconn **new_conn);
err_t netconn_recv(struct netconn *conn, struct netbuf **new_buf);
err_t netconn_recv_udp_raw_netbuf(struct netconn *conn, struct netbuf **new_buf);
err_t netconn_recv_udp_raw_netbuf_flags(struct netconn *conn, struct netbuf **new_buf, u8_t apiflags);
@ -168,7 +177,7 @@ index d3c4f02..6090cab 100644
err_t netconn_recv_tcp_pbuf_flags(struct netconn *conn, struct pbuf **new_buf, u8_t apiflags);
err_t netconn_tcp_recvd(struct netconn *conn, size_t len);
diff --git a/src/include/lwip/pbuf.h b/src/include/lwip/pbuf.h
index 728c5e4..4747f39 100644
index e08d4fa..9ce3500 100644
--- a/src/include/lwip/pbuf.h
+++ b/src/include/lwip/pbuf.h
@@ -40,8 +40,10 @@
@ -194,10 +203,10 @@ index 728c5e4..4747f39 100644
/** In case the user needs to store data custom data on a pbuf */
diff --git a/src/include/lwip/sockets.h b/src/include/lwip/sockets.h
index 643093a..2b6e6be 100644
index a7cec29..a50c691 100644
--- a/src/include/lwip/sockets.h
+++ b/src/include/lwip/sockets.h
@@ -330,7 +330,7 @@ struct linger {
@@ -333,7 +333,7 @@ struct linger {
#if LWIP_MULTICAST_TX_OPTIONS
@ -206,7 +215,7 @@ index 643093a..2b6e6be 100644
#define IP_MULTICAST_IF 32
#define IP_MULTICAST_TTL 33
#define IP_MULTICAST_LOOP 34
@@ -341,11 +341,11 @@ struct linger {
@@ -344,11 +344,11 @@ struct linger {
#define IP_MULTICAST_TTL 5
#define IP_MULTICAST_IF 6
#define IP_MULTICAST_LOOP 7
@ -220,7 +229,7 @@ index 643093a..2b6e6be 100644
#define IP_ADD_MEMBERSHIP 35
#define IP_DROP_MEMBERSHIP 36
#else
@@ -354,7 +354,7 @@ struct linger {
@@ -357,7 +357,7 @@ struct linger {
*/
#define IP_ADD_MEMBERSHIP 3
#define IP_DROP_MEMBERSHIP 4
@ -230,10 +239,10 @@ index 643093a..2b6e6be 100644
typedef struct ip_mreq {
struct in_addr imr_multiaddr; /* IP multicast address of group */
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
index 6b5a2d1..9804aed 100644
index abc3f15..50220e8 100644
--- a/src/include/lwipopts.h
+++ b/src/include/lwipopts.h
@@ -63,6 +63,10 @@
@@ -56,6 +56,10 @@
#define GAZELLE_TCP_MIN_TSO_SEG_LEN 256

View File

@ -9,10 +9,10 @@ Signed-off-by: Lemmy Huang <huangliming5@huawei.com>
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index 7e7d70ab..0abee303 100644
index a952903..59e854c 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -1807,11 +1807,7 @@ tcp_receive(struct tcp_pcb *pcb)
@@ -1780,11 +1780,7 @@ tcp_receive(struct tcp_pcb *pcb)
/* Acknowledge the segment(s). */

View File

@ -8,17 +8,17 @@ Subject: [PATCH] fix udp recvmbox size not set
1 file changed, 1 insertion(+)
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
index 6b5c769..f0df0e3 100644
index 50220e8..1c27051 100644
--- a/src/include/lwipopts.h
+++ b/src/include/lwipopts.h
@@ -180,6 +180,7 @@
@@ -174,6 +174,7 @@
---------------------------------
*/
#define LWIP_UDP 1
+#define DEFAULT_UDP_RECVMBOX_SIZE 4096
/*
---------------------------------
--
2.23.0

View File

@ -8,7 +8,7 @@ Subject: [PATCH] fix null pointer when all zero address listen
1 file changed, 35 insertions(+), 23 deletions(-)
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index 0abee30..c20c9b5 100644
index 59e854c..d151a96 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -114,6 +114,36 @@ static void tcp_remove_sacks_gt(struct tcp_pcb *pcb, u32_t seq);
@ -49,7 +49,7 @@ index 0abee30..c20c9b5 100644
* The initial input processing of TCP. It verifies the TCP header, demultiplexes
* the segment between the PCBs and passes it on to tcp_process(), which implements
@@ -384,33 +414,15 @@ tcp_input(struct pbuf *p, struct netif *inp)
if (ip_addr_cmp(&lpcb->local_ip, ip_current_dest_addr())) {
if (ip_addr_eq(&lpcb->local_ip, ip_current_dest_addr())) {
/* found an exact match */
#if GAZELLE_TCP_REUSE_IPPORT
- // check master fd

View File

@ -21,10 +21,10 @@ index b48c926..2c5b31e 100644
static inline u16_t ip_chksum_pseudo_offload(u8_t proto, u16_t proto_len,
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
index f0df0e3..2ba1e4c 100644
index 1c27051..f44b541 100644
--- a/src/include/lwipopts.h
+++ b/src/include/lwipopts.h
@@ -180,6 +180,12 @@
@@ -174,6 +174,12 @@
---------------------------------
*/
#define LWIP_UDP 1
@ -36,7 +36,7 @@ index f0df0e3..2ba1e4c 100644
+
#define DEFAULT_UDP_RECVMBOX_SIZE 4096
/*
--
2.33.0

View File

@ -12,7 +12,7 @@ Subject: [PATCH] add CHECKSUM_UDP when not support OFFLOAD_UDP_CHECKSUM
5 files changed, 43 insertions(+), 10 deletions(-)
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index 62a6511..5014a21 100644
index d151a96..c906082 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -210,7 +210,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
@ -25,7 +25,7 @@ index 62a6511..5014a21 100644
ret = (u64_t)ip_chksum_pseudo(p, IP_PROTO_TCP, p->tot_len,
ip_current_src_addr(), ip_current_dest_addr());
diff --git a/src/core/udp.c b/src/core/udp.c
index 0b1fa65..d9db535 100644
index 59e157d..06e21aa 100644
--- a/src/core/udp.c
+++ b/src/core/udp.c
@@ -412,9 +412,21 @@ udp_input(struct pbuf *p, struct netif *inp)
@ -81,7 +81,7 @@ index 0b1fa65..d9db535 100644
NETIF_RESET_HINTS(netif);
diff --git a/src/include/dpdk_cksum.h b/src/include/dpdk_cksum.h
index 2c5b31e..d092a1d 100644
index 2c5b31e..5b1b6f6 100644
--- a/src/include/dpdk_cksum.h
+++ b/src/include/dpdk_cksum.h
@@ -54,12 +54,12 @@ static inline u64_t is_cksum_ipbad(struct pbuf *p) {
@ -147,10 +147,10 @@ index 43b254a..c90ddb8 100644
#endif /* DPDK_VERSION_1911 */
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
index 2ba1e4c..5ba123f 100644
index f44b541..d2ad30b 100644
--- a/src/include/lwipopts.h
+++ b/src/include/lwipopts.h
@@ -71,18 +71,22 @@
@@ -70,18 +70,22 @@
// rx cksum
#define CHECKSUM_CHECK_IP 1 /* master switch */
#define CHECKSUM_CHECK_TCP 1 /* master switch */
@ -173,8 +173,8 @@ index 2ba1e4c..5ba123f 100644
-#define CHECKSUM_OFFLOAD_ALL (CHECKSUM_GEN_IP_HW || CHECKSUM_GEN_TCP_HW || CHECKSUM_CHECK_IP_HW || CHECKSUM_CHECK_TCP_HW)
+#define CHECKSUM_OFFLOAD_ALL (CHECKSUM_GEN_IP_HW || CHECKSUM_GEN_TCP_HW || CHECKSUM_CHECK_IP_HW || CHECKSUM_CHECK_TCP_HW || CHECKSUM_CHECK_UDP_HW || CHECKSUM_GEN_UDP_HW)
/*
---------------------------------------
--
2.28.0.windows.1

View File

@ -1,8 +1,17 @@
From 28922406bbe13f9442a16e4b1ccc19f42e8ebb9b Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Mon, 5 Feb 2024 17:26:46 +0800
Subject: add O_NONBLOCK and FIONBIO when not defined
---
src/include/lwipopts.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
index 5ba123f..baf739e 100644
index d2ad30b..fbdcbf4 100644
--- a/src/include/lwipopts.h
+++ b/src/include/lwipopts.h
@@ -244,9 +244,13 @@
@@ -236,9 +236,13 @@
#define SO_REUSE 1
@ -16,3 +25,6 @@ index 5ba123f..baf739e 100644
#define SIOCSHIWAT 1
--
2.33.0

View File

@ -16,7 +16,7 @@ Subject: [PATCH] gazelle offloads are registered to lwip
9 files changed, 52 insertions(+), 14 deletions(-)
diff --git a/src/core/ipv4/icmp.c b/src/core/ipv4/icmp.c
index 402ba69..c3a877c 100644
index 0a3b1c3..2984d24 100644
--- a/src/core/ipv4/icmp.c
+++ b/src/core/ipv4/icmp.c
@@ -241,7 +241,7 @@ icmp_input(struct pbuf *p, struct netif *inp)
@ -29,10 +29,10 @@ index 402ba69..c3a877c 100644
} else {
iph_cksum_set(p, hlen, 0);
diff --git a/src/core/ipv4/ip4.c b/src/core/ipv4/ip4.c
index 1b70bb5..1e3690f 100644
index 42f4bd5..4335423 100644
--- a/src/core/ipv4/ip4.c
+++ b/src/core/ipv4/ip4.c
@@ -509,7 +509,7 @@ ip4_input(struct pbuf *p, struct netif *inp)
@@ -543,7 +543,7 @@ ip4_input(struct pbuf *p, struct netif *inp)
IF__NETIF_CHECKSUM_ENABLED(inp, NETIF_CHECKSUM_CHECK_IP) {
#if CHECKSUM_CHECK_IP_HW
u64_t ret;
@ -41,7 +41,7 @@ index 1b70bb5..1e3690f 100644
ret = is_cksum_ipbad(p);
} else {
ret = (u64_t)inet_chksum(iphdr, iphdr_hlen);
@@ -986,7 +986,7 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d
@@ -1020,7 +1020,7 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d
#if CHECKSUM_GEN_IP
IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_IP) {
#if CHECKSUM_GEN_IP_HW
@ -50,7 +50,7 @@ index 1b70bb5..1e3690f 100644
iph_cksum_set(p, ip_hlen, 1);
} else {
iph_cksum_set(p, ip_hlen, 0);
@@ -1035,7 +1035,7 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d
@@ -1069,7 +1069,7 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d
#if IP_FRAG
/* don't fragment if interface has mtu set to 0 [loopif] */
#if GAZELLE_ENABLE
@ -60,7 +60,7 @@ index 1b70bb5..1e3690f 100644
if (netif->mtu && (p->tot_len > netif->mtu)) {
return ip4_frag(p, netif, dest);
diff --git a/src/core/ipv4/ip4_frag.c b/src/core/ipv4/ip4_frag.c
index e01ea51..f63a99e 100644
index b2462d2..b594f29 100644
--- a/src/core/ipv4/ip4_frag.c
+++ b/src/core/ipv4/ip4_frag.c
@@ -642,7 +642,7 @@ ip4_reass(struct pbuf *p)
@ -82,10 +82,10 @@ index e01ea51..f63a99e 100644
} else {
iph_cksum_set(p, IP_HLEN, 0);
diff --git a/src/core/netif.c b/src/core/netif.c
index 86b74a0..eb59fbc 100644
index db3c718..8a1ccec 100644
--- a/src/core/netif.c
+++ b/src/core/netif.c
@@ -1049,6 +1049,26 @@ netif_set_link_down(struct netif *netif)
@@ -1085,6 +1085,26 @@ netif_set_link_down(struct netif *netif)
}
}
@ -113,7 +113,7 @@ index 86b74a0..eb59fbc 100644
/**
* @ingroup netif
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index 736845c..07203e5 100644
index c906082..dcfb2b5 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -209,7 +209,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
@ -126,10 +126,10 @@ index 736845c..07203e5 100644
} else {
ret = (u64_t)ip_chksum_pseudo(p, IP_PROTO_TCP, p->tot_len,
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
index 547d01e..e2c9d63 100644
index 65511ac..4bf3bfd 100644
--- a/src/core/tcp_out.c
+++ b/src/core/tcp_out.c
@@ -1448,7 +1448,7 @@ tcp_output(struct tcp_pcb *pcb)
@@ -1451,7 +1451,7 @@ tcp_output(struct tcp_pcb *pcb)
/* data available and window allows it to be sent? */
#if GAZELLE_ENABLE
@ -138,7 +138,7 @@ index 547d01e..e2c9d63 100644
uint16_t send_pkt = 0;
do {
@@ -1831,7 +1831,7 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
@@ -1834,7 +1834,7 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
#if CHECKSUM_GEN_TCP
IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_TCP) {
#if CHECKSUM_GEN_TCP_HW
@ -147,9 +147,9 @@ index 547d01e..e2c9d63 100644
tcph_cksum_set(seg->p, TCPH_HDRLEN_BYTES(seg->tcphdr));
seg->tcphdr->chksum = ip_chksum_pseudo_offload(IP_PROTO_TCP,seg->p->tot_len, &pcb->local_ip, &pcb->remote_ip);
} else {
@@ -2273,7 +2273,7 @@ tcp_output_control_segment(struct tcp_pcb *pcb, struct pbuf *p,
IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_TCP) {
struct tcp_hdr *tcphdr = (struct tcp_hdr *)p->payload;
@@ -2293,7 +2293,7 @@ tcp_output_control_segment_netif(const struct tcp_pcb *pcb, struct pbuf *p,
IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_TCP) {
struct tcp_hdr *tcphdr = (struct tcp_hdr *)p->payload;
#if CHECKSUM_GEN_TCP_HW
- if (get_eth_params_tx_ol() & DEV_TX_OFFLOAD_TCP_CKSUM) {
+ if (netif_get_txol_flags(netif) & DEV_TX_OFFLOAD_TCP_CKSUM) {
@ -157,7 +157,7 @@ index 547d01e..e2c9d63 100644
tcphdr->chksum = ip_chksum_pseudo_offload(IP_PROTO_TCP, p->tot_len, src, dst);
} else {
diff --git a/src/core/udp.c b/src/core/udp.c
index 5c6dadb..937a045 100644
index bac011a..ff20ced 100644
--- a/src/core/udp.c
+++ b/src/core/udp.c
@@ -414,7 +414,7 @@ udp_input(struct pbuf *p, struct netif *inp)
@ -192,7 +192,7 @@ index 5b1b6f6..b8056f9 100644
// for ip4_input
static inline u64_t is_cksum_ipbad(struct pbuf *p) {
diff --git a/src/include/lwip/netif.h b/src/include/lwip/netif.h
index 057c51f..75f8d50 100644
index 1e6dc46..502a151 100644
--- a/src/include/lwip/netif.h
+++ b/src/include/lwip/netif.h
@@ -106,6 +106,11 @@ extern "C" {
@ -207,7 +207,7 @@ index 057c51f..75f8d50 100644
/**
* @}
*/
@@ -343,6 +348,10 @@ struct netif {
@@ -352,6 +357,10 @@ struct netif {
u8_t hwaddr_len;
/** flags (@see @ref netif_flags) */
u8_t flags;
@ -217,8 +217,8 @@ index 057c51f..75f8d50 100644
+#endif
/** descriptive abbreviation */
char name[2];
/** number of this interface. Used for @ref if_api and @ref netifapi_netif,
@@ -464,6 +473,17 @@ void netif_set_down(struct netif *netif);
/** number of this interface. Used for @ref if_api and @ref netifapi_netif,
@@ -478,6 +487,17 @@ void netif_set_down(struct netif *netif);
*/
#define netif_is_up(netif) (((netif)->flags & NETIF_FLAG_UP) ? (u8_t)1 : (u8_t)0)

View File

@ -15,10 +15,10 @@ Subject: [PATCH] adapt read/write for rtc mode
8 files changed, 174 insertions(+), 53 deletions(-)
diff --git a/src/api/api_msg.c b/src/api/api_msg.c
index 3e982ab..d8b99ee 100644
index 0f26119..2556901 100644
--- a/src/api/api_msg.c
+++ b/src/api/api_msg.c
@@ -1753,11 +1753,15 @@ lwip_netconn_do_writemore(struct netconn *conn WRITE_DELAYED_PARAM)
@@ -1754,11 +1754,15 @@ lwip_netconn_do_writemore(struct netconn *conn WRITE_DELAYED_PARAM)
write_more = 0;
}
#if GAZELLE_ENABLE
@ -40,10 +40,10 @@ index 3e982ab..d8b99ee 100644
#else
err = tcp_write(conn->pcb.tcp, dataptr, len, apiflags);
diff --git a/src/api/sockets.c b/src/api/sockets.c
index 8d573aa..e374f96 100644
index 833b27f..a07fb59 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -1087,7 +1087,15 @@ lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags)
@@ -1124,7 +1124,15 @@ lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags)
apiflags |= NETCONN_DONTBLOCK;
}
@ -60,11 +60,10 @@ index 8d573aa..e374f96 100644
do {
struct pbuf *p;
err_t err;
@@ -1166,15 +1174,10 @@ lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags)
@@ -1203,14 +1211,10 @@ lwip_recv_tcp(struct lwip_sock *sock, void *mem, size_t len, int flags)
apiflags |= NETCONN_DONTBLOCK | NETCONN_NOFIN;
/* @todo: do we need to support peeking more than one pbuf? */
} while ((recv_left > 0) && !(flags & MSG_PEEK));
-
-lwip_recv_tcp_done:
-#else /* GAZELLE_ENABLE */
- LWIP_UNUSED_ARG(recv_left);
@ -73,19 +72,18 @@ index 8d573aa..e374f96 100644
- return recvd;
+#if GAZELLE_ENABLE
}
-#endif /* GAZELLE_ENABLE */
+#endif
#endif /* GAZELLE_ENABLE */
+lwip_recv_tcp_done:
if (apiflags & NETCONN_NOAUTORCVD) {
if ((recvd > 0) && !(flags & MSG_PEEK)) {
/* ensure window update after copying all data */
diff --git a/src/core/init.c b/src/core/init.c
index 7b6214f..60e1c68 100644
index 6841857..5b60ed8 100644
--- a/src/core/init.c
+++ b/src/core/init.c
@@ -306,7 +306,7 @@ PACK_STRUCT_END
#if TCP_SNDLOWAT >= TCP_SND_BUF
#error "lwip_sanity_check: WARNING: TCP_SNDLOWAT must be less than TCP_SND_BUF. If you know what you are doing, define LWIP_DISABLE_TCP_SANITY_CHECKS to 1 to disable this error."
@@ -312,7 +312,7 @@ PACK_STRUCT_END
#if TCP_MSS >= ((16 * 1024) - 1)
#error "lwip_sanity_check: WARNING: TCP_MSS must be <= 16382 to prevent u16_t underflow in TCP_SNDLOWAT calculation!"
#endif
-#if TCP_SNDLOWAT >= (0xFFFFFFFF - (4 * TCP_MSS))
+#if TCP_SNDLOWAT >= (0xFFFF - (4 * TCP_MSS))
@ -93,7 +91,7 @@ index 7b6214f..60e1c68 100644
#endif
#if TCP_SNDQUEUELOWAT >= TCP_SND_QUEUELEN
diff --git a/src/core/pbuf.c b/src/core/pbuf.c
index 975e240..61690ff 100644
index 3c04281..8386c90 100644
--- a/src/core/pbuf.c
+++ b/src/core/pbuf.c
@@ -117,6 +117,7 @@ pbuf_skip_const(const struct pbuf *in, u16_t in_offset, u16_t *out_offset);
@ -132,10 +130,10 @@ index 975e240..61690ff 100644
}
case PBUF_RAM: {
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
index e2c9d63..073d989 100644
index 4bf3bfd..4e7aac0 100644
--- a/src/core/tcp_out.c
+++ b/src/core/tcp_out.c
@@ -515,15 +515,18 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
@@ -518,15 +518,18 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
* pos records progress as data is segmented.
*/
@ -155,7 +153,7 @@ index e2c9d63..073d989 100644
/* Usable space at the end of the last unsent segment */
unsent_optlen = LWIP_TCP_OPT_LENGTH_SEGMENT(last_unsent->flags, pcb);
@@ -631,9 +634,6 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
@@ -634,9 +637,6 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
pcb->unsent_oversize == 0);
#endif /* TCP_OVERSIZE */
}
@ -165,7 +163,7 @@ index e2c9d63..073d989 100644
/*
* Phase 3: Create new segments.
@@ -651,7 +651,6 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
@@ -654,7 +654,6 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
u8_t chksum_swapped = 0;
#endif /* TCP_CHECKSUM_ON_COPY */
@ -173,7 +171,7 @@ index e2c9d63..073d989 100644
if (apiflags & TCP_WRITE_FLAG_COPY) {
/* If copy is set, memory should be allocated and data copied
* into pbuf */
@@ -698,13 +697,6 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
@@ -701,13 +700,6 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
/* Concatenate the headers and data pbufs together. */
pbuf_cat(p/*header*/, p2/*data*/);
}
@ -187,7 +185,7 @@ index e2c9d63..073d989 100644
queuelen += pbuf_clen(p);
@@ -714,14 +706,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
@@ -717,14 +709,7 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
if (queuelen > LWIP_MIN(TCP_SND_QUEUELEN, TCP_SNDQUEUELEN_OVERFLOW)) {
LWIP_DEBUGF(TCP_OUTPUT_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("tcp_write: queue too long %"U16_F" (%d)\n",
queuelen, (int)TCP_SND_QUEUELEN));
@ -202,7 +200,7 @@ index e2c9d63..073d989 100644
goto memerr;
}
@@ -730,12 +715,6 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
@@ -733,12 +718,6 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
#endif
if ((seg = tcp_create_segment(pcb, p, 0, pcb->snd_lbb + pos, optflags)) == NULL) {
@ -215,7 +213,7 @@ index e2c9d63..073d989 100644
goto memerr;
}
#if TCP_OVERSIZE_DBGCHECK
@@ -763,9 +742,6 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
@@ -766,9 +745,6 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
lwip_ntohl(seg->tcphdr->seqno) + TCP_TCPLEN(seg)));
pos += seglen;
@ -225,7 +223,7 @@ index e2c9d63..073d989 100644
}
/*
@@ -855,12 +831,9 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
@@ -858,12 +834,9 @@ tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
if (queue) {
pcb->last_unsent = prev_seg;
}
@ -239,7 +237,7 @@ index e2c9d63..073d989 100644
pcb->snd_queuelen = queuelen;
LWIP_DEBUGF(TCP_QLEN_DEBUG, ("tcp_write: %"S16_F" (after enqueued)\n",
@@ -880,14 +853,12 @@ memerr:
@@ -883,14 +856,12 @@ memerr:
tcp_set_flags(pcb, TF_NAGLEMEMERR);
TCP_STATS_INC(tcp.memerr);
@ -254,7 +252,7 @@ index e2c9d63..073d989 100644
if (pcb->snd_queuelen != 0) {
LWIP_ASSERT("tcp_write: valid queue length", pcb->unacked != NULL ||
pcb->unsent != NULL);
@@ -896,6 +867,137 @@ memerr:
@@ -899,6 +870,137 @@ memerr:
return ERR_MEM;
}
@ -392,7 +390,7 @@ index e2c9d63..073d989 100644
/**
* Split segment on the head of the unsent queue. If return is not
* ERR_OK, existing head remains intact
@@ -2095,6 +2197,7 @@ tcp_rexmit(struct tcp_pcb *pcb)
@@ -2098,6 +2200,7 @@ tcp_rexmit(struct tcp_pcb *pcb)
/* Don't take any rtt measurements after retransmitting. */
pcb->rttest = 0;
@ -401,7 +399,7 @@ index e2c9d63..073d989 100644
/* Do the actual retransmission. */
MIB2_STATS_INC(mib2.tcpretranssegs);
diff --git a/src/core/udp.c b/src/core/udp.c
index 937a045..828a489 100644
index ff20ced..f38619b 100644
--- a/src/core/udp.c
+++ b/src/core/udp.c
@@ -414,7 +414,7 @@ udp_input(struct pbuf *p, struct netif *inp)
@ -414,10 +412,10 @@ index 937a045..828a489 100644
} else {
ret = ip_chksum_pseudo(p, IP_PROTO_UDP, p->tot_len,
diff --git a/src/include/lwip/tcp.h b/src/include/lwip/tcp.h
index e13099c..959df3e 100644
index f968441..460df21 100644
--- a/src/include/lwip/tcp.h
+++ b/src/include/lwip/tcp.h
@@ -567,6 +567,10 @@ err_t tcp_shutdown(struct tcp_pcb *pcb, int shut_rx, int shut_tx);
@@ -566,6 +566,10 @@ err_t tcp_shutdown(struct tcp_pcb *pcb, int shut_rx, int shut_tx);
err_t tcp_write (struct tcp_pcb *pcb, const void *dataptr, u16_t len,
u8_t apiflags);
@ -429,10 +427,10 @@ index e13099c..959df3e 100644
void tcp_setprio (struct tcp_pcb *pcb, u8_t prio);
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
index baf739e..fdd4f87 100644
index fbdcbf4..4ae37f5 100644
--- a/src/include/lwipopts.h
+++ b/src/include/lwipopts.h
@@ -208,8 +208,8 @@
@@ -201,8 +201,8 @@
#define TCP_LISTEN_BACKLOG 1
#define TCP_DEFAULT_LISTEN_BACKLOG 0xff
@ -443,7 +441,7 @@ index baf739e..fdd4f87 100644
#define TCP_MSS (FRAME_MTU - IP_HLEN - TCP_HLEN)
@@ -219,7 +219,7 @@
@@ -212,7 +212,7 @@
#define TCP_SND_QUEUELEN (8191)

View File

@ -8,10 +8,10 @@ Subject: [PATCH 76/77] fix recvmsg return EINVAL
1 file changed, 12 insertions(+)
diff --git a/src/api/sockets.c b/src/api/sockets.c
index b6c7b05..1d71427 100644
index a07fb59..575e298 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -1492,9 +1492,21 @@ lwip_recvmsg(int s, struct msghdr *message, int flags)
@@ -1535,9 +1535,21 @@ lwip_recvmsg(int s, struct msghdr *message, int flags)
/* check for valid vectors */
buflen = 0;
for (i = 0; i < message->msg_iovlen; i++) {
@ -30,7 +30,7 @@ index b6c7b05..1d71427 100644
+#else
((ssize_t)(buflen + (ssize_t)message->msg_iov[i].iov_len) <= 0)) {
+#endif
sock_set_errno(sock, err_to_errno(ERR_VAL));
set_errno(err_to_errno(ERR_VAL));
done_socket(sock);
return -1;
--

View File

@ -23,10 +23,10 @@ Subject: [PATCH] enable ipv6
16 files changed, 107 insertions(+), 24 deletions(-)
diff --git a/src/api/sockets.c b/src/api/sockets.c
index 6cff4cb..62052f2 100644
index c4be6a8..6a9946a 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -113,6 +113,14 @@
@@ -158,6 +158,14 @@
#endif /* LWIP_IPV4 */
#if LWIP_IPV6
@ -39,9 +39,9 @@ index 6cff4cb..62052f2 100644
+ (sin6)->sin6_scope_id = ip6_addr_zone(ipaddr); }while(0)
+#else
#define IP6ADDR_PORT_TO_SOCKADDR(sin6, ipaddr, port) do { \
(sin6)->sin6_len = sizeof(struct sockaddr_in6); \
IP6ADDR_SOCKADDR_SET_LEN(sin6); \
(sin6)->sin6_family = AF_INET6; \
@@ -120,6 +128,7 @@
@@ -165,6 +173,7 @@
(sin6)->sin6_flowinfo = 0; \
inet6_addr_from_ip6addr(&(sin6)->sin6_addr, ipaddr); \
(sin6)->sin6_scope_id = ip6_addr_zone(ipaddr); }while(0)
@ -49,7 +49,7 @@ index 6cff4cb..62052f2 100644
#define SOCKADDR6_TO_IP6ADDR_PORT(sin6, ipaddr, port) do { \
inet6_addr_to_ip6addr(ip_2_ip6(ipaddr), &((sin6)->sin6_addr)); \
if (ip6_addr_has_scope(ip_2_ip6(ipaddr), IP6_UNKNOWN)) { \
@@ -555,7 +564,8 @@ alloc_socket(struct netconn *newconn, int accepted, int flags)
@@ -595,7 +604,8 @@ alloc_socket(struct netconn *newconn, int accepted, int flags)
LWIP_UNUSED_ARG(accepted);
#if GAZELLE_ENABLE
@ -74,10 +74,10 @@ index 57a9670..69b43d1 100644
$(eval $(call register_dir, core, $(SRC)))
diff --git a/src/core/init.c b/src/core/init.c
index 60e1c68..6880fd3 100644
index 5b60ed8..36d7093 100644
--- a/src/core/init.c
+++ b/src/core/init.c
@@ -347,7 +347,9 @@ lwip_init(void)
@@ -353,7 +353,9 @@ lwip_init(void)
mem_init();
memp_init();
pbuf_init();
@ -88,7 +88,7 @@ index 60e1c68..6880fd3 100644
ip_init();
#if LWIP_ARP
diff --git a/src/core/ipv6/ip6.c b/src/core/ipv6/ip6.c
index 9d904ec..101e599 100644
index fad4f40..09b2f80 100644
--- a/src/core/ipv6/ip6.c
+++ b/src/core/ipv6/ip6.c
@@ -60,6 +60,10 @@
@ -132,7 +132,7 @@ index 9d904ec..101e599 100644
LWIP_DEBUGF(IP6_DEBUG, ("netif->output_ip6()\n"));
diff --git a/src/core/ipv6/ip6_frag.c b/src/core/ipv6/ip6_frag.c
index 8b352f5..67e36bf 100644
index 16bcf95..5ff6724 100644
--- a/src/core/ipv6/ip6_frag.c
+++ b/src/core/ipv6/ip6_frag.c
@@ -689,6 +689,7 @@ ip6_frag_free_pbuf_custom_ref(struct pbuf_custom_ref* p)
@ -162,7 +162,7 @@ index 8b352f5..67e36bf 100644
/* Add it to end of rambuf's chain, but using pbuf_cat, not pbuf_chain
* so that it is removed when pbuf_dechain is later called on rambuf.
diff --git a/src/core/tcp.c b/src/core/tcp.c
index c44664e..963b8a4 100644
index 34e99df..1d02574 100644
--- a/src/core/tcp.c
+++ b/src/core/tcp.c
@@ -1155,7 +1155,7 @@ tcp_new_port(void)
@ -175,7 +175,7 @@ index c44664e..963b8a4 100644
__atomic_store_n(&port_state[tcp_port - TCP_LOCAL_PORT_RANGE_START], 1, __ATOMIC_RELEASE);
break;
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index ecbd616..7154659 100644
index dcfb2b5..9b1ec9c 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -309,8 +309,8 @@ tcp_input(struct pbuf *p, struct netif *inp)
@ -190,10 +190,10 @@ index ecbd616..7154659 100644
head = &tcp_active_htable->array[idx].chain;
tcppcb_hlist_for_each(pcb, node, head) {
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
index 073d989..137e3cf 100644
index 4e7aac0..a2d72b3 100644
--- a/src/core/tcp_out.c
+++ b/src/core/tcp_out.c
@@ -139,7 +139,9 @@ static err_t tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct
@@ -142,7 +142,9 @@ static err_t tcp_output_control_segment_netif(const struct tcp_pcb *pcb, struct
static struct netif *
tcp_route(const struct tcp_pcb *pcb, const ip_addr_t *src, const ip_addr_t *dst)
{
@ -204,7 +204,7 @@ index 073d989..137e3cf 100644
if ((pcb != NULL) && (pcb->netif_idx != NETIF_NO_INDEX)) {
return netif_get_by_index(pcb->netif_idx);
diff --git a/src/core/udp.c b/src/core/udp.c
index 828a489..727a705 100644
index f38619b..02ffe36 100644
--- a/src/core/udp.c
+++ b/src/core/udp.c
@@ -132,7 +132,7 @@ udp_new_port(struct udp_pcb *dst_pcb)
@ -264,7 +264,7 @@ index c90ddb8..e61d0b3 100644
#define RTE_MBUF_F_TX_TCP_CKSUM PKT_TX_TCP_CKSUM
#define RTE_MBUF_F_TX_TCP_SEG PKT_TX_TCP_SEG
diff --git a/src/include/lwip/priv/tcp_priv.h b/src/include/lwip/priv/tcp_priv.h
index ddae3fd..9b1341c 100644
index 537683f..75c67ee 100644
--- a/src/include/lwip/priv/tcp_priv.h
+++ b/src/include/lwip/priv/tcp_priv.h
@@ -347,11 +347,24 @@ static inline int vdev_reg_done(enum reg_ring_type reg_type, const struct tcp_pc
@ -309,10 +309,10 @@ index ddae3fd..9b1341c 100644
hd = &htb->array[idx].chain; \
hlist_add_head(&(npcb)->tcp_node, hd); \
diff --git a/src/include/lwip/sockets.h b/src/include/lwip/sockets.h
index cfec6a5..5715df4 100644
index a50c691..89b6eb5 100644
--- a/src/include/lwip/sockets.h
+++ b/src/include/lwip/sockets.h
@@ -88,7 +88,9 @@ struct sockaddr_in {
@@ -95,7 +95,9 @@ struct sockaddr_in {
#if LWIP_IPV6
struct sockaddr_in6 {
@ -323,10 +323,10 @@ index cfec6a5..5715df4 100644
in_port_t sin6_port; /* Transport layer port # */
u32_t sin6_flowinfo; /* IPv6 flow information */
diff --git a/src/include/lwip/tcp.h b/src/include/lwip/tcp.h
index 959df3e..91a86c9 100644
index 460df21..bde17ec 100644
--- a/src/include/lwip/tcp.h
+++ b/src/include/lwip/tcp.h
@@ -476,7 +476,26 @@ static inline unsigned int jhash_3words(unsigned int a, unsigned int b, unsigned
@@ -475,7 +475,26 @@ static inline unsigned int jhash_3words(unsigned int a, unsigned int b, unsigned
return c;
}
@ -355,12 +355,12 @@ index 959df3e..91a86c9 100644
#define tcppcb_hlist_for_each(tcppcb, node, list) \
hlist_for_each_entry(tcppcb, node, list, tcp_node)
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
index a18179e..9ab5cde 100644
index 985e13e..0c87c44 100644
--- a/src/include/lwipopts.h
+++ b/src/include/lwipopts.h
@@ -178,6 +178,14 @@
#define IP_HLEN 20
@@ -172,6 +172,14 @@
#define IP_HLEN 20
+/*
+ -------------------------------------
@ -373,7 +373,7 @@ index a18179e..9ab5cde 100644
/*
---------------------------------
---------- UDP options ----------
@@ -211,7 +219,7 @@
@@ -204,7 +212,7 @@
#define TCP_OVERSIZE TCP_MSS
#define LWIP_NETIF_TX_SINGLE_PBUF 1
@ -382,7 +382,7 @@ index a18179e..9ab5cde 100644
#define TCP_WND (2500 * TCP_MSS)
@@ -263,5 +271,6 @@
@@ -255,5 +263,6 @@
#define ETHARP_SUPPORT_VLAN 1
#define LWIP_VLAN_PCP 1

View File

@ -1,7 +1,25 @@
diff -Nur lwip-ipv6/src/core/ipv6/ip6.c lwip-ipv6-hdr/src/core/ipv6/ip6.c
--- lwip-ipv6/src/core/ipv6/ip6.c 2023-11-15 19:48:02.864481010 +0800
+++ lwip-ipv6-hdr/src/core/ipv6/ip6.c 2023-11-15 20:05:30.388481010 +0800
@@ -367,7 +367,7 @@
From 1a746c8c1c04d6ac39aa7b02d420cb0368baf08f Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Mon, 5 Feb 2024 17:34:46 +0800
Subject: ip6 hdr
---
src/core/ipv6/ip6.c | 28 ++++++++++++++--------------
src/core/ipv6/ip6_frag.c | 16 ++++++++--------
src/core/ipv6/nd6.c | 10 +++++-----
src/core/raw.c | 2 +-
src/include/lwip/ip.h | 6 +++---
src/include/lwip/ip6_frag.h | 2 +-
src/include/lwip/prot/ip6.h | 2 +-
src/netif/lowpan6.c | 4 ++--
src/netif/lowpan6_common.c | 8 ++++----
9 files changed, 39 insertions(+), 39 deletions(-)
diff --git a/src/core/ipv6/ip6.c b/src/core/ipv6/ip6.c
index 09b2f80..5f16cd0 100644
--- a/src/core/ipv6/ip6.c
+++ b/src/core/ipv6/ip6.c
@@ -367,7 +367,7 @@ ip6_select_source_address(struct netif *netif, const ip6_addr_t *dest)
* @param inp the netif on which this packet was received
*/
static void
@ -10,7 +28,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6.c lwip-ipv6-hdr/src/core/ipv6/ip6.c
{
struct netif *netif;
@@ -512,7 +512,7 @@
@@ -512,7 +512,7 @@ ip6_input_accept(struct netif *netif)
err_t
ip6_input(struct pbuf *p, struct netif *inp)
{
@ -19,7 +37,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6.c lwip-ipv6-hdr/src/core/ipv6/ip6.c
struct netif *netif;
const u8_t *nexth;
u16_t hlen, hlen_tot; /* the current header length */
@@ -531,7 +531,7 @@
@@ -531,7 +531,7 @@ ip6_input(struct pbuf *p, struct netif *inp)
IP6_STATS_INC(ip6.recv);
/* identify the IP header */
@ -28,7 +46,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6.c lwip-ipv6-hdr/src/core/ipv6/ip6.c
if (IP6H_V(ip6hdr) != 6) {
LWIP_DEBUGF(IP6_DEBUG | LWIP_DBG_LEVEL_WARNING, ("IPv6 packet dropped due to bad version number %"U32_F"\n",
IP6H_V(ip6hdr)));
@@ -1015,7 +1015,7 @@
@@ -1019,7 +1019,7 @@ netif_found:
/* Returned p point to IPv6 header.
* Update all our variables and pointers and continue. */
@ -37,7 +55,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6.c lwip-ipv6-hdr/src/core/ipv6/ip6.c
nexth = &IP6H_NEXTH(ip6hdr);
hlen = hlen_tot = IP6_HLEN;
pbuf_remove_header(p, IP6_HLEN);
@@ -1188,7 +1188,7 @@
@@ -1188,7 +1188,7 @@ ip6_output_if_src(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
u8_t hl, u8_t tc,
u8_t nexth, struct netif *netif)
{
@ -46,7 +64,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6.c lwip-ipv6-hdr/src/core/ipv6/ip6.c
ip6_addr_t dest_addr;
LWIP_ASSERT_CORE_LOCKED();
@@ -1217,9 +1217,9 @@
@@ -1217,9 +1217,9 @@ ip6_output_if_src(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
return ERR_BUF;
}
@ -59,7 +77,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6.c lwip-ipv6-hdr/src/core/ipv6/ip6.c
IP6H_HOPLIM_SET(ip6hdr, hl);
IP6H_NEXTH_SET(ip6hdr, nexth);
@@ -1242,7 +1242,7 @@
@@ -1242,7 +1242,7 @@ ip6_output_if_src(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
} else {
/* IP header already included in p */
@ -68,7 +86,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6.c lwip-ipv6-hdr/src/core/ipv6/ip6.c
ip6_addr_copy_from_packed(dest_addr, ip6hdr->dest);
ip6_addr_assign_zone(&dest_addr, IP6_UNKNOWN, netif);
dest = &dest_addr;
@@ -1316,7 +1316,7 @@
@@ -1316,7 +1316,7 @@ ip6_output(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
u8_t hl, u8_t tc, u8_t nexth)
{
struct netif *netif;
@ -77,7 +95,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6.c lwip-ipv6-hdr/src/core/ipv6/ip6.c
ip6_addr_t src_addr, dest_addr;
LWIP_IP_CHECK_PBUF_REF_COUNT_FOR_TX(p);
@@ -1325,7 +1325,7 @@
@@ -1325,7 +1325,7 @@ ip6_output(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
netif = ip6_route(src, dest);
} else {
/* IP header included in p, read addresses. */
@ -86,7 +104,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6.c lwip-ipv6-hdr/src/core/ipv6/ip6.c
ip6_addr_copy_from_packed(src_addr, ip6hdr->src);
ip6_addr_copy_from_packed(dest_addr, ip6hdr->dest);
netif = ip6_route(&src_addr, &dest_addr);
@@ -1375,7 +1375,7 @@
@@ -1375,7 +1375,7 @@ ip6_output_hinted(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
u8_t hl, u8_t tc, u8_t nexth, struct netif_hint *netif_hint)
{
struct netif *netif;
@ -95,7 +113,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6.c lwip-ipv6-hdr/src/core/ipv6/ip6.c
ip6_addr_t src_addr, dest_addr;
err_t err;
@@ -1385,7 +1385,7 @@
@@ -1385,7 +1385,7 @@ ip6_output_hinted(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
netif = ip6_route(src, dest);
} else {
/* IP header included in p, read addresses. */
@ -104,7 +122,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6.c lwip-ipv6-hdr/src/core/ipv6/ip6.c
ip6_addr_copy_from_packed(src_addr, ip6hdr->src);
ip6_addr_copy_from_packed(dest_addr, ip6hdr->dest);
netif = ip6_route(&src_addr, &dest_addr);
@@ -1476,7 +1476,7 @@
@@ -1476,7 +1476,7 @@ ip6_options_add_hbh_ra(struct pbuf *p, u8_t nexth, u8_t value)
void
ip6_debug_print(struct pbuf *p)
{
@ -113,10 +131,11 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6.c lwip-ipv6-hdr/src/core/ipv6/ip6.c
LWIP_DEBUGF(IP6_DEBUG, ("IPv6 header:\n"));
LWIP_DEBUGF(IP6_DEBUG, ("+-------------------------------+\n"));
diff -Nur lwip-ipv6/src/core/ipv6/ip6_frag.c lwip-ipv6-hdr/src/core/ipv6/ip6_frag.c
--- lwip-ipv6/src/core/ipv6/ip6_frag.c 2023-11-15 19:48:02.864481010 +0800
+++ lwip-ipv6-hdr/src/core/ipv6/ip6_frag.c 2023-11-15 20:01:41.668481010 +0800
@@ -551,7 +551,7 @@
diff --git a/src/core/ipv6/ip6_frag.c b/src/core/ipv6/ip6_frag.c
index 5ff6724..78bcb2a 100644
--- a/src/core/ipv6/ip6_frag.c
+++ b/src/core/ipv6/ip6_frag.c
@@ -551,7 +551,7 @@ ip6_reass(struct pbuf *p)
if (valid) {
/* All fragments have been received */
@ -125,7 +144,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6_frag.c lwip-ipv6-hdr/src/core/ipv6/ip6_fra
/* chain together the pbufs contained within the ip6_reassdata list. */
iprh = (struct ip6_reass_helper*) ipr->p->payload;
@@ -565,7 +565,7 @@
@@ -565,7 +565,7 @@ ip6_reass(struct pbuf *p)
pbuf_remove_header(next_pbuf, IP6_FRAG_HLEN);
#if IPV6_FRAG_COPYHEADER
if (IPV6_FRAG_REQROOM > 0) {
@ -134,7 +153,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6_frag.c lwip-ipv6-hdr/src/core/ipv6/ip6_fra
u8_t hdrerr = pbuf_remove_header(next_pbuf, IPV6_FRAG_REQROOM);
LWIP_UNUSED_ARG(hdrerr); /* in case of LWIP_NOASSERT */
LWIP_ASSERT("no room for struct ip6_reass_helper", hdrerr == 0);
@@ -610,7 +610,7 @@
@@ -610,7 +610,7 @@ ip6_reass(struct pbuf *p)
(size_t)((u8_t*)p->payload - (u8_t*)ipr->iphdr));
/* This is where the IPv6 header is now. */
@ -143,7 +162,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6_frag.c lwip-ipv6-hdr/src/core/ipv6/ip6_fra
sizeof(struct ip6_frag_hdr));
/* Adjust datagram length by adding header lengths. */
@@ -721,8 +721,8 @@
@@ -721,8 +721,8 @@ ip6_frag_free_pbuf_custom(struct pbuf *p)
err_t
ip6_frag(struct pbuf *p, struct netif *netif, const ip6_addr_t *dest)
{
@ -154,7 +173,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6_frag.c lwip-ipv6-hdr/src/core/ipv6/ip6_fra
struct ip6_frag_hdr *frag_hdr;
struct pbuf *rambuf;
#if !LWIP_NETIF_TX_SINGLE_PBUF
@@ -740,7 +740,7 @@
@@ -740,7 +740,7 @@ ip6_frag(struct pbuf *p, struct netif *netif, const ip6_addr_t *dest)
identification++;
@ -163,7 +182,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6_frag.c lwip-ipv6-hdr/src/core/ipv6/ip6_fra
/* @todo we assume there are no options in the unfragmentable part (IPv6 header). */
LWIP_ASSERT("p->tot_len >= IP6_HLEN", p->tot_len >= IP6_HLEN);
@@ -769,7 +769,7 @@
@@ -769,7 +769,7 @@ ip6_frag(struct pbuf *p, struct netif *netif, const ip6_addr_t *dest)
}
/* fill in the IP header */
SMEMCPY(rambuf->payload, original_ip6hdr, IP6_HLEN);
@ -172,7 +191,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6_frag.c lwip-ipv6-hdr/src/core/ipv6/ip6_fra
frag_hdr = (struct ip6_frag_hdr *)((u8_t*)rambuf->payload + IP6_HLEN);
#else
/* When not using a static buffer, create a chain of pbufs.
@@ -785,7 +785,7 @@
@@ -785,7 +785,7 @@ ip6_frag(struct pbuf *p, struct netif *netif, const ip6_addr_t *dest)
LWIP_ASSERT("this needs a pbuf in one piece!",
(rambuf->len >= (IP6_HLEN)));
SMEMCPY(rambuf->payload, original_ip6hdr, IP6_HLEN);
@ -181,10 +200,11 @@ diff -Nur lwip-ipv6/src/core/ipv6/ip6_frag.c lwip-ipv6-hdr/src/core/ipv6/ip6_fra
frag_hdr = (struct ip6_frag_hdr *)((u8_t*)rambuf->payload + IP6_HLEN);
/* Can just adjust p directly for needed offset. */
diff -Nur lwip-ipv6/src/core/ipv6/nd6.c lwip-ipv6-hdr/src/core/ipv6/nd6.c
--- lwip-ipv6/src/core/ipv6/nd6.c 2023-11-15 19:48:02.864481010 +0800
+++ lwip-ipv6-hdr/src/core/ipv6/nd6.c 2023-11-15 20:06:47.036481010 +0800
@@ -895,7 +895,7 @@
diff --git a/src/core/ipv6/nd6.c b/src/core/ipv6/nd6.c
index 3b13c21..970ce40 100644
--- a/src/core/ipv6/nd6.c
+++ b/src/core/ipv6/nd6.c
@@ -910,7 +910,7 @@ nd6_input(struct pbuf *p, struct netif *inp)
case ICMP6_TYPE_PTB: /* Packet too big */
{
struct icmp6_hdr *icmp6hdr; /* Packet too big message */
@ -193,7 +213,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/nd6.c lwip-ipv6-hdr/src/core/ipv6/nd6.c
u32_t pmtu;
ip6_addr_t destination_address;
@@ -909,7 +909,7 @@
@@ -924,7 +924,7 @@ nd6_input(struct pbuf *p, struct netif *inp)
}
icmp6hdr = (struct icmp6_hdr *)p->payload;
@ -202,7 +222,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/nd6.c lwip-ipv6-hdr/src/core/ipv6/nd6.c
/* Create an aligned, zoned copy of the destination address. */
ip6_addr_copy_from_packed(destination_address, ip6hdr->dest);
@@ -2187,7 +2187,7 @@
@@ -2212,7 +2212,7 @@ nd6_free_q(struct nd6_q_entry *q)
static void
nd6_send_q(s8_t i)
{
@ -211,7 +231,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/nd6.c lwip-ipv6-hdr/src/core/ipv6/nd6.c
ip6_addr_t dest;
#if LWIP_ND6_QUEUEING
struct nd6_q_entry *q;
@@ -2204,7 +2204,7 @@
@@ -2229,7 +2229,7 @@ nd6_send_q(s8_t i)
/* pop first item off the queue */
neighbor_cache[i].q = q->next;
/* Get ipv6 header. */
@ -220,7 +240,7 @@ diff -Nur lwip-ipv6/src/core/ipv6/nd6.c lwip-ipv6-hdr/src/core/ipv6/nd6.c
/* Create an aligned copy. */
ip6_addr_copy_from_packed(dest, ip6hdr->dest);
/* Restore the zone, if applicable. */
@@ -2219,7 +2219,7 @@
@@ -2245,7 +2245,7 @@ nd6_send_q(s8_t i)
#else /* LWIP_ND6_QUEUEING */
if (neighbor_cache[i].q != NULL) {
/* Get ipv6 header. */
@ -229,10 +249,11 @@ diff -Nur lwip-ipv6/src/core/ipv6/nd6.c lwip-ipv6-hdr/src/core/ipv6/nd6.c
/* Create an aligned copy. */
ip6_addr_copy_from_packed(dest, ip6hdr->dest);
/* Restore the zone, if applicable. */
diff -Nur lwip-ipv6/src/core/raw.c lwip-ipv6-hdr/src/core/raw.c
--- lwip-ipv6/src/core/raw.c 2023-11-15 19:48:02.860481010 +0800
+++ lwip-ipv6-hdr/src/core/raw.c 2023-11-15 19:49:53.468481010 +0800
@@ -146,7 +146,7 @@
diff --git a/src/core/raw.c b/src/core/raw.c
index d85aaec..27f990d 100644
--- a/src/core/raw.c
+++ b/src/core/raw.c
@@ -146,7 +146,7 @@ raw_input(struct pbuf *p, struct netif *inp)
if (IP_HDR_GET_VERSION(p->payload) == 6)
#endif /* LWIP_IPV4 */
{
@ -241,22 +262,11 @@ diff -Nur lwip-ipv6/src/core/raw.c lwip-ipv6-hdr/src/core/raw.c
proto = IP6H_NEXTH(ip6hdr);
}
#if LWIP_IPV4
diff -Nur lwip-ipv6/src/include/lwip/ip6_frag.h lwip-ipv6-hdr/src/include/lwip/ip6_frag.h
--- lwip-ipv6/src/include/lwip/ip6_frag.h 2023-11-15 19:48:02.864481010 +0800
+++ lwip-ipv6-hdr/src/include/lwip/ip6_frag.h 2023-11-15 20:13:40.008481010 +0800
@@ -90,7 +90,7 @@
struct ip6_reassdata {
struct ip6_reassdata *next;
struct pbuf *p;
- struct ip6_hdr *iphdr; /* pointer to the first (original) IPv6 header */
+ struct ip6hdr *iphdr; /* pointer to the first (original) IPv6 header */
#if IPV6_FRAG_COPYHEADER
ip6_addr_p_t src; /* copy of the source address in the IP header */
ip6_addr_p_t dest; /* copy of the destination address in the IP header */
diff -Nur lwip-ipv6/src/include/lwip/ip.h lwip-ipv6-hdr/src/include/lwip/ip.h
--- lwip-ipv6/src/include/lwip/ip.h 2023-11-15 19:48:02.864481010 +0800
+++ lwip-ipv6-hdr/src/include/lwip/ip.h 2023-11-15 20:12:42.796481010 +0800
@@ -123,7 +123,7 @@
diff --git a/src/include/lwip/ip.h b/src/include/lwip/ip.h
index b6ab031..dd25ce6 100644
--- a/src/include/lwip/ip.h
+++ b/src/include/lwip/ip.h
@@ -134,7 +134,7 @@ struct ip_globals
#endif /* LWIP_IPV4 */
#if LWIP_IPV6
/** Header of the input IPv6 packet currently being processed. */
@ -265,7 +275,7 @@ diff -Nur lwip-ipv6/src/include/lwip/ip.h lwip-ipv6-hdr/src/include/lwip/ip.h
#endif /* LWIP_IPV6 */
/** Total header length of current_ip4/6_header (i.e. after this, the UDP/TCP header starts) */
u16_t current_ip_header_tot_len;
@@ -159,7 +159,7 @@
@@ -170,7 +170,7 @@ extern PER_THREAD struct ip_globals ip_data;
/** Get the IPv6 header of the current packet.
* This function must only be called from a receive callback (udp_recv,
* raw_recv, tcp_accept). It will return NULL otherwise. */
@ -274,7 +284,7 @@ diff -Nur lwip-ipv6/src/include/lwip/ip.h lwip-ipv6-hdr/src/include/lwip/ip.h
/** Returns TRUE if the current IP input packet is IPv6, FALSE if it is IPv4 */
#define ip_current_is_v6() (ip6_current_header() != NULL)
/** Source IPv6 address of current_header */
@@ -201,7 +201,7 @@
@@ -212,7 +212,7 @@ extern PER_THREAD struct ip_globals ip_data;
/** Get the IPv6 header of the current packet.
* This function must only be called from a receive callback (udp_recv,
* raw_recv, tcp_accept). It will return NULL otherwise. */
@ -283,10 +293,24 @@ diff -Nur lwip-ipv6/src/include/lwip/ip.h lwip-ipv6-hdr/src/include/lwip/ip.h
/** Always returns TRUE when only supporting IPv6 only */
#define ip_current_is_v6() 1
/** Get the transport layer protocol */
diff -Nur lwip-ipv6/src/include/lwip/prot/ip6.h lwip-ipv6-hdr/src/include/lwip/prot/ip6.h
--- lwip-ipv6/src/include/lwip/prot/ip6.h 2023-11-15 19:48:02.868481010 +0800
+++ lwip-ipv6-hdr/src/include/lwip/prot/ip6.h 2023-11-17 13:24:56.832481010 +0800
@@ -79,7 +79,7 @@
diff --git a/src/include/lwip/ip6_frag.h b/src/include/lwip/ip6_frag.h
index 87e0e86..6ea6052 100644
--- a/src/include/lwip/ip6_frag.h
+++ b/src/include/lwip/ip6_frag.h
@@ -90,7 +90,7 @@ extern "C" {
struct ip6_reassdata {
struct ip6_reassdata *next;
struct pbuf *p;
- struct ip6_hdr *iphdr; /* pointer to the first (original) IPv6 header */
+ struct ip6hdr *iphdr; /* pointer to the first (original) IPv6 header */
#if IPV6_FRAG_COPYHEADER
ip6_addr_p_t src; /* copy of the source address in the IP header */
ip6_addr_p_t dest; /* copy of the destination address in the IP header */
diff --git a/src/include/lwip/prot/ip6.h b/src/include/lwip/prot/ip6.h
index 7df81ed..40f270b 100644
--- a/src/include/lwip/prot/ip6.h
+++ b/src/include/lwip/prot/ip6.h
@@ -79,7 +79,7 @@ typedef struct ip6_addr_packed ip6_addr_p_t;
# include "arch/bpstruct.h"
#endif
PACK_STRUCT_BEGIN
@ -295,10 +319,11 @@ diff -Nur lwip-ipv6/src/include/lwip/prot/ip6.h lwip-ipv6-hdr/src/include/lwip/p
/** version / traffic class / flow label */
PACK_STRUCT_FIELD(u32_t _v_tc_fl);
/** payload length */
diff -Nur lwip-ipv6/src/netif/lowpan6.c lwip-ipv6-hdr/src/netif/lowpan6.c
--- lwip-ipv6/src/netif/lowpan6.c 2023-11-15 19:48:02.868481010 +0800
+++ lwip-ipv6-hdr/src/netif/lowpan6.c 2023-11-15 20:16:23.836481010 +0800
@@ -570,12 +570,12 @@
diff --git a/src/netif/lowpan6.c b/src/netif/lowpan6.c
index 8eb751c..037ac6d 100644
--- a/src/netif/lowpan6.c
+++ b/src/netif/lowpan6.c
@@ -571,12 +571,12 @@ lowpan6_output(struct netif *netif, struct pbuf *q, const ip6_addr_t *ip6addr)
struct lowpan6_link_addr src, dest;
#if LWIP_6LOWPAN_INFER_SHORT_ADDRESS
ip6_addr_t ip6_src;
@ -313,10 +338,11 @@ diff -Nur lwip-ipv6/src/netif/lowpan6.c lwip-ipv6-hdr/src/netif/lowpan6.c
ip6_addr_copy_from_packed(ip6_src, ip6_hdr->src);
ip6_addr_assign_zone(&ip6_src, IP6_UNICAST, netif);
if (lowpan6_get_address_mode(&ip6_src, &short_mac_addr) == 3) {
diff -Nur lwip-ipv6/src/netif/lowpan6_common.c lwip-ipv6-hdr/src/netif/lowpan6_common.c
--- lwip-ipv6/src/netif/lowpan6_common.c 2023-11-15 19:48:02.868481010 +0800
+++ lwip-ipv6-hdr/src/netif/lowpan6_common.c 2023-11-15 20:15:44.460481010 +0800
@@ -137,7 +137,7 @@
diff --git a/src/netif/lowpan6_common.c b/src/netif/lowpan6_common.c
index 9f50658..7b9f834 100644
--- a/src/netif/lowpan6_common.c
+++ b/src/netif/lowpan6_common.c
@@ -137,7 +137,7 @@ lowpan6_compress_headers(struct netif *netif, u8_t *inbuf, size_t inbuf_size, u8
u8_t lowpan6_header_len;
u8_t hidden_header_len = 0;
s8_t i;
@ -325,7 +351,7 @@ diff -Nur lwip-ipv6/src/netif/lowpan6_common.c lwip-ipv6-hdr/src/netif/lowpan6_c
ip_addr_t ip6src, ip6dst;
LWIP_ASSERT("netif != NULL", netif != NULL);
@@ -160,7 +160,7 @@
@@ -160,7 +160,7 @@ lowpan6_compress_headers(struct netif *netif, u8_t *inbuf, size_t inbuf_size, u8
}
/* Point to ip6 header and align copies of src/dest addresses. */
@ -334,7 +360,7 @@ diff -Nur lwip-ipv6/src/netif/lowpan6_common.c lwip-ipv6-hdr/src/netif/lowpan6_c
ip_addr_copy_from_ip6_packed(ip6dst, ip6hdr->dest);
ip6_addr_assign_zone(ip_2_ip6(&ip6dst), IP6_UNKNOWN, netif);
ip_addr_copy_from_ip6_packed(ip6src, ip6hdr->src);
@@ -396,7 +396,7 @@
@@ -396,7 +396,7 @@ lowpan6_decompress_hdr(u8_t *lowpan6_buffer, size_t lowpan6_bufsize,
struct lowpan6_link_addr *src, struct lowpan6_link_addr *dest)
{
u16_t lowpan6_offset;
@ -343,7 +369,7 @@ diff -Nur lwip-ipv6/src/netif/lowpan6_common.c lwip-ipv6-hdr/src/netif/lowpan6_c
s8_t i;
u32_t header_temp;
u16_t ip6_offset = IP6_HLEN;
@@ -408,7 +408,7 @@
@@ -408,7 +408,7 @@ lowpan6_decompress_hdr(u8_t *lowpan6_buffer, size_t lowpan6_bufsize,
LWIP_ASSERT("hdr_size_comp != NULL", hdr_size_comp != NULL);
LWIP_ASSERT("dehdr_size_decompst != NULL", hdr_size_decomp != NULL);
@ -352,3 +378,6 @@ diff -Nur lwip-ipv6/src/netif/lowpan6_common.c lwip-ipv6-hdr/src/netif/lowpan6_c
if (decomp_bufsize < IP6_HLEN) {
return ERR_MEM;
}
--
2.33.0

View File

@ -1,9 +1,23 @@
diff -Nur lwip-org/src/core/netif.c lwip-vlan/src/core/netif.c
--- lwip-org/src/core/netif.c 2023-11-24 17:38:29.428481010 +0800
+++ lwip-vlan/src/core/netif.c 2023-11-27 18:35:00.172481010 +0800
@@ -355,6 +355,11 @@
netif->input = input;
From 95f00d7a735b20cf352f6712529547b3720614cb Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Mon, 5 Feb 2024 17:35:32 +0800
Subject: add vlanid in netif
---
src/core/netif.c | 14 ++++++++++++++
src/core/tcp.c | 2 ++
src/core/tcp_in.c | 2 ++
src/include/lwip/netif.h | 9 +++++++++
src/netif/ethernet.c | 6 ++++++
5 files changed, 33 insertions(+)
diff --git a/src/core/netif.c b/src/core/netif.c
index 8a1ccec..eff3cae 100644
--- a/src/core/netif.c
+++ b/src/core/netif.c
@@ -369,6 +369,11 @@ netif_add(struct netif *netif,
netif->acd_list = NULL;
#endif /* LWIP_ACD */
NETIF_RESET_HINTS(netif);
+
+#if GAZELLE_ENABLE
@ -13,7 +27,7 @@ diff -Nur lwip-org/src/core/netif.c lwip-vlan/src/core/netif.c
#if ENABLE_LOOPBACK
netif->loop_first = NULL;
netif->loop_last = NULL;
@@ -441,6 +446,15 @@
@@ -455,6 +460,15 @@ netif_add(struct netif *netif,
return netif;
}
@ -29,23 +43,25 @@ diff -Nur lwip-org/src/core/netif.c lwip-vlan/src/core/netif.c
static void
netif_do_ip_addr_changed(const ip_addr_t *old_addr, const ip_addr_t *new_addr)
{
diff -Nur lwip-org/src/core/tcp.c lwip-vlan/src/core/tcp.c
--- lwip-org/src/core/tcp.c 2023-11-24 17:38:29.448481010 +0800
+++ lwip-vlan/src/core/tcp.c 2023-11-27 10:42:33.228481010 +0800
@@ -987,7 +987,9 @@
lpcb->tos = pcb->tos;
diff --git a/src/core/tcp.c b/src/core/tcp.c
index 1d02574..b889a4e 100644
--- a/src/core/tcp.c
+++ b/src/core/tcp.c
@@ -996,7 +996,9 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err)
#endif
#if LWIP_VLAN_PCP
+#if !GAZELLE_ENABLE
lpcb->netif_hints.tci = pcb->netif_hints.tci;
+#endif
#endif /* LWIP_VLAN_PCP */
#if GAZELLE_TCP_REUSE_IPPORT
lpcb->connect_num = 0;
diff -Nur lwip-org/src/core/tcp_in.c lwip-vlan/src/core/tcp_in.c
--- lwip-org/src/core/tcp_in.c 2023-11-24 17:38:29.448481010 +0800
+++ lwip-vlan/src/core/tcp_in.c 2023-11-27 10:42:33.228481010 +0800
@@ -808,7 +808,9 @@
#if LWIP_IPV4 && LWIP_IPV6
IP_SET_TYPE_VAL(lpcb->remote_ip, pcb->local_ip.type);
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index 9b1ec9c..10f8a14 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -808,7 +808,9 @@ tcp_listen_input(struct tcp_pcb_listen *pcb)
npcb->listener = pcb;
#endif /* LWIP_CALLBACK_API || TCP_LISTEN_BACKLOG */
#if LWIP_VLAN_PCP
@ -55,9 +71,10 @@ diff -Nur lwip-org/src/core/tcp_in.c lwip-vlan/src/core/tcp_in.c
#endif /* LWIP_VLAN_PCP */
/* inherit socket options */
npcb->so_options = pcb->so_options & SOF_INHERITED;
diff -Nur lwip-org/src/include/lwip/netif.h lwip-vlan/src/include/lwip/netif.h
--- lwip-org/src/include/lwip/netif.h 2023-11-24 17:38:29.440481010 +0800
+++ lwip-vlan/src/include/lwip/netif.h 2023-11-27 18:33:07.936481010 +0800
diff --git a/src/include/lwip/netif.h b/src/include/lwip/netif.h
index 502a151..368b89a 100644
--- a/src/include/lwip/netif.h
+++ b/src/include/lwip/netif.h
@@ -45,6 +45,10 @@
#include "lwip/ip_addr.h"
@ -69,7 +86,7 @@ diff -Nur lwip-org/src/include/lwip/netif.h lwip-vlan/src/include/lwip/netif.h
#include "lwip/def.h"
#include "lwip/pbuf.h"
#include "lwip/stats.h"
@@ -357,6 +361,10 @@
@@ -360,6 +364,10 @@ struct netif {
#if GAZELLE_ENABLE
u64_t rxol_flags;
u64_t txol_flags;
@ -80,7 +97,7 @@ diff -Nur lwip-org/src/include/lwip/netif.h lwip-vlan/src/include/lwip/netif.h
#endif
/** descriptive abbreviation */
char name[2];
@@ -484,6 +492,7 @@
@@ -492,6 +500,7 @@ void netif_set_down(struct netif *netif);
#define netif_get_rxol_flags(netif) ((netif)->rxol_flags)
#define netif_get_txol_flags(netif) ((netif)->txol_flags)
@ -88,10 +105,11 @@ diff -Nur lwip-org/src/include/lwip/netif.h lwip-vlan/src/include/lwip/netif.h
void netif_set_rtc_mode(struct netif *netif);
void netif_set_rxol_flags(struct netif *netif, u64_t flags);
void netif_set_txol_flags(struct netif *netif, u64_t flags);
diff -Nur lwip-org/src/netif/ethernet.c lwip-vlan/src/netif/ethernet.c
--- lwip-org/src/netif/ethernet.c 2023-11-24 17:38:29.444481010 +0800
+++ lwip-vlan/src/netif/ethernet.c 2023-11-27 11:07:48.464481010 +0800
@@ -283,9 +283,15 @@
diff --git a/src/netif/ethernet.c b/src/netif/ethernet.c
index dc89566..af4cffc 100644
--- a/src/netif/ethernet.c
+++ b/src/netif/ethernet.c
@@ -283,9 +283,15 @@ ethernet_output(struct netif * netif, struct pbuf * p,
vlan_prio_vid = LWIP_HOOK_VLAN_SET(netif, p, src, dst, eth_type);
#elif LWIP_VLAN_PCP
vlan_prio_vid = -1;
@ -107,3 +125,5 @@ diff -Nur lwip-org/src/netif/ethernet.c lwip-vlan/src/netif/ethernet.c
#endif
if (vlan_prio_vid >= 0) {
struct eth_vlan_hdr *vlanhdr;
--
2.33.0

View File

@ -10,7 +10,7 @@ Subject: [PATCH] add lwip log: tcp_rst & tcp_abandon & tcp_abort
3 files changed, 35 insertions(+), 12 deletions(-)
diff --git a/src/core/tcp.c b/src/core/tcp.c
index 963b8a4..a4f82a3 100644
index f6c4cf1..73d1d1e 100644
--- a/src/core/tcp.c
+++ b/src/core/tcp.c
@@ -415,6 +415,9 @@ tcp_close_shutdown(struct tcp_pcb *pcb, u8_t rst_on_unacked_data)
@ -33,7 +33,7 @@ index 963b8a4..a4f82a3 100644
tcp_rst(pcb, seqno, ackno, &pcb->local_ip, &pcb->remote_ip, local_port, pcb->remote_port);
}
last_state = pcb->state;
@@ -1574,6 +1578,9 @@ tcp_slowtmr_start:
@@ -1577,6 +1581,9 @@ tcp_slowtmr_start:
#endif
if (pcb_reset) {
@ -43,7 +43,7 @@ index 963b8a4..a4f82a3 100644
tcp_rst(pcb, pcb->snd_nxt, pcb->rcv_nxt, &pcb->local_ip, &pcb->remote_ip,
pcb->local_port, pcb->remote_port);
}
@@ -1941,8 +1948,8 @@ tcp_kill_prio(u8_t prio)
@@ -1947,8 +1954,8 @@ tcp_kill_prio(u8_t prio)
}
}
if (inactive != NULL) {
@ -54,7 +54,7 @@ index 963b8a4..a4f82a3 100644
tcp_abort(inactive);
}
}
@@ -1972,8 +1979,8 @@ tcp_kill_state(enum tcp_state state)
@@ -1978,8 +1985,8 @@ tcp_kill_state(enum tcp_state state)
}
}
if (inactive != NULL) {
@ -65,7 +65,7 @@ index 963b8a4..a4f82a3 100644
/* Don't send a RST, since no data is lost. */
tcp_abandon(inactive, 0);
}
@@ -1999,8 +2006,8 @@ tcp_kill_timewait(void)
@@ -2005,8 +2012,8 @@ tcp_kill_timewait(void)
}
}
if (inactive != NULL) {
@ -76,7 +76,7 @@ index 963b8a4..a4f82a3 100644
tcp_abort(inactive);
}
}
@@ -2540,7 +2547,8 @@ tcp_netif_ip_addr_changed_pcblist(const ip_addr_t *old_addr, struct tcp_pcb *pcb
@@ -2548,7 +2555,8 @@ tcp_netif_ip_addr_changed_pcblist(const ip_addr_t *old_addr, struct tcp_pcb *pcb
) {
/* this connection must be aborted */
struct tcp_pcb *next = pcb->next;
@ -87,7 +87,7 @@ index 963b8a4..a4f82a3 100644
pcb = next;
} else {
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index 7154659..700a64c 100644
index 10f8a14..4755ab5 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -592,6 +592,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
@ -109,7 +109,7 @@ index 7154659..700a64c 100644
+ LWIP_DEBUGF(TCP_RST_DEBUG | GAZELLE_DEBUG_SERIOUS,
+ ("tcp_input: no PCB match found, send RST, dest port=%d, src port=%d\n",
+ lwip_ntohs(tcphdr->dest), lwip_ntohs(tcphdr->src)));
tcp_rst(NULL, ackno, seqno + tcplen, ip_current_dest_addr(),
tcp_rst_netif(ip_data.current_input_netif, ackno, seqno + tcplen, ip_current_dest_addr(),
ip_current_src_addr(), tcphdr->dest, tcphdr->src);
}
@@ -761,7 +764,9 @@ tcp_listen_input(struct tcp_pcb_listen *pcb)
@ -120,10 +120,10 @@ index 7154659..700a64c 100644
+ LWIP_DEBUGF(TCP_RST_DEBUG | GAZELLE_DEBUG_SERIOUS,
+ ("tcp_listen_input: ACK in LISTEN, send reset, dest port=%d, src port=%d\n",
+ lwip_ntohs(tcphdr->dest), lwip_ntohs(tcphdr->src)));
tcp_rst((const struct tcp_pcb *)pcb, ackno, seqno + tcplen, ip_current_dest_addr(),
tcp_rst_netif(ip_data.current_input_netif, ackno, seqno + tcplen, ip_current_dest_addr(),
ip_current_src_addr(), tcphdr->dest, tcphdr->src);
} else if (flags & TCP_SYN) {
@@ -852,6 +857,7 @@ tcp_listen_input(struct tcp_pcb_listen *pcb)
@@ -854,6 +859,7 @@ tcp_listen_input(struct tcp_pcb_listen *pcb)
/* Send a SYN|ACK together with the MSS option. */
rc = tcp_enqueue_flags(npcb, TCP_SYN | TCP_ACK);
if (rc != ERR_OK) {
@ -131,7 +131,7 @@ index 7154659..700a64c 100644
tcp_abandon(npcb, 0);
PERF_RESUME(PERF_LAYER_TCP, PERF_POINT_TCP_SYN_RECV);
return;
@@ -892,6 +898,9 @@ tcp_timewait_input(struct tcp_pcb *pcb)
@@ -894,6 +900,9 @@ tcp_timewait_input(struct tcp_pcb *pcb)
should be sent in reply */
if (TCP_SEQ_BETWEEN(seqno, pcb->rcv_nxt, pcb->rcv_nxt + pcb->rcv_wnd)) {
/* If the SYN is in the window it is an error, send a reset */
@ -141,7 +141,7 @@ index 7154659..700a64c 100644
tcp_rst(pcb, ackno, seqno + tcplen, ip_current_dest_addr(),
ip_current_src_addr(), tcphdr->dest, tcphdr->src);
return;
@@ -1060,6 +1069,8 @@ tcp_process(struct tcp_pcb *pcb)
@@ -1062,6 +1071,8 @@ tcp_process(struct tcp_pcb *pcb)
/* received ACK? possibly a half-open connection */
else if (flags & TCP_ACK) {
/* send a RST to bring the other side in a non-synchronized state. */
@ -150,7 +150,7 @@ index 7154659..700a64c 100644
tcp_rst(pcb, ackno, seqno + tcplen, ip_current_dest_addr(),
ip_current_src_addr(), tcphdr->dest, tcphdr->src);
/* Resend SYN immediately (don't wait for rto timeout) to establish
@@ -1102,6 +1113,7 @@ tcp_process(struct tcp_pcb *pcb)
@@ -1104,6 +1115,7 @@ tcp_process(struct tcp_pcb *pcb)
* the connection. */
/* Already aborted? */
if (err != ERR_ABRT) {
@ -158,7 +158,7 @@ index 7154659..700a64c 100644
tcp_abort(pcb);
}
return ERR_ABRT;
@@ -1129,6 +1141,9 @@ tcp_process(struct tcp_pcb *pcb)
@@ -1131,6 +1143,9 @@ tcp_process(struct tcp_pcb *pcb)
}
} else {
/* incorrect ACK number, send RST */
@ -169,7 +169,7 @@ index 7154659..700a64c 100644
ip_current_src_addr(), tcphdr->dest, tcphdr->src);
}
diff --git a/src/include/lwip/debug.h b/src/include/lwip/debug.h
index f47cbfe..6abed9f 100644
index 4986973..c2de064 100644
--- a/src/include/lwip/debug.h
+++ b/src/include/lwip/debug.h
@@ -56,12 +56,12 @@
@ -189,4 +189,3 @@ index f47cbfe..6abed9f 100644
--
2.23.0

View File

@ -1,18 +1,31 @@
diff -Nur lwip-82/src/include/dpdk_version.h lwip-offload/src/include/dpdk_version.h
--- lwip-82/src/include/dpdk_version.h 2023-11-28 14:17:02.432481010 +0800
+++ lwip-offload/src/include/dpdk_version.h 2023-11-28 14:34:21.208481010 +0800
From c2c63406f804550db5670715c1afa6e743d1f675 Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Mon, 5 Feb 2024 17:38:06 +0800
Subject: support vlan offload
---
src/include/dpdk_version.h | 1 +
src/include/lwip/pbuf.h | 1 +
src/netif/ethernet.c | 17 +++++++++++------
3 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/src/include/dpdk_version.h b/src/include/dpdk_version.h
index e61d0b3..5efaa39 100644
--- a/src/include/dpdk_version.h
+++ b/src/include/dpdk_version.h
@@ -48,6 +48,7 @@
#define RTE_MBUF_F_TX_TCP_CKSUM PKT_TX_TCP_CKSUM
#define RTE_MBUF_F_TX_TCP_SEG PKT_TX_TCP_SEG
#define RTE_MBUF_F_TX_UDP_CKSUM PKT_TX_UDP_CKSUM
+#define RTE_MBUF_F_TX_VLAN PKT_TX_VLAN_PKT
#endif /* DPDK_VERSION_1911 */
diff -Nur lwip-82/src/include/lwip/pbuf.h lwip-offload/src/include/lwip/pbuf.h
--- lwip-82/src/include/lwip/pbuf.h 2023-11-28 14:17:02.408481010 +0800
+++ lwip-offload/src/include/lwip/pbuf.h 2023-11-28 14:41:31.580481010 +0800
@@ -240,6 +240,7 @@
diff --git a/src/include/lwip/pbuf.h b/src/include/lwip/pbuf.h
index 7fad719..bc29372 100644
--- a/src/include/lwip/pbuf.h
+++ b/src/include/lwip/pbuf.h
@@ -240,6 +240,7 @@ struct pbuf {
struct pbuf *last;
pthread_spinlock_t pbuf_lock;
struct tcp_pcb *pcb;
@ -20,10 +33,11 @@ diff -Nur lwip-82/src/include/lwip/pbuf.h lwip-offload/src/include/lwip/pbuf.h
#if GAZELLE_UDP_ENABLE
ip_addr_t addr;
u16_t port;
diff -Nur lwip-82/src/netif/ethernet.c lwip-offload/src/netif/ethernet.c
--- lwip-82/src/netif/ethernet.c 2023-11-28 14:17:02.440481010 +0800
+++ lwip-offload/src/netif/ethernet.c 2023-11-28 16:35:36.536481010 +0800
@@ -289,7 +289,12 @@
diff --git a/src/netif/ethernet.c b/src/netif/ethernet.c
index af4cffc..d2960b5 100644
--- a/src/netif/ethernet.c
+++ b/src/netif/ethernet.c
@@ -289,7 +289,12 @@ ethernet_output(struct netif * netif, struct pbuf * p,
}
#else
if (netif->vlan_enable) {
@ -37,9 +51,9 @@ diff -Nur lwip-82/src/netif/ethernet.c lwip-offload/src/netif/ethernet.c
}
#endif /* GAZELLE_ENABLE */
#endif
@@ -327,11 +332,11 @@
@@ -327,11 +332,11 @@ ethernet_output(struct netif * netif, struct pbuf * p,
("ethernet_output: sending packet %p\n", (void *)p));
#if CHECKSUM_GEN_IP_HW || CHECKSUM_GEN_TCP_HW
-#if LWIP_VLAN_PCP
- ethh_cksum_set(p, sizeof(*ethhdr)+SIZEOF_VLAN_HDR);
@ -52,5 +66,7 @@ diff -Nur lwip-82/src/netif/ethernet.c lwip-offload/src/netif/ethernet.c
+ ethh_cksum_set(p, sizeof(*ethhdr));
+ }
#endif
/* send the packet */
--
2.33.0

View File

@ -1,7 +1,20 @@
diff -Nur lwip-org/src/core/tcp.c lwip-gz-addr/src/core/tcp.c
--- lwip-org/src/core/tcp.c 2023-12-04 14:10:25.364481010 +0800
+++ lwip-gz-addr/src/core/tcp.c 2023-12-04 14:33:31.712481010 +0800
@@ -1161,7 +1161,7 @@
From f5df6b241f38a5830920038c05d41ed4444efe63 Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Mon, 5 Feb 2024 17:41:16 +0800
Subject: add struct gz addr
---
src/core/tcp.c | 2 +-
src/core/udp.c | 2 +-
src/include/lwipopts.h | 1 +
src/include/reg_sock.h | 36 +++++++++++++++++++++++++++++++++---
4 files changed, 36 insertions(+), 5 deletions(-)
diff --git a/src/core/tcp.c b/src/core/tcp.c
index 17f922e..9f240b8 100644
--- a/src/core/tcp.c
+++ b/src/core/tcp.c
@@ -1161,7 +1161,7 @@ tcp_new_port(void)
if (__atomic_load_n(&port_state[tcp_port - TCP_LOCAL_PORT_RANGE_START], __ATOMIC_ACQUIRE) == 0) {
#if GAZELLE_ENABLE
@ -10,10 +23,11 @@ diff -Nur lwip-org/src/core/tcp.c lwip-gz-addr/src/core/tcp.c
tmp_port = tcp_port;
__atomic_store_n(&port_state[tcp_port - TCP_LOCAL_PORT_RANGE_START], 1, __ATOMIC_RELEASE);
break;
diff -Nur lwip-org/src/core/udp.c lwip-gz-addr/src/core/udp.c
--- lwip-org/src/core/udp.c 2023-12-04 14:10:25.364481010 +0800
+++ lwip-gz-addr/src/core/udp.c 2023-12-04 14:19:58.832481010 +0800
@@ -132,7 +132,7 @@
diff --git a/src/core/udp.c b/src/core/udp.c
index 02ffe36..ca82e51 100644
--- a/src/core/udp.c
+++ b/src/core/udp.c
@@ -132,7 +132,7 @@ udp_new_port(struct udp_pcb *dst_pcb)
}
if (__atomic_load_n(&port_state[udp_port - UDP_LOCAL_PORT_RANGE_START], __ATOMIC_ACQUIRE) == 0) {
@ -22,10 +36,11 @@ diff -Nur lwip-org/src/core/udp.c lwip-gz-addr/src/core/udp.c
tmp_port = udp_port;
__atomic_store_n(&port_state[udp_port - UDP_LOCAL_PORT_RANGE_START], 1, __ATOMIC_RELEASE);
break;
diff -Nur lwip-org/src/include/lwipopts.h lwip-gz-addr/src/include/lwipopts.h
--- lwip-org/src/include/lwipopts.h 2023-12-04 14:10:25.368481010 +0800
+++ lwip-gz-addr/src/include/lwipopts.h 2023-12-06 19:29:24.520481010 +0800
@@ -184,6 +184,7 @@
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
index 11bc65a..4cd2d7a 100644
--- a/src/include/lwipopts.h
+++ b/src/include/lwipopts.h
@@ -178,6 +178,7 @@
*/
#define LWIP_IPV6 1
#define IP6_HLEN 40
@ -33,9 +48,10 @@ diff -Nur lwip-org/src/include/lwipopts.h lwip-gz-addr/src/include/lwipopts.h
/*
---------------------------------
diff -Nur lwip-org/src/include/reg_sock.h lwip-gz-addr/src/include/reg_sock.h
--- lwip-org/src/include/reg_sock.h 2023-12-04 14:10:25.368481010 +0800
+++ lwip-gz-addr/src/include/reg_sock.h 2023-12-06 19:41:19.792481010 +0800
diff --git a/src/include/reg_sock.h b/src/include/reg_sock.h
index 5a5e971..a11102e 100644
--- a/src/include/reg_sock.h
+++ b/src/include/reg_sock.h
@@ -34,7 +34,35 @@
#define __REG_SOCK_H__
@ -73,7 +89,7 @@ diff -Nur lwip-org/src/include/reg_sock.h lwip-gz-addr/src/include/reg_sock.h
enum reg_ring_type {
REG_RING_TCP_LISTEN = 0,
@@ -45,10 +73,12 @@
@@ -45,10 +73,12 @@ enum reg_ring_type {
};
struct gazelle_quintuple {
@ -87,7 +103,7 @@ diff -Nur lwip-org/src/include/reg_sock.h lwip-gz-addr/src/include/reg_sock.h
uint32_t src_ip;
uint32_t dst_ip;
#if LWIP_IPV6
@@ -65,6 +95,6 @@
@@ -65,6 +95,6 @@ struct reg_ring_msg {
};
extern int vdev_reg_xmit(enum reg_ring_type type, struct gazelle_quintuple *qtuple);
@ -95,3 +111,6 @@ diff -Nur lwip-org/src/include/reg_sock.h lwip-gz-addr/src/include/reg_sock.h
+extern bool port_in_stack_queue(gz_addr_t *src_ip, gz_addr_t *dst_ip, uint16_t src_port, uint16_t dst_port);
#endif /* __REG_SOCK_H__ */
--
2.33.0

View File

@ -9,10 +9,10 @@ Subject: [PATCH] add fd log info and fix wrong port log info
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/api/sockets.c b/src/api/sockets.c
index 65c69d4..d488b5b 100644
index 7978504..459299a 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -2797,7 +2797,7 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
@@ -2840,7 +2840,7 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
#endif
break;
case NETCONN_EVT_ERROR:
@ -22,7 +22,7 @@ index 65c69d4..d488b5b 100644
#if GAZELLE_ENABLE
if (netif_is_rtc_mode(netif_default)) {
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index 8ed91b5..24706c1 100644
index 6e84df4..8fb9482 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -688,8 +688,8 @@ aborted:
@ -33,7 +33,7 @@ index 8ed91b5..24706c1 100644
- lwip_ntohs(tcphdr->dest), lwip_ntohs(tcphdr->src)));
+ ("tcp_input: no PCB match found, send RST, local_port=%d, remote_port=%d\n",
+ tcphdr->src, tcphdr->dest));
tcp_rst(NULL, ackno, seqno + tcplen, ip_current_dest_addr(),
tcp_rst_netif(ip_data.current_input_netif, ackno, seqno + tcplen, ip_current_dest_addr(),
ip_current_src_addr(), tcphdr->dest, tcphdr->src);
}
@@ -765,8 +765,8 @@ tcp_listen_input(struct tcp_pcb_listen *pcb)
@ -44,7 +44,7 @@ index 8ed91b5..24706c1 100644
- lwip_ntohs(tcphdr->dest), lwip_ntohs(tcphdr->src)));
+ ("tcp_listen_input: ACK in LISTEN, send reset, local_port=%d, remote_port=%d\n",
+ tcphdr->src, tcphdr->dest));
tcp_rst((const struct tcp_pcb *)pcb, ackno, seqno + tcplen, ip_current_dest_addr(),
tcp_rst_netif(ip_data.current_input_netif, ackno, seqno + tcplen, ip_current_dest_addr(),
ip_current_src_addr(), tcphdr->dest, tcphdr->src);
} else if (flags & TCP_SYN) {
@@ -902,8 +902,8 @@ tcp_timewait_input(struct tcp_pcb *pcb)

View File

@ -0,0 +1,37 @@
From dcdd7d73c6083a63fe966a68f11eddcafa3fd743 Mon Sep 17 00:00:00 2001
From: hantwofish <hankangkang5@huawei.com>
Date: Thu, 14 Dec 2023 14:51:37 +0800
Subject: [PATCH] resove null pointer
---
src/api/sockets.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/api/sockets.c b/src/api/sockets.c
index a9d39ae..0b3e4ea 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -801,15 +801,17 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
#endif /* GAZELLE_ENABLE */
nsock = &sockets[newsock - LWIP_SOCKET_OFFSET];
#if GAZELLE_ENABLE
+ int ret = 0;
struct tcp_pcb *pcb = newconn->pcb.tcp;
- if (pcb->client_rx_ring != NULL && pcb->client_tx_ring != NULL) {
- if (find_same_node_memzone(pcb, nsock) != 0) {
+ if (pcb != NULL && pcb->client_rx_ring != NULL && pcb->client_tx_ring != NULL) {
+ ret = find_same_node_memzone(pcb, nsock);
+ }
+ if (pcb == NULL || ret != 0) {
netconn_delete(newconn);
free_socket(nsock, 1);
sock_set_errno(sock, ENOTCONN);
done_socket(sock);
return -1;
- }
}
#endif
--
2.33.0

View File

@ -0,0 +1,61 @@
From ce3debdf4c4cd6701cdb323377477539a5fd13fa Mon Sep 17 00:00:00 2001
From: yangchen <yangchen145@huawei.com>
Date: Fri, 15 Dec 2023 17:21:54 +0800
Subject: [PATCH] lwip log: fix reversed port in tcp_input
---
src/core/tcp_in.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index 8fb9482..92ea748 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -689,7 +689,7 @@ aborted:
TCP_STATS_INC(tcp.drop);
LWIP_DEBUGF(TCP_RST_DEBUG | GAZELLE_DEBUG_SERIOUS,
("tcp_input: no PCB match found, send RST, local_port=%d, remote_port=%d\n",
- tcphdr->src, tcphdr->dest));
+ tcphdr->dest, tcphdr->src));
tcp_rst_netif(ip_data.current_input_netif, ackno, seqno + tcplen, ip_current_dest_addr(),
ip_current_src_addr(), tcphdr->dest, tcphdr->src);
}
@@ -766,7 +766,7 @@ tcp_listen_input(struct tcp_pcb_listen *pcb)
RST. */
LWIP_DEBUGF(TCP_RST_DEBUG | GAZELLE_DEBUG_SERIOUS,
("tcp_listen_input: ACK in LISTEN, send reset, local_port=%d, remote_port=%d\n",
- tcphdr->src, tcphdr->dest));
+ tcphdr->dest, tcphdr->src));
tcp_rst_netif(ip_data.current_input_netif, ackno, seqno + tcplen, ip_current_dest_addr(),
ip_current_src_addr(), tcphdr->dest, tcphdr->src);
} else if (flags & TCP_SYN) {
@@ -903,7 +903,7 @@ tcp_timewait_input(struct tcp_pcb *pcb)
/* If the SYN is in the window it is an error, send a reset */
LWIP_DEBUGF(GAZELLE_DEBUG_SERIOUS,
("tcp_timewait_input: SYN in TIME_WAIT, send RST, local_port=%d, remote_port=%d\n",
- tcphdr->src, tcphdr->dest));
+ tcphdr->dest, tcphdr->src));
tcp_rst(pcb, ackno, seqno + tcplen, ip_current_dest_addr(),
ip_current_src_addr(), tcphdr->dest, tcphdr->src);
return;
@@ -1073,7 +1073,7 @@ tcp_process(struct tcp_pcb *pcb)
else if (flags & TCP_ACK) {
/* send a RST to bring the other side in a non-synchronized state. */
LWIP_DEBUGF(GAZELLE_DEBUG_SERIOUS, ("tcp_process: ACK in SYN_SENT, send RST, local_port=%d, remote_port=%d\n",
- tcphdr->src, tcphdr->dest));
+ tcphdr->dest, tcphdr->src));
tcp_rst(pcb, ackno, seqno + tcplen, ip_current_dest_addr(),
ip_current_src_addr(), tcphdr->dest, tcphdr->src);
/* Resend SYN immediately (don't wait for rto timeout) to establish
@@ -1146,7 +1146,7 @@ tcp_process(struct tcp_pcb *pcb)
/* incorrect ACK number, send RST */
LWIP_DEBUGF(GAZELLE_DEBUG_SERIOUS,
("tcp_process: incorrect ACK number in SYN_RCVD, send RST, ackno=%d, lastack=%d, snd_nxt=%d, local_port=%d, remote_port=%d\n",
- ackno, pcb->lastack, pcb->snd_nxt, tcphdr->src, tcphdr->dest));
+ ackno, pcb->lastack, pcb->snd_nxt, tcphdr->dest, tcphdr->src));
tcp_rst(pcb, ackno, seqno + tcplen, ip_current_dest_addr(),
ip_current_src_addr(), tcphdr->dest, tcphdr->src);
}
--
2.33.0

View File

@ -0,0 +1,27 @@
From db1929c5698a672200bf96d7ece992f10a98a80c Mon Sep 17 00:00:00 2001
From: yangchen <yangchen145@huawei.com>
Date: Wed, 20 Dec 2023 17:37:42 +0800
Subject: [PATCH] event_callback: del errevent log if err is ERR_OK
---
src/api/sockets.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/api/sockets.c b/src/api/sockets.c
index 0b3e4ea..f5b8ea6 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -2805,7 +2805,9 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
#endif
break;
case NETCONN_EVT_ERROR:
- LWIP_DEBUGF(GAZELLE_DEBUG_SERIOUS, ("event_callback: have errevent, err=%d, fd=%d\n", conn->pending_err, conn->socket));
+ if (conn->pending_err != ERR_OK) {
+ LWIP_DEBUGF(GAZELLE_DEBUG_SERIOUS, ("event_callback: have errevent, err=%d, fd=%d\n", conn->pending_err, conn->socket));
+ }
sock->errevent = 1;
#if GAZELLE_ENABLE
if (netif_is_rtc_mode(netif_default)) {
--
2.33.0

View File

@ -0,0 +1,27 @@
From c91f1d05c65526fe250cf5e5c32f9038721bc1d5 Mon Sep 17 00:00:00 2001
From: yangchen <yangchen145@huawei.com>
Date: Mon, 25 Dec 2023 12:39:56 +0800
Subject: [PATCH] tcp_send_fin: add the fin to the last unsent segment
---
src/core/tcp_out.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
index 137e3cf..e5c407e 100644
--- a/src/core/tcp_out.c
+++ b/src/core/tcp_out.c
@@ -1195,8 +1195,8 @@ tcp_send_fin(struct tcp_pcb *pcb)
LWIP_ASSERT("tcp_send_fin: invalid pcb", pcb != NULL);
/* first, try to add the fin to the last unsent segment */
- if (pcb->unsent != NULL) {
- struct tcp_seg *last_unsent = pcb->unsent;
+ if (pcb->last_unsent != NULL) {
+ struct tcp_seg *last_unsent = pcb->last_unsent;
if ((TCPH_FLAGS(last_unsent->tcphdr) & (TCP_SYN | TCP_FIN | TCP_RST)) == 0) {
/* no SYN/FIN/RST flag in the header, we can add the FIN flag */
--
2.33.0

View File

@ -0,0 +1,275 @@
From 212198780662639e0422419a25d28ff2bb0d421e Mon Sep 17 00:00:00 2001
From: hantwofish <hankangkang5@huawei.com>
Date: Mon, 25 Dec 2023 15:36:45 +0800
Subject: [PATCH] Mod the issue that 2w connection unable to establish in
Redis.
---
src/api/api_lib.c | 2 +-
src/api/api_msg.c | 2 +-
src/api/sockets.c | 19 ++++++++++++-------
src/core/init.c | 4 ++--
src/core/tcp.c | 4 ++--
src/core/tcp_in.c | 2 +-
src/include/lwip/api.h | 2 +-
src/include/lwip/opt.h | 2 +-
src/include/lwip/priv/api_msg.h | 2 +-
src/include/lwip/tcp.h | 8 ++++----
src/include/lwipopts.h | 4 ++--
11 files changed, 28 insertions(+), 23 deletions(-)
diff --git a/src/api/api_lib.c b/src/api/api_lib.c
index b22b987..1721d49 100644
--- a/src/api/api_lib.c
+++ b/src/api/api_lib.c
@@ -431,7 +431,7 @@ netconn_disconnect(struct netconn *conn)
* don't return any error (yet?))
*/
err_t
-netconn_listen_with_backlog(struct netconn *conn, u8_t backlog)
+netconn_listen_with_backlog(struct netconn *conn, u16_t backlog)
{
#if LWIP_TCP
API_MSG_VAR_DECLARE(msg);
diff --git a/src/api/api_msg.c b/src/api/api_msg.c
index 3fda788..b06be0a 100644
--- a/src/api/api_msg.c
+++ b/src/api/api_msg.c
@@ -1500,7 +1500,7 @@ lwip_netconn_do_listen(void *m)
/* connection is not closed, cannot listen */
err = ERR_VAL;
} else {
- u8_t backlog;
+ u16_t backlog;
#if TCP_LISTEN_BACKLOG
backlog = msg->msg.lb.backlog;
#else /* TCP_LISTEN_BACKLOG */
diff --git a/src/api/sockets.c b/src/api/sockets.c
index d1e1615..ced0c37 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -487,7 +487,7 @@ tryget_socket_unconn_nouse(int fd)
if ((s < 0) || (s >= NUM_SOCKETS))
#endif /* GAZELLE_ENABLE */
{
- LWIP_DEBUGF(SOCKETS_DEBUG, ("tryget_socket_unconn(%d): invalid\n", fd));
+ LWIP_DEBUGF(SOCKETS_DEBUG | GAZELLE_DEBUG_SERIOUS, ("tryget_socket_unconn(%d): invalid\n", fd));
return NULL;
}
return &sockets[s];
@@ -561,7 +561,7 @@ get_socket(int fd)
struct lwip_sock *sock = tryget_socket(fd);
if (!sock) {
if ((fd < LWIP_SOCKET_OFFSET) || (fd >= (LWIP_SOCKET_OFFSET + NUM_SOCKETS))) {
- LWIP_DEBUGF(SOCKETS_DEBUG, ("get_socket(%d): invalid\n", fd));
+ LWIP_DEBUGF(SOCKETS_DEBUG | GAZELLE_DEBUG_SERIOUS, ("get_socket(%d): invalid\n", fd));
}
set_errno(EBADF);
return NULL;
@@ -628,6 +628,7 @@ alloc_socket(struct netconn *newconn, int accepted, int flags)
SYS_ARCH_PROTECT(lev);
i = posix_api->socket_fn(domain, type, protocol);
if (i == -1) {
+ LWIP_DEBUGF(SOCKETS_DEBUG | GAZELLE_DEBUG_SERIOUS, ("posix_api->socket_fn fail socket is -1"));
goto err;
}
@@ -636,6 +637,7 @@ alloc_socket(struct netconn *newconn, int accepted, int flags)
}
if ((i < LWIP_SOCKET_OFFSET) || (i >= sockets_num + LWIP_SOCKET_OFFSET)) {
+ LWIP_DEBUGF(SOCKETS_DEBUG | GAZELLE_DEBUG_SERIOUS, ("posix_api->socket_fn socket is %d, illegal\n", i));
goto err;
}
@@ -806,13 +808,14 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d)...\n", s));
sock = get_socket(s);
if (!sock) {
+ LWIP_DEBUGF(SOCKETS_DEBUG | GAZELLE_DEBUG_SERIOUS, ("get_socket sock is null\n"));
return -1;
}
/* wait for a new connection */
err = netconn_accept(sock->conn, &newconn);
if (err != ERR_OK) {
- LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d): netconn_acept failed, err=%d\n", s, err));
+ LWIP_DEBUGF(SOCKETS_DEBUG | GAZELLE_DEBUG_SERIOUS, ("lwip_accept(%d): netconn_acept failed, err=%d\n", s, err));
if (NETCONNTYPE_GROUP(netconn_type(sock->conn)) != NETCONN_TCP) {
set_errno(EOPNOTSUPP);
} else if (err == ERR_CLSD) {
@@ -827,6 +830,7 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
newsock = alloc_socket(newconn, 1, flags);
if (newsock == -1) {
+ LWIP_DEBUGF(SOCKETS_DEBUG | GAZELLE_DEBUG_SERIOUS, ("alloc_socket fail newsock is -1\n"));
netconn_delete(newconn);
set_errno(ENFILE);
done_socket(sock);
@@ -846,6 +850,7 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
ret = find_same_node_memzone(pcb, nsock);
}
if (pcb == NULL || ret != 0) {
+ LWIP_DEBUGF(SOCKETS_DEBUG | GAZELLE_DEBUG_SERIOUS, ("alloc_socket fail pcb null flag=%u, ret=%d \n", (pcb == NULL), ret));
netconn_delete(newconn);
free_socket(nsock, 1);
sock_set_errno(sock, ENOTCONN);
@@ -881,7 +886,7 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
/* get the IP address and port of the remote host */
err = netconn_peer(newconn, &naddr, &port);
if (err != ERR_OK) {
- LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d): netconn_peer failed, err=%d\n", s, err));
+ LWIP_DEBUGF(SOCKETS_DEBUG | GAZELLE_DEBUG_SERIOUS, ("lwip_accept(%d): netconn_peer failed, err=%d\n", s, err));
free_socket(nsock, 1);
set_errno(err_to_errno(err));
done_socket(sock);
@@ -1096,10 +1101,10 @@ lwip_listen(int s, int backlog)
return -1;
}
- /* limit the "backlog" parameter to fit in an u8_t */
- backlog = LWIP_MIN(LWIP_MAX(backlog, 0), 0xff);
+ /* limit the "backlog" parameter to fit in an u16_t */
+ backlog = LWIP_MIN(LWIP_MAX(backlog, 0), 0xffff);
- err = netconn_listen_with_backlog(sock->conn, (u8_t)backlog);
+ err = netconn_listen_with_backlog(sock->conn, (u16_t)backlog);
if (err != ERR_OK) {
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_listen(%d) failed, err=%d\n", s, err));
diff --git a/src/core/init.c b/src/core/init.c
index 36d7093..c0aaf45 100644
--- a/src/core/init.c
+++ b/src/core/init.c
@@ -160,8 +160,8 @@ PACK_STRUCT_END
#if (LWIP_TCP && ((TCP_MAXRTX > 12) || (TCP_SYNMAXRTX > 12)))
#error "If you want to use TCP, TCP_MAXRTX and TCP_SYNMAXRTX must less or equal to 12 (due to tcp_backoff table), so, you have to reduce them in your lwipopts.h"
#endif
-#if (LWIP_TCP && TCP_LISTEN_BACKLOG && ((TCP_DEFAULT_LISTEN_BACKLOG < 0) || (TCP_DEFAULT_LISTEN_BACKLOG > 0xff)))
-#error "If you want to use TCP backlog, TCP_DEFAULT_LISTEN_BACKLOG must fit into an u8_t"
+#if (LWIP_TCP && TCP_LISTEN_BACKLOG && ((TCP_DEFAULT_LISTEN_BACKLOG < 0) || (TCP_DEFAULT_LISTEN_BACKLOG > 0xffff)))
+#error "If you want to use TCP backlog, TCP_DEFAULT_LISTEN_BACKLOG must fit into an u16_t"
#endif
#if (LWIP_TCP && LWIP_TCP_SACK_OUT && !TCP_QUEUE_OOSEQ)
#error "To use LWIP_TCP_SACK_OUT, TCP_QUEUE_OOSEQ needs to be enabled"
diff --git a/src/core/tcp.c b/src/core/tcp.c
index 9f240b8..a9a6513 100644
--- a/src/core/tcp.c
+++ b/src/core/tcp.c
@@ -903,7 +903,7 @@ tcp_accept_null(void *arg, struct tcp_pcb *pcb, err_t err)
* tpcb = tcp_listen_with_backlog(tpcb, backlog);
*/
struct tcp_pcb *
-tcp_listen_with_backlog(struct tcp_pcb *pcb, u8_t backlog)
+tcp_listen_with_backlog(struct tcp_pcb *pcb, u16_t backlog)
{
LWIP_ASSERT_CORE_LOCKED();
return tcp_listen_with_backlog_and_err(pcb, backlog, NULL);
@@ -926,7 +926,7 @@ tcp_listen_with_backlog(struct tcp_pcb *pcb, u8_t backlog)
* tpcb = tcp_listen_with_backlog_and_err(tpcb, backlog, &err);
*/
struct tcp_pcb *
-tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err)
+tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u16_t backlog, err_t *err)
{
struct tcp_pcb_listen *lpcb = NULL;
err_t res;
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index 92ea748..5e081f9 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -785,7 +785,7 @@ tcp_listen_input(struct tcp_pcb_listen *pcb)
SYN at a time when we have more memory available. */
if (npcb == NULL) {
err_t err;
- LWIP_DEBUGF(TCP_DEBUG, ("tcp_listen_input: could not allocate PCB\n"));
+ LWIP_DEBUGF(TCP_DEBUG | GAZELLE_DEBUG_SERIOUS, ("tcp_listen_input: could not allocate PCB\n"));
TCP_STATS_INC(tcp.memerr);
TCP_EVENT_ACCEPT(pcb, NULL, pcb->callback_arg, ERR_MEM, err);
LWIP_UNUSED_ARG(err); /* err not useful here */
diff --git a/src/include/lwip/api.h b/src/include/lwip/api.h
index 6e6e52d..5d03c24 100644
--- a/src/include/lwip/api.h
+++ b/src/include/lwip/api.h
@@ -366,7 +366,7 @@ err_t netconn_bind(struct netconn *conn, const ip_addr_t *addr, u16_t port);
err_t netconn_bind_if(struct netconn *conn, u8_t if_idx);
err_t netconn_connect(struct netconn *conn, const ip_addr_t *addr, u16_t port);
err_t netconn_disconnect (struct netconn *conn);
-err_t netconn_listen_with_backlog(struct netconn *conn, u8_t backlog);
+err_t netconn_listen_with_backlog(struct netconn *conn, u16_t backlog);
/** @ingroup netconn_tcp */
#define netconn_listen(conn) netconn_listen_with_backlog(conn, TCP_DEFAULT_LISTEN_BACKLOG)
err_t netconn_accept(struct netconn *conn, struct netconn **new_conn);
diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h
index e61b3f1..53b1946 100644
--- a/src/include/lwip/opt.h
+++ b/src/include/lwip/opt.h
@@ -1467,7 +1467,7 @@
* 0xff is the maximum (u8_t).
*/
#if !defined TCP_DEFAULT_LISTEN_BACKLOG || defined __DOXYGEN__
-#define TCP_DEFAULT_LISTEN_BACKLOG 0xff
+#define TCP_DEFAULT_LISTEN_BACKLOG 0xffff
#endif
/**
diff --git a/src/include/lwip/priv/api_msg.h b/src/include/lwip/priv/api_msg.h
index 9e8ffc9..b36f00a 100644
--- a/src/include/lwip/priv/api_msg.h
+++ b/src/include/lwip/priv/api_msg.h
@@ -145,7 +145,7 @@ struct api_msg {
#endif /* LWIP_IGMP || (LWIP_IPV6 && LWIP_IPV6_MLD) */
#if TCP_LISTEN_BACKLOG
struct {
- u8_t backlog;
+ u16_t backlog;
} lb;
#endif /* TCP_LISTEN_BACKLOG */
} msg;
diff --git a/src/include/lwip/tcp.h b/src/include/lwip/tcp.h
index bde17ec..5097179 100644
--- a/src/include/lwip/tcp.h
+++ b/src/include/lwip/tcp.h
@@ -249,8 +249,8 @@ struct tcp_pcb_listen {
#endif /* LWIP_CALLBACK_API */
#if TCP_LISTEN_BACKLOG
- u8_t backlog;
- u8_t accepts_pending;
+ u16_t backlog;
+ u16_t accepts_pending;
#endif /* TCP_LISTEN_BACKLOG */
#if GAZELLE_TCP_REUSE_IPPORT
@@ -574,8 +574,8 @@ void tcp_bind_netif(struct tcp_pcb *pcb, const struct netif *netif);
err_t tcp_connect (struct tcp_pcb *pcb, const ip_addr_t *ipaddr,
u16_t port, tcp_connected_fn connected);
-struct tcp_pcb * tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err);
-struct tcp_pcb * tcp_listen_with_backlog(struct tcp_pcb *pcb, u8_t backlog);
+struct tcp_pcb * tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u16_t backlog, err_t *err);
+struct tcp_pcb * tcp_listen_with_backlog(struct tcp_pcb *pcb, u16_t backlog);
/** @ingroup tcp_raw */
#define tcp_listen(pcb) tcp_listen_with_backlog(pcb, TCP_DEFAULT_LISTEN_BACKLOG)
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
index 4cd2d7a..d54ff1e 100644
--- a/src/include/lwipopts.h
+++ b/src/include/lwipopts.h
@@ -203,11 +203,11 @@
#define TCP_HLEN 20
-#define DEFAULT_ACCEPTMBOX_SIZE 1024
+#define DEFAULT_ACCEPTMBOX_SIZE 4096
#define DEFAULT_TCP_RECVMBOX_SIZE 4096
#define TCP_LISTEN_BACKLOG 1
-#define TCP_DEFAULT_LISTEN_BACKLOG 0xff
+#define TCP_DEFAULT_LISTEN_BACKLOG 0xffff
#define TCP_OVERSIZE TCP_MSS
#define LWIP_NETIF_TX_SINGLE_PBUF 1
--
2.33.0

View File

@ -0,0 +1,25 @@
From 2d01f8467027e5a640ee6c7ed72d64d8e0247829 Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Wed, 27 Dec 2023 10:40:54 +0800
Subject: [PATCH] remove duplicate log
---
src/core/tcp_in.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index 5e081f9..118210a 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -764,7 +764,7 @@ tcp_listen_input(struct tcp_pcb_listen *pcb)
if (flags & TCP_ACK) {
/* For incoming segments with the ACK flag set, respond with a
RST. */
- LWIP_DEBUGF(TCP_RST_DEBUG | GAZELLE_DEBUG_SERIOUS,
+ LWIP_DEBUGF(TCP_RST_DEBUG,
("tcp_listen_input: ACK in LISTEN, send reset, local_port=%d, remote_port=%d\n",
tcphdr->dest, tcphdr->src));
tcp_rst_netif(ip_data.current_input_netif, ackno, seqno + tcplen, ip_current_dest_addr(),
--
2.27.0

View File

@ -0,0 +1,142 @@
From 01be1587c5e6771da95d6cf8d387c0b5ba15c275 Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Wed, 27 Dec 2023 10:19:34 +0800
Subject: [PATCH] fix rte_ring_create time consuming
---
src/api/sockets.c | 2 +-
src/api/sys_arch.c | 63 ++++++++++++++++++++++++++++---------
src/include/arch/sys_arch.h | 4 +++
3 files changed, 54 insertions(+), 15 deletions(-)
diff --git a/src/api/sockets.c b/src/api/sockets.c
index 0cff4c4..d4cae53 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -2844,7 +2844,7 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
#endif
break;
case NETCONN_EVT_ERROR:
- if (conn->pending_err != ERR_OK) {
+ if ((conn->pending_err != ERR_OK) && (conn->pending_err != ERR_RST)) {
LWIP_DEBUGF(GAZELLE_DEBUG_SERIOUS, ("event_callback: have errevent, err=%d, fd=%d\n", conn->pending_err, conn->socket));
}
sock->errevent = 1;
diff --git a/src/api/sys_arch.c b/src/api/sys_arch.c
index 1bc3aee..b80c0a8 100644
--- a/src/api/sys_arch.c
+++ b/src/api/sys_arch.c
@@ -37,6 +37,7 @@
#include <unistd.h>
#include <rte_memzone.h>
+#include <rte_malloc.h>
#include "lwip/err.h"
#include "lwip/mem.h"
@@ -89,9 +90,50 @@ static int mbox_wait_func(void)
return eth_dev_poll();
}
+struct rte_ring *gazelle_ring_create_fast(const char *name, uint32_t size, uint32_t flags)
+{
+ ssize_t ring_size;
+ char ring_name[RTE_MEMZONE_NAMESIZE] = {0};
+ struct rte_ring *ring;
+
+ ring_size = rte_ring_get_memsize(size);
+ if (ring_size < 0) {
+ RTE_LOG(ERR, EAL, "rte_ring_get_memszie failed\n");
+ return NULL;
+ }
+
+ /*
+ * rte_ring_create is not used because it calls memzone_lookup_thread_unsafe function
+ * time consuming when there are many rings
+ */
+ ring = rte_malloc_socket(NULL, ring_size, RTE_CACHE_LINE_SIZE, rte_socket_id());
+ if (ring == NULL) {
+ RTE_LOG(ERR, EAL, "cannot create rte_ring for mbox\n");
+ return NULL;
+ }
+
+ if (snprintf(ring_name, sizeof(ring_name), "%s""%"PRIXPTR, name, (uintptr_t)ring) < 0) {
+ rte_free(ring);
+ RTE_LOG(ERR, EAL, "snprintf failed\n");
+ return NULL;
+ }
+
+ if (rte_ring_init(ring, ring_name, size, flags) != 0) {
+ rte_free(ring);
+ RTE_LOG(ERR, EAL, "cannot init rte_ring for mbox\n");
+ return NULL;
+ }
+
+ return ring;
+}
+
+void gazelle_ring_free_fast(struct rte_ring *ring)
+{
+ rte_free(ring);
+}
+
err_t sys_mbox_new(struct sys_mbox **mb, int size)
{
- int ret;
struct sys_mbox *mbox;
mbox = (struct sys_mbox *)memp_malloc(MEMP_SYS_MBOX);
@@ -100,21 +142,15 @@ err_t sys_mbox_new(struct sys_mbox **mb, int size)
}
mbox->flags = RING_F_SP_ENQ | RING_F_SC_DEQ;
-
- ret = snprintf(mbox->name, sizeof(mbox->name), MBOX_NAME_PREFIX"%"PRIXPTR, (uintptr_t)mbox);
- if (ret < 0) {
- memp_free(MEMP_SYS_MBOX, mbox);
- return ERR_VAL;
- }
-
mbox->size = size;
mbox->socket_id = rte_socket_id();
- mbox->ring = rte_ring_create(mbox->name, mbox->size, mbox->socket_id, mbox->flags);
- if (!mbox->ring) {
- RTE_LOG(ERR, EAL, "cannot create rte_ring for mbox\n");
- memp_free(MEMP_SYS_MBOX, mbox);
+
+ mbox->ring = gazelle_ring_create_fast(MBOX_NAME_PREFIX, mbox->size, mbox->flags);
+ if (mbox->ring == NULL) {
+ sys_mbox_free(&mbox);
return ERR_MEM;
}
+
mbox->wait_fn = mbox_wait_func;
*mb = mbox;
@@ -125,7 +161,7 @@ void sys_mbox_free(struct sys_mbox **mb)
{
struct sys_mbox *mbox = *mb;
if (mbox->ring != NULL) {
- rte_ring_free(mbox->ring);
+ gazelle_ring_free_fast(mbox->ring);
mbox->ring = NULL;
}
memp_free(MEMP_SYS_MBOX, mbox);
diff --git a/src/include/arch/sys_arch.h b/src/include/arch/sys_arch.h
index 5e95f3d..bf7e437 100644
--- a/src/include/arch/sys_arch.h
+++ b/src/include/arch/sys_arch.h
@@ -123,6 +123,10 @@ static __rte_always_inline uint32_t gazelle_st_ring_dequeue_burst(struct rte_rin
return n;
}
+
+void gazelle_ring_free_fast(struct rte_ring *ring);
+struct rte_ring *gazelle_ring_create_fast(const char *name, uint32_t size, uint32_t flags);
+
#endif
void sys_calibrate_tsc(void);
--
2.33.0

View File

@ -0,0 +1,85 @@
From 430469b1fa14ed689781eeed14dc8ce7cadd22a3 Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Mon, 5 Feb 2024 19:16:07 +0800
Subject: replace qtuple addr with gz_addr_t
---
src/include/lwip/priv/tcp_priv.h | 24 ++++++------------------
src/include/reg_sock.h | 19 ++++++++++++-------
2 files changed, 18 insertions(+), 25 deletions(-)
diff --git a/src/include/lwip/priv/tcp_priv.h b/src/include/lwip/priv/tcp_priv.h
index 75c67ee..8d7b9df 100644
--- a/src/include/lwip/priv/tcp_priv.h
+++ b/src/include/lwip/priv/tcp_priv.h
@@ -347,24 +347,12 @@ static inline int vdev_reg_done(enum reg_ring_type reg_type, const struct tcp_pc
LWIP_ASSERT("Invalid parameter", pcb != NULL);
struct gazelle_quintuple qtuple;
- if (IP_IS_V4_VAL(pcb->local_ip)) {
- qtuple.protocol = 0;
- qtuple.src_ip = ip_2_ip4(&pcb->local_ip)->addr;
- qtuple.src_port = lwip_htons(pcb->local_port);
- qtuple.dst_ip = ip_2_ip4(&pcb->remote_ip)->addr;
- qtuple.dst_port = lwip_htons(pcb->remote_port);
- } else {
-#if LWIP_IPV6
- qtuple.protocol = 1;
- qtuple.src_port = lwip_htons(pcb->local_port);
- qtuple.dst_port = lwip_htons(pcb->remote_port);
-
- for (int i = 0; i < 4; i++) {
- qtuple.src_ip6[i] = pcb->local_ip.u_addr.ip6.addr[i];
- qtuple.dst_ip6[i] = pcb->remote_ip.u_addr.ip6.addr[i];
- }
-#endif
- }
+
+ qtuple.protocol = IP_IS_V4_VAL(pcb->local_ip) ? GZ_ADDR_TYPE_V4 : GZ_ADDR_TYPE_V6;
+ qtuple.src_ip = *((gz_addr_t *)&pcb->local_ip);
+ qtuple.src_port = lwip_htons(pcb->local_port);
+ qtuple.dst_ip = *((gz_addr_t *)&pcb->remote_ip);
+ qtuple.dst_port = lwip_htons(pcb->remote_port);
#if GAZELLE_TCP_REUSE_IPPORT
if (reg_type == REG_RING_TCP_CONNECT_CLOSE) {
diff --git a/src/include/reg_sock.h b/src/include/reg_sock.h
index a11102e..466a2c2 100644
--- a/src/include/reg_sock.h
+++ b/src/include/reg_sock.h
@@ -37,6 +37,16 @@
#include "lwipopts.h"
+/* compatible with lwip_ip_addr_type */
+enum gz_ip_addr_type {
+ /** IPv4 */
+ GZ_ADDR_TYPE_V4 = 0U,
+ /** IPv6 */
+ GZ_ADDR_TYPE_V6 = 6U,
+ /** IPv4+IPv6 ("dual-stack") */
+ GZ_ADDR_TYPE_ANY = 46U
+};
+
/* compatible with ip4_addr_t */
struct gz_ip4 {
uint32_t addr;
@@ -78,13 +88,8 @@ struct gazelle_quintuple {
uint16_t src_port;
uint16_t dst_port;
- /* TODO: replace with gz_addr_t */
- uint32_t src_ip;
- uint32_t dst_ip;
-#if LWIP_IPV6
- uint32_t src_ip6[4];
- uint32_t dst_ip6[4];
-#endif
+ gz_addr_t src_ip;
+ gz_addr_t dst_ip;
};
struct reg_ring_msg {
--
2.33.0

View File

@ -0,0 +1,26 @@
From d926ce84920e03b150c60d842f8cd4c4cea671f5 Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Mon, 5 Feb 2024 19:16:37 +0800
Subject: fix wrong namelen in getaddrname
---
src/api/sockets.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/api/sockets.c b/src/api/sockets.c
index f3b8f8c..250c424 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -3063,7 +3063,8 @@ lwip_getaddrname(int s, struct sockaddr *name, socklen_t *namelen, u8_t local)
*namelen = IPADDR_SOCKADDR_GET_LEN(&saddr);
}
#else
- *namelen = LWIP_MIN(*namelen, sizeof(saddr));
+ u8_t sa_len = IP_IS_V4_VAL(naddr) ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6);
+ *namelen = LWIP_MIN(*namelen, sa_len);
#endif
MEMCPY(name, &saddr, *namelen);
--
2.33.0

View File

@ -0,0 +1,76 @@
From 105f7e2a5828d1999bdbf0bb64d336f22dc67859 Mon Sep 17 00:00:00 2001
From: yangchen <yangchen145@huawei.com>
Date: Mon, 8 Jan 2024 15:22:09 +0800
Subject: [PATCH] dfx: add tcp_in empty ack cnt and del rst invalid log
---
src/core/tcp_in.c | 8 ++++++--
src/include/lwip/stats.h | 1 +
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index 118210a..d6f54b6 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -523,6 +523,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
if (pcb->rcv_ann_wnd == 0) {
/* this is a zero-window probe, we respond to it with current RCV.NXT
and drop the data segment */
+ MIB2_STATS_INC(mib2.tcpinemptyacks);
tcp_send_empty_ack(pcb);
}
TCP_STATS_INC(tcp.drop);
@@ -687,8 +688,7 @@ aborted:
if (!(TCPH_FLAGS(tcphdr) & TCP_RST)) {
TCP_STATS_INC(tcp.proterr);
TCP_STATS_INC(tcp.drop);
- LWIP_DEBUGF(TCP_RST_DEBUG | GAZELLE_DEBUG_SERIOUS,
- ("tcp_input: no PCB match found, send RST, local_port=%d, remote_port=%d\n",
+ LWIP_DEBUGF(TCP_RST_DEBUG, ("tcp_input: no PCB match found, send RST, local_port=%d, remote_port=%d\n",
tcphdr->dest, tcphdr->src));
tcp_rst_netif(ip_data.current_input_netif, ackno, seqno + tcplen, ip_current_dest_addr(),
ip_current_src_addr(), tcphdr->dest, tcphdr->src);
@@ -1517,6 +1517,7 @@ tcp_receive(struct tcp_pcb *pcb)
/* End of ACK for new data processing. */
} else {
/* Out of sequence ACK, didn't really ack anything */
+ MIB2_STATS_INC(mib2.tcpinemptyacks);
tcp_send_empty_ack(pcb);
}
@@ -1818,6 +1819,7 @@ tcp_receive(struct tcp_pcb *pcb)
but lwIP currently does not support including SACKs in data packets. So we force
it to respond with an empty ACK packet (only if there is at least one SACK to be sent).
NOTE: tcp_send_empty_ack() on success clears the ACK flags (set by tcp_ack()) */
+ MIB2_STATS_INC(mib2.tcpinemptyacks);
tcp_send_empty_ack(pcb);
}
#endif /* LWIP_TCP_SACK_OUT */
@@ -2058,10 +2060,12 @@ tcp_receive(struct tcp_pcb *pcb)
/* We send the ACK packet after we've (potentially) dealt with SACKs,
so they can be included in the acknowledgment. */
+ MIB2_STATS_INC(mib2.tcpinemptyacks);
tcp_send_empty_ack(pcb);
}
} else {
/* The incoming segment is not within the window. */
+ MIB2_STATS_INC(mib2.tcpinemptyacks);
tcp_send_empty_ack(pcb);
}
} else {
diff --git a/src/include/lwip/stats.h b/src/include/lwip/stats.h
index 805836c..08c34e9 100644
--- a/src/include/lwip/stats.h
+++ b/src/include/lwip/stats.h
@@ -156,6 +156,7 @@ struct stats_mib2 {
u32_t tcpoutofseq;
u32_t tcpacceptmboxfull;
u32_t tcplistendrops;
+ u32_t tcpinemptyacks;
/* UDP */
u32_t udpindatagrams;
--
2.33.0

View File

@ -0,0 +1,280 @@
From 055e167029e3cee7ee8db8f8692efaec0300f374 Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Sat, 13 Jan 2024 20:52:37 +0800
Subject: [PATCH] adapt for dpdk-23.11
---
src/Makefile | 3 ---
src/core/ipv4/icmp.c | 2 +-
src/core/ipv4/ip4.c | 6 ++---
src/core/ipv4/ip4_frag.c | 4 ++--
src/core/ipv6/ip6.c | 2 +-
src/core/tcp_in.c | 2 +-
src/core/tcp_out.c | 6 ++---
src/core/udp.c | 4 ++--
src/include/dpdk_version.h | 46 ++++++++++++++++++++++++++++----------
src/netif/ethernet.c | 4 ++--
10 files changed, 49 insertions(+), 30 deletions(-)
diff --git a/src/Makefile b/src/Makefile
index 480470f..ce059e1 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -2,7 +2,12 @@ LWIP_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
ROOT_DIR := $(dir $(abspath $(LWIP_DIR)))
LWIP_INC = $(LWIP_DIR)/include
-DPDK_INCLUDE_FILE ?= /usr/include/dpdk
+DPDK_VERSION := $(shell rpm -q --queryformat '%{VERSION}' dpdk)
+ifeq ($(DPDK_VERSION),21.11)
+ DPDK_INCLUDE_FILE := /usr/local/include
+else
+ DPDK_INCLUDE_FILE := /usr/include/dpdk
+endif
SEC_FLAGS = -fstack-protector-strong -Werror -Wall -Wl,-z,relro,-z,now -Wl,-z,noexecstack -Wtrampolines -fPIC -D_FORTIRY_SOURCE=2 -O2
@@ -19,9 +24,6 @@ ARFLAGS = crDP
ifeq ($(shell $(CC) -dumpmachine | cut -d"-" -f1), x86_64)
CFLAGS += -mssse3
endif
-ifeq ($(DPDK_VERSION_1911), 1)
- CFLAGS += -DDPDK_VERSION_1911=1
-endif
SRCS =
DIRS = api core netif
diff --git a/src/core/ipv4/icmp.c b/src/core/ipv4/icmp.c
index 2984d24..a3de92d 100644
--- a/src/core/ipv4/icmp.c
+++ b/src/core/ipv4/icmp.c
@@ -241,7 +241,7 @@ icmp_input(struct pbuf *p, struct netif *inp)
#if CHECKSUM_GEN_IP
IF__NETIF_CHECKSUM_ENABLED(inp, NETIF_CHECKSUM_GEN_IP) {
#if CHECKSUM_GEN_IP_HW
- if (netif_get_txol_flags(inp) & DEV_TX_OFFLOAD_IPV4_CKSUM) {
+ if (netif_get_txol_flags(inp) & RTE_ETH_TX_OFFLOAD_IPV4_CKSUM) {
iph_cksum_set(p, hlen, 1);
} else {
iph_cksum_set(p, hlen, 0);
diff --git a/src/core/ipv4/ip4.c b/src/core/ipv4/ip4.c
index 4335423..907a2f0 100644
--- a/src/core/ipv4/ip4.c
+++ b/src/core/ipv4/ip4.c
@@ -543,7 +543,7 @@ ip4_input(struct pbuf *p, struct netif *inp)
IF__NETIF_CHECKSUM_ENABLED(inp, NETIF_CHECKSUM_CHECK_IP) {
#if CHECKSUM_CHECK_IP_HW
u64_t ret;
- if (netif_get_rxol_flags(inp) & DEV_RX_OFFLOAD_IPV4_CKSUM) {
+ if (netif_get_rxol_flags(inp) & RTE_ETH_RX_OFFLOAD_IPV4_CKSUM) {
ret = is_cksum_ipbad(p);
} else {
ret = (u64_t)inet_chksum(iphdr, iphdr_hlen);
@@ -1020,7 +1020,7 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d
#if CHECKSUM_GEN_IP
IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_IP) {
#if CHECKSUM_GEN_IP_HW
- if (netif_get_txol_flags(netif) & DEV_TX_OFFLOAD_IPV4_CKSUM) {
+ if (netif_get_txol_flags(netif) & RTE_ETH_TX_OFFLOAD_IPV4_CKSUM) {
iph_cksum_set(p, ip_hlen, 1);
} else {
iph_cksum_set(p, ip_hlen, 0);
@@ -1069,7 +1069,7 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d
#if IP_FRAG
/* don't fragment if interface has mtu set to 0 [loopif] */
#if GAZELLE_ENABLE
- if (!(netif_get_txol_flags(netif) & DEV_TX_OFFLOAD_TCP_TSO)) {
+ if (!(netif_get_txol_flags(netif) & RTE_ETH_TX_OFFLOAD_TCP_TSO)) {
#endif
if (netif->mtu && (p->tot_len > netif->mtu)) {
return ip4_frag(p, netif, dest);
diff --git a/src/core/ipv4/ip4_frag.c b/src/core/ipv4/ip4_frag.c
index 01e3d60..d9bf5cc 100644
--- a/src/core/ipv4/ip4_frag.c
+++ b/src/core/ipv4/ip4_frag.c
@@ -642,7 +642,7 @@ ip4_reass(struct pbuf *p)
#if CHECKSUM_GEN_IP
IF__NETIF_CHECKSUM_ENABLED(netif_default, NETIF_CHECKSUM_GEN_IP) {
#if CHECKSUM_GEN_IP_HW
- if (netif_get_txol_flags(netif_default) & DEV_TX_OFFLOAD_IPV4_CKSUM) {
+ if (netif_get_txol_flags(netif_default) & RTE_ETH_TX_OFFLOAD_IPV4_CKSUM) {
iph_cksum_set(p, IP_HLEN, 1);
} else {
iph_cksum_set(p, IP_HLEN, 0);
@@ -885,7 +885,7 @@ ip4_frag(struct pbuf *p, struct netif *netif, const ip4_addr_t *dest)
#if CHECKSUM_GEN_IP
IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_IP) {
#if CHECKSUM_GEN_IP_HW
- if (netif_get_txol_flags(netif) & DEV_TX_OFFLOAD_IPV4_CKSUM) {
+ if (netif_get_txol_flags(netif) & RTE_ETH_TX_OFFLOAD_IPV4_CKSUM) {
iph_cksum_set(p, IP_HLEN, 1);
} else {
iph_cksum_set(p, IP_HLEN, 0);
diff --git a/src/core/ipv6/ip6.c b/src/core/ipv6/ip6.c
index 5f16cd0..9017d87 100644
--- a/src/core/ipv6/ip6.c
+++ b/src/core/ipv6/ip6.c
@@ -1279,7 +1279,7 @@ ip6_output_if_src(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
#if LWIP_IPV6_FRAG
/* don't fragment if interface has mtu set to 0 [loopif] */
#if GAZELLE_ENABLE
- if (!(netif_get_txol_flags(netif) & DEV_TX_OFFLOAD_TCP_TSO)) {
+ if (!(netif_get_txol_flags(netif) & RTE_ETH_TX_OFFLOAD_TCP_TSO)) {
#endif
if (netif_mtu6(netif) && (p->tot_len > nd6_get_destination_mtu(dest, netif))) {
return ip6_frag(p, netif, dest);
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index d6f54b6..bdd9a04 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -209,7 +209,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
/* Verify TCP checksum. */
#if CHECKSUM_CHECK_TCP_HW
u64_t ret;
- if (netif_get_rxol_flags(inp) & DEV_RX_OFFLOAD_TCP_CKSUM) {
+ if (netif_get_rxol_flags(inp) & RTE_ETH_RX_OFFLOAD_TCP_CKSUM) {
ret = is_cksum_bad(p);
} else {
ret = (u64_t)ip_chksum_pseudo(p, IP_PROTO_TCP, p->tot_len,
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
index c5c81ae..30cd215 100644
--- a/src/core/tcp_out.c
+++ b/src/core/tcp_out.c
@@ -1555,7 +1555,7 @@ tcp_output(struct tcp_pcb *pcb)
/* data available and window allows it to be sent? */
#if GAZELLE_ENABLE
- if ((netif_get_txol_flags(netif) & DEV_TX_OFFLOAD_TCP_TSO) && pcb->need_tso_send) {
+ if ((netif_get_txol_flags(netif) & RTE_ETH_TX_OFFLOAD_TCP_TSO) && pcb->need_tso_send) {
uint16_t send_pkt = 0;
do {
@@ -1938,7 +1938,7 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
#if CHECKSUM_GEN_TCP
IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_TCP) {
#if CHECKSUM_GEN_TCP_HW
- if (netif_get_txol_flags(netif) & DEV_TX_OFFLOAD_TCP_CKSUM) {
+ if (netif_get_txol_flags(netif) & RTE_ETH_TX_OFFLOAD_TCP_CKSUM) {
tcph_cksum_set(seg->p, TCPH_HDRLEN_BYTES(seg->tcphdr));
seg->tcphdr->chksum = ip_chksum_pseudo_offload(IP_PROTO_TCP,seg->p->tot_len, &pcb->local_ip, &pcb->remote_ip);
} else {
@@ -2398,7 +2398,7 @@ tcp_output_control_segment_netif(const struct tcp_pcb *pcb, struct pbuf *p,
IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_TCP) {
struct tcp_hdr *tcphdr = (struct tcp_hdr *)p->payload;
#if CHECKSUM_GEN_TCP_HW
- if (netif_get_txol_flags(netif) & DEV_TX_OFFLOAD_TCP_CKSUM) {
+ if (netif_get_txol_flags(netif) & RTE_ETH_TX_OFFLOAD_TCP_CKSUM) {
tcph_cksum_set(p, TCPH_HDRLEN_BYTES(tcphdr));
tcphdr->chksum = ip_chksum_pseudo_offload(IP_PROTO_TCP, p->tot_len, src, dst);
} else {
diff --git a/src/core/udp.c b/src/core/udp.c
index ca82e51..461ec2d 100644
--- a/src/core/udp.c
+++ b/src/core/udp.c
@@ -414,7 +414,7 @@ udp_input(struct pbuf *p, struct netif *inp)
if (udphdr->chksum != 0) {
#if CHECKSUM_CHECK_UDP_HW
u64_t ret = 0;
- if (netif_get_rxol_flags(inp) & DEV_RX_OFFLOAD_UDP_CKSUM) {
+ if (netif_get_rxol_flags(inp) & RTE_ETH_RX_OFFLOAD_UDP_CKSUM) {
ret = is_cksum_bad(p);
} else {
ret = ip_chksum_pseudo(p, IP_PROTO_UDP, p->tot_len,
@@ -983,7 +983,7 @@ udp_sendto_if_src_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *d
#endif /* LWIP_CHECKSUM_ON_COPY */
{
#if CHECKSUM_GEN_UDP_HW
- if (netif_get_txol_flags(netif) & DEV_TX_OFFLOAD_UDP_CKSUM) {
+ if (netif_get_txol_flags(netif) & RTE_ETH_TX_OFFLOAD_UDP_CKSUM) {
udph_cksum_set(q, UDP_HLEN);
udpchksum = ip_chksum_pseudo_offload(IP_PROTO_UDP, q->tot_len, &pcb->local_ip, &pcb->remote_ip);
} else {
diff --git a/src/include/dpdk_version.h b/src/include/dpdk_version.h
index 5efaa39..df3adb5 100644
--- a/src/include/dpdk_version.h
+++ b/src/include/dpdk_version.h
@@ -33,23 +33,47 @@
#ifndef __DPDK_VERSION_H__
#define __DPDK_VERSION_H__
-#if DPDK_VERSION_1911
+#include <rte_version.h>
+
+#if RTE_VERSION < RTE_VERSION_NUM(21, 11, 0, 0)
#define __rte_ring_enqueue_elems(r, prod_head, obj_table, esize, n) \
ENQUEUE_PTRS(r, &r[1], prod_head, (obj_table), n, void *)
#define __rte_ring_dequeue_elems(r, cons_head, obj_table, esize, n) \
DEQUEUE_PTRS(r, &r[1], cons_head, (obj_table), n, void *)
-#define RTE_MBUF_F_RX_IP_CKSUM_BAD PKT_RX_IP_CKSUM_BAD
-#define RTE_MBUF_F_RX_L4_CKSUM_BAD PKT_RX_L4_CKSUM_BAD
-#define RTE_MBUF_F_TX_IPV4 PKT_TX_IPV4
-#define RTE_MBUF_F_TX_IPV6 PKT_TX_IPV6
-#define RTE_MBUF_F_TX_IP_CKSUM PKT_TX_IP_CKSUM
-#define RTE_MBUF_F_TX_TCP_CKSUM PKT_TX_TCP_CKSUM
-#define RTE_MBUF_F_TX_TCP_SEG PKT_TX_TCP_SEG
-#define RTE_MBUF_F_TX_UDP_CKSUM PKT_TX_UDP_CKSUM
-#define RTE_MBUF_F_TX_VLAN PKT_TX_VLAN_PKT
-
-#endif /* DPDK_VERSION_1911 */
+#define RTE_MBUF_F_RX_IP_CKSUM_BAD PKT_RX_IP_CKSUM_BAD
+#define RTE_MBUF_F_RX_L4_CKSUM_BAD PKT_RX_L4_CKSUM_BAD
+#define RTE_MBUF_F_TX_IPV4 PKT_TX_IPV4
+#define RTE_MBUF_F_TX_IPV6 PKT_TX_IPV6
+#define RTE_MBUF_F_TX_IP_CKSUM PKT_TX_IP_CKSUM
+#define RTE_MBUF_F_TX_TCP_CKSUM PKT_TX_TCP_CKSUM
+#define RTE_MBUF_F_TX_TCP_SEG PKT_TX_TCP_SEG
+#define RTE_MBUF_F_TX_UDP_CKSUM PKT_TX_UDP_CKSUM
+#define RTE_MBUF_F_TX_VLAN PKT_TX_VLAN_PKT
+
+#define RTE_ETH_RX_OFFLOAD_TCP_CKSUM DEV_RX_OFFLOAD_TCP_CKSUM
+#define RTE_ETH_RX_OFFLOAD_UDP_CKSUM DEV_RX_OFFLOAD_UDP_CKSUM
+#define RTE_ETH_RX_OFFLOAD_IPV4_CKSUM DEV_RX_OFFLOAD_IPV4_CKSUM
+#define RTE_ETH_RX_OFFLOAD_VLAN_STRIP DEV_RX_OFFLOAD_VLAN_STRIP
+
+#define RTE_ETH_TX_OFFLOAD_IPV4_CKSUM DEV_TX_OFFLOAD_IPV4_CKSUM
+#define RTE_ETH_TX_OFFLOAD_VLAN_INSERT DEV_TX_OFFLOAD_VLAN_INSERT
+#define RTE_ETH_TX_OFFLOAD_TCP_TSO DEV_TX_OFFLOAD_TCP_TSO
+#define RTE_ETH_TX_OFFLOAD_TCP_CKSUM DEV_TX_OFFLOAD_TCP_CKSUM
+#define RTE_ETH_TX_OFFLOAD_UDP_CKSUM DEV_TX_OFFLOAD_UDP_CKSUM
+#define RTE_ETH_TX_OFFLOAD_MULTI_SEGS DEV_TX_OFFLOAD_MULTI_SEGS
+
+#define RTE_ETH_LINK_SPEED_AUTONEG ETH_LINK_SPEED_AUTONEG
+
+#define RTE_ETH_MQ_TX_NONE ETH_MQ_TX_NONE
+#define RTE_ETH_MQ_RX_NONE ETH_MQ_RX_NONE
+#define RTE_ETH_RSS_IP ETH_RSS_IP
+#define RTE_ETH_RSS_TCP ETH_RSS_TCP
+#define RTE_ETH_RSS_UDP ETH_RSS_UDP
+#define RTE_ETH_MQ_RX_RSS ETH_MQ_RX_RSS
+#define RTE_ETH_RETA_GROUP_SIZE RTE_RETA_GROUP_SIZE
+
+#endif /* RTE_VERSION */
#endif /* __DPDK_VERSION_H__ */
diff --git a/src/netif/ethernet.c b/src/netif/ethernet.c
index d2960b5..e049cdf 100644
--- a/src/netif/ethernet.c
+++ b/src/netif/ethernet.c
@@ -289,7 +289,7 @@ ethernet_output(struct netif * netif, struct pbuf * p,
}
#else
if (netif->vlan_enable) {
- if (netif->txol_flags & DEV_TX_OFFLOAD_VLAN_INSERT) {
+ if (netif->txol_flags & RTE_ETH_TX_OFFLOAD_VLAN_INSERT) {
p->ol_flags |= RTE_MBUF_F_TX_VLAN;
p->vlan_tci = netif->vlan_tci;
} else {
@@ -332,7 +332,7 @@ ethernet_output(struct netif * netif, struct pbuf * p,
("ethernet_output: sending packet %p\n", (void *)p));
#if CHECKSUM_GEN_IP_HW || CHECKSUM_GEN_TCP_HW
- if (netif->vlan_enable && !(netif->txol_flags & DEV_TX_OFFLOAD_VLAN_INSERT)) {
+ if (netif->vlan_enable && !(netif->txol_flags & RTE_ETH_TX_OFFLOAD_VLAN_INSERT)) {
ethh_cksum_set(p, sizeof(*ethhdr) + SIZEOF_VLAN_HDR);
} else {
ethh_cksum_set(p, sizeof(*ethhdr));
--
2.33.0

View File

@ -0,0 +1,71 @@
From d491c37cce3796ddce32b30be7ad23d52937479e Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Mon, 5 Feb 2024 19:18:52 +0800
Subject: optimize enqueue for unacked and unsent queue
---
src/core/tcp_out.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
index 30cd215..1ab5cfb 100644
--- a/src/core/tcp_out.c
+++ b/src/core/tcp_out.c
@@ -1636,6 +1636,10 @@ tcp_output(struct tcp_pcb *pcb)
pbuf_remove_header(new_seg.p, new_seg.p->tot_len - new_seg.len - TCP_HLEN);
new_seg.p->tot_len = new_seg.p->len;
+ struct tcp_seg **cur_seg = NULL;
+ if (pcb->unacked != NULL) {
+ cur_seg = &(pcb->unacked);
+ }
for (int start = pbuf_chain_len; start > 0; start--) {
struct tcp_seg *tmp_seg = start_seg;
start_seg = start_seg->next;
@@ -1646,10 +1650,10 @@ tcp_output(struct tcp_pcb *pcb)
pcb->last_unacked = tmp_seg;
pcb->unacked = tmp_seg;
useg = tmp_seg;
+ cur_seg = &(pcb->unacked);
} else {
if (TCP_SEQ_LT(lwip_ntohl(tmp_seg->tcphdr->seqno), lwip_ntohl(useg->tcphdr->seqno))) {
/* add segment to before tail of unacked list, keeping the list sorted */
- struct tcp_seg **cur_seg = &(pcb->unacked);
while (*cur_seg &&
TCP_SEQ_LT(lwip_ntohl((*cur_seg)->tcphdr->seqno), lwip_ntohl(tmp_seg->tcphdr->seqno))) {
cur_seg = &((*cur_seg)->next );
@@ -2160,7 +2164,10 @@ tcp_rexmit(struct tcp_pcb *pcb)
}
seg = pcb->unacked;
+#if GAZELLE_ENABLE
+ cur_seg = &(pcb->unsent);
while (seg) {
+#endif
/* Give up if the segment is still referenced by the netif driver
due to deferred transmission. */
if (tcp_output_segment_busy(seg)) {
@@ -2177,7 +2184,9 @@ tcp_rexmit(struct tcp_pcb *pcb)
pcb->last_unacked = pcb->unacked->next;
pcb->unacked = pcb->unacked->next;
+#if !GAZELLE_ENABLE
cur_seg = &(pcb->unsent);
+#endif
while (*cur_seg &&
TCP_SEQ_LT(lwip_ntohl((*cur_seg)->tcphdr->seqno), lwip_ntohl(seg->tcphdr->seqno))) {
cur_seg = &((*cur_seg)->next);
@@ -2193,8 +2202,10 @@ tcp_rexmit(struct tcp_pcb *pcb)
}
#endif /* TCP_OVERSIZE */
+#if GAZELLE_ENABLE
seg = pcb->unacked;
}
+#endif
if (pcb->nrtx < 0xFF) {
++pcb->nrtx;
--
2.33.0

View File

@ -0,0 +1,91 @@
From ed49e784233ec0a83eb4f4e37fe9cd112bfed555 Mon Sep 17 00:00:00 2001
From: hantwofish <hankangkang5@huawei.com>
Date: Wed, 10 Jan 2024 09:31:23 +0800
Subject: [PATCH] delete redundant logs in lwip
---
src/api/sockets.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/src/api/sockets.c b/src/api/sockets.c
index 250c424..082ae14 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -487,7 +487,7 @@ tryget_socket_unconn_nouse(int fd)
if ((s < 0) || (s >= NUM_SOCKETS))
#endif /* GAZELLE_ENABLE */
{
- LWIP_DEBUGF(SOCKETS_DEBUG | GAZELLE_DEBUG_SERIOUS, ("tryget_socket_unconn(%d): invalid\n", fd));
+ LWIP_DEBUGF(SOCKETS_DEBUG , ("tryget_socket_unconn(%d): invalid\n", fd));
return NULL;
}
return &sockets[s];
@@ -561,7 +561,7 @@ get_socket(int fd)
struct lwip_sock *sock = tryget_socket(fd);
if (!sock) {
if ((fd < LWIP_SOCKET_OFFSET) || (fd >= (LWIP_SOCKET_OFFSET + NUM_SOCKETS))) {
- LWIP_DEBUGF(SOCKETS_DEBUG | GAZELLE_DEBUG_SERIOUS, ("get_socket(%d): invalid\n", fd));
+ LWIP_DEBUGF(SOCKETS_DEBUG , ("get_socket(%d): invalid\n", fd));
}
set_errno(EBADF);
return NULL;
@@ -628,7 +628,6 @@ alloc_socket(struct netconn *newconn, int accepted, int flags)
SYS_ARCH_PROTECT(lev);
i = posix_api->socket_fn(domain, type, protocol);
if (i == -1) {
- LWIP_DEBUGF(SOCKETS_DEBUG | GAZELLE_DEBUG_SERIOUS, ("posix_api->socket_fn fail socket is -1"));
goto err;
}
@@ -637,7 +636,6 @@ alloc_socket(struct netconn *newconn, int accepted, int flags)
}
if ((i < LWIP_SOCKET_OFFSET) || (i >= sockets_num + LWIP_SOCKET_OFFSET)) {
- LWIP_DEBUGF(SOCKETS_DEBUG | GAZELLE_DEBUG_SERIOUS, ("posix_api->socket_fn socket is %d, illegal\n", i));
goto err;
}
@@ -808,14 +806,13 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d)...\n", s));
sock = get_socket(s);
if (!sock) {
- LWIP_DEBUGF(SOCKETS_DEBUG | GAZELLE_DEBUG_SERIOUS, ("get_socket sock is null\n"));
return -1;
}
/* wait for a new connection */
err = netconn_accept(sock->conn, &newconn);
if (err != ERR_OK) {
- LWIP_DEBUGF(SOCKETS_DEBUG | GAZELLE_DEBUG_SERIOUS, ("lwip_accept(%d): netconn_acept failed, err=%d\n", s, err));
+ LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d): netconn_acept failed, err=%d\n", s, err));
if (NETCONNTYPE_GROUP(netconn_type(sock->conn)) != NETCONN_TCP) {
set_errno(EOPNOTSUPP);
} else if (err == ERR_CLSD) {
@@ -830,7 +827,6 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
newsock = alloc_socket(newconn, 1, flags);
if (newsock == -1) {
- LWIP_DEBUGF(SOCKETS_DEBUG | GAZELLE_DEBUG_SERIOUS, ("alloc_socket fail newsock is -1\n"));
netconn_delete(newconn);
set_errno(ENFILE);
done_socket(sock);
@@ -850,7 +846,6 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
ret = find_same_node_memzone(pcb, nsock);
}
if (pcb == NULL || ret != 0) {
- LWIP_DEBUGF(SOCKETS_DEBUG | GAZELLE_DEBUG_SERIOUS, ("alloc_socket fail pcb null flag=%u, ret=%d \n", (pcb == NULL), ret));
netconn_delete(newconn);
free_socket(nsock, 1);
sock_set_errno(sock, ENOTCONN);
@@ -886,7 +881,7 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
/* get the IP address and port of the remote host */
err = netconn_peer(newconn, &naddr, &port);
if (err != ERR_OK) {
- LWIP_DEBUGF(SOCKETS_DEBUG | GAZELLE_DEBUG_SERIOUS, ("lwip_accept(%d): netconn_peer failed, err=%d\n", s, err));
+ LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d): netconn_peer failed, err=%d\n", s, err));
free_socket(nsock, 1);
set_errno(err_to_errno(err));
done_socket(sock);
--
2.33.0

View File

@ -0,0 +1,228 @@
From bb07cd2f26a91c4f5396f2e19a409e4014e7a7e8 Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Fri, 19 Jan 2024 20:44:54 +0800
Subject: [PATCH] remove unnecessary variables in struct pbuf
---
src/core/pbuf.c | 5 ++--
src/core/tcp_out.c | 3 +-
src/core/udp.c | 4 +--
src/include/dpdk_cksum.h | 60 ++++++++++++++++++++--------------------
src/include/lwip/pbuf.h | 12 --------
src/netif/ethernet.c | 3 +-
6 files changed, 36 insertions(+), 51 deletions(-)
diff --git a/src/core/pbuf.c b/src/core/pbuf.c
index 8386c90..b0a63b4 100644
--- a/src/core/pbuf.c
+++ b/src/core/pbuf.c
@@ -86,6 +86,7 @@
#endif
#if GAZELLE_ENABLE
#include <rte_prefetch.h>
+#include "dpdk_cksum.h"
#endif
#include <string.h>
@@ -1038,9 +1039,7 @@ pbuf_copy_partial_pbuf(struct pbuf *p_to, const struct pbuf *p_from, u16_t copy_
}
#if GAZELLE_ENABLE && (CHECKSUM_GEN_IP_HW || CHECKSUM_GEN_TCP_HW)
- p_to->l2_len = p_from->l2_len;
- p_to->l3_len = p_from->l3_len;
- p_to->ol_flags = p_from->ol_flags;
+ pbuf_offload_copy(p_to, p_from);
#endif
len = LWIP_MIN(copy_len, len);
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
index 1ab5cfb..70c4242 100644
--- a/src/core/tcp_out.c
+++ b/src/core/tcp_out.c
@@ -1944,7 +1944,6 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
#if CHECKSUM_GEN_TCP_HW
if (netif_get_txol_flags(netif) & RTE_ETH_TX_OFFLOAD_TCP_CKSUM) {
tcph_cksum_set(seg->p, TCPH_HDRLEN_BYTES(seg->tcphdr));
- seg->tcphdr->chksum = ip_chksum_pseudo_offload(IP_PROTO_TCP,seg->p->tot_len, &pcb->local_ip, &pcb->remote_ip);
} else {
#if TCP_CHECKSUM_ON_COPY
u32_t acc;
@@ -2408,10 +2407,10 @@ tcp_output_control_segment_netif(const struct tcp_pcb *pcb, struct pbuf *p,
#if CHECKSUM_GEN_TCP
IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_TCP) {
struct tcp_hdr *tcphdr = (struct tcp_hdr *)p->payload;
+ tcphdr->chksum = 0;
#if CHECKSUM_GEN_TCP_HW
if (netif_get_txol_flags(netif) & RTE_ETH_TX_OFFLOAD_TCP_CKSUM) {
tcph_cksum_set(p, TCPH_HDRLEN_BYTES(tcphdr));
- tcphdr->chksum = ip_chksum_pseudo_offload(IP_PROTO_TCP, p->tot_len, src, dst);
} else {
tcphdr->chksum = ip_chksum_pseudo(p, IP_PROTO_TCP, p->tot_len,
src, dst);
diff --git a/src/core/udp.c b/src/core/udp.c
index 461ec2d..440f909 100644
--- a/src/core/udp.c
+++ b/src/core/udp.c
@@ -985,7 +985,7 @@ udp_sendto_if_src_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *d
#if CHECKSUM_GEN_UDP_HW
if (netif_get_txol_flags(netif) & RTE_ETH_TX_OFFLOAD_UDP_CKSUM) {
udph_cksum_set(q, UDP_HLEN);
- udpchksum = ip_chksum_pseudo_offload(IP_PROTO_UDP, q->tot_len, &pcb->local_ip, &pcb->remote_ip);
+ udpchksum = 0;
} else {
udpchksum = ip_chksum_pseudo(q, IP_PROTO_UDP, q->tot_len,
src_ip, dst_ip);
@@ -1019,7 +1019,7 @@ udp_sendto_if_src_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *d
/* output to IP */
NETIF_SET_HINTS(netif, &(pcb->netif_hints));
#if GAZELLE_UDP_ENABLE
- q->l4_len = UDP_HLEN;
+ PBUF_TO_MBUF(q)->l4_len = UDP_HLEN;
#endif /* GAZELLE_UDP_ENABLE */
err = ip_output_if_src(q, src_ip, dst_ip, ttl, pcb->tos, ip_proto, netif);
NETIF_RESET_HINTS(netif);
diff --git a/src/include/dpdk_cksum.h b/src/include/dpdk_cksum.h
index 38cfb96..115155d 100644
--- a/src/include/dpdk_cksum.h
+++ b/src/include/dpdk_cksum.h
@@ -45,32 +45,48 @@
#include "lwip/pbuf.h"
#endif
+#define PBUF_TO_MBUF(p) ((struct rte_mbuf *)RTE_PTR_SUB(p, sizeof(struct rte_mbuf)))
+
+static inline void pbuf_offload_copy(struct pbuf *to, const struct pbuf *from)
+{
+ PBUF_TO_MBUF(to)->l4_len = PBUF_TO_MBUF(from)->l4_len;
+ PBUF_TO_MBUF(to)->l3_len = PBUF_TO_MBUF(from)->l3_len;
+ PBUF_TO_MBUF(to)->l2_len = PBUF_TO_MBUF(from)->l2_len;
+ PBUF_TO_MBUF(to)->ol_flags = PBUF_TO_MBUF(from)->ol_flags;
+}
+
+static inline void pbuf_set_vlan(struct pbuf *p, u16_t vlan_tci)
+{
+ PBUF_TO_MBUF(p)->ol_flags |= RTE_MBUF_F_TX_VLAN;
+ PBUF_TO_MBUF(p)->vlan_tci = vlan_tci;
+}
+
#if CHECKSUM_CHECK_IP_HW
// for ip4_input
static inline u64_t is_cksum_ipbad(struct pbuf *p) {
- return p->ol_flags & (RTE_MBUF_F_RX_IP_CKSUM_BAD);
+ return PBUF_TO_MBUF(p)->ol_flags & (RTE_MBUF_F_RX_IP_CKSUM_BAD);
}
#endif /* CHECKSUM_CHECK_IP_HW */
#if (CHECKSUM_CHECK_TCP_HW || CHECKSUM_CHECK_UDP_HW)
// for tcp_input and udp_input
static inline u64_t is_cksum_bad(struct pbuf *p) {
- return p->ol_flags & (RTE_MBUF_F_RX_L4_CKSUM_BAD);
+ return PBUF_TO_MBUF(p)->ol_flags & (RTE_MBUF_F_RX_L4_CKSUM_BAD);
}
#endif /* (CHECKSUM_CHECK_TCP_HW || CHECKSUM_CHECK_UDP_HW) */
#if CHECKSUM_GEN_IP_HW
static inline void ethh_cksum_set(struct pbuf *p, u16_t len) {
- p->l2_len = len;
+ PBUF_TO_MBUF(p)->l2_len = len;
}
// replaces IPH_CHKSUM_SET
static inline void iph_cksum_set(struct pbuf *p, u16_t len, bool do_ipcksum) {
- p->ol_flags |= ((len == IP_HLEN) ? RTE_MBUF_F_TX_IPV4 : RTE_MBUF_F_TX_IPV6);
+ PBUF_TO_MBUF(p)->ol_flags |= ((len == IP_HLEN) ? RTE_MBUF_F_TX_IPV4 : RTE_MBUF_F_TX_IPV6);
if (do_ipcksum) {
- p->ol_flags |= RTE_MBUF_F_TX_IP_CKSUM;
+ PBUF_TO_MBUF(p)->ol_flags |= RTE_MBUF_F_TX_IP_CKSUM;
}
- p->l3_len = len;
+ PBUF_TO_MBUF(p)->l3_len = len;
}
#endif /* CHECKSUM_GEN_IP_HW */
@@ -80,37 +96,17 @@ static inline void iph_cksum_set(struct pbuf *p, u16_t len, bool do_ipcksum) {
#if CHECKSUM_GEN_TCP_HW
static inline void tcph_cksum_set(struct pbuf *p, u16_t len) {
- p->l4_len = len;
- p->ol_flags |= RTE_MBUF_F_TX_TCP_CKSUM;
+ PBUF_TO_MBUF(p)->l4_len = len;
+ PBUF_TO_MBUF(p)->ol_flags |= RTE_MBUF_F_TX_TCP_CKSUM;
}
#endif /* CHECKSUM_GEN_TCP_HW */
#if CHECKSUM_GEN_UDP_HW
static inline void udph_cksum_set(struct pbuf *p, u16_t len) {
- p->l4_len = len;
- p->ol_flags |= RTE_MBUF_F_TX_UDP_CKSUM;
+ PBUF_TO_MBUF(p)->l4_len = len;
+ PBUF_TO_MBUF(p)->ol_flags |= RTE_MBUF_F_TX_UDP_CKSUM;
}
#endif /* CHECKSUM_GEN_UDP_HW */
-
-static inline u16_t ip_chksum_pseudo_offload(u8_t proto, u16_t proto_len,
- const ip_addr_t *src, const ip_addr_t *dst)
-{
- struct ip_psd_header {
- ip_addr_t src_addr; /* IP address of source host. */
- ip_addr_t dst_addr; /* IP address of destination host. */
- uint8_t zero; /* zero. */
- uint8_t proto; /* L4 protocol type. */
- uint16_t len; /* L4 length. */
- } psd_hdr;
-
- ip_addr_copy(psd_hdr.src_addr, *src);
- ip_addr_copy(psd_hdr.dst_addr, *dst);
- psd_hdr.proto = proto;
- psd_hdr.len = lwip_htons(proto_len);
- psd_hdr.zero = 0;
-
- return rte_raw_cksum(&psd_hdr, sizeof(psd_hdr));
-}
#endif /* (CHECKSUM_GEN_TCP_HW || CHECKSUM_GEN_UDP_HW) */
#endif /* GAZELLE_ENABLE */
diff --git a/src/include/lwip/pbuf.h b/src/include/lwip/pbuf.h
index bc29372..d84c9da 100644
--- a/src/include/lwip/pbuf.h
+++ b/src/include/lwip/pbuf.h
@@ -225,22 +225,9 @@ struct pbuf {
u8_t if_idx;
#if GAZELLE_ENABLE && CHECKSUM_OFFLOAD_ALL
- /** checksum offload ol_flags */
- u64_t ol_flags;
- /* < L2 (MAC) Header Length for non-tunneling pkt. */
- u64_t l2_len:7;
- /* < L3 (IP) Header Length. */
- u64_t l3_len:9;
- /* < L4 (TCP/UDP) Header Length. */
- u64_t l4_len:8;
- u8_t header_off;
- u8_t rexmit;
volatile u8_t allow_in;
- u8_t head;
- struct pbuf *last;
pthread_spinlock_t pbuf_lock;
struct tcp_pcb *pcb;
- u16_t vlan_tci;
#if GAZELLE_UDP_ENABLE
ip_addr_t addr;
u16_t port;
diff --git a/src/netif/ethernet.c b/src/netif/ethernet.c
index e049cdf..0d8652b 100644
--- a/src/netif/ethernet.c
+++ b/src/netif/ethernet.c
@@ -290,8 +290,7 @@ ethernet_output(struct netif * netif, struct pbuf * p,
#else
if (netif->vlan_enable) {
if (netif->txol_flags & RTE_ETH_TX_OFFLOAD_VLAN_INSERT) {
- p->ol_flags |= RTE_MBUF_F_TX_VLAN;
- p->vlan_tci = netif->vlan_tci;
+ pbuf_set_vlan(p, netif->vlan_tci);
} else {
vlan_prio_vid = netif->vlan_tci;
}
--
2.33.0

View File

@ -0,0 +1,27 @@
From e2754cc316ca1fadabfbd8c927275a0d0d50d867 Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Tue, 30 Jan 2024 15:38:13 +0800
Subject: [PATCH] fix move lpcb to the front of list error
---
src/core/tcp_in.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index ec1905f..9d5a695 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -454,6 +454,10 @@ tcp_input(struct pbuf *p, struct netif *inp)
/* our successor is the remainder of the listening list */
lpcb->next = tcp_listen_pcbs.listen_pcbs;
#if GAZELLE_ENABLE
+ /* prev is head */
+ if (prev->prev == NULL) {
+ prev->prev = (struct tcp_pcb *)lpcb;
+ }
lpcb->prev = NULL;
#endif
/* put this listening pcb at the head of the listening list */
--
2.33.0

View File

@ -0,0 +1,59 @@
From 7dbceaeab7f85df6a58b77858c507fa9087d5ba7 Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Mon, 22 Jan 2024 20:38:57 +0800
Subject: [PATCH] fix receive fin packet process error
---
src/core/tcp_in.c | 9 ---------
src/include/lwipsock.h | 1 +
2 files changed, 1 insertion(+), 9 deletions(-)
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index 9d5a695..84d22ca 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -1142,9 +1142,6 @@ tcp_process(struct tcp_pcb *pcb)
if (recv_flags & TF_GOT_FIN) {
tcp_ack_now(pcb);
pcb->state = CLOSE_WAIT;
-#if GAZELLE_ENABLE
- API_EVENT(((struct netconn *)pcb->callback_arg), NETCONN_EVT_ERROR, 0);
-#endif
}
} else {
/* incorrect ACK number, send RST */
@@ -1163,9 +1160,6 @@ tcp_process(struct tcp_pcb *pcb)
if (recv_flags & TF_GOT_FIN) { /* passive close */
tcp_ack_now(pcb);
pcb->state = CLOSE_WAIT;
-#if GAZELLE_ENABLE
- API_EVENT(((struct netconn *)pcb->callback_arg), NETCONN_EVT_ERROR, 0);
-#endif
}
break;
case FIN_WAIT_1:
@@ -1820,9 +1814,6 @@ tcp_receive(struct tcp_pcb *pcb)
recv_flags |= TF_GOT_FIN;
if (pcb->state == ESTABLISHED) { /* force passive close or we can move to active close */
pcb->state = CLOSE_WAIT;
-#if GAZELLE_ENABLE
- API_EVENT(((struct netconn *)pcb->callback_arg), NETCONN_EVT_ERROR, 0);
-#endif
}
}
diff --git a/src/include/lwipsock.h b/src/include/lwipsock.h
index ccc8c43..f4cb1de 100644
--- a/src/include/lwipsock.h
+++ b/src/include/lwipsock.h
@@ -120,7 +120,6 @@ struct lwip_sock {
char pad2 __rte_cache_aligned;
/* stack thread all use */
struct list_node recv_list;
- struct pbuf *send_lastdata;
struct pbuf *send_pre_del;
sem_t snd_ring_sem;
--
2.33.0

View File

@ -0,0 +1,25 @@
From cbde011450b38359d494bcc18ae91c690e5c5d43 Mon Sep 17 00:00:00 2001
From: yangchen <yangchen145@huawei.com>
Date: Fri, 26 Jan 2024 17:28:29 +0800
Subject: [PATCH] support udp recv zero packets
---
src/api/sockets.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/api/sockets.c b/src/api/sockets.c
index d8b41e4..c133fc2 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -1385,7 +1385,7 @@ lwip_recvfrom_udp_raw(struct lwip_sock *sock, int flags, struct msghdr *msg, u16
LWIP_UNUSED_ARG(copied);
LWIP_UNUSED_ARG(i);
buflen = do_lwip_read_from_lwip(sock, flags, apiflags);
- if (buflen <= 0) {
+ if (buflen < 0) {
return ERR_BUF;
}
--
2.33.0

126
0110-adapt-lwip-2.2.0.patch Normal file
View File

@ -0,0 +1,126 @@
From d0251f285bb997cdc0dc1e7ab28ba431bce9c544 Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Mon, 5 Feb 2024 19:56:58 +0800
Subject: [PATCH] adapt lwip 2.2.0
---
src/api/api_msg.c | 8 ++++----
src/api/sockets.c | 23 +++++++----------------
src/core/tcp.c | 4 ++--
src/core/tcp_out.c | 2 +-
src/include/lwipopts.h | 2 +-
5 files changed, 15 insertions(+), 24 deletions(-)
diff --git a/src/api/api_msg.c b/src/api/api_msg.c
index adfdd40..a0baaae 100644
--- a/src/api/api_msg.c
+++ b/src/api/api_msg.c
@@ -295,7 +295,7 @@ recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p,
SYS_ARCH_INC(conn->recv_avail, len);
#endif /* LWIP_SO_RCVBUF */
#if GAZELLE_UDP_ENABLE
- do_lwip_add_recvlist(conn->socket);
+ do_lwip_add_recvlist(conn->callback_arg.socket);
#endif /* GAZELLE_UDP_ENABLE */
/* Register event with callback */
API_EVENT(conn, NETCONN_EVT_RCVPLUS, len);
@@ -357,7 +357,7 @@ recv_tcp(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
SYS_ARCH_INC(conn->recv_avail, len);
#endif /* LWIP_SO_RCVBUF */
#if GAZELLE_ENABLE
- do_lwip_add_recvlist(conn->socket);
+ do_lwip_add_recvlist(conn->callback_arg.socket);
#endif
/* Register event with callback */
API_EVENT(conn, NETCONN_EVT_RCVPLUS, len);
@@ -491,7 +491,7 @@ err_tcp(void *arg, err_t err)
/* use trypost to prevent deadlock */
sys_mbox_trypost(&conn->recvmbox, mbox_msg);
#if GAZELLE_ENABLE
- do_lwip_add_recvlist(conn->socket);
+ do_lwip_add_recvlist(conn->callback_arg.socket);
#endif
}
/* pass error message to acceptmbox to wake up pending accept */
diff --git a/src/api/sockets.c b/src/api/sockets.c
index e6868a1..923518c 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -848,7 +848,7 @@ lwip_accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
if (pcb == NULL || ret != 0) {
netconn_delete(newconn);
free_socket(nsock, 1);
- sock_set_errno(sock, ENOTCONN);
+ set_errno(ENOTCONN);
done_socket(sock);
return -1;
}
@@ -2840,7 +2840,7 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
break;
case NETCONN_EVT_ERROR:
if ((conn->pending_err != ERR_OK) && (conn->pending_err != ERR_RST)) {
- LWIP_DEBUGF(GAZELLE_DEBUG_SERIOUS, ("event_callback: have errevent, err=%d, fd=%d\n", conn->pending_err, conn->socket));
+ LWIP_DEBUGF(GAZELLE_DEBUG_SERIOUS, ("event_callback: have errevent, err=%d, fd=%d\n", conn->pending_err, conn->callback_arg.socket));
}
sock->errevent = 1;
#if GAZELLE_ENABLE
@@ -4246,7 +4246,7 @@ lwip_fcntl(int s, int cmd, int val)
default:
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_fcntl(%d, UNIMPL: %d, %d)\n", s, cmd, val));
#if GAZELLE_ENABLE
- sock_errno(sock, 0); /* not yet implemented, but we return 0 for compatilbe with app */
+ set_errno(0); /* not yet implemented, but we return 0 for compatilbe with app */
ret = 0;
#else
set_errno(ENOSYS); /* not yet implemented */
diff --git a/src/core/tcp.c b/src/core/tcp.c
index a9a6513..69f6953 100644
--- a/src/core/tcp.c
+++ b/src/core/tcp.c
@@ -258,7 +258,7 @@ tcp_free(struct tcp_pcb *pcb)
rte_ring_free(pcb->client_rx_ring);
rte_ring_free(pcb->client_tx_ring);
netconn = (struct netconn *)pcb->callback_arg;
- sock = get_socket(netconn->socket);
+ sock = get_socket(netconn->callback_arg.socket);
rte_memzone_free(sock->same_node_rx_ring->mz);
rte_memzone_free(sock->same_node_rx_ring_mz);
rte_memzone_free(sock->same_node_tx_ring->mz);
@@ -995,7 +995,7 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u16_t backlog, err_t *err)
lpcb->next_same_port_pcb = NULL;
struct netconn* conn = pcb->callback_arg;
- lpcb->socket_fd = conn->socket;
+ lpcb->socket_fd = conn->callback_arg.socket;
lpcb->master_lpcb = conn->is_master_fd;
#endif
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
index 70c4242..1632a66 100644
--- a/src/core/tcp_out.c
+++ b/src/core/tcp_out.c
@@ -2501,7 +2501,7 @@ tcp_rst(const struct tcp_pcb *pcb, u32_t seqno, u32_t ackno,
p = tcp_rst_common(pcb, seqno, ackno, local_ip, remote_ip, local_port, remote_port);
if (p != NULL) {
- tcp_output_control_segment(pcb, p, local_ip, remote_ip);
+ tcp_output_control_segment((struct tcp_pcb *)pcb, p, local_ip, remote_ip);
}
}
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
index d54ff1e..28b8aca 100644
--- a/src/include/lwipopts.h
+++ b/src/include/lwipopts.h
@@ -107,7 +107,7 @@
#define LWIP_TIMERS 1
-#define TCP_SND_BUF (2500 * TCP_MSS)
+#define LWIP_TIMEVAL_PRIVATE 0
/*
------------------------------------------------
--
2.33.0

View File

@ -0,0 +1,26 @@
From b619f034c74d53bd6d8b572cb47fdb58fd90d7ae Mon Sep 17 00:00:00 2001
From: yangchen <yangchen145@huawei.com>
Date: Wed, 6 Mar 2024 11:00:56 +0800
Subject: [PATCH] support udp pkglen > mtu: modify IP_REASS_MAX_PBUFS
---
src/include/lwipopts.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
index 28b8aca..d067dea 100644
--- a/src/include/lwipopts.h
+++ b/src/include/lwipopts.h
@@ -171,6 +171,9 @@
#define IP_HLEN 20
+/* the max pbuf num of a udp pbuf chain is ((65535 + MBUF_MAX_DATA_LEN - 1) / MBUF_MAX_DATA_LEN) */
+#define IP_REASS_MAX_PBUFS 46
+
/*
-------------------------------------
----------- IPv6 options -----------
--
2.33.0

View File

@ -0,0 +1,38 @@
From 1e4e2fe5d7239da26edf89f554f929c10e0d5573 Mon Sep 17 00:00:00 2001
From: yangchen <yangchen145@huawei.com>
Date: Wed, 6 Mar 2024 18:25:19 +0800
Subject: [PATCH] support udp pkglen > mtu: modify netbuf_alloc size
---
src/api/sockets.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/api/sockets.c b/src/api/sockets.c
index 923518c..66f6e2c 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -1891,7 +1891,13 @@ lwip_sendto(int s, const void *data, size_t size, int flags,
/* make the buffer point to the data that should be sent */
#if LWIP_NETIF_TX_SINGLE_PBUF
/* Allocate a new netbuf and copy the data into it. */
+#if GAZELLE_ENABLE
+ /* In the gazelle scenario, only use buf.p->payload and buf.p->tot_len, and
+ buf.p->payload stores the sock pointer info. Don't need to alloc short_size */
+ if (netbuf_alloc(&buf, 0) == NULL) {
+#else
if (netbuf_alloc(&buf, short_size) == NULL) {
+#endif
err = ERR_MEM;
} else {
#if LWIP_CHECKSUM_ON_COPY
@@ -1905,6 +1911,7 @@ lwip_sendto(int s, const void *data, size_t size, int flags,
/* In the gazelle scenario, the payload is stored in send_ring,
and the payload stores the sock pointer information. */
buf.p->payload = (void *)sock;
+ buf.p->tot_len = short_size;
#else
MEMCPY(buf.p->payload, data, short_size);
#endif
--
2.33.0

View File

@ -0,0 +1,24 @@
From 3b0bca4b38276c95f1305247ebf8a3db02ff5d83 Mon Sep 17 00:00:00 2001
From: liyunqing <liyunqing@kylinos.cn>
Date: Thu, 7 Mar 2024 11:18:00 +0800
Subject: [PATCH] fix duplicate pbuf_free in udp_sendto
---
src/core/udp.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/core/udp.c b/src/core/udp.c
index 440f909..ff5c99b 100644
--- a/src/core/udp.c
+++ b/src/core/udp.c
@@ -680,7 +680,6 @@ udp_sendto_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip,
struct pbuf *udp_pbuf = do_lwip_get_from_sendring((struct lwip_sock *)(p->payload), p->tot_len, &apiflags);
do_lwip_get_from_sendring_over((struct lwip_sock *)(p->payload));
- pbuf_free(p);
p = udp_pbuf;
if (p == NULL) {
return ERR_MEM;
--
2.27.0

View File

@ -0,0 +1,40 @@
From 931c9ff6d250685ce29cf10e3e03ecaae70419ea Mon Sep 17 00:00:00 2001
From: liyunqing <liyunqing@kylinos.cn>
Date: Tue, 27 Feb 2024 15:40:33 +0800
Subject: [PATCH] sync recv flags with linux kernel
---
src/include/lwip/sockets.h | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/include/lwip/sockets.h b/src/include/lwip/sockets.h
index 89b6eb5..4466f11 100644
--- a/src/include/lwip/sockets.h
+++ b/src/include/lwip/sockets.h
@@ -281,14 +281,22 @@ struct linger {
#define IPPROTO_UDPLITE 136
#define IPPROTO_RAW 255
+#if GAZELLE_ENABLE
/* Flags we can use with send and recv. */
+#define MSG_PEEK 0x02 /* Peeks at an incoming message */
+#define MSG_WAITALL 0x100 /* Unimplemented: Requests that the function block until the full amount of data requested can be returned */
+#define MSG_OOB 0x01 /* Unimplemented: Requests out-of-band data. The significance and semantics of out-of-band data are protocol-specific */
+#define MSG_DONTWAIT 0x40 /* Nonblocking i/o for this operation only */
+#define MSG_MORE 0x8000 /* Sender will send more */
+#define MSG_NOSIGNAL 0x4000 /* Uninmplemented: Requests not to send the SIGPIPE signal if an attempt to send is made on a stream-oriented socket that is no longer connected. */
+#else
#define MSG_PEEK 0x01 /* Peeks at an incoming message */
#define MSG_WAITALL 0x02 /* Unimplemented: Requests that the function block until the full amount of data requested can be returned */
#define MSG_OOB 0x04 /* Unimplemented: Requests out-of-band data. The significance and semantics of out-of-band data are protocol-specific */
#define MSG_DONTWAIT 0x08 /* Nonblocking i/o for this operation only */
#define MSG_MORE 0x10 /* Sender will send more */
#define MSG_NOSIGNAL 0x20 /* Uninmplemented: Requests not to send the SIGPIPE signal if an attempt to send is made on a stream-oriented socket that is no longer connected. */
-
+#endif /* GAZELLE_ENABLE */
/*
* Options for level IPPROTO_IP
--
2.27.0

View File

@ -0,0 +1,25 @@
From f0ca9ad7361b943c0ce84bad8dc2655a90e38ca4 Mon Sep 17 00:00:00 2001
From: liyunqing <liyunqing@kylinos.cn>
Date: Fri, 15 Mar 2024 17:49:27 +0800
Subject: [PATCH] enable LWIP_SO_RCVTIMEO to support recv\accept timeout
---
src/include/lwipopts.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
index d067dea..3b8de83 100644
--- a/src/include/lwipopts.h
+++ b/src/include/lwipopts.h
@@ -257,6 +257,8 @@
#define SIOCSHIWAT 1
+#define LWIP_SO_RCVTIMEO 1
+
/*
------------------------------------
--------- Debug log options --------
--
2.27.0

View File

@ -0,0 +1,48 @@
From 08db0069d623d35de69999ba1dfbc9ed1a5b78d6 Mon Sep 17 00:00:00 2001
From: yangchen <yangchen145@huawei.com>
Date: Thu, 14 Mar 2024 16:49:56 +0800
Subject: [PATCH] transfer pbuf timestamp in ip frag
---
src/core/ipv4/ip4_frag.c | 5 +++++
src/include/lwipsock.h | 1 +
2 files changed, 6 insertions(+)
diff --git a/src/core/ipv4/ip4_frag.c b/src/core/ipv4/ip4_frag.c
index d9bf5cc..aa50856 100644
--- a/src/core/ipv4/ip4_frag.c
+++ b/src/core/ipv4/ip4_frag.c
@@ -39,6 +39,7 @@
*/
#include "lwip/opt.h"
+#include "lwipsock.h"
#if LWIP_IPV4
@@ -800,6 +801,10 @@ ip4_frag(struct pbuf *p, struct netif *netif, const ip4_addr_t *dest)
if (rambuf == NULL) {
goto memerr;
}
+#if GAZELLE_ENABLE
+ /* transfer time stamp to new pbuf */
+ time_stamp_transfer_pbuf(p, rambuf);
+#endif
LWIP_ASSERT("this needs a pbuf in one piece!",
(rambuf->len == rambuf->tot_len) && (rambuf->next == NULL));
poff += pbuf_copy_partial(p, rambuf->payload, fragsize, poff);
diff --git a/src/include/lwipsock.h b/src/include/lwipsock.h
index f4cb1de..dc2e9d3 100644
--- a/src/include/lwipsock.h
+++ b/src/include/lwipsock.h
@@ -182,6 +182,7 @@ extern err_t same_node_ring_create(struct rte_ring **ring, int size, int port, c
extern err_t create_same_node_ring(struct tcp_pcb *pcb);
extern err_t find_same_node_ring(struct tcp_pcb *pcb);
extern void lstack_calculate_aggregate(int type, uint32_t len);
+extern void time_stamp_transfer_pbuf(struct pbuf *pbuf_old, struct pbuf *pbuf_new);
#endif /* GAZELLE_ENABLE */
struct lwip_sock *get_socket(int s);
--
2.33.0

View File

@ -0,0 +1,70 @@
From 74d87ad663f013e792a9ea5d004eae139cd2e0a0 Mon Sep 17 00:00:00 2001
From: compile_success <980965867@qq.com>
Date: Sat, 9 Mar 2024 06:45:25 +0000
Subject: [PATCH] support loop mode
---
src/core/netif.c | 8 ++++++++--
src/include/lwip/netif.h | 4 ++++
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/core/netif.c b/src/core/netif.c
index 8302bd5..79f2317 100644
--- a/src/core/netif.c
+++ b/src/core/netif.c
@@ -1117,6 +1117,10 @@ netif_set_link_callback(struct netif *netif, netif_status_callback_fn link_callb
*/
err_t
netif_loop_output(struct netif *netif, struct pbuf *p)
+#else
+err_t
+udp_netif_loop_output(struct netif *netif, struct pbuf *p)
+#endif
{
struct pbuf *r;
err_t err;
@@ -1218,7 +1224,6 @@ netif_loop_output(struct netif *netif, struct pbuf *p)
return ERR_OK;
}
-#endif
#if LWIP_HAVE_LOOPIF
#if LWIP_IPV4
@@ -1249,6 +1254,10 @@ netif_loop_output_ipv6(struct netif *netif, struct pbuf *p, const ip6_addr_t *ad
*/
void
netif_poll(struct netif *netif)
+#else
+void
+udp_netif_poll(struct netif *netif)
+#endif
{
/* If we have a loopif, SNMP counters are adjusted for it,
* if not they are adjusted for 'netif'. */
@@ -1312,7 +1321,6 @@ netif_poll(struct netif *netif)
}
SYS_ARCH_UNPROTECT(lev);
}
-#endif
#if !LWIP_NETIF_LOOPBACK_MULTITHREADING
/**
diff --git a/src/include/lwip/netif.h b/src/include/lwip/netif.h
index d10d4e8..d8f1f45 100644
--- a/src/include/lwip/netif.h
+++ b/src/include/lwip/netif.h
@@ -538,6 +538,10 @@ void netif_set_link_callback(struct netif *netif, netif_status_callback_fn link_
#if ENABLE_LOOPBACK
err_t netif_loop_output(struct netif *netif, struct pbuf *p);
void netif_poll(struct netif *netif);
+#if GAZELLE_ENABLE
+err_t udp_netif_loop_output(struct netif *netif, struct pbuf *p);
+void udp_netif_poll(struct netif *netif);
+#endif
#if !LWIP_NETIF_LOOPBACK_MULTITHREADING
void netif_poll_all(void);
#endif /* !LWIP_NETIF_LOOPBACK_MULTITHREADING */
--
2.33.0

View File

@ -0,0 +1,128 @@
From 0ba2b637ae7ae725bdd7de24de58b517a0cce93f Mon Sep 17 00:00:00 2001
From: wuchangye <wuchangye@huawei.com>
Date: Sun, 24 Mar 2024 05:29:30 +0800
Subject: [PATCH] support querying udp multicast addresses
---
src/api/sockets.c | 43 ++++++++++++++++++++++++++++++++++++--
src/include/lwip/sockets.h | 1 +
2 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/src/api/sockets.c b/src/api/sockets.c
index 66f6e2c..c544c22 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -4342,6 +4342,27 @@ lwip_inet_pton(int af, const char *src, void *dst)
}
#if LWIP_IGMP
+#if GAZELLE_ENABLE
+int lwip_socket_get_multi_memberships(int s, ip4_addr_t *if_addr, ip4_addr_t *multi_addr)
+{
+ struct lwip_sock *sock = get_socket(s);
+
+ if (!sock) {
+ return 0;
+ }
+
+ if (socket_ipv4_multicast_memberships[s].sock == sock) {
+ ip4_addr_copy(*if_addr, socket_ipv4_multicast_memberships[s].if_addr);
+ ip4_addr_copy(*multi_addr, socket_ipv4_multicast_memberships[s].multi_addr);
+ done_socket(sock);
+ return 1;
+ }
+
+ done_socket(sock);
+ return 0;
+}
+#endif
+
/** Register a new IGMP membership. On socket close, the membership is dropped automatically.
*
* ATTENTION: this function is called from tcpip_thread (or under CORE_LOCK).
@@ -4357,8 +4378,11 @@ lwip_socket_register_membership(int s, const ip4_addr_t *if_addr, const ip4_addr
if (!sock) {
return 0;
}
-
+#if GAZELLE_ENABLE
+ i = s;
+#else
for (i = 0; i < LWIP_SOCKET_MAX_MEMBERSHIPS; i++) {
+#endif
if (socket_ipv4_multicast_memberships[i].sock == NULL) {
socket_ipv4_multicast_memberships[i].sock = sock;
ip4_addr_copy(socket_ipv4_multicast_memberships[i].if_addr, *if_addr);
@@ -4366,7 +4390,9 @@ lwip_socket_register_membership(int s, const ip4_addr_t *if_addr, const ip4_addr
done_socket(sock);
return 1;
}
+#if !GAZELLE_ENABLE
}
+#endif
done_socket(sock);
return 0;
}
@@ -4386,16 +4412,24 @@ lwip_socket_unregister_membership(int s, const ip4_addr_t *if_addr, const ip4_ad
return;
}
+#if GAZELLE_ENABLE
+ i = s;
+#else
for (i = 0; i < LWIP_SOCKET_MAX_MEMBERSHIPS; i++) {
+#endif
if ((socket_ipv4_multicast_memberships[i].sock == sock) &&
ip4_addr_eq(&socket_ipv4_multicast_memberships[i].if_addr, if_addr) &&
ip4_addr_eq(&socket_ipv4_multicast_memberships[i].multi_addr, multi_addr)) {
socket_ipv4_multicast_memberships[i].sock = NULL;
ip4_addr_set_zero(&socket_ipv4_multicast_memberships[i].if_addr);
ip4_addr_set_zero(&socket_ipv4_multicast_memberships[i].multi_addr);
+#if !GAZELLE_ENABLE
break;
+#endif
}
+#if !GAZELLE_ENABLE
}
+#endif
done_socket(sock);
}
@@ -4412,8 +4446,11 @@ lwip_socket_drop_registered_memberships(int s)
if (!sock) {
return;
}
-
+#if GAZELLE_ENABLE
+ i = s;
+#else
for (i = 0; i < LWIP_SOCKET_MAX_MEMBERSHIPS; i++) {
+#endif
if (socket_ipv4_multicast_memberships[i].sock == sock) {
ip_addr_t multi_addr, if_addr;
ip_addr_copy_from_ip4(multi_addr, socket_ipv4_multicast_memberships[i].multi_addr);
@@ -4424,7 +4461,9 @@ lwip_socket_drop_registered_memberships(int s)
netconn_join_leave_group(sock->conn, &multi_addr, &if_addr, NETCONN_LEAVE);
}
+#if !GAZELLE_ENABLE
}
+#endif
done_socket(sock);
}
#endif /* LWIP_IGMP */
diff --git a/src/include/lwip/sockets.h b/src/include/lwip/sockets.h
index 4466f11..296d4eb 100644
--- a/src/include/lwip/sockets.h
+++ b/src/include/lwip/sockets.h
@@ -361,6 +361,7 @@ struct linger {
#if GAZELLE_UDP_ENABLE
#define IP_ADD_MEMBERSHIP 35
#define IP_DROP_MEMBERSHIP 36
+int lwip_socket_get_multi_memberships(int s, ip4_addr_t *if_addr, ip4_addr_t *multi_addr);
#else
/*
* Options and types related to multicast membership
--
2.33.0

2499
0119-support-igmpv3.patch Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,25 @@
From a90ad15caf8dacf54fa6433dfd748ff7248c8718 Mon Sep 17 00:00:00 2001
From: liyunqing <liyunqing@kylinos.cn>
Date: Fri, 22 Mar 2024 16:50:00 +0800
Subject: [PATCH] enable SO_REUSE_RXTOALL
---
src/include/lwipopts.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
index 3b8de83..1b4ec6d 100644
--- a/src/include/lwipopts.h
+++ b/src/include/lwipopts.h
@@ -259,6 +259,8 @@
#define LWIP_SO_RCVTIMEO 1
+#define SO_REUSE_RXTOALL 1
+
/*
------------------------------------
--------- Debug log options --------
--
2.27.0

View File

@ -0,0 +1,28 @@
diff --git a/src/include/dpdk_version.h b/src/include/dpdk_version.h
index df3adb5..bf03d98 100644
--- a/src/include/dpdk_version.h
+++ b/src/include/dpdk_version.h
@@ -56,6 +56,7 @@
#define RTE_ETH_RX_OFFLOAD_UDP_CKSUM DEV_RX_OFFLOAD_UDP_CKSUM
#define RTE_ETH_RX_OFFLOAD_IPV4_CKSUM DEV_RX_OFFLOAD_IPV4_CKSUM
#define RTE_ETH_RX_OFFLOAD_VLAN_STRIP DEV_RX_OFFLOAD_VLAN_STRIP
+#define RTE_ETH_RX_OFFLOAD_VLAN_FILTER DEV_RX_OFFLOAD_VLAN_FILTER
#define RTE_ETH_TX_OFFLOAD_IPV4_CKSUM DEV_TX_OFFLOAD_IPV4_CKSUM
#define RTE_ETH_TX_OFFLOAD_VLAN_INSERT DEV_TX_OFFLOAD_VLAN_INSERT
diff --git a/src/netif/ethernet.c b/src/netif/ethernet.c
index 0d8652b..d0d68b3 100644
--- a/src/netif/ethernet.c
+++ b/src/netif/ethernet.c
@@ -122,6 +122,11 @@ ethernet_input(struct pbuf *p, struct netif *netif)
MIB2_STATS_NETIF_INC(netif, ifinerrors);
goto free_and_return;
}
+#if GAZELLE_ENABLE
+ if (netif->vlan_enable && !(netif->txol_flags & RTE_ETH_RX_OFFLOAD_VLAN_FILTER) && VLAN_ID(vlan) != netif->vlan_tci) {
+ goto free_and_return;
+ }
+#endif
#if defined(LWIP_HOOK_VLAN_CHECK) || defined(ETHARP_VLAN_CHECK) || defined(ETHARP_VLAN_CHECK_FN) /* if not, allow all VLANs */
#ifdef LWIP_HOOK_VLAN_CHECK
if (!LWIP_HOOK_VLAN_CHECK(netif, ethhdr, vlan)) {

1867
0122-support-mldv2.patch Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,22 @@
From 226fbb87dcf266d165962f1d87f9c4c5d4ea8e2d Mon Sep 17 00:00:00 2001
From: yinbin6 <yinbin8@huawei.com>
Date: Thu, 11 Apr 2024 15:07:47 +0800
Subject: [PATCH] opts: modify MEMP_NUM_UDP_PCB
diff --git a/src/include/lwipopts.h b/src/include/lwipopts.h
index 62573f5..4655388 100644
--- a/src/include/lwipopts.h
+++ b/src/include/lwipopts.h
@@ -192,7 +192,7 @@
#define UDP_HLEN 8
-#define MEMP_NUM_UDP_PCB 16
+#define MEMP_NUM_UDP_PCB (GAZELLE_MAX_CLIENTS + GAZELLE_RESERVED_CLIENTS)
#define MEMP_NUM_IGMP_GROUP 16
#define DEFAULT_UDP_RECVMBOX_SIZE 4096
--
2.33.0

View File

@ -0,0 +1,24 @@
From b80f4cd0b3d5ea5349599ef12dd13a0bedafb3b9 Mon Sep 17 00:00:00 2001
From: compile_success <980965867@qq.com>
Date: Mon, 22 Apr 2024 15:11:21 +0000
Subject: [PATCH] fix udp recv memleak
---
src/api/api_msg.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/api/api_msg.c b/src/api/api_msg.c
index f0a3e0b..9da4869 100644
--- a/src/api/api_msg.c
+++ b/src/api/api_msg.c
@@ -286,6 +286,7 @@ recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p,
p->port = port;
len = p->tot_len;
if (sys_mbox_trypost(&conn->recvmbox, p) != ERR_OK) {
+ pbuf_free(p);
return;
#else /* GAZELLE_UDP_ENABLE */
err_t err;
--
2.33.0

View File

@ -0,0 +1,124 @@
From c822d404bae65db647d7c0ddec4647f8b0cce1e1 Mon Sep 17 00:00:00 2001
From: wanfeng <wanfeng@kylinos.cn>
Date: Tue, 16 Apr 2024 15:23:46 +0800
Subject: [PATCH] add MCAST_JOIN_SOURCE_GROUP to setsockopt for mldv2
---
src/api/sockets.c | 94 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 94 insertions(+)
diff --git a/src/api/sockets.c b/src/api/sockets.c
index 6b2f5ee..50fa335 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -3976,6 +3976,29 @@ lwip_setsockopt_impl(int s, int level, int optname, const void *optval, socklen_
}
}
break;
+ case MCAST_JOIN_SOURCE_GROUP:
+ case MCAST_LEAVE_SOURCE_GROUP:
+ LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB(sock, optlen, struct group_source_req);
+ if ((((const struct group_source_req *)optval)->gsr_group.ss_family != AF_INET6) ||
+ (((const struct group_source_req *)optval)->gsr_source.ss_family != AF_INET6)) {
+ done_socket(sock);
+ return EINVAL;
+ }
+#if LWIP_UDP
+ if (NETCONNTYPE_GROUPV6(netconn_type(sock->conn)) == NETCONN_UDP_IPV6) {
+ err = mcast_sock_join_leave_source_group(s, &sock->conn->pcb.udp->ipmc, optname, (const struct group_source_req *)optval);
+ } else
+#endif /* LWIP_UDP */
+#if LWIP_RAW
+ if (NETCONNTYPE_GROUPV6(netconn_type(sock->conn)) == NETCONN_RAW_IPV6) {
+ err = mcast_sock_join_leave_source_group(s, &sock->conn->pcb.raw->ipmc, optname, (const struct group_source_req *)optval);
+ } else
+#endif /* LWIP_RAW */
+ {
+ done_socket(sock);
+ return ENOPROTOOPT;
+ }
+ break;
#endif /* LWIP_IPV6_MLD */
default:
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, IPPROTO_IPV6, UNIMPL: optname=0x%x, ..)\n",
@@ -4869,6 +4892,77 @@ out:
return err_to_errno(err);
}
+/**
+ * setsockopt() MCAST_JOIN_SOURCE_GROUP / MCAST_LEAVE_SOURCE_GROUP command
+ */
+int
+mcast_sock_join_leave_source_group(int s, struct ip_mc *ipmc, int optname, const struct group_source_req *gsr)
+{
+ struct netif *netif;
+ ip_addr_t multi_addr;
+ ip_addr_t src_addr;
+ err_t err;
+ u8_t if_idx;
+
+ if (gsr->gsr_group.ss_family == AF_INET) {
+ inet_addr_to_ip4addr(ip_2_ip4(&multi_addr), &(((struct sockaddr_in *)&(gsr->gsr_group))->sin_addr));
+ inet_addr_to_ip4addr(ip_2_ip4(&src_addr), &(((struct sockaddr_in *)&(gsr->gsr_source))->sin_addr));
+ IP_SET_TYPE_VAL(multi_addr, IPADDR_TYPE_V4);
+ IP_SET_TYPE_VAL(src_addr, IPADDR_TYPE_V4);
+ if (!ip4_addr_ismulticast(ip_2_ip4(&multi_addr)) || ip4_addr_isany(ip_2_ip4(&src_addr))) {
+ return EADDRNOTAVAIL;
+ }
+
+ } else if (gsr->gsr_group.ss_family == AF_INET6) {
+ inet6_addr_to_ip6addr(ip_2_ip6(&multi_addr), &(((struct sockaddr_in6 *)&(gsr->gsr_group))->sin6_addr));
+ inet6_addr_to_ip6addr(ip_2_ip6(&src_addr), &(((struct sockaddr_in6 *)&(gsr->gsr_source))->sin6_addr));
+ IP_SET_TYPE_VAL(multi_addr, IPADDR_TYPE_V6);
+ IP_SET_TYPE_VAL(src_addr, IPADDR_TYPE_V6);
+ if (!ip6_addr_ismulticast(ip_2_ip6(&multi_addr)) || ip6_addr_isany(ip_2_ip6(&src_addr))) {
+ return EADDRNOTAVAIL;
+ }
+
+ } else {
+ return EADDRNOTAVAIL;
+ }
+
+ if (gsr->gsr_interface) {
+ netif = netif_get_by_index((u8_t)gsr->gsr_interface);
+ } else {
+ netif = netif_default; /* To default network interface */
+ }
+ if (netif == NULL) {
+ return ENXIO;
+ }
+
+ if_idx = netif_get_index(netif);
+ if (optname == MCAST_JOIN_SOURCE_GROUP) {
+#if LWIP_IPV4 && LWIP_IGMP
+ if (IP_IS_V4(&multi_addr)) {
+ if (!lwip_socket_register_membership(s, if_idx, ip_2_ip4(&multi_addr))) {
+ /* cannot track membership (out of memory) */
+ err = ENOMEM;
+ goto out;
+ }
+ } else
+#endif
+ {
+#if LWIP_IPV6 && LWIP_IPV6_MLD
+ if (!lwip_socket_register_mld6_membership(s, if_idx, ip_2_ip6(&multi_addr))) {
+ /* cannot track membership (out of memory) */
+ err = ENOMEM;
+ goto out;
+ }
+#endif
+ }
+ err = mcast_join_netif(ipmc, netif, &multi_addr, &src_addr);
+ } else {
+ err = mcast_leave_netif(ipmc, netif, &multi_addr, &src_addr);
+ }
+out:
+ return err_to_errno(err);
+}
+
/**
* setsockopt() IPV6_JOIN_GROUP / IPV6_LEAVE_GROUP command
*/
--
2.25.1

View File

@ -0,0 +1,419 @@
From 050f6e547e31a6dd26837a4660ce8c53db71e272 Mon Sep 17 00:00:00 2001
From: root <root@localhost.localdomain>
Date: Thu, 25 Apr 2024 10:57:46 +0800
Subject: [PATCH] add stats_proto in/out to xmit/recv
---
src/core/ipv4/etharp.c | 25 ++++++++++++++++++++-----
src/core/ipv4/icmp.c | 22 +++++++++++++++++++++-
src/core/ipv4/ip4.c | 28 ++++++++++++++++++++++------
src/core/tcp_in.c | 8 +++++++-
src/core/tcp_out.c | 16 +++++++++++++---
src/core/udp.c | 21 ++++++++++++++++-----
src/include/lwip/stats.h | 6 ++++++
7 files changed, 105 insertions(+), 21 deletions(-)
diff --git a/src/core/ipv4/etharp.c b/src/core/ipv4/etharp.c
index 6a9117a..ffaa442 100644
--- a/src/core/ipv4/etharp.c
+++ b/src/core/ipv4/etharp.c
@@ -654,7 +654,9 @@ etharp_input(struct pbuf *p, struct netif *netif)
u8_t for_us, from_us;
LWIP_ASSERT_CORE_LOCKED();
-
+#if GAZELLE_ENABLE
+ ETHARP_STATS_INC(etharp.rx_in);
+#endif
LWIP_ERROR("netif != NULL", (netif != NULL), return;);
hdr = (struct etharp_hdr *)p->payload;
@@ -672,7 +674,9 @@ etharp_input(struct pbuf *p, struct netif *netif)
pbuf_free(p);
return;
}
+#if !GAZELLE_ENABLE
ETHARP_STATS_INC(etharp.recv);
+#endif
#if LWIP_ACD
/* We have to check if a host already has configured our ip address and
@@ -746,6 +750,9 @@ etharp_input(struct pbuf *p, struct netif *netif)
break;
}
/* free ARP packet */
+#if GAZELLE_ENABLE
+ ETHARP_STATS_INC(etharp.rx_out);
+#endif
pbuf_free(p);
}
@@ -801,7 +808,10 @@ etharp_output(struct netif *netif, struct pbuf *q, const ip4_addr_t *ipaddr)
const struct eth_addr *dest;
struct eth_addr mcastaddr;
const ip4_addr_t *dst_addr = ipaddr;
-
+
+#if GAZELLE_ENABLE
+ ETHARP_STATS_INC(etharp.tx_in);
+#endif
LWIP_ASSERT_CORE_LOCKED();
LWIP_ASSERT("netif != NULL", netif != NULL);
LWIP_ASSERT("q != NULL", q != NULL);
@@ -901,6 +911,9 @@ etharp_output(struct netif *netif, struct pbuf *q, const ip4_addr_t *ipaddr)
/* continuation for multicast/broadcast destinations */
/* obtain source Ethernet address of the given interface */
/* send packet directly on the link */
+#if GAZELLE_ENABLE
+ ETHARP_STATS_INC(etharp.tx_out);
+#endif
return ethernet_output(netif, q, (struct eth_addr *)(netif->hwaddr), dest, ETHTYPE_IP);
}
@@ -1179,13 +1192,15 @@ etharp_raw(struct netif *netif, const struct eth_addr *ethsrc_addr,
{
ethernet_output(netif, p, ethsrc_addr, ethdst_addr, ETHTYPE_ARP);
}
-
- ETHARP_STATS_INC(etharp.xmit);
+#if GAZELLE_ENABLE
+ ETHARP_STATS_INC(etharp.tx_out);
+#else
+ ETHARP_STATS_INC(etharp.xmit);
+#endif
/* free ARP query packet */
pbuf_free(p);
p = NULL;
/* could not allocate pbuf for ARP request */
-
return result;
}
diff --git a/src/core/ipv4/icmp.c b/src/core/ipv4/icmp.c
index a3de92d..ff1ecca 100644
--- a/src/core/ipv4/icmp.c
+++ b/src/core/ipv4/icmp.c
@@ -92,7 +92,11 @@ icmp_input(struct pbuf *p, struct netif *inp)
u16_t hlen;
const ip4_addr_t *src;
+#if GAZELLE_ENABLE
+ ICMP_STATS_INC(icmp.rx_in);
+#else
ICMP_STATS_INC(icmp.recv);
+#endif
MIB2_STATS_INC(mib2.icmpinmsgs);
iphdr_in = ip4_current_header();
@@ -120,6 +124,9 @@ icmp_input(struct pbuf *p, struct netif *inp)
break;
case ICMP_ECHO:
MIB2_STATS_INC(mib2.icmpinechos);
+#if GAZELLE_ENABLE
+ ICMP_STATS_INC(icmp.tx_in);
+#endif
src = ip4_current_dest_addr();
/* multicast destination address? */
if (ip4_addr_ismulticast(ip4_current_dest_addr())) {
@@ -252,8 +259,11 @@ icmp_input(struct pbuf *p, struct netif *inp)
#endif
}
#endif /* CHECKSUM_GEN_IP */
-
+#if GAZELLE_ENABLE
+ ICMP_STATS_INC(icmp.tx_out);
+#else
ICMP_STATS_INC(icmp.xmit);
+#endif
/* increase number of messages attempted to send */
MIB2_STATS_INC(mib2.icmpoutmsgs);
/* increase number of echo replies attempted to send */
@@ -292,6 +302,9 @@ icmp_input(struct pbuf *p, struct netif *inp)
ICMP_STATS_INC(icmp.proterr);
ICMP_STATS_INC(icmp.drop);
}
+#if GAZELLE_ENABLE
+ ICMP_STATS_INC(icmp.rx_out);
+#endif
pbuf_free(p);
return;
lenerr:
@@ -361,6 +374,9 @@ icmp_send_response(struct pbuf *p, u8_t type, u8_t code)
/* increase number of messages attempted to send */
MIB2_STATS_INC(mib2.icmpoutmsgs);
+#if GAZELLE_ENABLE
+ ICMP_STATS_INC(icmp.tx_in);
+#endif
/* Keep IP header + up to 8 bytes */
response_pkt_len = IP_HLEN + ICMP_DEST_UNREACH_DATASIZE;
@@ -411,7 +427,11 @@ icmp_send_response(struct pbuf *p, u8_t type, u8_t code)
icmphdr->chksum = inet_chksum(icmphdr, q->len);
}
#endif
+#if GAZELLE_ENABLE
+ ICMP_STATS_INC(icmp.tx_out);
+#else
ICMP_STATS_INC(icmp.xmit);
+#endif
ip4_output_if(q, NULL, &iphdr_src, ICMP_TTL, 0, IP_PROTO_ICMP, netif);
}
pbuf_free(q);
diff --git a/src/core/ipv4/ip4.c b/src/core/ipv4/ip4.c
index 907a2f0..8865766 100644
--- a/src/core/ipv4/ip4.c
+++ b/src/core/ipv4/ip4.c
@@ -382,7 +382,9 @@ ip4_forward(struct pbuf *p, struct ip_hdr *iphdr, struct netif *inp)
IP_STATS_INC(ip.fw);
MIB2_STATS_INC(mib2.ipforwdatagrams);
+#if !GAZELLE_ENABLE
IP_STATS_INC(ip.xmit);
+#endif
#ifndef LWIP_PERF
PERF_STOP("ip4_forward");
@@ -406,6 +408,9 @@ ip4_forward(struct pbuf *p, struct ip_hdr *iphdr, struct netif *inp)
/* transmit pbuf on chosen interface */
netif->output(netif, p, ip4_current_dest_addr());
return;
+#if GAZELLE_ENABLE
+ IP_STATS_INC(ip.tx_out);
+#endif
return_noroute:
MIB2_STATS_INC(mib2.ipoutnoroutes);
}
@@ -481,8 +486,12 @@ ip4_input(struct pbuf *p, struct netif *inp)
LWIP_ASSERT_CORE_LOCKED();
PERF_START(PERF_LAYER_IP, PERF_POINT_IP_RECV);
-
- IP_STATS_INC(ip.recv);
+
+#if GAZELLE_ENABLE
+ IP_STATS_INC(ip.rx_in);
+#else
+ IP_STATS_INC(ip.recv);
+#endif
MIB2_STATS_INC(mib2.ipinreceives);
/* identify the IP header */
@@ -815,7 +824,9 @@ ip4_input(struct pbuf *p, struct netif *inp)
ip4_addr_set_any(ip4_current_dest_addr());
PERF_STOP_INCREASE_COUNT("ip4_input", PERF_LAYER_IP);
-
+#if GAZELLE_ENABLE
+ IP_STATS_INC(ip.rx_out);
+#endif
return ERR_OK;
}
@@ -908,7 +919,9 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d
#if CHECKSUM_GEN_IP_INLINE
u32_t chk_sum = 0;
#endif /* CHECKSUM_GEN_IP_INLINE */
-
+#if GAZELLE_ENABLE
+ IP_STATS_INC(ip.tx_in);
+#endif
LWIP_ASSERT_CORE_LOCKED();
LWIP_IP_CHECK_PBUF_REF_COUNT_FOR_TX(p);
@@ -1045,7 +1058,9 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d
dest = &dest_addr;
}
+#if !GAZELLE_ENABLE
IP_STATS_INC(ip.xmit);
+#endif
LWIP_DEBUGF(IP_DEBUG, ("ip4_output_if: %c%c%"U16_F"\n", netif->name[0], netif->name[1], (u16_t)netif->num));
ip4_debug_print(p);
@@ -1078,7 +1093,9 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d
}
#endif
#endif /* IP_FRAG */
-
+#if GAZELLE_ENABLE
+ IP_STATS_INC(ip.tx_out);
+#endif
LWIP_DEBUGF(IP_DEBUG, ("ip4_output_if: call netif->output()\n"));
return netif->output(netif, p, dest);
}
@@ -1107,7 +1124,6 @@ ip4_output(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest,
struct netif *netif;
LWIP_IP_CHECK_PBUF_REF_COUNT_FOR_TX(p);
-
if ((netif = ip4_route_src(src, dest)) == NULL) {
LWIP_DEBUGF(IP_DEBUG, ("ip4_output: No route to %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n",
ip4_addr1_16(dest), ip4_addr2_16(dest), ip4_addr3_16(dest), ip4_addr4_16(dest)));
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index 2922721..6c960a6 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -179,8 +179,11 @@ tcp_input(struct pbuf *p, struct netif *inp)
#ifndef LWIP_PERF
PERF_START;
#endif
-
+#if GAZELLE_ENABLE
+ TCP_STATS_INC(tcp.rx_in);
+#else
TCP_STATS_INC(tcp.recv);
+#endif
MIB2_STATS_INC(mib2.tcpinsegs);
tcphdr = (struct tcp_hdr *)p->payload;
@@ -675,6 +678,9 @@ tcp_input(struct pbuf *p, struct netif *inp)
#endif /* TCP_INPUT_DEBUG */
}
}
+#if GAZELLE_ENABLE
+ TCP_STATS_INC(tcp.rx_out);
+#endif
/* Jump target if pcb has been aborted in a callback (by calling tcp_abort()).
Below this line, 'pcb' may not be dereferenced! */
aborted:
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
index 1632a66..8a9016b 100644
--- a/src/core/tcp_out.c
+++ b/src/core/tcp_out.c
@@ -1467,7 +1467,9 @@ tcp_output(struct tcp_pcb *pcb)
#endif /* TCP_CWND_DEBUG */
LWIP_ASSERT_CORE_LOCKED();
-
+#if GAZELLE_ENABLE
+ TCP_STATS_INC(tcp.tx_in);
+#endif
LWIP_ASSERT("tcp_output: invalid pcb", pcb != NULL);
/* pcb->state LISTEN not allowed here */
LWIP_ASSERT("don't call tcp_output for listen-pcbs",
@@ -2019,8 +2021,9 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
#endif /* CHECKSUM_GEN_TCP_HW */
}
#endif /* CHECKSUM_GEN_TCP */
+#if !GAZELLE_ENABLE
TCP_STATS_INC(tcp.xmit);
-
+#endif
PERF_PAUSE_RETURN_POINT(PERF_LAYER_TCP, tmpPoint);
PERF_START(PERF_LAYER_IP, PERF_POINT_IP_SEND);
@@ -2039,7 +2042,9 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
seg->chksum_swapped = 1;
}
#endif
-
+#if GAZELLE_ENABLE
+ TCP_STATS_INC(tcp.tx_out);
+#endif
PERF_STOP_INCREASE_COUNT("ip_out", PERF_LAYER_IP);
PERF_RESUME(PERF_LAYER_TCP, tmpPoint);
@@ -2430,7 +2435,12 @@ tcp_output_control_segment_netif(const struct tcp_pcb *pcb, struct pbuf *p,
ttl = TCP_TTL;
tos = 0;
}
+#if GAZELLE_ENABLE
+ TCP_STATS_INC(tcp.tx_out);
+#else
TCP_STATS_INC(tcp.xmit);
+#endif
+
err = ip_output_if(p, src, dst, ttl, tos, IP_PROTO_TCP, netif);
NETIF_RESET_HINTS(netif);
diff --git a/src/core/udp.c b/src/core/udp.c
index 4a47e99..2c946c7 100644
--- a/src/core/udp.c
+++ b/src/core/udp.c
@@ -263,7 +263,9 @@ udp_input(struct pbuf *p, struct netif *inp)
LWIP_UNUSED_ARG(inp);
LWIP_ASSERT_CORE_LOCKED();
-
+#if GAZELLE_ENABLE
+ UDP_STATS_INC(udp.rx_in);
+#endif
LWIP_ASSERT("udp_input: invalid pbuf", p != NULL);
LWIP_ASSERT("udp_input: invalid netif", inp != NULL);
@@ -273,7 +275,9 @@ udp_input(struct pbuf *p, struct netif *inp)
//PERF_START;
#endif
+#if !GAZELLE_ENABLE
UDP_STATS_INC(udp.recv);
+#endif
/* Check minimum length (UDP header) */
if (p->len < UDP_HLEN) {
@@ -518,6 +522,9 @@ udp_input(struct pbuf *p, struct netif *inp)
} else {
pbuf_free(p);
}
+#if GAZELLE_ENABLE
+ UDP_STATS_INC(udp.rx_out);
+#endif
end:
#if LWIP_RECORD_PERF
PERF_STOP_INCREASE_COUNT("udp_input", PERF_LAYER_UDP);
@@ -589,7 +596,6 @@ udp_send_chksum(struct udp_pcb *pcb, struct pbuf *p,
{
LWIP_ERROR("udp_send_chksum: invalid pcb", pcb != NULL, return ERR_ARG);
LWIP_ERROR("udp_send_chksum: invalid pbuf", p != NULL, return ERR_ARG);
-
if (IP_IS_ANY_TYPE_VAL(pcb->remote_ip)) {
return ERR_VAL;
}
@@ -839,9 +845,11 @@ udp_sendto_if_src_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *d
struct pbuf *q; /* q will be sent down the stack */
u8_t ip_proto;
u8_t ttl;
-
+
LWIP_ASSERT_CORE_LOCKED();
-
+#if GAZELLE_ENABLE
+ UDP_STATS_INC(udp.tx_in);
+#endif
LWIP_ERROR("udp_sendto_if_src: invalid pcb", pcb != NULL, return ERR_ARG);
LWIP_ERROR("udp_sendto_if_src: invalid pbuf", p != NULL, return ERR_ARG);
LWIP_ERROR("udp_sendto_if_src: invalid dst_ip", dst_ip != NULL, return ERR_ARG);
@@ -1057,8 +1065,11 @@ udp_sendto_if_src_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *d
q = NULL;
/* p is still referenced by the caller, and will live on */
}
-
+#if GAZELLE_ENABLE
+ UDP_STATS_INC(udp.tx_out);
+#else
UDP_STATS_INC(udp.xmit);
+#endif
return err;
}
diff --git a/src/include/lwip/stats.h b/src/include/lwip/stats.h
index 08c34e9..f99f6e5 100644
--- a/src/include/lwip/stats.h
+++ b/src/include/lwip/stats.h
@@ -64,6 +64,12 @@ extern "C" {
struct stats_proto {
STAT_COUNTER xmit; /* Transmitted packets. */
STAT_COUNTER recv; /* Received packets. */
+#if GAZELLE_ENABLE
+ STAT_COUNTER tx_in; /* Transmitted packets. */
+ STAT_COUNTER tx_out; /* Transmitted out packets. */
+ STAT_COUNTER rx_in; /* Received in packets. */
+ STAT_COUNTER rx_out; /* Received out packets. */
+#endif
STAT_COUNTER fw; /* Forwarded packets. */
STAT_COUNTER drop; /* Dropped packets. */
STAT_COUNTER chkerr; /* Checksum error. */
--
2.27.0

View File

@ -0,0 +1,104 @@
From a4a51288e841fc066cc6ab079c63eb1f113fa2ab Mon Sep 17 00:00:00 2001
From: wanfeng <wanfeng@kylinos.cn>
Date: Tue, 16 Apr 2024 15:51:09 +0800
Subject: [PATCH] add MCAST_BLOCK_SOURCE to setsockopt for mldv2
---
src/api/sockets.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 74 insertions(+)
diff --git a/src/api/sockets.c b/src/api/sockets.c
index 50fa335..6a3ec91 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -3993,6 +3993,29 @@ lwip_setsockopt_impl(int s, int level, int optname, const void *optval, socklen_
if (NETCONNTYPE_GROUPV6(netconn_type(sock->conn)) == NETCONN_RAW_IPV6) {
err = mcast_sock_join_leave_source_group(s, &sock->conn->pcb.raw->ipmc, optname, (const struct group_source_req *)optval);
} else
+#endif /* LWIP_RAW */
+ {
+ done_socket(sock);
+ return ENOPROTOOPT;
+ }
+ break;
+ case MCAST_BLOCK_SOURCE:
+ case MCAST_UNBLOCK_SOURCE:
+ LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB(sock, optlen, struct group_source_req);
+ if ((((const struct group_source_req *)optval)->gsr_group.ss_family != AF_INET6) ||
+ (((const struct group_source_req *)optval)->gsr_source.ss_family != AF_INET6)) {
+ done_socket(sock);
+ return EINVAL;
+ }
+#if LWIP_UDP
+ if (NETCONNTYPE_GROUPV6(netconn_type(sock->conn)) == NETCONN_UDP_IPV6) {
+ err = mcast_sock_block_unblock_source_group(&sock->conn->pcb.udp->ipmc, optname, (const struct group_source_req *)optval);
+ } else
+#endif /* LWIP_UDP */
+#if LWIP_RAW
+ if (NETCONNTYPE_GROUPV6(netconn_type(sock->conn)) == NETCONN_RAW_IPV6) {
+ err = mcast_sock_block_unblock_source_group(&sock->conn->pcb.raw->ipmc, optname, (const struct group_source_req *)optval);
+ } else
#endif /* LWIP_RAW */
{
done_socket(sock);
@@ -4963,6 +4986,57 @@ out:
return err_to_errno(err);
}
+/**
+ * setsockopt() MCAST_BLOCK_SOURCE / MCAST_UNBLOCK_SOURCE command
+ */
+int
+mcast_sock_block_unblock_source_group(struct ip_mc *ipmc, int optname, const struct group_source_req *gsr)
+{
+ struct netif *netif;
+ ip_addr_t multi_addr;
+ ip_addr_t blk_addr;
+ err_t err;
+
+ if (gsr->gsr_group.ss_family == AF_INET) {
+ inet_addr_to_ip4addr(ip_2_ip4(&multi_addr), &(((struct sockaddr_in *)&(gsr->gsr_group))->sin_addr));
+ inet_addr_to_ip4addr(ip_2_ip4(&blk_addr), &(((struct sockaddr_in *)&(gsr->gsr_source))->sin_addr));
+ IP_SET_TYPE_VAL(multi_addr, IPADDR_TYPE_V4);
+ IP_SET_TYPE_VAL(blk_addr, IPADDR_TYPE_V4);
+ if (!ip4_addr_ismulticast(ip_2_ip4(&multi_addr)) || ip4_addr_isany(ip_2_ip4(&blk_addr))) {
+ return EADDRNOTAVAIL;
+ }
+
+ } else if (gsr->gsr_group.ss_family == AF_INET6) {
+ inet6_addr_to_ip6addr(ip_2_ip6(&multi_addr), &(((struct sockaddr_in6 *)&(gsr->gsr_group))->sin6_addr));
+ inet6_addr_to_ip6addr(ip_2_ip6(&blk_addr), &(((struct sockaddr_in6 *)&(gsr->gsr_source))->sin6_addr));
+ IP_SET_TYPE_VAL(multi_addr, IPADDR_TYPE_V6);
+ IP_SET_TYPE_VAL(blk_addr, IPADDR_TYPE_V6);
+ if (!ip6_addr_ismulticast(ip_2_ip6(&multi_addr)) || ip6_addr_isany(ip_2_ip6(&blk_addr))) {
+ return EADDRNOTAVAIL;
+ }
+
+ } else {
+ return EADDRNOTAVAIL;
+ }
+
+ if (gsr->gsr_interface) {
+ netif = netif_get_by_index((u8_t)gsr->gsr_interface);
+ } else {
+ netif = netif_default; /* To default network interface */
+ }
+ if (netif == NULL) {
+ return ENXIO;
+ }
+
+ if (optname == MCAST_BLOCK_SOURCE) {
+ err = mcast_block_netif(ipmc, netif, &multi_addr, &blk_addr);
+ } else {
+ err = mcast_unblock_netif(ipmc, netif, &multi_addr, &blk_addr);
+ }
+
+ return err_to_errno(err);
+}
+
/**
* setsockopt() IPV6_JOIN_GROUP / IPV6_LEAVE_GROUP command
*/
--
2.25.1

View File

@ -0,0 +1,33 @@
diff -Nur lwip-2.2.0old/src/api/sockets.c lwip-2.2.0/src/api/sockets.c
--- lwip-2.2.0old/src/api/sockets.c 2024-04-29 10:39:04.721200645 +0800
+++ lwip-2.2.0/src/api/sockets.c 2024-04-29 11:21:09.036645032 +0800
@@ -3859,6 +3859,29 @@
return ENOPROTOOPT;
}
break;
+ case MCAST_JOIN_SOURCE_GROUP:
+ case MCAST_LEAVE_SOURCE_GROUP:
+ LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB(sock, optlen, struct group_source_req);
+ if ((((const struct group_source_req *)optval)->gsr_group.ss_family != AF_INET) ||
+ (((const struct group_source_req *)optval)->gsr_source.ss_family != AF_INET)) {
+ done_socket(sock);
+ return EINVAL;
+ }
+#if LWIP_UDP
+ if (NETCONNTYPE_GROUP(netconn_type(sock->conn)) == NETCONN_UDP) {
+ err = mcast_sock_join_leave_source_group(s,&sock->conn->pcb.udp->ipmc, optname, (const struct group_source_req *)optval);
+ } else
+#endif /* LWIP_UDP */
+#if LWIP_RAW
+ if (NETCONNTYPE_GROUP(netconn_type(sock->conn)) == NETCONN_RAW) {
+ err = mcast_sock_join_leave_source_group(s,&sock->conn->pcb.raw->ipmc, optname, (const struct group_source_req *)optval);
+ } else
+#endif /* LWIP_RAW */
+ {
+ done_socket(sock);
+ return ENOPROTOOPT;
+ }
+ break;
#endif /* LWIP_IGMP */
default:
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, IPPROTO_IP, UNIMPL: optname=0x%x, ..)\n",

View File

@ -0,0 +1,25 @@
From beadb61ae1e366ea1f7a2e53d96251ea6f40490e Mon Sep 17 00:00:00 2001
From: yinbin6 <yinbin8@huawei.com>
Date: Tue, 30 Apr 2024 10:09:18 +0800
Subject: [PATCH] memset gazelle_quintuple in vdev_reg_done
---
src/include/lwip/priv/tcp_priv.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/include/lwip/priv/tcp_priv.h b/src/include/lwip/priv/tcp_priv.h
index 8d7b9df..7ef00fa 100644
--- a/src/include/lwip/priv/tcp_priv.h
+++ b/src/include/lwip/priv/tcp_priv.h
@@ -346,7 +346,7 @@ static inline int vdev_reg_done(enum reg_ring_type reg_type, const struct tcp_pc
{
LWIP_ASSERT("Invalid parameter", pcb != NULL);
- struct gazelle_quintuple qtuple;
+ struct gazelle_quintuple qtuple = {0};
qtuple.protocol = IP_IS_V4_VAL(pcb->local_ip) ? GZ_ADDR_TYPE_V4 : GZ_ADDR_TYPE_V6;
qtuple.src_ip = *((gz_addr_t *)&pcb->local_ip);
--
2.33.0

View File

@ -0,0 +1,33 @@
diff -Nur lwip-2.2.0old/src/api/sockets.c lwip-2.2.0/src/api/sockets.c
--- lwip-2.2.0old/src/api/sockets.c 2024-04-30 10:27:19.406967694 +0800
+++ lwip-2.2.0/src/api/sockets.c 2024-04-30 10:37:41.203874969 +0800
@@ -3859,6 +3859,29 @@
return ENOPROTOOPT;
}
break;
+ case MCAST_JOIN_GROUP:
+ case MCAST_LEAVE_GROUP: {
+ LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB(sock, optlen, struct group_req);
+ if (((const struct group_req *)optval)->gr_group.ss_family != AF_INET) {
+ done_socket(sock);
+ return EINVAL;
+ }
+#if LWIP_UDP
+ if (NETCONNTYPE_GROUP(netconn_type(sock->conn)) == NETCONN_UDP) {
+ err = mcast_sock_join_leave_group(s,&sock->conn->pcb.udp->ipmc, optname, (const struct group_req *)optval);
+ } else
+#endif /* LWIP_UDP */
+#if LWIP_RAW
+ if (NETCONNTYPE_GROUP(netconn_type(sock->conn)) == NETCONN_RAW) {
+ err = mcast_sock_join_leave_group(s,&sock->conn->pcb.raw->ipmc, optname, (const struct group_req *)optval);
+ } else
+#endif /* LWIP_RAW */
+ {
+ done_socket(sock);
+ return ENOPROTOOPT;
+ }
+ }
+ break;
case MCAST_JOIN_SOURCE_GROUP:
case MCAST_LEAVE_SOURCE_GROUP:
LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB(sock, optlen, struct group_source_req);

View File

@ -0,0 +1,33 @@
diff -Nur lwip-2.2.0old/src/api/sockets.c lwip-2.2.0/src/api/sockets.c
--- lwip-2.2.0old/src/api/sockets.c 2024-05-07 11:16:33.896085084 +0800
+++ lwip-2.2.0/src/api/sockets.c 2024-05-07 11:27:00.444968722 +0800
@@ -3905,6 +3905,29 @@
return ENOPROTOOPT;
}
break;
+ case MCAST_BLOCK_SOURCE:
+ case MCAST_UNBLOCK_SOURCE:
+ LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB(sock, optlen, struct group_source_req);
+ if ((((const struct group_source_req *)optval)->gsr_group.ss_family != AF_INET) ||
+ (((const struct group_source_req *)optval)->gsr_source.ss_family != AF_INET)) {
+ done_socket(sock);
+ return EINVAL;
+ }
+#if LWIP_UDP
+ if (NETCONNTYPE_GROUP(netconn_type(sock->conn)) == NETCONN_UDP) {
+ err = mcast_sock_block_unblock_source_group(&sock->conn->pcb.udp->ipmc, optname, (const struct group_source_req *)optval);
+ } else
+#endif /* LWIP_UDP */
+#if LWIP_RAW
+ if (NETCONNTYPE_GROUP(netconn_type(sock->conn)) == NETCONN_RAW) {
+ err = mcast_sock_block_unblock_source_group(&sock->conn->pcb.raw->ipmc, optname, (const struct group_source_req *)optval);
+ } else
+#endif /* LWIP_RAW */
+ {
+ done_socket(sock);
+ return ENOPROTOOPT;
+ }
+ break;
#endif /* LWIP_IGMP */
default:
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, IPPROTO_IP, UNIMPL: optname=0x%x, ..)\n",

View File

@ -0,0 +1,79 @@
From 817a3b938db89efa8ef63d610b43cb10321da446 Mon Sep 17 00:00:00 2001
From: hantwofish <hankangkang5@huawei.com>
Date: Tue, 7 May 2024 17:49:32 +0800
Subject: [PATCH] mod udp loop mem leak
---
src/core/netif.c | 21 +++++++++++++++------
src/core/pbuf.c | 20 +++++++++++++++++---
2 files changed, 32 insertions(+), 9 deletions(-)
diff --git a/src/core/netif.c b/src/core/netif.c
index 2fc8945..e6cdebe 100644
--- a/src/core/netif.c
+++ b/src/core/netif.c
@@ -1182,13 +1182,22 @@ udp_netif_loop_output(struct netif *netif, struct pbuf *p)
LWIP_ASSERT("netif_loop_output: invalid pbuf", p != NULL);
/* Allocate a new pbuf */
- r = pbuf_alloc(PBUF_LINK, p->tot_len, PBUF_RAM);
- if (r == NULL) {
- LINK_STATS_INC(link.memerr);
- LINK_STATS_INC(link.drop);
- MIB2_STATS_NETIF_INC(stats_if, ifoutdiscards);
- return ERR_MEM;
+ u16_t p_clen = pbuf_clen(p);
+ struct pbuf *temp[p_clen];
+ for (int i = 0; i < p_clen; i++) {
+ temp[i] = pbuf_alloc(PBUF_LINK, p->len, PBUF_RAM);
+ if (temp[i] == NULL) {
+ LINK_STATS_INC(link.memerr);
+ LINK_STATS_INC(link.drop);
+ MIB2_STATS_NETIF_INC(stats_if, ifoutdiscards);
+ pbuf_free(temp[0]);
+ return ERR_MEM;
+ }
+ if (i > 0) {
+ pbuf_cat(temp[0], temp[i]);
+ }
}
+ r = temp[0];
#if LWIP_LOOPBACK_MAX_PBUFS
clen = pbuf_clen(r);
/* check for overflow or too many pbuf on queue */
diff --git a/src/core/pbuf.c b/src/core/pbuf.c
index b0a63b4..914d1f4 100644
--- a/src/core/pbuf.c
+++ b/src/core/pbuf.c
@@ -1373,11 +1373,25 @@ pbuf_clone(pbuf_layer layer, pbuf_type type, struct pbuf *p)
{
struct pbuf *q;
err_t err;
- q = pbuf_alloc(layer, p->tot_len, type);
- if (q == NULL) {
- return NULL;
+ u16_t p_clen = pbuf_clen(p);
+ struct pbuf *temp[p_clen];
+ for (int i = 0; i < p_clen; i++) {
+ temp[i] = pbuf_alloc(PBUF_LINK, p->len, PBUF_RAM);
+ if (temp[i] == NULL) {
+ pbuf_free(temp[0]);
+ return NULL;
+ }
+ if (i > 0) {
+ pbuf_cat(temp[0], temp[i]);
+ }
}
+ q = temp[0];
+
err = pbuf_copy(q, p);
+ if (err != ERR_OK) {
+ pbuf_free(q);
+ return NULL;
+ }
LWIP_UNUSED_ARG(err); /* in case of LWIP_NOASSERT */
LWIP_ASSERT("pbuf_copy failed", err == ERR_OK);
return q;
--
2.33.0

View File

@ -0,0 +1,34 @@
From 3b23b3a69d71a862dfe7fca1b53b673dc868ffa5 Mon Sep 17 00:00:00 2001
From: wanfeng <wanfeng@kylinos.cn>
Date: Fri, 10 May 2024 15:11:12 +0800
Subject: [PATCH] allow membership to register multiple times
---
src/api/sockets.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/api/sockets.c b/src/api/sockets.c
index 04df15a..5a72b62 100644
--- a/src/api/sockets.c
+++ b/src/api/sockets.c
@@ -4501,7 +4501,7 @@ lwip_socket_register_membership(int s, unsigned int if_idx, const ip4_addr_t *mu
#else
for (i = 0; i < LWIP_SOCKET_MAX_MEMBERSHIPS; i++) {
#endif
- if (socket_ipv4_multicast_memberships[i].sock == NULL) {
+ if (socket_ipv4_multicast_memberships[i].sock == NULL || (socket_ipv4_multicast_memberships[i].sock == sock)) {
socket_ipv4_multicast_memberships[i].sock = sock;
socket_ipv4_multicast_memberships[i].if_idx = if_idx;
ip4_addr_copy(socket_ipv4_multicast_memberships[i].multi_addr, *multi_addr);
@@ -4617,7 +4617,7 @@ lwip_socket_register_mld6_membership(int s, unsigned int if_idx, const ip6_addr_
#else
for (i = 0; i < LWIP_SOCKET_MAX_MEMBERSHIPS; i++) {
#endif
- if (socket_ipv6_multicast_memberships[i].sock == NULL) {
+ if (socket_ipv6_multicast_memberships[i].sock == NULL || (socket_ipv6_multicast_memberships[i].sock == sock)) {
socket_ipv6_multicast_memberships[i].sock = sock;
socket_ipv6_multicast_memberships[i].if_idx = (u8_t)if_idx;
ip6_addr_copy(socket_ipv6_multicast_memberships[i].multi_addr, *multi_addr);
--
2.25.1

View File

@ -0,0 +1,53 @@
From c465aa8bce75770ed296862657118d0ceaf4087b Mon Sep 17 00:00:00 2001
From: hantwofish <hankangkang5@huawei.com>
Date: Thu, 9 May 2024 20:06:50 +0800
Subject: [PATCH] mod checksum of ip_hdr and udp_hdr
---
src/core/ipv4/ip4.c | 2 +-
src/core/ipv4/ip4_frag.c | 1 +
src/core/udp.c | 3 ++-
3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/core/ipv4/ip4.c b/src/core/ipv4/ip4.c
index 8865766..0bbeefc 100644
--- a/src/core/ipv4/ip4.c
+++ b/src/core/ipv4/ip4.c
@@ -1084,7 +1084,7 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d
#if IP_FRAG
/* don't fragment if interface has mtu set to 0 [loopif] */
#if GAZELLE_ENABLE
- if (!(netif_get_txol_flags(netif) & RTE_ETH_TX_OFFLOAD_TCP_TSO)) {
+ if ((!(netif_get_txol_flags(netif) & RTE_ETH_TX_OFFLOAD_TCP_TSO)) || !(IPH_PROTO(iphdr) == IP_PROTO_TCP)) {
#endif
if (netif->mtu && (p->tot_len > netif->mtu)) {
return ip4_frag(p, netif, dest);
diff --git a/src/core/ipv4/ip4_frag.c b/src/core/ipv4/ip4_frag.c
index aa50856..2ba473b 100644
--- a/src/core/ipv4/ip4_frag.c
+++ b/src/core/ipv4/ip4_frag.c
@@ -892,6 +892,7 @@ ip4_frag(struct pbuf *p, struct netif *netif, const ip4_addr_t *dest)
#if CHECKSUM_GEN_IP_HW
if (netif_get_txol_flags(netif) & RTE_ETH_TX_OFFLOAD_IPV4_CKSUM) {
iph_cksum_set(p, IP_HLEN, 1);
+ iph_cksum_set(rambuf, IP_HLEN, 1);
} else {
iph_cksum_set(p, IP_HLEN, 0);
IPH_CHKSUM_SET(iphdr, inet_chksum(iphdr, IP_HLEN));
diff --git a/src/core/udp.c b/src/core/udp.c
index 2c946c7..1fae8b6 100644
--- a/src/core/udp.c
+++ b/src/core/udp.c
@@ -1011,7 +1011,8 @@ udp_sendto_if_src_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *d
#endif /* LWIP_CHECKSUM_ON_COPY */
{
#if CHECKSUM_GEN_UDP_HW
- if (netif_get_txol_flags(netif) & RTE_ETH_TX_OFFLOAD_UDP_CKSUM) {
+ if ( (netif_get_txol_flags(netif) & RTE_ETH_TX_OFFLOAD_UDP_CKSUM) &&
+ (netif->mtu) && (p->tot_len <= netif->mtu)) {
udph_cksum_set(q, UDP_HLEN);
udpchksum = 0;
} else {
--
2.33.0

View File

@ -0,0 +1,28 @@
From 2d03a11cfbbe8885339fda776f45ad3d26829d9f Mon Sep 17 00:00:00 2001
From: ningjin <ningjin@kylinos.cn>
Date: Mon, 20 May 2024 17:33:12 +0800
Subject: [PATCH] change STAT_COUNTER from u16 to u64
---
src/include/lwip/stats.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/include/lwip/stats.h b/src/include/lwip/stats.h
index f99f6e5..6798f48 100644
--- a/src/include/lwip/stats.h
+++ b/src/include/lwip/stats.h
@@ -52,7 +52,10 @@ extern "C" {
#define LWIP_STATS_LARGE 0
#endif
-#if LWIP_STATS_LARGE
+#if GAZELLE_ENABLE
+#define STAT_COUNTER u64_t
+#define STAT_COUNTER_F U64_F
+#elif LWIP_STATS_LARGE
#define STAT_COUNTER u32_t
#define STAT_COUNTER_F U32_F
#else
--
2.27.0

View File

@ -0,0 +1,25 @@
diff --git a/src/netif/ethernet.c b/src/netif/ethernet.c
index d0d68b3..5ba6d95 100644
--- a/src/netif/ethernet.c
+++ b/src/netif/ethernet.c
@@ -123,7 +123,9 @@ ethernet_input(struct pbuf *p, struct netif *netif)
goto free_and_return;
}
#if GAZELLE_ENABLE
- if (netif->vlan_enable && !(netif->txol_flags & RTE_ETH_RX_OFFLOAD_VLAN_FILTER) && VLAN_ID(vlan) != netif->vlan_tci) {
+ /* 1.if vlan mode is not enable, ignore VLAN packets.
+ 2.if vlan mode is enable, ignore packets not for our VLAN */
+ if (netif->vlan_enable == false || (netif->vlan_enable && VLAN_ID(vlan) != netif->vlan_tci)) {
goto free_and_return;
}
#endif
@@ -141,6 +143,9 @@ ethernet_input(struct pbuf *p, struct netif *netif)
}
#endif /* defined(LWIP_HOOK_VLAN_CHECK) || defined(ETHARP_VLAN_CHECK) || defined(ETHARP_VLAN_CHECK_FN) */
type = vlan->tpid;
+ } else if (netif->vlan_enable && !(netif->txol_flags & RTE_ETH_RX_OFFLOAD_VLAN_STRIP)) {
+ /* if vlan mode is enable but vlan strip offload is off, ignore packets without vlan info. */
+ goto free_and_return;
}
#endif /* ETHARP_SUPPORT_VLAN */

View File

@ -1,143 +0,0 @@
From 95aba99f41333ad430496eab2596bc8b489ae731 Mon Sep 17 00:00:00 2001
From: Dirk Ziegelmeier <dirk@ziegelmeier.net>
Date: Fri, 19 Oct 2018 22:30:17 +0200
Subject: [PATCH] Implement task #11620: Add outgoing VLAN PCP support for
Ethernet level QoS
Apply rebased patch from Timmy Brolin
---
src/core/tcp.c | 29 ++++++++++++++++-------------
src/core/tcp_in.c | 3 +++
src/include/lwip/netif.h | 22 ++++++++++++++--------
src/include/lwip/opt.h | 34 +++++++++++++++++++++++-----------
src/netif/ethernet.c | 12 ++++++++++--
5 files changed, 66 insertions(+), 34 deletions(-)
diff --git a/src/core/tcp.c b/src/core/tcp.c
index ce03c8161..1f91d24ba 100644
--- a/src/core/tcp.c
+++ b/src/core/tcp.c
@@ -892,6 +892,9 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err)
lpcb->ttl = pcb->ttl;
lpcb->tos = pcb->tos;
+#if LWIP_VLAN_PCP
+ lpcb->netif_hints.tci = pcb->netif_hints.tci;
+#endif /* LWIP_VLAN_PCP */
#if GAZELLE_TCP_REUSE_IPPORT
lpcb->connect_num = 0;
lpcb->next_same_port_pcb = NULL;
index 428a6f48d..d1fe067a4 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -690,6 +690,9 @@ tcp_listen_input(struct tcp_pcb_listen *pcb)
#if LWIP_CALLBACK_API || TCP_LISTEN_BACKLOG
npcb->listener = pcb;
#endif /* LWIP_CALLBACK_API || TCP_LISTEN_BACKLOG */
+#if LWIP_VLAN_PCP
+ npcb->netif_hints.tci = pcb->netif_hints.tci;
+#endif /* LWIP_VLAN_PCP */
/* inherit socket options */
npcb->so_options = pcb->so_options & SOF_INHERITED;
npcb->netif_idx = pcb->netif_idx;
diff --git a/src/include/lwip/netif.h b/src/include/lwip/netif.h
index 9e2007a64..013a69b5a 100644
--- a/src/include/lwip/netif.h
+++ b/src/include/lwip/netif.h
@@ -248,14 +248,20 @@ typedef u8_t netif_addr_idx_t;
#define NETIF_ADDR_IDX_MAX 0x7F
#endif
+#if LWIP_NETIF_HWADDRHINT || LWIP_VLAN_PCP
+ #define LWIP_NETIF_USE_HINTS 1
+ struct netif_hint {
#if LWIP_NETIF_HWADDRHINT
-#define LWIP_NETIF_USE_HINTS 1
-struct netif_hint {
- netif_addr_idx_t addr_hint;
-};
-#else /* LWIP_NETIF_HWADDRHINT */
-#define LWIP_NETIF_USE_HINTS 0
-#endif /* LWIP_NETIF_HWADDRHINT */
+ u8_t addr_hint;
+#endif
+#if LWIP_VLAN_PCP
+ /** VLAN hader is set if this is >= 0 (but must be <= 0xFFFF) */
+ s32_t tci;
+#endif
+ };
+#else /* LWIP_NETIF_HWADDRHINT || LWIP_VLAN_PCP */
+ #define LWIP_NETIF_USE_HINTS 0
+#endif /* LWIP_NETIF_HWADDRHINT || LWIP_VLAN_PCP*/
/** Generic data structure used for all lwIP network interfaces.
* The following fields should be filled in by the initialization
#if LWIP_IPV6_AUTOCONFIG
diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h
index 90fce4f05..fb4b10c8b 100644
--- a/src/include/lwip/opt.h
+++ b/src/include/lwip/opt.h
@@ -677,6 +677,18 @@
#define ETHARP_SUPPORT_VLAN 0
#endif
+/**
+ * LWIP_VLAN_PCP==1: Enable outgoing VLAN taggning of frames on a per-PCB basis
+ * for QoS purposes. With this feature enabled, each PCB has a new variable: "tci".
+ * (Tag Control Identifier). The TCI contains three fields: VID, CFI and PCP.
+ * VID is the VLAN ID, which should be set to zero.
+ * The "CFI" bit is used to enable or disable VLAN tags for the PCB.
+ * PCP (Priority Code Point) is a 3 bit field used for Ethernet level QoS.
+ */
+#ifndef LWIP_VLAN_PCP
+#define LWIP_VLAN_PCP 0
+#endif
+
/** LWIP_ETHERNET==1: enable ethernet support even though ARP might be disabled
*/
#if !defined LWIP_ETHERNET || defined __DOXYGEN__
@@ -1548,13 +1560,13 @@
* link level header. The default is 14, the standard value for
* Ethernet.
*/
-#if !defined PBUF_LINK_HLEN || defined __DOXYGEN__
-#if defined LWIP_HOOK_VLAN_SET && !defined __DOXYGEN__
-#define PBUF_LINK_HLEN (18 + ETH_PAD_SIZE)
-#else /* LWIP_HOOK_VLAN_SET */
-#define PBUF_LINK_HLEN (14 + ETH_PAD_SIZE)
-#endif /* LWIP_HOOK_VLAN_SET */
-#endif
+ #if !defined PBUF_LINK_HLEN || defined __DOXYGEN__
+#if (defined LWIP_HOOK_VLAN_SET || LWIP_VLAN_PCP) && !defined __DOXYGEN__
+ #define PBUF_LINK_HLEN (18 + ETH_PAD_SIZE)
+#else /* LWIP_HOOK_VLAN_SET || LWIP_VLAN_PCP */
+ #define PBUF_LINK_HLEN (14 + ETH_PAD_SIZE)
+#endif /* LWIP_HOOK_VLAN_SET || LWIP_VLAN_PCP */
+ #endif
/**
* PBUF_LINK_ENCAPSULATION_HLEN: the number of bytes that should be allocated
diff --git a/src/netif/ethernet.c b/src/netif/ethernet.c
index dd171e280..9e367f8cc 100644
--- a/src/netif/ethernet.c
+++ b/src/netif/ethernet.c
@@ -273,8 +273,16 @@ ethernet_output(struct netif * netif, struct pbuf * p,
struct eth_hdr *ethhdr;
u16_t eth_type_be = lwip_htons(eth_type);
-#if ETHARP_SUPPORT_VLAN && defined(LWIP_HOOK_VLAN_SET)
- s32_t vlan_prio_vid = LWIP_HOOK_VLAN_SET(netif, p, src, dst, eth_type);
+#if ETHARP_SUPPORT_VLAN
+ s32_t vlan_prio_vid;
+#ifdef LWIP_HOOK_VLAN_SET
+ vlan_prio_vid = LWIP_HOOK_VLAN_SET(netif, p, src, dst, eth_type);
+#elif LWIP_VLAN_PCP
+ vlan_prio_vid = -1;
+ if (netif->hints && (netif->hints->tci >= 0)) {
+ vlan_prio_vid = (u16_t)netif->hints->tci;
+ }
+#endif
if (vlan_prio_vid >= 0) {
struct eth_vlan_hdr *vlanhdr;

View File

@ -1,33 +0,0 @@
From f72227aadcc1d0d8c46a8b4fe62ba3d03ffa42c3 Mon Sep 17 00:00:00 2001
From: Simon Goldschmidt <goldsimon@gmx.de>
Date: Wed, 7 Nov 2018 10:49:06 +0100
Subject: [PATCH] fix compiling ETHARP_SUPPORT_VLAN without LWIP_HOOK_VLAN_SET
and LWIP_VLAN_PCP
---
src/netif/ethernet.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/netif/ethernet.c b/src/netif/ethernet.c
index 9e367f8cc..6db434b46 100644
--- a/src/netif/ethernet.c
+++ b/src/netif/ethernet.c
@@ -273,7 +273,7 @@ ethernet_output(struct netif * netif, struct pbuf * p,
struct eth_hdr *ethhdr;
u16_t eth_type_be = lwip_htons(eth_type);
-#if ETHARP_SUPPORT_VLAN
+#if ETHARP_SUPPORT_VLAN && (defined(LWIP_HOOK_VLAN_SET) || LWIP_VLAN_PCP)
s32_t vlan_prio_vid;
#ifdef LWIP_HOOK_VLAN_SET
vlan_prio_vid = LWIP_HOOK_VLAN_SET(netif, p, src, dst, eth_type);
@@ -297,7 +297,7 @@ ethernet_output(struct netif * netif, struct pbuf * p,
eth_type_be = PP_HTONS(ETHTYPE_VLAN);
} else
-#endif /* ETHARP_SUPPORT_VLAN && defined(LWIP_HOOK_VLAN_SET) */
+#endif /* ETHARP_SUPPORT_VLAN && (defined(LWIP_HOOK_VLAN_SET) || LWIP_VLAN_PCP) */
{
if (pbuf_add_header(p, SIZEOF_ETH_HDR) != 0) {
goto pbuf_header_failed;

View File

@ -1,36 +0,0 @@
From 003d34eebd223c16a3dbf6a970bb6e23cb7d1a24 Mon Sep 17 00:00:00 2001
From: Simon Goldschmidt <goldsimon@gmx.de>
Date: Fri, 27 Mar 2020 22:59:05 +0100
Subject: [PATCH] tcp: fix sequence number comparison
This fixes both undefined behavior (see bug #51447) as well as a possible bug
where sequence numbers in 31 bit distance may come through.
Conflict: NA
Reference: https://git.savannah.gnu.org/cgit/lwip.git/commit/?id=003d34eebd223c16a3dbf6a970bb6e23cb7d1a24
---
src/include/lwip/priv/tcp_priv.h | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/src/include/lwip/priv/tcp_priv.h b/src/include/lwip/priv/tcp_priv.h
index 72f9126d..c84b5be8 100644
--- a/src/include/lwip/priv/tcp_priv.h
+++ b/src/include/lwip/priv/tcp_priv.h
@@ -106,14 +106,11 @@ err_t tcp_process_refused_data(struct tcp_pcb *pcb);
#define tcp_output_nagle(tpcb) (tcp_do_output_nagle(tpcb) ? tcp_output(tpcb) : ERR_OK)
-#define TCP_SEQ_LT(a,b) ((s32_t)((u32_t)(a) - (u32_t)(b)) < 0)
-#define TCP_SEQ_LEQ(a,b) ((s32_t)((u32_t)(a) - (u32_t)(b)) <= 0)
-#define TCP_SEQ_GT(a,b) ((s32_t)((u32_t)(a) - (u32_t)(b)) > 0)
-#define TCP_SEQ_GEQ(a,b) ((s32_t)((u32_t)(a) - (u32_t)(b)) >= 0)
+#define TCP_SEQ_LT(a,b) (((u32_t)((u32_t)(a) - (u32_t)(b)) & 0x80000000u) != 0)
+#define TCP_SEQ_LEQ(a,b) (!(TCP_SEQ_LT(b,a)))
+#define TCP_SEQ_GT(a,b) TCP_SEQ_LT(b,a)
+#define TCP_SEQ_GEQ(a,b) TCP_SEQ_LEQ(b,a)
/* is b<=a<=c? */
-#if 0 /* see bug #10548 */
-#define TCP_SEQ_BETWEEN(a,b,c) ((c)-(b) >= (a)-(b))
-#endif
#define TCP_SEQ_BETWEEN(a,b,c) (TCP_SEQ_GEQ(a,b) && TCP_SEQ_LEQ(a,c))
#ifndef TCP_TMR_INTERVAL
--
2.28.0.windows.1

View File

@ -1,58 +0,0 @@
From adbc5b5f716d108966bcf606e61de60b83f525a5 Mon Sep 17 00:00:00 2001
From: Simon Goldschmidt <goldsimon@gmx.de>
Date: Thu, 5 Mar 2020 21:20:35 +0100
Subject: [PATCH] tcp: tighten up checks for received SYN
Any malicous segment could contain a SYN up to now (no check).
A SYN in the wrong segment could break OOSEQ queueing.
Fix this by allowing SYN only in states where it is required.
See bug #56397: Assert "tcp_receive: ooseq tcplen > rcv_wnd"
Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
Conflict: NA
Reference: https://git.savannah.gnu.org/cgit/lwip.git/commit/?id=adbc5b5f716d108966bcf606e61de60b83f525a5
---
src/core/tcp_in.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index 4bfba85f..90061281 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -852,6 +852,13 @@ tcp_process(struct tcp_pcb *pcb)
tcp_parseopt(pcb);
+ if (flags & TCP_SYN) {
+ /* accept SYN only in 2 states: */
+ if ((pcb->state != SYN_SENT) && (pcb->state != SYN_RCVD)) {
+ return ERR_OK;
+ }
+ }
+
/* Do different things depending on the TCP state. */
switch (pcb->state) {
case SYN_SENT:
@@ -924,7 +931,12 @@ tcp_process(struct tcp_pcb *pcb)
}
break;
case SYN_RCVD:
- if (flags & TCP_ACK) {
+ if (flags & TCP_SYN) {
+ if (seqno == pcb->rcv_nxt - 1) {
+ /* Looks like another copy of the SYN - retransmit our SYN-ACK */
+ tcp_rexmit(pcb);
+ }
+ } else if (flags & TCP_ACK) {
/* expected ACK number? */
if (TCP_SEQ_BETWEEN(ackno, pcb->lastack + 1, pcb->snd_nxt)) {
pcb->state = ESTABLISHED;
@@ -975,9 +987,6 @@ tcp_process(struct tcp_pcb *pcb)
tcp_rst(pcb, ackno, seqno + tcplen, ip_current_dest_addr(),
ip_current_src_addr(), tcphdr->dest, tcphdr->src);
}
- } else if ((flags & TCP_SYN) && (seqno == pcb->rcv_nxt - 1)) {
- /* Looks like another copy of the SYN - retransmit our SYN-ACK */
- tcp_rexmit(pcb);
}
break;
case CLOSE_WAIT:
--
2.28.0.windows.1

Binary file not shown.

BIN
lwip-2.2.0.zip Normal file

Binary file not shown.

218
lwip.spec
View File

@ -3,16 +3,12 @@
Summary: lwip is a small independent implementation of the TCP/IP protocol suite
Name: lwip
Version: 2.1.3
Release: 95
Version: 2.2.0
Release: 29
License: BSD
URL: http://savannah.nongnu.org/projects/lwip/
Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.zip
Patch6001: backport-tcp-fix-sequence-number-comparison.patch
Patch6002: backport-tcp-tighten-up-checks-for-received-SYN.patch
Patch9000: 0001-add-makefile.patch
Patch9001: 0002-adapt-lstack.patch
Patch9002: 0003-fix-the-occasional-coredump-when-the-lwip-exits.patch
@ -58,7 +54,7 @@ Patch9041: 0042-expand-recv-win.patch
Patch9042: 0043-add-prefetch.patch
Patch9043: 0044-skip-unnecessary-tcp_route.patch
Patch9044: 0045-add-variable-in-struct-sock.patch
Patch9045: 0046-add-dataack-when-recv-too-many-acks-with-data.patch
Patch9046: 0047-reduce-struct-pbuf-size.patch
Patch9047: 0048-listen-pcb-also-use-pcb_if.patch
Patch9048: 0049-expand-recv-mbox-size.patch
@ -91,8 +87,7 @@ Patch9074: 0075-adapt-read-write-for-rtc-mode.patch
Patch9075: 0076-fix-recvmsg-return-EINVAL.patch
Patch9076: 0077-adpat-event-for-rtc-mode.patch
Patch9077: 0078-posix_api-support-select.patch
Patch6003: backport-Add-outgoing-VLAN-PCP-support.patch
Patch6004: backport-fix-compiling-ETHARP_SUPPORT_VLAN.patch
Patch9078: 0079-enable-vlan-define.patch
Patch9079: 0080-enable-ipv6.patch
Patch9080: 0081-ip6-hdr.patch
@ -107,12 +102,58 @@ Patch9088: 0089-add-struct-gz-addr.patch
Patch9089: 0090-frag-fix-coredump-when-get-netif.patch
Patch9090: 0091-add-fd-log-info-and-fix-wrong-port-log-info.patch
Patch9091: 0092-fix-the-coredump-issue-when-UDP-traffic-is-sent.patch
Patch9092: 0093-modfiy-accept-null-pointer-when-new-conn-receive-RST-packet-in-listening.patch
Patch9093: 0094-lwip-log-fix-reversed-port-in-tcp_input.patch
Patch9094: 0095-event_callback-del-errevent-log-if-err-is-ERR_OK.patch
Patch9095: 0096-tcp_send_fin-add-the-fin-to-the-last-unsent-segment.patch
Patch9096: 0097-Mod-the-issue-that-2w-connection-unable-to-establish.patch
Patch9097: 0098-remove-duplicate-lwip-log.patch
Patch9098: 0099-fix-rte_ring_create-time-consuming.patch
Patch9099: 0100-replace-qtuple-addr-with-gz_addr_t.patch
Patch9100: 0101-fix-wrong-namelen-in-getaddrname.patch
Patch9101: 0102-dfx-add-tcp_in-empty-ack-cnt-and-del-rst-invalid-log.patch
Patch9102: 0103-adapt-for-dpdk-23.11.patch
Patch9103: 0104-optimize-enqueue-for-unacked-and-unsent-queue.patch
Patch9104: 0105-delete-redundant-logs-in-lwip.patch
Patch9105: 0106-remove-unnecessary-variables-in-struct-pbuf.patch
Patch9106: 0107-fix-move-lpcb-to-the-front-of-list-error.patch
Patch9107: 0108-fix-receive-fin-packet-process-error.patch
Patch9108: 0109-support-udp-recv-zero-packets.patch
Patch9109: 0110-adapt-lwip-2.2.0.patch
Patch9110: 0111-support-udp-pkglen-mtu-modify-IP_REASS_MAX_PBUFS.patch
Patch9111: 0112-support-udp-pkglen-mtu-modify-netbuf_alloc-size.patch
Patch9112: 0113-fix-duplicate-pbuf_free-in-udp_sendto.patch
Patch9113: 0114-sync-recv-flags-with-linux-kernel.patch
Patch9114: 0115-enable-LWIP_SO_RCVTIMEO-to-support-recv-accept-timeo.patch
Patch9115: 0116-transfer-pbuf-timestamp-in-ip-frag.patch
Patch9116: 0117-udp-muticast-loop.patch
Patch9117: 0118-support-querying-udp-multicast-addresses.patch
Patch9118: 0119-support-igmpv3.patch
Patch9119: 0120-enable-SO_REUSE_RXTOALL.patch
Patch9120: 0121-add-vlan-filter.patch
Patch9121: 0122-support-mldv2.patch
Patch9122: 0123-opts-modify-MEMP_NUM_UDP_PCB.patch
Patch9123: 0124-fix-udp-recv-memleak.patch
Patch9124: 0125-add-MCAST_JOIN_SOURCE_GROUP-to-setsockopt-for-mldv2.patch
Patch9125: 0126-add-stats_proto-in-out-to-xmit-recv.patch
Patch9126: 0127-add-MCAST_BLOCK_SOURCE-to-setsockopt-for-mldv2.patch
Patch9127: 0128-add-MCAST_JOIN_SOURCE_GROUP-to-setsockopt-for-igmpv3.patch
Patch9128: 0129-memset-gazelle_quintuple-in-vdev_reg_done.patch
Patch9129: 0130-add-MCAST_JOIN_GROUP-to-setsockopt-for-igmpv3.patch
Patch9130: 0131-add-MCAST_BLOCK_SOURCE-to-setsockopt-for-igmpv3.patch
Patch9131: 0132-mod-udp-loop-mem-leak.patch
Patch9132: 0133-allow-membership-to-register-multiple-times.patch
Patch9133: 0134-mod-checksum-of-ip_hdr-and-udp_hdr.patch
Patch9134: 0135-change-STAT_COUNTER-from-u16-to-u64.patch
Patch9135: 0136-fix-vlan-filter-bug.patch
BuildRequires: gcc-c++ dos2unix dpdk-devel
#Requires:
ExclusiveArch: x86_64 aarch64 loongarch64 sw_64
ExclusiveArch: x86_64 aarch64 loongarch64 sw_64 riscv64 ppc64le
%description
lwip is a small independent implementation of the TCP/IP protocol suite.
@ -123,7 +164,6 @@ find %{_builddir}/%{name}-%{version} -type f -exec dos2unix -q {} \;
%autopatch -p1
%build
export DPDK_VERSION_1911=1
cd %{_builddir}/%{name}-%{version}/src
%make_build
@ -137,6 +177,157 @@ cd %{_builddir}/%{name}-%{version}/src
%{_libdir}/liblwip.a
%changelog
* Fri May 24 2024 zhengjiebing <zhengjiebing@cmss.chinamobile.com> - 2.2.0-29
- fix vlan filter bug
* Tue May 21 2024 ningjin <ningjin@kylinos.cn> - 2.2.0-28
- change change STAT_COUNTER from u16 to u64
* Thu May 09 2024 hankangkang <hankangkang5@huawei.com> - 2.2.0-27
- mod checksum of ip_hdr and udp_hdr
* Fri May 10 2024 wanfeng <wanfeng@kylinos.cn> - 2.2.0-26
- allow multicast membership to register multiple times
* Tue May 07 2024 hankangkang <hankangkang5@huawei.com> - 2.2.0-25
- Fix MBUF memory leakage issue when message length is greater than MTU
* Tue May 07 2024 zhangyulong <zhangyulong@kylinos.cn> - 2.2.0-24
- add option MCAST_BLOCK_SOURCE to the setsockopt for the igmpv3 protocol
* Mon May 06 2024 zhangyulong <zhangyulong@kylinos.cn> - 2.2.0-23
- add option MCAST_JOIN_GROUP to the setsockopt for the igmpv3 protocol
* Tue Apr 30 2024 yinbin <yinbin8@huawei.com> - 2.2.0-22
- memset gazelle_quintuple in vdev_reg_done
* Mon Apr 29 2024 zhangyulong <zhangyulong@kylinos.cn> - 2.2.0-21
- add option MCAST_JOIN_SOURCE_GROUP to the setsockopt for the igmpv3 protocol
* Mon Apr 29 2024 wanfeng <wanfeng@kylinos.cn> - 2.2.0-20
- add option MCAST_BLOCK_SOURCE to the setsockopt for the mldv2 protocol
* Thu Apr 25 2024 ningjin <ningjin@kylinos.cn> - 2.2.0-19
- add in/out and xmit/recv to stats_proto
* Wed Apr 24 2024 wanfeng <wanfeng@kylinos.cn> - 2.2.0-18
- add option MCAST_JOIN_SOURCE_GROUP to the setsockopt for the mldv2 protocol
* Mon Apr 22 2024 zhujunhao <zhujunhao11@huawei.com> - 2.2.0-17
- fix udp recv memleak
* Thu Apr 11 2024 yinbin <yinbin8@huawei.com> - 2.2.0-16
- opts: modify MEMP_NUM_UDP_PCB
* Tue Apr 09 2024 wanfeng <wanfeng@kylinos.cn> - 2.2.0-15
- add ipv6 mldv2 multicast protocol
* Mon Apr 08 2024 zhengjiebing <zhengjiebing@cmss.chinamobile.com> - 2.2.0-14
- add vlan filter
* Fri Mar 29 2024 liyunqing <liyunqing@kylinos.cn> - 2.2.0-13
- enable SO_REUSE_RXTOALL
* Fri Mar 29 2024 zhangyulong <zhangyulong@kylinos.cn> - 2.2.0-12
- add igmp v3 multicast protocol
* Sat Mar 23 2024 wuchangye <wuchangye@huawei.com> - 2.2.0-11
- support querying udp multicast addresses
* Fri Mar 22 2024 zhujunhao <zhujunhao11@huawei.com> - 2.2.0-10
- add udp muticast loop
* Mon Mar 18 2024 yangchen <yangchen145@huawei.com> - 2.2.0-9
- tansfer pbuf timestamp in ip frag
* Fri Mar 15 2024 liyunqing <liyunqing@kylinos.cn> - 2.2.0-8
- enable LWIP_SO_RCVTIMEO to support recv\accept timeout
* Mon Mar 11 2024 liyunqing <liyunqing@kylinos.cn> - 2.2.0-7
- sync macros with kernel defined which use in recv and send
* Thu Mar 7 2024 liyunqing <liyunqing@kylinos.cn> - 2.2.0-6
- fix duplicate pbuf_free in udp_sendto
* Wed Mar 6 2024 yangchen <yangchen145@huawei.com> - 2.2.0-5
- support udp pkglen > mtu: modify netbuf_alloc size
* Tue Mar 5 2024 yangchen <yangchen145@huawei.com> - 2.2.0-4
- support udp pkglen > mtu: modify IP_REASS_MAX_PBUFS
* Tue Mar 5 2024 peng.zou <peng.zou@shingroup.cn> - 2.2.0-3
- add ppc64le support
* Sun Feb 18 2024 jiangheng <jiangheng14@huawei.com> - 2.2.0-2
- remove backport patches
- sys_mbox_new return error when rte ring create failed
* Mon Feb 05 2024 jiangheng <jiangheng14@huawei.com> - 2.2.0-1
- update to lwip-2.2.0
* Fri Feb 2 2024 shafeipaozi <sunbo.oerv@isrc.iscas.ac.cn> - 2.1.3-116
- add support riscv
* Thu Feb 01 2024 yangchen <yangchen145@huawei.com> - 2.1.3-115
- support udp recv zero packets
* Tue Jan 30 2024 jiangheng <jiangheng14@huawei.com> - 2.1.3-114
- fix receive fin packet process error
* Tue Jan 30 2024 jiangheng <jiangheng14@huawei.com> - 2.1.3-113
- fix move lpcb to the front of list error
* Wed Jan 24 2024 jiangheng <jiangheng14@huawei.com> - 2.1.3-112
- adapt for dpdk-23.11
* Fri Jan 19 2024 jiangheng <jiangheng14@huawei.com> - 2.1.3-111
- remove unnecessary variables in struct pbuf
* Wed Jan 10 2024 hankangkang <hankangkang5@huawei.com> - 2.1.3-110
- delete redundant logs in lwip
* Tue Jan 16 2024 zhengjiebing <zhengjiebing@cmss.chinamobile.com> - 2.1.3-109
- optimize enqueue way for unacked and unsent queue
* Mon Jan 15 2024 jiangheng <jiangheng14@huawei.com> - 2.1.3-108
- adapt for dpdk-23.11
* Wed Jan 10 2024 yangchen <yangchen145@huawei.com> - 2.1.3-107
- dfx: add tcp_in empty ack cnt and del rst invalid log
* Mon Jan 08 2024 zhengjiebing <zhengjiebing@cmss.chinamobile.com> - 2.1.3-106
- fix wrong namelen in lwip_getaddrname
* Tue Jan 02 2024 zhengjiebing <zhengjiebing@cmss.chinamobile.com> - 2.1.3-105
- replace qtuple addr with gz_addr_t
* Tue Jan 02 2024 jiangheng <jiangheng14@huawei.com> - 2.1.3-104
- tcp_in: fix ooseq update error
* Fri Dec 29 2023 jiangheng <jiangheng14@huawei.com> - 2.1.3-103
- rte_ring_get_memsize adapt dpdk 19.11
* Tue Dec 26 2023 jiangheng <jiangheng14@huawei.com> - 2.1.3-102
- fix rte_ring_create/free time-consuming
* Tue Dec 26 2023 jiangheng <jiangheng14@huawei.com> - 2.1.3-101
- remove duplicate lwip log
* Mon Dec 25 2023 hankangkang <hankangkang5@huawei.com> - 2.1.3-100
- Mod the issue that 2w connection unable to establish
* Sat Dec 23 2023 yangchen <yangchen145@huawei.com> - 2.1.3-99
- tcp_send_fin: add the fin to the last unsent segment
* Wed Dec 20 2023 yangchen <yangchen145@huawei.com> - 2.1.3-98
- event_callback: del errevent log if err is ERR_OK
* Fri Dec 15 2023 yangchen <yangchen145@huawei.com> - 2.1.3-97
- lwip log: fix reversed port in tcp_input
* Thu Dec 14 2023 hankangkang <hankangkang5@huawei.com> - 2.1.3-96
- modfiy-accept-null-pointer-when-new-conn-receive-RST-packet-in-listening
* Sat Dec 9 2023 wuchangye <wuchangye@huawei.com> - 2.1.3-95
- fix the coredump issue when UDP traffic is sent
@ -186,10 +377,9 @@ cd %{_builddir}/%{name}-%{version}/src
- adapt read/write for rtc mode
- fix recvmsg return EINVAL
- adapt event for rtc mode
- gazelle offloads are registerd to lwip
* Fri Nov 3 2023 liyanan <liyanan61@h-parners.com> - 2.1.3-79
- Adapt dpdk fallback
* Tue Oct 24 2023 jiangheng <jiangheng14@huawei.com> - 2.1.3-79
- gazelle offloads are registerd to lwip
* Sun Oct 08 2023 jiangheng <jiangheng14@huawei.com> - 2.1.3-78
- lstack_lwip: external api start with do_lwip_ prefix