回复:[PATCH v5 04/17] net/nbl: add Channel layer definitions and implementation
Dimon
dimon.zhao at nebula-matrix.com
Thu Aug 21 05:19:18 CEST 2025
Hi Stephen,
> + while (true) {
> + if (rte_bitmap_get(chan_info->mailbox.state_bmp, NBL_CHAN_INTERRUPT_READY)) {
> + nr = read(chan_info->mailbox.fd[0], &unused, sizeof(unused));
> + if (nr < 0)
> + break;
> + }
> + nbl_chan_clean_queue(chan_mgt);
> + nanosleep(&time, 0);
> + }
The chan_info->mailbox.fd[0] is the read fd of eventfd. We are using the eventfd block waiting to read mailbox message.
Thank you.
------------------------------------------------------------------
发件人:Stephen Hemminger <stephen at networkplumber.org>
发送时间:2025年8月21日(周四) 00:16
收件人:Dimon<dimon.zhao at nebula-matrix.com>
抄 送:dev<dev at dpdk.org>; Kyo Liu<kyo.liu at nebula-matrix.com>; Leon<leon.yu at nebula-matrix.com>; Sam<sam.chen at nebula-matrix.com>
主 题:Re: [PATCH v5 04/17] net/nbl: add Channel layer definitions and implementation
On Tue, 19 Aug 2025 03:22:24 -0700
Dimon Zhao <dimon.zhao at nebula-matrix.com> wrote:
> +
> +static uint32_t nbl_chan_thread_polling_task(void *param)
> +{
> + struct nbl_channel_mgt *chan_mgt = (struct nbl_channel_mgt *)param;
> + union nbl_chan_info *chan_info = NBL_CHAN_MGT_TO_CHAN_INFO(chan_mgt);
> + struct timespec time;
> + char unused[16];
> + ssize_t nr = 0;
> +
> + time.tv_sec = 0;
> + time.tv_nsec = 100000;
> +
> + while (true) {
> + if (rte_bitmap_get(chan_info->mailbox.state_bmp, NBL_CHAN_INTERRUPT_READY)) {
> + nr = read(chan_info->mailbox.fd[0], &unused, sizeof(unused));
> + if (nr < 0)
> + break;
> + }
> + nbl_chan_clean_queue(chan_mgt);
> + nanosleep(&time, 0);
> + }
> +
> + return 0;
> +}
This is going to make embedded application developers upset because it uses
a significant part of a CPU polling.
Since you are reading from mailbox, why not implement select/poll/epoll and
have the thread block waiting to read mailbox instead.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mails.dpdk.org/archives/dev/attachments/20250821/802caa42/attachment-0001.htm>
More information about the dev
mailing list