From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f49.google.com (mail-wm0-f49.google.com [74.125.82.49]) by dpdk.org (Postfix) with ESMTP id 0F89A5591 for ; Mon, 22 Feb 2016 19:19:07 +0100 (CET) Received: by mail-wm0-f49.google.com with SMTP id c200so185127230wme.0 for ; Mon, 22 Feb 2016 10:19:07 -0800 (PST) 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=cD0IJsm/LUqEGtfHVtcQ2WlcF5criDyfuE2CypNMyaQ=; b=ltSopt0NPp7joz31hiuziSepvWC9mTLZe8jmXVO+1t7yG9Lb3bttxGfIDDlkn5I0yc aXYMJngwyjoVhBhIfkUGHo7hIhTGS8WFnfdMj7E9f0r2u/Gohm8frbsYJPWRLJxaOnOd jRaBinRLINUC1r8x0OioFyoXyPhtcY0SkT3fuy8nBGOo2ZaiCUBKRhX7FCufnJZKihOB V7D4qP+GwOoVu74NCbZTfaxXBr0gUtjpnZZ6iF6RJJBN/Tr6DMCewdVm71C4woR4CFaE Pc4PwxfuTTAvqp7yUbQoo88SfdOWC/BIqnzFBpK8fHEBNsdDMpPbOfpnx+MqyMTSw2V8 e9jA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=cD0IJsm/LUqEGtfHVtcQ2WlcF5criDyfuE2CypNMyaQ=; b=NtAwxOgqzsj2xQ7PP7wD/ufXbXrr8IUXQKpIkQ+5qUuxudipeQKA0vZqF1sl5GDX6Q YhepydFtkCA1B1336AV+I6oYTZDS7v9W8d5V1mXKWN/Sny7E2QtX/+pkTVFI8prUj5tV SO99PuaJyRhbBkLl9LrFPS5A00N9w4DXE17PvzBMblQ9lchSb6RX2LLzD7aLl+xWsP6k sFv49i7IbXZoBZWSadoamR1bqrh+VnRdB5rjwBzevGEeZyi6iSnMUE1VUwv5oq/kkWY3 j5o4a82e0lzA8OwrvHqbT+0DRQGEFHtZhPhvSqp4vdWGC49ozfMaPCdm6ZRE8EJNAPLp gatg== X-Gm-Message-State: AG10YOSY4jls/e0ELYn5jdmv5DRPa/CkMwcKaqPv/9BJYp+ZCKDeyrmJTTAGdJ7C2k5DnLdz X-Received: by 10.194.75.164 with SMTP id d4mr28945032wjw.15.1456165146947; Mon, 22 Feb 2016 10:19:06 -0800 (PST) Received: from 6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by smtp.gmail.com with ESMTPSA id x186sm22216050wmg.19.2016.02.22.10.19.05 for (version=TLSv1/SSLv3 cipher=OTHER); Mon, 22 Feb 2016 10:19:06 -0800 (PST) From: Adrien Mazarguil To: dev@dpdk.org Date: Mon, 22 Feb 2016 19:18:39 +0100 Message-Id: <1456165123-28365-4-git-send-email-adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1456165123-28365-1-git-send-email-adrien.mazarguil@6wind.com> References: <1456165123-28365-1-git-send-email-adrien.mazarguil@6wind.com> Subject: [dpdk-dev] [PATCH 3/7] mlx5: manage all special flow types at once X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Feb 2016 18:19:07 -0000 This commit adds helpers to remove redundant code. Signed-off-by: Adrien Mazarguil --- drivers/net/mlx5/mlx5.c | 5 +---- drivers/net/mlx5/mlx5.h | 2 ++ drivers/net/mlx5/mlx5_rxmode.c | 40 ++++++++++++++++++++++++++++++++++++++++ drivers/net/mlx5/mlx5_trigger.c | 10 ++-------- 4 files changed, 45 insertions(+), 12 deletions(-) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index ae2576f..ad69ec2 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -88,10 +88,7 @@ mlx5_dev_close(struct rte_eth_dev *dev) ((priv->ctx != NULL) ? priv->ctx->device->name : "")); /* In case mlx5_dev_stop() has not been called. */ priv_dev_interrupt_handler_uninstall(priv, dev); - priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_ALLMULTI); - priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_PROMISC); - priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_BROADCAST); - priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_IPV6MULTI); + priv_special_flow_disable_all(priv); priv_mac_addrs_disable(priv); priv_destroy_hash_rxqs(priv); diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 8442016..43b24fb 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -199,6 +199,8 @@ int mlx5_dev_rss_reta_update(struct rte_eth_dev *, int priv_special_flow_enable(struct priv *, enum hash_rxq_flow_type); void priv_special_flow_disable(struct priv *, enum hash_rxq_flow_type); +int priv_special_flow_enable_all(struct priv *); +void priv_special_flow_disable_all(struct priv *); void mlx5_promiscuous_enable(struct rte_eth_dev *); void mlx5_promiscuous_disable(struct rte_eth_dev *); void mlx5_allmulticast_enable(struct rte_eth_dev *); diff --git a/drivers/net/mlx5/mlx5_rxmode.c b/drivers/net/mlx5/mlx5_rxmode.c index 9ac7a41..bcf4231 100644 --- a/drivers/net/mlx5/mlx5_rxmode.c +++ b/drivers/net/mlx5/mlx5_rxmode.c @@ -268,6 +268,46 @@ priv_special_flow_disable(struct priv *priv, enum hash_rxq_flow_type flow_type) } /** + * Enable all special flows in all hash RX queues. + * + * @param priv + * Private structure. + */ +int +priv_special_flow_enable_all(struct priv *priv) +{ + enum hash_rxq_flow_type flow_type; + + for (flow_type = 0; flow_type != HASH_RXQ_FLOW_TYPE_MAC; ++flow_type) { + int ret; + + ret = priv_special_flow_enable(priv, flow_type); + if (!ret) + continue; + /* Failure, rollback. */ + while (flow_type) + priv_special_flow_disable(priv, --flow_type); + return ret; + } + return 0; +} + +/** + * Disable all special flows in all hash RX queues. + * + * @param priv + * Private structure. + */ +void +priv_special_flow_disable_all(struct priv *priv) +{ + enum hash_rxq_flow_type flow_type; + + for (flow_type = 0; flow_type != HASH_RXQ_FLOW_TYPE_MAC; ++flow_type) + priv_special_flow_disable(priv, flow_type); +} + +/** * DPDK callback to enable promiscuous mode. * * @param dev diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c index db7890f..b5ca7d4 100644 --- a/drivers/net/mlx5/mlx5_trigger.c +++ b/drivers/net/mlx5/mlx5_trigger.c @@ -80,10 +80,7 @@ mlx5_dev_start(struct rte_eth_dev *dev) " %s", (void *)priv, strerror(err)); /* Rollback. */ - priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_IPV6MULTI); - priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_BROADCAST); - priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_ALLMULTI); - priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_PROMISC); + priv_special_flow_disable_all(priv); priv_mac_addrs_disable(priv); priv_destroy_hash_rxqs(priv); } @@ -113,10 +110,7 @@ mlx5_dev_stop(struct rte_eth_dev *dev) return; } DEBUG("%p: cleaning up and destroying hash RX queues", (void *)dev); - priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_IPV6MULTI); - priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_BROADCAST); - priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_ALLMULTI); - priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_PROMISC); + priv_special_flow_disable_all(priv); priv_mac_addrs_disable(priv); priv_destroy_hash_rxqs(priv); priv_fdir_disable(priv); -- 2.1.4