From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 52347A052E; Mon, 3 Feb 2020 14:32:39 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 081511BFE4; Mon, 3 Feb 2020 14:32:36 +0100 (CET) Received: from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130]) by dpdk.org (Postfix) with ESMTP id 8A82A1BFD6 for ; Mon, 3 Feb 2020 14:32:34 +0100 (CET) From: Bing Zhao To: orika@mellanox.com, viacheslavo@mellanox.com, rasland@mellanox.com, matan@mellanox.com Cc: dev@dpdk.org Date: Mon, 3 Feb 2020 15:32:10 +0200 Message-Id: <1580736735-19472-2-git-send-email-bingz@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1580736735-19472-1-git-send-email-bingz@mellanox.com> References: <1580736735-19472-1-git-send-email-bingz@mellanox.com> Subject: [dpdk-dev] [PATCH 1/6] net/mlx5: introduce non-cached flows tailq list X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" A new tailq head is introduced in the mlx5 private structure for each device. Then all the flows created by user are moved into this tailq list. This is the first stage to separate the flows with DV mode from the flows with Verbs mode. Signed-off-by: Bing Zhao --- drivers/net/mlx5/mlx5.c | 3 ++- drivers/net/mlx5/mlx5.h | 3 ++- drivers/net/mlx5/mlx5_flow.c | 16 ++++++++-------- drivers/net/mlx5/mlx5_trigger.c | 6 +++--- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index f80e403..dc4fbbc 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -2674,7 +2674,8 @@ struct mlx5_flow_id_pool * mlx5_ifindex(eth_dev), eth_dev->data->mac_addrs, MLX5_MAX_MAC_ADDRESSES); - TAILQ_INIT(&priv->flows); + TAILQ_INIT(&priv->cached_flows); + TAILQ_INIT(&priv->noncached_flows); TAILQ_INIT(&priv->ctrl_flows); TAILQ_INIT(&priv->flow_meters); TAILQ_INIT(&priv->flow_meter_profiles); diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index d7c519b..65bdb3b 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -515,7 +515,8 @@ struct mlx5_priv { unsigned int (*reta_idx)[]; /* RETA index table. */ unsigned int reta_idx_n; /* RETA index size. */ struct mlx5_drop drop_queue; /* Flow drop queues. */ - struct mlx5_flows flows; /* RTE Flow rules. */ + struct mlx5_flows cached_flows; /* cached RTE Flow rules. */ + struct mlx5_flows noncached_flows; /* non-cached RTE Flow rules. */ struct mlx5_flows ctrl_flows; /* Control flow rules. */ LIST_HEAD(rxq, mlx5_rxq_ctrl) rxqsctrl; /* DPDK Rx queues. */ LIST_HEAD(rxqobj, mlx5_rxq_obj) rxqsobj; /* Verbs/DevX Rx queues. */ diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 144e07c..d7fb094 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -4357,7 +4357,7 @@ struct rte_flow * { struct mlx5_priv *priv = dev->data->dev_private; - return flow_list_create(dev, &priv->flows, + return flow_list_create(dev, &priv->noncached_flows, attr, items, actions, true, error); } @@ -4490,7 +4490,7 @@ struct rte_flow * struct rte_flow *flow; int ret = 0; - TAILQ_FOREACH(flow, &priv->flows, next) { + TAILQ_FOREACH(flow, &priv->noncached_flows, next) { DRV_LOG(DEBUG, "port %u flow %p still referenced", dev->data->port_id, (void *)flow); ++ret; @@ -4674,7 +4674,7 @@ struct rte_flow * { struct mlx5_priv *priv = dev->data->dev_private; - flow_list_destroy(dev, &priv->flows, flow); + flow_list_destroy(dev, &priv->noncached_flows, flow); return 0; } @@ -4690,7 +4690,7 @@ struct rte_flow * { struct mlx5_priv *priv = dev->data->dev_private; - mlx5_flow_list_flush(dev, &priv->flows); + mlx5_flow_list_flush(dev, &priv->noncached_flows); return 0; } @@ -5004,7 +5004,7 @@ struct rte_flow * struct rte_flow *flow = NULL; MLX5_ASSERT(fdir_flow); - TAILQ_FOREACH(flow, &priv->flows, next) { + TAILQ_FOREACH(flow, &priv->noncached_flows, next) { if (flow->fdir && !flow_fdir_cmp(flow->fdir, fdir_flow)) { DRV_LOG(DEBUG, "port %u found FDIR flow %p", dev->data->port_id, (void *)flow); @@ -5047,7 +5047,7 @@ struct rte_flow * rte_errno = EEXIST; goto error; } - flow = flow_list_create(dev, &priv->flows, &fdir_flow->attr, + flow = flow_list_create(dev, &priv->noncached_flows, &fdir_flow->attr, fdir_flow->items, fdir_flow->actions, true, NULL); if (!flow) @@ -5092,7 +5092,7 @@ struct rte_flow * rte_errno = ENOENT; return -rte_errno; } - flow_list_destroy(dev, &priv->flows, flow); + flow_list_destroy(dev, &priv->noncached_flows, flow); DRV_LOG(DEBUG, "port %u deleted FDIR flow %p", dev->data->port_id, (void *)flow); return 0; @@ -5132,7 +5132,7 @@ struct rte_flow * { struct mlx5_priv *priv = dev->data->dev_private; - mlx5_flow_list_flush(dev, &priv->flows); + mlx5_flow_list_flush(dev, &priv->noncached_flows); } /** diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c index be47df5..0053847 100644 --- a/drivers/net/mlx5/mlx5_trigger.c +++ b/drivers/net/mlx5/mlx5_trigger.c @@ -320,7 +320,7 @@ dev->data->port_id); goto error; } - ret = mlx5_flow_start(dev, &priv->flows); + ret = mlx5_flow_start(dev, &priv->noncached_flows); if (ret) { DRV_LOG(DEBUG, "port %u failed to set flows", dev->data->port_id); @@ -337,7 +337,7 @@ ret = rte_errno; /* Save rte_errno before cleanup. */ /* Rollback. */ dev->data->dev_started = 0; - mlx5_flow_stop(dev, &priv->flows); + mlx5_flow_stop(dev, &priv->noncached_flows); mlx5_traffic_disable(dev); mlx5_txq_stop(dev); mlx5_rxq_stop(dev); @@ -367,7 +367,7 @@ mlx5_mp_req_stop_rxtx(dev); usleep(1000 * priv->rxqs_n); DRV_LOG(DEBUG, "port %u stopping device", dev->data->port_id); - mlx5_flow_stop(dev, &priv->flows); + mlx5_flow_stop(dev, &priv->noncached_flows); mlx5_traffic_disable(dev); mlx5_rx_intr_vec_disable(dev); mlx5_dev_interrupt_handler_uninstall(dev); -- 1.8.3.1