Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 8 Apr 2006 23:00:10 -0400
From:      Mike Meyer <mwm-keyword-freebsdhackers.102a7e@mired.org>
To:        Dima Dorfman <dd@freebsd.org>
Cc:        hackers@freebsd.org
Subject:   Re: Using any network interface whatsoever
Message-ID:  <17464.30906.793504.199832@bhuda.mired.org>
In-Reply-To: <20060409005712.GA856@trit.org>
References:  <C05CAC06.C0BD%ceri@submonkey.net> <20060407225742.GA21619@odin.ac.hmc.edu> <20060407230247.GH16344@submonkey.net> <4437C9F6.5000008@samsco.org> <17463.65076.117616.563302@bhuda.mired.org> <443811EF.2020509@samsco.org> <17464.8074.937742.701480@bhuda.mired.org> <44383346.2030207@samsco.org> <17464.16087.217524.843667@bhuda.mired.org> <20060409005712.GA856@trit.org>

next in thread | previous in thread | raw e-mail | index | archive | help
In <20060409005712.GA856@trit.org>, Dima Dorfman <dd@freebsd.org> typed:
> Mike Meyer <mwm-keyword-freebsdhackers.102a7e@mired.org> wrote:
> > What do I want for that? I identify ethernet boards by which slot on
> > the back of the system I plug the cable into. Currently, I have to map
> > that to board types to and which board is plugged into which slot to
> > know which name to use. I want a name that tells me which slot I plug
> > a cable in to plug it into that interface.
> Is information about the slot even available on a PC? For something like this:

The BIOS seems to get that information from somewhere. But I'm not a
hardware guru, so I can't say for sure.

> : em0@pci6:7:0:   class=0x020000 card=0x016d1028 chip=0x10768086 rev=0x05 hdr=0x00
> :     vendor   = 'Intel Corporation'
> :     device   = '82547EI Gigabit Ethernet Controller'
> :     class    = network
> :     subclass = ethernet
> 
> would you consider eth-6-7-0 to be an improvement over em0?

Not really, because the magic numbers aren't tied to anything
real. You want the magic numbers to corrspond to the physical objects
you manipulate.

For disk devices, the numbers were originally tied to bus ids, which
were set on the device. ra's had swappable plugs with the drive number
on them and a light behind the plug, so /dev/ra3 referred to the drive
in the rack of 16 drives with the number "3" in the front panel
lights.

> It has the advantage of not changing if another card is added to the
> system, but it's not very informative. For a system that has only
nn> its two on-board NICs, "em0" and "em1" are very obvious--at least
> it's clear which one corresponds to the label "eth 0" on the
> chassis.

I'll have to take your word for that, as I haven't got a box handy
with two onboard NICs.

Is there anything that says we can't have multiple names for an
interface? If we do that, then we could (random brainstorming here):

Have a name like eth-pci-slot-3 (it's an ethernet device on a pci bus
at slot 3), eth-pci-onboard-0 (onboard ethernet port 0) or eth-usb-2
(for the usb-ethernet dongles). The class part - "eth" - is redundant,
as the rest of the name identifies the device exactly, but it helps
prevent errors, as you get "no such device" errors instead of trying
to do something completely inappropriate to a device. This is what
you'd use on systems with multiple identical devices.

All network devices also get a name of the form net0, net1, .... This
is for systems with just one network interface - no matter what kind
it is - which can just refer to "net0" and get the one and only
network interface.

All network devices also get a name corresponding to the media, so
you'd have eth0, eth1, or fw0, fw1 (firewire), meaning that if you
specifically want an ethernet - as opposed to an arbitrary network
interface - you'd use eth0 instead of net0. This allows you to use
eth0, fw0 and wifi0 for the ethernet, firewire and wifi network
interfaces on a modern laptop, without having to worry about which
net# device map to which of those devices.


	<mike
-- 
Mike Meyer <mwm@mired.org>		http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?17464.30906.793504.199832>