|
miniOS
x86_64 hobby kernel with SMP, VFS, and POSIX process model
|
lwIP netif initialization and poll driver for miniOS. More...
#include <miniOS/net/lwip_netif.h>#include <miniOS/net/lwip_port.h>#include <miniOS/net/net_config.h>#include <string.h>#include "lwip/init.h"#include "lwip/dns.h"#include "lwip/netif.h"#include "lwip/ip4_addr.h"#include "lwip/timeouts.h"#include "lwip/pbuf.h"#include "lwip/etharp.h"#include "netif/ethernet.h"
Functions | |
| static err_t | miniOS_netif_linkoutput (struct netif *netif, struct pbuf *p) |
| linkoutput callback: transmit a pbuf chain via lwip_port_tx(). | |
| static err_t | miniOS_netif_init (struct netif *netif) |
| netif initialization callback called by netif_add(). | |
| static void | miniOS_lwip_rx_callback (netdev_t *dev, lwip_port_frame_kind_t kind, const void *frame, size_t frame_len, const ethernet_frame_info_t *info, void *ctx) |
| RX callback wired into lwip_port_attach(). | |
| static void | miniOS_lwip_timeout_cb (uint32_t elapsed_ms, void *ctx) |
| Timeout callback wired into lwip_port_attach(). | |
| void | lwip_netif_init (void) |
| Initialize lwIP stack and register eth0 netif. | |
| void | lwip_netif_poll (void) |
| Poll the network interface and drive lwIP timers. | |
Variables | |
| static struct netif | g_lwip_netif |
lwIP netif initialization and poll driver for miniOS.
Bridges the lwip_port Ethernet seam to lwIP's netif layer. Operates in NO_SYS=1 mode — no threading, no tcpip_thread.
| void lwip_netif_init | ( | void | ) |
Initialize lwIP stack and register eth0 netif.
Calls lwip_init(), netif_add() with QEMU static IPv4 config from net_config_get_active(), wires the RX callback to ethernet_input(), and calls lwip_port_attach() to connect the Ethernet seam. Must be called after net_observe_init() and before any socket operations.


| void lwip_netif_poll | ( | void | ) |
Poll the network interface and drive lwIP timers.
Calls lwip_port_poll() then sys_check_timeouts(). Must be called regularly (every ~10ms) to keep TCP retransmit and ARP aging alive. Also calls lwip_port_poll_timeouts(10) to feed the timeout accumulator.


|
static |
RX callback wired into lwip_port_attach().
Receives classified Ethernet frames from lwip_port and feeds them into lwIP's ethernet_input() for ARP and IPv4 processing. Unsupported frames (LWIP_PORT_FRAME_UNSUPPORTED) are silently dropped.
T-42-02-01: drops frame when pbuf_alloc returns NULL (pool exhausted). T-42-02-04: NULL ctx guard is defensive; ctx is always &g_lwip_netif.

|
static |
Timeout callback wired into lwip_port_attach().
Called by lwip_port_poll_timeouts() when the elapsed threshold is reached. Drives lwIP's internal timers (TCP retransmit, ARP aging, etc.).

|
static |
netif initialization callback called by netif_add().


|
static |
linkoutput callback: transmit a pbuf chain via lwip_port_tx().
Flattens the pbuf chain into a contiguous frame buffer before TX. Frames exceeding 1514 bytes (max Ethernet payload) are rejected with ERR_MEM to satisfy threat T-42-02-02 (oversized frame in linkoutput).


|
static |