diff mbox series

net/mlx4: make the array states static const, makes object smaller

Message ID 20210801153742.147304-1-colin.king@canonical.com (mailing list archive)
State Accepted
Commit 7cdd0a89ec70ce6a720171f1f7817ee9502b134c
Delegated to: Netdev Maintainers
Headers show
Series net/mlx4: make the array states static const, makes object smaller | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cc_maintainers success CCed 5 of 5 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

Colin King Aug. 1, 2021, 3:37 p.m. UTC
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(-)

Comments

Leon Romanovsky Aug. 2, 2021, 8:44 a.m. UTC | #1
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>
Tariq Toukan Aug. 2, 2021, 10:39 a.m. UTC | #2
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
patchwork-bot+netdevbpf@kernel.org Aug. 2, 2021, 10:10 p.m. UTC | #3
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
diff mbox series

Patch

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,