tasklwIP - A Lightweight TCP/IP stack - Tasks: task #7421, Implement SO_RCVBUF

 
 

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

task #7421: Implement SO_RCVBUF

Submitted by:  Frédéric Bernon <fbernon>
Submitted on:  Tue 30 Oct 2007 11:18:11 AM UTC  
 
Category:  UDP Should Start On:  Mon 29 Oct 2007 11:00:00 PM UTC
Should be Finished on:  Mon 29 Oct 2007 11:00:00 PM UTC Priority:  5 - Normal
Status:  Done Privacy:  Public
Percent Complete:  100% Assigned to:  Frédéric Bernon <fbernon>
Open/Closed:  Closed Planned Release:  1.3.0
Effort:  0.00

( Jump to the original submission)

Sun 16 Dec 2007 04:50:30 PM UTC, comment #12: 

Ok, I close it

Frédéric Bernon <fbernon>
Project MemberIn charge of this item.
Sun 16 Dec 2007 04:33:01 PM UTC, comment #11: 

Is there anything left to do here? I'd move implementing the listen backlog to a new task; for the recv_avail problem, there is already a bug (bug #21698).

Simon Goldschmidt <goldsimon>
Project Administrator
Mon 26 Nov 2007 08:10:32 AM UTC, comment #10: 

I think the idea is going in the right direction, but the macros might not be sufficient if you want to avoid increasign a variable over a certain limit. (for recv_avail this works since only tcpip_thread increases it, application threads only decrease it).

But it's a good starting point to get cleaner code, I think!

Simon Goldschmidt <goldsimon>
Project Administrator
Mon 26 Nov 2007 12:35:49 AM UTC, comment #9: 

To protect concurrent access to netconn::recv_avail, I thought to use macro like the ones I put the joined file (protect.h). They could be used with any other counters in lwIP (lwip_socket::rcvevent, lwip_socket::sendevent...).

Thoughts?

(file #14484)

Frédéric Bernon <fbernon>
Project MemberIn charge of this item.
Fri 09 Nov 2007 01:09:11 PM UTC, comment #8: 

I'm removing this from 1.3.0 because it's not critical (but still welcome)

Kieran Mansley <kieranm>
Project Member
Wed 07 Nov 2007 05:55:21 PM UTC, comment #7: 

Good idea.

Simon Goldschmidt <goldsimon>
Project Administrator
Wed 07 Nov 2007 09:59:59 AM UTC, comment #6: 

I thought we could also implement the "listen" backlog with a such counter implementation.

Frédéric Bernon <fbernon>
Project MemberIn charge of this item.
Fri 02 Nov 2007 10:42:31 AM UTC, comment #5: 

I check in this first patch (since there is no problem if you don't set LWIP_SO_RCVBUF=1 in your lwipopts.h).

>we should provide a function for access to recv_bufsize for netconn API apps


I add a netconn_recv_bufsize macro in api.h

>we should really work on protecting recv_avail, or am I wrong?


Yes, but it's common problem for FIONREAD with lwip_ioctl/ioctlsocket. Perhaps another task?

>maybe we should check linux or other stacks how they handle SO_RCVBUF for TCP sockets...


Yes, good idea (but in a first time, the TCP_WND is a first feature, but common to all tcp connections).

>Only I would combine the if statements that are the same for #if LWIP_SO_RCVBUF and #else in api_msg.c


That what I did the first time, but it was not very "nice" for brackets, and not really more readable. But feel free to change it if you prefer...

Frédéric Bernon <fbernon>
Project MemberIn charge of this item.
Fri 02 Nov 2007 08:28:49 AM UTC, comment #4: 

Wow, such a simple patch, why didn't we include that earlier?

Some comments:
- we should provide a function for access to recv_bufsize for netconn API apps
- we should really work on protecting recv_avail, or am I wrong?
- maybe we should check linux or other stacks how they handle SO_RCVBUF for TCP sockets...

Other than that: great work! (Only I would combine the if statements that are the same for #if LWIP_SO_RCVBUF and #else in api_msg.c).

Simon Goldschmidt <goldsimon>
Project Administrator
Thu 01 Nov 2007 10:14:58 PM UTC, comment #3: 

The full patch (+sockets.c/.h and opt.h part).

(file #14273)

Frédéric Bernon <fbernon>
Project MemberIn charge of this item.
Thu 01 Nov 2007 08:32:29 PM UTC, comment #2: 

I attach a first patch (there is not the sockets.c/.h and opt.h part). It just process UDP & RAW netconn (since TCP not need it).

It's mainly a new "netconn::recv_bufsize" field, initialized to 0xffffffff (without any real limit), that can be set to a lower value to be able to limit the number of bytes in the "netconn::recvmbox". It used the "netconn::recv_avail" field (not very well protected for thread-safing).

Comments?

(file #14272)

Frédéric Bernon <fbernon>
Project MemberIn charge of this item.
Thu 01 Nov 2007 12:57:16 PM UTC, comment #1: 

Seems like a good idea and fits well with lwIP's lightweight nature.

Kieran Mansley <kieranm>
Project Member
Tue 30 Oct 2007 11:18:11 AM UTC, original submission:  

In the sequential api, if the application never fetch packets on a UDP connection, nothing avoid to consumne all netbuf/pbuf. A SO_RCVBUF can be a solution to limit number of bytes in a netconn::recvmbox.

Frédéric Bernon <fbernon>
Project MemberIn charge of this item.

 

Attached Files
file #14484:  protect.h added by fbernon (725B - text/x-chdr)
file #14273:  LWIP_SO_RCVBUF.txt added by fbernon (5KiB - text/plain)
file #14272:  LWIP_SO_RCVBUF.txt added by fbernon (3KiB - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by kieranm (Posted a comment)
  • -email is unavailable- added by fbernon (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 13 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-12-16 fbernon StatusIn Progress => Done
        Percent Complete50% => 100%
        Open/ClosedOpen => Closed
        Planned ReleaseNone => 1.3.0
    2007-11-26 fbernon Attached File- => Added protect.h, #14484
    2007-11-09 kieranm Planned Release1.3.0 => None
    2007-11-02 fbernon Percent Complete10% => 50%
        Assigned toNone => fbernon
        Planned ReleaseNone => 1.3.0
    2007-11-02 fbernon StatusNone => In Progress
    2007-11-01 fbernon Attached File- => Added LWIP_SO_RCVBUF.txt, #14273
    2007-11-01 fbernon Attached File- => Added LWIP_SO_RCVBUF.txt, #14272
        Percent Complete0% => 10%

    Back to the top


    Powered by Savane 3.5