Skip to contentSkip to conversation

common/mlx5: fix possible building error

PATCH In review [email protected] 3 participants 10 messages Mar 2, 2020 – Mar 9, 2020 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 common/mlx5: fix possible building error

From: Tonghao Zhang <[email protected]>

When setting the CONFIG_RTE_BUILD_SHARED_LIB to y, and build the mlx5 pmd, there is a building error. To fix it, add RTE_IBVERBS_LINK_DLOPEN to include relative codes.

Quoted 2 lines

mlx5_common.o: In function `mlx5_glue_init':
drivers/common/mlx5/mlx5_common.c:324: undefined reference to `dlclose'

Fixes 7b4f1e6bd367 ("common/mlx5: introduce common library")
---
 drivers/common/mlx5/mlx5_common.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/common/mlx5/mlx5_common.c +3 -2
index 610fb48..570a3f4 100644
@@ -209,8 +209,6 @@ enum mlx5_class
  */
 RTE_INIT_PRIO(mlx5_glue_init, CLASS)
 {
-	void *handle = NULL;
-
 	/* Initialize common log type. */
 	mlx5_common_logtype = rte_log_register("pmd.common.mlx5");
 	if (mlx5_common_logtype >= 0)
@@ -249,6 +247,7 @@ enum mlx5_class
 		 mlx5_glue_path(glue_path, sizeof(glue_path)) : ""),
 	};
 	unsigned int i = 0;
+	void *handle = NULL;
 	void **sym;
 	const char *dlmsg;
 
@@ -320,8 +319,10 @@ enum mlx5_class
 	mlx5_glue->fork_init();
 	return;
 glue_error:
+#ifdef RTE_IBVERBS_LINK_DLOPEN
 	if (handle)
 		dlclose(handle);
+#endif
 	DRV_LOG(WARNING, "Cannot initialize MLX5 common due to missing"
 		" run-time dependency on rdma-core libraries (libibverbs,"
 		" libmlx5)");
Signature · 1 line
1.8.3.1
#1 lore raw

Hi

From: [email protected]

Quoted 8 lines

From: Tonghao Zhang <[email protected]>

When setting the CONFIG_RTE_BUILD_SHARED_LIB to y, and build the mlx5 pmd, there is a building error.
To fix it, add RTE_IBVERBS_LINK_DLOPEN to include relative codes.

Quoted 2 lines

mlx5_common.o: In function `mlx5_glue_init':
drivers/common/mlx5/mlx5_common.c:324: undefined reference to

Quoted 7 lines

`dlclose'

Fixes 7b4f1e6bd367 ("common/mlx5: introduce common library")

The title should point to the root cause - not to the results.

Something like:

common/mlx5: fix dynamic loading reference

Quoted 26 lines
 drivers/common/mlx5/mlx5_common.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/common/mlx5/mlx5_common.c +1 -2
index 610fb48..570a3f4 100644
@@ -209,8 +209,6 @@ enum mlx5_class
  */
 RTE_INIT_PRIO(mlx5_glue_init, CLASS)
 {
-	void *handle = NULL;
-
 	/* Initialize common log type. */
 	mlx5_common_logtype = rte_log_register("pmd.common.mlx5");
 	if (mlx5_common_logtype >= 0)
@@ -249,6 +247,7 @@ enum mlx5_class
 		 mlx5_glue_path(glue_path, sizeof(glue_path)) : ""),
 	};
 	unsigned int i = 0;
+	void *handle = NULL;
 	void **sym;
 	const char *dlmsg;
 

drivers/common/mlx5/mlx5_common.c enum mlx5_class · line 325

Quoted 7 lines
drivers/common/mlx5/mlx5_common.c +2 -0
@@ -320,8 +319,10 @@ enum mlx5_class
 	mlx5_glue->fork_init();
 	return;
 glue_error:
+#ifdef RTE_IBVERBS_LINK_DLOPEN
 	if (handle)
 		dlclose(handle);
+#endif

What's about " #include <dlfcn.h> " Is it compiled for you? If so, why dlclose is not known on your setup?

Quoted 6 lines
drivers/common/mlx5/mlx5_common.c +0 -0
 	DRV_LOG(WARNING, "Cannot initialize MLX5 common due to

missing"

drivers/common/mlx5/mlx5_common.c +0 -1
 		" run-time dependency on rdma-core libraries (libibverbs,"
 		" libmlx5)");
--

1.8.3.1

#2 lore raw
Quoted 52 lines · Matan Azrad

Hi

From: [email protected]

Quoted 8 lines

From: Tonghao Zhang <[email protected]>

When setting the CONFIG_RTE_BUILD_SHARED_LIB to y, and build the mlx5 pmd, there is a building error.
To fix it, add RTE_IBVERBS_LINK_DLOPEN to include relative codes.

Quoted 2 lines

mlx5_common.o: In function `mlx5_glue_init':
drivers/common/mlx5/mlx5_common.c:324: undefined reference to

Quoted 7 lines

`dlclose'

Fixes 7b4f1e6bd367 ("common/mlx5: introduce common library")

The title should point to the root cause - not to the results.

Something like:

common/mlx5: fix dynamic loading reference

Quoted 25 lines
 drivers/common/mlx5/mlx5_common.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/common/mlx5/mlx5_common.c +1 -2
index 610fb48..570a3f4 100644
@@ -209,8 +209,6 @@ enum mlx5_class
  */
 RTE_INIT_PRIO(mlx5_glue_init, CLASS)
 {
-     void *handle = NULL;
-
      /* Initialize common log type. */
      mlx5_common_logtype = rte_log_register("pmd.common.mlx5");
      if (mlx5_common_logtype >= 0)
@@ -249,6 +247,7 @@ enum mlx5_class
               mlx5_glue_path(glue_path, sizeof(glue_path)) : ""),
      };
      unsigned int i = 0;
+     void *handle = NULL;
      void **sym;
      const char *dlmsg;
 
Quoted 11 lines

drivers/common/mlx5/mlx5_common.c enum mlx5_class · line 325

Quoted 8 lines
drivers/common/mlx5/mlx5_common.c +2 -0
@@ -320,8 +319,10 @@ enum mlx5_class
      mlx5_glue->fork_init();
      return;
 glue_error:
+#ifdef RTE_IBVERBS_LINK_DLOPEN
      if (handle)
              dlclose(handle);
+#endif

What's about " #include <dlfcn.h> " Is it compiled for you?

Yes, still building fail.

Quoted 1 line

If so, why dlclose is not known on your setup?

When I fixed it, I found the codes in mlx5_glue_init, use the RTE_IBVERBS_LINK_DLOPEN.
but dlclose is not included in it. I think we should add RTE_IBVERBS_LINK_DLOPEN to fix the building fail.

Quoted 9 lines
Quoted 8 lines
drivers/common/mlx5/mlx5_common.c +0 -0
      DRV_LOG(WARNING, "Cannot initialize MLX5 common due to

missing"
" run-time dependency on rdma-core libraries (libibverbs," " libmlx5)");
--
1.8.3.1

Signature · 2 lines
Thanks,
Tonghao
#3 lore raw

From: Tonghao Zhang

Quoted 63 lines · Matan Azrad
Quoted 51 lines

Hi

From: [email protected]

Quoted 8 lines

From: Tonghao Zhang <[email protected]>

When setting the CONFIG_RTE_BUILD_SHARED_LIB to y, and build the mlx5 pmd, there is a building error.
To fix it, add RTE_IBVERBS_LINK_DLOPEN to include relative codes.

Quoted 2 lines

mlx5_common.o: In function `mlx5_glue_init':
drivers/common/mlx5/mlx5_common.c:324: undefined reference to

Quoted 7 lines

`dlclose'

Fixes 7b4f1e6bd367 ("common/mlx5: introduce common library")

The title should point to the root cause - not to the results.

Something like:

common/mlx5: fix dynamic loading reference

Quoted 24 lines
 drivers/common/mlx5/mlx5_common.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/common/mlx5/mlx5_common.c +1 -2
index 610fb48..570a3f4 100644
@@ -209,8 +209,6 @@ enum mlx5_class
  */
 RTE_INIT_PRIO(mlx5_glue_init, CLASS)  {
-     void *handle = NULL;
-
      /* Initialize common log type. */
      mlx5_common_logtype = rte_log_register("pmd.common.mlx5");
      if (mlx5_common_logtype >= 0)
@@ -249,6 +247,7 @@ enum mlx5_class
               mlx5_glue_path(glue_path, sizeof(glue_path)) : ""),
      };
      unsigned int i = 0;
+     void *handle = NULL;
      void **sym;
      const char *dlmsg;
 
Quoted 11 lines

drivers/common/mlx5/mlx5_common.c enum mlx5_class · line 325

Quoted 8 lines
drivers/common/mlx5/mlx5_common.c +2 -0
@@ -320,8 +319,10 @@ enum mlx5_class
      mlx5_glue->fork_init();
      return;
 glue_error:
+#ifdef RTE_IBVERBS_LINK_DLOPEN
      if (handle)
              dlclose(handle);
+#endif

What's about " #include <dlfcn.h> " Is it compiled for you?

Quoted 6 lines

Yes, still building fail.

Quoted 1 line

If so, why dlclose is not known on your setup?

When I fixed it, I found the codes in mlx5_glue_init, use the RTE_IBVERBS_LINK_DLOPEN.
but dlclose is not included in it. I think we should add RTE_IBVERBS_LINK_DLOPEN to fix the building fail.

I agree, but looks like the include should be in the define area too. No?

Quoted 14 lines
Quoted 9 lines
Quoted 8 lines
drivers/common/mlx5/mlx5_common.c +0 -0
      DRV_LOG(WARNING, "Cannot initialize MLX5 common due to

missing"
" run-time dependency on rdma-core libraries (libibverbs," " libmlx5)");
--
1.8.3.1

--
Thanks,
Tonghao

#4 lore raw
Quoted 67 lines · Matan Azrad

From: Tonghao Zhang

Quoted 63 lines · Matan Azrad
Quoted 62 lines

Hi

From: [email protected]

Quoted 8 lines

From: Tonghao Zhang <[email protected]>

When setting the CONFIG_RTE_BUILD_SHARED_LIB to y, and build the mlx5 pmd, there is a building error.
To fix it, add RTE_IBVERBS_LINK_DLOPEN to include relative codes.

Quoted 2 lines

mlx5_common.o: In function `mlx5_glue_init':
drivers/common/mlx5/mlx5_common.c:324: undefined reference to

Quoted 7 lines

`dlclose'

Fixes 7b4f1e6bd367 ("common/mlx5: introduce common library")

The title should point to the root cause - not to the results.

Something like:

common/mlx5: fix dynamic loading reference

Quoted 25 lines
 drivers/common/mlx5/mlx5_common.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/common/mlx5/mlx5_common.c +1 -2
index 610fb48..570a3f4 100644
@@ -209,8 +209,6 @@ enum mlx5_class
  */
 RTE_INIT_PRIO(mlx5_glue_init, CLASS)  {
-     void *handle = NULL;
-
      /* Initialize common log type. */
      mlx5_common_logtype = rte_log_register("pmd.common.mlx5");
      if (mlx5_common_logtype >= 0)
@@ -249,6 +247,7 @@ enum mlx5_class
               mlx5_glue_path(glue_path, sizeof(glue_path)) : ""),
      };
      unsigned int i = 0;
+     void *handle = NULL;
      void **sym;
      const char *dlmsg;
 

drivers/common/mlx5/mlx5_common.c enum mlx5_class · line 325

Quoted 7 lines
drivers/common/mlx5/mlx5_common.c +2 -0
@@ -320,8 +319,10 @@ enum mlx5_class
      mlx5_glue->fork_init();
      return;
 glue_error:
+#ifdef RTE_IBVERBS_LINK_DLOPEN
      if (handle)
              dlclose(handle);
+#endif

What's about " #include <dlfcn.h> " Is it compiled for you?

Quoted 8 lines
Quoted 6 lines

Yes, still building fail.

Quoted 1 line

If so, why dlclose is not known on your setup?

When I fixed it, I found the codes in mlx5_glue_init, use the RTE_IBVERBS_LINK_DLOPEN.
but dlclose is not included in it. I think we should add RTE_IBVERBS_LINK_DLOPEN to fix the building fail.

I agree, but looks like the include should be in the define area too. No?

No, the "dlfcn.h" in dpdk is not included in define area at all.

[root@localhost dpdk-next-net]# grep -rwin "dlfcn.h" lib/librte_eal/common/eal_common_options.c:17:#include <dlfcn.h> drivers/net/ark/ark_ethdev.c:7:#include <dlfcn.h> drivers/net/mlx4/mlx4.c:11:#include <dlfcn.h> drivers/common/mlx5/mlx5_common.c:5:#include <dlfcn.h> examples/performance-thread/pthread_shim/pthread_shim.c:10:#include <dlfcn.h>

and other codes should be in define area, but not:
drivers/net/ark/ark_ethdev.c:177 lib/librte_eal/common/eal_common_options.c:306 drivers/common/mlx5/mlx5_common.c:325(this patch fix)

Quoted 14 lines
Quoted 14 lines
Quoted 9 lines
Quoted 8 lines
drivers/common/mlx5/mlx5_common.c +0 -0
      DRV_LOG(WARNING, "Cannot initialize MLX5 common due to

missing"
" run-time dependency on rdma-core libraries (libibverbs," " libmlx5)");
--
1.8.3.1

--
Thanks,
Tonghao

Signature · 2 lines
Thanks,
Tonghao
#5 lore raw

From: Tonghao Zhang

Quoted 90 lines
Quoted 5 lines · Matan Azrad

From: Tonghao Zhang

Quoted 1 line

On Tue, Mar 3, 2020 at 3:15 PM Matan Azrad <[email protected]>

Quoted 8 lines · wrote:
Quoted 8 lines
Quoted 8 lines

Hi

From: [email protected]

Quoted 3 lines

From: Tonghao Zhang <[email protected]>

When setting the CONFIG_RTE_BUILD_SHARED_LIB to y, and build

the

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

mlx5 pmd, there is a building error.
To fix it, add RTE_IBVERBS_LINK_DLOPEN to include relative codes.

Quoted 2 lines

mlx5_common.o: In function `mlx5_glue_init':
drivers/common/mlx5/mlx5_common.c:324: undefined reference

to

Quoted 49 lines
Quoted 49 lines
Quoted 49 lines
Quoted 7 lines

`dlclose'

Fixes 7b4f1e6bd367 ("common/mlx5: introduce common library")

The title should point to the root cause - not to the results.

Something like:

common/mlx5: fix dynamic loading reference

Quoted 25 lines
 drivers/common/mlx5/mlx5_common.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/common/mlx5/mlx5_common.c +0 -2
index 610fb48..570a3f4 100644
@@ -209,8 +209,6 @@ enum mlx5_class
  */
 RTE_INIT_PRIO(mlx5_glue_init, CLASS)  {
-     void *handle = NULL;
-
      /* Initialize common log type. */
      mlx5_common_logtype = rte_log_register("pmd.common.mlx5");
      if (mlx5_common_logtype >= 0) @@ -249,6 +247,7 @@ enum

mlx5_class

               mlx5_glue_path(glue_path, sizeof(glue_path)) : ""),
      };
      unsigned int i = 0;
drivers/common/mlx5/mlx5_common.c +1 -0
+     void *handle = NULL;
      void **sym;
      const char *dlmsg;

drivers/common/mlx5/mlx5_common.c enum mlx5_class · line 325

Quoted 7 lines
drivers/common/mlx5/mlx5_common.c +2 -0
@@ -320,8 +319,10 @@ enum mlx5_class
      mlx5_glue->fork_init();
      return;
 glue_error:
+#ifdef RTE_IBVERBS_LINK_DLOPEN
      if (handle)
              dlclose(handle);
+#endif

What's about " #include <dlfcn.h> " Is it compiled for you?

Quoted 8 lines
Quoted 6 lines

Yes, still building fail.

Quoted 1 line

If so, why dlclose is not known on your setup?

When I fixed it, I found the codes in mlx5_glue_init, use the RTE_IBVERBS_LINK_DLOPEN.
but dlclose is not included in it. I think we should add RTE_IBVERBS_LINK_DLOPEN to fix the building fail.

I agree, but looks like the include should be in the define area too. No?

No, the "dlfcn.h" in dpdk is not included in define area at all.

[root@localhost dpdk-next-net]# grep -rwin "dlfcn.h" lib/librte_eal/common/eal_common_options.c:17:#include <dlfcn.h> drivers/net/ark/ark_ethdev.c:7:#include <dlfcn.h> drivers/net/mlx4/mlx4.c:11:#include <dlfcn.h> drivers/common/mlx5/mlx5_common.c:5:#include <dlfcn.h> examples/performance-thread/pthread_shim/pthread_shim.c:10:#include <dlfcn.h>

Quoted 5 lines

and other codes should be in define area, but not:
drivers/net/ark/ark_ethdev.c:177 lib/librte_eal/common/eal_common_options.c:306 drivers/common/mlx5/mlx5_common.c:325(this patch fix)

So, Is it compiled well to include it while its lib is not loaded?

Quoted 20 lines
Quoted 11 lines
Quoted 11 lines
Quoted 9 lines
Quoted 8 lines
drivers/common/mlx5/mlx5_common.c +0 -0
      DRV_LOG(WARNING, "Cannot initialize MLX5 common due to

missing"
" run-time dependency on rdma-core libraries (libibverbs," " libmlx5)");
--
1.8.3.1

Quoted 3 lines
Quoted 3 lines

--
Thanks,
Tonghao

--
Thanks,
Tonghao

#6 lore raw
Quoted 94 lines · Matan Azrad

From: Tonghao Zhang

Quoted 90 lines
Quoted 5 lines · Matan Azrad

From: Tonghao Zhang

Quoted 1 line

On Tue, Mar 3, 2020 at 3:15 PM Matan Azrad <[email protected]>

Quoted 8 lines · wrote:
Quoted 8 lines
Quoted 8 lines

Hi

From: [email protected]

Quoted 3 lines

From: Tonghao Zhang <[email protected]>

When setting the CONFIG_RTE_BUILD_SHARED_LIB to y, and build

the

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

mlx5 pmd, there is a building error.
To fix it, add RTE_IBVERBS_LINK_DLOPEN to include relative codes.

Quoted 2 lines

mlx5_common.o: In function `mlx5_glue_init':
drivers/common/mlx5/mlx5_common.c:324: undefined reference

to

Quoted 49 lines
Quoted 49 lines
Quoted 49 lines
Quoted 7 lines

`dlclose'

Fixes 7b4f1e6bd367 ("common/mlx5: introduce common library")

The title should point to the root cause - not to the results.

Something like:

common/mlx5: fix dynamic loading reference

Quoted 25 lines
 drivers/common/mlx5/mlx5_common.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/common/mlx5/mlx5_common.c +0 -2
index 610fb48..570a3f4 100644
@@ -209,8 +209,6 @@ enum mlx5_class
  */
 RTE_INIT_PRIO(mlx5_glue_init, CLASS)  {
-     void *handle = NULL;
-
      /* Initialize common log type. */
      mlx5_common_logtype = rte_log_register("pmd.common.mlx5");
      if (mlx5_common_logtype >= 0) @@ -249,6 +247,7 @@ enum

mlx5_class

               mlx5_glue_path(glue_path, sizeof(glue_path)) : ""),
      };
      unsigned int i = 0;
drivers/common/mlx5/mlx5_common.c +1 -0
+     void *handle = NULL;
      void **sym;
      const char *dlmsg;

drivers/common/mlx5/mlx5_common.c enum mlx5_class · line 325

Quoted 7 lines
drivers/common/mlx5/mlx5_common.c +2 -0
@@ -320,8 +319,10 @@ enum mlx5_class
      mlx5_glue->fork_init();
      return;
 glue_error:
+#ifdef RTE_IBVERBS_LINK_DLOPEN
      if (handle)
              dlclose(handle);
+#endif

What's about " #include <dlfcn.h> " Is it compiled for you?

Quoted 8 lines
Quoted 6 lines

Yes, still building fail.

Quoted 1 line

If so, why dlclose is not known on your setup?

When I fixed it, I found the codes in mlx5_glue_init, use the RTE_IBVERBS_LINK_DLOPEN.
but dlclose is not included in it. I think we should add RTE_IBVERBS_LINK_DLOPEN to fix the building fail.

I agree, but looks like the include should be in the define area too. No?

No, the "dlfcn.h" in dpdk is not included in define area at all.

[root@localhost dpdk-next-net]# grep -rwin "dlfcn.h" lib/librte_eal/common/eal_common_options.c:17:#include <dlfcn.h> drivers/net/ark/ark_ethdev.c:7:#include <dlfcn.h> drivers/net/mlx4/mlx4.c:11:#include <dlfcn.h> drivers/common/mlx5/mlx5_common.c:5:#include <dlfcn.h> examples/performance-thread/pthread_shim/pthread_shim.c:10:#include <dlfcn.h>

Quoted 8 lines
Quoted 5 lines

and other codes should be in define area, but not:
drivers/net/ark/ark_ethdev.c:177 lib/librte_eal/common/eal_common_options.c:306 drivers/common/mlx5/mlx5_common.c:325(this patch fix)

So, Is it compiled well to include it while its lib is not loaded?

Review the codes again, RTE_IBVERBS_LINK_DLOPEN is only used for mlx4/mlx5. Other codes is unnecessary included in RTE_IBVERBS_LINK_DLOPEN define.

v3 is shown as below, and tested:
https://travis-ci.com/ovn-open-virtual-networks/dpdk-next-net/builds/151882661

(quoted diff) +0 -0

b/drivers/common/mlx5/mlx5_common.c
index 610fb48..9ea56f2 100644

drivers/common/mlx5/mlx5_common.c +7 -3
@@ -2,10 +2,12 @@
  * Copyright 2019 Mellanox Technologies, Ltd
  */
 
-#include <dlfcn.h>
 #include <unistd.h>
 #include <string.h>
 #include <stdio.h>
+#ifdef RTE_IBVERBS_LINK_DLOPEN
+#include <dlfcn.h>
+#endif
 
 #include <rte_errno.h>
 
@@ -209,8 +211,6 @@ enum mlx5_class
  */
 RTE_INIT_PRIO(mlx5_glue_init, CLASS)
 {
-       void *handle = NULL;
-
        /* Initialize common log type. */
        mlx5_common_logtype = rte_log_register("pmd.common.mlx5");
        if (mlx5_common_logtype >= 0)
@@ -233,6 +233,8 @@ enum mlx5_class
        /* The glue initialization was done earlier by mlx5 common library. */
 #ifdef RTE_IBVERBS_LINK_DLOPEN
        char glue_path[sizeof(RTE_EAL_PMD_PATH) - 1 + sizeof("-glue")];
+       void *handle = NULL;
+
        const char *path[] = {
                /*
                 * A basic security check is necessary before trusting
@@ -320,8 +322,10 @@ enum mlx5_class
        mlx5_glue->fork_init();
        return;
 glue_error:
+#ifdef RTE_IBVERBS_LINK_DLOPEN
        if (handle)
                dlclose(handle);
+#endif
        DRV_LOG(WARNING, "Cannot initialize MLX5 common due to missing"
                " run-time dependency on rdma-core libraries (libibverbs,"
                " libmlx5)");
drivers/net/mlx4/mlx4.c +3 -1
index a1dd658..8e29878 100644
@@ -8,7 +8,6 @@
  * mlx4 driver initialization.
  */
 
-#include <dlfcn.h>
 #include <errno.h>
 #include <inttypes.h>
 #include <stddef.h>
@@ -18,6 +17,9 @@
 #include <string.h>
 #include <sys/mman.h>
 #include <unistd.h>
+#ifdef RTE_IBVERBS_LINK_DLOPEN
+#include <dlfcn.h>
+#endif
 
 /* Verbs headers do not support -pedantic. */
 #ifdef PEDANTIC
Quoted 20 lines
Quoted 20 lines
Quoted 11 lines
Quoted 11 lines
Quoted 9 lines
Quoted 8 lines
drivers/common/mlx5/mlx5_common.c +0 -0
      DRV_LOG(WARNING, "Cannot initialize MLX5 common due to

missing"
" run-time dependency on rdma-core libraries (libibverbs," " libmlx5)");
--
1.8.3.1

Quoted 3 lines
Quoted 3 lines

--
Thanks,
Tonghao

--
Thanks,
Tonghao

Signature · 2 lines
Thanks,
Tonghao
#7 lore raw

PATCH v3 1/1 common/mlx5: fix dynamic loading reference

In reply to [email protected]

From: Tonghao Zhang <[email protected]>

When setting the CONFIG_RTE_BUILD_SHARED_LIB to y, and build the mlx5 pmd, there is a building error. To fix it, add RTE_IBVERBS_LINK_DLOPEN to include relative codes.

mlx5_common.o: In function `mlx5_glue_init':
drivers/common/mlx5/mlx5_common.c:324: undefined reference to `dlclose'

Fixes 7b4f1e6bd367 ("common/mlx5: introduce common library")

---
v3:
* rename the patch title
* mv the dlfcn.h to define area
* tested: https://travis-ci.com/ovn-open-virtual-networks/dpdk-next-net/builds/151882661

v2:
* change the patch title

---
 drivers/common/mlx5/mlx5_common.c | 10 +++++++---
 drivers/net/mlx4/mlx4.c           |  4 +++-
 2 files changed, 10 insertions(+), 4 deletions(-)
drivers/common/mlx5/mlx5_common.c +7 -3
index 610fb48..9ea56f2 100644
@@ -2,10 +2,12 @@
  * Copyright 2019 Mellanox Technologies, Ltd
  */
 
-#include <dlfcn.h>
 #include <unistd.h>
 #include <string.h>
 #include <stdio.h>
+#ifdef RTE_IBVERBS_LINK_DLOPEN
+#include <dlfcn.h>
+#endif
 
 #include <rte_errno.h>
 
@@ -209,8 +211,6 @@ enum mlx5_class
  */
 RTE_INIT_PRIO(mlx5_glue_init, CLASS)
 {
-	void *handle = NULL;
-
 	/* Initialize common log type. */
 	mlx5_common_logtype = rte_log_register("pmd.common.mlx5");
 	if (mlx5_common_logtype >= 0)
@@ -233,6 +233,8 @@ enum mlx5_class
 	/* The glue initialization was done earlier by mlx5 common library. */
 #ifdef RTE_IBVERBS_LINK_DLOPEN
 	char glue_path[sizeof(RTE_EAL_PMD_PATH) - 1 + sizeof("-glue")];
+	void *handle = NULL;
+
 	const char *path[] = {
 		/*
 		 * A basic security check is necessary before trusting
@@ -320,8 +322,10 @@ enum mlx5_class
 	mlx5_glue->fork_init();
 	return;
 glue_error:
+#ifdef RTE_IBVERBS_LINK_DLOPEN
 	if (handle)
 		dlclose(handle);
+#endif
 	DRV_LOG(WARNING, "Cannot initialize MLX5 common due to missing"
 		" run-time dependency on rdma-core libraries (libibverbs,"
 		" libmlx5)");
drivers/net/mlx4/mlx4.c +3 -1
index a1dd658..8e29878 100644
@@ -8,7 +8,6 @@
  * mlx4 driver initialization.
  */
 
-#include <dlfcn.h>
 #include <errno.h>
 #include <inttypes.h>
 #include <stddef.h>
@@ -18,6 +17,9 @@
 #include <string.h>
 #include <sys/mman.h>
 #include <unistd.h>
+#ifdef RTE_IBVERBS_LINK_DLOPEN
+#include <dlfcn.h>
+#endif
 
 /* Verbs headers do not support -pedantic. */
 #ifdef PEDANTIC
Signature · 1 line
1.8.3.1
Acked-by on v3 1/1
#8 lore raw

Re: [dpdk-dev] [PATCH dpdk-dev v3] common/mlx5: fix dynamic loading reference

From: [email protected]

Quoted 10 lines

From: Tonghao Zhang <[email protected]>

When setting the CONFIG_RTE_BUILD_SHARED_LIB to y, and build the mlx5 pmd, there is a building error.
To fix it, add RTE_IBVERBS_LINK_DLOPEN to include relative codes.

mlx5_common.o: In function `mlx5_glue_init':
drivers/common/mlx5/mlx5_common.c:324: undefined reference to
`dlclose'

Quoted 5 lines
Fixes 7b4f1e6bd367 ("common/mlx5: introduce common library")
#9 lore raw

Re: [dpdk-dev] [PATCH dpdk-dev v3] common/mlx5: fix dynamic loading reference

In reply to [email protected]

Hi,

Quoted 52 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of [email protected]
Sent: Friday, March 6, 2020 4:27 PM
To: Matan Azrad <[email protected]>; Ali Alnubani <[email protected]>
Cc: [email protected]; Tonghao Zhang <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH dpdk-dev v3] common/mlx5: fix dynamic loading reference

From: Tonghao Zhang <[email protected]>

When setting the CONFIG_RTE_BUILD_SHARED_LIB to y, and build the mlx5 pmd, there is a building error. To fix it, add RTE_IBVERBS_LINK_DLOPEN to include relative codes.

mlx5_common.o: In function `mlx5_glue_init':
drivers/common/mlx5/mlx5_common.c:324: undefined reference to
`dlclose'

Fixes 7b4f1e6bd367 ("common/mlx5: introduce common library")

---
v3:
* rename the patch title
* mv the dlfcn.h to define area
* tested:
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftravis
-ci.com%2Fovn-open-virtual-networks%2Fdpdk-next- net%2Fbuilds%2F151882661&amp;data=02%7C01%7Crasland%40mellanox.co m%7Cc089a6504673460ee42c08d7c1da91c5%7Ca652971c7d2e4d9ba6a4d1492 56f461b%7C0%7C0%7C637191016800944332&amp;sdata=AL6s1X0NFyBtAi%2 BfFS%2FwB41xHZBUQsvDUZ5%2FWucJTd0%3D&amp;reserved=0

v2:
* change the patch title

---
 drivers/common/mlx5/mlx5_common.c | 10 +++++++---
 drivers/net/mlx4/mlx4.c           |  4 +++-
 2 files changed, 10 insertions(+), 4 deletions(-)
drivers/common/mlx5/mlx5_common.c +0 -0
index 610fb48..9ea56f2 100644

drivers/common/mlx5/mlx5_common.c line 4

Quoted 3 lines
drivers/common/mlx5/mlx5_common.c +0 -0
@@ -2,10 +2,12 @@
  * Copyright 2019 Mellanox Technologies, Ltd
  */
 

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh