DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dekel Peled <dekelp@mellanox.com>
To: matan@mellanox.com, viacheslavo@mellanox.com, rasland@mellanox.com
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 4/6] net/mlx5: add OS specific flow type selection
Date: Sun, 28 Jun 2020 17:06:53 +0300
Message-ID: <2354f1a5073b61e10959c5749392277fd41dc7ca.1593352527.git.dekelp@mellanox.com> (raw)
In-Reply-To: <cover.1593352527.git.dekelp@mellanox.com>

In current implementation the flow type (DV/Verbs) is selected
using dedicated function flow_get_drv_type().

This patch adds OS specific function mlx5_flow_os_get_type(), to
allow OS specific flow type selection.
The new function is called by flow_get_drv_type(), and if it returns a
valid value (DV/Verbs) no more logic is required.
Otherwise the existing logic is executed.

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
---
 drivers/net/mlx5/linux/mlx5_flow_os.h | 18 ++++++++++++++++++
 drivers/net/mlx5/mlx5_flow.c          | 10 ++++++----
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/drivers/net/mlx5/linux/mlx5_flow_os.h b/drivers/net/mlx5/linux/mlx5_flow_os.h
index 4ad4e0a..41691a1 100644
--- a/drivers/net/mlx5/linux/mlx5_flow_os.h
+++ b/drivers/net/mlx5/linux/mlx5_flow_os.h
@@ -5,6 +5,24 @@
 #ifndef RTE_PMD_MLX5_FLOW_OS_H_
 #define RTE_PMD_MLX5_FLOW_OS_H_
 
+#include "mlx5_flow.h"
+
+#ifdef HAVE_IBV_FLOW_DV_SUPPORT
+extern const struct mlx5_flow_driver_ops mlx5_flow_dv_drv_ops;
+#endif
+
+/**
+ * Get OS enforced flow type. MLX5_FLOW_TYPE_MAX means "non enforced type".
+ *
+ * @return
+ *   Flow type (MLX5_FLOW_TYPE_MAX)
+ */
+static inline enum mlx5_flow_drv_type
+mlx5_flow_os_get_type(void)
+{
+	return MLX5_FLOW_TYPE_MAX;
+}
+
 /**
  * Check if item type is supported.
  *
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 4700ec1..b8468c1 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -36,12 +36,10 @@
 #include "mlx5_defs.h"
 #include "mlx5.h"
 #include "mlx5_flow.h"
+#include "mlx5_flow_os.h"
 #include "mlx5_rxtx.h"
 
 /** Device flow drivers. */
-#ifdef HAVE_IBV_FLOW_DV_SUPPORT
-extern const struct mlx5_flow_driver_ops mlx5_flow_dv_drv_ops;
-#endif
 extern const struct mlx5_flow_driver_ops mlx5_flow_verbs_drv_ops;
 
 const struct mlx5_flow_driver_ops mlx5_flow_null_drv_ops;
@@ -2501,8 +2499,12 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,
 flow_get_drv_type(struct rte_eth_dev *dev, const struct rte_flow_attr *attr)
 {
 	struct mlx5_priv *priv = dev->data->dev_private;
-	enum mlx5_flow_drv_type type = MLX5_FLOW_TYPE_MAX;
+	/* The OS can determine first a specific flow type (DV, VERBS) */
+	enum mlx5_flow_drv_type type = mlx5_flow_os_get_type();
 
+	if (type != MLX5_FLOW_TYPE_MAX)
+		return type;
+	/* If no OS specific type - continue with DV/VERBS selection */
 	if (attr->transfer && priv->config.dv_esw_en)
 		type = MLX5_FLOW_TYPE_DV;
 	if (!attr->transfer)
-- 
1.8.3.1


  parent reply	other threads:[~2020-06-28 14:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-28 14:06 [dpdk-dev] [PATCH 0/6] net/mlx5: refactor flow infrastructure Dekel Peled
2020-06-28 14:06 ` [dpdk-dev] [PATCH 1/6] net/mlx5: rename IB flow to generic name DRV flow Dekel Peled
2020-06-28 14:06 ` [dpdk-dev] [PATCH 2/6] net/mlx5: rename Verbs action to generic name Dekel Peled
2020-06-28 14:06 ` [dpdk-dev] [PATCH 3/6] net/mlx5: add OS specific flow related utilities Dekel Peled
2020-06-28 14:06 ` Dekel Peled [this message]
2020-06-28 14:06 ` [dpdk-dev] [PATCH 5/6] net/mlx5: add OS specific flow create and destroy Dekel Peled
2020-06-28 14:06 ` [dpdk-dev] [PATCH 6/6] net/mlx5: add OS specific flow actions operations Dekel Peled
2020-07-01 13:12 ` [dpdk-dev] [PATCH 0/6] net/mlx5: refactor flow infrastructure 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=2354f1a5073b61e10959c5749392277fd41dc7ca.1593352527.git.dekelp@mellanox.com \
    --to=dekelp@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=matan@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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git