Voxia OS v0.0.1
Hobby Project Operating System Targeting x86-64
Loading...
Searching...
No Matches
netdev.c File Reference
#include "netdev.h"
#include "init/init.h"
#include <hash.h>
#include "libk/serial.h"
#include <str.h>
#include "memory/slab.h"
#include <init/loader.h>

Go to the source code of this file.

Data Structures

struct  netdev_list
 

Macros

#define NETDEV_HASHMAP_MAX_ENTRY   512
 

Functions

static void bind_nic (netdev_t *netdev, struct ioforge_nic_service *nic)
 
 INIT (Netdev)
 
int create_netdev (char *name, netdev_type_t type)
 
netdev_tlookup_netdev (char *name)
 
uint16_t get_next_ip_id (netdev_t *dev)
 

Variables

static struct slab_cachenetdev_cache = 0
 
static struct netdev_list netdev_lists [512]
 
static struct netdev_opsethernet_ops = 0
 

Macro Definition Documentation

◆ NETDEV_HASHMAP_MAX_ENTRY

#define NETDEV_HASHMAP_MAX_ENTRY   512

Definition at line 9 of file netdev.c.

Referenced by create_netdev(), and lookup_netdev().

Function Documentation

◆ bind_nic()

static void bind_nic ( netdev_t * netdev,
struct ioforge_nic_service * nic )
static

◆ create_netdev()

◆ get_next_ip_id()

uint16_t get_next_ip_id ( netdev_t * dev)

Definition at line 100 of file netdev.c.

References netdev::ip_id_counter.

Referenced by ipv4_send().

◆ INIT()

INIT ( Netdev )

Definition at line 22 of file netdev.c.

References bind_nic(), ethernet_ops, kalloc(), netdev_cache, and vxCreateSlabCache().

◆ lookup_netdev()

netdev_t * lookup_netdev ( char * name)

Definition at line 70 of file netdev.c.

References bucket, hash, LOG2_DEBUG, name, NETDEV_HASHMAP_MAX_ENTRY, and netdev_lists.

Referenced by socket_set_sockopt().

Variable Documentation

◆ ethernet_ops

struct netdev_ops* ethernet_ops = 0
static

Definition at line 18 of file netdev.c.

Referenced by create_netdev(), and INIT().

◆ netdev_cache

struct slab_cache* netdev_cache = 0
static

Definition at line 11 of file netdev.c.

Referenced by create_netdev(), and INIT().

◆ netdev_lists

struct netdev_list netdev_lists[512]
static

Definition at line 16 of file netdev.c.

Referenced by create_netdev(), and lookup_netdev().