45 .description =
"MAC address",
46 .type = &setting_type_hex,
50 .description =
"Hardware address",
51 .type = &setting_type_hex,
55 .description =
"Bus type",
56 .type = &setting_type_string,
60 .description =
"Bus location",
61 .type = &setting_type_uint32,
65 .description =
"Bus ID",
66 .type = &setting_type_hex,
70 .description =
"Link-layer type",
71 .type = &setting_type_string,
75 .description =
"Chip",
76 .type = &setting_type_string,
80 .description =
"Interface name",
81 .type = &setting_type_string,
86 .type = &setting_type_int16,
99 const void *
data,
size_t len ) {
161 static const char *bustypes[] = {
176 assert (
desc->bus_type < ( sizeof ( bustypes ) /
177 sizeof ( bustypes[0] ) ) );
178 bustype = bustypes[
desc->bus_type];
182 return strlen ( bustype );
199 if (
len >
sizeof ( busloc ) )
200 len =
sizeof ( busloc );
202 return sizeof ( busloc );
221 if (
len >
sizeof ( dhcp_desc ) )
222 len =
sizeof ( dhcp_desc );
224 return sizeof ( dhcp_desc );
321 const void *
data,
size_t len ) {
423 DBG (
"Could not register netX settings: %s\n",
464 if (
mtu > max_mtu ) {
465 DBGC (
netdev,
"NETDEV %s cannot support MTU %zd (max " 473 if (
mtu != old_mtu ) {
static int netdev_fetch_mac(struct net_device *netdev, void *data, size_t len)
Fetch link-layer address setting.
#define EINVAL
Invalid argument.
static struct settings netdev_redirect_settings
"netX" settings
struct arbelprm_rc_send_wqe rc
Dynamic Host Configuration Protocol.
int(* fetch)(struct net_device *netdev, void *data, size_t len)
Fetch setting.
uint8_t ll_header_len
Link-layer header length.
static struct netdev_setting_operation netdev_setting_operations[]
Network device settings.
uint8_t ll_addr_len
Link-layer address length.
static struct settings * netdev_redirect(struct settings *settings)
Redirect "netX" settings block.
static struct settings_operations netdev_redirect_settings_operations
"netX" settings operations
const struct setting * setting
Setting.
const struct setting mac_setting __setting(SETTING_NETDEV, mac)
Network device predefined settings.
size_t mtu
Maximum transmission unit length.
uint64_t desc
Microcode descriptor list physical address.
#define ENOENT
No such file or directory.
void generic_settings_clear(struct settings *settings)
Clear generic settings block.
static int apply_netdev_settings(void)
Apply network device settings.
int generic_settings_fetch(struct settings *settings, struct setting *setting, void *data, size_t len)
Fetch value of generic setting.
uint8_t mac[ETH_ALEN]
MAC address.
void(* init_addr)(const void *hw_addr, void *ll_addr)
Initialise link-layer address.
static struct settings * netdev_settings(struct net_device *netdev)
Get per-netdevice configuration settings block.
static void netdev_clear(struct settings *settings)
Clear network device settings.
#define ENOTSUP
Operation not supported.
A hardware device description.
#define BUS_TYPE_MCA
MCA bus type.
const char * name
Protocol name.
char * strncpy(char *dest, const char *src, size_t max)
Copy string.
static int netdev_fetch_chip(struct net_device *netdev, void *data, size_t len)
Fetch chip setting.
#define BUS_TYPE_ISA
ISA bus type.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define SETTING_NETDEV
Network device settings.
static int netdev_fetch_busid(struct net_device *netdev, void *data, size_t len)
Fetch bus ID setting.
static int netdev_is_open(struct net_device *netdev)
Check whether or not network device is open.
An initialisation function.
#define BUS_TYPE_PCI
PCI bus type.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
#define container_of(ptr, type, field)
Get containing structure.
uint8_t hw_addr_len
Hardware address length.
static struct net_device * netdev
const char * driver_name
Driver name.
static int netdev_store(struct settings *settings, const struct setting *setting, const void *data, size_t len)
Store value of network device setting.
#define DHCP_MTU
Maximum transmission unit.
struct settings_applicator netdev_applicator __settings_applicator
Network device settings applicator.
struct settings *(* redirect)(struct settings *settings)
Redirect to underlying settings block (if applicable)
#define BUS_TYPE_EISA
EISA bus type.
char * strerror(int errno)
Retrieve string representation of error number.
A network device setting operation.
#define for_each_netdev(netdev)
Iterate over all network devices.
uint16_t device
Device ID.
Network device descriptor.
size_t strlen(const char *src)
Get length of string.
Settings block operations.
static int netdev_fetch_linktype(struct net_device *netdev, void *data, size_t len)
Fetch link layer type setting.
unsigned long fetch_uintz_setting(struct settings *settings, const struct setting *setting)
Fetch value of unsigned integer setting, or zero.
static int netdev_fetch_hwaddr(struct net_device *netdev, void *data, size_t len)
Fetch hardware address setting.
#define BUS_TYPE_EFI
EFI bus type.
struct list_head siblings
Sibling settings blocks.
struct device * dev
Underlying hardware device.
void netdev_close(struct net_device *netdev)
Close network device.
Network device management.
#define BUS_TYPE_TAP
TAP bus type.
#define cpu_to_be32(value)
static uint16_t struct vmbus_xfer_pages_operations * op
char name[NETDEV_NAME_LEN]
Name of this network device.
static int netdev_fetch_bustype(struct net_device *netdev, void *data, size_t len)
Fetch bus type setting.
struct settings_operations netdev_settings_operations
Network device configuration settings operations.
int generic_settings_store(struct settings *settings, const struct setting *setting, const void *data, size_t len)
Store value of generic setting.
struct net_device * find_netdev(const char *name)
Get network device by name.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
static int netdev_fetch_ifname(struct net_device *netdev, void *data, size_t len)
Fetch ifname setting.
uint8_t data[48]
Additional event data.
struct device_description desc
Device description.
static void netdev_redirect_settings_init(void)
Initialise "netX" settings.
int(* apply)(void)
Apply updated settings.
struct init_fn netdev_redirect_settings_init_fn __init_fn(INIT_LATE)
"netX" settings initialiser
struct list_head children
Child settings blocks.
int register_settings(struct settings *settings, struct settings *parent, const char *name)
Register settings block.
static int netdev_fetch(struct settings *settings, struct setting *setting, void *data, size_t len)
Fetch value of network device setting.
uint16_t vendor
Vendor ID.
#define BUS_TYPE_XEN
Xen bus type.
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
size_t max_pkt_len
Maximum packet length.
#define INIT_LATE
Late initialisation.
#define DBG(...)
Print a debugging message.
#define LIST_HEAD_INIT(list)
Initialise a static list head.
#define BUS_TYPE_USB
USB bus type.
struct generic_settings settings
Configuration settings applicable to this device.
static int netdev_store_mac(struct net_device *netdev, const void *data, size_t len)
Store link-layer address setting.
int(* store)(struct net_device *netdev, const void *data, size_t len)
Store setting (or NULL if not supported)
int(* store)(struct settings *settings, const struct setting *setting, const void *data, size_t len)
Store value of setting.
int setting_cmp(const struct setting *a, const struct setting *b)
Compare two settings.
uint8_t hw_addr[MAX_HW_ADDR_LEN]
Hardware address.
#define NULL
NULL pointer (VOID *)
int netdev_open(struct net_device *netdev)
Open network device.
struct ll_protocol * ll_protocol
Link-layer protocol.
struct refcnt * refcnt
Reference counter.
static int netdev_fetch_busloc(struct net_device *netdev, void *data, size_t len)
Fetch bus location setting.
#define BUS_TYPE_HV
Hyper-V bus type.
#define BUS_TYPE_ISAPNP
ISAPnP bus type.