12

Implementing the ioctl Section

The ioctl section of a network device driver contains the code that implements a network device driver’s ioctl interface. The ioctl interface performs miscellaneous tasks that have nothing to do with data packet transmission and reception. Typically, it turns specific features of the hardware on or off.

The el_ioctl( ) routine performs the following tasks:

Determines whether the user has removed the PCMCIA card from the slot (Section 12.2)

Sets the IPL and obtains the simple lock (Section 12.3)

Recognizes the ioctl command and performs the appropriate operations. Table 12–1 lists the ioctl commands that network device drivers must recognize.

Releases the simple lock and resets the IPL (Section 12.17)

Table 12–1: Network ioctl Commands

ioctl Command

Required

Description

For More Information

SIOCENABLBACK

No

Enables loopback

Section 12.4

 

 

mode.

 

SIOCDISABLBACK

No

Disables loopback

Section 12.5

 

 

mode.

 

SIOCRPHYSADDR

Yes

Returns the current

Section 12.6

 

 

and default MAC

 

 

 

addresses.

 

SIOCSPHYSADDR

Yes

Sets the local MAC

Section 12.7

 

 

address.

 

SIOCADDMULTI

Yes

Adds the device to a

Section 12.8

 

 

multicast group.

 

SIOCDELMULTI

Yes

Removes the device

Section 12.9

 

 

from a multicast

 

 

 

group.

 

SIOCRDCTRS

Yes

Reads counters.

Section 12.10

SIOCRDZCTRS

Yes

Reads and zeros

Section 12.10

 

 

counters.

 

SIOCSIFADDR

Yes

Brings up the device.

Section 12.11

Implementing the ioctl Section 12–1

Page 125
Image 125
Compaq AA-RNG2A-TE manual Implementing the ioctl Section, Ioctl Command Required Description For More Information