DPDK patches and discussions
 help / color / mirror / Atom feed
From: Harman Kalra <hkalra@marvell.com>
To: Stephen Hemminger <stephen@networkplumber.org>,
	"dev@dpdk.org" <dev@dpdk.org>
Cc: Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>,
	Kiran Kumar Kokkilagadda <kirankumark@marvell.com>,
	Sunil Kumar Kori <skori@marvell.com>,
	Satha Koteswara Rao Kottidi <skoteshwar@marvell.com>
Subject: Re: [EXTERNAL] [RFC 2/3] common/cnxk: replace variable length array
Date: Mon, 27 Oct 2025 05:22:05 +0000	[thread overview]
Message-ID: <IA1PR18MB5470E4E3CF00DDA23D06AE54C5FCA@IA1PR18MB5470.namprd18.prod.outlook.com> (raw)
In-Reply-To: <20251023194237.197681-3-stephen@networkplumber.org>

Hi Stephen,

Please find response inline.

Thanks
Harman


________________________________________
From: Stephen Hemminger <stephen@networkplumber.org>
Sent: Friday, October 24, 2025 01:11
To: dev@dpdk.org
Cc: Stephen Hemminger; Nithin Kumar Dabilpuram; Kiran Kumar Kokkilagadda; Sunil Kumar Kori; Satha Koteswara Rao Kottidi; Harman Kalra
Subject: [EXTERNAL] [RFC 2/3] common/cnxk: replace variable length array

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=]
ZjQcmQRYFpfptBannerStart
Prioritize security for external emails:
Confirm sender and content safety before clicking links or opening attachments
<https://us-phishalarm-ewt.proofpoint.com/EWT/v1/CRVmXkqW!tq3Z1f8UAlXatG-dmV0aDgUiMX3k-TnFTMUNNDwBiTqsiDtPNHuGKbTZiCNYBjBSFK8C-DKdl6dvUuA0rM6hZ29mZZl_Zctb5JHJ$>
Report Suspicious

ZjQcmQRYFpfptBannerEnd

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)


[HK] The value of MSIX_IRQ_SET_BUF_LEN should be derived from the maximum number of interrupts configured for a PCI device,
as obtained via plt_intr_max_intr_get(intr_handle), which internally uses the VFIO_DEVICE_GET_IRQ_INFO ioctl.
In contrast, PLT_MAX_RXTX_INTR_VEC_ID is a fixed default value representing the maximum number of interrupt vectors.
This mismatch may lead to unexpected behaviour as on certain platforms (like cnxk) where the PCI device's MSIX capability
may exceed PLT_MAX_RXTX_INTR_VEC_ID.

 static int
 irq_get_info(struct plt_intr_handle *intr_handle)
--
2.51.0



  reply	other threads:[~2025-10-27  5:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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-27  5:22   ` Harman Kalra [this message]
2025-10-23 19:41 ` [RFC 3/3] common/cnxk: re-enable vla warnings Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=IA1PR18MB5470E4E3CF00DDA23D06AE54C5FCA@IA1PR18MB5470.namprd18.prod.outlook.com \
    --to=hkalra@marvell.com \
    --cc=dev@dpdk.org \
    --cc=kirankumark@marvell.com \
    --cc=ndabilpuram@marvell.com \
    --cc=skori@marvell.com \
    --cc=skoteshwar@marvell.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).