[PATCH 1/3] net/hns3: fix inconsistent lock
huangdengdui
huangdengdui at huawei.com
Thu Aug 21 14:20:36 CEST 2025
On 2025/8/14 5:06, Stephen Hemminger wrote:
> On Wed, 13 Aug 2025 15:33:15 +0800
> Dengdui Huang <huangdengdui at huawei.com> wrote:
>
>> The hns3 driver supports configuring RSS through both ops API and
>> rte_flow API. The ops API uses spink lock, while the rte_flow API uses
>> pthread mutex lock. When concurrent calls occur, issues may arise.
>> This patch replaces the lock in the flow API with spink lock.
>>
>> Fixes: 1bdcca8006e4 ("net/hns3: fix flow director lock")
>> Cc: stable at dpdk.org
>>
>> Signed-off-by: Dengdui Huang <huangdengdui at huawei.com>
>> ---
>
> With that mutex removed, you can also go farther and remove all references to pthread.
I made a mistake, and I will remove these references in the next version.
>
> $ git diff
> diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
> index a63ab99edc..f6bb1b5d43 100644
> --- a/drivers/net/hns3/hns3_ethdev.h
> +++ b/drivers/net/hns3/hns3_ethdev.h
> @@ -5,7 +5,6 @@
> #ifndef HNS3_ETHDEV_H
> #define HNS3_ETHDEV_H
>
> -#include <pthread.h>
> #include <ethdev_driver.h>
> #include <rte_byteorder.h>
> #include <rte_io.h>
> diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c
> index 458d4ffbf1..f2d1e4ec3a 100644
> --- a/drivers/net/hns3/hns3_flow.c
> +++ b/drivers/net/hns3/hns3_flow.c
> @@ -2853,13 +2853,10 @@ void
> hns3_flow_init(struct rte_eth_dev *dev)
> {
> struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> - pthread_mutexattr_t attr;
>
> if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> return;
>
> - pthread_mutexattr_init(&attr);
> - pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED);
> dev->data->dev_flags |= RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE;
>
> TAILQ_INIT(&hw->flow_fdir_list);
More information about the dev
mailing list