All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shahaf Shuler <shahafs@mellanox.com>
To: Ophir Munk <ophirmu@mellanox.com>, "dev@dpdk.org" <dev@dpdk.org>,
	"Adrien Mazarguil" <adrien.mazarguil@6wind.com>
Cc: Thomas Monjalon <thomas@monjalon.net>, Olga Shern <olgas@mellanox.com>
Subject: Re: [PATCH v3 2/2] net/mlx4: avoid constant recreations in functions
Date: Sun, 13 May 2018 06:05:40 +0000	[thread overview]
Message-ID: <DB7PR05MB4426FABD9A43D66C80FFE6E5C39D0@DB7PR05MB4426.eurprd05.prod.outlook.com> (raw)
In-Reply-To: <1525962108-15215-2-git-send-email-ophirmu@mellanox.com>

Thursday, May 10, 2018 5:22 PM, Ophir Munk:
> Subject: [PATCH v3 2/2] net/mlx4: avoid constant recreations in functions
> 
> 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)] = {

Since there is another version, it is better to have this patch first with the above fixes.

>  		[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[] = {

And this one can be done as part of the "advertise supported RSS ..." commit. 

It is better to have the fix/clean patch first, and then to introduce the new code. 

>  		[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

  reply	other threads:[~2018-05-13  6:05 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-08 15:43 [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 ` [PATCH v2 1/2] net/mlx4: advertise " Ophir Munk
2018-05-09 22:27   ` [PATCH v2 2/2] net/mlx4: avoid constant recreations in functions Ophir Munk
2018-05-10  5:20   ` [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   ` [PATCH v3 " Ophir Munk
2018-05-10 14:21     ` [PATCH v3 2/2] net/mlx4: avoid constant recreations in functions Ophir Munk
2018-05-13  6:05       ` Shahaf Shuler [this message]
2018-05-13  6:05     ` [PATCH v3 1/2] net/mlx4: advertise supported RSS hash functions Shahaf Shuler
2018-05-13 15:36     ` [PATCH v4 1/2] net/mlx4: avoid constant recreations in function Ophir Munk
2018-05-13 15:36       ` [PATCH v4 2/2] net/mlx4: advertise supported RSS hash functions Ophir Munk
2018-05-13 15:39     ` [PATCH v4 1/2] net/mlx4: avoid constant recreations in function Ophir Munk
2018-05-13 15:39       ` [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       ` [PATCH v5 1/2] net/mlx4: avoid constant recreations in function Ophir Munk
2018-05-13 16:50         ` [PATCH v5 2/2] net/mlx4: advertise supported RSS hash functions Ophir Munk
2018-05-14 10:07         ` [PATCH v6 1/2] net/mlx4: avoid constant recreations in function Ophir Munk
2018-05-14 10:07           ` [PATCH v6 2/2] net/mlx4: advertise supported RSS hash functions Ophir Munk
2018-05-14 10:14           ` [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=DB7PR05MB4426FABD9A43D66C80FFE6E5C39D0@DB7PR05MB4426.eurprd05.prod.outlook.com \
    --to=shahafs@mellanox.com \
    --cc=adrien.mazarguil@6wind.com \
    --cc=dev@dpdk.org \
    --cc=olgas@mellanox.com \
    --cc=ophirmu@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.