DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] base/thunderx: fix build with Gcc 15
@ 2025-01-10 17:27 Stephen Hemminger
  0 siblings, 0 replies; only message in thread
From: Stephen Hemminger @ 2025-01-10 17:27 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Jerin Jacob, Maciej Czekaj

Gcc 15 now produces warning with the base code of Thunderx driver.
The issue is that Gcc now defaults to C23 mode, and the standards
gods have decided that partial initialization of a union has changed.

The fix is to use an empty initializer which forces full initialization.

[2377/3224] Compiling C object drivers/net/thunderx/base/libnicvf_base.a.p/nicvf_mbox.c.o
In function ‘nicvf_mbox_send_msg_to_pf_raw’,
    inlined from ‘nicvf_mbox_send_async_msg_to_pf’ at ../drivers/net/thunderx/base/nicvf_mbox.c:70:2,
    inlined from ‘nicvf_mbox_cfg_done’ at ../drivers/net/thunderx/base/nicvf_mbox.c:468:2:
../drivers/net/thunderx/base/nicvf_mbox.c:59:17: warning: ‘mbx’ is used uninitialized [-Wuninitialized]
   59 |                 nicvf_reg_write(nic, mbx_addr, *mbx_data);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../drivers/net/thunderx/base/nicvf_mbox.c: In function ‘nicvf_mbox_cfg_done’:
../drivers/net/thunderx/base/nicvf_mbox.c:465:24: note: ‘mbx’ declared here
  465 |         struct nic_mbx mbx = { .msg = { 0 } };
      |                        ^~~
In function ‘nicvf_mbox_send_msg_to_pf_raw’,
    inlined from ‘nicvf_mbox_send_async_msg_to_pf’ at ../drivers/net/thunderx/base/nicvf_mbox.c:70:2,
    inlined from ‘nicvf_mbox_link_change’ at ../drivers/net/thunderx/base/nicvf_mbox.c:477:2:
../drivers/net/thunderx/base/nicvf_mbox.c:59:17: warning: ‘mbx’ is used uninitialized [-Wuninitialized]
   59 |                 nicvf_reg_write(nic, mbx_addr, *mbx_data);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../drivers/net/thunderx/base/nicvf_mbox.c: In function ‘nicvf_mbox_link_change’:
../drivers/net/thunderx/base/nicvf_mbox.c:474:24: note: ‘mbx’ declared here
  474 |         struct nic_mbx mbx = { .msg = { 0 } };

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/thunderx/base/nicvf_mbox.c | 42 +++++++++++++-------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/net/thunderx/base/nicvf_mbox.c b/drivers/net/thunderx/base/nicvf_mbox.c
index 0e0176974d..29407f75fa 100644
--- a/drivers/net/thunderx/base/nicvf_mbox.c
+++ b/drivers/net/thunderx/base/nicvf_mbox.c
@@ -212,7 +212,7 @@ int
 nicvf_mbox_set_mac_addr(struct nicvf *nic,
 			const uint8_t mac[NICVF_MAC_ADDR_SIZE])
 {
-	struct nic_mbx mbx = { .msg = {0} };
+	struct nic_mbx mbx = { };
 	int i;
 
 	mbx.msg.msg = NIC_MBOX_MSG_SET_MAC;
@@ -226,7 +226,7 @@ nicvf_mbox_set_mac_addr(struct nicvf *nic,
 int
 nicvf_mbox_config_cpi(struct nicvf *nic, uint32_t qcnt)
 {
-	struct nic_mbx mbx = { .msg = { 0 } };
+	struct nic_mbx mbx = { };
 
 	mbx.msg.msg = NIC_MBOX_MSG_CPI_CFG;
 	mbx.cpi_cfg.vf_id = nic->vf_id;
@@ -239,7 +239,7 @@ nicvf_mbox_config_cpi(struct nicvf *nic, uint32_t qcnt)
 int
 nicvf_mbox_get_rss_size(struct nicvf *nic)
 {
-	struct nic_mbx mbx = { .msg = { 0 } };
+	struct nic_mbx mbx = { };
 
 	mbx.msg.msg = NIC_MBOX_MSG_RSS_SIZE;
 	mbx.rss_size.vf_id = nic->vf_id;
@@ -251,7 +251,7 @@ nicvf_mbox_get_rss_size(struct nicvf *nic)
 int
 nicvf_mbox_config_rss(struct nicvf *nic)
 {
-	struct nic_mbx mbx = { .msg = { 0 } };
+	struct nic_mbx mbx = { };
 	struct nicvf_rss_reta_info *rss = &nic->rss_info;
 	size_t tot_len = rss->rss_size;
 	size_t cur_len;
@@ -284,7 +284,7 @@ int
 nicvf_mbox_rq_config(struct nicvf *nic, uint16_t qidx,
 		     struct pf_rq_cfg *pf_rq_cfg)
 {
-	struct nic_mbx mbx = { .msg = { 0 } };
+	struct nic_mbx mbx = { };
 
 	mbx.msg.msg = NIC_MBOX_MSG_RQ_CFG;
 	mbx.rq.qs_num = nic->vf_id;
@@ -296,7 +296,7 @@ nicvf_mbox_rq_config(struct nicvf *nic, uint16_t qidx,
 int
 nicvf_mbox_sq_config(struct nicvf *nic, uint16_t qidx)
 {
-	struct nic_mbx mbx = { .msg = { 0 } };
+	struct nic_mbx mbx = { };
 
 	mbx.msg.msg = NIC_MBOX_MSG_SQ_CFG;
 	mbx.sq.qs_num = nic->vf_id;
@@ -309,7 +309,7 @@ nicvf_mbox_sq_config(struct nicvf *nic, uint16_t qidx)
 int
 nicvf_mbox_qset_config(struct nicvf *nic, struct pf_qs_cfg *qs_cfg)
 {
-	struct nic_mbx mbx = { .msg = { 0 } };
+	struct nic_mbx mbx = { };
 
 #if NICVF_BYTE_ORDER == NICVF_BIG_ENDIAN
 	qs_cfg->be = 1;
@@ -325,7 +325,7 @@ nicvf_mbox_qset_config(struct nicvf *nic, struct pf_qs_cfg *qs_cfg)
 int
 nicvf_mbox_request_sqs(struct nicvf *nic)
 {
-	struct nic_mbx mbx = { .msg = { 0 } };
+	struct nic_mbx mbx = { };
 	size_t i;
 
 	assert_primary(nic);
@@ -346,7 +346,7 @@ nicvf_mbox_request_sqs(struct nicvf *nic)
 int
 nicvf_mbox_rq_drop_config(struct nicvf *nic, uint16_t qidx, bool enable)
 {
-	struct nic_mbx mbx = { .msg = { 0 } };
+	struct nic_mbx mbx = { };
 	struct pf_rq_drop_cfg *drop_cfg;
 
 	/* Enable CQ drop to reserve sufficient CQEs for all tx packets */
@@ -365,7 +365,7 @@ nicvf_mbox_rq_drop_config(struct nicvf *nic, uint16_t qidx, bool enable)
 int
 nicvf_mbox_update_hw_max_frs(struct nicvf *nic, uint16_t mtu)
 {
-	struct nic_mbx mbx = { .msg = { 0 } };
+	struct nic_mbx mbx = { };
 
 	mbx.msg.msg = NIC_MBOX_MSG_SET_MAX_FRS;
 	mbx.frs.max_frs = mtu;
@@ -376,7 +376,7 @@ nicvf_mbox_update_hw_max_frs(struct nicvf *nic, uint16_t mtu)
 int
 nicvf_mbox_rq_sync(struct nicvf *nic)
 {
-	struct nic_mbx mbx = { .msg = { 0 } };
+	struct nic_mbx mbx = { };
 
 	/* Make sure all packets in the pipeline are written back into mem */
 	mbx.msg.msg = NIC_MBOX_MSG_RQ_SW_SYNC;
@@ -387,7 +387,7 @@ nicvf_mbox_rq_sync(struct nicvf *nic)
 int
 nicvf_mbox_rq_bp_config(struct nicvf *nic, uint16_t qidx, bool enable)
 {
-	struct nic_mbx mbx = { .msg = { 0 } };
+	struct nic_mbx mbx = { };
 
 	mbx.msg.msg = NIC_MBOX_MSG_RQ_BP_CFG;
 	mbx.rq.qs_num = nic->vf_id;
@@ -401,7 +401,7 @@ nicvf_mbox_rq_bp_config(struct nicvf *nic, uint16_t qidx, bool enable)
 int
 nicvf_mbox_loopback_config(struct nicvf *nic, bool enable)
 {
-	struct nic_mbx mbx = { .msg = { 0 } };
+	struct nic_mbx mbx = { };
 
 	mbx.lbk.msg = NIC_MBOX_MSG_LOOPBACK;
 	mbx.lbk.vf_id = nic->vf_id;
@@ -414,7 +414,7 @@ nicvf_mbox_reset_stat_counters(struct nicvf *nic, uint16_t rx_stat_mask,
 			       uint8_t tx_stat_mask, uint16_t rq_stat_mask,
 			       uint16_t sq_stat_mask)
 {
-	struct nic_mbx mbx = { .msg = { 0 } };
+	struct nic_mbx mbx = { };
 
 	mbx.reset_stat.msg = NIC_MBOX_MSG_RESET_STAT_COUNTER;
 	mbx.reset_stat.rx_stat_mask = rx_stat_mask;
@@ -427,7 +427,7 @@ nicvf_mbox_reset_stat_counters(struct nicvf *nic, uint16_t rx_stat_mask,
 int
 nicvf_mbox_set_link_up_down(struct nicvf *nic, bool enable)
 {
-	struct nic_mbx mbx = { .msg = { 0 } };
+	struct nic_mbx mbx = { };
 
 	mbx.lbk.msg = NIC_MBOX_MSG_SET_LINK;
 	mbx.lbk.vf_id = nic->vf_id;
@@ -439,7 +439,7 @@ nicvf_mbox_set_link_up_down(struct nicvf *nic, bool enable)
 int
 nicvf_mbox_change_mode(struct nicvf *nic, struct change_link_mode *cfg)
 {
-	struct nic_mbx mbx = { .msg = { 0 } };
+	struct nic_mbx mbx = { };
 
 	mbx.mode.msg = NIC_MBOX_MSG_CHANGE_MODE;
 	mbx.mode.vf_id = nic->vf_id;
@@ -453,7 +453,7 @@ nicvf_mbox_change_mode(struct nicvf *nic, struct change_link_mode *cfg)
 void
 nicvf_mbox_shutdown(struct nicvf *nic)
 {
-	struct nic_mbx mbx = { .msg = { 0 } };
+	struct nic_mbx mbx = { };
 
 	mbx.msg.msg = NIC_MBOX_MSG_SHUTDOWN;
 	nicvf_mbox_send_msg_to_pf(nic, &mbx);
@@ -462,7 +462,7 @@ nicvf_mbox_shutdown(struct nicvf *nic)
 void
 nicvf_mbox_cfg_done(struct nicvf *nic)
 {
-	struct nic_mbx mbx = { .msg = { 0 } };
+	struct nic_mbx mbx = { };
 
 	mbx.msg.msg = NIC_MBOX_MSG_CFG_DONE;
 	nicvf_mbox_send_async_msg_to_pf(nic, &mbx);
@@ -471,7 +471,7 @@ nicvf_mbox_cfg_done(struct nicvf *nic)
 void
 nicvf_mbox_link_change(struct nicvf *nic)
 {
-	struct nic_mbx mbx = { .msg = { 0 } };
+	struct nic_mbx mbx = { };
 
 	mbx.msg.msg = NIC_MBOX_MSG_BGX_LINK_CHANGE;
 	nicvf_mbox_send_async_msg_to_pf(nic, &mbx);
@@ -480,7 +480,7 @@ nicvf_mbox_link_change(struct nicvf *nic)
 void
 nicvf_mbox_reset_xcast(struct nicvf *nic)
 {
-	struct nic_mbx mbx = { .msg = { 0 } };
+	struct nic_mbx mbx = { };
 
 	mbx.msg.msg = NIC_MBOX_MSG_RESET_XCAST;
 	nicvf_mbox_send_msg_to_pf(nic, &mbx);
@@ -489,7 +489,7 @@ nicvf_mbox_reset_xcast(struct nicvf *nic)
 int
 nicvf_mbox_set_xcast(struct nicvf *nic, uint8_t  mode, uint64_t mac)
 {
-	struct nic_mbx mbx = { .msg = { 0 } };
+	struct nic_mbx mbx = { };
 
 	mbx.xcast.msg = NIC_MBOX_MSG_SET_XCAST;
 	mbx.xcast.mode = mode;
-- 
2.45.2


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-01-10 17:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-10 17:27 [PATCH] base/thunderx: fix build with Gcc 15 Stephen Hemminger

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