From owner-freebsd-hackers Sun Apr 21 17: 5:19 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from viola.sinor.ru (viola.sinor.ru [217.70.106.9]) by hub.freebsd.org (Postfix) with ESMTP id 4FCC437B416; Sun, 21 Apr 2002 16:59:35 -0700 (PDT) Received: from tlg5-ppp85.sibnet.ru (tlg5-ppp85.sibnet.ru [217.70.98.216]) by viola.sinor.ru (8.9.3/8.9.3) with ESMTP id GAA16279; Mon, 22 Apr 2002 06:59:31 +0700 Date: Mon, 22 Apr 2002 06:59:31 +0700 (NOVST) From: "Semen A. Ustimenko" X-X-Sender: semenu@def.the.net To: Bill Paul Cc: freebsd-hackers@FreeBSD.org Subject: Re: MIIBUS_MEDIAINIT method In-Reply-To: <20020421230424.9B4B637B400@hub.freebsd.org> Message-ID: <20020422061252.N2315-100000@def.the.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Pretty clear now... Thanks! See below... On Sun, 21 Apr 2002, Bill Paul wrote: > > then the method will be called twice, and some NIC drivers (tx, xl, dc, > > maybe more) will not behave well. > > They work fine if the author of the MAC driver was smart enough to check > for this in his mediainit method and just return immmediately if the > auxilliary media types have already been ifmedia_add()ed. The authors of above drivers do not. :) I bet they didn't know... And a quest: how will you know inside YOURMAC_miibus_mediainit() that this is the call from the *last* PHY? (Not critical, but...) > > Isn't it reasonable to stop all PHY drivers from calling MEDIAINIT, and > > call it once per miibus instance in miibus_attach() or miibus_probe() > > instead? > > No. We want the PHY driver to set up its media types in the ifmedia > struct first, and then add our own after those, which means we have > to wait until the end of the PHY's attach routine, and it's newbus > that calls the attach routines, not the miibus code. > Ah, my bad... You're rigth. This is the main point - there is no place which would be more appropriate to notify MAC driver about PHY attachement completion. Well.... But this isn't very nice... As long as MEDIAINIT method is called per every PHY, it should at least contain a PHY-identifying argument, i think... Yet mii_inst would be enough, even to solve the ``quest above''. This way somebody could do per-PHY tricks in MAC driver :) If you really need to spot the all-PHYs-atachment-completion-event, then you must await it from miibus device, i think. > If you have a card or hardware configuration which is actually > causing the scenario you describe, then say so. No, I don't. But who knows what NIC there can exist? > Otherwise, keep your fingers out of this code. No user-servicable parts > inside. Keep out of children. Do not look into laser optics with > remaining eye. > :) OK... As you say... Just one more question: Will the MIIBUS_LINKCHG method be MFCed? Thanks! To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message