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 E6686457AD; Tue, 13 Aug 2024 09:31:15 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CFD0F40DCE; Tue, 13 Aug 2024 09:31:15 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2072.outbound.protection.outlook.com [40.107.20.72]) by mails.dpdk.org (Postfix) with ESMTP id D1F824065B for ; Tue, 13 Aug 2024 09:31:13 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JhJ6vd3WSJVBL5TQXF1T8VWSwkPXJDTWY1LkrKGTwmEwWYD8Pvuzlo9Lqs2arWqDj6QYBguJJGxgWb5nbfE7IEDSvKzldJVXMTNHZIjis6gvVzLydgyxZZ400RjOOADPkjYKNK+fAXmEtaEtA0uP3eGddUxbzhU/fVLSU0QfPSEShePcuaKyudRKhJiSxuIkuy6SOXu+1tU+CHFfUJlEYl+PZ5WCbhTtQ71FMIW1IefDmQV9ZPnbGcvBFsdzgz80znjgrmmZacZQftiv0UNO2zPFKrlqab3hb1/Cop1/IHUo1oarEUYRhfuD1+YCTPGICR4GOYWlB0eGOVBHfAuv2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=U6pDhHyRUqPuVPK+oIlrgOcSlCmNAK5q4GTSoUu2OMI=; b=irlVsb+umBVsZMlLApNYs6a0/TVNCypnSR65iWSNdeyNUGFl+aattSdZ2Vy0H1aDVEStfLkerQIPl0feuanGDdlgpQPZsha5aN3YNFYCRJJMcny2pg+I9us1MLBxu9WcpksPSjM07nC4fWXTVVy2L+BfuodotIZSH1IsOwtzE/JFqgfvNzER8ARGB+yxSfKHAY/icFoufAxvLK3ddlzK/i4a5P+mJK3x5STw7wFzfV/6PyAtoJxGShcV+wpLd24mHmeNBoTf1pdCoODN+ypPQ7YnHws8W36CVb8Lym2lJn4r/UfR4DNT55Fi/UX3yrKkFAQEWlO+9TptDcgaysNPiQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nokia.com; dmarc=pass action=none header.from=nokia.com; dkim=pass header.d=nokia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nokia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=U6pDhHyRUqPuVPK+oIlrgOcSlCmNAK5q4GTSoUu2OMI=; b=Id5aXCHhDsfvubB8sTQBgu88TjRUL9z2TDjuD+sXyVzkV4twYxE+6FqhM8hsGk3qLWvNd9hXaGTvCqLIe9pLupnFJ7mbJr0gw81P4gVyhZaOanb2yWWXCuGIZvEMx5meeQlDHv7kSBcIKlDsd8bLpel77DNvJcLwf/aQlAG5M/d3uj+80x8S2WlGD4wnhyhRACYcYeM6IDNLE7FCK/rLw56PYh1M8IGSl2UrReQe+16hshXBBWLMfyiHW2xOYSam4QjRTDt/HSHArFptDkPoATFiAA8984KuSTVGjLQxRs3dcr8M2QqklV1C4WmUMqfDN8Ck9ddsq/SJtGs5sV7qGw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nokia.com; Received: from DU2PR07MB9522.eurprd07.prod.outlook.com (2603:10a6:10:49a::12) by DU2PR07MB8143.eurprd07.prod.outlook.com (2603:10a6:10:271::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.22; Tue, 13 Aug 2024 07:31:11 +0000 Received: from DU2PR07MB9522.eurprd07.prod.outlook.com ([fe80::3bcc:6d1b:6257:819]) by DU2PR07MB9522.eurprd07.prod.outlook.com ([fe80::3bcc:6d1b:6257:819%4]) with mapi id 15.20.7849.019; Tue, 13 Aug 2024 07:31:11 +0000 Content-Type: multipart/alternative; boundary="------------wK2TQqVYzhP4Ozr0zRVjkh0e" Message-ID: Date: Tue, 13 Aug 2024 09:31:08 +0200 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 2/3] baseband/acc: refactor queue status update To: dev@dpdk.org References: <20240812234201.2196633-1-nicolas.chautru@intel.com> <20240812234201.2196633-3-nicolas.chautru@intel.com> Content-Language: en-US From: Mattia Milani In-Reply-To: X-ClientProxiedBy: FR4P281CA0221.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:e4::18) To DU2PR07MB9522.eurprd07.prod.outlook.com (2603:10a6:10:49a::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR07MB9522:EE_|DU2PR07MB8143:EE_ X-MS-Office365-Filtering-Correlation-Id: 909b2fea-f6e9-40dc-1125-08dcbb69e770 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?B?M096YU8rRUVGak41ZVJtYk9LUEk3MU1qUURhUzFvMEFlcEhVZHJzK2U1T0xT?= =?utf-8?B?ZHFETTFFTkw0SUpxNEVTWEkvVjEzdmdwSHM2ZTUwMGJIcVlyTlFCOEI2ZGxG?= =?utf-8?B?Nm5WV1U4amRmUEZWMDMzRFlJMnU2QjJ5TklGN1lEcFZyQTJsZEJvUmRobW11?= =?utf-8?B?WW10TVo0YWNac0lta0VMUmF3c21YNkFmZ21WUVNTcEoxRFVoanNRR3RqS2c3?= =?utf-8?B?UWw1UXJWUVFoMDc2OFVocWJsMWpSNmZkdUJXUU9vMTFMdU5wd09tSjNEb0Jm?= =?utf-8?B?a212K1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wMkEvKzhSWXdZS0pVaXZvNUw3LzlZWHVOdFRrS0VvRE5RdlBkOXBEYm82?= =?utf-8?B?N0FBL20wNHFKSTF0cmI4NTIzRXZ4dHpOajRFejdWakRVRnVRT3FaZy8xSDBJ?= =?utf-8?B?bTRsbldaTktZbVYyRGpGZTlDYXUrWmpjdjJyeVB6V1VGMWpxa0s0bEpocVRi?= =?utf-8?B?blZ6NHlLTlpxSXc3ZG5lQVlUZEV5NzB3NEYvYnpqdERWNDVRems3VHdkNUFY?= =?utf-8?B?dXQ2ZWJPOVNGL0sySDdEQmJzRFVJcEtndVI3UUlFdkYzL1lGcVp4ZHduYkVt?= =?utf-8?B?ZFoyVTh0T2R5WXJOS2VtSGtDbFltUVREVHZSbE5nSFlqTm4zUDg5QkNHNkE2?= =?utf-8?B?Qjk3andGUGQwbXppK0NZL3lJVmwzT3l6MWJZV0F1M0I3c0JNVTdacmRwREZH?= =?utf-8?B?am5IbS9OaEpPV2RqSElaemZaVEp1QlI2ZkNrOWRsOGhtSzJ5a0JZR0JyQ0Jl?= =?utf-8?Q?Y/qzLDq8j/dqfswSpusp?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU2PR07MB9522.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?TytkY2xaQXIxdXQrV1Zvb0lRRWF4OGo0ayszc3M3eVhhQ09RYnZDTmk1SnJ5?= =?utf-8?B?UUdiRk1tSWZwZkpLV2xVcHlLcDBKcnh0K3FFY0YvZkV3azZiOUxUdDVkeE5m?= =?utf-8?B?NHM1cUpYc2d5eWFoNmhxSWNRRU9MU0s4ak5Kb2l4U3RVSFhpWHl3SmtiU3BU?= =?utf-8?B?N1pBUFNzRkNyc3BiLzlYbXhhU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mZXb091cW4y?= =?utf-8?B?YlhNaFNoMkp2SUFrbXM5QVFRQmNheUdIbVZoWlhrWm9uV1FCekpZeFBUN1Rl?= =?utf-8?B?N0gwTERJVEpIbitvVkVQdklRVktMaldyaHhWTzZpeTY5cHJNYW1LaE85T3pQ?= =?utf-8?B?NVNWZzlIOGRUa3Jnem5mMWJkWVQxZnhPWmJISnU0YkNnMmhlTldmVWhKRVRz?= =?utf-8?B?ZWc9PQ==?= X-OriginatorOrg: nokia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 909b2fea-f6e9-40dc-1125-08dcbb69e770 X-MS-Exchange-CrossTenant-AuthSource: DU2PR07MB9522.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2024 07:31:10.9844 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5d471751-9675-428d-917b-70f44f9630b0 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: C9iDaLdoamt81LzzRMuO4+icfs7GmGjQvXQJBXBN3BeF186k8TQecOM7xzEmneP3GvqP8X+noPUYErOUL6kC3Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR07MB8143 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 --------------wK2TQqVYzhP4Ozr0zRVjkh0e Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit My bad, please ignore the first comment, I've confused the - and + on the left side. sorry for the misunderstanding. For the second I still think would make more sense to reset the statistics at when a queue is started rather than stopped. On 13/08/2024 09:24, Mattia Milani wrote: > > Dear all, > > I'm a DPDK newbie, but I hope anyway you are gonna consider my > comments or help me to understand the code a little bit better. > > 1) Aren't you updating the variable two times? for example, in > 'acc100_enqueue_enc_cb', >     you update both 'enqueued_count' and 'enqueue_err_count' and then > you call >     'acc_update_qstat_enqueue' which does exactly the same thing but > also updates 'enqueue_depth_avail'. > > 2) You reset the queue stats when '*_queue_stop' is called, wouldn't > be better to reset the statistics when a queue is started? so that, if > I want, I can still access the statistics of a stopped queue to see > the counters. > > All the best, Mattia > > On 13/08/2024 01:42, Nicolas Chautru wrote: >> CAUTION: This is an external email. Please be very careful when clicking links or opening attachments. See the URL nok.it/ext for additional information. >> >> >> >> Introducing common function for queue stats update >> within the acc PMDs. >> >> Signed-off-by: Nicolas Chautru >> --- >> drivers/baseband/acc/acc_common.h | 18 ++++++++ >> drivers/baseband/acc/rte_acc100_pmd.c | 45 ++++++-------------- >> drivers/baseband/acc/rte_vrb_pmd.c | 61 +++++++++------------------ >> 3 files changed, 50 insertions(+), 74 deletions(-) >> >> diff --git a/drivers/baseband/acc/acc_common.h b/drivers/baseband/acc/acc_common.h >> index e249f37e38..06a88360de 100644 >> --- a/drivers/baseband/acc/acc_common.h >> +++ b/drivers/baseband/acc/acc_common.h >> @@ -1555,6 +1555,24 @@ acc_aq_avail(struct rte_bbdev_queue_data *q_data, uint16_t num_ops) >> return aq_avail; >> } >> >> +/* Update queue stats during enqueue. */ >> +static inline void >> +acc_update_qstat_enqueue(struct rte_bbdev_queue_data *q_data, >> + uint16_t enq_count, uint16_t enq_err_count) >> +{ >> + q_data->queue_stats.enqueued_count += enq_count; >> + q_data->queue_stats.enqueue_err_count += enq_err_count; >> + q_data->queue_stats.enqueue_depth_avail = acc_aq_avail(q_data, 0); >> +} >> + >> +/* Update queue stats during dequeue. */ >> +static inline void >> +acc_update_qstat_dequeue(struct rte_bbdev_queue_data *q_data, uint16_t deq_count) >> +{ >> + q_data->queue_stats.dequeued_count += deq_count; >> + q_data->queue_stats.enqueue_depth_avail = acc_aq_avail(q_data, 0); >> +} >> + >> /* Calculates number of CBs in processed encoder TB based on 'r' and input >> * length. >> */ >> diff --git a/drivers/baseband/acc/rte_acc100_pmd.c b/drivers/baseband/acc/rte_acc100_pmd.c >> index ab69350080..d2a0a36e12 100644 >> --- a/drivers/baseband/acc/rte_acc100_pmd.c >> +++ b/drivers/baseband/acc/rte_acc100_pmd.c >> @@ -892,6 +892,7 @@ acc100_queue_stop(struct rte_bbdev *dev, uint16_t queue_id) >> dev->data->queues[queue_id].queue_stats.dequeue_err_count = 0; >> dev->data->queues[queue_id].queue_stats.enqueue_warn_count = 0; >> dev->data->queues[queue_id].queue_stats.dequeue_warn_count = 0; >> + dev->data->queues[queue_id].queue_stats.enqueue_depth_avail = 0; >> >> return 0; >> } >> @@ -3196,9 +3197,7 @@ acc100_enqueue_enc_cb(struct rte_bbdev_queue_data *q_data, >> >> acc_dma_enqueue(q, i, &q_data->queue_stats); >> >> - /* Update stats */ >> - q_data->queue_stats.enqueued_count += i; >> - q_data->queue_stats.enqueue_err_count += num - i; >> + acc_update_qstat_enqueue(q_data, i, num - i); >> return i; >> } >> >> @@ -3245,9 +3244,7 @@ acc100_enqueue_ldpc_enc_cb(struct rte_bbdev_queue_data *q_data, >> >> acc_dma_enqueue(q, desc_idx, &q_data->queue_stats); >> >> - /* Update stats */ >> - q_data->queue_stats.enqueued_count += i; >> - q_data->queue_stats.enqueue_err_count += num - i; >> + acc_update_qstat_enqueue(q_data, i, num - i); >> >> return i; >> } >> @@ -3284,9 +3281,7 @@ acc100_enqueue_enc_tb(struct rte_bbdev_queue_data *q_data, >> >> acc_dma_enqueue(q, enqueued_cbs, &q_data->queue_stats); >> >> - /* Update stats */ >> - q_data->queue_stats.enqueued_count += i; >> - q_data->queue_stats.enqueue_err_count += num - i; >> + acc_update_qstat_enqueue(q_data, i, num - i); >> >> return i; >> } >> @@ -3322,9 +3317,7 @@ acc100_enqueue_ldpc_enc_tb(struct rte_bbdev_queue_data *q_data, >> >> acc_dma_enqueue(q, enqueued_descs, &q_data->queue_stats); >> >> - /* Update stats. */ >> - q_data->queue_stats.enqueued_count += i; >> - q_data->queue_stats.enqueue_err_count += num - i; >> + acc_update_qstat_enqueue(q_data, i, num - i); >> >> return i; >> } >> @@ -3388,9 +3381,7 @@ acc100_enqueue_dec_cb(struct rte_bbdev_queue_data *q_data, >> >> acc_dma_enqueue(q, i, &q_data->queue_stats); >> >> - /* Update stats */ >> - q_data->queue_stats.enqueued_count += i; >> - q_data->queue_stats.enqueue_err_count += num - i; >> + acc_update_qstat_enqueue(q_data, i, num - i); >> >> return i; >> } >> @@ -3426,9 +3417,7 @@ acc100_enqueue_ldpc_dec_tb(struct rte_bbdev_queue_data *q_data, >> >> acc_dma_enqueue(q, enqueued_cbs, &q_data->queue_stats); >> >> - /* Update stats */ >> - q_data->queue_stats.enqueued_count += i; >> - q_data->queue_stats.enqueue_err_count += num - i; >> + acc_update_qstat_enqueue(q_data, i, num - i); >> return i; >> } >> >> @@ -3468,9 +3457,7 @@ acc100_enqueue_ldpc_dec_cb(struct rte_bbdev_queue_data *q_data, >> >> acc_dma_enqueue(q, i, &q_data->queue_stats); >> >> - /* Update stats */ >> - q_data->queue_stats.enqueued_count += i; >> - q_data->queue_stats.enqueue_err_count += num - i; >> + acc_update_qstat_enqueue(q_data, i, num - i); >> return i; >> } >> >> @@ -3505,9 +3492,7 @@ acc100_enqueue_dec_tb(struct rte_bbdev_queue_data *q_data, >> >> acc_dma_enqueue(q, enqueued_cbs, &q_data->queue_stats); >> >> - /* Update stats */ >> - q_data->queue_stats.enqueued_count += i; >> - q_data->queue_stats.enqueue_err_count += num - i; >> + acc_update_qstat_enqueue(q_data, i, num - i); >> >> return i; >> } >> @@ -3897,8 +3882,7 @@ acc100_dequeue_enc(struct rte_bbdev_queue_data *q_data, >> q->aq_dequeued += aq_dequeued; >> q->sw_ring_tail += dequeued_descs; >> >> - /* Update enqueue stats */ >> - q_data->queue_stats.dequeued_count += dequeued_ops; >> + acc_update_qstat_dequeue(q_data, dequeued_ops); >> >> return dequeued_ops; >> } >> @@ -3940,8 +3924,7 @@ acc100_dequeue_ldpc_enc(struct rte_bbdev_queue_data *q_data, >> q->aq_dequeued += aq_dequeued; >> q->sw_ring_tail += dequeued_descs; >> >> - /* Update enqueue stats */ >> - q_data->queue_stats.dequeued_count += dequeued_ops; >> + acc_update_qstat_dequeue(q_data, dequeued_ops); >> >> return dequeued_ops; >> } >> @@ -3986,8 +3969,7 @@ acc100_dequeue_dec(struct rte_bbdev_queue_data *q_data, >> q->aq_dequeued += aq_dequeued; >> q->sw_ring_tail += dequeued_cbs; >> >> - /* Update enqueue stats */ >> - q_data->queue_stats.dequeued_count += i; >> + acc_update_qstat_dequeue(q_data, i); >> >> return i; >> } >> @@ -4033,8 +4015,7 @@ acc100_dequeue_ldpc_dec(struct rte_bbdev_queue_data *q_data, >> q->aq_dequeued += aq_dequeued; >> q->sw_ring_tail += dequeued_cbs; >> >> - /* Update enqueue stats */ >> - q_data->queue_stats.dequeued_count += i; >> + acc_update_qstat_dequeue(q_data, i); >> >> return i; >> } >> diff --git a/drivers/baseband/acc/rte_vrb_pmd.c b/drivers/baseband/acc/rte_vrb_pmd.c >> index 585dc49bd6..630b514f03 100644 >> --- a/drivers/baseband/acc/rte_vrb_pmd.c >> +++ b/drivers/baseband/acc/rte_vrb_pmd.c >> @@ -1109,6 +1109,7 @@ vrb_queue_stop(struct rte_bbdev *dev, uint16_t queue_id) >> dev->data->queues[queue_id].queue_stats.dequeue_err_count = 0; >> dev->data->queues[queue_id].queue_stats.enqueue_warn_count = 0; >> dev->data->queues[queue_id].queue_stats.dequeue_warn_count = 0; >> + dev->data->queues[queue_id].queue_stats.enqueue_depth_avail = 0; >> return 0; >> } >> >> @@ -2738,9 +2739,7 @@ vrb_enqueue_enc_cb(struct rte_bbdev_queue_data *q_data, >> >> acc_dma_enqueue(q, i, &q_data->queue_stats); >> >> - /* Update stats */ >> - q_data->queue_stats.enqueued_count += i; >> - q_data->queue_stats.enqueue_err_count += num - i; >> + acc_update_qstat_enqueue(q_data, i, num - i); >> return i; >> } >> >> @@ -2778,9 +2777,7 @@ vrb_enqueue_ldpc_enc_cb(struct rte_bbdev_queue_data *q_data, >> >> acc_dma_enqueue(q, desc_idx, &q_data->queue_stats); >> >> - /* Update stats. */ >> - q_data->queue_stats.enqueued_count += i; >> - q_data->queue_stats.enqueue_err_count += num - i; >> + acc_update_qstat_enqueue(q_data, i, num - i); >> >> return i; >> } >> @@ -2817,9 +2814,7 @@ vrb_enqueue_enc_tb(struct rte_bbdev_queue_data *q_data, >> >> acc_dma_enqueue(q, enqueued_cbs, &q_data->queue_stats); >> >> - /* Update stats */ >> - q_data->queue_stats.enqueued_count += i; >> - q_data->queue_stats.enqueue_err_count += num - i; >> + acc_update_qstat_enqueue(q_data, i, num - i); >> >> return i; >> } >> @@ -2864,9 +2859,7 @@ vrb_enqueue_ldpc_enc_tb(struct rte_bbdev_queue_data *q_data, >> >> acc_dma_enqueue(q, enqueued_descs, &q_data->queue_stats); >> >> - /* Update stats. */ >> - q_data->queue_stats.enqueued_count += i; >> - q_data->queue_stats.enqueue_err_count += num - i; >> + acc_update_qstat_enqueue(q_data, i, num - i); >> >> return i; >> } >> @@ -2926,9 +2919,7 @@ vrb_enqueue_dec_cb(struct rte_bbdev_queue_data *q_data, >> >> acc_dma_enqueue(q, i, &q_data->queue_stats); >> >> - /* Update stats. */ >> - q_data->queue_stats.enqueued_count += i; >> - q_data->queue_stats.enqueue_err_count += num - i; >> + acc_update_qstat_enqueue(q_data, i, num - i); >> >> return i; >> } >> @@ -2961,9 +2952,7 @@ vrb_enqueue_ldpc_dec_tb(struct rte_bbdev_queue_data *q_data, >> >> acc_dma_enqueue(q, enqueued_cbs, &q_data->queue_stats); >> >> - /* Update stats. */ >> - q_data->queue_stats.enqueued_count += i; >> - q_data->queue_stats.enqueue_err_count += num - i; >> + acc_update_qstat_enqueue(q_data, i, num - i); >> return i; >> } >> >> @@ -3004,9 +2993,7 @@ vrb_enqueue_ldpc_dec_cb(struct rte_bbdev_queue_data *q_data, >> >> acc_dma_enqueue(q, i, &q_data->queue_stats); >> >> - /* Update stats. */ >> - q_data->queue_stats.enqueued_count += i; >> - q_data->queue_stats.enqueue_err_count += num - i; >> + acc_update_qstat_enqueue(q_data, i, num - i); >> return i; >> } >> >> @@ -3041,9 +3028,7 @@ vrb_enqueue_dec_tb(struct rte_bbdev_queue_data *q_data, >> >> acc_dma_enqueue(q, enqueued_cbs, &q_data->queue_stats); >> >> - /* Update stats */ >> - q_data->queue_stats.enqueued_count += i; >> - q_data->queue_stats.enqueue_err_count += num - i; >> + acc_update_qstat_enqueue(q_data, i, num - i); >> >> return i; >> } >> @@ -3453,8 +3438,7 @@ vrb_dequeue_enc(struct rte_bbdev_queue_data *q_data, >> q->aq_dequeued += aq_dequeued; >> q->sw_ring_tail += dequeued_descs; >> >> - /* Update enqueue stats. */ >> - q_data->queue_stats.dequeued_count += dequeued_ops; >> + acc_update_qstat_dequeue(q_data, dequeued_ops); >> >> return dequeued_ops; >> } >> @@ -3496,8 +3480,7 @@ vrb_dequeue_ldpc_enc(struct rte_bbdev_queue_data *q_data, >> q->aq_dequeued += aq_dequeued; >> q->sw_ring_tail += dequeued_descs; >> >> - /* Update enqueue stats. */ >> - q_data->queue_stats.dequeued_count += dequeued_ops; >> + acc_update_qstat_dequeue(q_data, dequeued_ops); >> >> return dequeued_ops; >> } >> @@ -3535,8 +3518,7 @@ vrb_dequeue_dec(struct rte_bbdev_queue_data *q_data, >> q->aq_dequeued += aq_dequeued; >> q->sw_ring_tail += dequeued_cbs; >> >> - /* Update enqueue stats */ >> - q_data->queue_stats.dequeued_count += i; >> + acc_update_qstat_dequeue(q_data, i); >> >> return i; >> } >> @@ -3575,8 +3557,7 @@ vrb_dequeue_ldpc_dec(struct rte_bbdev_queue_data *q_data, >> q->aq_dequeued += aq_dequeued; >> q->sw_ring_tail += dequeued_cbs; >> >> - /* Update enqueue stats. */ >> - q_data->queue_stats.dequeued_count += i; >> + acc_update_qstat_dequeue(q_data, i); >> >> return i; >> } >> @@ -3782,9 +3763,7 @@ vrb_enqueue_fft(struct rte_bbdev_queue_data *q_data, >> >> acc_dma_enqueue(q, i, &q_data->queue_stats); >> >> - /* Update stats */ >> - q_data->queue_stats.enqueued_count += i; >> - q_data->queue_stats.enqueue_err_count += num - i; >> + acc_update_qstat_enqueue(q_data, i, num - i); >> return i; >> } >> >> @@ -3851,8 +3830,7 @@ vrb_dequeue_fft(struct rte_bbdev_queue_data *q_data, >> >> q->aq_dequeued += aq_dequeued; >> q->sw_ring_tail += dequeued_cbs; >> - /* Update enqueue stats. */ >> - q_data->queue_stats.dequeued_count += i; >> + acc_update_qstat_dequeue(q_data, i); >> return i; >> } >> >> @@ -4106,9 +4084,7 @@ vrb2_enqueue_mldts(struct rte_bbdev_queue_data *q_data, >> >> acc_dma_enqueue(q, enqueued_descs, &q_data->queue_stats); >> >> - /* Update stats. */ >> - q_data->queue_stats.enqueued_count += i; >> - q_data->queue_stats.enqueue_err_count += num - i; >> + acc_update_qstat_enqueue(q_data, i, num - i); >> return i; >> } >> >> @@ -4207,8 +4183,9 @@ vrb2_dequeue_mldts(struct rte_bbdev_queue_data *q_data, >> >> q->aq_dequeued += aq_dequeued; >> q->sw_ring_tail += dequeued_cbs; >> - /* Update enqueue stats. */ >> - q_data->queue_stats.dequeued_count += i; >> + >> + acc_update_qstat_dequeue(q_data, i); >> + >> return i; >> } >> >> -- >> 2.34.1 >> --------------wK2TQqVYzhP4Ozr0zRVjkh0e Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

My bad, please ignore the first comment, I've confused the - and + on the left side.
sorry for the misunderstanding.
For the second I still think would make more sense to reset the statistics at
when a queue is started rather than stopped.

On 13/08/2024 09:24, Mattia Milani wrote:

Dear all,

I'm a DPDK newbie, but I hope anyway you are gonna consider my
comments or help me to understand the code a little bit better.

1) Aren't you updating the variable two times? for example, in 'acc100_enqueue_enc_cb',
    you update both 'enqueued_count' and 'enqueue_err_count' and then you call
    'acc_update_qstat_enqueue' which does exactly the same thing but also updates 'enqueue_depth_avail'.

2) You reset the queue stats when '*_queue_stop' is called, wouldn't be better to reset the statistics when a queue is started? so that, if I want, I can still access the statistics of a stopped queue to see the counters.

All the best, Mattia

On 13/08/2024 01:42, Nicolas Chautru wrote:
CAUTION: This is an external email. Please be very careful when clicking links or opening attachments. See the URL nok.it/ext for additional information.



Introducing common function for queue stats update
within the acc PMDs.

Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
---
 drivers/baseband/acc/acc_common.h     | 18 ++++++++
 drivers/baseband/acc/rte_acc100_pmd.c | 45 ++++++--------------
 drivers/baseband/acc/rte_vrb_pmd.c    | 61 +++++++++------------------
 3 files changed, 50 insertions(+), 74 deletions(-)

diff --git a/drivers/baseband/acc/acc_common.h b/drivers/baseband/acc/acc_common.h
index e249f37e38..06a88360de 100644
--- a/drivers/baseband/acc/acc_common.h
+++ b/drivers/baseband/acc/acc_common.h
@@ -1555,6 +1555,24 @@ acc_aq_avail(struct rte_bbdev_queue_data *q_data, uint16_t num_ops)
        return aq_avail;
 }

+/* Update queue stats during enqueue. */
+static inline void
+acc_update_qstat_enqueue(struct rte_bbdev_queue_data *q_data,
+               uint16_t enq_count, uint16_t enq_err_count)
+{
+       q_data->queue_stats.enqueued_count += enq_count;
+       q_data->queue_stats.enqueue_err_count += enq_err_count;
+       q_data->queue_stats.enqueue_depth_avail = acc_aq_avail(q_data, 0);
+}
+
+/* Update queue stats during dequeue. */
+static inline void
+acc_update_qstat_dequeue(struct rte_bbdev_queue_data *q_data, uint16_t deq_count)
+{
+       q_data->queue_stats.dequeued_count += deq_count;
+       q_data->queue_stats.enqueue_depth_avail = acc_aq_avail(q_data, 0);
+}
+
 /* Calculates number of CBs in processed encoder TB based on 'r' and input
  * length.
  */
diff --git a/drivers/baseband/acc/rte_acc100_pmd.c b/drivers/baseband/acc/rte_acc100_pmd.c
index ab69350080..d2a0a36e12 100644
--- a/drivers/baseband/acc/rte_acc100_pmd.c
+++ b/drivers/baseband/acc/rte_acc100_pmd.c
@@ -892,6 +892,7 @@ acc100_queue_stop(struct rte_bbdev *dev, uint16_t queue_id)
        dev->data->queues[queue_id].queue_stats.dequeue_err_count = 0;
        dev->data->queues[queue_id].queue_stats.enqueue_warn_count = 0;
        dev->data->queues[queue_id].queue_stats.dequeue_warn_count = 0;
+       dev->data->queues[queue_id].queue_stats.enqueue_depth_avail = 0;

        return 0;
 }
@@ -3196,9 +3197,7 @@ acc100_enqueue_enc_cb(struct rte_bbdev_queue_data *q_data,

        acc_dma_enqueue(q, i, &q_data->queue_stats);

-       /* Update stats */
-       q_data->queue_stats.enqueued_count += i;
-       q_data->queue_stats.enqueue_err_count += num - i;
+       acc_update_qstat_enqueue(q_data, i, num - i);
        return i;
 }

@@ -3245,9 +3244,7 @@ acc100_enqueue_ldpc_enc_cb(struct rte_bbdev_queue_data *q_data,

        acc_dma_enqueue(q, desc_idx, &q_data->queue_stats);

-       /* Update stats */
-       q_data->queue_stats.enqueued_count += i;
-       q_data->queue_stats.enqueue_err_count += num - i;
+       acc_update_qstat_enqueue(q_data, i, num - i);

        return i;
 }
@@ -3284,9 +3281,7 @@ acc100_enqueue_enc_tb(struct rte_bbdev_queue_data *q_data,

        acc_dma_enqueue(q, enqueued_cbs, &q_data->queue_stats);

-       /* Update stats */
-       q_data->queue_stats.enqueued_count += i;
-       q_data->queue_stats.enqueue_err_count += num - i;
+       acc_update_qstat_enqueue(q_data, i, num - i);

        return i;
 }
@@ -3322,9 +3317,7 @@ acc100_enqueue_ldpc_enc_tb(struct rte_bbdev_queue_data *q_data,

        acc_dma_enqueue(q, enqueued_descs, &q_data->queue_stats);

-       /* Update stats. */
-       q_data->queue_stats.enqueued_count += i;
-       q_data->queue_stats.enqueue_err_count += num - i;
+       acc_update_qstat_enqueue(q_data, i, num - i);

        return i;
 }
@@ -3388,9 +3381,7 @@ acc100_enqueue_dec_cb(struct rte_bbdev_queue_data *q_data,

        acc_dma_enqueue(q, i, &q_data->queue_stats);

-       /* Update stats */
-       q_data->queue_stats.enqueued_count += i;
-       q_data->queue_stats.enqueue_err_count += num - i;
+       acc_update_qstat_enqueue(q_data, i, num - i);

        return i;
 }
@@ -3426,9 +3417,7 @@ acc100_enqueue_ldpc_dec_tb(struct rte_bbdev_queue_data *q_data,

        acc_dma_enqueue(q, enqueued_cbs, &q_data->queue_stats);

-       /* Update stats */
-       q_data->queue_stats.enqueued_count += i;
-       q_data->queue_stats.enqueue_err_count += num - i;
+       acc_update_qstat_enqueue(q_data, i, num - i);
        return i;
 }

@@ -3468,9 +3457,7 @@ acc100_enqueue_ldpc_dec_cb(struct rte_bbdev_queue_data *q_data,

        acc_dma_enqueue(q, i, &q_data->queue_stats);

-       /* Update stats */
-       q_data->queue_stats.enqueued_count += i;
-       q_data->queue_stats.enqueue_err_count += num - i;
+       acc_update_qstat_enqueue(q_data, i, num - i);
        return i;
 }

@@ -3505,9 +3492,7 @@ acc100_enqueue_dec_tb(struct rte_bbdev_queue_data *q_data,

        acc_dma_enqueue(q, enqueued_cbs, &q_data->queue_stats);

-       /* Update stats */
-       q_data->queue_stats.enqueued_count += i;
-       q_data->queue_stats.enqueue_err_count += num - i;
+       acc_update_qstat_enqueue(q_data, i, num - i);

        return i;
 }
@@ -3897,8 +3882,7 @@ acc100_dequeue_enc(struct rte_bbdev_queue_data *q_data,
        q->aq_dequeued += aq_dequeued;
        q->sw_ring_tail += dequeued_descs;

-       /* Update enqueue stats */
-       q_data->queue_stats.dequeued_count += dequeued_ops;
+       acc_update_qstat_dequeue(q_data, dequeued_ops);

        return dequeued_ops;
 }
@@ -3940,8 +3924,7 @@ acc100_dequeue_ldpc_enc(struct rte_bbdev_queue_data *q_data,
        q->aq_dequeued += aq_dequeued;
        q->sw_ring_tail += dequeued_descs;

-       /* Update enqueue stats */
-       q_data->queue_stats.dequeued_count += dequeued_ops;
+       acc_update_qstat_dequeue(q_data, dequeued_ops);

        return dequeued_ops;
 }
@@ -3986,8 +3969,7 @@ acc100_dequeue_dec(struct rte_bbdev_queue_data *q_data,
        q->aq_dequeued += aq_dequeued;
        q->sw_ring_tail += dequeued_cbs;

-       /* Update enqueue stats */
-       q_data->queue_stats.dequeued_count += i;
+       acc_update_qstat_dequeue(q_data, i);

        return i;
 }
@@ -4033,8 +4015,7 @@ acc100_dequeue_ldpc_dec(struct rte_bbdev_queue_data *q_data,
        q->aq_dequeued += aq_dequeued;
        q->sw_ring_tail += dequeued_cbs;

-       /* Update enqueue stats */
-       q_data->queue_stats.dequeued_count += i;
+       acc_update_qstat_dequeue(q_data, i);

        return i;
 }
diff --git a/drivers/baseband/acc/rte_vrb_pmd.c b/drivers/baseband/acc/rte_vrb_pmd.c
index 585dc49bd6..630b514f03 100644
--- a/drivers/baseband/acc/rte_vrb_pmd.c
+++ b/drivers/baseband/acc/rte_vrb_pmd.c
@@ -1109,6 +1109,7 @@ vrb_queue_stop(struct rte_bbdev *dev, uint16_t queue_id)
        dev->data->queues[queue_id].queue_stats.dequeue_err_count = 0;
        dev->data->queues[queue_id].queue_stats.enqueue_warn_count = 0;
        dev->data->queues[queue_id].queue_stats.dequeue_warn_count = 0;
+       dev->data->queues[queue_id].queue_stats.enqueue_depth_avail = 0;
        return 0;
 }

@@ -2738,9 +2739,7 @@ vrb_enqueue_enc_cb(struct rte_bbdev_queue_data *q_data,

        acc_dma_enqueue(q, i, &q_data->queue_stats);

-       /* Update stats */
-       q_data->queue_stats.enqueued_count += i;
-       q_data->queue_stats.enqueue_err_count += num - i;
+       acc_update_qstat_enqueue(q_data, i, num - i);
        return i;
 }

@@ -2778,9 +2777,7 @@ vrb_enqueue_ldpc_enc_cb(struct rte_bbdev_queue_data *q_data,

        acc_dma_enqueue(q, desc_idx, &q_data->queue_stats);

-       /* Update stats. */
-       q_data->queue_stats.enqueued_count += i;
-       q_data->queue_stats.enqueue_err_count += num - i;
+       acc_update_qstat_enqueue(q_data, i, num - i);

        return i;
 }
@@ -2817,9 +2814,7 @@ vrb_enqueue_enc_tb(struct rte_bbdev_queue_data *q_data,

        acc_dma_enqueue(q, enqueued_cbs, &q_data->queue_stats);

-       /* Update stats */
-       q_data->queue_stats.enqueued_count += i;
-       q_data->queue_stats.enqueue_err_count += num - i;
+       acc_update_qstat_enqueue(q_data, i, num - i);

        return i;
 }
@@ -2864,9 +2859,7 @@ vrb_enqueue_ldpc_enc_tb(struct rte_bbdev_queue_data *q_data,

        acc_dma_enqueue(q, enqueued_descs, &q_data->queue_stats);

-       /* Update stats. */
-       q_data->queue_stats.enqueued_count += i;
-       q_data->queue_stats.enqueue_err_count += num - i;
+       acc_update_qstat_enqueue(q_data, i, num - i);

        return i;
 }
@@ -2926,9 +2919,7 @@ vrb_enqueue_dec_cb(struct rte_bbdev_queue_data *q_data,

        acc_dma_enqueue(q, i, &q_data->queue_stats);

-       /* Update stats. */
-       q_data->queue_stats.enqueued_count += i;
-       q_data->queue_stats.enqueue_err_count += num - i;
+       acc_update_qstat_enqueue(q_data, i, num - i);

        return i;
 }
@@ -2961,9 +2952,7 @@ vrb_enqueue_ldpc_dec_tb(struct rte_bbdev_queue_data *q_data,

        acc_dma_enqueue(q, enqueued_cbs, &q_data->queue_stats);

-       /* Update stats. */
-       q_data->queue_stats.enqueued_count += i;
-       q_data->queue_stats.enqueue_err_count += num - i;
+       acc_update_qstat_enqueue(q_data, i, num - i);
        return i;
 }

@@ -3004,9 +2993,7 @@ vrb_enqueue_ldpc_dec_cb(struct rte_bbdev_queue_data *q_data,

        acc_dma_enqueue(q, i, &q_data->queue_stats);

-       /* Update stats. */
-       q_data->queue_stats.enqueued_count += i;
-       q_data->queue_stats.enqueue_err_count += num - i;
+       acc_update_qstat_enqueue(q_data, i, num - i);
        return i;
 }

@@ -3041,9 +3028,7 @@ vrb_enqueue_dec_tb(struct rte_bbdev_queue_data *q_data,

        acc_dma_enqueue(q, enqueued_cbs, &q_data->queue_stats);

-       /* Update stats */
-       q_data->queue_stats.enqueued_count += i;
-       q_data->queue_stats.enqueue_err_count += num - i;
+       acc_update_qstat_enqueue(q_data, i, num - i);

        return i;
 }
@@ -3453,8 +3438,7 @@ vrb_dequeue_enc(struct rte_bbdev_queue_data *q_data,
        q->aq_dequeued += aq_dequeued;
        q->sw_ring_tail += dequeued_descs;

-       /* Update enqueue stats. */
-       q_data->queue_stats.dequeued_count += dequeued_ops;
+       acc_update_qstat_dequeue(q_data, dequeued_ops);

        return dequeued_ops;
 }
@@ -3496,8 +3480,7 @@ vrb_dequeue_ldpc_enc(struct rte_bbdev_queue_data *q_data,
        q->aq_dequeued += aq_dequeued;
        q->sw_ring_tail += dequeued_descs;

-       /* Update enqueue stats. */
-       q_data->queue_stats.dequeued_count += dequeued_ops;
+       acc_update_qstat_dequeue(q_data, dequeued_ops);

        return dequeued_ops;
 }
@@ -3535,8 +3518,7 @@ vrb_dequeue_dec(struct rte_bbdev_queue_data *q_data,
        q->aq_dequeued += aq_dequeued;
        q->sw_ring_tail += dequeued_cbs;

-       /* Update enqueue stats */
-       q_data->queue_stats.dequeued_count += i;
+       acc_update_qstat_dequeue(q_data, i);

        return i;
 }
@@ -3575,8 +3557,7 @@ vrb_dequeue_ldpc_dec(struct rte_bbdev_queue_data *q_data,
        q->aq_dequeued += aq_dequeued;
        q->sw_ring_tail += dequeued_cbs;

-       /* Update enqueue stats. */
-       q_data->queue_stats.dequeued_count += i;
+       acc_update_qstat_dequeue(q_data, i);

        return i;
 }
@@ -3782,9 +3763,7 @@ vrb_enqueue_fft(struct rte_bbdev_queue_data *q_data,

        acc_dma_enqueue(q, i, &q_data->queue_stats);

-       /* Update stats */
-       q_data->queue_stats.enqueued_count += i;
-       q_data->queue_stats.enqueue_err_count += num - i;
+       acc_update_qstat_enqueue(q_data, i, num - i);
        return i;
 }

@@ -3851,8 +3830,7 @@ vrb_dequeue_fft(struct rte_bbdev_queue_data *q_data,

        q->aq_dequeued += aq_dequeued;
        q->sw_ring_tail += dequeued_cbs;
-       /* Update enqueue stats. */
-       q_data->queue_stats.dequeued_count += i;
+       acc_update_qstat_dequeue(q_data, i);
        return i;
 }

@@ -4106,9 +4084,7 @@ vrb2_enqueue_mldts(struct rte_bbdev_queue_data *q_data,

        acc_dma_enqueue(q, enqueued_descs, &q_data->queue_stats);

-       /* Update stats. */
-       q_data->queue_stats.enqueued_count += i;
-       q_data->queue_stats.enqueue_err_count += num - i;
+       acc_update_qstat_enqueue(q_data, i, num - i);
        return i;
 }

@@ -4207,8 +4183,9 @@ vrb2_dequeue_mldts(struct rte_bbdev_queue_data *q_data,

        q->aq_dequeued += aq_dequeued;
        q->sw_ring_tail += dequeued_cbs;
-       /* Update enqueue stats. */
-       q_data->queue_stats.dequeued_count += i;
+
+       acc_update_qstat_dequeue(q_data, i);
+
        return i;
 }

--
2.34.1

--------------wK2TQqVYzhP4Ozr0zRVjkh0e--