DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bing Zhao <bingz@mellanox.com>
To: orika@mellanox.com, viacheslavo@mellanox.com,
	rasland@mellanox.com, matan@mellanox.com
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v2 6/6] net/mlx5: do not save device flow matcher value
Date: Tue,  4 Feb 2020 13:33:22 +0200	[thread overview]
Message-ID: <1580816002-159035-7-git-send-email-bingz@mellanox.com> (raw)
In-Reply-To: <1580816002-159035-1-git-send-email-bingz@mellanox.com>

The matcher value is a series of bits with specified format that
defined by the hardware interface. PMD driver needs to translate the
packet header into the matcher format and then used to create the
flow with the lower layer driver.
And this matcher value is only used when creating a flow, and when
destroying it, only the lower layer driver object related to the
matcher needs to be released. So there is no need to save such huge
block information of a device flow.

Signed-off-by: Bing Zhao <bingz@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow.h    |  2 --
 drivers/net/mlx5/mlx5_flow_dv.c | 28 ++++++++++++++++++++--------
 2 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 5e517c3..af30438 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -513,8 +513,6 @@ struct mlx5_flow_dv {
 	struct mlx5_hrxq *hrxq; /**< Hash Rx queues. */
 	/* Flow DV api: */
 	struct mlx5_flow_dv_matcher *matcher; /**< Cache to matcher. */
-	struct mlx5_flow_dv_match_params value;
-	/**< Holds the value that the packet is compared to. */
 	struct mlx5_flow_dv_encap_decap_resource *encap_decap;
 	/**< Pointer to encap/decap resource in cache. */
 	struct mlx5_flow_dv_modify_hdr_resource *modify_hdr;
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 33a3d70..111b01d 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -56,7 +56,7 @@
 
 #define MLX5_ENCAPSULATION_DECISION_SIZE (sizeof(struct rte_flow_item_eth) + \
 					  sizeof(struct rte_flow_item_ipv4))
-/* VLAN header definitions */
+/* VLAN header definitions. */
 #define MLX5DV_FLOW_VLAN_PCP_SHIFT 13
 #define MLX5DV_FLOW_VLAN_PCP_MASK (0x7 << MLX5DV_FLOW_VLAN_PCP_SHIFT)
 #define MLX5DV_FLOW_VLAN_VID_MASK 0x0fff
@@ -75,15 +75,23 @@
 	uint32_t attr;
 };
 
+/* Maximal number of global temporary device flow. */
+#define MLX5DV_FLOW_HANDLE_MAX_NUM 8
 /* Global temporary device flow. */
 struct mlx5_flow sflow;
 /* Global subsidiary device flows actions' list. */
 struct {
 	void *actions[MLX5_DV_MAX_NUMBER_OF_ACTIONS];
+	/**< Action list. */
 	uint64_t hash_fields;
+	/**< Verbs hash Rx queue hash fields. */
+	struct mlx5_flow_dv_match_params value;
+	/**< Holds the value that the packet is compared to. */
 	int actions_n;
-	uint8_t transfer; /**< 1 if the flow is E-Switch flow. */
-} sflow_act[8];
+	/**< number of actions. */
+	uint8_t transfer;
+	/**< 1 if the flow is E-Switch flow. */
+} sflow_act[MLX5DV_FLOW_HANDLE_MAX_NUM];
 
 /**
  * Initialize flow attributes structure according to flow items' types.
@@ -5127,7 +5135,6 @@ struct field_modify_info modify_tcp[] = {
 	}
 	dev_flow->ingress = attr->ingress;
 	dev_flow->transfer = attr->transfer;
-	dv_handle->value.size = MLX5_ST_SZ_BYTES(fte_match_param);
 	/* DV support already defined, compiler will happy for inbox driver. */
 	dev_flow->dv_handle = dv_handle;
 	return dev_flow;
@@ -7097,7 +7104,7 @@ struct field_modify_info modify_tcp[] = {
 	union mlx5_flow_tbl_key tbl_key;
 	uint32_t modify_action_pos = UINT32_MAX;
 	void *match_mask = matcher.mask.buf;
-	void *match_value = dev_flow->dv_handle->value.buf;
+	void *match_value = &sflow_act[sidx].value.buf;
 	uint8_t next_protocol = 0xff;
 	struct rte_vlan_hdr vlan = { 0 };
 	uint32_t table;
@@ -7539,6 +7546,11 @@ struct field_modify_info modify_tcp[] = {
 	sflow_act[sidx].actions_n = actions_n;
 	sflow_act[sidx].transfer = dev_flow->transfer;
 	dev_flow->dv_handle->action_flags = action_flags;
+	/* Matcher size is fixed right now. */
+	sflow_act[sidx].value.size = MLX5_ST_SZ_BYTES(fte_match_param);
+	/* Clear buffer in case of dirty content. */
+	memset(&sflow_act[sidx].value.buf, 0,
+	       MLX5_ST_SZ_BYTES(fte_match_param));
 	for (; items->type != RTE_FLOW_ITEM_TYPE_END; items++) {
 		int tunnel = !!(item_flags & MLX5_FLOW_LAYER_TUNNEL);
 		int item_type = items->type;
@@ -7723,7 +7735,7 @@ struct field_modify_info modify_tcp[] = {
 	}
 #ifdef RTE_LIBRTE_MLX5_DEBUG
 	MLX5_ASSERT(!flow_dv_check_valid_spec(matcher.mask.buf,
-					      dev_flow->dv_handle->value.buf));
+					      sflow_act[sidx].value.buf));
 #endif
 	dev_flow->dv_handle->layers = item_flags;
 	if (action_flags & MLX5_FLOW_ACTION_RSS)
@@ -7820,8 +7832,8 @@ struct field_modify_info modify_tcp[] = {
 		matcher_obj = dv_handle->matcher->matcher_object;
 		dv_handle->flow =
 			mlx5_glue->dv_create_flow(matcher_obj,
-						  (void *)&dv_handle->value,
-						  n, sflow_act[sidx].actions);
+						  &sflow_act[sidx].value, n,
+						  sflow_act[sidx].actions);
 		if (!dv_handle->flow) {
 			rte_flow_error_set(error, errno,
 					   RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
-- 
1.8.3.1


  parent reply	other threads:[~2020-02-04 11:34 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-03 13:32 [dpdk-dev] [PATCH 0/6] net/mlx5: move to non-cached mode for flow rules Bing Zhao
2020-02-03 13:32 ` [dpdk-dev] [PATCH 1/6] net/mlx5: introduce non-cached flows tailq list Bing Zhao
2020-02-03 13:32 ` [dpdk-dev] [PATCH 2/6] net/mlx5: change operations of non-cached flows Bing Zhao
2020-02-03 13:32 ` [dpdk-dev] [PATCH 3/6] net/mlx5: flow type check before creating Bing Zhao
2020-02-03 13:32 ` [dpdk-dev] [PATCH 4/6] net/mlx5: introduce handle structure for DV flows Bing Zhao
2020-02-03 13:32 ` [dpdk-dev] [PATCH 5/6] net/mlx5: remove the DV support macro checking Bing Zhao
2020-02-03 13:32 ` [dpdk-dev] [PATCH 6/6] net/mlx5: do not save device flow matcher value Bing Zhao
2020-02-04 11:33 ` [dpdk-dev] [PATCH v2 0/6] net/mlx5: move to non-cached mode for flow rules Bing Zhao
2020-02-04 11:33   ` [dpdk-dev] [PATCH v2 1/6] net/mlx5: introduce non-cached flows tailq list Bing Zhao
2020-02-04 11:33   ` [dpdk-dev] [PATCH v2 2/6] net/mlx5: change operations of non-cached flows Bing Zhao
2020-02-04 11:33   ` [dpdk-dev] [PATCH v2 3/6] net/mlx5: flow type check before creating Bing Zhao
2020-02-04 11:33   ` [dpdk-dev] [PATCH v2 4/6] net/mlx5: introduce handle structure for DV flows Bing Zhao
2020-02-04 11:33   ` [dpdk-dev] [PATCH v2 5/6] net/mlx5: remove the DV support macro checking Bing Zhao
2020-02-04 11:33   ` Bing Zhao [this message]
2020-03-24 15:16   ` [dpdk-dev] [PATCH v3 0/4] net/mlx5: move to non-cached mode for flow rules Bing Zhao
2020-03-24 15:16     ` [dpdk-dev] [PATCH v3 1/4] net/mlx5: change operations for non-cached flows Bing Zhao
2020-03-24 15:16     ` [dpdk-dev] [PATCH v3 2/4] net/mlx5: reorganize mlx5 flow structures Bing Zhao
2020-03-24 15:16     ` [dpdk-dev] [PATCH v3 3/4] net/mlx5: separate the flow handle resource Bing Zhao
2020-03-24 15:16     ` [dpdk-dev] [PATCH v3 4/4] net/mlx5: check device stat before creating flow Bing Zhao
2020-03-24 15:33   ` [dpdk-dev] [PATCH v4 0/4] net/mlx5: move to non-cached mode for flow rules Bing Zhao
2020-03-24 15:33     ` [dpdk-dev] [PATCH v4 1/4] net/mlx5: change operations for non-cached flows Bing Zhao
2020-03-24 15:33     ` [dpdk-dev] [PATCH v4 2/4] net/mlx5: reorganize mlx5 flow structures Bing Zhao
2020-03-24 15:33     ` [dpdk-dev] [PATCH v4 3/4] net/mlx5: separate the flow handle resource Bing Zhao
2020-03-24 15:34     ` [dpdk-dev] [PATCH v4 4/4] net/mlx5: check device stat before creating flow Bing Zhao
2020-03-25  9:13     ` [dpdk-dev] [PATCH v4 0/4] net/mlx5: move to non-cached mode for flow rules Matan Azrad
2020-03-29 15:50     ` Raslan Darawsheh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1580816002-159035-7-git-send-email-bingz@mellanox.com \
    --to=bingz@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=matan@mellanox.com \
    --cc=orika@mellanox.com \
    --cc=rasland@mellanox.com \
    --cc=viacheslavo@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).