Skip to contentSkip to conversation

net/mlx5: fix indexed pools allocate on Windows

PATCH In review Suanming Mou 5 participants 7 messages Jul 21, 2021 – Jul 22, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: fix indexed pools allocate on Windows

Currently, the flow indexed pools are allocated per port, the allocation was missing in Windows code.

This commit fixes the the Windows flow indexed pools are not allocated issue.

Fixes b4edeaf3efd5 ("net/mlx5: replace flow list with indexed pool")
---
 drivers/net/mlx5/windows/mlx5_os.c | 47 ++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
drivers/net/mlx5/windows/mlx5_os.c +47 -0
index 5da362a9d5..a31fafc90d 100644
@@ -35,6 +35,44 @@ static const char *MZ_MLX5_PMD_SHARED_DATA = "mlx5_pmd_shared_data";
 /* Spinlock for mlx5_shared_data allocation. */
 static rte_spinlock_t mlx5_shared_data_lock = RTE_SPINLOCK_INITIALIZER;
 
+/* rte flow indexed pool configuration. */
+static struct mlx5_indexed_pool_config icfg[] = {
+	{
+		.size = sizeof(struct rte_flow),
+		.trunk_size = 64,
+		.need_lock = 1,
+		.release_mem_en = 0,
+		.malloc = mlx5_malloc,
+		.free = mlx5_free,
+		.per_core_cache = 0,
+		.type = "ctl_flow_ipool",
+	},
+	{
+		.size = sizeof(struct rte_flow),
+		.trunk_size = 64,
+		.grow_trunk = 3,
+		.grow_shift = 2,
+		.need_lock = 1,
+		.release_mem_en = 0,
+		.malloc = mlx5_malloc,
+		.free = mlx5_free,
+		.per_core_cache = 1 << 14,
+		.type = "rte_flow_ipool",
+	},
+	{
+		.size = sizeof(struct rte_flow),
+		.trunk_size = 64,
+		.grow_trunk = 3,
+		.grow_shift = 2,
+		.need_lock = 1,
+		.release_mem_en = 0,
+		.malloc = mlx5_malloc,
+		.free = mlx5_free,
+		.per_core_cache = 0,
+		.type = "mcp_flow_ipool",
+	},
+};
+
 /**
  * Initialize shared data between primary and secondary process.
  *
@@ -317,6 +355,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	char name[RTE_ETH_NAME_MAX_LEN];
 	int own_domain_id = 0;
 	uint16_t port_id;
+	int i;
 
 	/* Build device name. */
 	strlcpy(name, dpdk_dev->name, sizeof(name));
@@ -584,6 +623,14 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	mlx5_set_min_inline(spawn, config);
 	/* Store device configuration on private structure. */
 	priv->config = *config;
+	for (i = 0; i < MLX5_FLOW_TYPE_MAXI; i++) {
+		icfg[i].release_mem_en = !!config->reclaim_mode;
+		if (config->reclaim_mode)
+			icfg[i].per_core_cache = 0;
+		priv->flows[i] = mlx5_ipool_create(&icfg[i]);
+		if (!priv->flows[i])
+			goto error;
+	}
 	/* Create context for virtual machine VLAN workaround. */
 	priv->vmwa_context = NULL;
 	if (config->dv_flow_en) {
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw
Quoted 90 lines

Subject: [PATCH] net/mlx5: fix indexed pools allocate on Windows

Currently, the flow indexed pools are allocated per port, the allocation was missing in Windows code.

This commit fixes the the Windows flow indexed pools are not allocated issue.

Fixes b4edeaf3efd5 ("net/mlx5: replace flow list with indexed pool")
---
 drivers/net/mlx5/windows/mlx5_os.c | 47
++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
drivers/net/mlx5/windows/mlx5_os.c +38 -0
index 5da362a9d5..a31fafc90d 100644
@@ -35,6 +35,44 @@ static const char *MZ_MLX5_PMD_SHARED_DATA =
 "mlx5_pmd_shared_data";
 /* Spinlock for mlx5_shared_data allocation. */  static rte_spinlock_t
 mlx5_shared_data_lock = RTE_SPINLOCK_INITIALIZER;
 
+/* rte flow indexed pool configuration. */ static struct
+mlx5_indexed_pool_config icfg[] = {
+	{
+		.size = sizeof(struct rte_flow),
+		.trunk_size = 64,
+		.need_lock = 1,
+		.release_mem_en = 0,
+		.malloc = mlx5_malloc,
+		.free = mlx5_free,
+		.per_core_cache = 0,
+		.type = "ctl_flow_ipool",
+	},
+	{
+		.size = sizeof(struct rte_flow),
+		.trunk_size = 64,
+		.grow_trunk = 3,
+		.grow_shift = 2,
+		.need_lock = 1,
+		.release_mem_en = 0,
+		.malloc = mlx5_malloc,
+		.free = mlx5_free,
+		.per_core_cache = 1 << 14,
+		.type = "rte_flow_ipool",
+	},
+	{
+		.size = sizeof(struct rte_flow),
+		.trunk_size = 64,
+		.grow_trunk = 3,
+		.grow_shift = 2,
+		.need_lock = 1,
+		.release_mem_en = 0,
+		.malloc = mlx5_malloc,
+		.free = mlx5_free,
+		.per_core_cache = 0,
+		.type = "mcp_flow_ipool",
+	},
+};
+
 /**
  * Initialize shared data between primary and secondary process.

*

drivers/net/mlx5/windows/mlx5_os.c +1 -0
@@ -317,6 +355,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	char name[RTE_ETH_NAME_MAX_LEN];
 	int own_domain_id = 0;
 	uint16_t port_id;
+	int i;
 
 	/* Build device name. */
 	strlcpy(name, dpdk_dev->name, sizeof(name)); @@ -584,6 +623,14

@@ mlx5_dev_spawn(struct rte_device *dpdk_dev,

drivers/net/mlx5/windows/mlx5_os.c +8 -1
 	mlx5_set_min_inline(spawn, config);
 	/* Store device configuration on private structure. */
 	priv->config = *config;
+	for (i = 0; i < MLX5_FLOW_TYPE_MAXI; i++) {
+		icfg[i].release_mem_en = !!config->reclaim_mode;
+		if (config->reclaim_mode)
+			icfg[i].per_core_cache = 0;
+		priv->flows[i] = mlx5_ipool_create(&icfg[i]);
+		if (!priv->flows[i])
+			goto error;
+	}
 	/* Create context for virtual machine VLAN workaround. */
 	priv->vmwa_context = NULL;
 	if (config->dv_flow_en) {
--
Quoted 1 line

2.25.1

Tested-by
#2 lore raw
Quoted 98 lines

-----Original Message-----
From: Tal Shnaiderman <[email protected]>
Sent: Wednesday, July 21, 2021 11:40 AM
To: Suanming Mou <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>; Odi Assli <[email protected]>
Cc: Raslan Darawsheh <[email protected]>; [email protected]
Subject: RE: [PATCH] net/mlx5: fix indexed pools allocate on Windows

Quoted 6 lines

Subject: [PATCH] net/mlx5: fix indexed pools allocate on Windows

Currently, the flow indexed pools are allocated per port, the allocation was missing in Windows code.

This commit fixes the the Windows flow indexed pools are not allocated

issue.

Quoted 61 lines
Fixes b4edeaf3efd5 ("net/mlx5: replace flow list with indexed pool")
---
 drivers/net/mlx5/windows/mlx5_os.c | 47
++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
drivers/net/mlx5/windows/mlx5_os.c +38 -0
index 5da362a9d5..a31fafc90d 100644
@@ -35,6 +35,44 @@ static const char *MZ_MLX5_PMD_SHARED_DATA =
 "mlx5_pmd_shared_data";
 /* Spinlock for mlx5_shared_data allocation. */  static
 rte_spinlock_t mlx5_shared_data_lock = RTE_SPINLOCK_INITIALIZER;
 
+/* rte flow indexed pool configuration. */ static struct
+mlx5_indexed_pool_config icfg[] = {
+	{
+		.size = sizeof(struct rte_flow),
+		.trunk_size = 64,
+		.need_lock = 1,
+		.release_mem_en = 0,
+		.malloc = mlx5_malloc,
+		.free = mlx5_free,
+		.per_core_cache = 0,
+		.type = "ctl_flow_ipool",
+	},
+	{
+		.size = sizeof(struct rte_flow),
+		.trunk_size = 64,
+		.grow_trunk = 3,
+		.grow_shift = 2,
+		.need_lock = 1,
+		.release_mem_en = 0,
+		.malloc = mlx5_malloc,
+		.free = mlx5_free,
+		.per_core_cache = 1 << 14,
+		.type = "rte_flow_ipool",
+	},
+	{
+		.size = sizeof(struct rte_flow),
+		.trunk_size = 64,
+		.grow_trunk = 3,
+		.grow_shift = 2,
+		.need_lock = 1,
+		.release_mem_en = 0,
+		.malloc = mlx5_malloc,
+		.free = mlx5_free,
+		.per_core_cache = 0,
+		.type = "mcp_flow_ipool",
+	},
+};
+
 /**
  * Initialize shared data between primary and secondary process.

*

drivers/net/mlx5/windows/mlx5_os.c mlx5_dev_spawn(struct rte_device *dpdk_dev, · line 361

Quoted 7 lines
drivers/net/mlx5/windows/mlx5_os.c +1 -0
@@ -317,6 +355,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	char name[RTE_ETH_NAME_MAX_LEN];
 	int own_domain_id = 0;
 	uint16_t port_id;
+	int i;
 
 	/* Build device name. */
 	strlcpy(name, dpdk_dev->name, sizeof(name)); @@ -584,6 +623,14

@@

Quoted 11 lines

mlx5_dev_spawn(struct rte_device *dpdk_dev,

drivers/net/mlx5/windows/mlx5_os.c +7 -0
 	mlx5_set_min_inline(spawn, config);
 	/* Store device configuration on private structure. */
 	priv->config = *config;
+	for (i = 0; i < MLX5_FLOW_TYPE_MAXI; i++) {
+		icfg[i].release_mem_en = !!config->reclaim_mode;
+		if (config->reclaim_mode)
+			icfg[i].per_core_cache = 0;
+		priv->flows[i] = mlx5_ipool_create(&icfg[i]);
+		if (!priv->flows[i])
+			goto error;
Quoted 8 lines
Quoted 6 lines
drivers/net/mlx5/windows/mlx5_os.c +1 -1
+	}
 	/* Create context for virtual machine VLAN workaround. */
 	priv->vmwa_context = NULL;
 	if (config->dv_flow_en) {
--

2.25.1

Acked-by on v1 1/1
#3 lore raw
In reply to Suanming Mou

Hi

From: Suanming Mou:

Quoted 4 lines

Currently, the flow indexed pools are allocated per port, the allocation was missing in Windows code.

This commit fixes the the Windows flow indexed pools are not allocated

Double "the"

Instead, you can use:
Allocate indexed pool for the Windows case too.

Quoted 5 lines

issue.

Fixes b4edeaf3efd5 ("net/mlx5: replace flow list with indexed pool")

Better title:
net/mlx5/windows: fix indexed pools allocation

Besides,

Quoted 81 lines
---
 drivers/net/mlx5/windows/mlx5_os.c | 47
++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
drivers/net/mlx5/windows/mlx5_os.c +38 -0
index 5da362a9d5..a31fafc90d 100644
@@ -35,6 +35,44 @@ static const char *MZ_MLX5_PMD_SHARED_DATA =
 "mlx5_pmd_shared_data";
 /* Spinlock for mlx5_shared_data allocation. */  static rte_spinlock_t
 mlx5_shared_data_lock = RTE_SPINLOCK_INITIALIZER;
 
+/* rte flow indexed pool configuration. */ static struct
+mlx5_indexed_pool_config icfg[] = {
+	{
+		.size = sizeof(struct rte_flow),
+		.trunk_size = 64,
+		.need_lock = 1,
+		.release_mem_en = 0,
+		.malloc = mlx5_malloc,
+		.free = mlx5_free,
+		.per_core_cache = 0,
+		.type = "ctl_flow_ipool",
+	},
+	{
+		.size = sizeof(struct rte_flow),
+		.trunk_size = 64,
+		.grow_trunk = 3,
+		.grow_shift = 2,
+		.need_lock = 1,
+		.release_mem_en = 0,
+		.malloc = mlx5_malloc,
+		.free = mlx5_free,
+		.per_core_cache = 1 << 14,
+		.type = "rte_flow_ipool",
+	},
+	{
+		.size = sizeof(struct rte_flow),
+		.trunk_size = 64,
+		.grow_trunk = 3,
+		.grow_shift = 2,
+		.need_lock = 1,
+		.release_mem_en = 0,
+		.malloc = mlx5_malloc,
+		.free = mlx5_free,
+		.per_core_cache = 0,
+		.type = "mcp_flow_ipool",
+	},
+};
+
 /**
  * Initialize shared data between primary and secondary process.

*

drivers/net/mlx5/windows/mlx5_os.c +1 -0
@@ -317,6 +355,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	char name[RTE_ETH_NAME_MAX_LEN];
 	int own_domain_id = 0;
 	uint16_t port_id;
+	int i;
 
 	/* Build device name. */
 	strlcpy(name, dpdk_dev->name, sizeof(name)); @@ -584,6 +623,14

@@ mlx5_dev_spawn(struct rte_device *dpdk_dev,

drivers/net/mlx5/windows/mlx5_os.c +8 -1
 	mlx5_set_min_inline(spawn, config);
 	/* Store device configuration on private structure. */
 	priv->config = *config;
+	for (i = 0; i < MLX5_FLOW_TYPE_MAXI; i++) {
+		icfg[i].release_mem_en = !!config->reclaim_mode;
+		if (config->reclaim_mode)
+			icfg[i].per_core_cache = 0;
+		priv->flows[i] = mlx5_ipool_create(&icfg[i]);
+		if (!priv->flows[i])
+			goto error;
+	}
 	/* Create context for virtual machine VLAN workaround. */
 	priv->vmwa_context = NULL;
 	if (config->dv_flow_en) {
--

2.25.1

#4 lore raw

21/07/2021 10:43, Matan Azrad:

Quoted 2 lines

Better title:
net/mlx5/windows: fix indexed pools allocation

even better: keep the "on Windows" at the end.

#5 lore raw

PATCH v2 1/1 net/mlx5: fix indexed pools allocation

In reply to Suanming Mou

Currently, the flow indexed pools are allocated per port, the allocation was missing in Windows code.

Allocate indexed pool for the Windows case too.

Fixes b4edeaf3efd5 ("net/mlx5: replace flow list with indexed pool")

---

v2: commit message updated.

---
 drivers/net/mlx5/windows/mlx5_os.c | 47 ++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
drivers/net/mlx5/windows/mlx5_os.c +47 -0
index 5da362a9d5..a31fafc90d 100644
@@ -35,6 +35,44 @@ static const char *MZ_MLX5_PMD_SHARED_DATA = "mlx5_pmd_shared_data";
 /* Spinlock for mlx5_shared_data allocation. */
 static rte_spinlock_t mlx5_shared_data_lock = RTE_SPINLOCK_INITIALIZER;
 
+/* rte flow indexed pool configuration. */
+static struct mlx5_indexed_pool_config icfg[] = {
+	{
+		.size = sizeof(struct rte_flow),
+		.trunk_size = 64,
+		.need_lock = 1,
+		.release_mem_en = 0,
+		.malloc = mlx5_malloc,
+		.free = mlx5_free,
+		.per_core_cache = 0,
+		.type = "ctl_flow_ipool",
+	},
+	{
+		.size = sizeof(struct rte_flow),
+		.trunk_size = 64,
+		.grow_trunk = 3,
+		.grow_shift = 2,
+		.need_lock = 1,
+		.release_mem_en = 0,
+		.malloc = mlx5_malloc,
+		.free = mlx5_free,
+		.per_core_cache = 1 << 14,
+		.type = "rte_flow_ipool",
+	},
+	{
+		.size = sizeof(struct rte_flow),
+		.trunk_size = 64,
+		.grow_trunk = 3,
+		.grow_shift = 2,
+		.need_lock = 1,
+		.release_mem_en = 0,
+		.malloc = mlx5_malloc,
+		.free = mlx5_free,
+		.per_core_cache = 0,
+		.type = "mcp_flow_ipool",
+	},
+};
+
 /**
  * Initialize shared data between primary and secondary process.
  *
@@ -317,6 +355,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	char name[RTE_ETH_NAME_MAX_LEN];
 	int own_domain_id = 0;
 	uint16_t port_id;
+	int i;
 
 	/* Build device name. */
 	strlcpy(name, dpdk_dev->name, sizeof(name));
@@ -584,6 +623,14 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	mlx5_set_min_inline(spawn, config);
 	/* Store device configuration on private structure. */
 	priv->config = *config;
+	for (i = 0; i < MLX5_FLOW_TYPE_MAXI; i++) {
+		icfg[i].release_mem_en = !!config->reclaim_mode;
+		if (config->reclaim_mode)
+			icfg[i].per_core_cache = 0;
+		priv->flows[i] = mlx5_ipool_create(&icfg[i]);
+		if (!priv->flows[i])
+			goto error;
+	}
 	/* Create context for virtual machine VLAN workaround. */
 	priv->vmwa_context = NULL;
 	if (config->dv_flow_en) {
Signature · 1 line
2.25.1
#6 lore raw

Re: [dpdk-dev] [PATCH v2] net/mlx5: fix indexed pools allocation

22/07/2021 08:59, Suanming Mou:

Quoted 11 lines

Currently, the flow indexed pools are allocated per port, the allocation was missing in Windows code.

Allocate indexed pool for the Windows case too.

Fixes b4edeaf3efd5 ("net/mlx5: replace flow list with indexed pool")

Applied, thanks.