Re: few questions on 'struct net_device'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




3) following from the 2) -- why do we have to request resources in interface
opening method (dev->open), if
irq etc. have been already assigned to structure members earlier, when code
initialized 'net_device' (for example, rtle8139 does it PCI probing
routine).

A the time of net_device initialization (generally at the time of PCI
probing), the irq and other resources have only been STORED in the
net_device structure for future reference. They have not yet been
requested from the system.

The actual request for resources is delayed till the device open time
because no one would actually be using those resources prior to
opening the device. If we allocate the resources at initialization
time only, we would be wasting precious resources without needing
them, despite the same resources could have been used by some other
device in use, while our device has yet not been "opened".

Also consider that once we request the irq, our ISR will be called at
every irq seen at that line whether it was generated by our device or
not. Even if it was generated by our device, we could have safely
chosen to ignore it.

Hence linux delays the actual allocation of resources as much as possible.

Regards,

Rajat

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux