From patchwork Tue Aug 1 16:54:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrien Mazarguil X-Patchwork-Id: 27326 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 14B55A132; Tue, 1 Aug 2017 18:55:30 +0200 (CEST) Received: from mail-wr0-f182.google.com (mail-wr0-f182.google.com [209.85.128.182]) by dpdk.org (Postfix) with ESMTP id DC51FA0D2 for ; Tue, 1 Aug 2017 18:55:10 +0200 (CEST) Received: by mail-wr0-f182.google.com with SMTP id v105so9274693wrb.0 for ; Tue, 01 Aug 2017 09:55:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=CUPqG/4gVu+FW4iLjlOzfUM/Df1UeOqQ1HdK2gDAf4k=; b=U8Iwrd8lmxIar7GYhT0bbrSqbWdg7DBeQW73Jd6MTh5SzXkz73/dw/XBytrZ6asyzX eNQSasFzb+/xNnzAMn3iB6zjF8CTR5YemShBBNuYwq9iPYreoZbfiqXe1Clt6NopSf0r bB/4ebwmunrgBx/2uTM80MWJaVwiIqHEggu+wH6L4bP9yS2oAgxQ8xanlzcxxX9B4HM5 IFWvleK1zj6vvzEobo9Q59sf7W/b0is06r8MhTWwq14Q2xJQ2yfPPR+9QU51BJ26I+rJ Itf6XGmpq0R97XXg3UTlrN/7MIJNXFSIGJrh+jMxLmBAuAG3PvVg2EDTR70N9YHKHgF2 aaKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=CUPqG/4gVu+FW4iLjlOzfUM/Df1UeOqQ1HdK2gDAf4k=; b=pYsQUVm+03Vy2Sc8QeX2Nd9tfDTlqA0nr+jaaPQ/aa9Z7jX/NXl9wNygmZspoZht3K XCYKGWBQ4qwcr+zzy1MxzKXADAup1MlVNoy+MVPbvS8ozG4xw5O+YOz40dFDSCHuqJwq 73blz1jSyHXsz6unoDSXAzJyyKTGIxBNhDIhGc2esO5wmawg+8WLIk08cdnbDuV5WLgo FRJ7Y3PFKDvAo0CBXIZx8rK99M/lLCdGBKUIeytlMZeRaEZrjzhZiLA7wcv96tc07+Ul 3Ivf3qJbH9D+9sWfChqtF6YTTjTXnafb9RujzZi+XCkGmI20XMCyzZfXWZNIsH2+3kT+ t5iw== X-Gm-Message-State: AIVw111eHMY1gVAkJFBMoYwr9iRsiNwzJoiijy2y8iJEA8cWbBj0KqRH fDvsqs4h0pPjJ/Yoxes= X-Received: by 10.223.150.200 with SMTP id u66mr18238747wrb.216.1501606510184; Tue, 01 Aug 2017 09:55:10 -0700 (PDT) Received: from 6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id v2sm22190457wra.2.2017.08.01.09.55.08 for (version=TLS1_2 cipher=AES128-SHA bits=128/128); Tue, 01 Aug 2017 09:55:08 -0700 (PDT) From: Adrien Mazarguil To: dev@dpdk.org Date: Tue, 1 Aug 2017 18:54:01 +0200 Message-Id: <4e2af92c95c91ad87871273da16703da27157af0.1501598384.git.adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v1 14/48] net/mlx4: revert flow API RSS support 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" This reverts commit d7769c7c08cc08a9d1bc4e40b95524d9697707d9. Existing RSS features rely on experimental Verbs provided by Mellanox OFED. In order to replace this dependency with standard distribution packages, RSS support must be temporarily removed to be re-implemented using a different API. Removing support for the RSS flow rule action is the first step toward this goal. Signed-off-by: Adrien Mazarguil --- drivers/net/mlx4/mlx4.c | 6 +- drivers/net/mlx4/mlx4.h | 5 - drivers/net/mlx4/mlx4_flow.c | 206 +++----------------------------------- drivers/net/mlx4/mlx4_flow.h | 3 +- 4 files changed, 20 insertions(+), 200 deletions(-) diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index c11e789..4aef6a3 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -533,7 +533,7 @@ priv_mac_addr_del(struct priv *priv); * @return * Pointer to a parent rxq structure, NULL on failure. */ -struct rxq * +static struct rxq * priv_parent_create(struct priv *priv, uint16_t queues[], uint16_t children_n) @@ -670,8 +670,10 @@ dev_configure(struct rte_eth_dev *dev) priv->rss = 1; tmp = priv->rxqs_n; priv->rxqs_n = rxqs_n; - if (priv->isolated) + if (priv->isolated) { + priv->rss = 0; return 0; + } if (priv_parent_create(priv, NULL, priv->rxqs_n)) return 0; /* Failure, rollback. */ diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h index 23ffc87..301b193 100644 --- a/drivers/net/mlx4/mlx4.h +++ b/drivers/net/mlx4/mlx4.h @@ -285,9 +285,4 @@ rxq_create_qp(struct rxq *rxq, void rxq_parent_cleanup(struct rxq *parent); -struct rxq * -priv_parent_create(struct priv *priv, - uint16_t queues[], - uint16_t children_n); - #endif /* RTE_PMD_MLX4_H_ */ diff --git a/drivers/net/mlx4/mlx4_flow.c b/drivers/net/mlx4/mlx4_flow.c index f5c015e..827115e 100644 --- a/drivers/net/mlx4/mlx4_flow.c +++ b/drivers/net/mlx4/mlx4_flow.c @@ -109,7 +109,6 @@ struct rte_flow_drop { static const enum rte_flow_action_type valid_actions[] = { RTE_FLOW_ACTION_TYPE_DROP, RTE_FLOW_ACTION_TYPE_QUEUE, - RTE_FLOW_ACTION_TYPE_RSS, RTE_FLOW_ACTION_TYPE_END, }; @@ -670,76 +669,6 @@ priv_flow_validate(struct priv *priv, if (!queue || (queue->index > (priv->rxqs_n - 1))) goto exit_action_not_supported; action.queue = 1; - action.queues_n = 1; - action.queues[0] = queue->index; - } else if (actions->type == RTE_FLOW_ACTION_TYPE_RSS) { - int i; - int ierr; - const struct rte_flow_action_rss *rss = - (const struct rte_flow_action_rss *) - actions->conf; - - if (!priv->hw_rss) { - rte_flow_error_set(error, ENOTSUP, - RTE_FLOW_ERROR_TYPE_ACTION, - actions, - "RSS cannot be used with " - "the current configuration"); - return -rte_errno; - } - if (!priv->isolated) { - rte_flow_error_set(error, ENOTSUP, - RTE_FLOW_ERROR_TYPE_ACTION, - actions, - "RSS cannot be used without " - "isolated mode"); - return -rte_errno; - } - if (!rte_is_power_of_2(rss->num)) { - rte_flow_error_set(error, ENOTSUP, - RTE_FLOW_ERROR_TYPE_ACTION, - actions, - "the number of queues " - "should be power of two"); - return -rte_errno; - } - if (priv->max_rss_tbl_sz < rss->num) { - rte_flow_error_set(error, ENOTSUP, - RTE_FLOW_ERROR_TYPE_ACTION, - actions, - "the number of queues " - "is too large"); - return -rte_errno; - } - /* checking indexes array */ - ierr = 0; - for (i = 0; i < rss->num; ++i) { - int j; - if (rss->queue[i] >= priv->rxqs_n) - ierr = 1; - /* - * Prevent the user from specifying - * the same queue twice in the RSS array. - */ - for (j = i + 1; j < rss->num && !ierr; ++j) - if (rss->queue[j] == rss->queue[i]) - ierr = 1; - if (ierr) { - rte_flow_error_set( - error, - ENOTSUP, - RTE_FLOW_ERROR_TYPE_HANDLE, - NULL, - "RSS action only supports " - "unique queue indices " - "in a list"); - return -rte_errno; - } - } - action.queue = 1; - action.queues_n = rss->num; - for (i = 0; i < rss->num; ++i) - action.queues[i] = rss->queue[i]; } else { goto exit_action_not_supported; } @@ -865,82 +794,6 @@ mlx4_flow_create_drop_queue(struct priv *priv) } /** - * Get RSS parent rxq structure for given queues. - * - * Creates a new or returns an existed one. - * - * @param priv - * Pointer to private structure. - * @param queues - * queues indices array, NULL in default RSS case. - * @param children_n - * the size of queues array. - * - * @return - * Pointer to a parent rxq structure, NULL on failure. - */ -static struct rxq * -priv_parent_get(struct priv *priv, - uint16_t queues[], - uint16_t children_n, - struct rte_flow_error *error) -{ - unsigned int i; - struct rxq *parent; - - for (parent = LIST_FIRST(&priv->parents); - parent; - parent = LIST_NEXT(parent, next)) { - unsigned int same = 0; - unsigned int overlap = 0; - - /* - * Find out whether an appropriate parent queue already exists - * and can be reused, otherwise make sure there are no overlaps. - */ - for (i = 0; i < children_n; ++i) { - unsigned int j; - - for (j = 0; j < parent->rss.queues_n; ++j) { - if (parent->rss.queues[j] != queues[i]) - continue; - ++overlap; - if (i == j) - ++same; - } - } - if (same == children_n && - children_n == parent->rss.queues_n) - return parent; - else if (overlap) - goto error; - } - /* Exclude the cases when some QPs were created without RSS */ - for (i = 0; i < children_n; ++i) { - struct rxq *rxq = (*priv->rxqs)[queues[i]]; - if (rxq->qp) - goto error; - } - parent = priv_parent_create(priv, queues, children_n); - if (!parent) { - rte_flow_error_set(error, - ENOMEM, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, - NULL, "flow rule creation failure"); - return NULL; - } - return parent; - -error: - rte_flow_error_set(error, - EEXIST, - RTE_FLOW_ERROR_TYPE_UNSPECIFIED, - NULL, - "sharing a queue between several" - " RSS groups is not supported"); - return NULL; -} - -/** * Complete flow rule creation. * * @param priv @@ -963,7 +816,6 @@ priv_flow_create_action_queue(struct priv *priv, { struct ibv_qp *qp; struct rte_flow *rte_flow; - struct rxq *rxq_parent = NULL; assert(priv->pd); assert(priv->ctx); @@ -977,38 +829,23 @@ priv_flow_create_action_queue(struct priv *priv, qp = priv->flow_drop_queue ? priv->flow_drop_queue->qp : NULL; } else { int ret; - unsigned int i; - struct rxq *rxq = NULL; - - if (action->queues_n > 1) { - rxq_parent = priv_parent_get(priv, action->queues, - action->queues_n, error); - if (!rxq_parent) + struct rxq *rxq = (*priv->rxqs)[action->queue_id]; + + if (!rxq->qp) { + assert(priv->isolated); + ret = rxq_create_qp(rxq, rxq->elts_n, + 0, 0, NULL); + if (ret) { + rte_flow_error_set( + error, + ENOMEM, + RTE_FLOW_ERROR_TYPE_HANDLE, + NULL, + "flow rule creation failure"); goto error; - } - for (i = 0; i < action->queues_n; ++i) { - rxq = (*priv->rxqs)[action->queues[i]]; - /* - * In case of isolated mode we postpone - * ibv receive queue creation till the first - * rte_flow rule will be applied on that queue. - */ - if (!rxq->qp) { - assert(priv->isolated); - ret = rxq_create_qp(rxq, rxq->elts_n, - 0, 0, rxq_parent); - if (ret) { - rte_flow_error_set( - error, - ENOMEM, - RTE_FLOW_ERROR_TYPE_HANDLE, - NULL, - "flow rule creation failure"); - goto error; - } } } - qp = action->queues_n > 1 ? rxq_parent->qp : rxq->qp; + qp = rxq->qp; rte_flow->qp = qp; } rte_flow->ibv_attr = ibv_attr; @@ -1023,8 +860,6 @@ priv_flow_create_action_queue(struct priv *priv, return rte_flow; error: - if (rxq_parent) - rxq_parent_cleanup(rxq_parent); rte_free(rte_flow); return NULL; } @@ -1088,22 +923,11 @@ priv_flow_create(struct priv *priv, continue; } else if (actions->type == RTE_FLOW_ACTION_TYPE_QUEUE) { action.queue = 1; - action.queues_n = 1; - action.queues[0] = + action.queue_id = ((const struct rte_flow_action_queue *) actions->conf)->index; } else if (actions->type == RTE_FLOW_ACTION_TYPE_DROP) { action.drop = 1; - } else if (actions->type == RTE_FLOW_ACTION_TYPE_RSS) { - unsigned int i; - const struct rte_flow_action_rss *rss = - (const struct rte_flow_action_rss *) - actions->conf; - - action.queue = 1; - action.queues_n = rss->num; - for (i = 0; i < rss->num; ++i) - action.queues[i] = rss->queue[i]; } else { rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, diff --git a/drivers/net/mlx4/mlx4_flow.h b/drivers/net/mlx4/mlx4_flow.h index 4654dc2..17e5f6e 100644 --- a/drivers/net/mlx4/mlx4_flow.h +++ b/drivers/net/mlx4/mlx4_flow.h @@ -98,8 +98,7 @@ mlx4_flow_isolate(struct rte_eth_dev *dev, struct mlx4_flow_action { uint32_t drop:1; /**< Target is a drop queue. */ uint32_t queue:1; /**< Target is a receive queue. */ - uint16_t queues[RTE_MAX_QUEUES_PER_PORT]; /**< Queue indices to use. */ - uint16_t queues_n; /**< Number of entries in queue[] */ + uint32_t queue_id; /**< Identifier of the queue. */ }; int mlx4_priv_flow_start(struct priv *priv);