From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f49.google.com (mail-wm0-f49.google.com [74.125.82.49]) by dpdk.org (Postfix) with ESMTP id 535BE1B222 for ; Thu, 5 Oct 2017 14:50:48 +0200 (CEST) Received: by mail-wm0-f49.google.com with SMTP id u138so1905905wmu.5 for ; Thu, 05 Oct 2017 05:50:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=jhZ6DyUBUGTFdFZ7mYnOCE+BQbRnczBMYmFQgSH89RA=; b=i9OuABSqgAKXhjmErP+4dLn55rV1hmI02F4OF+FSH6B1z32hyjy+dU21jqcmDpKzmH lTvx3fq5IEeMhJeDte5dzpUGexQWP3s0cymym6D+hUsQhXCHWuPKuhlDoFUJCquCu6Fc Pdrl2QZgSWD6PBZMNrI9HbiPL6oVBr4uLviY/u9iokzkOJllEEsfabTx4ev4LbIrYNBB DOLvGa+CHQPiekvYcK23gUodNDvEpWhW6+Xwe1Hl9yMV8kCHfjlgJc55rMXqvuDlEBKa 6/Mlsn9RACi9PUOAnrmD06O8p792g01FcpsFDlB0rv0GJwu8UE70Eb3Lg4PbZWax8jbT Y5Vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=jhZ6DyUBUGTFdFZ7mYnOCE+BQbRnczBMYmFQgSH89RA=; b=qX80VEayQ+M+zU0MyLTZRYfaOCPreyy879YXd1ae25xIN6ft9/AUxU4f6iO24iRDN9 uQsXYhZbX86YAW2+v/cPYgW+YVdH7lPV4u3rE7qhMEH/dy1jMU4soU9vaSDF6XgpnJwJ XaCcSpZaZUrbhhS9uOasEkY6LClGq0gsTMqkGWQQ5GWmZYi8dmetzt8XRo1Z3SP/3ihd gRgeEQhOzaCwLi4wRaASQ+Q7tLbecK952nnNp/Cx5zXXHyrzm46xygbDl5XWIILzgcUa DLIV8jRBjKLTTM3tjxWvQSJfzwpNEblEws676ECP/nMXySfbHQIadyMtk6ZtrvqXsYfn sdcA== X-Gm-Message-State: AMCzsaWz3hJBUJYVzwnPiJ0rkRQ+M8+bZstD7QPq4oticMRyg+nB+Dnk Cp5+2LY4D1vO0XIgP6l5TRlYFhoQtw== X-Google-Smtp-Source: AOwi7QCABdZtxa6oAhxlNNZ3LZthra+8wQyYirRfMtav1Y36bV3fvnnA5XZ7Huu+/N1zWSV3e+uEDw== X-Received: by 10.28.146.211 with SMTP id u202mr17843693wmd.49.1507207847765; Thu, 05 Oct 2017 05:50:47 -0700 (PDT) Received: from ping.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id k9sm26405823wrk.27.2017.10.05.05.50.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 05 Oct 2017 05:50:47 -0700 (PDT) From: Nelio Laranjeiro To: dev@dpdk.org Cc: adrien.mazarguil@6wind.com, yskoh@mellanox.com, ferruh.yigit@intel.com Date: Thu, 5 Oct 2017 14:49:59 +0200 Message-Id: <22abd64aa83af0ba300983cddeb34790c72da02a.1507207731.git.nelio.laranjeiro@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v2 27/30] net/mlx5: move Verbs flows and attributes 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: , X-List-Received-Date: Thu, 05 Oct 2017 12:50:48 -0000 Moves ibv_attr containing the specification of the flow from Verbs point of view also with the verbs flow itself near the related verbs objects making the flow. This is also a preparation to handle correctly the RSS hash configuration provided by the user, has multiple Verbs flows will be necessary for a single generic flow. Signed-off-by: Nelio Laranjeiro --- drivers/net/mlx5/mlx5_flow.c | 46 ++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 2fb50b3..8ada144 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -101,11 +101,15 @@ struct mlx5_hrxq_drop { /* Flows structures. */ struct mlx5_flow { uint64_t hash_fields; /**< Fields that participate in the hash. */ + struct ibv_flow_attr *ibv_attr; /**< Pointer to Verbs attributes. */ + struct ibv_flow *ibv_flow; /**< Verbs flow. */ struct mlx5_hrxq *hrxq; /**< Hash Rx queues. */ }; /* Drop flows structures. */ struct mlx5_flow_drop { + struct ibv_flow_attr *ibv_attr; /**< Pointer to Verbs attributes. */ + struct ibv_flow *ibv_flow; /**< Verbs flow. */ struct mlx5_hrxq_drop hrxq; /**< Drop hash Rx queue. */ }; @@ -113,8 +117,6 @@ struct rte_flow { TAILQ_ENTRY(rte_flow) next; /**< Pointer to the next flow structure. */ uint32_t mark:1; /**< Set if the flow is marked. */ uint32_t drop:1; /**< Drop queue. */ - struct ibv_flow_attr *ibv_attr; /**< Pointer to Verbs attributes. */ - struct ibv_flow *ibv_flow; /**< Verbs flow. */ uint16_t queues_n; /**< Number of entries in queue[]. */ uint16_t (*queues)[]; /**< Queues indexes to use. */ union { @@ -1031,13 +1033,13 @@ priv_flow_create_action_queue_drop(struct priv *priv, }; ++parser->ibv_attr->num_of_specs; parser->offset += sizeof(struct ibv_flow_spec_action_drop); - rte_flow->ibv_attr = parser->ibv_attr; + rte_flow->drxq.ibv_attr = parser->ibv_attr; if (!priv->dev->data->dev_started) return rte_flow; rte_flow->drxq.hrxq.qp = priv->flow_drop_queue->qp; - rte_flow->ibv_flow = ibv_create_flow(rte_flow->drxq.hrxq.qp, - rte_flow->ibv_attr); - if (!rte_flow->ibv_flow) { + rte_flow->drxq.ibv_flow = ibv_create_flow(rte_flow->drxq.hrxq.qp, + rte_flow->drxq.ibv_attr); + if (!rte_flow->drxq.ibv_flow) { rte_flow_error_set(error, ENOMEM, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, "flow rule creation failure"); goto error; @@ -1083,7 +1085,7 @@ priv_flow_create_action_queue(struct priv *priv, return NULL; } rte_flow->mark = parser->mark; - rte_flow->ibv_attr = parser->ibv_attr; + rte_flow->frxq.ibv_attr = parser->ibv_attr; rte_flow->queues = (uint16_t (*)[])(rte_flow + 1); memcpy(rte_flow->queues, parser->queues, parser->queues_n * sizeof(uint16_t)); @@ -1116,9 +1118,9 @@ priv_flow_create_action_queue(struct priv *priv, } if (!priv->dev->data->dev_started) return rte_flow; - rte_flow->ibv_flow = ibv_create_flow(rte_flow->frxq.hrxq->qp, - rte_flow->ibv_attr); - if (!rte_flow->ibv_flow) { + rte_flow->frxq.ibv_flow = ibv_create_flow(rte_flow->frxq.hrxq->qp, + rte_flow->frxq.ibv_attr); + if (!rte_flow->frxq.ibv_flow) { rte_flow_error_set(error, ENOMEM, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, "flow rule creation failure"); goto error; @@ -1336,12 +1338,17 @@ priv_flow_destroy(struct priv *priv, rxq_data->mark = mark; } free: - if (flow->ibv_flow) - claim_zero(ibv_destroy_flow(flow->ibv_flow)); - if (!flow->drop) + if (flow->drop) { + if (flow->drxq.ibv_flow) + claim_zero(ibv_destroy_flow(flow->drxq.ibv_flow)); + rte_free(flow->drxq.ibv_attr); + } else { mlx5_priv_hrxq_release(priv, flow->frxq.hrxq); + if (flow->frxq.ibv_flow) + claim_zero(ibv_destroy_flow(flow->frxq.ibv_flow)); + rte_free(flow->frxq.ibv_attr); + } TAILQ_REMOVE(list, flow, next); - rte_free(flow->ibv_attr); DEBUG("Flow destroyed %p", (void *)flow); rte_free(flow); } @@ -1490,8 +1497,9 @@ priv_flow_stop(struct priv *priv, struct mlx5_flows *list) struct rte_flow *flow; TAILQ_FOREACH_REVERSE(flow, list, mlx5_flows, next) { - claim_zero(ibv_destroy_flow(flow->ibv_flow)); - flow->ibv_flow = NULL; + assert(!flow->drop); + claim_zero(ibv_destroy_flow(flow->frxq.ibv_flow)); + flow->frxq.ibv_flow = NULL; mlx5_priv_hrxq_release(priv, flow->frxq.hrxq); flow->frxq.hrxq = NULL; if (flow->mark) { @@ -1546,9 +1554,9 @@ priv_flow_start(struct priv *priv, struct mlx5_flows *list) return rte_errno; } flow_create: - flow->ibv_flow = ibv_create_flow(flow->frxq.hrxq->qp, - flow->ibv_attr); - if (!flow->ibv_flow) { + flow->frxq.ibv_flow = ibv_create_flow(flow->frxq.hrxq->qp, + flow->frxq.ibv_attr); + if (!flow->frxq.ibv_flow) { DEBUG("Flow %p cannot be applied", (void *)flow); rte_errno = EINVAL; return rte_errno; -- 2.1.4