patchlwIP - A Lightweight TCP/IP stack - Patches: patch #5687, api_lib.c: allocate all 'struct...


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

patch #5687: api_lib.c: allocate all 'struct api_msg' on stack instead of mem-pool

Submitted by:  Simon Goldschmidt <goldsimon>
Submitted on:  Mon 15 Jan 2007 10:01:39 AM UTC  
Category:  None Priority:  5 - Normal
Status:  Done Privacy:  Public
Assigned to:  Kieran Mansley <kieranm> Open/Closed:  Closed
Planned Release:  None

Wed 28 Feb 2007 03:32:17 PM UTC, comment #3: 

Isn't be better to directly use the api_msg, without using the api_msg* ?

There is more changes, but call would be a little bit simplest. Example with netconn_disconnect:

netconn_disconnect(struct netconn *conn)
  struct api_msg msg;


  if (conn == NULL) {
    return ERR_VAL;

  msg.type = API_MSG_DISCONNECT;
  msg.msg.conn = conn; 
  sys_mbox_fetch(conn->mbox, NULL, 0);
  return conn->err;

Frédéric Bernon <fbernon>
Project Member
Wed 28 Feb 2007 02:15:56 PM UTC, comment #2: 

I have applied this patch but had to strip the windows newline characters before it would succeed.

Have checked it in.  Please review/test and report any problems.

Kieran Mansley <kieranm>
Project MemberIn charge of this item.
Mon 19 Feb 2007 10:50:46 AM UTC, comment #1: 

I think this should go in.  Any objections?

Kieran Mansley <kieranm>
Project MemberIn charge of this item.
Mon 15 Jan 2007 10:01:39 AM UTC, original submission:  

The messages passed between application thread and tcpip thread can be allocated on the stack instead of through memp_malloc(), which should minimize memory usage (struct api_msg is about 24 bytes, only one at a time is allocated per thread) and should be (a little bit) faster (since allocating on the stack is faster that memp_malloc()).

NOTE that in tcpip.c:179 the api_msg was deleted if allocation of MEMP_TCPIP_MSG failed! This would leave the calling thread deadlocked since it waits for an answer of the tcpip thread. Thus, the old version didn't work anyway if the allocation failed...

Simon Goldschmidt <goldsimon>
Project Administrator


Attached Files
file #11755:  patch_MEMP_API_MSG.patch added by goldsimon (8KiB - 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 fbernon (Posted a comment)
  • -email is unavailable- added by kieranm (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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-02-28 kieranm StatusNone => Done
        Open/ClosedOpen => Closed
    2007-02-19 kieranm Assigned toNone => kieranm
    2007-01-15 goldsimon Attached File- => Added patch_MEMP_API_MSG.patch, #11755
        Carbon-Copy- => Added

    Back to the top

    Powered by Savane 3.5