DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ori Kam <orika@mellanox.com>
To: yskoh@mellanox.com, shahafs@mellanox.com, matan@mellanox.com,
	viacheslavo@mellanox.com, motih@mellanox.com
Cc: dev@dpdk.org, orika@mellanox.com
Subject: [dpdk-dev] [PATCH 5/9] net/mlx5: add port ID item to Direct Verbs
Date: Sun, 14 Apr 2019 21:12:33 +0000	[thread overview]
Message-ID: <1555276357-4892-6-git-send-email-orika@mellanox.com> (raw)
In-Reply-To: <1555276357-4892-1-git-send-email-orika@mellanox.com>

Adds the port ID item to the DV steering code.

Signed-off-by: Ori Kam <orika@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 86 ++++++++++++++++++++++++++++++-----------
 1 file changed, 63 insertions(+), 23 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index fedc6cb..e66ee34 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -3095,6 +3095,64 @@ struct field_modify_info modify_tcp[] = {
 	}
 }
 
+/**
+ * Add source vport match to the specified matcher.
+ *
+ * @param[in, out] matcher
+ *   Flow matcher.
+ * @param[in, out] key
+ *   Flow matcher value.
+ * @param[in] port
+ *   Source vport value to match
+ * @param[in] mask
+ *   Mask
+ */
+static void
+flow_dv_translate_item_source_vport(void *matcher, void *key,
+				    int16_t port, uint16_t mask)
+{
+	void *misc_m = MLX5_ADDR_OF(fte_match_param, matcher, misc_parameters);
+	void *misc_v = MLX5_ADDR_OF(fte_match_param, key, misc_parameters);
+
+	MLX5_SET(fte_match_set_misc, misc_m, source_port, mask);
+	MLX5_SET(fte_match_set_misc, misc_v, source_port, port);
+}
+
+/**
+ * Translate port-id item to eswitch match on  port-id.
+ *
+ * @param[in] dev
+ *   The devich to configure through.
+ * @param[in, out] matcher
+ *   Flow matcher.
+ * @param[in, out] key
+ *   Flow matcher value.
+ * @param[in] item
+ *   Flow pattern to translate.
+ *
+ * @return
+ *   0 on success, a negative errno value otherwise.
+ */
+static int
+flow_dv_eswitch_translate_item_port_id(struct rte_eth_dev *dev,
+				       void *matcher, void *key,
+				       const struct rte_flow_item *item)
+{
+	const struct rte_flow_item_port_id *pid_m = item ? item->mask : NULL;
+	const struct rte_flow_item_port_id *pid_v = item ? item->spec : NULL;
+	uint16_t mask, val, id;
+	int ret;
+
+	mask = pid_m ? pid_m->id : 0xffff;
+	id = pid_v ? pid_v->id : dev->data->port_id;
+	id = mask ? id : dev->data->port_id;
+	ret = mlx5_port_to_eswitch_info(id, NULL, &val);
+	if (ret)
+		return ret;
+	flow_dv_translate_item_source_vport(matcher, key, val, mask);
+	return 0;
+}
+
 static uint32_t matcher_zero[MLX5_ST_SZ_DW(fte_match_param)] = { 0 };
 
 #define HEADER_IS_ZERO(match_criteria, headers)				     \
@@ -3305,29 +3363,6 @@ struct field_modify_info modify_tcp[] = {
 }
 
 /**
- * Add source vport match to the specified matcher.
- *
- * @param[in, out] matcher
- *   Flow matcher.
- * @param[in, out] key
- *   Flow matcher value.
- * @param[in] port
- *   Source vport value to match
- * @param[in] mask
- *   Mask
- */
-static void
-flow_dv_translate_item_source_vport(void *matcher, void *key,
-				    int16_t port, uint16_t mask)
-{
-	void *misc_m = MLX5_ADDR_OF(fte_match_param, matcher, misc_parameters);
-	void *misc_v = MLX5_ADDR_OF(fte_match_param, key, misc_parameters);
-
-	MLX5_SET(fte_match_set_misc, misc_m, source_port, mask);
-	MLX5_SET(fte_match_set_misc, misc_v, source_port, port);
-}
-
-/**
  * Find existing tag resource or create and register a new one.
  *
  * @param dev[in, out]
@@ -3733,6 +3768,11 @@ struct field_modify_info modify_tcp[] = {
 		void *match_value = dev_flow->dv.value.buf;
 
 		switch (items->type) {
+		case RTE_FLOW_ITEM_TYPE_PORT_ID:
+			flow_dv_eswitch_translate_item_port_id
+					(dev, match_mask, match_value, items);
+			last_item = MLX5_FLOW_ITEM_PORT_ID;
+			break;
 		case RTE_FLOW_ITEM_TYPE_ETH:
 			flow_dv_translate_item_eth(match_mask, match_value,
 						   items, tunnel);
-- 
1.8.3.1

  parent reply	other threads:[~2019-04-14 21:13 UTC|newest]

Thread overview: 124+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-14 21:12 [dpdk-dev] [PATCH 0/9] net/mlx5: add Direct Verbs E-Switch support Ori Kam
2019-04-14 21:12 ` Ori Kam
2019-04-14 21:12 ` [dpdk-dev] [PATCH 1/9] net/mlx5: fix translate vport function name Ori Kam
2019-04-14 21:12   ` Ori Kam
2019-04-16 23:47   ` Yongseok Koh
2019-04-16 23:47     ` Yongseok Koh
2019-04-14 21:12 ` [dpdk-dev] [PATCH 2/9] net/mlx5: fix menson compilation with Direct Rules Ori Kam
2019-04-14 21:12   ` Ori Kam
2019-04-17  0:01   ` Yongseok Koh
2019-04-17  0:01     ` Yongseok Koh
2019-04-17  0:34     ` Yongseok Koh
2019-04-17  0:34       ` Yongseok Koh
2019-04-17  5:18       ` Ori Kam
2019-04-17  5:18         ` Ori Kam
2019-04-17  5:18     ` Ori Kam
2019-04-17  5:18       ` Ori Kam
2019-04-14 21:12 ` [dpdk-dev] [PATCH 3/9] net/mlx5: add Direct Rules configuration support Ori Kam
2019-04-14 21:12   ` Ori Kam
2019-04-17  1:42   ` Yongseok Koh
2019-04-17  1:42     ` Yongseok Koh
2019-04-17  6:19     ` Ori Kam
2019-04-17  6:19       ` Ori Kam
2019-04-14 21:12 ` [dpdk-dev] [PATCH 4/9] net/mlx5: add validation for Direct Rule E-Switch Ori Kam
2019-04-14 21:12   ` Ori Kam
2019-04-17 23:59   ` Yongseok Koh
2019-04-17 23:59     ` Yongseok Koh
2019-04-18  4:40     ` Ori Kam
2019-04-18  4:40       ` Ori Kam
2019-04-14 21:12 ` Ori Kam [this message]
2019-04-14 21:12   ` [dpdk-dev] [PATCH 5/9] net/mlx5: add port ID item to Direct Verbs Ori Kam
2019-04-18  0:19   ` Yongseok Koh
2019-04-18  0:19     ` Yongseok Koh
2019-04-18  4:43     ` Ori Kam
2019-04-18  4:43       ` Ori Kam
2019-04-14 21:12 ` [dpdk-dev] [PATCH 6/9] net/mlx5: add transfer attribute to matcher Ori Kam
2019-04-14 21:12   ` Ori Kam
2019-04-18  0:38   ` Yongseok Koh
2019-04-18  0:38     ` Yongseok Koh
2019-04-18  4:57     ` Ori Kam
2019-04-18  4:57       ` Ori Kam
2019-04-14 21:12 ` [dpdk-dev] [PATCH 7/9] net/mlx5: add port ID action to Direct Verbs Ori Kam
2019-04-14 21:12   ` Ori Kam
2019-04-18  0:59   ` Yongseok Koh
2019-04-18  0:59     ` Yongseok Koh
2019-04-18  5:06     ` Ori Kam
2019-04-18  5:06       ` Ori Kam
2019-04-14 21:12 ` [dpdk-dev] [PATCH 8/9] net/mlx5: add Forward Database table type Ori Kam
2019-04-14 21:12   ` Ori Kam
2019-04-18  1:16   ` Yongseok Koh
2019-04-18  1:16     ` Yongseok Koh
2019-04-18  5:13     ` Ori Kam
2019-04-18  5:13       ` Ori Kam
2019-04-14 21:12 ` [dpdk-dev] [PATCH 9/9] net/mlx5: add drop action to Direct Verbs E-Switch Ori Kam
2019-04-14 21:12   ` Ori Kam
2019-04-18  1:28   ` Yongseok Koh
2019-04-18  1:28     ` Yongseok Koh
2019-04-18  5:15     ` Ori Kam
2019-04-18  5:15       ` Ori Kam
2019-04-18 11:28 ` [dpdk-dev] [PATCH v2 0/9] net/mlx5: add Direct Verbs E-Switch support Ori Kam
2019-04-18 11:28   ` Ori Kam
2019-04-18 11:28   ` [dpdk-dev] [PATCH v2 1/9] net/mlx5: fix translate vport function name Ori Kam
2019-04-18 11:28     ` Ori Kam
2019-04-18 12:06     ` Yongseok Koh
2019-04-18 12:06       ` Yongseok Koh
2019-04-18 11:28   ` [dpdk-dev] [PATCH v2 2/9] net/mlx5: fix meson build for Direct Rules Ori Kam
2019-04-18 11:28     ` Ori Kam
2019-04-18 12:09     ` Yongseok Koh
2019-04-18 12:09       ` Yongseok Koh
2019-04-18 11:28   ` [dpdk-dev] [PATCH v2 3/9] net/mlx5: add Direct Rules E-Switch support Ori Kam
2019-04-18 11:28     ` Ori Kam
2019-04-18 12:11     ` Yongseok Koh
2019-04-18 12:11       ` Yongseok Koh
2019-04-18 11:28   ` [dpdk-dev] [PATCH v2 4/9] net/mlx5: add validation for Direct Rule E-Switch Ori Kam
2019-04-18 11:28     ` Ori Kam
2019-04-18 12:16     ` Yongseok Koh
2019-04-18 12:16       ` Yongseok Koh
2019-04-18 11:28   ` [dpdk-dev] [PATCH v2 5/9] net/mlx5: add port ID item to Direct Verbs Ori Kam
2019-04-18 11:28     ` Ori Kam
2019-04-18 12:17     ` Yongseok Koh
2019-04-18 12:17       ` Yongseok Koh
2019-04-18 11:28   ` [dpdk-dev] [PATCH v2 6/9] net/mlx5: add transfer attribute to matcher Ori Kam
2019-04-18 11:28     ` Ori Kam
2019-04-18 12:19     ` Yongseok Koh
2019-04-18 12:19       ` Yongseok Koh
2019-04-18 11:28   ` [dpdk-dev] [PATCH v2 7/9] net/mlx5: add E-Switch port ID action to Direct Verbs Ori Kam
2019-04-18 11:28     ` Ori Kam
2019-04-18 12:19     ` Yongseok Koh
2019-04-18 12:19       ` Yongseok Koh
2019-04-18 11:28   ` [dpdk-dev] [PATCH v2 8/9] net/mlx5: add Forward Database table type Ori Kam
2019-04-18 11:28     ` Ori Kam
2019-04-18 12:21     ` Yongseok Koh
2019-04-18 12:21       ` Yongseok Koh
2019-04-18 11:28   ` [dpdk-dev] [PATCH v2 9/9] net/mlx5: add drop action to Direct Verbs E-Switch Ori Kam
2019-04-18 11:28     ` Ori Kam
2019-04-18 12:28     ` Yongseok Koh
2019-04-18 12:28       ` Yongseok Koh
2019-04-18 13:15 ` [dpdk-dev] [PATCH v3 0/9] net/mlx5: add Direct Verbs E-Switch support Ori Kam
2019-04-18 13:15   ` Ori Kam
2019-04-18 13:15   ` [dpdk-dev] [PATCH v3 1/9] net/mlx5: fix translate vport function name Ori Kam
2019-04-18 13:15     ` Ori Kam
2019-04-18 13:16   ` [dpdk-dev] [PATCH v3 2/9] net/mlx5: fix meson build for Direct Rules Ori Kam
2019-04-18 13:16     ` Ori Kam
2019-04-18 13:16   ` [dpdk-dev] [PATCH v3 3/9] net/mlx5: add Direct Rules E-Switch support Ori Kam
2019-04-18 13:16     ` Ori Kam
2019-04-18 13:16   ` [dpdk-dev] [PATCH v3 4/9] net/mlx5: add validation for Direct Rule E-Switch Ori Kam
2019-04-18 13:16     ` Ori Kam
2019-04-18 13:16   ` [dpdk-dev] [PATCH v3 5/9] net/mlx5: add port ID item to Direct Verbs Ori Kam
2019-04-18 13:16     ` Ori Kam
2019-04-18 13:16   ` [dpdk-dev] [PATCH v3 6/9] net/mlx5: add transfer attribute to matcher Ori Kam
2019-04-18 13:16     ` Ori Kam
2019-04-18 13:16   ` [dpdk-dev] [PATCH v3 7/9] net/mlx5: add E-Switch port ID action to Direct Verbs Ori Kam
2019-04-18 13:16     ` Ori Kam
2019-04-18 13:16   ` [dpdk-dev] [PATCH v3 8/9] net/mlx5: add Forward Database table type Ori Kam
2019-04-18 13:16     ` Ori Kam
2019-04-18 13:16   ` [dpdk-dev] [PATCH v3 9/9] net/mlx5: add drop action to Direct Verbs E-Switch Ori Kam
2019-04-18 13:16     ` Ori Kam
2019-04-18 13:23     ` Yongseok Koh
2019-04-18 13:23       ` Yongseok Koh
2019-04-18 13:47       ` Ori Kam
2019-04-18 13:47         ` Ori Kam
2019-04-18 18:14         ` Shahaf Shuler
2019-04-18 18:14           ` Shahaf Shuler
2019-04-18 18:55   ` [dpdk-dev] [PATCH v3 0/9] net/mlx5: add Direct Verbs E-Switch support Shahaf Shuler
2019-04-18 18:55     ` Shahaf Shuler

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=1555276357-4892-6-git-send-email-orika@mellanox.com \
    --to=orika@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=matan@mellanox.com \
    --cc=motih@mellanox.com \
    --cc=shahafs@mellanox.com \
    --cc=viacheslavo@mellanox.com \
    --cc=yskoh@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).