From: Song Liu <song@kernel.org>
To: Ong Boon Leong <boon.leong.ong@intel.com>
Cc: bpf <bpf@vger.kernel.org>, Networking <netdev@vger.kernel.org>,
bjorn@kernel.org, Magnus Karlsson <magnus.karlsson@intel.com>,
Jonathan Lemon <jonathan.lemon@gmail.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Jesper Dangaard Brouer <hawk@kernel.org>,
John Fastabend <john.fastabend@gmail.com>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
Yonghong Song <yhs@fb.com>, KP Singh <kpsingh@kernel.org>
Subject: Re: [PATCH bpf-next 4/4] samples/bpf: xdpsock: add time-out for cleaning Tx
Date: Fri, 26 Nov 2021 22:45:51 -0800 [thread overview]
Message-ID: <CAPhsuW4AiqzH+vx3hOJb5taae0cN0NDKUUNsi5iybG+PF9xYgg@mail.gmail.com> (raw)
In-Reply-To: <20211124091821.3916046-5-boon.leong.ong@intel.com>
On Wed, Nov 24, 2021 at 1:22 AM Ong Boon Leong <boon.leong.ong@intel.com> wrote:
>
> 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 7014
I am not following why we need examples above in the commit log.
>
> Signed-off-by: Ong Boon Leong <boon.leong.ong@intel.com>
> ---
> 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?
> bool pending;
> int i;
>
> @@ -1421,7 +1422,8 @@ static void complete_tx_only_all(void)
> pending = !!xsks[i]->outstanding_tx;
> }
> }
> - } while (pending);
> + sleep(opt_interval);
> + } while (pending && retries-- > 0);
> }
>
> static void tx_only_all(void)
> --
> 2.25.1
>
next prev parent reply other threads:[~2021-11-27 6:48 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-24 9:18 [PATCH bpf-next 0/4] samples/bpf: xdpsock app enhancements Ong Boon Leong
2021-11-24 9:18 ` [PATCH bpf-next 1/4] samples/bpf: xdpsock: add VLAN support for Tx-only operation Ong Boon Leong
2021-11-27 6:48 ` Song Liu
2021-11-24 9:18 ` [PATCH bpf-next 2/4] samples/bpf: xdpsock: add Dest and Src MAC setting " Ong Boon Leong
2021-11-27 6:40 ` Song Liu
2021-11-27 9:51 ` Jesper Dangaard Brouer
2021-11-24 9:18 ` [PATCH bpf-next 3/4] samples/bpf: xdpsock: add period cycle time to Tx operation Ong Boon Leong
2021-11-27 6:52 ` Song Liu
2021-11-27 10:41 ` Jesper Dangaard Brouer
2021-11-24 9:18 ` [PATCH bpf-next 4/4] samples/bpf: xdpsock: add time-out for cleaning Tx Ong Boon Leong
2021-11-27 6:45 ` Song Liu [this message]
2021-11-29 1:14 ` Ong, Boon Leong
2021-11-27 9:48 ` Jesper Dangaard Brouer
2021-11-29 1:17 ` Ong, Boon Leong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAPhsuW4AiqzH+vx3hOJb5taae0cN0NDKUUNsi5iybG+PF9xYgg@mail.gmail.com \
--to=song@kernel.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bjorn@kernel.org \
--cc=boon.leong.ong@intel.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=hawk@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=jonathan.lemon@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@kernel.org \
--cc=kuba@kernel.org \
--cc=magnus.karlsson@intel.com \
--cc=netdev@vger.kernel.org \
--cc=songliubraving@fb.com \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).