From patchwork Tue Sep 4 13:49:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Duszynski X-Patchwork-Id: 44244 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BB45E4F9B; Tue, 4 Sep 2018 15:49:33 +0200 (CEST) Received: from mail-lj1-f193.google.com (mail-lj1-f193.google.com [209.85.208.193]) by dpdk.org (Postfix) with ESMTP id 945DC2D13 for ; Tue, 4 Sep 2018 15:49:28 +0200 (CEST) Received: by mail-lj1-f193.google.com with SMTP id f1-v6so3193107ljc.9 for ; Tue, 04 Sep 2018 06:49:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=j8KUDWso1N84oCd1YwrgDHqam7TiIe6PQ4Sy/GDxrtc=; b=Y+y6Xh0XVy2xjEiAORkksYlXLVQfhYerLMdjmO8w1zFxZPNVipG4/C36TCyrxNq9tz QibtEWIlj23PXAiMu4NQbqgVf8nHpqO0+wDzyjhbrC4qH012D2LDDw6cUvIAVx3v1sOm +z7CB4CIljif8RNIYJzRHoRkIvt9pGfeIQP2or4BjTKU11Fu0ZKUlqxyw+MzpWW9+Nau zNntIe3uOG8dOo7MPXvF3c4FBv8AQnnELgwzCGDOP1YyKBznfVkX2I4b+pDS0/N6dQ70 cb/mfFFPYTphpiJ5jHKN7ZKIpfyLnX+AxTfyCoKa5zE/GPXHfV7aU9LAkL1iHykB0VXk AZgw== 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; bh=j8KUDWso1N84oCd1YwrgDHqam7TiIe6PQ4Sy/GDxrtc=; b=FSKM9ML6lUcleCDFyMnKdu9p7BTBsKuCd2Lz84nFR2jszRzq4/OwuvYsWy0RMNPHhD HECrTJcX0w11139VwMUJsiMElT0CeBR3++MGHP585Xkw53WTGQEHL/ROFfAXdsz+J8Ms Ss0iJlUS6r40c1kGo2VmlyAmVS3RUq/PBWG0KYkvFZgTMiQQGyycLa9KZnKSTefUluhh b5zQkVTq8LEtoI8zv/Loz5q+eaCUQ1fenFvQR05hRF9rnchEfJflPlPPWmRc5y4fpbuX visMiG7YsI7XEyrBJAqq8mdUR0ZS+tIffbpw3lObvPFmXTuc8PzvdmqM00XHWU52jey8 /8vg== X-Gm-Message-State: APzg51Dj/ndPwB1c23ceGv6+QpUlZTbKW1DUyvtaQcP5B/UB4Jutiexp xU8sRJGm0S1vSeM+cHGmKLQHiauBV5MrnQ== X-Google-Smtp-Source: ANB0VdZVU96pIP6ASG4h/DHEPKobr3B9maMKSYiS83E0isN3mErriepx1sb4vOnizvWd7yOTXSEN6g== X-Received: by 2002:a2e:429c:: with SMTP id h28-v6mr20277573ljf.67.1536068968005; Tue, 04 Sep 2018 06:49:28 -0700 (PDT) Received: from sh.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id q22-v6sm4057225lff.10.2018.09.04.06.49.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 04 Sep 2018 06:49:27 -0700 (PDT) From: Tomasz Duszynski To: dev@dpdk.org Cc: nsamsono@marvell.com, mw@semihalf.com, Tomasz Duszynski Date: Tue, 4 Sep 2018 15:49:06 +0200 Message-Id: <1536068953-9352-6-git-send-email-tdu@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1536068953-9352-1-git-send-email-tdu@semihalf.com> References: <1536045016-32008-1-git-send-email-tdu@semihalf.com> <1536068953-9352-1-git-send-email-tdu@semihalf.com> Subject: [dpdk-dev] [PATCH v2 05/12] net/mvpp2: add init and deinit to flow 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" Add init and deinit functionality to flow implementation. Init puts structures used by flow in a sane sate. Deinit deallocates all resources used by flow. Signed-off-by: Tomasz Duszynski Signed-off-by: Natalie Samsonov Reviewed-by: Liron Himi Reviewed-by: Shlomi Gridish --- drivers/net/mvpp2/mrvl_ethdev.c | 3 +++ drivers/net/mvpp2/mrvl_flow.c | 33 ++++++++++++++++++++++++++++++++- drivers/net/mvpp2/mrvl_flow.h | 15 +++++++++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 drivers/net/mvpp2/mrvl_flow.h diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c index 1464385..5e3a106 100644 --- a/drivers/net/mvpp2/mrvl_ethdev.c +++ b/drivers/net/mvpp2/mrvl_ethdev.c @@ -23,6 +23,7 @@ #include #include "mrvl_ethdev.h" #include "mrvl_qos.h" +#include "mrvl_flow.h" #include "mrvl_mtr.h" /* bitmask with reserved hifs */ @@ -628,6 +629,7 @@ mrvl_dev_start(struct rte_eth_dev *dev) goto out; } + mrvl_flow_init(dev); mrvl_mtr_init(dev); return 0; @@ -768,6 +770,7 @@ mrvl_dev_close(struct rte_eth_dev *dev) mrvl_flush_rx_queues(dev); mrvl_flush_tx_shadow_queues(dev); + mrvl_flow_deinit(dev); mrvl_mtr_deinit(dev); for (i = 0; i < priv->ppio_params.inqs_params.num_tcs; ++i) { diff --git a/drivers/net/mvpp2/mrvl_flow.c b/drivers/net/mvpp2/mrvl_flow.c index e6953e4..065b1aa 100644 --- a/drivers/net/mvpp2/mrvl_flow.c +++ b/drivers/net/mvpp2/mrvl_flow.c @@ -11,7 +11,7 @@ #include -#include "mrvl_ethdev.h" +#include "mrvl_flow.h" #include "mrvl_qos.h" /** Number of rules in the classifier table. */ @@ -2790,3 +2790,34 @@ const struct rte_flow_ops mrvl_flow_ops = { .flush = mrvl_flow_flush, .isolate = mrvl_flow_isolate }; + +/** + * Initialize flow resources. + * + * @param dev Pointer to the device. + */ +void +mrvl_flow_init(struct rte_eth_dev *dev) +{ + struct mrvl_priv *priv = dev->data->dev_private; + + LIST_INIT(&priv->flows); +} + +/** + * Cleanup flow resources. + * + * @param dev Pointer to the device. + */ +void +mrvl_flow_deinit(struct rte_eth_dev *dev) +{ + struct mrvl_priv *priv = dev->data->dev_private; + + mrvl_flow_flush(dev, NULL); + + if (priv->cls_tbl) { + pp2_cls_tbl_deinit(priv->cls_tbl); + priv->cls_tbl = NULL; + } +} diff --git a/drivers/net/mvpp2/mrvl_flow.h b/drivers/net/mvpp2/mrvl_flow.h new file mode 100644 index 0000000..f63747c --- /dev/null +++ b/drivers/net/mvpp2/mrvl_flow.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2018 Marvell International Ltd. + * Copyright(c) 2018 Semihalf. + * All rights reserved. + */ + +#ifndef _MRVL_FLOW_H_ +#define _MRVL_FLOW_H_ + +#include "mrvl_ethdev.h" + +void mrvl_flow_init(struct rte_eth_dev *dev); +void mrvl_flow_deinit(struct rte_eth_dev *dev); + +#endif /* _MRVL_FLOW_H_ */