DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ophir Munk <ophirmu@mellanox.com>
To: dev@dpdk.org, Adrien Mazarguil <adrien.mazarguil@6wind.com>
Cc: Thomas Monjalon <thomas@monjalon.net>,
	Olga Shern <olgas@mellanox.com>,
	Ophir Munk <ophirmu@mellanox.com>,
	Shahaf Shuler <shahafs@mellanox.com>
Subject: [dpdk-dev] [PATCH v2 2/2] net/mlx4: avoid constant recreations in functions
Date: Wed,  9 May 2018 22:27:01 +0000	[thread overview]
Message-ID: <1525904821-17728-2-git-send-email-ophirmu@mellanox.com> (raw)
In-Reply-To: <1525904821-17728-1-git-send-email-ophirmu@mellanox.com>

Functions mlx4_ibv_to_dpdk_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 <ophirmu@mellanox.com>
---
 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 41dac16..47d0403 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,
@@ -152,13 +152,13 @@ uint64_t
 mlx4_ibv_to_dpdk_rss_types(uint64_t types)
 {
 	enum { IPV4, IPV6, TCP, UDP, };
-	const uint64_t in[] = {
+	static const uint64_t 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,
 		[UDP] = IBV_RX_HASH_SRC_PORT_UDP | IBV_RX_HASH_DST_PORT_UDP,
 	};
-	const uint64_t out[RTE_DIM(in)] = {
+	static const uint64_t out[RTE_DIM(in)] = {
 		[IPV4] = (ETH_RSS_IPV4 |
 			  ETH_RSS_FRAG_IPV4 |
 			  ETH_RSS_NONFRAG_IPV4_OTHER),
-- 
2.7.4

  reply	other threads:[~2018-05-09 22:27 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-08 15:43 [dpdk-dev] [PATCH v1] net/mlx4: report on supported RSS hash functions Ophir Munk
2018-05-09  9:38 ` Shahaf Shuler
2018-05-09 11:54   ` Ophir Munk
2018-05-09 14:01     ` Shahaf Shuler
2018-05-09 22:42       ` Ophir Munk
2018-05-09 22:27 ` [dpdk-dev] [PATCH v2 1/2] net/mlx4: advertise " Ophir Munk
2018-05-09 22:27   ` Ophir Munk [this message]
2018-05-10  5:20   ` Shahaf Shuler
2018-05-10 14:25     ` Ophir Munk
2018-05-10 14:21   ` [dpdk-dev] [PATCH v3 " Ophir Munk
2018-05-10 14:21     ` [dpdk-dev] [PATCH v3 2/2] net/mlx4: avoid constant recreations in functions Ophir Munk
2018-05-13  6:05       ` Shahaf Shuler
2018-05-13  6:05     ` [dpdk-dev] [PATCH v3 1/2] net/mlx4: advertise supported RSS hash functions Shahaf Shuler
2018-05-13 15:36     ` [dpdk-dev] [PATCH v4 1/2] net/mlx4: avoid constant recreations in function Ophir Munk
2018-05-13 15:36       ` [dpdk-dev] [PATCH v4 2/2] net/mlx4: advertise supported RSS hash functions Ophir Munk
2018-05-13 15:39     ` [dpdk-dev] [PATCH v4 1/2] net/mlx4: avoid constant recreations in function Ophir Munk
2018-05-13 15:39       ` [dpdk-dev] [PATCH v4 2/2] net/mlx4: advertise supported RSS hash functions Ophir Munk
2018-05-13 16:12         ` Thomas Monjalon
2018-05-13 16:13           ` Ophir Munk
2018-05-13 16:23             ` Ophir Munk
2018-05-13 16:50       ` [dpdk-dev] [PATCH v5 1/2] net/mlx4: avoid constant recreations in function Ophir Munk
2018-05-13 16:50         ` [dpdk-dev] [PATCH v5 2/2] net/mlx4: advertise supported RSS hash functions Ophir Munk
2018-05-14 10:07         ` [dpdk-dev] [PATCH v6 1/2] net/mlx4: avoid constant recreations in function Ophir Munk
2018-05-14 10:07           ` [dpdk-dev] [PATCH v6 2/2] net/mlx4: advertise supported RSS hash functions Ophir Munk
2018-05-14 10:14           ` [dpdk-dev] [PATCH v6 1/2] net/mlx4: avoid constant recreations in function Shahaf Shuler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1525904821-17728-2-git-send-email-ophirmu@mellanox.com \
    --to=ophirmu@mellanox.com \
    --cc=adrien.mazarguil@6wind.com \
    --cc=dev@dpdk.org \
    --cc=olgas@mellanox.com \
    --cc=shahafs@mellanox.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).