From: Ferruh Yigit <ferruh.yigit@intel.com>
To: wangyunjian <wangyunjian@huawei.com>, dev@dpdk.org
Cc: liucheng11@huawei.com, dingxiaoxiong@huawei.com
Subject: Re: [dpdk-dev] [PATCH] kni: fix wrong mbuf alloc count in kni_allocate_mbufs
Date: Fri, 18 Jun 2021 14:37:10 +0100 [thread overview]
Message-ID: <0d996824-6015-18d6-c730-1821a34aae0c@intel.com> (raw)
In-Reply-To: <4ebfe0d38b335a437edc9c58368153d005f562ce.1622460655.git.wangyunjian@huawei.com>
On 5/31/2021 1:09 PM, wangyunjian wrote:
> From: Yunjian Wang <wangyunjian@huawei.com>
>
> In kni_allocate_mbufs(), we alloc mbuf for alloc_q as this code.
> allocq_free = (kni->alloc_q->read - kni->alloc_q->write - 1) \
> & (MAX_MBUF_BURST_NUM - 1);
> The value of allocq_free maybe zero (e.g 32 & (32 - 1) = 0), and
> it will not fill the alloc_q. When the alloc_q's free count is
> zero, it will drop the packet in kernel kni.
>
nack
Both 'read' & 'write' pointers can be max 'len-1',
so 'read - write - 1' can't be 'len'.
For above example first part can't be '32'.
But if you are observing a problem, can you please describe it a little more, it
may be because of something else.
> In this patch, we set the allocq_free as the min between
> MAX_MBUF_BURST_NUM and the free count of the alloc_q.
>
> Signed-off-by: Cheng Liu <liucheng11@huawei.com>
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> ---
> lib/kni/rte_kni.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/lib/kni/rte_kni.c b/lib/kni/rte_kni.c
> index 9dae6a8d7c..20d8f20cef 100644
> --- a/lib/kni/rte_kni.c
> +++ b/lib/kni/rte_kni.c
> @@ -677,8 +677,9 @@ kni_allocate_mbufs(struct rte_kni *kni)
> return;
> }
>
> - allocq_free = (kni->alloc_q->read - kni->alloc_q->write - 1)
> - & (MAX_MBUF_BURST_NUM - 1);
> + allocq_free = kni_fifo_free_count(kni->alloc_q);
> + allocq_free = (allocq_free > MAX_MBUF_BURST_NUM) ?
> + MAX_MBUF_BURST_NUM : allocq_free;
> for (i = 0; i < allocq_free; i++) {
> pkts[i] = rte_pktmbuf_alloc(kni->pktmbuf_pool);
> if (unlikely(pkts[i] == NULL)) {
>
next prev parent reply other threads:[~2021-06-18 13:37 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-31 12:09 wangyunjian
2021-06-18 13:37 ` Ferruh Yigit [this message]
2021-06-21 3:27 ` wangyunjian
2021-06-21 11:26 ` Ferruh Yigit
2021-06-22 7:32 ` wangyunjian
2021-06-22 7:43 ` Ferruh Yigit
2021-06-22 10:57 ` [dpdk-dev] [PATCH v2] " wangyunjian
2021-06-22 12:27 ` Ferruh Yigit
2021-06-22 12:32 ` wangyunjian
2021-06-22 12:44 ` [dpdk-dev] [PATCH v3] kni: fix mbuf allocation for alloc FIFO wangyunjian
2021-06-22 20:46 ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2021-06-23 12:16 ` wangyunjian
2021-06-23 14:11 ` Ferruh Yigit
2021-06-23 14:41 ` Thomas Monjalon
2021-06-24 1:55 ` Ajit Khaparde
2021-06-24 7:43 ` Thomas Monjalon
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=0d996824-6015-18d6-c730-1821a34aae0c@intel.com \
--to=ferruh.yigit@intel.com \
--cc=dev@dpdk.org \
--cc=dingxiaoxiong@huawei.com \
--cc=liucheng11@huawei.com \
--cc=wangyunjian@huawei.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).