aboutsummaryrefslogtreecommitdiffstats
path: root/src/vcl/ldp.c
diff options
context:
space:
mode:
authorDou Chao <chao.dou@intel.com>2022-11-29 19:41:34 +0800
committerFlorin Coras <florin.coras@gmail.com>2022-12-14 16:57:14 +0000
commit243a0433ff05a37113d6890bbeb163bbea033687 (patch)
tree1ac3ec8b63ed22649a30f1c6666ac5460a1ff9b3 /src/vcl/ldp.c
parent4b9935cd54e5ca31c192cb9113e3056016f0b728 (diff)
vcl: enable gso for 'sendmsg' in LDP mode.
Some upon apps(e.g. Nginx-quic) package it's several protocol buffers into a struct msg which is a combination of gso_buffer and gso_size. but if HostStack regardless the gso_size to the buffer and split the buffer with default mss, that cause peer client failed on parsing the package. Type: improvement Signed-off-by: Dou Chao <chao.dou@intel.com> Change-Id: I805eb642be826038ba96d1b85dad8ec0c0f6c459 Signed-off-by: Dou Chao <chao.dou@intel.com>
Diffstat (limited to 'src/vcl/ldp.c')
-rw-r--r--src/vcl/ldp.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/src/vcl/ldp.c b/src/vcl/ldp.c
index 73a5bc20cb4..522e85d9719 100644
--- a/src/vcl/ldp.c
+++ b/src/vcl/ldp.c
@@ -21,6 +21,7 @@
#include <stdarg.h>
#include <sys/resource.h>
#include <netinet/tcp.h>
+#include <linux/udp.h>
#include <vcl/ldp_socket_wrapper.h>
#include <vcl/ldp.h>
@@ -1539,13 +1540,19 @@ __recv_chk (int fd, void *buf, size_t n, size_t buflen, int flags)
return recv (fd, buf, n, flags);
}
-static int
-ldp_vls_sendo (vls_handle_t vlsh, const void *buf, size_t n, int flags,
+static inline int
+ldp_vls_sendo (vls_handle_t vlsh, const void *buf, size_t n,
+ vppcom_endpt_tlv_t *ep_tlv, int flags,
__CONST_SOCKADDR_ARG addr, socklen_t addr_len)
{
vppcom_endpt_t *ep = 0;
vppcom_endpt_t _ep;
+ if (ep_tlv)
+ {
+ _ep.app_data = *ep_tlv;
+ }
+
if (addr)
{
ep = &_ep;
@@ -1614,7 +1621,7 @@ sendto (int fd, const void *buf, size_t n, int flags,
vlsh = ldp_fd_to_vlsh (fd);
if (vlsh != VLS_INVALID_HANDLE)
{
- size = ldp_vls_sendo (vlsh, buf, n, flags, addr, addr_len);
+ size = ldp_vls_sendo (vlsh, buf, n, NULL, flags, addr, addr_len);
if (size < 0)
{
errno = -size;
@@ -1670,11 +1677,26 @@ sendmsg (int fd, const struct msghdr * msg, int flags)
struct iovec *iov = msg->msg_iov;
ssize_t total = 0;
int i, rv = 0;
+ struct cmsghdr *cmsg;
+ uint16_t *valp;
+ vppcom_endpt_tlv_t _app_data;
+ vppcom_endpt_tlv_t *p_app_data = NULL;
+
+ cmsg = CMSG_FIRSTHDR (msg);
+ if (cmsg && cmsg->cmsg_type == UDP_SEGMENT)
+ {
+ p_app_data = &_app_data;
+ valp = (void *) CMSG_DATA (cmsg);
+ p_app_data->data_type = VCL_UDP_SEGMENT;
+ p_app_data->data_len = sizeof (*valp);
+ p_app_data->value = *valp;
+ }
for (i = 0; i < msg->msg_iovlen; ++i)
{
- rv = ldp_vls_sendo (vlsh, iov[i].iov_base, iov[i].iov_len, flags,
- msg->msg_name, msg->msg_namelen);
+ rv =
+ ldp_vls_sendo (vlsh, iov[i].iov_base, iov[i].iov_len, p_app_data,
+ flags, msg->msg_name, msg->msg_namelen);
if (rv < 0)
break;
else