[v2,2/2] net/mlx5: remove unused metadata shift parameter

Message ID 20220203084652.19167-2-viacheslavo@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Raslan Darawsheh
Headers
Series [v2,1/2] net/mlx5: fix metadata endianness in modify field action |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS

Commit Message

Slava Ovsiienko Feb. 3, 2022, 8:46 a.m. UTC
  Due to updated modify field actionimmediate value buffer
pattern [1] the implicit shift for the metadata is not
needed anymore and should be removed.

[1] commit 40c8fb1fd3b3 ("net/mlx5: update modify field action")

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)
  

Comments

Ferruh Yigit Feb. 8, 2022, 10:48 a.m. UTC | #1
On 2/3/2022 8:46 AM, Viacheslav Ovsiienko wrote:
> Due to updated modify field actionimmediate value buffer
> pattern [1] the implicit shift for the metadata is not
> needed anymore and should be removed.
> 
> [1] commit 40c8fb1fd3b3 ("net/mlx5: update modify field action")
> 
> Signed-off-by: Viacheslav Ovsiienko<viacheslavo@nvidia.com>

Hi Slava, Raslan,

Thanks for the split in v2, it looks good to me.
  

Patch

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 10ef2af06a..ef9c66eddf 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -1451,7 +1451,7 @@  static void
 mlx5_flow_field_id_to_modify_info
 		(const struct rte_flow_action_modify_data *data,
 		 struct field_modify_info *info, uint32_t *mask,
-		 uint32_t width, uint32_t *shift, struct rte_eth_dev *dev,
+		 uint32_t width, struct rte_eth_dev *dev,
 		 const struct rte_flow_attr *attr, struct rte_flow_error *error)
 {
 	struct mlx5_priv *priv = dev->data->dev_private;
@@ -1806,16 +1806,11 @@  mlx5_flow_field_id_to_modify_info
 		{
 			uint32_t meta_mask = priv->sh->dv_meta_mask;
 			uint32_t meta_count = __builtin_popcount(meta_mask);
-			uint32_t msk_c0 =
-				rte_cpu_to_be_32(priv->sh->dv_regc0_mask);
-			uint32_t shl_c0 = rte_bsf32(msk_c0);
 			int reg = flow_dv_get_metadata_reg(dev, attr, error);
 			if (reg < 0)
 				return;
 			MLX5_ASSERT(reg != REG_NON);
 			MLX5_ASSERT((unsigned int)reg < RTE_DIM(reg_to_field));
-			if (reg == REG_C_0)
-				*shift = shl_c0;
 			info[idx] = (struct field_modify_info){4, 0,
 						reg_to_field[reg]};
 			if (mask)
@@ -1868,14 +1863,13 @@  flow_dv_convert_action_modify_field
 								{0, 0, 0} };
 	uint32_t mask[MLX5_ACT_MAX_MOD_FIELDS] = {0, 0, 0, 0, 0};
 	uint32_t type, meta = 0;
-	uint32_t shift = 0;
 
 	if (conf->src.field == RTE_FLOW_FIELD_POINTER ||
 	    conf->src.field == RTE_FLOW_FIELD_VALUE) {
 		type = MLX5_MODIFICATION_TYPE_SET;
 		/** For SET fill the destination field (field) first. */
 		mlx5_flow_field_id_to_modify_info(&conf->dst, field, mask,
-						  conf->width, &shift, dev,
+						  conf->width, dev,
 						  attr, error);
 		item.spec = conf->src.field == RTE_FLOW_FIELD_POINTER ?
 					(void *)(uintptr_t)conf->src.pvalue :
@@ -1889,12 +1883,12 @@  flow_dv_convert_action_modify_field
 		type = MLX5_MODIFICATION_TYPE_COPY;
 		/** For COPY fill the destination field (dcopy) without mask. */
 		mlx5_flow_field_id_to_modify_info(&conf->dst, dcopy, NULL,
-						  conf->width, &shift, dev,
+						  conf->width, dev,
 						  attr, error);
 		/** Then construct the source field (field) with mask. */
 		mlx5_flow_field_id_to_modify_info(&conf->src, field, mask,
-						  conf->width, &shift,
-						  dev, attr, error);
+						  conf->width, dev,
+						  attr, error);
 	}
 	item.mask = &mask;
 	return flow_dv_convert_modify_action(&item,