Skip to contentSkip to conversation

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

PATCH In review Colin Ian King 2 participants 2 messages Aug 22, 2024 – Aug 23, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 idpf: make read-only arrays tx_itr and rx_itr static const

Don't populate the read-only arrays tx_itr and rx_itr on the stack at run time, instead make them static const.

---
 drivers/net/ethernet/intel/idpf/idpf_virtchnl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/idpf/idpf_virtchnl.c +2 -2
index 70986e12da28..d50e5cab05fc 100644
@@ -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;
 
Signature · 1 line
2.39.2
#1 lore raw

From: Colin Ian King <[email protected]>
Date: Thu, 22 Aug 2024 22:34:10 +0100

Quoted 13 lines

Don't populate the read-only arrays tx_itr and rx_itr on the stack at run time, instead make them static const.

---
 drivers/net/ethernet/intel/idpf/idpf_virtchnl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/idpf/idpf_virtchnl.c +0 -0
index 70986e12da28..d50e5cab05fc 100644

drivers/net/ethernet/intel/idpf/idpf_virtchnl.c void idpf_vport_init(struct idpf_vport *vport, struct idpf_vport_max_q *max_q) · line 3153

Quoted 7 lines
drivers/net/ethernet/intel/idpf/idpf_virtchnl.c +2 -2
@@ -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?

drivers/net/ethernet/intel/idpf/idpf_virtchnl.c void idpf_vport_init(struct idpf_vport *vport, struct idpf_vport_max_q *max_q) · line 3155

Quoted 2 lines
drivers/net/ethernet/intel/idpf/idpf_virtchnl.c +0 -0
 	struct idpf_rss_data *rss_data;
 	u16 idx = vport->idx;

Thanks,
Olek