patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH v1] common/mlx5/linux: replace malloc and free in glue
@ 2020-10-27 10:16 Ophir Munk
  2020-11-01 14:58 ` Raslan Darawsheh
  0 siblings, 1 reply; 3+ messages in thread
From: Ophir Munk @ 2020-10-27 10:16 UTC (permalink / raw)
  To: dev, Raslan Darawsheh
  Cc: Ophir Munk, Matan Azrad, Viacheslav Ovsiienko, stable

This commit replaces mlx5_malloc and mlx5_free calls with Linux calls
malloc and free in file mlx5_glue.c.
The current mlx5_malloc calls have no flags, alignment or socket
selection, so they are equivalent to calling malloc.  Rdma core itself
is using malloc.  When using mlx5_malloc the glue library is dependent
on common_mlx5 library which must be compiled first.  Not doing so and
in case ibverbs_link=dlopen will result in compilation failure:
mlx5_glue.c: undefined reference to `mlx5_malloc'.
To make all of this simpler and remove the common_mlx5 dependency - this
commit does the alloc/free replacements.

Fixes: 66914d19d135 ("common/mlx5: convert control path memory to
unified malloc")
Cc: stable@dpdk.org

Signed-off-by: Ophir Munk <ophirmu@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/common/mlx5/linux/mlx5_glue.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/common/mlx5/linux/mlx5_glue.c b/drivers/common/mlx5/linux/mlx5_glue.c
index 47b7e98..89539e7 100644
--- a/drivers/common/mlx5/linux/mlx5_glue.c
+++ b/drivers/common/mlx5/linux/mlx5_glue.c
@@ -8,7 +8,6 @@
 #include <stddef.h>
 #include <stdint.h>
 #include <stdlib.h>
-#include <rte_memory.h>
 /*
  * Not needed by this file; included to work around the lack of off_t
  * definition for mlx5dv.h with unpatched rdma-core versions.
@@ -16,7 +15,6 @@
 #include <sys/types.h>
 
 #include "mlx5_glue.h"
-#include "../mlx5_malloc.h"
 
 static int
 mlx5_glue_fork_init(void)
@@ -186,7 +184,7 @@ mlx5_glue_destroy_flow_action(void *action)
 		res = ibv_destroy_flow_action(attr->action);
 		break;
 	}
-	mlx5_free(action);
+	free(action);
 	return res;
 #endif
 #else
@@ -619,7 +617,7 @@ mlx5_glue_dv_create_flow_action_counter(void *counter_obj, uint32_t offset)
 	struct mlx5dv_flow_action_attr *action;
 
 	(void)offset;
-	action = mlx5_malloc(0, sizeof(*action), 0, SOCKET_ID_ANY);
+	action = malloc(sizeof(*action));
 	if (!action)
 		return NULL;
 	action->type = MLX5DV_FLOW_ACTION_COUNTERS_DEVX;
@@ -643,7 +641,7 @@ mlx5_glue_dv_create_flow_action_dest_ibv_qp(void *qp)
 #else
 	struct mlx5dv_flow_action_attr *action;
 
-	action = mlx5_malloc(0, sizeof(*action), 0, SOCKET_ID_ANY);
+	action = malloc(sizeof(*action));
 	if (!action)
 		return NULL;
 	action->type = MLX5DV_FLOW_ACTION_DEST_IBV_QP;
@@ -688,7 +686,7 @@ mlx5_glue_dv_create_flow_action_modify_header
 
 	(void)domain;
 	(void)flags;
-	action = mlx5_malloc(0, sizeof(*action), 0, SOCKET_ID_ANY);
+	action = malloc(sizeof(*action));
 	if (!action)
 		return NULL;
 	action->type = MLX5DV_FLOW_ACTION_IBV_FLOW_ACTION;
@@ -728,7 +726,7 @@ mlx5_glue_dv_create_flow_action_packet_reformat
 	(void)flags;
 	struct mlx5dv_flow_action_attr *action;
 
-	action = mlx5_malloc(0, sizeof(*action), 0, SOCKET_ID_ANY);
+	action = malloc(sizeof(*action));
 	if (!action)
 		return NULL;
 	action->type = MLX5DV_FLOW_ACTION_IBV_FLOW_ACTION;
@@ -758,7 +756,7 @@ mlx5_glue_dv_create_flow_action_tag(uint32_t tag)
 #else /* HAVE_MLX5DV_DR */
 	struct mlx5dv_flow_action_attr *action;
 
-	action = mlx5_malloc(0, sizeof(*action), 0, SOCKET_ID_ANY);
+	action = malloc(sizeof(*action));
 	if (!action)
 		return NULL;
 	action->type = MLX5DV_FLOW_ACTION_TAG;
-- 
2.8.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-stable] [PATCH v1] common/mlx5/linux: replace malloc and free in glue
  2020-10-27 10:16 [dpdk-stable] [PATCH v1] common/mlx5/linux: replace malloc and free in glue Ophir Munk
@ 2020-11-01 14:58 ` Raslan Darawsheh
  0 siblings, 0 replies; 3+ messages in thread
From: Raslan Darawsheh @ 2020-11-01 14:58 UTC (permalink / raw)
  To: Ophir Munk, dev; +Cc: Ophir Munk, Matan Azrad, Slava Ovsiienko, stable

Hi,

> -----Original Message-----
> From: Ophir Munk <ophirmu@nvidia.com>
> Sent: Tuesday, October 27, 2020 12:17 PM
> To: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>
> Cc: Ophir Munk <ophirmu@nvidia.com>; Matan Azrad <matan@nvidia.com>;
> Slava Ovsiienko <viacheslavo@nvidia.com>; stable@dpdk.org
> Subject: [PATCH v1] common/mlx5/linux: replace malloc and free in glue
> 
> This commit replaces mlx5_malloc and mlx5_free calls with Linux calls
> malloc and free in file mlx5_glue.c.
> The current mlx5_malloc calls have no flags, alignment or socket
> selection, so they are equivalent to calling malloc.  Rdma core itself
> is using malloc.  When using mlx5_malloc the glue library is dependent
> on common_mlx5 library which must be compiled first.  Not doing so and
> in case ibverbs_link=dlopen will result in compilation failure:
> mlx5_glue.c: undefined reference to `mlx5_malloc'.
> To make all of this simpler and remove the common_mlx5 dependency - this
> commit does the alloc/free replacements.
> 
> Fixes: 66914d19d135 ("common/mlx5: convert control path memory to
> unified malloc")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ophir Munk <ophirmu@nvidia.com>
> Acked-by: Matan Azrad <matan@nvidia.com>
> ---
>  drivers/common/mlx5/linux/mlx5_glue.c | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
> 

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [dpdk-stable] [PATCH v1] common/mlx5/linux: replace malloc and free in glue
@ 2020-10-27 10:15 Ophir Munk
  0 siblings, 0 replies; 3+ messages in thread
From: Ophir Munk @ 2020-10-27 10:15 UTC (permalink / raw)
  To: Ophir Munk; +Cc: stable

This commit replaces mlx5_malloc and mlx5_free calls with Linux calls
malloc and free in file mlx5_glue.c.
The current mlx5_malloc calls have no flags, alignment or socket
selection, so they are equivalent to calling malloc.  Rdma core itself
is using malloc.  When using mlx5_malloc the glue library is dependent
on common_mlx5 library which must be compiled first.  Not doing so and
in case ibverbs_link=dlopen will result in compilation failure:
mlx5_glue.c: undefined reference to `mlx5_malloc'.
To make all of this simpler and remove the common_mlx5 dependency - this
commit does the alloc/free replacements.

Fixes: 66914d19d135 ("common/mlx5: convert control path memory to
unified malloc")
Cc: stable@dpdk.org

Signed-off-by: Ophir Munk <ophirmu@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/common/mlx5/linux/mlx5_glue.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/common/mlx5/linux/mlx5_glue.c b/drivers/common/mlx5/linux/mlx5_glue.c
index 47b7e98..89539e7 100644
--- a/drivers/common/mlx5/linux/mlx5_glue.c
+++ b/drivers/common/mlx5/linux/mlx5_glue.c
@@ -8,7 +8,6 @@
 #include <stddef.h>
 #include <stdint.h>
 #include <stdlib.h>
-#include <rte_memory.h>
 /*
  * Not needed by this file; included to work around the lack of off_t
  * definition for mlx5dv.h with unpatched rdma-core versions.
@@ -16,7 +15,6 @@
 #include <sys/types.h>
 
 #include "mlx5_glue.h"
-#include "../mlx5_malloc.h"
 
 static int
 mlx5_glue_fork_init(void)
@@ -186,7 +184,7 @@ mlx5_glue_destroy_flow_action(void *action)
 		res = ibv_destroy_flow_action(attr->action);
 		break;
 	}
-	mlx5_free(action);
+	free(action);
 	return res;
 #endif
 #else
@@ -619,7 +617,7 @@ mlx5_glue_dv_create_flow_action_counter(void *counter_obj, uint32_t offset)
 	struct mlx5dv_flow_action_attr *action;
 
 	(void)offset;
-	action = mlx5_malloc(0, sizeof(*action), 0, SOCKET_ID_ANY);
+	action = malloc(sizeof(*action));
 	if (!action)
 		return NULL;
 	action->type = MLX5DV_FLOW_ACTION_COUNTERS_DEVX;
@@ -643,7 +641,7 @@ mlx5_glue_dv_create_flow_action_dest_ibv_qp(void *qp)
 #else
 	struct mlx5dv_flow_action_attr *action;
 
-	action = mlx5_malloc(0, sizeof(*action), 0, SOCKET_ID_ANY);
+	action = malloc(sizeof(*action));
 	if (!action)
 		return NULL;
 	action->type = MLX5DV_FLOW_ACTION_DEST_IBV_QP;
@@ -688,7 +686,7 @@ mlx5_glue_dv_create_flow_action_modify_header
 
 	(void)domain;
 	(void)flags;
-	action = mlx5_malloc(0, sizeof(*action), 0, SOCKET_ID_ANY);
+	action = malloc(sizeof(*action));
 	if (!action)
 		return NULL;
 	action->type = MLX5DV_FLOW_ACTION_IBV_FLOW_ACTION;
@@ -728,7 +726,7 @@ mlx5_glue_dv_create_flow_action_packet_reformat
 	(void)flags;
 	struct mlx5dv_flow_action_attr *action;
 
-	action = mlx5_malloc(0, sizeof(*action), 0, SOCKET_ID_ANY);
+	action = malloc(sizeof(*action));
 	if (!action)
 		return NULL;
 	action->type = MLX5DV_FLOW_ACTION_IBV_FLOW_ACTION;
@@ -758,7 +756,7 @@ mlx5_glue_dv_create_flow_action_tag(uint32_t tag)
 #else /* HAVE_MLX5DV_DR */
 	struct mlx5dv_flow_action_attr *action;
 
-	action = mlx5_malloc(0, sizeof(*action), 0, SOCKET_ID_ANY);
+	action = malloc(sizeof(*action));
 	if (!action)
 		return NULL;
 	action->type = MLX5DV_FLOW_ACTION_TAG;
-- 
2.8.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-01 14:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-27 10:16 [dpdk-stable] [PATCH v1] common/mlx5/linux: replace malloc and free in glue Ophir Munk
2020-11-01 14:58 ` Raslan Darawsheh
  -- strict thread matches above, loose matches on Subject: below --
2020-10-27 10:15 Ophir Munk

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ http://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git