| 123456789101112131415161718192021222324252627282930313233343536 |
- /* Shared kernel receive pump for the network stack.
- *
- * Packet-level commands still take an exclusive raw lease through
- * netdev_acquire(). TCP clients no longer take that lease: every socket
- * syscall drains the active NIC through net_pump(), which dispatches each
- * frame to the TCP client table, the TCP listener, a pending DNS query, the
- * ARP cache and the netkexec watcher, and answers ARP/ICMP.
- *
- * net_pump() may only be called with the BKL held: it serializes every stack
- * user against the same NIC rings, the shared receive scratch and the
- * protocol state. It temporarily enables interrupts (the driver TX timeout
- * paths spin on get_ticks_ms()) and restores the caller's IF at the end.
- */
- #ifndef NETCORE_H
- #define NETCORE_H
- /* Drain at most `budget` frames and dispatch them. Returns the number of
- * frames consumed. No-op while a packet-level command owns the NIC. */
- int net_pump(unsigned int budget);
- /* Save/disable interrupts, then enable them. Paired with net_irq_exit().
- * Used around driver calls in the cooperative stack paths so a stuck TX
- * descriptor can still time out on the PIT. */
- unsigned int net_irq_enter(void);
- void net_irq_exit(unsigned int flags);
- /* Long-running stack operations (DNS/ARP waits, TCP connects) keep the
- * background netkexec watcher from polling the active NIC and stealing their
- * frames. The counter is protected by the BKL. */
- void net_stack_enter(void);
- void net_stack_leave(void);
- int net_stack_busy(void);
- /* Reaper: forget a dead process's stack-operation counts. */
- void net_stack_reap(unsigned int pid);
- #endif
|