iPXE
|
Loopback testing. More...
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <byteswap.h>
#include <ipxe/iobuf.h>
#include <ipxe/netdevice.h>
#include <ipxe/if_ether.h>
#include <ipxe/keys.h>
#include <ipxe/console.h>
#include <usr/ifmgmt.h>
#include <usr/lotest.h>
Go to the source code of this file.
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static | LIST_HEAD (lotest_queue) |
Loopback testing received packets. More... | |
static int | lotest_rx (struct io_buffer *iobuf, struct net_device *netdev, const void *ll_dest __unused, const void *ll_source __unused, unsigned int flags __unused) |
Process received packet. More... | |
static struct io_buffer * | lotest_dequeue (void) |
Dequeue received packet. More... | |
static const char * | lotest_ntoa (const void *net_addr __unused) |
Transcribe network-layer address. More... | |
static void | lotest_flush (void) |
Discard all received loopback test packets. More... | |
static int | loopback_wait (void *data, size_t len) |
Wait for packet to be received. More... | |
int | loopback_test (struct net_device *sender, struct net_device *receiver, size_t mtu, int broadcast) |
Perform loopback test between two network devices. More... | |
Variables | |
static struct net_device * | lotest_receiver |
Current loopback test receiver. More... | |
static struct net_protocol lotest_protocol | __net_protocol |
Loopback test network-layer protocol. More... | |
Loopback testing.
Definition in file lotest.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
Loopback testing received packets.
|
static |
Process received packet.
iobuf | I/O buffer |
netdev | Network device |
ll_dest | Link-layer destination address |
ll_source | Link-layer source address |
flags | Packet flags |
rc | Return status code |
Definition at line 62 of file lotest.c.
References free_iob(), io_buffer::list, list_add_tail, lotest_receiver, and netdev.
|
static |
Dequeue received packet.
iobuf | I/O buffer, or NULL |
Definition at line 83 of file lotest.c.
References io_buffer::list, list_del, list_first_entry, and NULL.
Referenced by loopback_wait(), and lotest_flush().
|
static |
|
static |
Discard all received loopback test packets.
Definition at line 124 of file lotest.c.
References free_iob(), lotest_dequeue(), and NULL.
Referenced by loopback_test().
|
static |
Wait for packet to be received.
data | Expected data |
len | Expected data length |
rc | Return status code |
Definition at line 138 of file lotest.c.
References CTRL_C, data, io_buffer::data, DBG, DBG_HDA, ECANCELED, EINVAL, free_iob(), getchar(), iob_disown, iob_len(), iskey(), len, lotest_dequeue(), memcmp(), net_poll(), and printf().
Referenced by loopback_test().
int loopback_test | ( | struct net_device * | sender, |
struct net_device * | receiver, | ||
size_t | mtu, | ||
int | broadcast | ||
) |
Perform loopback test between two network devices.
sender | Sending network device |
receiver | Received network device |
mtu | Packet size (excluding link-layer headers) |
broadcast | Use broadcast link-layer address |
rc | Return status code |
Definition at line 194 of file lotest.c.
References alloc_iob(), ENOMEM, free, htonl, iflinkwait(), ifopen(), ifstat(), iob_disown, iob_put, iob_reserve, net_device::ll_addr, loopback_wait(), lotest_flush(), lotest_receiver, malloc(), MAX_LL_HEADER_LEN, memcpy(), mtu, net_device::name, net_tx(), NULL, printf(), random(), rc, sender, seq, and strerror().
Referenced by lotest_exec().
|
static |
Current loopback test receiver.
Definition at line 47 of file lotest.c.
Referenced by loopback_test(), and lotest_rx().
|
static |
Loopback test network-layer protocol.
Using a dedicated network-layer protocol avoids problems caused by cards supporting features such as IPv4 checksum offload trying to interpret the (randomly generated) network-layer content.