13#ifndef KERNEL_DEVICES_ETHERNET_H
14#define KERNEL_DEVICES_ETHERNET_H
16#include <kernel/devices/driver.h>
18#include <kernel/types.h>
22#include <utils/compiler.h>
23#include <utils/container_of.h>
31 ETHERNET_CAP_BROADCAST,
68#define ETHERNET_DEVICE_PRIV_ALIGNMENT sizeof(uint64_t)
92 return (
void *)(dev) +
static const char * ethernet_device_name(struct ethernet_device *dev)
Definition: ethernet.h:104
void ethernet_device_free(struct ethernet_device *)
De-allocate an ethernet device.
Definition: ethernet.c:32
#define ETHERNET_DEVICE_PRIV_ALIGNMENT
Boundary onto which the ethernet device's private data must be aligned.
Definition: ethernet.h:68
ethernet_capability
Ethernet device capabilities.
Definition: ethernet.h:30
struct ethernet_device * ethernet_device_find_by_mac(mac_address_t)
Definition: ethernet.c:108
static void ethernet_device_set_name(struct ethernet_device *dev, const char *name)
Set the name of the device.
Definition: ethernet.h:98
struct ethernet_device * ethernet_device_alloc(size_t priv_size)
Allocate a new ethernet device.
Definition: ethernet.c:17
error_t ethernet_device_register(struct ethernet_device *)
Register a new ethernet device.
Definition: ethernet.c:37
struct ethernet_device * ethernet_device_find_by_name(const char *)
Definition: ethernet.c:98
void ethernet_device_receive_packet(struct ethernet_device *, struct packet *)
Process a packet received by an ethernet network device.
Definition: ethernet.c:141
@ ETHERNET_CAP_MULTICAST
Device supports broadcast packets.
Definition: ethernet.h:32
static void device_set_name(struct device *dev, const char *name)
Set the name of the device.
Definition: device.h:112
static const char * device_name(struct device *dev)
Definition: device.h:118
uint8_t mac_address_t[ETHERNET_ADDR_SIZE]
Represents an ethernet MAC address.
Definition: ethernet.h:29
#define align_up(_value, _power)
Align _value to the next multiple of _power.
Definition: math.h:47
Represents a device inside the kernel.
Definition: device.h:78
An ethernet device.
Definition: ethernet.h:50
struct ethernet_operations * ops
The underlying generic device.
Definition: ethernet.h:52
mac_address_t mac
The ethernet operation vtable.
Definition: ethernet.h:53
uint32_t capabilities
Maximum transmittable packet size.
Definition: ethernet.h:58
struct worker * worker
Node inside the linked list of registered devices.
Definition: ethernet.h:63
size_t mtu
The device's mac address.
Definition: ethernet.h:55
LLIST_NODE(this)
The netdevice's interface.
Operations that can be performed on an ethernet device.
Definition: ethernet.h:36
The head of a doubly linked list.
Definition: linked_list.h:43
A network interface.
Definition: interface.h:39
A network packet.
Definition: packet.h:51
Worker thread.
Definition: worker.h:53