From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by dpdk.org (Postfix) with ESMTP id 541111B4CF for ; Wed, 11 Jul 2018 09:23:23 +0200 (CEST) Received: by mail-wm0-f66.google.com with SMTP id s14-v6so1409169wmc.1 for ; Wed, 11 Jul 2018 00:23:23 -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; bh=Ccw4CjKG9Rqt+pwxyhFq3+hXv9opIbWyMqT/Y9RoQS8=; b=hY1nt15q1xPWUaX/BhHvgKA3qZ7oDtAXAukyO0MJNymrXgg63qSUoII74Pgb8Dg+WS /4DzF8RhCzeXu7qAp/4fUpahaTicBrmP53nxf88eRc+PYRps8IgkIPKVhmvIzmsPXkC6 JvV44SX1ZQ6rBcn+99YS9nowD0i5mOM5ZBsOaIkoXJOov/9ija9fVsN6jVNNllsYkzuS phuvHHFg5LS7dlAaaiJHO7GHd2FydBxTbW3KtFq/WuC9lKhorSYmGuqhqywEqBWA32vN iS6dXXWH7nZnik2LKapeKOv5cDjg61xsE7iODk2yWAZLZbdt5dVHEYF+/mK41M3xxKmP X49A== 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=Ccw4CjKG9Rqt+pwxyhFq3+hXv9opIbWyMqT/Y9RoQS8=; b=ntWh6VG74UClznhji2H6Aba9uPCiknN407JWSeZ/zEBMG09EqYngx0E69ZVYXT6nam fwK7ruZHw13VCHXYjx9mEh5g7JgDlt+KslTmJZLqJirbYaP+7O/lGhZCuJK6ehhYEX2u QKp/OPn7nWEBrehe2NlRVsYP3JHvWPZdmyMgFchTpQLIsC8RQokK2Cn0cygH4W9rknD6 BOaYtuEuf5Q2s1DOO2IbG4UCAN0opa7/CmJlw3UFtOR56mzzKjutxtrcp7Ti3QaC12cD XLsWNfT71w23flv20KS9d9Q7Rbb/Snk5Cdj3tgJ5kptodQsp0/lKBafYg55qvvodHs1Y OVUQ== X-Gm-Message-State: APt69E3OqxwmPDlof+fEUWxmvGZW0eK77aXKAlvycOl4cyCisE74KXK5 jvWWrvBBViqUXlgopeLPrITYucAXyg== X-Google-Smtp-Source: AAOMgpeTw0TkO/mGB/9i8QQTuNq2LFGcmERYDyYlOu/wvCJftLghLDI3iC/nOovFaBfYy8dyjSUQoA== X-Received: by 2002:a1c:c44f:: with SMTP id u76-v6mr16186079wmf.43.1531293802915; Wed, 11 Jul 2018 00:23:22 -0700 (PDT) Received: from laranjeiro-vm.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id t10-v6sm31314212wre.95.2018.07.11.00.23.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jul 2018 00:23:22 -0700 (PDT) From: Nelio Laranjeiro To: dev@dpdk.org, Yongseok Koh Cc: Adrien Mazarguil Date: Wed, 11 Jul 2018 09:22:39 +0200 Message-Id: X-Mailer: git-send-email 2.18.0 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v3 06/21] net/mlx5: add flow stop/start 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: Wed, 11 Jul 2018 07:23:23 -0000 Signed-off-by: Nelio Laranjeiro Acked-by: Yongseok Koh --- drivers/net/mlx5/mlx5_flow.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 6041a4573..77f1bd5cc 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -908,9 +908,12 @@ mlx5_flow_list_flush(struct rte_eth_dev *dev, struct mlx5_flows *list) * Pointer to a TAILQ flow list. */ void -mlx5_flow_stop(struct rte_eth_dev *dev __rte_unused, - struct mlx5_flows *list __rte_unused) +mlx5_flow_stop(struct rte_eth_dev *dev, struct mlx5_flows *list) { + struct rte_flow *flow; + + TAILQ_FOREACH_REVERSE(flow, list, mlx5_flows, next) + mlx5_flow_remove(dev, flow); } /** @@ -925,10 +928,23 @@ mlx5_flow_stop(struct rte_eth_dev *dev __rte_unused, * 0 on success, a negative errno value otherwise and rte_errno is set. */ int -mlx5_flow_start(struct rte_eth_dev *dev __rte_unused, - struct mlx5_flows *list __rte_unused) +mlx5_flow_start(struct rte_eth_dev *dev, struct mlx5_flows *list) { + struct rte_flow *flow; + struct rte_flow_error error; + int ret = 0; + + TAILQ_FOREACH(flow, list, next) { + ret = mlx5_flow_apply(dev, flow, &error); + if (ret < 0) + goto error; + } return 0; +error: + ret = rte_errno; /* Save rte_errno before cleanup. */ + mlx5_flow_stop(dev, list); + rte_errno = ret; /* Restore rte_errno. */ + return -rte_errno; } /** -- 2.18.0