[PATCH 1/3] net/hns3: fix simple Tx path incorrect free the mbuf
huangdengdui
huangdengdui at huawei.com
Thu Jan 9 08:43:12 CET 2025
On 2025/1/9 0:57, Stephen Hemminger wrote:
> On Wed, 8 Jan 2025 10:40:43 +0800
> Jie Hai <haijie1 at huawei.com> wrote:
>
>> On 2024/12/31 1:55, Stephen Hemminger wrote:
>>> On Mon, 30 Dec 2024 14:54:03 +0800
>>> Jie Hai <haijie1 at huawei.com> wrote:
>>>
>>>> From: Jie Hai <haijie1 at huawei.com>
>>>> To: <dev at dpdk.org>, <thomas at monjalon.net>, <ferruh.yigit at amd.com>, <david.marchand at redhat.com>, <andrew.rybchenko at oktetlabs.ru>, Chengwen Feng <fengchengwen at huawei.com>, "Wei Hu (Xavier)" <xavier.huwei at huawei.com>, Huisong Li <lihuisong at huawei.com>
>>>> CC: <haijie1 at huawei.com>, <huangdengdui at huawei.com>
>>>> Subject: [PATCH 1/3] net/hns3: fix simple Tx path incorrect free the mbuf
>>>> Date: Mon, 30 Dec 2024 14:54:03 +0800
>>>> X-Mailer: git-send-email 2.22.0
>>>>
>>>> From: Dengdui Huang <huangdengdui at huawei.com>
>>>>
>>>> When RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE offload is not set,
>>>> use rte_pktmbuf_free_seg() to free the mbuf.
>>>>
>>>> Fixes: 7ef933908f04 ("net/hns3: add simple Tx path")
>>>> Cc: stable at dpdk.org
>>>>
>>>> Signed-off-by: Dengdui Huang <huangdengdui at huawei.com>
>>>> Signed-off-by: Jie Hai <haijie1 at huawei.com>
>>>
>>> What about the fast free case which is using rte_mempool_put_bulk when
>>> it should use rte_pktmbuf_free_bulk instead?
>>>
>>>
>> Hi, Stephen Hemminger,
>>
>> During the fast free case, the performance of using
>> rte_mempool_put_bulk is higher than that of using
>> rte_pktmbuf_free_bulk because other references
>> to mbuf do not need to be considered. So it's better
>> to not change.
>>
>> Thanks,
>> Jie Hai
>
> The problem is that having an open coded version of this buried in
> one driver is a long term potential proble>
> If you really think that optimizing free like this is noticeable, then
> why not make a new function "rte_pktmuf_fast_free_bulk" and put it in the
> regular mbuf library.
>
Do you mean to add the following functions to the library?
void rte_pktmbuf_fast_free_bulk(struct rte_mbuf **mbufs, unsigned int count)
{
rte_mempool_put_bulk(mbufs[0]->pool, (void **)mbufs, count);
}
The driver uses rte_mempool_put_bulk only when the following conditions are met:
1. All mbufs comes from the same mempool
2. All mbufs have only one reference.
3. All mbufs have only one segment.
So the rte_pktmbuf_fast_free_bulk function is just a wrapper around the rte_mempool_put_bulk function.
More information about the dev
mailing list