DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] common/cnxk: fix pointer argument with gcc 12
@ 2021-11-08  9:19 Ankur Dwivedi
  2021-11-11 15:17 ` Jerin Jacob
  0 siblings, 1 reply; 2+ messages in thread
From: Ankur Dwivedi @ 2021-11-08  9:19 UTC (permalink / raw)
  To: dev
  Cc: jerinj, gmuthukrishn, ndabilpuram, kirankumark, skori,
	skoteshwar, Ankur Dwivedi

The pointer passed to the rq_ctx and sq_ctx functions was the address
of qctx. Instead of that qctx should be passed. This patch fixes this.

This patch also resolves warning observed with gcc 12 compiler.

log:
   ../drivers/common/cnxk/cnxk_telemetry.h:12:38: warning: array subscript
   ‘struct nix_cn10k_sq_ctx_s[0]’ is partly outside array bounds of
   ‘volatile void[8]’ [-Warray-bounds]

Bugzilla ID: 853
Fixes: af75aac78978 ("common/cnxk: support telemetry for NIX")

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
Reviewed-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Reviewed-by: Jerin Jacob Kollanukkaran <jerinj@marvell.com>
Tested-by: Jerin Jacob Kollanukkaran <jerinj@marvell.com>
---
 drivers/common/cnxk/cnxk_telemetry_nix.c | 32 +++++++++++++++---------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/drivers/common/cnxk/cnxk_telemetry_nix.c b/drivers/common/cnxk/cnxk_telemetry_nix.c
index 1175f68a51..df6458039d 100644
--- a/drivers/common/cnxk/cnxk_telemetry_nix.c
+++ b/drivers/common/cnxk/cnxk_telemetry_nix.c
@@ -266,9 +266,11 @@ cnxk_tel_nix_sq(struct roc_nix_sq *sq, struct plt_tel_data *d)
 }
 
 static void
-nix_rq_ctx_cn9k(void *qctx, struct plt_tel_data *d)
+nix_rq_ctx_cn9k(volatile void *qctx, struct plt_tel_data *d)
 {
-	struct nix_rq_ctx_s *ctx = (struct nix_rq_ctx_s *)qctx;
+	volatile struct nix_rq_ctx_s *ctx;
+
+	ctx = (volatile struct nix_rq_ctx_s *)qctx;
 
 	/* W0 */
 	CNXK_TEL_DICT_INT(d, ctx, wqe_aura, w0_);
@@ -343,9 +345,11 @@ nix_rq_ctx_cn9k(void *qctx, struct plt_tel_data *d)
 }
 
 static void
-nix_rq_ctx(void *qctx, struct plt_tel_data *d)
+nix_rq_ctx(volatile void *qctx, struct plt_tel_data *d)
 {
-	struct nix_cn10k_rq_ctx_s *ctx = (struct nix_cn10k_rq_ctx_s *)qctx;
+	volatile struct nix_cn10k_rq_ctx_s *ctx;
+
+	ctx = (volatile struct nix_cn10k_rq_ctx_s *)qctx;
 
 	/* W0 */
 	CNXK_TEL_DICT_INT(d, ctx, wqe_aura, w0_);
@@ -453,9 +457,9 @@ cnxk_tel_nix_rq_ctx(struct roc_nix *roc_nix, uint8_t n, struct plt_tel_data *d)
 	}
 
 	if (roc_model_is_cn9k())
-		nix_rq_ctx_cn9k(&qctx, d);
+		nix_rq_ctx_cn9k(qctx, d);
 	else
-		nix_rq_ctx(&qctx, d);
+		nix_rq_ctx(qctx, d);
 
 	return 0;
 }
@@ -512,9 +516,11 @@ cnxk_tel_nix_cq_ctx(struct roc_nix *roc_nix, uint8_t n, struct plt_tel_data *d)
 }
 
 static void
-nix_sq_ctx_cn9k(void *qctx, struct plt_tel_data *d)
+nix_sq_ctx_cn9k(volatile void *qctx, struct plt_tel_data *d)
 {
-	struct nix_sq_ctx_s *ctx = (struct nix_sq_ctx_s *)qctx;
+	volatile struct nix_sq_ctx_s *ctx;
+
+	ctx = (volatile struct nix_sq_ctx_s *)qctx;
 
 	/* W0 */
 	CNXK_TEL_DICT_INT(d, ctx, sqe_way_mask, w0_);
@@ -595,9 +601,11 @@ nix_sq_ctx_cn9k(void *qctx, struct plt_tel_data *d)
 }
 
 static void
-nix_sq_ctx(void *qctx, struct plt_tel_data *d)
+nix_sq_ctx(volatile void *qctx, struct plt_tel_data *d)
 {
-	struct nix_cn10k_sq_ctx_s *ctx = (struct nix_cn10k_sq_ctx_s *)qctx;
+	volatile struct nix_cn10k_sq_ctx_s *ctx;
+
+	ctx = (volatile struct nix_cn10k_sq_ctx_s *)qctx;
 
 	/* W0 */
 	CNXK_TEL_DICT_INT(d, ctx, sqe_way_mask, w0_);
@@ -698,9 +706,9 @@ cnxk_tel_nix_sq_ctx(struct roc_nix *roc_nix, uint8_t n, struct plt_tel_data *d)
 	}
 
 	if (roc_model_is_cn9k())
-		nix_sq_ctx_cn9k(&qctx, d);
+		nix_sq_ctx_cn9k(qctx, d);
 	else
-		nix_sq_ctx(&qctx, d);
+		nix_sq_ctx(qctx, d);
 
 	return 0;
 }
-- 
2.28.0


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

* Re: [dpdk-dev] [PATCH] common/cnxk: fix pointer argument with gcc 12
  2021-11-08  9:19 [dpdk-dev] [PATCH] common/cnxk: fix pointer argument with gcc 12 Ankur Dwivedi
@ 2021-11-11 15:17 ` Jerin Jacob
  0 siblings, 0 replies; 2+ messages in thread
From: Jerin Jacob @ 2021-11-11 15:17 UTC (permalink / raw)
  To: Ankur Dwivedi, Ferruh Yigit
  Cc: dpdk-dev, Jerin Jacob, Gowrishankar Muthukrishnan,
	Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori,
	Satha Koteswara Rao Kottidi

On Mon, Nov 8, 2021 at 2:50 PM Ankur Dwivedi <adwivedi@marvell.com> wrote:
>
> The pointer passed to the rq_ctx and sq_ctx functions was the address
> of qctx. Instead of that qctx should be passed. This patch fixes this.
>
> This patch also resolves warning observed with gcc 12 compiler.
>
> log:
>    ../drivers/common/cnxk/cnxk_telemetry.h:12:38: warning: array subscript
>    ‘struct nix_cn10k_sq_ctx_s[0]’ is partly outside array bounds of
>    ‘volatile void[8]’ [-Warray-bounds]
>
> Bugzilla ID: 853
> Fixes: af75aac78978 ("common/cnxk: support telemetry for NIX")
>
> Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
> Reviewed-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
> Reviewed-by: Jerin Jacob <jerinj@marvell.com>

Applied to dpdk-next-net-mrvl/for-next-net. Thanks


> ---
>  drivers/common/cnxk/cnxk_telemetry_nix.c | 32 +++++++++++++++---------
>  1 file changed, 20 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/common/cnxk/cnxk_telemetry_nix.c b/drivers/common/cnxk/cnxk_telemetry_nix.c
> index 1175f68a51..df6458039d 100644
> --- a/drivers/common/cnxk/cnxk_telemetry_nix.c
> +++ b/drivers/common/cnxk/cnxk_telemetry_nix.c
> @@ -266,9 +266,11 @@ cnxk_tel_nix_sq(struct roc_nix_sq *sq, struct plt_tel_data *d)
>  }
>
>  static void
> -nix_rq_ctx_cn9k(void *qctx, struct plt_tel_data *d)
> +nix_rq_ctx_cn9k(volatile void *qctx, struct plt_tel_data *d)
>  {
> -       struct nix_rq_ctx_s *ctx = (struct nix_rq_ctx_s *)qctx;
> +       volatile struct nix_rq_ctx_s *ctx;
> +
> +       ctx = (volatile struct nix_rq_ctx_s *)qctx;
>
>         /* W0 */
>         CNXK_TEL_DICT_INT(d, ctx, wqe_aura, w0_);
> @@ -343,9 +345,11 @@ nix_rq_ctx_cn9k(void *qctx, struct plt_tel_data *d)
>  }
>
>  static void
> -nix_rq_ctx(void *qctx, struct plt_tel_data *d)
> +nix_rq_ctx(volatile void *qctx, struct plt_tel_data *d)
>  {
> -       struct nix_cn10k_rq_ctx_s *ctx = (struct nix_cn10k_rq_ctx_s *)qctx;
> +       volatile struct nix_cn10k_rq_ctx_s *ctx;
> +
> +       ctx = (volatile struct nix_cn10k_rq_ctx_s *)qctx;
>
>         /* W0 */
>         CNXK_TEL_DICT_INT(d, ctx, wqe_aura, w0_);
> @@ -453,9 +457,9 @@ cnxk_tel_nix_rq_ctx(struct roc_nix *roc_nix, uint8_t n, struct plt_tel_data *d)
>         }
>
>         if (roc_model_is_cn9k())
> -               nix_rq_ctx_cn9k(&qctx, d);
> +               nix_rq_ctx_cn9k(qctx, d);
>         else
> -               nix_rq_ctx(&qctx, d);
> +               nix_rq_ctx(qctx, d);
>
>         return 0;
>  }
> @@ -512,9 +516,11 @@ cnxk_tel_nix_cq_ctx(struct roc_nix *roc_nix, uint8_t n, struct plt_tel_data *d)
>  }
>
>  static void
> -nix_sq_ctx_cn9k(void *qctx, struct plt_tel_data *d)
> +nix_sq_ctx_cn9k(volatile void *qctx, struct plt_tel_data *d)
>  {
> -       struct nix_sq_ctx_s *ctx = (struct nix_sq_ctx_s *)qctx;
> +       volatile struct nix_sq_ctx_s *ctx;
> +
> +       ctx = (volatile struct nix_sq_ctx_s *)qctx;
>
>         /* W0 */
>         CNXK_TEL_DICT_INT(d, ctx, sqe_way_mask, w0_);
> @@ -595,9 +601,11 @@ nix_sq_ctx_cn9k(void *qctx, struct plt_tel_data *d)
>  }
>
>  static void
> -nix_sq_ctx(void *qctx, struct plt_tel_data *d)
> +nix_sq_ctx(volatile void *qctx, struct plt_tel_data *d)
>  {
> -       struct nix_cn10k_sq_ctx_s *ctx = (struct nix_cn10k_sq_ctx_s *)qctx;
> +       volatile struct nix_cn10k_sq_ctx_s *ctx;
> +
> +       ctx = (volatile struct nix_cn10k_sq_ctx_s *)qctx;
>
>         /* W0 */
>         CNXK_TEL_DICT_INT(d, ctx, sqe_way_mask, w0_);
> @@ -698,9 +706,9 @@ cnxk_tel_nix_sq_ctx(struct roc_nix *roc_nix, uint8_t n, struct plt_tel_data *d)
>         }
>
>         if (roc_model_is_cn9k())
> -               nix_sq_ctx_cn9k(&qctx, d);
> +               nix_sq_ctx_cn9k(qctx, d);
>         else
> -               nix_sq_ctx(&qctx, d);
> +               nix_sq_ctx(qctx, d);
>
>         return 0;
>  }
> --
> 2.28.0
>

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

end of thread, other threads:[~2021-11-11 15:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-08  9:19 [dpdk-dev] [PATCH] common/cnxk: fix pointer argument with gcc 12 Ankur Dwivedi
2021-11-11 15:17 ` Jerin Jacob

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