xiaoxiang781216 commented on code in PR #7890:
URL: https://github.com/apache/nuttx/pull/7890#discussion_r1051601118


##########
mm/iob/iob_initialize.c:
##########
@@ -52,11 +51,13 @@
  */
 
 #ifdef IOB_SECTION
-static uint8_t g_iob_buffer[IOB_BUFFER_SIZE] locate_data(IOB_SECTION);
+static uint8_t g_iob_buffer[IOB_POOLSIZE] locate_data(IOB_SECTION);

Review Comment:
   static uint8_t g_iob_buffer[CONFIG_IOB_NBUFFERS][IOB_BUFSIZE]  
locate_data(IOB_SECTION);



##########
mm/iob/iob_initialize.c:
##########
@@ -52,11 +51,13 @@
  */
 
 #ifdef IOB_SECTION
-static uint8_t g_iob_buffer[IOB_BUFFER_SIZE] locate_data(IOB_SECTION);
+static uint8_t g_iob_buffer[IOB_POOLSIZE] locate_data(IOB_SECTION);
 #else
-static uint8_t g_iob_buffer[IOB_BUFFER_SIZE];
+static uint8_t g_iob_buffer[IOB_POOLSIZE];

Review Comment:
   static uint8_t g_iob_buffer[CONFIG_IOB_NBUFFERS][IOB_BUFSIZE];



##########
include/nuttx/mm/iob.h:
##########
@@ -114,6 +114,14 @@ struct iob_s
 #endif
   unsigned int io_pktlen; /* Total length of the packet */
 
+#ifdef CONFIG_IOB_SHARED
+  /* Pointer to parent node */
+
+  FAR struct iob_s *io_parent;
+
+  unsigned int io_refs; /* Reference count of this iob */

Review Comment:
   why the reference count not part of io_data?



##########
net/tcp/tcp_send.c:
##########
@@ -402,7 +405,10 @@ void tcp_reset(FAR struct net_driver_s *dev)
 
   /* Update device buffer length before setup the IP header */
 
-  iob_update_pktlen(dev->d_iob, dev->d_len);

Review Comment:
   move the check to iob_update_pktlen



##########
mm/iob/iob_initialize.c:
##########
@@ -117,25 +118,18 @@ sem_t g_qentry_sem = SEM_INITIALIZER(CONFIG_IOB_NCHAINS);
 void iob_initialize(void)
 {
   int i;
-  uintptr_t buf;
-
-  /* Get a start address which plus offsetof(struct iob_s, io_data) is
-   * aligned to the CONFIG_IOB_ALIGNMENT memory boundary
-   */
-
-  buf = ROUNDUP((uintptr_t)g_iob_buffer + offsetof(struct iob_s, io_data),
-                CONFIG_IOB_ALIGNMENT) - offsetof(struct iob_s, io_data);
 
   /* Get I/O buffer instance from the start address and add each I/O buffer
    * to the free list
    */
 
   for (i = 0; i < CONFIG_IOB_NBUFFERS; i++)
     {
-      FAR struct iob_s *iob = (FAR struct iob_s *)(buf + i * IOB_ALIGN_SIZE);
+      FAR struct iob_s *iob = &g_iob_list[i];
 
       /* Add the pre-allocate I/O buffer to the head of the free list */
 
+      iob->io_data   = &g_iob_buffer[i * IOB_BUFSIZE];

Review Comment:
   iob->io_data   = g_iob_buffer[i];



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to