Fast UDP forwarding with SMP

For 64bit projects and applications
Post Reply
villemt
Posts: 52
Joined: Fri Jan 15, 2021 9:29 pm

Fast UDP forwarding with SMP

Post by villemt » Mon Jun 22, 2026 3:42 pm

Menuet
cpu0: os + network driver
cpu1: UDP packet forwarding application

Linux Mint

[attachment=0]udp3.jpg[/attachment]
Attachments
udp3.jpg
udp3.jpg (77.05 KiB) Viewed 5377 times

Pascal83
Posts: 1
Joined: Mon Jun 15, 2026 11:39 am

Re: Fast UDP forwarding with SMP

Post by Pascal83 » Sun Jun 28, 2026 11:58 am

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

villemt
Posts: 52
Joined: Fri Jan 15, 2021 9:29 pm

Re: Fast UDP forwarding with SMP

Post by villemt » Mon Jul 27, 2026 11:25 am

  
    ; 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

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest