iPXE
|
Network interface management. More...
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <ipxe/console.h>
#include <ipxe/netdevice.h>
#include <ipxe/device.h>
#include <ipxe/job.h>
#include <ipxe/monojob.h>
#include <ipxe/timer.h>
#include <ipxe/errortab.h>
#include <usr/ifmgmt.h>
Go to the source code of this file.
Data Structures | |
struct | ifpoller |
Network device poller. More... | |
Macros | |
#define | LINK_WAIT_TIMEOUT ( 15 * TICKS_PER_SEC ) |
Default time to wait for link-up. More... | |
#define | EADDRNOTAVAIL_CONFIG __einfo_error ( EINFO_EADDRNOTAVAIL_CONFIG ) |
Default unsuccessful configuration status code. More... | |
#define | EINFO_EADDRNOTAVAIL_CONFIG |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
int | ifopen (struct net_device *netdev) |
Open network device. More... | |
void | ifclose (struct net_device *netdev) |
Close network device. More... | |
static void | ifstat_errors (struct net_device_stats *stats, const char *prefix) |
Print network device error breakdown. More... | |
void | ifstat (struct net_device *netdev) |
Print status of network device. More... | |
static int | ifpoller_progress (struct ifpoller *ifpoller, struct job_progress *progress __unused) |
Report network device poller progress. More... | |
static int | ifpoller_wait (struct net_device *netdev, struct net_device_configurator *configurator, unsigned long timeout, int(*progress)(struct ifpoller *ifpoller)) |
Poll network device until completion. More... | |
static int | iflinkwait_progress (struct ifpoller *ifpoller) |
Check link-up progress. More... | |
int | iflinkwait (struct net_device *netdev, unsigned long timeout, int verbose) |
Wait for link-up, with status indication. More... | |
static int | ifconf_progress (struct ifpoller *ifpoller) |
Check configuration progress. More... | |
int | ifconf (struct net_device *netdev, struct net_device_configurator *configurator, unsigned long timeout) |
Perform network device configuration. More... | |
Variables | |
struct errortab ifmgmt_errors [] | __errortab |
Human-readable error message. More... | |
static struct interface_operation | ifpoller_job_op [] |
Network device poller operations. More... | |
static struct interface_descriptor | ifpoller_job_desc |
Network device poller descriptor. More... | |
Network interface management.
Definition in file ifmgmt.c.
#define LINK_WAIT_TIMEOUT ( 15 * TICKS_PER_SEC ) |
#define EADDRNOTAVAIL_CONFIG __einfo_error ( EINFO_EADDRNOTAVAIL_CONFIG ) |
#define EINFO_EADDRNOTAVAIL_CONFIG |
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
int ifopen | ( | struct net_device * | netdev | ) |
Open network device.
netdev | Network device |
rc | Return status code |
Definition at line 65 of file ifmgmt.c.
References net_device::name, netdev, netdev_open(), printf(), rc, and strerror().
Referenced by iflinkwait(), ifopen_payload(), loopback_test(), and netboot().
void ifclose | ( | struct net_device * | netdev | ) |
Close network device.
netdev | Network device |
Definition at line 82 of file ifmgmt.c.
References netdev, and netdev_close().
Referenced by close_other_netdevs(), and ifclose_payload().
|
static |
Print network device error breakdown.
stats | Network device statistics |
prefix | Message prefix |
Definition at line 92 of file ifmgmt.c.
References net_device_error::count, net_device_stats::errors, prefix, printf(), net_device_error::rc, and strerror().
Referenced by ifstat().
void ifstat | ( | struct net_device * | netdev | ) |
Print status of network device.
netdev | Network device |
Definition at line 110 of file ifmgmt.c.
References net_device_stats::bad, net_device::dev, device::driver_name, net_device_stats::good, ifstat_errors(), net_device::link_rc, net_device::ll_protocol, device::name, ll_protocol::name, net_device::name, netdev, netdev_addr(), netdev_is_open(), netdev_link_blocked(), netdev_link_ok(), printf(), net_device::rx_stats, strerror(), and net_device::tx_stats.
Referenced by ifstat_payload(), iwstat(), loopback_test(), and netboot().
|
static |
Report network device poller progress.
ifpoller | Network device poller |
progress | Progress report to fill in |
ongoing_rc | Ongoing job status code (if known) |
Definition at line 153 of file ifmgmt.c.
References ifpoller::progress.
|
static |
Poll network device until completion.
netdev | Network device |
configurator | Network device configurator (if applicable) |
timeout | Timeout period, in ticks |
progress | Method to check progress |
rc | Return status code |
Definition at line 178 of file ifmgmt.c.
References ifpoller::configurator, ifpoller_job_desc, INTF_INIT, intf_plug_plug(), ifpoller::job, monojob, monojob_wait(), netdev, ifpoller::netdev, ifpoller::progress, and timeout().
Referenced by ifconf(), and iflinkwait().
|
static |
Check link-up progress.
ifpoller | Network device poller |
ongoing_rc | Ongoing job status code (if known) |
Definition at line 199 of file ifmgmt.c.
References intf_close(), ifpoller::job, net_device::link_rc, netdev, and ifpoller::netdev.
Referenced by iflinkwait().
int iflinkwait | ( | struct net_device * | netdev, |
unsigned long | timeout, | ||
int | verbose | ||
) |
Wait for link-up, with status indication.
netdev | Network device |
timeout | Timeout period, in ticks |
verbose | Always display progress message |
rc | Return status code |
Definition at line 219 of file ifmgmt.c.
References iflinkwait_progress(), ifopen(), ifpoller_wait(), net_device::name, netdev, netdev_link_ok(), netdev_poll(), NULL, printf(), rc, and timeout().
Referenced by ifconf(), iflinkwait_payload(), and loopback_test().
|
static |
Check configuration progress.
ifpoller | Network device poller |
ongoing_rc | Ongoing job status code (if known) |
Definition at line 243 of file ifmgmt.c.
References ifpoller::configurator, net_device_configuration::configurator, EADDRNOTAVAIL_CONFIG, intf_close(), ifpoller::job, netdev, ifpoller::netdev, netdev_configuration(), netdev_configuration_in_progress(), netdev_configuration_ok(), net_device_configuration::rc, and rc.
Referenced by ifconf().
int ifconf | ( | struct net_device * | netdev, |
struct net_device_configurator * | configurator, | ||
unsigned long | timeout | ||
) |
Perform network device configuration.
netdev | Network device |
configurator | Network device configurator, or NULL to use all |
timeout | Timeout period, in ticks |
rc | Return status code |
Definition at line 274 of file ifmgmt.c.
References net_device_configuration::configurator, ifconf_progress(), iflinkwait(), ifpoller_wait(), LINK_WAIT_TIMEOUT, net_device::ll_addr, net_device::ll_protocol, net_device_configurator::name, net_device::name, netdev, netdev_configure(), netdev_configure_all(), ll_protocol::ntoa, printf(), rc, strerror(), and timeout().
Referenced by ifconf_payload(), and netboot().
struct errortab ifmgmt_errors [] __errortab |
Human-readable error message.
|
static |
Network device poller operations.
|
static |
Network device poller descriptor.
Definition at line 166 of file ifmgmt.c.
Referenced by ifpoller_wait().