patchlwIP - A Lightweight TCP/IP stack - Patches: patch #5919, Create compile switch to remove...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #5919: Create compile switch to remove select code

Submitted by:  Simon Goldschmidt <goldsimon>
Submitted on:  Tue 08 May 2007 08:42:13 AM UTC  
 
Category:  None Priority:  3 - Low
Status:  None Privacy:  Public
Assigned to:  Simon Goldschmidt <goldsimon> Open/Closed:  Closed
Planned Release:  None

( Jump to the original submission)

Sat 09 Jun 2007 11:37:31 AM UTC, comment #22: 

> but it's increase the footprint for nothing if you don't use it...


I know, but I think we can talk about completely removing that stuff once we have an independent socket layer. There seems to be much stuff inside the netconn layer only used for sockets...

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Sat 09 Jun 2007 11:28:20 AM UTC, comment #21: 

About comment #19, yes, you're right, but it's increase the footprint for nothing if you don't use it...

Frédéric Bernon <fbernon>
Project Member
Sat 09 Jun 2007 11:27:08 AM UTC, comment #20: 

(sorry, it seems our submit have be sent in the same time, and mine reopen it by error, Savane is not real safe-thread ;) )

Frédéric Bernon <fbernon>
Project Member
Sat 09 Jun 2007 11:25:56 AM UTC, comment #19: 

As far as I can see it (but I'm far from sure), the only thing we could remove in the netconn api is the recv_avail and the callback code...

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Sat 09 Jun 2007 11:15:06 AM UTC, comment #18: 

I think that most of the change to disable extra code in inside api_lib and api_msg, so, it should be apply in current code (to my point of view)...

Frédéric Bernon <fbernon>
Project Member
Sat 09 Jun 2007 11:14:50 AM UTC, comment #17: 

Since with a new socket layer at the horizon, I'm not really keen on working out how that callback-mechanism works, I'm closing this and making this idea a design goal for a new socket layer.

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Sat 09 Jun 2007 11:07:01 AM UTC, comment #16: 

Sorry, seems like I forgot this item for a while...
I'm currently not really working on this so I have no answers. Maybe it is even better to close this and take the idea (of removing select code per define) as a design goal for a new socket layer?

But for then, the defines you suggested would make sense!

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Sat 09 Jun 2007 10:43:56 AM UTC, comment #15: 

Simon, can you give me answers to comment #14?

Frédéric Bernon <fbernon>
Project Member
Sat 02 Jun 2007 12:59:19 PM UTC, comment #14: 

So, for this item, we will get two new options? LWIP_SOCKETS_SELECT &  LWIP_NONBLOCKING_SOCKETS? Just off topic, perhaps it will be good to uniformize socket defines names ?

LWIP_SOCKETS_NONBLOCKING
LWIP_SOCKETS_COMPAT
LWIP_SOCKETS_POSIX_IO_NAMES

?

Frédéric Bernon <fbernon>
Project Member
Sat 02 Jun 2007 12:46:52 PM UTC, comment #13: 

I'm planning to check this in in a few days, expanded by another switch that disables the netconn->callback if non-blocking I/O is not needed to further shrink code size.

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Sat 02 Jun 2007 12:45:32 PM UTC, comment #12: 

Just for the record (even if it's a little off-topic): changes from comment #11 are checked in.

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Tue 22 May 2007 09:36:08 PM UTC, comment #11: 

I think to extend LWIP_SO_RCVTIMEO to TCP connections. It will be the same code, or something near...

But, I don't like this part of code in netconn_recv:

    /* If we are closed, we indicate that we no longer wish to receive
       data by setting conn->recvmbox to SYS_MBOX_NULL. */
    if (p == NULL) {
      memp_free(MEMP_NETBUF, buf);
      sys_mbox_free(conn->recvmbox);
      conn->recvmbox = SYS_MBOX_NULL;
      return NULL;
    }

I think it's not very thread-safe...

Frédéric Bernon <fbernon>
Project Member
Tue 22 May 2007 08:33:42 PM UTC, comment #10: 

Ok, so event_callback seems to be needed for non-blocking sockets. This could be avoided, however, if the netconn API would support non-blocking receive (which is not that useful since we have callbacks for that). But since we now have sys_arch_mbox_tryfetch(), it could be solved in that way. However, I suggest to leave it like it is (which means we need event_callback regardless of select()).

We could however introduce another option LWIP_NONBLOCKING_SOCKETS to remove that kind of code in order to reduce code size.

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Tue 22 May 2007 07:31:47 AM UTC, comment #9: 

You're right, it works. So no need for more switches.

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Sat 19 May 2007 10:57:30 PM UTC, comment #8: 

re Simon's comment #6:

Just so you know, nios2-elf-gcc does support leaving out unused functions - people have been using it with that in the company I work for. There might be an issue with your linker scripts. Mail me off-list (since it's off-topic) and I might be able to help. Let me know specifically what functions should have been included that weren't, and any reason they may have been left out. And possibly also your linker script. NB a linker map may also be informative (-Wl,-Map,mapfile on the gcc link line, in case you don't already know).

Jonathan Larmour <jifl>
Project Member
Thu 17 May 2007 10:33:39 AM UTC, comment #7: 

Hm, I'm afraid I don't really know if that works in all cases so I'd rather do some more tests...

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Thu 17 May 2007 10:20:16 AM UTC, comment #6: 

>except I don't really like LWIP_HAVE_SELECT name.


OK, I'm changing the name into LWIP_SOCKETS_SELECT and checking it in.

BTW: Jonathan said most modern compilers can leave out unused functions. I just realized my compiler (nios2-elf-gcc/-ld) can't! And if I tell it to, it leaves out functions that are used! So for compilers like this, we would need even more switches like this. Personally, I don't favour having too many config-options, but I would help to keep the code footprint small...

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Fri 11 May 2007 07:55:56 AM UTC, comment #5: 

I think you need e.g. the sock->recevent to be able for an application thread to copy something the tcpip_thread has already received (maybe only in non-blocking mode). I didn't investigate this further, this was only what I think after having a quick look over it.

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Fri 11 May 2007 07:50:05 AM UTC, comment #4: 

Are you sure about your answer in comment #2 ? I don't really see what other operation really need event_callback except "select"... Perhaps I miss something...

Frédéric Bernon <fbernon>
Project Member
Tue 08 May 2007 06:03:50 PM UTC, comment #3: 

Ooops, pressed the button too early :-) I wanted to say I have included a patch of sockets.c that should work...

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Tue 08 May 2007 06:02:29 PM UTC, comment #2: 

>why don't you have disable all "event_callback"? Is it used for something else than "select"?


Ha, at first I was confused by your answer. Then I kept on reading the code and the answer is I left out too much. The whole recvevent thing seems to be needed by normal (non-select) operation.

(file #12717)

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Tue 08 May 2007 04:02:41 PM UTC, comment #1: 

Agree for that, except I don't really like LWIP_HAVE_SELECT name. Another question, why don't you have disable all "event_callback"? Is it used for something else than "select"?

Frédéric Bernon <fbernon>
Project Member
Tue 08 May 2007 08:42:13 AM UTC, original submission:  

To reduce footprint (and gain a little speed) if lwip_select() is not used, I propose to create a define that can be set to 0 to remove select code (mainly the selectsem and some code in event_callback).

See attached patch

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.

 

Attached Files
file #12716:  select_define.patch added by goldsimon (3KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jifl (Posted a comment)
  • -email is unavailable- added by fbernon (Posted a comment)
  • -email is unavailable- added by goldsimon (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-06-09 fbernon Open/ClosedOpen => Closed
    2007-06-09 fbernon StatusWont Do => None
        Open/ClosedClosed => Open
    2007-06-09 goldsimon StatusNone => Wont Do
        Open/ClosedOpen => Closed
    2007-05-08 goldsimon Attached File- => Added sockets.c_select_define2.patch, #12717
    2007-05-08 goldsimon Attached File- => Added select_define.patch, #12716

    Back to the top


    Powered by Savane 3.5