But note that netif_set_link_up does more than set flags - it does stuff for ARP and IGMP. I think this has come up before - or something similar - did you search this mailing list archive for more on this?
Bill >-----Original Message----- >From: [email protected] >[mailto:[email protected]] On >Behalf Of John Kennedy >Sent: Monday, May 18, 2009 5:22 PM >To: Mailing list for lwIP users >Subject: RE: [lwip-users] netif->flags > >Jeff, >That makes sense to me, I was just a little puzzled by why Lwip doesn't >set NETIF_FLAG_UP with the rest of the flags in low_level_init and why >there is no comment or anything else I can find that indicates that it >even needs to be set. Hence my original question. > >-----Original Message----- >From: Jeff Barber [mailto:[email protected]] >Sent: Monday, May 18, 2009 2:24 PM >To: Mailing list for lwIP users >Subject: Re: [lwip-users] netif->flags > >(I'm still a newbie with lwIP and am still working on a driver so I >have no direct experience yet but...) > >There are two different state bits that are orthogonal: NETIF_FLAG_UP >and NETIF_FLAG_LINK_UP. It appears to me that these are intended to >reflect, respectively, whether the device driver is "running" and >whether the device has established a communication link with a peer >device. So shouldn't you just unconditionally call netif_set_up once >at the beginning (assuming your init function succeeded)? It's what >I've been planning to do. I will also have a static IP but I will >consider my device "up" even if there is no link. There are separate >netif_set_link_up and netif_set_link_down calls that allow the driver >to reflect the current link state. > >Think of the way an ethernet interface works on linux (or any other >unix). You run "ifconfig eth0 up [...]" administratively to load the >driver, initialize the device instance, allocate descriptor rings and >receive buffers and so forth. This all works even if there's no cable >plugged into the port. Then when the cable is plugged in, the driver >calls "set_link_up" and communication can then take place. But the >interface itself does not go up or down every time the link goes up or >down. The interface only goes down if I type "ifconfig eth0 down". > >Jeff > > >On Mon, May 18, 2009 at 3:36 PM, John Kennedy ><[email protected]> wrote: >> Please forgive my ignorance. I think you're right (since I'm not >using DHCP). So it sounds like I should have some kind of link checking >in my code and call netif_set_up and _down as you suggest? Where/how is >this type of checking typically done, I presume I will have to poll the >PHY periodically? >> >> John >> >> -----Original Message----- >> From: Bill Auerbach [mailto:[email protected]] >> Sent: Monday, May 18, 2009 1:07 PM >> To: 'Mailing list for lwIP users' >> Subject: RE: [lwip-users] netif->flags >> >> Does it make sense to call netif_set_up and _down as you see the >physical link come and go. With a static IP, as long as there is a >link, aren't you "up"? >> >> Bill >> >>>-----Original Message----- >>>From: [email protected] >>>[mailto:[email protected]] On >>>Behalf Of John Kennedy >>>Sent: Monday, May 18, 2009 2:50 PM >>>To: Mailing list for lwIP users >>>Subject: RE: [lwip-users] netif->flags >>> >>>Yes, but as far as I can tell netif_set_up is only called in autoip.c >>>and dhcp.c, and I'm not using either yet... >>> >>> >>> >>>________________________________________ >>>John Kennedy >>> >>> >>>Idaho Technology Inc. >>>390 Wakara Way >>>Salt Lake City, UT 84108, USA >>> >>>USA: 1-800-735-6544 >>>Bus:+1 (801)736-6354 x448 >>>Fax:+1 (801)588-0507 >>> >>>http://www.idahotech.com/ >>>-----Original Message----- >>>From: Simon Goldschmidt [mailto:[email protected]] >>>Sent: Monday, May 18, 2009 8:08 AM >>>To: Mailing list for lwIP users >>>Subject: Re: [lwip-users] netif->flags >>> >>> >>>> Hi, >>>> I'm using lwIP and the socket IF. The lwIP 1.3.0 source file >>>ethernetif.c >>>> contains a function low_level_init which initializes some of the >netif >>>> flags; but it does not initialize the flag NETIF_FLAG_UP. I can't >>>find >>>> anywhere else in the code where this flag is set. Should this flag >>>> (NETIF_FLAG_UP) be set in low_level_init with the other flags, if >not >>>where should this >>>> flag be set? >>> >>>void netif_set_up(struct netif *netif) >>>-- >>>Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + >>>Telefonanschluss für nur 17,95 Euro/mtl.!* >>>http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a >>> >>> >>>_______________________________________________ >>>lwip-users mailing list >>>[email protected] >>>http://lists.nongnu.org/mailman/listinfo/lwip-users >>> >>>________________________________________ >>>CONFIDENTIALITY NOTICE: This E-mail and any attachments are >confidential >>>information of the sender and are for the exclusive use of the >intended >>>recipient. If you are not the intended recipient, be aware that any >>>disclosure, copying, distribution, or use of this E-mail or any >>>attachment is prohibited. If you have received this E-mail in error, >>>please notify us immediately by returning it to the sender and delete >>>this copy from your system. Thank you for your cooperation. >>> >>> >>> >>> >>>_______________________________________________ >>>lwip-users mailing list >>>[email protected] >>>http://lists.nongnu.org/mailman/listinfo/lwip-users >> >> >> >> _______________________________________________ >> lwip-users mailing list >> [email protected] >> http://lists.nongnu.org/mailman/listinfo/lwip-users >> >> ________________________________________ >> CONFIDENTIALITY NOTICE: This E-mail and any attachments are >confidential information of the sender and are for the exclusive use of >the intended recipient. If you are not the intended recipient, be aware >that any disclosure, copying, distribution, or use of this E-mail or any >attachment is prohibited. If you have received this E-mail in error, >please notify us immediately by returning it to the sender and delete >this copy from your system. Thank you for your cooperation. >> >> >> >> >> _______________________________________________ >> lwip-users mailing list >> [email protected] >> http://lists.nongnu.org/mailman/listinfo/lwip-users >> > > >_______________________________________________ >lwip-users mailing list >[email protected] >http://lists.nongnu.org/mailman/listinfo/lwip-users > > >_______________________________________________ >lwip-users mailing list >[email protected] >http://lists.nongnu.org/mailman/listinfo/lwip-users _______________________________________________ lwip-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/lwip-users
