diff mbox series

[next] idpf: make read-only arrays tx_itr and rx_itr static const

Message ID 20240822213410.644665-1-colin.i.king@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [next] idpf: make read-only arrays tx_itr and rx_itr static const | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 16 this patch: 16
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 16 this patch: 16
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 16 this patch: 16
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 10 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 54 this patch: 54
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-08-25--21-00 (tests: 714)

Commit Message

Colin Ian King Aug. 22, 2024, 9:34 p.m. UTC
Don't populate the read-only arrays tx_itr and rx_itr on the stack at
run time, instead make them static const.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/net/ethernet/intel/idpf/idpf_virtchnl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Alexander Lobakin Aug. 23, 2024, 12:39 p.m. UTC | #1
From: Colin Ian King <colin.i.king@gmail.com>
Date: Thu, 22 Aug 2024 22:34:10 +0100

> Don't populate the read-only arrays tx_itr and rx_itr on the stack at
> run time, instead make them static const.
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
>  drivers/net/ethernet/intel/idpf/idpf_virtchnl.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
> index 70986e12da28..d50e5cab05fc 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
> @@ -3149,8 +3149,8 @@ void idpf_vport_init(struct idpf_vport *vport, struct idpf_vport_max_q *max_q)
>  	struct idpf_adapter *adapter = vport->adapter;
>  	struct virtchnl2_create_vport *vport_msg;
>  	struct idpf_vport_config *vport_config;
> -	u16 tx_itr[] = {2, 8, 64, 128, 256};
> -	u16 rx_itr[] = {2, 8, 32, 96, 128};
> +	static const u16 tx_itr[] = {2, 8, 64, 128, 256};
> +	static const u16 rx_itr[] = {2, 8, 32, 96, 128};

Move it to the top of the function to keep the RCT style?

>  	struct idpf_rss_data *rss_data;
>  	u16 idx = vport->idx;

Thanks,
Olek
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
index 70986e12da28..d50e5cab05fc 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
@@ -3149,8 +3149,8 @@  void idpf_vport_init(struct idpf_vport *vport, struct idpf_vport_max_q *max_q)
 	struct idpf_adapter *adapter = vport->adapter;
 	struct virtchnl2_create_vport *vport_msg;
 	struct idpf_vport_config *vport_config;
-	u16 tx_itr[] = {2, 8, 64, 128, 256};
-	u16 rx_itr[] = {2, 8, 32, 96, 128};
+	static const u16 tx_itr[] = {2, 8, 64, 128, 256};
+	static const u16 rx_itr[] = {2, 8, 32, 96, 128};
 	struct idpf_rss_data *rss_data;
 	u16 idx = vport->idx;