Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Apr 2000 17:28:49 -0400
From:      "Gary T. Corcoran" <gcorcoran@lucent.com>
To:        FreeBSD Hackers <freebsd-hackers@freebsd.org>
Subject:   Setting device options
Message-ID:  <38F63C11.860C901B@lucent.com>

next in thread | raw e-mail | index | archive | help
Now that my device driver basically works (I can successfully do pings
and ftp transfers through it) using default settings, I'd like to
start polishing it up a bit...

This is a driver for a DSL device (Lucent WildWire), and our driver
has lots of options because there are many "flavors" of DSL and
things that need to be set depending on who is providing DSL service
to your location.  The device driver currently makes our DSL device
look like an Ethernet card, though I will also be adding more code
to support WAN (PPP) modes (that is, of course, one of the options
that I need to set before the device is initialized).

So, I want to know how I can "automagically" set the device options,
every time a user kldload's the device driver.
To give you a little background, here's how it works on the other
operating systems, and thus this is the type of thing I'm looking
for in FreeBSD.

In Windows, after installation the options are stored in that
"wonderful" hack called the Registry.  The driver, upon initialization,
reads the settings (i.e. the options) from the registry, and uses
those settings to initialize.

In Linux, by declaring some global variables with the "MODULE_PARM"
macro, this allows these variables to automatically have their value
set as the module is being loaded, overriding whatever default was
compiled into the module.  One only has to provide settings in the
/etc/conf.modules file for the options to override, and these values
are picked up by the "insmod" (insert module, equivalent to kldload)
command.  Thus, when the module is loaded, if there were any options
set, the values of the global variables are set, even before the
init_module() routine gets called.

In other words, once you set the options you need in conf.modules,
all settings are automatically handled, you don't have to remember
to run some "extra" program after loading your module but before
you bring up your link with ifconfig.

Is there some equivalent way of handling device driver option settings
in FreeBSD?  I would prefer an "automatic" way of having the
device options set, similar in function to the way you can set
options for your ethernet card with the ifconfig command - so
that once you define, for example, your ifconfig command and
put it in your rc file, you just automatically bring things up
the desired way.  Any suggestions?  (For FreeBSD 4.x)

Thanks,
Gary


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




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