[v1,38/72] net/mlx5/windows: add pthread initializer definition

Message ID 20201027232335.31427-39-ophirmu@nvidia.com (mailing list archive)
State Superseded, archived
Delegated to: Raslan Darawsheh
Headers
Series mlx5 Windows support - part #5 |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Ophir Munk Oct. 27, 2020, 11:23 p.m. UTC
  PTHREAD_MUTEX_INITIALIZER is a Linux macro defined in
/usr/include/pthread.h. It is used by mlx5 PMD but it is not included
in DPDK Windows pthread implementation. Therefore define it privately
in windows/mlx5_os.h file.

Signed-off-by: Ophir Munk <ophirmu@nvidia.com>
---
 drivers/net/mlx5/windows/mlx5_os.h | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Thomas Monjalon Oct. 28, 2020, 7:21 a.m. UTC | #1
28/10/2020 00:23, Ophir Munk:
> PTHREAD_MUTEX_INITIALIZER is a Linux macro defined in
> /usr/include/pthread.h. It is used by mlx5 PMD but it is not included
> in DPDK Windows pthread implementation. Therefore define it privately
> in windows/mlx5_os.h file.

You should not define EAL stuff privately in the PMD.
I remember Microsoft discouraged the definition of mutex initializer.
Instead we have pthread_mutex_init().
  

Patch

diff --git a/drivers/net/mlx5/windows/mlx5_os.h b/drivers/net/mlx5/windows/mlx5_os.h
index bb1aa27..5f4abc3 100644
--- a/drivers/net/mlx5/windows/mlx5_os.h
+++ b/drivers/net/mlx5/windows/mlx5_os.h
@@ -16,4 +16,5 @@  enum {
 
 #define PCI_DRV_FLAGS 0
 
+#define PTHREAD_MUTEX_INITIALIZER {(void *)-1, -1, 0, 0, 0, 0}
 #endif /* RTE_PMD_MLX5_OS_H_ */