Perform loopback test between two network devices.
201 unsigned int successes;
207 if ( (
rc =
ifopen ( receiver ) ) != 0 )
217 if (
mtu <
sizeof ( *
seq ) )
218 mtu =
sizeof ( *seq );
222 seq = ( (
void * ) buf );
225 ll_dest = ( broadcast ?
sender->ll_broadcast : receiver->
ll_addr );
228 printf (
"Performing %sloopback test from %s to %s with %zd byte MTU\n",
229 ( broadcast ?
"broadcast " :
"" ),
sender->name,
239 for ( successes = 0 ; ; successes++ ) {
242 printf (
"\r%d", successes );
246 for ( i =
sizeof ( *
seq ) ; i <
mtu ; i++ )
250 printf (
"\nFailed to allocate I/O buffer" );
259 &lotest_protocol, ll_dest,
260 sender->ll_addr ) ) != 0 ) {
261 printf (
"\nFailed to transmit packet: %s",
static struct net_device * lotest_receiver
Current loopback test receiver.
struct arbelprm_rc_send_wqe rc
#define iob_put(iobuf, len)
int printf(const char *fmt,...)
Write a formatted string to the console.
static void lotest_flush(void)
Discard all received loopback test packets.
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
u16 seq
802.11 Sequence Control field
int iflinkwait(struct net_device *netdev, unsigned long timeout, int verbose)
Wait for link-up, with status indication.
#define ENOMEM
Not enough space.
#define iob_disown(iobuf)
Disown an I/O buffer.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static int loopback_wait(void *data, size_t len)
Wait for packet to be received.
#define MAX_LL_HEADER_LEN
Maximum length of a link-layer header.
char * strerror(int errno)
Retrieve string representation of error number.
static void(* free)(struct refcnt *refcnt))
long int random(void)
Generate a pseudo-random number between 0 and 2147483647L or 2147483562?
void * malloc(size_t size)
Allocate memory.
struct stp_switch sender
Sender switch.
int ifopen(struct net_device *netdev)
Open network device.
#define iob_reserve(iobuf, len)
char name[NETDEV_NAME_LEN]
Name of this network device.
int net_tx(struct io_buffer *iobuf, struct net_device *netdev, struct net_protocol *net_protocol, const void *ll_dest, const void *ll_source)
Transmit network-layer packet.
void ifstat(struct net_device *netdev)
Print status of network device.
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
#define NULL
NULL pointer (VOID *)