46 .description =
"MAC address",
47 .type = &setting_type_hex,
51 .description =
"Hardware address",
52 .type = &setting_type_hex,
56 .description =
"Bus type",
57 .type = &setting_type_string,
61 .description =
"Bus location",
62 .type = &setting_type_uint32,
66 .description =
"Bus ID",
67 .type = &setting_type_hex,
71 .description =
"Link-layer type",
72 .type = &setting_type_string,
76 .description =
"Chip",
77 .type = &setting_type_string,
81 .description =
"Interface name",
82 .type = &setting_type_string,
87 .type = &setting_type_int16,
100 const void *
data,
size_t len ) {
105 if (
len !=
netdev->ll_protocol->ll_addr_len )
126 size_t max_len =
netdev->ll_protocol->ll_addr_len;
144 size_t max_len =
netdev->ll_protocol->hw_addr_len;
162 static const char *bustypes[] = {
178 assert (
desc->bus_type < ( sizeof ( bustypes ) /
179 sizeof ( bustypes[0] ) ) );
180 bustype = bustypes[
desc->bus_type];
184 return strlen ( bustype );
201 if (
len >
sizeof ( busloc ) )
202 len =
sizeof ( busloc );
204 return sizeof ( busloc );
223 if (
len >
sizeof ( dhcp_desc ) )
224 len =
sizeof ( dhcp_desc );
226 return sizeof ( dhcp_desc );
255 const char *chip =
netdev->dev->driver_name;
271 const char *ifname =
netdev->name;
323 const void *
data,
size_t len ) {
425 DBG (
"Could not register netX settings: %s\n",
467 if (
mtu > max_mtu ) {
468 DBGC (
netdev,
"NETDEV %s cannot support MTU %zd (max "
476 if (
mtu != old_mtu ) {
#define NULL
NULL pointer (VOID *)
struct arbelprm_rc_send_wqe rc
#define assert(condition)
Assert a condition at run-time.
#define BUS_TYPE_PCI
PCI bus type.
#define BUS_TYPE_ISAPNP
ISAPnP bus type.
#define BUS_TYPE_EISA
EISA bus type.
#define BUS_TYPE_USB
USB bus type.
#define BUS_TYPE_EFI
EFI bus type.
#define BUS_TYPE_ISA
ISA bus type.
#define BUS_TYPE_MCA
MCA bus type.
#define BUS_TYPE_TAP
TAP bus type.
#define BUS_TYPE_XEN
Xen bus type.
#define BUS_TYPE_DT
Devicetree bus type.
#define BUS_TYPE_HV
Hyper-V bus type.
uint8_t data[48]
Additional event data.
struct ena_llq_option desc
Descriptor counts.
uint8_t mac[ETH_ALEN]
MAC address.
static struct net_device * netdev
#define DBG(...)
Print a debugging message.
#define DHCP_MTU
Maximum transmission unit.
#define INIT_LATE
Late initialisation.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
#define ENOENT
No such file or directory.
#define EINVAL
Invalid argument.
#define ENOTSUP
Operation not supported.
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
#define SETTING_NETDEV
Network device settings.
#define cpu_to_be32(value)
Dynamic Host Configuration Protocol.
#define __setting(setting_order, name)
Declare a configuration setting.
#define __settings_applicator
Declare a settings applicator.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define __init_fn(init_order)
Declare an initialisation functon.
#define LIST_HEAD_INIT(list)
Initialise a static list head.
static int netdev_fetch_busid(struct net_device *netdev, void *data, size_t len)
Fetch bus ID setting.
static struct settings_operations netdev_redirect_settings_operations
"netX" settings operations
static struct settings netdev_redirect_settings
"netX" settings
static int netdev_fetch_mac(struct net_device *netdev, void *data, size_t len)
Fetch link-layer address setting.
static struct settings * netdev_redirect(struct settings *settings)
Redirect "netX" settings block.
struct settings_operations netdev_settings_operations
Network device configuration settings operations.
static int netdev_fetch_bustype(struct net_device *netdev, void *data, size_t len)
Fetch bus type setting.
static void netdev_redirect_settings_init(void)
Initialise "netX" settings.
static int netdev_fetch_hwaddr(struct net_device *netdev, void *data, size_t len)
Fetch hardware address setting.
static int netdev_store_mac(struct net_device *netdev, const void *data, size_t len)
Store link-layer address setting.
static int netdev_store(struct settings *settings, const struct setting *setting, const void *data, size_t len)
Store value of network device setting.
static int netdev_fetch_chip(struct net_device *netdev, void *data, size_t len)
Fetch chip setting.
static int netdev_fetch(struct settings *settings, struct setting *setting, void *data, size_t len)
Fetch value of network device setting.
static int netdev_fetch_busloc(struct net_device *netdev, void *data, size_t len)
Fetch bus location setting.
static void netdev_clear(struct settings *settings)
Clear network device settings.
static struct netdev_setting_operation netdev_setting_operations[]
Network device settings.
static int netdev_fetch_linktype(struct net_device *netdev, void *data, size_t len)
Fetch link layer type setting.
static int apply_netdev_settings(void)
Apply network device settings.
static int netdev_fetch_ifname(struct net_device *netdev, void *data, size_t len)
Fetch ifname setting.
int netdev_open(struct net_device *netdev)
Open network device.
void netdev_close(struct net_device *netdev)
Close network device.
struct net_device * find_netdev(const char *name)
Get network device by name.
Network device management.
#define for_each_netdev(netdev)
Iterate over all network devices.
static int netdev_is_open(struct net_device *netdev)
Check whether or not network device is open.
static struct settings * netdev_settings(struct net_device *netdev)
Get per-netdevice configuration settings block.
static uint16_t struct vmbus_xfer_pages_operations * op
int register_settings(struct settings *settings, struct settings *parent, const char *name)
Register settings block.
unsigned long fetch_uintz_setting(struct settings *settings, const struct setting *setting)
Fetch value of unsigned integer setting, or zero.
int setting_cmp(const struct setting *a, const struct setting *b)
Compare two settings.
int generic_settings_fetch(struct settings *settings, struct setting *setting, void *data, size_t len)
Fetch value of generic setting.
void generic_settings_clear(struct settings *settings)
Clear generic settings block.
int generic_settings_store(struct settings *settings, const struct setting *setting, const void *data, size_t len)
Store value of generic setting.
#define container_of(ptr, type, field)
Get containing structure.
char * strerror(int errno)
Retrieve string representation of error number.
size_t strlen(const char *src)
Get length of string.
char * strncpy(char *dest, const char *src, size_t max)
Copy string.
A hardware device description.
Network device descriptor.
uint16_t device
Device ID.
uint16_t vendor
Vendor ID.
An initialisation function.
void(* init_addr)(const void *hw_addr, void *ll_addr)
Initialise link-layer address.
uint8_t ll_header_len
Link-layer header length.
A network device setting operation.
int(* store)(struct net_device *netdev, const void *data, size_t len)
Store setting (or NULL if not supported)
int(* fetch)(struct net_device *netdev, void *data, size_t len)
Fetch setting.
const struct setting * setting
Setting.
Settings block operations.