if_xname ... here we go

Max Laier max at love2party.net
Mon Jan 5 18:37:34 PST 2004


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 at 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 at xxxxxxxxxxxxxx
Max Laier				| ICQ #67774661
http://pf4freebsd.love2party.net/	| mlaier at EFnet #DragonFlyBSD






More information about the Submit mailing list