I'm trying to generate delay in acknowledgement using eBPF kernel program for egress packet. I'm running the python+c program using bcc. i tried mdelay/msleep/udelay etc functions with delay.h library in c, it gives me LLVM error that "Program using external function which can't be resolved".
Then I tried implementing sleep functionality : Taking 3 variables: tprev (which get the current time at starting of prog) tnow(this gets current time as the loop starts and gets updates in each iteration with current time) timer: this is the duration for which we want program to be delayed. the while loop is: while((tnow - tprev) ≤ timer) but ebpf prog treat it as n infinite loop and gives error that infinite loop detected. Whereas it's not an infinite loop.
Is there a way to introduce delay in Ack or delay in general in eBPF program and How?