RE: [PATCH bpf-next 4/4] samples/bpf: xdpsock: add time-out for cleaning Tx
From: Ong, Boon Leong <hidden>
Date: 2021-11-29 01:16:44
Also in:
bpf
On Wed, Nov 24, 2021 at 1:22 AM Ong Boon Leong [off-list ref] wrote:quoted
When user sets tx-pkt-count and in case where there are invalid Tx frame, the complete_tx_only_all() process polls indefinitely. So, this patch adds a time-out mechanism into the process so that the application can terminate automatically after it retries 3*polling interval duration. sock0@enp0s29f1:2 txonly xdp-drv pps pkts 1.00 rx 0 0 tx 136383 1000000 rx dropped 0 0 rx invalid 0 0 tx invalid 35 245 rx queue full 0 0 fill ring empty 0 1 tx ring empty 957 7011 sock0@enp0s29f1:2 txonly xdp-drv pps pkts 1.00 rx 0 0 tx 0 1000000 rx dropped 0 0 rx invalid 0 0 tx invalid 0 245 rx queue full 0 0 fill ring empty 0 1 tx ring empty 1 7012 sock0@enp0s29f1:2 txonly xdp-drv pps pkts 1.00 rx 0 0 tx 0 1000000 rx dropped 0 0 rx invalid 0 0 tx invalid 0 245 rx queue full 0 0 fill ring empty 0 1 tx ring empty 1 7013 sock0@enp0s29f1:2 txonly xdp-drv pps pkts 1.00 rx 0 0 tx 0 1000000 rx dropped 0 0 rx invalid 0 0 tx invalid 0 245 rx queue full 0 0 fill ring empty 0 1 tx ring empty 1 7014 sock0@enp0s29f1:2 txonly xdp-drv pps pkts 1.00 rx 0 0 tx 0 1000000 rx dropped 0 0 rx invalid 0 0 tx invalid 0 245 rx queue full 0 0 fill ring empty 0 1 tx ring empty 0 7014 sock0@enp0s29f1:2 txonly xdp-drv pps pkts 0.00 rx 0 0 tx 0 1000000 rx dropped 0 0 rx invalid 0 0 tx invalid 0 245 rx queue full 0 0 fill ring empty 0 1 tx ring empty 0 7014I am not following why we need examples above in the commit log.
I pasted the log to demonstrate the behavior of the time-out, that is aligned with the stats poller. Will remove in next rev.
quoted
Signed-off-by: Ong Boon Leong <redacted> --- samples/bpf/xdpsock_user.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)diff --git a/samples/bpf/xdpsock_user.c b/samples/bpf/xdpsock_user.c index 61d4063f11a..9c3311329ec 100644 --- a/samples/bpf/xdpsock_user.c +++ b/samples/bpf/xdpsock_user.c@@ -1410,6 +1410,7 @@ static inline int get_batch_size(int pkt_cnt) static void complete_tx_only_all(void) { + u32 retries = 3;Shall we make the retry value configurable? And maybe make it a timeout value in seconds?
OK, next rev will have seconds granularity. Ok, I can make it configurable.