diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 42dc312a87..1ca6223f95 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -401,17 +401,12 @@ struct mlx5_hw_q_job {
 		const void *action; /* Indirect action attached to the job. */
 	};
 	void *user_data; /* Job user data. */
-	struct rte_flow_item *items;
-	union {
-		struct {
-			/* User memory for query output */
-			void *user;
-			/* Data extracted from hardware */
-			void *hw;
-		} __rte_packed query;
-		struct rte_flow_item_ethdev port_spec;
-		struct rte_flow_item_tag tag_spec;
-	} __rte_packed;
+	struct {
+		/* User memory for query output */
+		void *user;
+		/* Data extracted from hardware */
+		void *hw;
+	} query;
 	struct rte_flow_hw *upd_flow; /* Flow with updated values. */
 };
 
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 9ed356e1c2..436d1391bc 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -1316,6 +1316,16 @@ struct mlx5_flow_hw_action_params {
 	uint8_t ipv6_push_data[MLX5_PUSH_MAX_LEN];
 };
 
+/** Container for dynamically generated flow items used during flow rule creation. */
+struct mlx5_flow_hw_pattern_params {
+	/** Array of dynamically generated flow items. */
+	struct rte_flow_item items[MLX5_HW_MAX_ITEMS];
+	/** Temporary REPRESENTED_PORT item generated by PMD. */
+	struct rte_flow_item_ethdev port_spec;
+	/** Temporary TAG item generated by PMD. */
+	struct rte_flow_item_tag tag_spec;
+};
+
 /* rte flow action translate to DR action struct. */
 struct mlx5_action_construct_data {
 	LIST_ENTRY(mlx5_action_construct_data) next;
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index a87fe4d07a..ab67dc139e 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -3272,44 +3272,44 @@ flow_hw_get_rule_items(struct rte_eth_dev *dev,
 		       const struct rte_flow_template_table *table,
 		       const struct rte_flow_item items[],
 		       uint8_t pattern_template_index,
-		       struct mlx5_hw_q_job *job)
+		       struct mlx5_flow_hw_pattern_params *pp)
 {
 	struct rte_flow_pattern_template *pt = table->its[pattern_template_index];
 
 	/* Only one implicit item can be added to flow rule pattern. */
 	MLX5_ASSERT(!pt->implicit_port || !pt->implicit_tag);
-	/* At least one item was allocated in job descriptor for items. */
+	/* At least one item was allocated in pattern params for items. */
 	MLX5_ASSERT(MLX5_HW_MAX_ITEMS >= 1);
 	if (pt->implicit_port) {
 		if (pt->orig_item_nb + 1 > MLX5_HW_MAX_ITEMS) {
 			rte_errno = ENOMEM;
 			return NULL;
 		}
-		/* Set up represented port item in job descriptor. */
-		job->port_spec = (struct rte_flow_item_ethdev){
+		/* Set up represented port item in pattern params. */
+		pp->port_spec = (struct rte_flow_item_ethdev){
 			.port_id = dev->data->port_id,
 		};
-		job->items[0] = (struct rte_flow_item){
+		pp->items[0] = (struct rte_flow_item){
 			.type = RTE_FLOW_ITEM_TYPE_REPRESENTED_PORT,
-			.spec = &job->port_spec,
+			.spec = &pp->port_spec,
 		};
-		rte_memcpy(&job->items[1], items, sizeof(*items) * pt->orig_item_nb);
-		return job->items;
+		rte_memcpy(&pp->items[1], items, sizeof(*items) * pt->orig_item_nb);
+		return pp->items;
 	} else if (pt->implicit_tag) {
 		if (pt->orig_item_nb + 1 > MLX5_HW_MAX_ITEMS) {
 			rte_errno = ENOMEM;
 			return NULL;
 		}
-		/* Set up tag item in job descriptor. */
-		job->tag_spec = (struct rte_flow_item_tag){
+		/* Set up tag item in pattern params. */
+		pp->tag_spec = (struct rte_flow_item_tag){
 			.data = flow_hw_tx_tag_regc_value(dev),
 		};
-		job->items[0] = (struct rte_flow_item){
+		pp->items[0] = (struct rte_flow_item){
 			.type = (enum rte_flow_item_type)MLX5_RTE_FLOW_ITEM_TYPE_TAG,
-			.spec = &job->tag_spec,
+			.spec = &pp->tag_spec,
 		};
-		rte_memcpy(&job->items[1], items, sizeof(*items) * pt->orig_item_nb);
-		return job->items;
+		rte_memcpy(&pp->items[1], items, sizeof(*items) * pt->orig_item_nb);
+		return pp->items;
 	} else {
 		return items;
 	}
@@ -3364,6 +3364,7 @@ flow_hw_async_flow_create(struct rte_eth_dev *dev,
 	};
 	struct mlx5dr_rule_action *rule_acts;
 	struct mlx5_flow_hw_action_params ap;
+	struct mlx5_flow_hw_pattern_params pp;
 	struct rte_flow_hw *flow = NULL;
 	struct mlx5_hw_q_job *job = NULL;
 	const struct rte_flow_item *rule_items;
@@ -3428,7 +3429,7 @@ flow_hw_async_flow_create(struct rte_eth_dev *dev,
 		goto error;
 	}
 	rule_items = flow_hw_get_rule_items(dev, table, items,
-					    pattern_template_index, job);
+					    pattern_template_index, &pp);
 	if (!rule_items)
 		goto error;
 	if (likely(!rte_flow_template_table_resizable(dev->data->port_id, &table->cfg.attr))) {
@@ -10121,11 +10122,8 @@ flow_hw_configure(struct rte_eth_dev *dev,
 			goto err;
 		}
 		mem_size += (sizeof(struct mlx5_hw_q_job *) +
-			    sizeof(struct mlx5_hw_q_job) +
-			    sizeof(struct rte_flow_item) *
-			    MLX5_HW_MAX_ITEMS +
-				sizeof(struct rte_flow_hw)) *
-			    _queue_attr[i]->size;
+			     sizeof(struct mlx5_hw_q_job) +
+			     sizeof(struct rte_flow_hw)) * _queue_attr[i]->size;
 	}
 	priv->hw_q = mlx5_malloc(MLX5_MEM_ZERO, mem_size,
 				 64, SOCKET_ID_ANY);
@@ -10134,7 +10132,6 @@ flow_hw_configure(struct rte_eth_dev *dev,
 		goto err;
 	}
 	for (i = 0; i < nb_q_updated; i++) {
-		struct rte_flow_item *items = NULL;
 		struct rte_flow_hw *upd_flow = NULL;
 
 		priv->hw_q[i].job_idx = _queue_attr[i]->size;
@@ -10147,12 +10144,8 @@ flow_hw_configure(struct rte_eth_dev *dev,
 				&job[_queue_attr[i - 1]->size - 1].upd_flow[1];
 		job = (struct mlx5_hw_q_job *)
 		      &priv->hw_q[i].job[_queue_attr[i]->size];
-		items = (struct rte_flow_item *)
-			 &job[_queue_attr[i]->size];
-		upd_flow = (struct rte_flow_hw *)
-			&items[_queue_attr[i]->size * MLX5_HW_MAX_ITEMS];
+		upd_flow = (struct rte_flow_hw *)&job[_queue_attr[i]->size];
 		for (j = 0; j < _queue_attr[i]->size; j++) {
-			job[j].items = &items[j * MLX5_HW_MAX_ITEMS];
 			job[j].upd_flow = &upd_flow[j];
 			priv->hw_q[i].job[j] = &job[j];
 		}
@@ -12329,14 +12322,12 @@ flow_hw_calc_table_hash(struct rte_eth_dev *dev,
 			 uint32_t *hash, struct rte_flow_error *error)
 {
 	const struct rte_flow_item *items;
-	/* Temp job to allow adding missing items */
-	static struct rte_flow_item tmp_items[MLX5_HW_MAX_ITEMS];
-	static struct mlx5_hw_q_job job = {.items = tmp_items};
+	struct mlx5_flow_hw_pattern_params pp;
 	int res;
 
 	items = flow_hw_get_rule_items(dev, table, pattern,
 				       pattern_template_index,
-				       &job);
+				       &pp);
 	res = mlx5dr_rule_hash_calculate(mlx5_table_matcher(table), items,
 					 pattern_template_index,
 					 MLX5DR_RULE_HASH_CALC_MODE_RAW,
