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 v6 1/2] net/mlx4: avoid constant recreations in function
Date: Mon, 14 May 2018 10:07:31 +0000 [thread overview]
Message-ID: <1526292452-30482-1-git-send-email-ophirmu@mellanox.com> (raw)
In-Reply-To: <1526230217-21180-1-git-send-email-ophirmu@mellanox.com>
Function mlx4_conv_rss_types() contains constant arrays variables
which are recreated with every call to the function. By changing the
arrays definitions from "const" to "static const" these recreations
can be saved.
Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
---
v1:
Initial release
v2:
Update based on reviews (split into 2 commits)
v3, v4, v5
More updates based on reviews
v6
Following review comments: prefix with MLX4_ all constants
drivers/net/mlx4/mlx4_flow.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/mlx4/mlx4_flow.c b/drivers/net/mlx4/mlx4_flow.c
index 37463b8..f117e2e 100644
--- a/drivers/net/mlx4/mlx4_flow.c
+++ b/drivers/net/mlx4/mlx4_flow.c
@@ -94,7 +94,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 |
@@ -115,7 +115,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,
--
2.7.4
next prev parent reply other threads:[~2018-05-14 10:07 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 ` [dpdk-dev] [PATCH v2 2/2] net/mlx4: avoid constant recreations in functions Ophir Munk
2018-05-10 5:20 ` [dpdk-dev] [PATCH v2 1/2] net/mlx4: advertise supported RSS hash functions 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 ` Ophir Munk [this message]
2018-05-14 10:07 ` [dpdk-dev] [PATCH v6 " 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=1526292452-30482-1-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).