tasklwIP - A Lightweight TCP/IP stack - Tasks: task #6833, netif.h: add netif->poll() /...

 
 

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

task #6833: netif.h: add netif->poll() / create netif_poll_all() to simplify porting

Submitter:  Simon Goldschmidt <goldsimon>
Submitted:  Sun 29 Apr 2007 05:54:56 PM UTC
   
 
Category:  Network drivers Should Start On:  Sun 29 Apr 2007 12:00:00 AM UTC
Should be Finished on:  Sun 29 Apr 2007 12:00:00 AM UTC Priority:  1 - Later
Status:  None Privacy:  Public
Assigned to:  None Percent Complete:  0%
Open/Closed:  Closed Planned Release:  None
Effort:  0.00

Mon 30 Apr 2007 01:43:57 PM UTC, comment #2: 

I had some more in the back of my mind when I wrote this and I agree, that (besides easier porting) we don't really need it, now.

I was thinking about the following scenario: we could protect all access to stack-internal functions and modify the socket/netconn API to be configured call directly into the stack (with locking instead of messages. That way you could easily use a sequential API without an OS. Only you have to make sure the netif can input packets when it wants and the timers are called. You can then call netif_poll_all() & sys_check_timers() to let the stack run a bit.

But as I said, that's an idea for the far future and I'm going to test it in private, first (if it gives enough performance) and not going to bother the rest of you with it until I have positive results ;-)

OK, closing this. (Maybe I'll reopen it some time...)

Simon Goldschmidt <goldsimon>
Group administrator
Mon 30 Apr 2007 01:34:13 PM UTC, comment #1: 

Just my opinion, but I don't see any real value in this to warrant extra code/data. In the majority of cases, this would just convert a native driver's poll in a main outer loop to an API call that just does exactly the same thing, but now has to conform to an API and fit into the netif abstraction.

So instead of calling something like e.g.:
  while (1) {
    pbuf = myeth_driver_poll();
    if (pbuf)
      tcpip_ethinput(pbuf, netif_eth0);
  }

you now would call netif_poll_all(), which would have to call myeth_driver_poll() - a function which does the same operation.

If we want to make this area easier to use, an example would be better than an API change. I don't think it's that difficult to use anyway.

As I said, just my opinion though.

Jonathan Larmour <jifl>
Group Member
Sun 29 Apr 2007 05:54:56 PM UTC, original submission:  

This idea comes from linux, actually: if drivers don't have an interrupt, they can specify a function poll() which handles the receiving of packets.

I would expand the struct netif by a function 'poll(struct netif*)' that can be called in the main loop, when using polling / non-interrupt mode of lwIP (aka SYS_LIGHTWEIGHT_PROT = 0).

Also, I would create a function like netif_poll_all() in netif.c, which polls all netifs on the list 'netif_list' that are up. We then could (together with the function sys_check_timers() that I'm currently implementing) provide an example 'main loop' to simplify porting/using lwIP in such non-interrupt environments.

Simon Goldschmidt <goldsimon>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

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 goldsimon (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-04-30 goldsimon Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code