patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Hemant Agrawal <hemant.agrawal@nxp.com>
To: dev@dpdk.org
Cc: ferruh.yigit@amd.com, Rohit Raj <rohit.raj@nxp.com>,
	hemant.agrawal@nxp.com, stable@dpdk.org
Subject: [PATCH v5 02/18] net/dpaa: fix typecasting ch ID to u32
Date: Tue,  1 Oct 2024 16:33:09 +0530	[thread overview]
Message-ID: <20241001110325.4173762-3-hemant.agrawal@nxp.com> (raw)
In-Reply-To: <20241001110325.4173762-1-hemant.agrawal@nxp.com>

From: Rohit Raj <rohit.raj@nxp.com>

Avoid typecasting ch_id to u32 and passing it to another API since it
can corrupt other data. Instead, create new u32 variable and typecase
it back to u16 after it gets updated by the API.

Fixes: 0c504f6950b6 ("net/dpaa: support push mode")
Cc: hemant.agrawal@nxp.com
Cc: stable@dpdk.org

Signed-off-by: Rohit Raj <rohit.raj@nxp.com>
---
 drivers/net/dpaa/dpaa_ethdev.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index 060b8c678f..1a2de5240f 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -972,7 +972,7 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 	struct fman_if *fif = dev->process_private;
 	struct qman_fq *rxq = &dpaa_intf->rx_queues[queue_idx];
 	struct qm_mcc_initfq opts = {0};
-	u32 flags = 0;
+	u32 ch_id, flags = 0;
 	int ret;
 	u32 buffsz = rte_pktmbuf_data_room_size(mp) - RTE_PKTMBUF_HEADROOM;
 	uint32_t max_rx_pktlen;
@@ -1096,7 +1096,9 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 						DPAA_IF_RX_CONTEXT_STASH;
 
 		/*Create a channel and associate given queue with the channel*/
-		qman_alloc_pool_range((u32 *)&rxq->ch_id, 1, 1, 0);
+		qman_alloc_pool_range(&ch_id, 1, 1, 0);
+		rxq->ch_id = (u16)ch_id;
+
 		opts.we_mask = opts.we_mask | QM_INITFQ_WE_DESTWQ;
 		opts.fqd.dest.channel = rxq->ch_id;
 		opts.fqd.dest.wq = DPAA_IF_RX_PRIORITY;
-- 
2.25.1


  parent reply	other threads:[~2024-10-01 11:03 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20240801105313.630280-1-hemant.agrawal@nxp.com>
2024-08-01 10:52 ` [PATCH 01/17] bus/dpaa: fix PFDRs leaks due to FQRNIs Hemant Agrawal
2024-08-01 10:52 ` [PATCH 02/17] net/dpaa: fix typecasting ch ID to u32 Hemant Agrawal
2024-08-07 15:37   ` Ferruh Yigit
2024-08-01 10:52 ` [PATCH 03/17] bus/dpaa: fix VSP for 1G fm1-mac9 and 10 Hemant Agrawal
2024-08-07 15:38   ` Ferruh Yigit
2024-08-23  7:33     ` Hemant Agrawal
     [not found] ` <20240823073240.3708320-1-hemant.agrawal@nxp.com>
2024-08-23  7:32   ` [PATCH v2 01/18] bus/dpaa: fix PFDRs leaks due to FQRNIs Hemant Agrawal
2024-08-23  7:32   ` [PATCH v2 02/18] net/dpaa: fix typecasting ch ID to u32 Hemant Agrawal
2024-08-23  7:32   ` [PATCH v2 03/18] bus/dpaa: fix VSP for 1G fm1-mac9 and 10 Hemant Agrawal
2024-08-23  7:32   ` [PATCH v2 04/18] bus/dpaa: fix the fman details status Hemant Agrawal
     [not found]   ` <20240930102946.3236998-1-hemant.agrawal@nxp.com>
2024-09-30 10:29     ` [PATCH v3 01/18] bus/dpaa: fix PFDRs leaks due to FQRNIs Hemant Agrawal
2024-09-30 10:29     ` [PATCH v3 02/18] net/dpaa: fix typecasting ch ID to u32 Hemant Agrawal
2024-09-30 10:29     ` [PATCH v3 03/18] bus/dpaa: fix VSP for 1G fm1-mac9 and 10 Hemant Agrawal
2024-09-30 10:29     ` [PATCH v3 04/18] bus/dpaa: fix the fman details status Hemant Agrawal
2024-09-30 10:29     ` [PATCH v3 18/18] net/dpaa: fix reallocate_mbuf handling Hemant Agrawal
     [not found]   ` <20240930121525.3452847-1-hemant.agrawal@nxp.com>
2024-09-30 12:15     ` [PATCH v4 01/18] bus/dpaa: fix PFDRs leaks due to FQRNIs Hemant Agrawal
2024-09-30 12:15     ` [PATCH v4 02/18] net/dpaa: fix typecasting ch ID to u32 Hemant Agrawal
2024-09-30 12:15     ` [PATCH v4 03/18] bus/dpaa: fix VSP for 1G fm1-mac9 and 10 Hemant Agrawal
2024-09-30 12:15     ` [PATCH v4 04/18] bus/dpaa: fix the fman details status Hemant Agrawal
2024-09-30 12:15     ` [PATCH v4 18/18] net/dpaa: fix reallocate_mbuf handling Hemant Agrawal
     [not found]     ` <20241001110325.4173762-1-hemant.agrawal@nxp.com>
2024-10-01 11:03       ` [PATCH v5 01/18] bus/dpaa: fix PFDRs leaks due to FQRNIs Hemant Agrawal
2024-10-01 11:03       ` Hemant Agrawal [this message]
2024-10-01 11:03       ` [PATCH v5 03/18] bus/dpaa: fix VSP for 1G fm1-mac9 and 10 Hemant Agrawal
2024-10-01 11:03       ` [PATCH v5 04/18] bus/dpaa: fix the fman details status Hemant Agrawal
2024-10-01 11:03       ` [PATCH v5 18/18] net/dpaa: fix reallocate_mbuf handling Hemant Agrawal

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=20241001110325.4173762-3-hemant.agrawal@nxp.com \
    --to=hemant.agrawal@nxp.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=rohit.raj@nxp.com \
    --cc=stable@dpdk.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).