From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ophir Munk Subject: [PATCH v3 2/2] net/mlx4: avoid constant recreations in functions Date: Thu, 10 May 2018 14:21:48 +0000 Message-ID: <1525962108-15215-2-git-send-email-ophirmu@mellanox.com> References: <1525904821-17728-1-git-send-email-ophirmu@mellanox.com> <1525962108-15215-1-git-send-email-ophirmu@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain Cc: Thomas Monjalon , Olga Shern , Ophir Munk , Shahaf Shuler To: dev@dpdk.org, Adrien Mazarguil Return-path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0088.outbound.protection.outlook.com [104.47.1.88]) by dpdk.org (Postfix) with ESMTP id 781271BB16 for ; Thu, 10 May 2018 16:22:08 +0200 (CEST) In-Reply-To: <1525962108-15215-1-git-send-email-ophirmu@mellanox.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Functions mlx4_ibv_to_rss_types() and mlx4_conv_rss_types() contain constant arrays variables which are recreated with every call to the functions. By changing the arrays definitions from "const" to "static const" these recreations can be saved. Signed-off-by: Ophir Munk --- drivers/net/mlx4/mlx4_flow.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/mlx4/mlx4_flow.c b/drivers/net/mlx4/mlx4_flow.c index baad299..6e9b81e 100644 --- a/drivers/net/mlx4/mlx4_flow.c +++ b/drivers/net/mlx4/mlx4_flow.c @@ -91,7 +91,7 @@ uint64_t mlx4_conv_rss_types(struct priv *priv, uint64_t types) { enum { IPV4, IPV6, TCP, UDP, }; - const uint64_t in[] = { + static const uint64_t in[] = { [IPV4] = (ETH_RSS_IPV4 | ETH_RSS_FRAG_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP | @@ -112,7 +112,7 @@ mlx4_conv_rss_types(struct priv *priv, uint64_t types) ETH_RSS_NONFRAG_IPV6_UDP | ETH_RSS_IPV6_UDP_EX), }; - const uint64_t out[RTE_DIM(in)] = { + static const uint64_t out[RTE_DIM(in)] = { [IPV4] = IBV_RX_HASH_SRC_IPV4 | IBV_RX_HASH_DST_IPV4, [IPV6] = IBV_RX_HASH_SRC_IPV6 | IBV_RX_HASH_DST_IPV6, [TCP] = IBV_RX_HASH_SRC_PORT_TCP | IBV_RX_HASH_DST_PORT_TCP, @@ -153,7 +153,7 @@ mlx4_ibv_to_rss_types(uint64_t types) { enum { IPV4, IPV6, IPV4_TCP, IPV6_TCP, IPV4_UDP, IPV6_UDP}; - const uint64_t in[] = { + static const uint64_t in[] = { [IPV4] = IPV4_IBV_HF, [IPV6] = IPV6_IBV_HF, [IPV4_TCP] = IPV4_IBV_HF | TCP_IBV_HF, @@ -161,7 +161,7 @@ mlx4_ibv_to_rss_types(uint64_t types) [IPV4_UDP] = IPV4_IBV_HF | UDP_IBV_HF, [IPV6_UDP] = IPV6_IBV_HF | UDP_IBV_HF, }; - const uint64_t out[RTE_DIM(in)] = { + static const uint64_t out[RTE_DIM(in)] = { [IPV4] = IPV4_RSS_HF, [IPV6] = IPV6_RSS_HF, [IPV4_TCP] = IPV4_RSS_HF | IPV4_TCP_RSS_HF, -- 2.7.4