xiaoxiang781216 commented on PR #6834:
URL: https://github.com/apache/incubator-nuttx/pull/6834#issuecomment-1212047063

   > IOB is shared mechanism used for different stacks. So on a multi-stack 
system where `CONFIG_IOB_HEADSIZE>0` all stacks are affected, maybe this is 
even a design limitation of the current IOB design. And could use some 
refactoring/redesign.
   > 
   
   The redesign need extend the iob_buffer which was denied in #6780. In the 
current implementation, the default config keep the size as before, but the 
netdev implementor could extend the header or the alignment, which is a best 
compromise we can find without the major re-architecture.
   
   > But for the moment isn't there any way to introduce user storage for iob 
without affecting all the iob's? A rough idea from my side would just be using 
an union exclusively for the TCP side and not affect the others i.e. And just 
the pointer when using it in the TCP stack
   > 
   
   this approach insert a uint_ptr field but how to allocate the real memory to 
this pointer? Another mem pool?
   
   > ```
   > union iob_s_tcp_playload{
   >    uint_ptr user;
   >    uint8_t  io_data[CONFIG_IOB_BUFSIZE-sizeof(uint_ptr)];
   > } iob_s_tcp_playload;  
   > 
   > struct iob_s incoming_data;
   > 
   > // Fetch iob
   > 
   > iob_s_tcp_playload* tcp_iob = 
(iob_s_tcp_playload*)(&incoming_data.io_data);
   > 
   > struct custom_struct = (struct custom_struct*)tcp_iob.user;
   > memcpy(dst, &tcp_io.iodata[0], sizeof(iob_s_tcp_playload.io_data));
   > ```
   > 
   
   You can't do this since IP layer expect io_data start at the same location 
for all TCP/UDP/ICMP/ICMPv6.
   
   > If you guys could share the TCP changes that need this I can give better 
input on this dicussion, or maybe include this change with this TCP change.
   
   The goal of this patch is different from 
https://github.com/apache/incubator-nuttx/pull/6780/commits/d6affff1241004452267921f5291cfcacc39653d
   
   This patch fix the netdev special requirement:
   
   1. The cache alignment of io_data to improve the performance
   2. Reserve the space before io_data for MAC layer to add the L2 header.
   
   But the preserved header could be used for TCP/UDP/IP out of band data 
potentially.


-- 
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