Linux Device Drivers 2nd Edition (779877), страница 102
Текст из файла (страница 102)
mem_start and mem_end can bespecified on the kernel command line at system boot, and their values areretrieved by ifconfig. The rmem fields are never referenced outside of thedriver itself. By convention, the end fields are set so that end - start isthe amount of available on-board memory.unsigned long base_addr;The I/O base address of the network interface. This field, like the previousones, is assigned during device probe. The ifconfig command can be used todisplay or modify the current value. The base_addr can be explicitlyassigned on the kernel command line at system boot or at load time.
The fieldis not used by the kernel, like the memory fields shown previously.43522 June 2001 16:43http://openlib.org.uaChapter 14: Network Driversunsigned char irq;The assigned interrupt number. The value of dev->irq is printed by ifconfigwhen interfaces are listed. This value can usually be set at boot or load timeand modified later using ifconfig.unsigned char if_port;Which port is in use on multiport devices. This field is used, for example, withdevices that support both coaxial (IF_PORT_10BASE2) and twisted-pair(IF_PORT_10BASET) Ethernet connections. The full set of known port typesis defined in <linux/netdevice.h>.unsigned char dma;The DMA channel allocated by the device. The field makes sense only withsome peripheral buses, like ISA.
It is not used outside of the device driveritself, but for informational purposes (in ifconfig).unsigned long state;Device state. The field includes several flags. Drivers do not normally manipulate these flags directly; instead, a set of utility functions has been provided.These functions will be discussed shortly when we get into driver operations.struct net_device *next;Pointer to the next device in the global linked list. This field shouldn’t betouched by the driver.int (*init)(struct net_device *dev);The initialization function, described earlier.The Hidden FieldsThe net_device structure includes many additional fields, which are usuallyassigned at device initialization.
Some of these fields convey information about theinterface, while some exist only for the benefit of the driver (i.e., they are not usedby the kernel); other fields, most notably the device methods, are part of the kernel-driver interface.We will list the three groups separately, independent of the actual order of thefields, which is not significant.Interface informationMost of the information about the interface is correctly set up by the functionether_setup.
Ethernet cards can rely<b>Текст обрезан, так как является слишком большим</b>.