Page 1 of 1

Fast UDP forwarding with SMP

Posted: Mon Jun 22, 2026 3:42 pm
by villemt
Menuet
cpu0: os + network driver
cpu1: UDP packet forwarding application

Linux Mint

[attachment=0]udp3.jpg[/attachment]

Re: Fast UDP forwarding with SMP

Posted: Sun Jun 28, 2026 11:58 am
by Pascal83
Really nice results — the latency advantage holds across every configuration. Great to see what a lean assembly OS can still do in the network path. Thanks for sharing the numbers

Re: Fast UDP forwarding with SMP

Posted: Mon Jul 27, 2026 11:25 am
by villemt
  
    ; Start thread in CPU1

    mov    rax , 140
    mov    rbx , 3
    mov    rcx , threadentry
    mov    rdx , threadstack
    mov    r8  , 1 ; CPU1
    int    0x60

    ; ..

threadentry:

    ; Open UDP socket - source

    mov   rax , 53               
    mov   rbx , 0
    mov   rcx , 10000
    mov   rdx , 11000
    mov   rsi , [source_ip]
    int   0x60
    mov   [socket1],rax

    ; Open UDP socket - destination

    mov   rax , 53               
    mov   rbx , 0
    mov   rcx , 20000
    mov   rdx , 21000
    mov   rsi , [destination_ip]
    int   0x60
    mov   [socket2],rax

    ; Enable events: Win, Kbd, Buttons, Network

    mov   rax , 40                
    mov   rbx , 111b + 1 shl 7
    int   0x60

still:

    ; Wait for event

    mov   rax , 10 
    int   0x60

    ; Read data

    mov   rax , 53
    mov   rbx , 13
    mov   rcx , [socket1] ; Source
    mov   rdx , buffer
    int   0x60
    mov   [length],rax

    ; Send data

    mov   rax , 53
    mov   rbx , 4
    mov   rcx , [socket2] ; Destination
    mov   rdx , [length]
    mov   rsi , buffer
    int   0x60

    jmp   still