4
Implementing the Configure Section
The configure section of a network device driver contains the code
that incorporates the device driver into the kernel, either statically or
dynamically. In a static configuration, the device driver’s
configure
interface registers callback routines, which allow the
cfgmgr
framework
to configure the driver into the kernel at a specified point during system
startup. In a dynamic configuration, the
configure
interface cooperates
with the
cfgmgr
framework to handle user-level requests to dynamically
configure, reconfigure, and query a network device driver at run time.
Because these tasks are common to all network drivers, the code has been
consolidated into a single routine called
lan_configure( )
. Routines with
the prefix
lan_
reside in the
lan_common.c
source file. A network driver’s
configure( )
routine can simply call
lan_configure( )
to carry out the
following tasks:
•
CFG_OP_CONFIGURE
•
CFG_OP_RECONFIGURE
•
CFG_OP_UNCONFIGURE
•
CFG_OP_QUERY
The
if_el
driver’s
configure
section contains an attributes data structure
and the
el_configure( )
routine.
The following sections describe how to initialize the
cfg_subsys_attr_t
data structure and how to set up the
el_configure( )
routine:
•
Declaring configure-related variables and initializing the
cfg_subsys_attr_t
data structure (Section 4.1)
•
Setting up the
el_configure( )
routine (Section 4.2)
4.1 Declaring Configure-Related Variables and the
cfg_subsys_attr_t Data Structure
As part of implementing a device driver’s
configure
interface, you declare a
number of variables and initialize the
cfg_subsys_attr_t
data structure.
Implementing the Configure Section 4–1