XenevaOS
Loading...
Searching...
No Matches
netsrv.h
Go to the documentation of this file.
1
19#ifndef __NETSRV_H__
20#define __NETSRV_H__
21
22#include <stdint.h>
23
24#define NETSRV_RING_MAGIC 0x3154454Eu /* 'NET1' */
25#define NETSRV_SLOTS 32 /* per ring, a power of two */
26#define NETSRV_SLOT_SIZE 2048
27#define NETSRV_SLOT_HDR 8
28#define NETSRV_MAX_FRAME (NETSRV_SLOT_SIZE - NETSRV_SLOT_HDR)
29#define NETSRV_TX_OFFSET 4096
30#define NETSRV_RX_OFFSET (NETSRV_TX_OFFSET + NETSRV_SLOTS * NETSRV_SLOT_SIZE)
31#define NETSRV_RING_BYTES (NETSRV_RX_OFFSET + NETSRV_SLOTS * NETSRV_SLOT_SIZE)
32
33#define NETSRV_IOC_ATTACH 0x5501 /* arg: NetsrvAttach */
34#define NETSRV_IOC_DETACH 0x5502
35#define NETSRV_IOC_STATS 0x5503 /* arg: NetsrvStats */
36
37#define NETSRV_OK 0
38#define NETSRV_E_PERM -1
39#define NETSRV_E_INVAL -2
40#define NETSRV_E_BUSY -3
41
42typedef struct {
44 uint32_t slots; /* NETSRV_SLOTS */
45 uint32_t slot_size; /* NETSRV_SLOT_SIZE */
46 volatile uint32_t link; /* 1 = link up (server writes) */
47 uint8_t mac[6]; /* filled in by the server before ATTACH */
49 volatile uint32_t tx_head, tx_tail;
50 volatile uint32_t rx_head, rx_tail;
51 volatile uint32_t tx_dropped; /* frames the kernel discarded: ring full */
52 volatile uint32_t rx_dropped; /* frames the server discarded: ring full */
54
55typedef struct { uint64_t ring_phys; uint64_t ring_len; } NetsrvAttach;
57
58#endif
uint8_t mac[6]
Definition main.cpp:127
unsigned int uint32_t
Definition acefiex.h:163
unsigned char uint8_t
Definition acefiex.h:161
COMPILER_DEPENDENT_UINT64 uint64_t
Definition acefiex.h:165
unsigned short int uint16_t
Definition acefiex.h:162
uint64_t tx_frames
Definition netproxy.c:45
uint64_t tx_dropped
Definition netproxy.c:45
uint64_t rx_frames
Definition netproxy.c:45
Definition netsrv.h:42
volatile uint32_t rx_head
Definition netsrv.h:50
volatile uint32_t rx_dropped
Definition netsrv.h:52
volatile uint32_t link
Definition netsrv.h:46
uint16_t reserved
Definition netsrv.h:48
uint32_t magic
Definition netsrv.h:43
volatile uint32_t tx_dropped
Definition netsrv.h:51
volatile uint32_t tx_head
Definition netsrv.h:49
uint32_t slot_size
Definition netsrv.h:45
uint32_t slots
Definition netsrv.h:44
Definition netsrv.h:55
uint64_t ring_len
Definition netsrv.h:55
Definition netsrv.h:56
uint64_t rx_bad
Definition netsrv.h:56