DPDK patches and discussions
 help / color / mirror / Atom feed
* [RFC 0/3] common/cnxk: remove dependence on VLA
@ 2025-10-23 19:41 Stephen Hemminger
  2025-10-23 19:41 ` [RFC 1/3] common/cnxk: replace variable length state array Stephen Hemminger
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stephen Hemminger @ 2025-10-23 19:41 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

While looking at LTO compile failures, it looks like the cnxk common
code can be modified to not use VLA's. This fixes one of the compile
problems there.

Compile tested only!

Stephen Hemminger (3):
  common/cnxk: replace variable length state array
  common/cnxk: replace variable length array
  common/cnxk: re-enable vla warnings

 drivers/common/cnxk/meson.build    | 2 --
 drivers/common/cnxk/roc_aes.c      | 3 ++-
 drivers/common/cnxk/roc_platform.c | 4 ++--
 3 files changed, 4 insertions(+), 5 deletions(-)

-- 
2.51.0


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

* [RFC 1/3] common/cnxk: replace variable length state array
  2025-10-23 19:41 [RFC 0/3] common/cnxk: remove dependence on VLA Stephen Hemminger
@ 2025-10-23 19:41 ` Stephen Hemminger
  2025-10-23 19:41 ` [RFC 2/3] common/cnxk: replace variable length array Stephen Hemminger
  2025-10-23 19:41 ` [RFC 3/3] common/cnxk: re-enable vla warnings Stephen Hemminger
  2 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2025-10-23 19:41 UTC (permalink / raw)
  To: dev
  Cc: Stephen Hemminger, Nithin Dabilpuram, Kiran Kumar K,
	Sunil Kumar Kori, Satha Rao, Harman Kalra

The cipher function is always called with in_len = 16
and there is an existing define for that.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/common/cnxk/roc_aes.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/common/cnxk/roc_aes.c b/drivers/common/cnxk/roc_aes.c
index d84feb546a..e51cf532d7 100644
--- a/drivers/common/cnxk/roc_aes.c
+++ b/drivers/common/cnxk/roc_aes.c
@@ -157,9 +157,10 @@ static void
 cipher(uint8_t *in, uint8_t *out, uint32_t *ks, uint32_t key_rounds, uint8_t in_len)
 {
 	uint8_t data_word_len = in_len / sizeof(uint32_t);
-	uint32_t state[data_word_len];
+	uint32_t state[AES_HASH_KEY_LEN / sizeof(uint32_t)];
 	unsigned int i, round;
 
+	RTE_ASSERT(data_word_len <= AES_HASH_KEY_LEN);
 	memcpy(state, in, sizeof(state));
 
 	/* AddRoundKey(state, w[0, Nb-1]) // See Sec. 5.1.4 */
-- 
2.51.0


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

* [RFC 2/3] common/cnxk: replace variable length array
  2025-10-23 19:41 [RFC 0/3] common/cnxk: remove dependence on VLA Stephen Hemminger
  2025-10-23 19:41 ` [RFC 1/3] common/cnxk: replace variable length state array Stephen Hemminger
@ 2025-10-23 19:41 ` Stephen Hemminger
  2025-10-23 19:41 ` [RFC 3/3] common/cnxk: re-enable vla warnings Stephen Hemminger
  2 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2025-10-23 19:41 UTC (permalink / raw)
  To: dev
  Cc: Stephen Hemminger, Nithin Dabilpuram, Kiran Kumar K,
	Sunil Kumar Kori, Satha Rao, Harman Kalra

This fixes errors when compiled with LTO about large VLA.
../drivers/common/cnxk/roc_platform.c: In function ‘irq_init’:
../drivers/common/cnxk/roc_platform.c:92:14: warning: argument to variable-length array is too large [-Wvla-larger-than=]
   92 |         char irq_set_buf[MSIX_IRQ_SET_BUF_LEN];
      |              ^

Since the number of IRQ is limited by EAL max interrupt vectors
use that define that already exists rather than a function call
hidden in a macro.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/common/cnxk/roc_platform.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/common/cnxk/roc_platform.c b/drivers/common/cnxk/roc_platform.c
index e13cb42285..1fdbf8f051 100644
--- a/drivers/common/cnxk/roc_platform.c
+++ b/drivers/common/cnxk/roc_platform.c
@@ -17,8 +17,8 @@
 #include <sys/ioctl.h>
 #include <unistd.h>
 
-#define MSIX_IRQ_SET_BUF_LEN                                                                       \
-	(sizeof(struct vfio_irq_set) + sizeof(int) * (plt_intr_max_intr_get(intr_handle)))
+#define MSIX_IRQ_SET_BUF_LEN							\
+	(sizeof(struct vfio_irq_set) + sizeof(int) * PLT_MAX_RXTX_INTR_VEC_ID)
 
 static int
 irq_get_info(struct plt_intr_handle *intr_handle)
-- 
2.51.0


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

* [RFC 3/3] common/cnxk: re-enable vla warnings
  2025-10-23 19:41 [RFC 0/3] common/cnxk: remove dependence on VLA Stephen Hemminger
  2025-10-23 19:41 ` [RFC 1/3] common/cnxk: replace variable length state array Stephen Hemminger
  2025-10-23 19:41 ` [RFC 2/3] common/cnxk: replace variable length array Stephen Hemminger
@ 2025-10-23 19:41 ` Stephen Hemminger
  2 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2025-10-23 19:41 UTC (permalink / raw)
  To: dev
  Cc: Stephen Hemminger, Nithin Dabilpuram, Kiran Kumar K,
	Sunil Kumar Kori, Satha Rao, Harman Kalra

The code in common/cnxk no longer uses VLA's.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/common/cnxk/meson.build | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/common/cnxk/meson.build b/drivers/common/cnxk/meson.build
index daffc15afd..58ebf4c99f 100644
--- a/drivers/common/cnxk/meson.build
+++ b/drivers/common/cnxk/meson.build
@@ -94,8 +94,6 @@ sources += files('cnxk_telemetry_bphy.c',
                  'cnxk_telemetry_sso.c',
 )
 
-cflags += no_wvla_cflag
-
 if meson.is_cross_build()
     soc_type = meson.get_external_property('platform', '')
 else
-- 
2.51.0


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

end of thread, other threads:[~2025-10-23 19:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-23 19:41 [RFC 0/3] common/cnxk: remove dependence on VLA Stephen Hemminger
2025-10-23 19:41 ` [RFC 1/3] common/cnxk: replace variable length state array Stephen Hemminger
2025-10-23 19:41 ` [RFC 2/3] common/cnxk: replace variable length array Stephen Hemminger
2025-10-23 19:41 ` [RFC 3/3] common/cnxk: re-enable vla warnings 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).