From owner-freebsd-questions@FreeBSD.ORG Thu Jan 15 11:15:44 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B17D1065673; Thu, 15 Jan 2009 11:15:44 +0000 (UTC) (envelope-from yonyossef.lists@gmail.com) Received: from mail-ew0-f30.google.com (mail-ew0-f30.google.com [209.85.219.30]) by mx1.freebsd.org (Postfix) with ESMTP id A3D648FC14; Thu, 15 Jan 2009 11:15:43 +0000 (UTC) (envelope-from yonyossef.lists@gmail.com) Received: by ewy11 with SMTP id 11so346410ewy.19 for ; Thu, 15 Jan 2009 03:15:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:references:subject :date:message-id:mime-version:content-type:content-transfer-encoding :x-mailer:thread-index:x-mimeole:in-reply-to; bh=yIH6EUJPOMf5KdIb+ojBFGfQpOZSwytc350nqPq1ql8=; b=ZHd6c46sNeDfW35l38RlABGj9uuGfZHUt1myzvjqeP1a28xhKY/TLiLNQwrSizmYu0 kKpO+N5aeitPArO0w3RDHrvNGvfDQZuxvhgbdLVDaGpanLSV/EEDVFze5U02Io+81tsW w+zqGj23lG7igxH7sMSCwJjxR6d3N+nbGLdoQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:references:subject:date:message-id:mime-version :content-type:content-transfer-encoding:x-mailer:thread-index :x-mimeole:in-reply-to; b=EKcXBjrBV7CKXFMRctWrhRps7AmmeQXndur4Yl8fnFeuqi/KhmcuiUQdW+XwI1aMsA L6cNI3ucBSqa5wauJgK9uPc+qeHDEA2EVYdAfS0rKRrjUjsblZ+sza0f5/rc0vFnL7BH JkhpD4UV8Fh7aeztlauueKVhPDhtT05CCin3M= Received: by 10.67.115.15 with SMTP id s15mr3145055ugm.56.1232018142576; Thu, 15 Jan 2009 03:15:42 -0800 (PST) Received: from mtllpt03 (DSL212-235-20-133.bb.netvision.net.il [212.235.20.133]) by mx.google.com with ESMTPS id q1sm1487845uge.23.2009.01.15.03.15.40 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 15 Jan 2009 03:15:41 -0800 (PST) From: "Yony Yossef" To: , "Yony Yossef" References: <20def4870901140009y1f007108y92797d5f79ffac08@mail.gmail.com> <496E11B7.3010608@sepehrs.com> <000b01c9768e$745aa160$220f000a@mtl.com> <496EF30E.4010304@sepehrs.com> <000c01c976ec$87e040b0$220f000a@mtl.com> <496EF849.7040909@elischer.org> <001501c976f3$5d7a81d0$220f000a@mtl.com> Date: Thu, 15 Jan 2009 13:15:53 +0200 Message-ID: <001701c97702$a301bd90$220f000a@mtl.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 Thread-Index: Acl2+QecVlhjxwpkRWiLitQBNobj5gACUw4A X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350 In-Reply-To: X-Mailman-Approved-At: Thu, 15 Jan 2009 12:22:39 +0000 Cc: Liran Liss , freebsd-net@freebsd.org, Oleg Kats , "'H.fazaeli'" , 'Julian Elischer' , Eitan Shefi , freebsd-questions@freebsd.org Subject: RE: howto determine network device unit number? device.hints? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jan 2009 11:15:45 -0000 > -----Original Message----- > From: rea-fbsd@codelabs.ru [mailto:rea-fbsd@codelabs.ru] > Sent: Thursday, January 15, 2009 12:01 PM > To: Yony Yossef > Cc: 'Julian Elischer'; Liran Liss; freebsd-net@freebsd.org; > Oleg Kats; 'H.fazaeli'; Eitan Shefi; freebsd-questions@freebsd.org > Subject: Re: howto determine network device unit number? device.hints? > > Yony, good day. > > Thu, Jan 15, 2009 at 11:26:34AM +0200, Yony Yossef wrote: > > All I'm doing is unloading and reloading the driver. > > Unit numbers change and it makes my automatic subnet configuration > > (/etc/rc.conf) assign bad IPs. > > You're using your own driver, aren't you? If yes, could you > show your device_method_t structure and the corresponding > identify, probe, attach and detach routines? You're setting > the unit numbers via 'if_initname(ifp, device_get_name(dev), > device_get_unit(dev))' or alike? My device has 2 ports, therefore my if_initname is that: if_initname(dev, device_get_name(mdev->pdev), port + 2 * device_get_unit(mdev->pdev)); > > I still don't get the reason for this arbitrarily assigned unit > > numbers and what is the common solution for it. Except post load > > rename of the interfaces. > > I was under impression that the unit number are coming from > the parent busses and they should be stable, at least for the > case when the parent bus driver isn't unloaded (and for PCI > it should be the case). So, either the driver sets device > unit names weirdly or you hit some bug. > -- > Eygene This is what I captured the last time it happened. # pciconf -l | grep mtnic mtnic0@pci0:19:0:0: class=0x020000 card=0x001715b3 chip=0x636815b3 rev=0xa0 hdr=0x00 mtnic1@pci0:16:0:0: class=0x020000 card=0x001715b3 chip=0x636815b3 rev=0xa0 hdr=0x00 # kldunload if_mtnic # kldload if_mtnic # pciconf -l | grep mtnic mtnic1@pci0:19:0:0: class=0x020000 card=0x001715b3 chip=0x636815b3 rev=0xa0 hdr=0x00 mtnic0@pci0:16:0:0: class=0x020000 card=0x001715b3 chip=0x636815b3 rev=0xa0 hdr=0x00