|
XenevaOS
|
#include <aurora.h>#include <pcie.h>#include <Hal/AA64/aa64lowlevel.h>#include <Hal/AA64/gic.h>#include <Fs/Dev/devinput.h>#include <Drivers/virtio.h>#include <Drivers/uart.h>#include <Mm/pmmngr.h>#include <aucon.h>#include <Net/aunet.h>#include <Mm/vmmngr.h>#include <string.h>#include <Mm/kmalloc.h>#include <Net/ethernet.h>
Classes | |
| struct | VirtioNetCfg |
| struct | _ethernet_ |
Macros | |
| #define | VIRTIO_F_VERSION_1 (1ull << 32) |
| #define | RX_BUFFER_COUNT 8 |
| #define | TX_BUFFER_COUNT 8 |
| #define | TX_BUFFER_SIZE 2048 |
| #define | RX_BUFFER_SIZE 2048 |
| #define | VIRTIO_PCI_CAP_ID 0x09 |
| #define | VIRTIO_PCI_CAP_COMMON_CFG 1 |
| #define | VIRTIO_PCI_CAP_DEVICE_CFG 4 |
| #define | ETHERNET_TYPE_IPV4 0x0800 |
| #define | ETHERNET_TYPE_ARP 0x0806 |
| #define | ETHERNET_TYPE_WAKE_ON_LAN 0x0842 |
| #define | ETHERNET_TYPE_AVTP 0x22F0 |
| #define | ETHERNET_TYPE_IETF_TRILL_PROTOCOL 0x22F3 |
| #define | ETHERNET_TYPE_STREAM_RESV_PROTOCOL 0x22EA |
| #define | ETHERNET_TYPE_IPV6 0x86DD |
| #define | VIRTIO_NET_HDR_GSO_NODE 0 |
Typedefs | |
| typedef struct _ethernet_ | Ethernet |
Functions | |
| void | AuVirtioNetHandler (int spiNum) |
| AuVirtioNetHandler – interrupt handler for virtio-net-dev. | |
| void | AuVirtioNetNotifyQueue (struct VirtioCommonCfg *cfg, uint16_t queueIdx) |
| AuVirtioNetNotifyQueue – notify queue. | |
| void | AuVirtioNetRxinitialize (struct VirtioCommonCfg *common) |
| AuVirtioNetRxInitialize – initialize rx queue. | |
| void | AuVirtioNetTxinitialize (struct VirtioCommonCfg *common) |
| AuVirtioNetTxInitialize – initialize tx queue. | |
| void | AuVirtioTransmit (void *packet, uint16_t len) |
| AU_EXTERN AU_EXPORT size_t | AuVirtioWrite (AuVFSNode *node, AuVFSNode *file, uint64_t *buffer, uint32_t len) |
| AU_EXTERN AU_EXPORT int | VirtioNetIOCtl (AuVFSNode *file, int code, void *arg) |
| VirtioNetIOCtl – io control codes. | |
| void | AuVirtioNetInitialize (uint64_t device) |
| AuVirtioNetInitialize – initialize the virtio network device. | |
| AU_EXTERN AU_EXPORT int | AuDriverUnload () |
| AU_EXTERN AU_EXPORT int | AuDriverMain () |
Variables | |
| struct VirtioQueue * | rxqueue |
| struct VirtioQueue * | txqueue |
| virtio_net_hdr_t * | rx_hdrs |
| volatile uint8_t * | notifyBase |
| uint32_t | notifyOffMultiplier |
| VirtioCommonCfg * | _cfg |
| AuVFSNode * | nic |
| AuNetworkDevice * | ndev |
| #define ETHERNET_TYPE_ARP 0x0806 |
| #define ETHERNET_TYPE_AVTP 0x22F0 |
| #define ETHERNET_TYPE_IETF_TRILL_PROTOCOL 0x22F3 |
| #define ETHERNET_TYPE_IPV4 0x0800 |
| #define ETHERNET_TYPE_IPV6 0x86DD |
| #define ETHERNET_TYPE_STREAM_RESV_PROTOCOL 0x22EA |
| #define ETHERNET_TYPE_WAKE_ON_LAN 0x0842 |
| #define RX_BUFFER_COUNT 8 |
| #define RX_BUFFER_SIZE 2048 |
| #define TX_BUFFER_COUNT 8 |
| #define TX_BUFFER_SIZE 2048 |
| #define VIRTIO_F_VERSION_1 (1ull << 32) |
| #define VIRTIO_NET_HDR_GSO_NODE 0 |
| #define VIRTIO_PCI_CAP_COMMON_CFG 1 |
| #define VIRTIO_PCI_CAP_DEVICE_CFG 4 |
| #define VIRTIO_PCI_CAP_ID 0x09 |
| typedef struct _ethernet_ Ethernet |
| void AuVirtioNetHandler | ( | int | spiNum | ) |
AuVirtioNetHandler – interrupt handler for virtio-net-dev.
| spiNum | – shared peripheral interrupt number passed by system |
| void AuVirtioNetInitialize | ( | uint64_t | device | ) |
AuVirtioNetInitialize – initialize the virtio network device.
| device | – device address passed by PCIe |
feature negotiation
enable RX+TX queue
| void AuVirtioNetNotifyQueue | ( | struct VirtioCommonCfg * | cfg, |
| uint16_t | queueIdx | ||
| ) |
AuVirtioNetNotifyQueue – notify queue.
| cfg | – Pointer to common queue |
| queueIdx | – queue number, zero – rx queue, one – tx queue |
| void AuVirtioNetRxinitialize | ( | struct VirtioCommonCfg * | common | ) |
AuVirtioNetRxInitialize – initialize rx queue.
| common | – pointer to virtio common config |
| void AuVirtioNetTxinitialize | ( | struct VirtioCommonCfg * | common | ) |
AuVirtioNetTxInitialize – initialize tx queue.
| common | – pointer to virtio common config |
| void AuVirtioTransmit | ( | void * | packet, |
| uint16_t | len | ||
| ) |
| AU_EXTERN AU_EXPORT size_t AuVirtioWrite | ( | AuVFSNode * | node, |
| AuVFSNode * | file, | ||
| uint64_t * | buffer, | ||
| uint32_t | len | ||
| ) |
VirtioNetIOCtl – io control codes.
| VirtioCommonCfg* _cfg |
| AuNetworkDevice* ndev |
| AuVFSNode* nic |
| volatile uint8_t* notifyBase |
| uint32_t notifyOffMultiplier |
| virtio_net_hdr_t* rx_hdrs |
| struct VirtioQueue* rxqueue |
| struct VirtioQueue* txqueue |