Setting Up The El_Ioctl Routine - Compaq Tru64 UNIX Installation Manual

Writing network device drivers
Table of Contents

Advertisement

Table 12–1: Network ioctl Commands (cont.)
ioctl Command
SIOCSIFFLAGS
SIOCSIPMTU
SIOCSMACSPEED
SIOCIFRESET
SIOCIFSETCHAR

12.1 Setting Up the el_ioctl Routine

The following code shows how to set up the el_ioctl( ) routine:
static int el_ioctl(struct ifnet *ifp,
{
register struct el_softc *sc = el_softc[ifp->if_unit];
register unit = ifp->if_unit;
struct ifreq *ifr = (struct ifreq *)data;
struct ifdevea *ifd = (struct ifdevea *)data;
struct ctrreq *ctr = (struct ctrreq *)data;
struct ifchar *ifc = (struct ifchar *)data;
int s, i, j, need_reset, lock_on = 1, status = ESUCCESS;
unsigned short ifmtu, speed;
u_char mclist_buf[NET_SZ_MCLIST];
Specifies a pointer to the ifnet data structure for an if_el device.
1
Specifies the ioctl command.
2
Specifies a pointer to ioctl command-specific data to be passed to
3
or initialized by the device driver.
Declares a pointer to the el_softc data structure that is called sc and
4
initializes it to the el_softc data structure for this device.
Declares a unit variable and initializes it to the unit number for the
5
device.
Casts the data argument to a data structure of type ifreq for use with
6
the SIOCPHYSADDR, SIOCADDMULTI, SIOCDELMULTI, SIOCSIPMTU, and
SIOCSMACSPEED ioctl commands.
12–2 Implementing the ioctl Section
Required
Description
Yes
Ensures that the
interface is operating
correctly according
to the interface flags
(if_flags).
Yes
Sets the IP maximum
transmission unit
(MTU).
Yes
Sets the media speed. Section 12.14
No
Resets the device.
Yes
Sets network device
characteristics, such
as full duplex or
promiscuous mode.
1
u_int cmd,
2
caddr_t data)
3
5
6
11
12
For More Information
Section 12.12
Section 12.13
Section 12.15
Section 12.16
4
7
8
9
10

Advertisement

Table of Contents
loading

Table of Contents