virtio: record local_port for distributing pkts in virtio_user.

(cherry picked from commit a37e0838d2d238b31e9784a579dba4dd61b53a04)
This commit is contained in:
hantwofish 2024-06-25 15:33:13 +08:00 committed by openeuler-sync-bot
parent a490e695e8
commit e6178582ca
2 changed files with 58 additions and 1 deletions

View File

@ -0,0 +1,52 @@
From 97608b76168fc80d25f1871f4c8c17fd0457c9f9 Mon Sep 17 00:00:00 2001
From: hantwofish <hankangkang5@huawei.com>
Date: Tue, 25 Jun 2024 15:25:18 +0800
Subject: [PATCH] [virtio]: record local_port for port_map of virtio
---
src/core/udp.c | 8 ++++++++
src/include/reg_sock.h | 2 ++
2 files changed, 10 insertions(+)
diff --git a/src/core/udp.c b/src/core/udp.c
index 086e7e0..6b11bf6 100644
--- a/src/core/udp.c
+++ b/src/core/udp.c
@@ -1191,6 +1191,11 @@ udp_bind(struct udp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port)
LWIP_DEBUGF(UDP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("udp_bind: bound to "));
ip_addr_debug_print_val(UDP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, pcb->local_ip);
LWIP_DEBUGF(UDP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, (", port %"U16_F")\n", pcb->local_port));
+#if GAZELLE_ENABLE
+ struct gazelle_quintuple qtuple = {0};
+ qtuple.src_port = lwip_htons(pcb->local_port);
+ vdev_reg_xmit(REG_RING_UDP_BIND, &qtuple);
+#endif
return ERR_OK;
}
@@ -1373,6 +1378,9 @@ udp_remove(struct udp_pcb *pcb)
}
}
#if GAZELLE_UDP_ENABLE
+ struct gazelle_quintuple qtuple = {0};
+ qtuple.src_port = lwip_htons(pcb->local_port);
+ vdev_reg_xmit(REG_RING_UDP_BIND_CLOSE, &qtuple);
udp_release_port(pcb->local_port);
#endif
memp_free(MEMP_UDP_PCB, pcb);
diff --git a/src/include/reg_sock.h b/src/include/reg_sock.h
index 466a2c2..04d1a8f 100644
--- a/src/include/reg_sock.h
+++ b/src/include/reg_sock.h
@@ -79,6 +79,8 @@ enum reg_ring_type {
REG_RING_TCP_LISTEN_CLOSE,
REG_RING_TCP_CONNECT,
REG_RING_TCP_CONNECT_CLOSE,
+ REG_RING_UDP_BIND,
+ REG_RING_UDP_BIND_CLOSE,
RING_REG_MAX,
};
--
2.33.0

View File

@ -4,7 +4,7 @@
Summary: lwip is a small independent implementation of the TCP/IP protocol suite
Name: lwip
Version: 2.2.0
Release: 34
Release: 35
License: BSD
URL: http://savannah.nongnu.org/projects/lwip/
Source0: http://download.savannah.nongnu.org/releases/lwip/%{name}-%{version}.zip
@ -153,6 +153,8 @@ Patch9137: 0138-lwip_sock-add-sock_time_stamp.patch
Patch9138: 0139-distinguish-tcp-udp-get_from_sendring.patch
Patch9139: 0140-add-IP_ADD_SOURCE_MEMBERSHIP-to-setsockopt-for-igmpv3.patch
Patch9140: 0141-Improve-size-of-multicast-specifications.patch
Patch9141: 0142-virtio-record-local_port-for-port_map-of-virtio.patch
BuildRequires: gcc-c++ dos2unix dpdk-devel
#Requires:
@ -181,6 +183,9 @@ cd %{_builddir}/%{name}-%{version}/src
%{_libdir}/liblwip.a
%changelog
* Tue Jun 25 2024 hankangkang <hankangkang5@huawei.com> - 2.2.0-35
- virtio: record local_port for distributing pkts in virtio_user.
* Thu Jun 27 2024 wanfeng <wanfeng@kylinos.cn> - 2.2.0-34
- Improve the size of multicast specifications, with a maximum of 16 groups and 32 members per group