Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 07 Dec 2001 18:10:18 -0800
From:      Terry Lambert <tlambert2@mindspring.com>
To:        Yiping Chen <YipingChen@via.com.tw>
Cc:        "'current@FreeBSD.org'" <current@FreeBSD.org>
Subject:   Re: Question about Freebsd driver
Message-ID:  <3C11768A.200B23C3@mindspring.com>
References:  <AAC504441CD3D51190540050DA92E076458F7C@exchtp02.via.com.tw>

next in thread | previous in thread | raw e-mail | index | archive | help
Yiping Chen wrote:
> 
> Dear Sir:
> 
> I have a question about Freebsd driver.
> If we want to support some options in driver(like speed and duplex mode
> setting) ,
> user can use this option to change driver configurations.
> I am not sure whether freebsd driver support driver parameter or something
> else.
> Can you give me some suggestions? Thanks!!

For LAN drivers, you can set a large number of predefined options,
such as spped and duplex, as well as vendor specific options.

The command you are looking for is "ifconfig".

To find the source code to any FreeBSD command, you should type
"which command" at a root prompt.  For example, if the command
you were looking for was "foo" or "fee":

	# which foo
	/usr/bin/foo
	# cd /usr/src/usr.bin/foo
	# ls
	foo.c

	# which fee
	/sbin/fee
	# cd /usr/src/sbin/fee
	# ls
	fee .c

The ifconfig command is odd in that it gathers up its arguments,
and then ioctl's down on a socket descriptor.  This is handled by
code in the /sys/net directory, and then in the drivers itself.

It's best if you start with code in a specific driver.

As a general rule, for things like duplex and speed, you will want
to write your driver to autonegotiate, if the hardware can do that,
since that's one less thing the user has to worry about.  The use
of duplex and speed settings us usually _ONLY_ to defeat the use
of autonegotiation, and force user settings.  Many cards support
doing this (for example, when using FreeBSD as a router or a hub).

Hope this helps.

-- Terry

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




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