DragonFly BSD
DragonFly submit List (threaded) for 2004-01
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: if_xname ... here we go


From: Max Laier <max@xxxxxxxxxxxxxx>
Date: Tue, 6 Jan 2004 03:36:56 +0100

On Tuesday 06 January 2004 03:28, Matthew Dillon wrote:
>     I've committed the easy parts.   I have the rest in my tree ready to
>     go... I added additional #if checks in the contrib code as per your
> notes.
>
>     In reviewing the code I have one question.  Take the code in
>     netif/ed/if_ed.c as an example:
>
> RCS file: /cvs/src/sys/dev/netif/ed/if_ed.c,v
> retrieving revision 1.6
> diff -u -w -r1.6 if_ed.c
> --- sys/dev/netif/ed/if_ed.c    20 Nov 2003 22:07:27 -0000      1.6
> +++ sys/dev/netif/ed/if_ed.c    6 Jan 2004 01:13:21 -0000
> @@ -1593,13 +1593,11 @@
>          */
>         ed_stop(sc);
>
> -       if (!ifp->if_name) {
>                 /*
>                  * Initialize ifnet structure
>                  */
>                 ifp->if_softc = sc;
> -               ifp->if_unit = unit;
> -               ifp->if_name = "ed";
> +       if_initname(ifp, "ed", unit);
>                 ifp->if_output = ether_output;
>                 ifp->if_start = ed_start;
>                 ifp->if_ioctl = ed_ioctl;
> @@ -1637,13 +1635,13 @@
>                  * Attach the interface
>                  */
>                 ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
> -       }
> +
>
>     My question is, why did you remove the if (!ifp->if_name) {
>     conditional?  It seems to be checking to see if an interface is
>     being re-initialized and is not reloading the already loaded fields
>     if so.  In particular, it is not calling ether_ifattach() again.
>
>     I'm not sure if the reload scenario is possible here but if so I
>     think we need some sort of conditional there so as not to
>     call ether_ifattach() multiple times.
>
>     There are a couple of a IF files where you've done this.
>
> 					-Matt
> 					Matthew Dillon
> 					<dillon@xxxxxxxxxxxxx>

I based my descision on Brooks' analysis (which I belive is true for 4.x as 
well): http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/dev/ed/if_ed.c#rev1.220

If it is not yet, such a check should clearly go to the common case and be 
based on a field of the softc/dev rather then the interface.

-- 
Best regards,				| max@xxxxxxxxxxxxxx
Max Laier				| ICQ #67774661
http://pf4freebsd.love2party.net/	| mlaier@EFnet #DragonFlyBSD




[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]