From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0B33945B4C; Tue, 22 Oct 2024 21:14:11 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CE6DE40E2F; Tue, 22 Oct 2024 21:13:20 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by mails.dpdk.org (Postfix) with ESMTP id 0ED3140698 for ; Tue, 22 Oct 2024 21:13:03 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id E5CBD20120E; Tue, 22 Oct 2024 21:13:02 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 99520201215; Tue, 22 Oct 2024 21:13:02 +0200 (CEST) Received: from lsv03379.swis.in-blr01.nxp.com (lsv03379.swis.in-blr01.nxp.com [92.120.147.188]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id 03C04183DC02; Wed, 23 Oct 2024 03:13:01 +0800 (+08) From: vanshika.shukla@nxp.com To: dev@dpdk.org, Hemant Agrawal , Sachin Saxena Cc: Jun Yang Subject: [v4 12/42] bus/fslmc: improve BMAN buffer acquire Date: Wed, 23 Oct 2024 00:42:25 +0530 Message-Id: <20241022191256.516818-13-vanshika.shukla@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241022191256.516818-1-vanshika.shukla@nxp.com> References: <20241014120126.170790-1-vanshika.shukla@nxp.com> <20241022191256.516818-1-vanshika.shukla@nxp.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Jun Yang Ignore reserved bits of BMan acquire response number. Signed-off-by: Jun Yang --- drivers/bus/fslmc/qbman/qbman_portal.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/drivers/bus/fslmc/qbman/qbman_portal.c b/drivers/bus/fslmc/qbman/qbman_portal.c index 1f24cdce7e..3fdca9761d 100644 --- a/drivers/bus/fslmc/qbman/qbman_portal.c +++ b/drivers/bus/fslmc/qbman/qbman_portal.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause * * Copyright (C) 2014-2016 Freescale Semiconductor, Inc. - * Copyright 2018-2020 NXP + * Copyright 2018-2020,2023-2024 NXP * */ @@ -42,6 +42,8 @@ /* opaque token for static dequeues */ #define QMAN_SDQCR_TOKEN 0xbb +#define BMAN_VALID_RSLT_NUM_MASK 0x7 + enum qbman_sdqcr_dct { qbman_sdqcr_dct_null = 0, qbman_sdqcr_dct_prio_ics, @@ -2628,7 +2630,7 @@ struct qbman_acquire_rslt { uint16_t reserved; uint8_t num; uint8_t reserved2[3]; - uint64_t buf[7]; + uint64_t buf[BMAN_VALID_RSLT_NUM_MASK]; }; static int qbman_swp_acquire_direct(struct qbman_swp *s, uint16_t bpid, @@ -2636,8 +2638,9 @@ static int qbman_swp_acquire_direct(struct qbman_swp *s, uint16_t bpid, { struct qbman_acquire_desc *p; struct qbman_acquire_rslt *r; + int num; - if (!num_buffers || (num_buffers > 7)) + if (!num_buffers || (num_buffers > BMAN_VALID_RSLT_NUM_MASK)) return -EINVAL; /* Start the management command */ @@ -2668,12 +2671,13 @@ static int qbman_swp_acquire_direct(struct qbman_swp *s, uint16_t bpid, return -EIO; } - QBMAN_BUG_ON(r->num > num_buffers); + num = r->num & BMAN_VALID_RSLT_NUM_MASK; + QBMAN_BUG_ON(num > num_buffers); /* Copy the acquired buffers to the caller's array */ - u64_from_le32_copy(buffers, &r->buf[0], r->num); + u64_from_le32_copy(buffers, &r->buf[0], num); - return (int)r->num; + return num; } static int qbman_swp_acquire_cinh_direct(struct qbman_swp *s, uint16_t bpid, @@ -2681,8 +2685,9 @@ static int qbman_swp_acquire_cinh_direct(struct qbman_swp *s, uint16_t bpid, { struct qbman_acquire_desc *p; struct qbman_acquire_rslt *r; + int num; - if (!num_buffers || (num_buffers > 7)) + if (!num_buffers || (num_buffers > BMAN_VALID_RSLT_NUM_MASK)) return -EINVAL; /* Start the management command */ @@ -2713,12 +2718,13 @@ static int qbman_swp_acquire_cinh_direct(struct qbman_swp *s, uint16_t bpid, return -EIO; } - QBMAN_BUG_ON(r->num > num_buffers); + num = r->num & BMAN_VALID_RSLT_NUM_MASK; + QBMAN_BUG_ON(num > num_buffers); /* Copy the acquired buffers to the caller's array */ - u64_from_le32_copy(buffers, &r->buf[0], r->num); + u64_from_le32_copy(buffers, &r->buf[0], num); - return (int)r->num; + return num; } int qbman_swp_acquire(struct qbman_swp *s, uint16_t bpid, uint64_t *buffers, -- 2.25.1