pxe_undi.c File Reference

PXE UNDI API. More...

#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <byteswap.h>
#include <basemem_packet.h>
#include <gpxe/netdevice.h>
#include <gpxe/iobuf.h>
#include <gpxe/device.h>
#include <gpxe/pci.h>
#include <gpxe/if_ether.h>
#include <gpxe/ip.h>
#include <gpxe/arp.h>
#include <gpxe/rarp.h>
#include "pxe.h"

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER)
void pxe_set_netdev (struct net_device *netdev)
 Set network device as current PXE network device.
static int pxe_netdev_open (void)
 Open PXE network device.
static void pxe_netdev_close (void)
 Close PXE network device.
static void pxe_dump_mcast_list (struct s_PXENV_UNDI_MCAST_ADDRESS *mcast)
 Dump multicast address list.
PXENV_EXIT_t pxenv_undi_startup (struct s_PXENV_UNDI_STARTUP *undi_startup)
PXENV_EXIT_t pxenv_undi_cleanup (struct s_PXENV_UNDI_CLEANUP *undi_cleanup)
PXENV_EXIT_t pxenv_undi_initialize (struct s_PXENV_UNDI_INITIALIZE *undi_initialize)
PXENV_EXIT_t pxenv_undi_reset_adapter (struct s_PXENV_UNDI_RESET *undi_reset_adapter)
PXENV_EXIT_t pxenv_undi_shutdown (struct s_PXENV_UNDI_SHUTDOWN *undi_shutdown)
PXENV_EXIT_t pxenv_undi_open (struct s_PXENV_UNDI_OPEN *undi_open)
PXENV_EXIT_t pxenv_undi_close (struct s_PXENV_UNDI_CLOSE *undi_close)
PXENV_EXIT_t pxenv_undi_transmit (struct s_PXENV_UNDI_TRANSMIT *undi_transmit)
PXENV_EXIT_t pxenv_undi_set_mcast_address (struct s_PXENV_UNDI_SET_MCAST_ADDRESS *undi_set_mcast_address)
PXENV_EXIT_t pxenv_undi_set_station_address (struct s_PXENV_UNDI_SET_STATION_ADDRESS *undi_set_station_address)
PXENV_EXIT_t pxenv_undi_set_packet_filter (struct s_PXENV_UNDI_SET_PACKET_FILTER *undi_set_packet_filter)
PXENV_EXIT_t pxenv_undi_get_information (struct s_PXENV_UNDI_GET_INFORMATION *undi_get_information)
PXENV_EXIT_t pxenv_undi_get_statistics (struct s_PXENV_UNDI_GET_STATISTICS *undi_get_statistics)
PXENV_EXIT_t pxenv_undi_clear_statistics (struct s_PXENV_UNDI_CLEAR_STATISTICS *undi_clear_statistics)
PXENV_EXIT_t pxenv_undi_initiate_diags (struct s_PXENV_UNDI_INITIATE_DIAGS *undi_initiate_diags)
PXENV_EXIT_t pxenv_undi_force_interrupt (struct s_PXENV_UNDI_FORCE_INTERRUPT *undi_force_interrupt)
PXENV_EXIT_t pxenv_undi_get_mcast_address (struct s_PXENV_UNDI_GET_MCAST_ADDRESS *undi_get_mcast_address)
PXENV_EXIT_t pxenv_undi_get_nic_type (struct s_PXENV_UNDI_GET_NIC_TYPE *undi_get_nic_type)
PXENV_EXIT_t pxenv_undi_get_iface_info (struct s_PXENV_UNDI_GET_IFACE_INFO *undi_get_iface_info)
PXENV_EXIT_t pxenv_undi_get_state (struct s_PXENV_UNDI_GET_STATE *undi_get_state)
PXENV_EXIT_t pxenv_undi_isr (struct s_PXENV_UNDI_ISR *undi_isr)

Variables

static int undi_tx_count = 0
 Count of outstanding transmitted packets.
struct net_devicepxe_netdev = NULL


Detailed Description

PXE UNDI API.

Definition in file pxe_undi.c.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER   ) 

void pxe_set_netdev ( struct net_device netdev  ) 

Set network device as current PXE network device.

Parameters:
netdev Network device, or NULL

Definition at line 60 of file pxe_undi.c.

References netdev_get(), netdev_put(), and NULL.

Referenced by pxe_activate(), and pxe_deactivate().

00060                                                   {
00061         if ( pxe_netdev )
00062                 netdev_put ( pxe_netdev );
00063         pxe_netdev = NULL;
00064         if ( netdev )
00065                 pxe_netdev = netdev_get ( netdev );
00066 }

static int pxe_netdev_open ( void   )  [static]

Open PXE network device.

Return values:
rc Return status code

Definition at line 73 of file pxe_undi.c.

References netdev_irq(), and netdev_open().

Referenced by pxenv_undi_open(), and pxenv_undi_reset_adapter().

00073                                     {
00074         int rc;
00075 
00076         if ( ( rc = netdev_open ( pxe_netdev ) ) != 0 )
00077                 return rc;
00078 
00079         netdev_irq ( pxe_netdev, 1 );
00080         return 0;
00081 }

static void pxe_netdev_close ( void   )  [static]

Close PXE network device.

Definition at line 87 of file pxe_undi.c.

References netdev_close(), netdev_irq(), and undi_tx_count.

Referenced by pxenv_undi_cleanup(), pxenv_undi_close(), pxenv_undi_reset_adapter(), and pxenv_undi_shutdown().

00087                                       {
00088         netdev_irq ( pxe_netdev, 0 );
00089         netdev_close ( pxe_netdev );
00090         undi_tx_count = 0;
00091 }

static void pxe_dump_mcast_list ( struct s_PXENV_UNDI_MCAST_ADDRESS mcast  )  [static]

Dump multicast address list.

Parameters:
mcast PXE multicast address list

Definition at line 98 of file pxe_undi.c.

References DBG, net_device::ll_protocol, s_PXENV_UNDI_MCAST_ADDRESS::McastAddr, s_PXENV_UNDI_MCAST_ADDRESS::MCastAddrCount, and ll_protocol::ntoa.

Referenced by pxenv_undi_open(), pxenv_undi_reset_adapter(), and pxenv_undi_set_mcast_address().

00098                                                                              {
00099         struct ll_protocol *ll_protocol = pxe_netdev->ll_protocol;
00100         unsigned int i;
00101 
00102         for ( i = 0 ; i < mcast->MCastAddrCount ; i++ ) {
00103                 DBG ( " %s", ll_protocol->ntoa ( mcast->McastAddr[i] ) );
00104         }
00105 }


Variable Documentation

int undi_tx_count = 0 [static]

Count of outstanding transmitted packets.

This is incremented each time PXENV_UNDI_TRANSMIT is called, and decremented each time that PXENV_UNDI_ISR is called with the TX queue empty, stopping when the count reaches zero. This allows us to provide a pessimistic approximation of TX completion events to the PXE NBP simply by monitoring the netdev's TX queue.

Definition at line 51 of file pxe_undi.c.

Referenced by pxe_netdev_close(), pxenv_undi_isr(), and pxenv_undi_transmit().

struct net_device* pxe_netdev = NULL

Definition at line 53 of file pxe_undi.c.

Referenced by pxenv_get_cached_info(), and pxenv_udp_write().


Generated on Tue Apr 6 20:01:13 2010 for gPXE by  doxygen 1.5.7.1