iPXE
|
PXE UNDI API. More...
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <byteswap.h>
#include <basemem_packet.h>
#include <ipxe/netdevice.h>
#include <ipxe/iobuf.h>
#include <ipxe/device.h>
#include <ipxe/pci.h>
#include <ipxe/if_ether.h>
#include <ipxe/ip.h>
#include <ipxe/arp.h>
#include <ipxe/rarp.h>
#include <ipxe/profile.h>
#include "pxe.h"
Go to the source code of this file.
Variables | |
static int | undi_tx_count = 0 |
Count of outstanding transmitted packets. More... | |
struct net_device * | pxe_netdev = NULL |
static struct profiler undi_tx_profiler | __profiler = { .name = "undi.tx" } |
Transmit profiler. More... | |
struct pxe_api_call pxe_undi_api [] | __pxe_api_call |
PXE UNDI API. More... | |
PXE UNDI API.
Definition in file pxe_undi.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
void pxe_set_netdev | ( | struct net_device * | netdev | ) |
Set network device as current PXE network device.
netdev | Network device, or NULL |
Definition at line 69 of file pxe_undi.c.
References netdev, netdev_get(), netdev_put(), netdev_rx_unfreeze(), NULL, and pxe_netdev.
Referenced by pxe_activate(), and pxe_deactivate().
|
static |
Open PXE network device.
rc | Return status code |
Definition at line 87 of file pxe_undi.c.
References assert(), netdev_irq(), netdev_open(), netdev_rx_freeze(), NULL, pxe_netdev, and rc.
Referenced by pxenv_undi_open(), and pxenv_undi_reset_adapter().
|
static |
Close PXE network device.
Definition at line 105 of file pxe_undi.c.
References assert(), netdev_close(), netdev_irq(), netdev_rx_unfreeze(), NULL, pxe_netdev, and undi_tx_count.
Referenced by pxenv_undi_cleanup(), pxenv_undi_close(), pxenv_undi_reset_adapter(), and pxenv_undi_shutdown().
|
static |
Dump multicast address list.
mcast | PXE multicast address list |
Definition at line 119 of file pxe_undi.c.
References DBGC, net_device::ll_protocol, s_PXENV_UNDI_MCAST_ADDRESS::McastAddr, s_PXENV_UNDI_MCAST_ADDRESS::MCastAddrCount, ll_protocol::ntoa, and pxe_netdev.
Referenced by pxenv_undi_open(), pxenv_undi_reset_adapter(), and pxenv_undi_set_mcast_address().
|
static |
Definition at line 134 of file pxe_undi.c.
References DBGC, pxe_netdev, PXENV_EXIT_FAILURE, PXENV_EXIT_SUCCESS, PXENV_STATUS_SUCCESS, PXENV_STATUS_UNDI_INVALID_STATE, and s_PXENV_UNDI_STARTUP::Status.
|
static |
Definition at line 154 of file pxe_undi.c.
References DBGC, pxe_netdev, pxe_netdev_close(), PXENV_EXIT_FAILURE, PXENV_EXIT_SUCCESS, PXENV_STATUS_SUCCESS, PXENV_STATUS_UNDI_INVALID_STATE, and s_PXENV_UNDI_CLEANUP::Status.
|
static |
Definition at line 177 of file pxe_undi.c.
References DBGC, s_PXENV_UNDI_INITIALIZE::ProtocolIni, pxe_netdev, PXENV_EXIT_FAILURE, PXENV_EXIT_SUCCESS, PXENV_STATUS_SUCCESS, PXENV_STATUS_UNDI_INVALID_STATE, and s_PXENV_UNDI_INITIALIZE::Status.
|
static |
Definition at line 198 of file pxe_undi.c.
References DBGC, net_device::name, pxe_dump_mcast_list(), pxe_netdev, pxe_netdev_close(), pxe_netdev_open(), PXENV_EXIT_FAILURE, PXENV_EXIT_SUCCESS, PXENV_STATUS, PXENV_STATUS_SUCCESS, PXENV_STATUS_UNDI_INVALID_STATE, s_PXENV_UNDI_RESET::R_Mcast_Buf, rc, s_PXENV_UNDI_RESET::Status, and strerror().
|
static |
Definition at line 231 of file pxe_undi.c.
References DBGC, pxe_netdev, pxe_netdev_close(), PXENV_EXIT_FAILURE, PXENV_EXIT_SUCCESS, PXENV_STATUS_SUCCESS, PXENV_STATUS_UNDI_INVALID_STATE, and s_PXENV_UNDI_SHUTDOWN::Status.
|
static |
Definition at line 253 of file pxe_undi.c.
References DBGC, net_device::name, s_PXENV_UNDI_OPEN::OpenFlag, s_PXENV_UNDI_OPEN::PktFilter, pxe_dump_mcast_list(), pxe_netdev, pxe_netdev_open(), PXENV_EXIT_FAILURE, PXENV_EXIT_SUCCESS, PXENV_STATUS, PXENV_STATUS_SUCCESS, PXENV_STATUS_UNDI_INVALID_STATE, s_PXENV_UNDI_OPEN::R_Mcast_Buf, rc, s_PXENV_UNDI_OPEN::Status, and strerror().
|
static |
Definition at line 285 of file pxe_undi.c.
References DBGC, pxe_netdev, pxe_netdev_close(), PXENV_EXIT_FAILURE, PXENV_EXIT_SUCCESS, PXENV_STATUS_SUCCESS, PXENV_STATUS_UNDI_INVALID_STATE, and s_PXENV_UNDI_CLOSE::Status.
|
static |
Definition at line 308 of file pxe_undi.c.
References alloc_iob(), copy_from_real, s_PXENV_UNDI_TBD::DataBlkCount, s_PXENV_UNDI_TBD::DataBlock, DBGC, DBGC2, s_PXENV_UNDI_TRANSMIT::DestAddr, free_iob(), s_PXENV_UNDI_TBD::ImmedLength, iob_put, iob_reserve, IOB_ZLEN, len, net_device::ll_addr, ll_protocol::ll_addr_len, net_device::ll_broadcast, net_device::ll_protocol, MAX_LL_ADDR_LEN, MAX_LL_HEADER_LEN, net_protocol::name, net_protocol::net_proto, netdev_irq(), netdev_rx_freeze(), netdev_rx_frozen(), netdev_tx(), ll_protocol::ntoa, NULL, P_ARP, P_IP, P_RARP, P_UNKNOWN, profile_start(), profile_stop(), s_PXENV_UNDI_TRANSMIT::Protocol, ll_protocol::push, pxe_netdev, PXENV_EXIT_FAILURE, PXENV_EXIT_SUCCESS, PXENV_STATUS, PXENV_STATUS_OUT_OF_RESOURCES, PXENV_STATUS_SUCCESS, PXENV_STATUS_UNDI_INVALID_PARAMETER, PXENV_STATUS_UNDI_INVALID_STATE, rc, s_PXENV_UNDI_TRANSMIT::Status, strerror(), s_PXENV_UNDI_TRANSMIT::TBD, DataBlk::TDDataLen, DataBlk::TDDataPtr, undi_tx_count, s_PXENV_UNDI_TBD::Xmit, s_PXENV_UNDI_TRANSMIT::XmitFlag, and XMT_DESTADDR.
|
static |
Definition at line 448 of file pxe_undi.c.
References DBGC, pxe_dump_mcast_list(), pxe_netdev, PXENV_EXIT_FAILURE, PXENV_EXIT_SUCCESS, PXENV_STATUS_SUCCESS, PXENV_STATUS_UNDI_INVALID_STATE, s_PXENV_UNDI_SET_MCAST_ADDRESS::R_Mcast_Buf, and s_PXENV_UNDI_SET_MCAST_ADDRESS::Status.
|
static |
Definition at line 472 of file pxe_undi.c.
References DBGC, net_device::ll_addr, ll_protocol::ll_addr_len, net_device::ll_protocol, memcpy(), netdev_is_open(), ll_protocol::ntoa, pxe_netdev, PXENV_EXIT_FAILURE, PXENV_EXIT_SUCCESS, PXENV_STATUS_SUCCESS, PXENV_STATUS_UNDI_INVALID_STATE, s_PXENV_UNDI_SET_STATION_ADDRESS::StationAddress, and s_PXENV_UNDI_SET_STATION_ADDRESS::Status.
|
static |
Definition at line 515 of file pxe_undi.c.
References DBGC, s_PXENV_UNDI_SET_PACKET_FILTER::filter, pxe_netdev, PXENV_EXIT_FAILURE, PXENV_EXIT_SUCCESS, PXENV_STATUS_SUCCESS, PXENV_STATUS_UNDI_INVALID_STATE, and s_PXENV_UNDI_SET_PACKET_FILTER::Status.
|
static |
Definition at line 544 of file pxe_undi.c.
References assert(), s_PXENV_UNDI_GET_INFORMATION::BaseIo, s_PXENV_UNDI_GET_INFORMATION::CurrentNodeAddress, DBGC, device::desc, net_device::dev, ETH_MAX_MTU, net_device::hw_addr, s_PXENV_UNDI_GET_INFORMATION::HwAddrLen, s_PXENV_UNDI_GET_INFORMATION::HwType, ll_protocol::init_addr, s_PXENV_UNDI_GET_INFORMATION::IntNumber, device_description::ioaddr, device_description::irq, net_device::ll_addr, ll_protocol::ll_addr_len, ll_protocol::ll_proto, net_device::ll_protocol, s_PXENV_UNDI_GET_INFORMATION::MaxTranUnit, memcpy(), ll_protocol::name, netdev_irq_supported(), ll_protocol::ntoa, ntohs, s_PXENV_UNDI_GET_INFORMATION::PermNodeAddress, pxe_netdev, PXENV_EXIT_FAILURE, PXENV_EXIT_SUCCESS, PXENV_STATUS_SUCCESS, PXENV_STATUS_UNDI_INVALID_STATE, s_PXENV_UNDI_GET_INFORMATION::ROMAddress, s_PXENV_UNDI_GET_INFORMATION::RxBufCt, s_PXENV_UNDI_GET_INFORMATION::Status, and s_PXENV_UNDI_GET_INFORMATION::TxBufCt.
|
static |
Definition at line 597 of file pxe_undi.c.
References net_device_stats::bad, DBGC, net_device_stats::good, pxe_netdev, PXENV_EXIT_FAILURE, PXENV_EXIT_SUCCESS, PXENV_STATUS_SUCCESS, PXENV_STATUS_UNDI_INVALID_STATE, s_PXENV_UNDI_GET_STATISTICS::RcvCRCErrors, s_PXENV_UNDI_GET_STATISTICS::RcvGoodFrames, s_PXENV_UNDI_GET_STATISTICS::RcvResourceErrors, net_device::rx_stats, s_PXENV_UNDI_GET_STATISTICS::Status, net_device::tx_stats, and s_PXENV_UNDI_GET_STATISTICS::XmtGoodFrames.
|
static |
Definition at line 630 of file pxe_undi.c.
References DBGC, memset(), pxe_netdev, PXENV_EXIT_FAILURE, PXENV_EXIT_SUCCESS, PXENV_STATUS_SUCCESS, PXENV_STATUS_UNDI_INVALID_STATE, net_device::rx_stats, s_PXENV_UNDI_CLEAR_STATISTICS::Status, and net_device::tx_stats.
|
static |
Definition at line 656 of file pxe_undi.c.
References DBGC, pxe_netdev, PXENV_EXIT_FAILURE, PXENV_STATUS_UNDI_INVALID_STATE, PXENV_STATUS_UNSUPPORTED, and s_PXENV_UNDI_INITIATE_DIAGS::Status.
|
static |
Definition at line 678 of file pxe_undi.c.
References DBGC, pxe_netdev, PXENV_EXIT_FAILURE, PXENV_STATUS_UNDI_INVALID_STATE, PXENV_STATUS_UNSUPPORTED, and s_PXENV_UNDI_FORCE_INTERRUPT::Status.
|
static |
Definition at line 700 of file pxe_undi.c.
References AF_INET, DBGC, inet_ntoa(), s_PXENV_UNDI_GET_MCAST_ADDRESS::InetAddr, ip, net_device::ll_protocol, ll_protocol::mc_hash, s_PXENV_UNDI_GET_MCAST_ADDRESS::MediaAddr, ll_protocol::ntoa, pxe_netdev, PXENV_EXIT_FAILURE, PXENV_EXIT_SUCCESS, PXENV_STATUS, PXENV_STATUS_SUCCESS, PXENV_STATUS_UNDI_INVALID_STATE, rc, s_PXENV_UNDI_GET_MCAST_ADDRESS::Status, and strerror().
|
static |
Definition at line 737 of file pxe_undi.c.
References device_description::bus_type, BUS_TYPE_ISAPNP, BUS_TYPE_PCI, device_description::class, DBGC, device::desc, net_device::dev, device_description::device, info, s_PXENV_UNDI_GET_NIC_TYPE::info, device_description::location, memset(), s_PXENV_UNDI_GET_NIC_TYPE::NicType, s_PXENV_UNDI_GET_NIC_TYPE::nic_type_info::pci, PCI_BASE_CLASS, PCI_BUS, PCI_FUNC, PCI_NIC, PCI_PROG_INTF, PCI_SLOT, PCI_SUB_CLASS, s_PXENV_UNDI_GET_NIC_TYPE::nic_type_info::pnp, PnP_NIC, pxe_netdev, PXENV_EXIT_FAILURE, PXENV_EXIT_SUCCESS, PXENV_STATUS_FAILURE, PXENV_STATUS_SUCCESS, PXENV_STATUS_UNDI_INVALID_STATE, s_PXENV_UNDI_GET_NIC_TYPE::Status, and device_description::vendor.
|
static |
Definition at line 809 of file pxe_undi.c.
References DBGC, s_PXENV_UNDI_GET_IFACE_INFO::IfaceType, s_PXENV_UNDI_GET_IFACE_INFO::LinkSpeed, memset(), netdev_irq_supported(), pxe_netdev, PXENV_EXIT_FAILURE, PXENV_EXIT_SUCCESS, PXENV_STATUS_SUCCESS, PXENV_STATUS_UNDI_INVALID_STATE, s_PXENV_UNDI_GET_IFACE_INFO::Reserved, s_PXENV_UNDI_GET_IFACE_INFO::ServiceFlags, snprintf(), s_PXENV_UNDI_GET_IFACE_INFO::Status, SUPPORTED_BROADCAST, SUPPORTED_IRQ, SUPPORTED_MULTICAST, SUPPORTED_OPEN_CLOSE, SUPPORTED_RESET, and SUPPORTED_SET_STATION_ADDRESS.
|
static |
Definition at line 853 of file pxe_undi.c.
References __from_data16, basemem_packet, s_PXENV_UNDI_ISR::BufferLength, io_buffer::data, DBGC, DBGC2, ETH_P_ARP, ETH_P_IP, ETH_P_RARP, flags, s_PXENV_UNDI_ISR::Frame, s_PXENV_UNDI_ISR::FrameHeaderLength, s_PXENV_UNDI_ISR::FrameLength, free_iob(), s_PXENV_UNDI_ISR::FuncFlag, htons, iob_len(), len, list_empty, LL_BROADCAST, LL_MULTICAST, net_device::ll_protocol, memcpy(), net_protocol::name, net_poll(), net_protocol::net_proto, netdev_irq(), netdev_irq_enabled(), netdev_rx_dequeue(), NULL, P_ARP, P_BROADCAST, P_DIRECTED, P_IP, P_MULTICAST, P_RARP, P_UNKNOWN, s_PXENV_UNDI_ISR::PktType, s_PXENV_UNDI_ISR::ProtType, ll_protocol::pull, pxe_netdev, PXENV_EXIT_FAILURE, PXENV_EXIT_SUCCESS, PXENV_STATUS_SUCCESS, PXENV_STATUS_UNDI_INVALID_PARAMETER, PXENV_STATUS_UNDI_INVALID_STATE, PXENV_UNDI_ISR_IN_GET_NEXT, PXENV_UNDI_ISR_IN_PROCESS, PXENV_UNDI_ISR_IN_START, PXENV_UNDI_ISR_OUT_DONE, PXENV_UNDI_ISR_OUT_NOT_OURS, PXENV_UNDI_ISR_OUT_OURS, PXENV_UNDI_ISR_OUT_RECEIVE, PXENV_UNDI_ISR_OUT_TRANSMIT, rc, rm_ds, s_PXENV_UNDI_ISR::Status, net_device::tx_queue, and undi_tx_count.
|
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 57 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 59 of file pxe_undi.c.
Referenced by pxe_api_call(), pxe_deactivate(), pxe_dump_mcast_list(), pxe_fake_cached_info(), pxe_netdev_close(), pxe_netdev_open(), pxe_notify(), pxe_set_netdev(), pxe_start_nbp(), pxenv_get_cached_info(), pxenv_restart_tftp(), pxenv_start_base(), pxenv_start_undi(), pxenv_stop_base(), pxenv_stop_undi(), pxenv_udp_open(), pxenv_udp_write(), pxenv_undi_cleanup(), pxenv_undi_clear_statistics(), pxenv_undi_close(), pxenv_undi_force_interrupt(), pxenv_undi_get_iface_info(), pxenv_undi_get_information(), pxenv_undi_get_mcast_address(), pxenv_undi_get_nic_type(), pxenv_undi_get_statistics(), pxenv_undi_initialize(), pxenv_undi_initiate_diags(), pxenv_undi_isr(), pxenv_undi_open(), pxenv_undi_reset_adapter(), pxenv_undi_set_mcast_address(), pxenv_undi_set_packet_filter(), pxenv_undi_set_station_address(), pxenv_undi_shutdown(), pxenv_undi_startup(), pxenv_undi_transmit(), and pxenv_unload_stack().
Transmit profiler.
Definition at line 62 of file pxe_undi.c.
struct pxe_api_call pxe_undi_api [] __pxe_api_call |
PXE UNDI API.
Definition at line 1039 of file pxe_undi.c.