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/06/30 11:40:20 UTC

[incubator-nuttx] branch master updated (08e9dff -> c7ba756)

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

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


    from 08e9dff  tcp_close: disable send callback before sending FIN
     new 52c237c  net/tcp/tcp.h: Update a comment about readahead
     new 7599ca4  Kconfig: mention that IOB_NCHAINS is not used by TCP anymore
     new 3142375  Add iob_tailroom
     new c7ba756  tcp_recvwindow.c: Use iob_tailroom to replace the home grown one

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 include/nuttx/mm/iob.h                      | 11 +++++++++++
 mm/iob/Kconfig                              |  3 +++
 mm/iob/Make.defs                            |  2 +-
 mm/iob/{iob_free_chain.c => iob_tailroom.c} | 21 +++++++++------------
 net/tcp/tcp.h                               |  2 +-
 net/tcp/tcp_recvwindow.c                    | 12 +-----------
 6 files changed, 26 insertions(+), 25 deletions(-)
 copy mm/iob/{iob_free_chain.c => iob_tailroom.c} (79%)

[incubator-nuttx] 04/04: tcp_recvwindow.c: Use iob_tailroom to replace the home grown one

Posted by xi...@apache.org.
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

commit c7ba75697c258284d7e72dc2104307eb2c14ba91
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Wed Jun 30 15:05:53 2021 +0900

    tcp_recvwindow.c: Use iob_tailroom to replace the home grown one
---
 net/tcp/tcp_recvwindow.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/net/tcp/tcp_recvwindow.c b/net/tcp/tcp_recvwindow.c
index fdb1569..3f0e0b8 100644
--- a/net/tcp/tcp_recvwindow.c
+++ b/net/tcp/tcp_recvwindow.c
@@ -110,17 +110,7 @@ uint16_t tcp_get_recvwindow(FAR struct net_driver_s *dev,
 
   if (conn->readahead != NULL)
     {
-      /* XXX move this to mm/iob */
-
-      const struct iob_s *iob;
-
-      iob = conn->readahead;
-      while (iob->io_flink != NULL)
-        {
-          iob = iob->io_flink;
-        }
-
-      tailroom = CONFIG_IOB_BUFSIZE - (iob->io_offset + iob->io_len);
+      tailroom = iob_tailroom(conn->readahead);
     }
   else
     {

[incubator-nuttx] 02/04: Kconfig: mention that IOB_NCHAINS is not used by TCP anymore

Posted by xi...@apache.org.
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

commit 7599ca4e958a2dd3839da4c959d4d0db0330c3f1
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Wed Jun 30 14:44:23 2021 +0900

    Kconfig: mention that IOB_NCHAINS is not used by TCP anymore
---
 mm/iob/Kconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/mm/iob/Kconfig b/mm/iob/Kconfig
index 9327ee1..85dc43f 100644
--- a/mm/iob/Kconfig
+++ b/mm/iob/Kconfig
@@ -47,6 +47,9 @@ config IOB_NCHAINS
 		I/O buffer chain containers that also carry a payload of usage
 		specific information.
 
+		Note: TCP doesn't use this.
+		Note: UDP and CAN use this.
+
 config IOB_THROTTLE
 	int "I/O buffer throttle value"
 	default 0 if !NET_WRITE_BUFFERS || !NET_READAHEAD

[incubator-nuttx] 03/04: Add iob_tailroom

Posted by xi...@apache.org.
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

commit 314237588eb0beb5153b434d6af7fc8f690234de
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Wed Jun 30 15:05:06 2021 +0900

    Add iob_tailroom
    
    I plan to use this for tcp.
---
 include/nuttx/mm/iob.h | 11 +++++++++++
 mm/iob/Make.defs       |  2 +-
 mm/iob/iob_tailroom.c  | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 64 insertions(+), 1 deletion(-)

diff --git a/include/nuttx/mm/iob.h b/include/nuttx/mm/iob.h
index 3b70286..abdce41 100644
--- a/include/nuttx/mm/iob.h
+++ b/include/nuttx/mm/iob.h
@@ -479,6 +479,17 @@ int iob_copyout(FAR uint8_t *dest, FAR const struct iob_s *iob,
                 unsigned int len, unsigned int offset);
 
 /****************************************************************************
+ * Name: iob_tailroom
+ *
+ * Description:
+ *  Return the number of bytes at the tail of the I/O buffer chain which
+ *  can be used to append data without additional allocations.
+ *
+ ****************************************************************************/
+
+unsigned int iob_tailroom(FAR struct iob_s *iob);
+
+/****************************************************************************
  * Name: iob_clone
  *
  * Description:
diff --git a/mm/iob/Make.defs b/mm/iob/Make.defs
index e241204..4ae751a 100644
--- a/mm/iob/Make.defs
+++ b/mm/iob/Make.defs
@@ -27,7 +27,7 @@ CSRCS += iob_concat.c iob_copyin.c iob_copyout.c iob_contig.c iob_free.c
 CSRCS += iob_free_chain.c iob_free_qentry.c iob_free_queue.c
 CSRCS += iob_initialize.c iob_pack.c iob_peek_queue.c iob_remove_queue.c
 CSRCS += iob_statistics.c iob_trimhead.c iob_trimhead_queue.c iob_trimtail.c
-CSRCS += iob_navail.c iob_free_queue_qentry.c
+CSRCS += iob_navail.c iob_free_queue_qentry.c iob_tailroom.c
 
 ifeq ($(CONFIG_IOB_NOTIFIER),y)
   CSRCS += iob_notifier.c
diff --git a/mm/iob/iob_tailroom.c b/mm/iob/iob_tailroom.c
new file mode 100644
index 0000000..d0c9991
--- /dev/null
+++ b/mm/iob/iob_tailroom.c
@@ -0,0 +1,52 @@
+/****************************************************************************
+ * mm/iob/iob_tailroom.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <nuttx/mm/iob.h>
+
+#include "iob.h"
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: iob_tailroom
+ *
+ * Description:
+ *  Return the number of bytes at the tail of the I/O buffer chain which
+ *  can be used to append data without additional allocations.
+ *
+ ****************************************************************************/
+
+unsigned int iob_tailroom(FAR struct iob_s *iob)
+{
+  while (iob->io_flink != NULL)
+    {
+      iob = iob->io_flink;
+    }
+
+  return CONFIG_IOB_BUFSIZE - (iob->io_offset + iob->io_len);
+}

[incubator-nuttx] 01/04: net/tcp/tcp.h: Update a comment about readahead

Posted by xi...@apache.org.
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

commit 52c237cb5f85093104ca2f78e75a48f6178fc9de
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Wed Jun 30 14:27:20 2021 +0900

    net/tcp/tcp.h: Update a comment about readahead
---
 net/tcp/tcp.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/tcp/tcp.h b/net/tcp/tcp.h
index 6f0ca62..6f592c0 100644
--- a/net/tcp/tcp.h
+++ b/net/tcp/tcp.h
@@ -205,7 +205,7 @@ struct tcp_conn_s
 
   /* Read-ahead buffering.
    *
-   *   readahead - A singly linked list of type struct iob_qentry_s
+   *   readahead - A singly linked list of type struct iob_s
    *               where the TCP/IP read-ahead data is retained.
    */