linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/mlx4: make the array states static const, makes object smaller
@ 2021-08-01 15:37 Colin King
  2021-08-02  8:44 ` Leon Romanovsky
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Colin King @ 2021-08-01 15:37 UTC (permalink / raw)
  To: Tariq Toukan, David S . Miller, Jakub Kicinski, netdev, linux-rdma
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Don't populate the array states on the stack but instead it
static const. Makes the object code smaller by 79 bytes.

Before:
   text   data   bss    dec    hex filename
  21309   8304   192  29805   746d drivers/net/ethernet/mellanox/mlx4/qp.o

After:
   text   data   bss    dec    hex filename
  21166   8368   192  29726   741e drivers/net/ethernet/mellanox/mlx4/qp.o

(gcc version 10.2.0)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/ethernet/mellanox/mlx4/qp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/qp.c b/drivers/net/ethernet/mellanox/mlx4/qp.c
index 427e7a31862c..2584bc038f94 100644
--- a/drivers/net/ethernet/mellanox/mlx4/qp.c
+++ b/drivers/net/ethernet/mellanox/mlx4/qp.c
@@ -917,7 +917,7 @@ int mlx4_qp_to_ready(struct mlx4_dev *dev, struct mlx4_mtt *mtt,
 {
 	int err;
 	int i;
-	enum mlx4_qp_state states[] = {
+	static const enum mlx4_qp_state states[] = {
 		MLX4_QP_STATE_RST,
 		MLX4_QP_STATE_INIT,
 		MLX4_QP_STATE_RTR,
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] net/mlx4: make the array states static const, makes object smaller
  2021-08-01 15:37 [PATCH] net/mlx4: make the array states static const, makes object smaller Colin King
@ 2021-08-02  8:44 ` Leon Romanovsky
  2021-08-02 10:39 ` Tariq Toukan
  2021-08-02 22:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Leon Romanovsky @ 2021-08-02  8:44 UTC (permalink / raw)
  To: Colin King
  Cc: Tariq Toukan, David S . Miller, Jakub Kicinski, netdev,
	linux-rdma, kernel-janitors, linux-kernel

On Sun, Aug 01, 2021 at 04:37:42PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate the array states on the stack but instead it
> static const. Makes the object code smaller by 79 bytes.
> 
> Before:
>    text   data   bss    dec    hex filename
>   21309   8304   192  29805   746d drivers/net/ethernet/mellanox/mlx4/qp.o
> 
> After:
>    text   data   bss    dec    hex filename
>   21166   8368   192  29726   741e drivers/net/ethernet/mellanox/mlx4/qp.o
> 
> (gcc version 10.2.0)
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/net/ethernet/mellanox/mlx4/qp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net/mlx4: make the array states static const, makes object smaller
  2021-08-01 15:37 [PATCH] net/mlx4: make the array states static const, makes object smaller Colin King
  2021-08-02  8:44 ` Leon Romanovsky
@ 2021-08-02 10:39 ` Tariq Toukan
  2021-08-02 22:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Tariq Toukan @ 2021-08-02 10:39 UTC (permalink / raw)
  To: Colin King, Tariq Toukan, David S . Miller, Jakub Kicinski,
	netdev, linux-rdma
  Cc: kernel-janitors, linux-kernel



On 8/1/2021 6:37 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate the array states on the stack but instead it
> static const. Makes the object code smaller by 79 bytes.
> 
> Before:
>     text   data   bss    dec    hex filename
>    21309   8304   192  29805   746d drivers/net/ethernet/mellanox/mlx4/qp.o
> 
> After:
>     text   data   bss    dec    hex filename
>    21166   8368   192  29726   741e drivers/net/ethernet/mellanox/mlx4/qp.o
> 
> (gcc version 10.2.0)
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   drivers/net/ethernet/mellanox/mlx4/qp.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx4/qp.c b/drivers/net/ethernet/mellanox/mlx4/qp.c
> index 427e7a31862c..2584bc038f94 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/qp.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/qp.c
> @@ -917,7 +917,7 @@ int mlx4_qp_to_ready(struct mlx4_dev *dev, struct mlx4_mtt *mtt,
>   {
>   	int err;
>   	int i;
> -	enum mlx4_qp_state states[] = {
> +	static const enum mlx4_qp_state states[] = {
>   		MLX4_QP_STATE_RST,
>   		MLX4_QP_STATE_INIT,
>   		MLX4_QP_STATE_RTR,
> 

Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Thanks for your patch.

Regards,
Tariq

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net/mlx4: make the array states static const, makes object smaller
  2021-08-01 15:37 [PATCH] net/mlx4: make the array states static const, makes object smaller Colin King
  2021-08-02  8:44 ` Leon Romanovsky
  2021-08-02 10:39 ` Tariq Toukan
@ 2021-08-02 22:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-08-02 22:10 UTC (permalink / raw)
  To: Colin King
  Cc: tariqt, davem, kuba, netdev, linux-rdma, kernel-janitors, linux-kernel

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Sun,  1 Aug 2021 16:37:42 +0100 you wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate the array states on the stack but instead it
> static const. Makes the object code smaller by 79 bytes.
> 
> Before:
>    text   data   bss    dec    hex filename
>   21309   8304   192  29805   746d drivers/net/ethernet/mellanox/mlx4/qp.o
> 
> [...]

Here is the summary with links:
  - net/mlx4: make the array states static const, makes object smaller
    https://git.kernel.org/netdev/net-next/c/7cdd0a89ec70

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-02 22:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-01 15:37 [PATCH] net/mlx4: make the array states static const, makes object smaller Colin King
2021-08-02  8:44 ` Leon Romanovsky
2021-08-02 10:39 ` Tariq Toukan
2021-08-02 22:10 ` patchwork-bot+netdevbpf

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).