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 v3 2/2] net/mlx4: avoid constant recreations in functions
Date: Thu, 10 May 2018 14:21:48 +0000 [thread overview]
Message-ID: <1525962108-15215-2-git-send-email-ophirmu@mellanox.com> (raw)
In-Reply-To: <1525962108-15215-1-git-send-email-ophirmu@mellanox.com>
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 <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 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
next prev parent reply other threads:[~2018-05-10 14:22 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 ` Ophir Munk [this message]
2018-05-13 6:05 ` [dpdk-dev] [PATCH v3 2/2] net/mlx4: avoid constant recreations in functions 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=1525962108-15215-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).