How to improve performance of unicast to broadcast UDP packet transformation using eBPF/XDP

I received my Banana Pi BPi-R4 and tried running my XDP program and did not get the performance boost I was hoping for. I still had drops when connecting more than 1 receiver on the LAN ports. I found this post which showed a way to use nftables on netdev family: NFtables and QoS in 2021 - #484 by Lynx

I utilized it to forward unicast packets to broadcast. This is what I ended up with:

table netdev cake {
    chain catch {
        type filter hook ingress device br-wan priority -149; policy accept;
        ip daddr 192.168.1.40 udp dport 5555-5556 jump unicast-to-broadcast
    }

    chain unicast-to-broadcast {
        ether saddr set b2:9a:97:7c:ed:5b ether daddr set ff:ff:ff:ff:ff:ff ip daddr set 192.168.40.255 udp dport set 5555 fwd to br-lan
    }
}

This approach seems to work better with speeds upto 300mbps and 3 receivers. Maybe there is a way to utilize hw offloading to increase throughput even higher.

1 Like