Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
dev:netdriverapi [2007/08/18 14:37]
mdc created
dev:netdriverapi [2007/08/18 14:43] (current)
mdc Initial formatting
Line 1: Line 1:
-net_device::​open ( struct net_device *netdev ) +====== gPXE Network Driver API Documentation ====== 
- + 
 +==== net_device::​open ( struct net_device *netdev ) ==== 
 Here MAC address is programmed over the device (NIC). Then receive buffer for the device is created ​ Here MAC address is programmed over the device (NIC). Then receive buffer for the device is created ​
 and its memory is released in net_device::​close(). This address for the ring buffer is transfer to the NIC’s ​ and its memory is released in net_device::​close(). This address for the ring buffer is transfer to the NIC’s ​
Line 6: Line 8:
 receive. Other parameters like burst rate, transfer threshold, reception of broadcast and multicast is  receive. Other parameters like burst rate, transfer threshold, reception of broadcast and multicast is 
 also set here.  also set here. 
-  + 
-  +==== net_device::​close ( struct net_device *netdev ) ====
-net_device::​close ( struct net_device *netdev )  +
  
 The crucial task here is to reset the device (may use a command available with the hardware), to free  The crucial task here is to reset the device (may use a command available with the hardware), to free 
 the memory allocated for the Receive ring buffer in net_device:​open() and to stop any pending ​ the memory allocated for the Receive ring buffer in net_device:​open() and to stop any pending ​
-transmission.  +transmission. 
-  + 
-net_device::​transmit ( struct net_device *netdev, struct io_buffer *iobuf ) +==== net_device::​transmit ( struct net_device *netdev, struct io_buffer *iobuf ) ==== 
- +
 Initiate transmission of the packet, i.e. add packet to the card's TX  Initiate transmission of the packet, i.e. add packet to the card's TX 
 queue. ​ Don't wait for transmission to complete; the completion will be  queue. ​ Don't wait for transmission to complete; the completion will be 
Line 23: Line 24:
 Some cards have alignment or padding requirements;​ iob_pad() can generally ​ Some cards have alignment or padding requirements;​ iob_pad() can generally ​
 be used to satisfy these. ​ be used to satisfy these. ​
-  + 
-  +==== net_device::​poll ( struct net_device *netdev, unsigned int rx_quota ) ====
-net_device::​poll ( struct net_device *netdev, unsigned int rx_quota ) +
  
 The poll function is called periodically to check for any received packets and also to check that packets ​ The poll function is called periodically to check for any received packets and also to check that packets ​
Line 38: Line 38:
 Here one is not concerned with releasing the memory allocated to received packet. ​ Here one is not concerned with releasing the memory allocated to received packet. ​
  
-net_device::​probe ( struct pci_device *pci, const struct pci_device_id *id  +==== net_device::​probe ( struct pci_device *pci, const struct pci_device_id *id ) ====
-__unused ​+
  
 Here actual device probe is not done. It is done by pci::​pci_probe(),​ which looks for the correct driver for  Here actual device probe is not done. It is done by pci::​pci_probe(),​ which looks for the correct driver for 
Line 49: Line 48:
 Once all allocation is done, the device is reset and EEPROM is initialized and MAC address is read from  Once all allocation is done, the device is reset and EEPROM is initialized and MAC address is read from 
 the EEPROM. ​ the EEPROM. ​
 +
 Function alias are created (open,​close,​transmit,​poll) ​ to  NIC specific routines. ​   ​ Function alias are created (open,​close,​transmit,​poll) ​ to  NIC specific routines. ​   ​
 Lastly we need to register Network device and non-volatile storage (EEPROM) which can be done using  Lastly we need to register Network device and non-volatile storage (EEPROM) which can be done using 
 register_netdev and nvo_register. ​ register_netdev and nvo_register. ​
-  
-  
  

QR Code
QR Code dev:netdriverapi (generated for current page)