From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by dpdk.org (Postfix) with ESMTP id F23B91B561 for ; Thu, 12 Jul 2018 11:31:30 +0200 (CEST) Received: by mail-wr1-f67.google.com with SMTP id c4-v6so8291146wrs.12 for ; Thu, 12 Jul 2018 02:31:30 -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=BLzOZwSqOBeuAMytfilMXM0Ej8gr/SmP9SULH0K6uYjO7+MYKkFW4WFJHuSDTSgA7M PmWzxK3ky3NL2BsLeEuZC9Ke8S4BVp+dPt47UXWlWM83vRtt3zdgDJtLxdOe5HqxlVXG iutGbHDndk7s6f1DX5xUeye3UJLBTix5wLlvoWjc+xYOa9idm2hllQQder7tPtbfDI4j iW+tjXAUcu/BSMslHKXmbmUXQ1OifXs4R9mtBClG5N35tTIZCTPFOjwTKTNf4Ec/FTc2 Ryh1ayVG8lUhUlqT1WpLS5KIw/F9ZSlQ2E5BpYQwGY96GJz7UNDU9NNMEqV19DNO9kNy qDVQ== 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=OvZJ5zQqU++HIJUUWhlTXKCwBshonhu3oxlqtpFGV7PQFLPk3gCeAcbG9M/UY2Q6KD FLXHm1JKyhf6LWCWKRnk+fvwHNOLwd9PLbt2Y6TgbnNNWpCEycyQJTWCiRwOUGOeK4Cd XoKgkXjxBm6/F4kee3BxV67GoX1Sx1J2jYDb9lpO6XA+mJvJBom/2pdGWqzYc1d62HrF UkJgaY5gFsWgFV5p6K9cIsvS2hzzUCW2UkYPfiYGtkcoxOkiG0NpSKwZxBH93GwMfpnF rPdueCRLh+9/d6wcija8QZSqeWtvJHekRtsoGJnJHxRfJdtzD51dx4RM2Lj6wP7WGnIe NRUw== X-Gm-Message-State: AOUpUlGnt7ToF+P3OCnuhl/LiMkVkV8YkSINCxRvO9MjOPMjYYeOIfdR fNCEzTKdo4GKKrw0Vtnv0PqkQB7oKg== X-Google-Smtp-Source: AAOMgpeNlAy6JyzVfS91VQhL7KzSVu9mrrN6BpDg8BpfPe5VjqVEjzDEmlUvPA4HmgojC2hzBYpdSQ== X-Received: by 2002:adf:a963:: with SMTP id u90-v6mr1228480wrc.248.1531387890065; Thu, 12 Jul 2018 02:31:30 -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 s2-v6sm18717603wrn.75.2018.07.12.02.31.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Jul 2018 02:31:29 -0700 (PDT) From: Nelio Laranjeiro To: dev@dpdk.org, Yongseok Koh Cc: Adrien Mazarguil Date: Thu, 12 Jul 2018 11:30:52 +0200 Message-Id: <02048f950f6b4cf3a2bb203c6b039245c2268c3d.1531387413.git.nelio.laranjeiro@6wind.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v4 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: Thu, 12 Jul 2018 09:31:31 -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