Skip to content

Commit fe079e0

Browse files
committed
net/hinic: fix mutexes for multi-process
The hinic driver supports secondary processes. Mutexes in structures allocated in shared memory must be initialized with PTHREAD_PROCESS_SHARED. All callers of hinic_mutex_init() pass NULL as the attribute argument, so route it through the EAL helper and drop the unused parameter handling. Bugzilla ID: 662 Fixes: ae86576 ("net/hinic: replace spinlock with mutex") Cc: stable@dpdk.org Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>
1 parent 53153cb commit fe079e0

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

drivers/net/hinic/base/hinic_compat.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <rte_spinlock.h>
2020
#include <rte_cycles.h>
2121
#include <rte_log.h>
22+
#include <rte_thread.h>
2223

2324
typedef uint8_t u8;
2425
typedef int8_t s8;
@@ -198,9 +199,10 @@ static inline u16 ilog2(u32 n)
198199
}
199200

200201
static inline int hinic_mutex_init(pthread_mutex_t *pthreadmutex,
201-
const pthread_mutexattr_t *mattr)
202+
__rte_unused const pthread_mutexattr_t *mattr)
202203
{
203-
return pthread_mutex_init(pthreadmutex, mattr);
204+
rte_thread_mutex_init_shared(pthreadmutex);
205+
return 0;
204206
}
205207

206208
static inline int hinic_mutex_destroy(pthread_mutex_t *pthreadmutex)

0 commit comments

Comments
 (0)