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 7AB1145B37; Mon, 14 Oct 2024 14:02:52 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C044440B91; Mon, 14 Oct 2024 14:01:45 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by mails.dpdk.org (Postfix) with ESMTP id 958D140676 for ; Mon, 14 Oct 2024 14:01:33 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 6AEDE1A08C8; Mon, 14 Oct 2024 14:01:33 +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 2DC731A08E3; Mon, 14 Oct 2024 14:01:33 +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 9AFA8183DC04; Mon, 14 Oct 2024 20:01:32 +0800 (+08) From: vanshika.shukla@nxp.com To: dev@dpdk.org, Hemant Agrawal , Sachin Saxena Cc: Jun Yang Subject: [v3 12/43] bus/fslmc: improve BMAN buffer acquire Date: Mon, 14 Oct 2024 17:30:55 +0530 Message-Id: <20241014120126.170790-13-vanshika.shukla@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241014120126.170790-1-vanshika.shukla@nxp.com> References: <20240918075056.1838654-2-vanshika.shukla@nxp.com> <20241014120126.170790-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