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 2BC6F459C6; Wed, 18 Sep 2024 09:52:47 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 849D242F01; Wed, 18 Sep 2024 09:51:20 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by mails.dpdk.org (Postfix) with ESMTP id 6467D42EBB for ; Wed, 18 Sep 2024 09:51:03 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 484D01A1C61; Wed, 18 Sep 2024 09:51:03 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 0F5AC1A1C64; Wed, 18 Sep 2024 09:51:03 +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 8365B183C481; Wed, 18 Sep 2024 15:51:02 +0800 (+08) From: vanshika.shukla@nxp.com To: dev@dpdk.org, Hemant Agrawal , Sachin Saxena Cc: Jun Yang Subject: [v2 12/43] bus/fslmc: improve BMAN buffer acquire Date: Wed, 18 Sep 2024 13:20:25 +0530 Message-Id: <20240918075056.1838654-13-vanshika.shukla@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240918075056.1838654-1-vanshika.shukla@nxp.com> References: <20240913055959.3246917-1-vanshika.shukla@nxp.com> <20240918075056.1838654-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