You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/12/21 09:14:33 UTC

[incubator-nuttx] branch master updated: net/usrsock: increase the send/recv() length limit to UINT32_MAX

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 1e83c83  net/usrsock: increase the send/recv() length limit to UINT32_MAX
1e83c83 is described below

commit 1e83c83bf30d84564946b10a74ac043c3ed21657
Author: chao.an <an...@xiaomi.com>
AuthorDate: Fri Dec 17 23:47:47 2021 +0800

    net/usrsock: increase the send/recv() length limit to UINT32_MAX
    
    change request type to uint32_t to the impove the throughput
    
    Signed-off-by: chao.an <an...@xiaomi.com>
---
 include/nuttx/net/usrsock.h   | 4 ++--
 net/usrsock/usrsock_recvmsg.c | 4 ++--
 net/usrsock/usrsock_sendmsg.c | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/nuttx/net/usrsock.h b/include/nuttx/net/usrsock.h
index a2ef6fb..581e4b0 100644
--- a/include/nuttx/net/usrsock.h
+++ b/include/nuttx/net/usrsock.h
@@ -154,8 +154,8 @@ begin_packed_struct struct usrsock_request_sendto_s
 
   int16_t usockid;
   int32_t flags;
+  uint32_t buflen;
   uint16_t addrlen;
-  uint16_t buflen;
 } end_packed_struct;
 
 begin_packed_struct struct usrsock_request_recvfrom_s
@@ -164,7 +164,7 @@ begin_packed_struct struct usrsock_request_recvfrom_s
 
   int16_t usockid;
   int32_t flags;
-  uint16_t max_buflen;
+  uint32_t max_buflen;
   uint16_t max_addrlen;
 } end_packed_struct;
 
diff --git a/net/usrsock/usrsock_recvmsg.c b/net/usrsock/usrsock_recvmsg.c
index a5aebfe..d865742 100644
--- a/net/usrsock/usrsock_recvmsg.c
+++ b/net/usrsock/usrsock_recvmsg.c
@@ -159,9 +159,9 @@ static int do_recvfrom_request(FAR struct usrsock_conn_s *conn,
       addrlen = UINT16_MAX;
     }
 
-  if (buflen > UINT16_MAX)
+  if (buflen > UINT32_MAX)
     {
-      buflen = UINT16_MAX;
+      buflen = UINT32_MAX;
     }
 
   /* Prepare request for daemon to read. */
diff --git a/net/usrsock/usrsock_sendmsg.c b/net/usrsock/usrsock_sendmsg.c
index b3fc975..8d9245a 100644
--- a/net/usrsock/usrsock_sendmsg.c
+++ b/net/usrsock/usrsock_sendmsg.c
@@ -159,9 +159,9 @@ static int do_sendto_request(FAR struct usrsock_conn_s *conn,
       req.buflen += msg->msg_iov[i].iov_len;
     }
 
-  if (req.buflen > UINT16_MAX)
+  if (req.buflen > UINT32_MAX)
     {
-      req.buflen = UINT16_MAX;
+      req.buflen = UINT32_MAX;
     }
 
   bufs[0].iov_base = (FAR void *)&req;