From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f54.google.com (mail-wm0-f54.google.com [74.125.82.54]) by dpdk.org (Postfix) with ESMTP id 56E881B1BE for ; Mon, 9 Oct 2017 16:45:48 +0200 (CEST) Received: by mail-wm0-f54.google.com with SMTP id q124so23292730wmb.0 for ; Mon, 09 Oct 2017 07:45: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=YE1FJK9/NBCQStCqvHpAdGW2tOFxw8DaVMJsDZ6ZMWQ=; b=XRssxJk7lTWcW3jo/eeCG70rFP5xgyOs4OLj3gWnv0YiTRgS1JjyKRksosCnTnq2Oc MpcyFTkYDRyCrA6gw0t1NufcFIanAg1UpKqOGRwClKnKEks+dyaUg6nj970/vAzdJ4Fh pb3LX47NBdolRVbg270l0Qzv/yR8CdHTtUh5NWmsgDaETcufHVbpwH5EvQ+Qxso2Au2v iQ2uFgWSf3MbmsHf1uY3avVSMakDywLoC/BccbWEdUp5iLiYaIA/Mti0wr4SQJg02efz Mj130hPPusRkRND7c0PhUAO60Shwc6TfZzVLl4jGNPqBigC+jQVz90Lky/jf8o7RK4Mj Ldrw== 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=YE1FJK9/NBCQStCqvHpAdGW2tOFxw8DaVMJsDZ6ZMWQ=; b=Tkok+YAxCy7kd3NJ3OauVU11E1QbkLSEOVbtvwHMR2jVRYMEQywHiizRHAovhNPjxi wvaIELp3L8thuylqKlBUK5x5ORD5VW5NSReDzRIZwev1bvq07ZyaTHbiPIrCY4QuxKRw YM+tkFg8m4QgjR9q6oSCr9zlv2D6fOswHsRhmhPaAvepxLnLW9+JCqZ6qhTFwNIimOMm DmNudlrYYN38vBJ4HTrF2yHJjyq5ZHfH/Cug7smQ+hXBtwiH4MHS0XKZKFTZXrjvtG2a OcgK5LlWiisASSsuIbzTcp2E3kS6TZJO2L8A1ivQLDIkbhOEdXw+FLhtS1xhZkcIhSDQ 8nkA== X-Gm-Message-State: AMCzsaUO3CNGeU5M3cd2QWuhWvkya+fhg3oucN5DEDZGUzcKNoh5jNpb fQSECE4Xyy5GSRQ33OmYNucaGDgCVw== X-Google-Smtp-Source: AOwi7QAdffDAVjS8Qqd9EyUk7Mj1G1zj/AJBSmUOdg053XzuynuYM9+NUwEO88PMohYRFIRHVOraMw== X-Received: by 10.28.207.130 with SMTP id f124mr6911705wmg.88.1507560347854; Mon, 09 Oct 2017 07:45: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 x15sm6791495wma.32.2017.10.09.07.45.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Oct 2017 07:45:47 -0700 (PDT) From: Nelio Laranjeiro To: dev@dpdk.org Cc: adrien.mazarguil@6wind.com, yskoh@mellanox.com, ferruh.yigit@intel.com Date: Mon, 9 Oct 2017 16:45:03 +0200 Message-Id: <79b004b5e28913b0076fb123471a4f7127730f19.1507560012.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 v3 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: Mon, 09 Oct 2017 14:45: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 Acked-by: Yongseok Koh --- 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 f809ed5..4ff915a 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