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 5DBD9A00C4; Thu, 20 Jan 2022 07:40:27 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 29CB241238; Thu, 20 Jan 2022 07:40:27 +0100 (CET) Received: from mail-io1-f42.google.com (mail-io1-f42.google.com [209.85.166.42]) by mails.dpdk.org (Postfix) with ESMTP id 0C95840042 for ; Thu, 20 Jan 2022 07:40:26 +0100 (CET) Received: by mail-io1-f42.google.com with SMTP id p7so5817932iod.2 for ; Wed, 19 Jan 2022 22:40:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=oyJwa06v8FNDXeEx+FEvyskyRQKYhvlL9zYVbT3Y7Tc=; b=F0zkV2nBK4GifiY83fTgjh4BeDeQOvr9XafIt07f9stIVzpMw+//0YnsmVCx5gvdRq 6yGwF+iYCX5JaKYwS+GRF6uwyuvRPXXCVMW1Jpf+6X+/qx33R0PZgqK6cbLsZvGxqslM 7epx5AGTQ+aTuWajW4susWq7NT03YSikGnNWdodF4c82z5gzKCufKzVKpL0l1jUuQNSb 6yiiQjSFC4Q1LZhGR/2yDHKO5BR8mEmFdFbwDK5Tr8Ut5GRi40pBGb6xwNkFddywZ/PF OGHmBrlwc4zFoJx8qWUgmKPs9nLyfg1A8FzKEsbeTM4nL11d+RloB3388Xpx4zUYbiAm d0XA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=oyJwa06v8FNDXeEx+FEvyskyRQKYhvlL9zYVbT3Y7Tc=; b=yyBTpuWs1o294gGc5dHfMHOLW61HjJpPI1K1+7cNZx0K5kemr+o3DEn7HZZkRGhEoW fft4EUx2gMyvHUReNFCJFUm8mY1vaU4C0QRcEQfTGYaOEh7qbOxb4nzOb2MEYZs3Ejgc UQLKU0cJxALHKqi5moasZx8LUJx22qTAtVKQO53pODeybpbvpb0zodWNTr6ENZfVEZFc GsOggHfm5UswabktwiharJFZ7cSzuWt0dxjVzNmdqU6m5pdBFQXoEO9z42Gq0Y5M1fq1 OWtRBOw44nXdu72xb17+CxcNT3kR4y+DaURRAXM/oJTKVCGzHVYkN0TtfeH/dB/yTaAx F9fQ== X-Gm-Message-State: AOAM532/8uLSHoBz7/bIB07xeanLJxiNC6RCcg8cZOez/VuTNChfQUrX STEYWYU8UtraZCsbVCiV1NDcasaFUQ1K5eu41Go= X-Google-Smtp-Source: ABdhPJwjYlm11J/XsdmqSJojcuombHTZOmDVNxi7Btk/jhDmIXf9pUd2fjLoj6fMVtmezNO35L/CsNtIzHDHeFNueYQ= X-Received: by 2002:a02:7048:: with SMTP id f69mr15992221jac.79.1642660825243; Wed, 19 Jan 2022 22:40:25 -0800 (PST) MIME-Version: 1.0 References: <20220119094327.1488398-1-rbhansali@marvell.com> In-Reply-To: <20220119094327.1488398-1-rbhansali@marvell.com> From: Jerin Jacob Date: Thu, 20 Jan 2022 12:09:59 +0530 Message-ID: Subject: Re: [PATCH v2 1/2] common/cnxk: get head-tail of Rx and Tx queues To: Rahul Bhansali , Ferruh Yigit Cc: dpdk-dev , Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Ray Kinsella , Jerin Jacob Content-Type: text/plain; charset="UTF-8" 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 On Wed, Jan 19, 2022 at 3:14 PM Rahul Bhansali wrote: > > Adds roc APIs roc_nix_cq_head_tail_get, roc_nix_sq_head_tail_get > to get head-tail of receive and transmit queue respectively. > > Signed-off-by: Rahul Bhansali Series Acked-by: Jerin Jacob Series applied to dpdk-next-net-mrvl/for-next-net. Thanks. Changed the git log to: common/cnxk: get head and tail of Rx and Tx queues Adds roc APIs roc_nix_cq_head_tail_get(), roc_nix_sq_head_tail_get() to get tail and head of receive and transmit queue respectively. Signed-off-by: Rahul Bhansali Acked-by: Ray Kinsella Acked-by: Jerin Jacob > --- > v2 changes: > - No change > > drivers/common/cnxk/roc_nix.h | 4 +++ > drivers/common/cnxk/roc_nix_queue.c | 53 +++++++++++++++++++++++++++++ > drivers/common/cnxk/version.map | 2 ++ > 3 files changed, 59 insertions(+) > > diff --git a/drivers/common/cnxk/roc_nix.h b/drivers/common/cnxk/roc_nix.h > index 69a5e8e7b4..d79abfef9f 100644 > --- a/drivers/common/cnxk/roc_nix.h > +++ b/drivers/common/cnxk/roc_nix.h > @@ -795,8 +795,12 @@ int __roc_api roc_nix_rq_ena_dis(struct roc_nix_rq *rq, bool enable); > int __roc_api roc_nix_rq_fini(struct roc_nix_rq *rq); > int __roc_api roc_nix_cq_init(struct roc_nix *roc_nix, struct roc_nix_cq *cq); > int __roc_api roc_nix_cq_fini(struct roc_nix_cq *cq); > +void __roc_api roc_nix_cq_head_tail_get(struct roc_nix *roc_nix, uint16_t qid, > + uint32_t *head, uint32_t *tail); > int __roc_api roc_nix_sq_init(struct roc_nix *roc_nix, struct roc_nix_sq *sq); > int __roc_api roc_nix_sq_fini(struct roc_nix_sq *sq); > +void __roc_api roc_nix_sq_head_tail_get(struct roc_nix *roc_nix, uint16_t qid, > + uint32_t *head, uint32_t *tail); > > /* PTP */ > int __roc_api roc_nix_ptp_rx_ena_dis(struct roc_nix *roc_nix, int enable); > diff --git a/drivers/common/cnxk/roc_nix_queue.c b/drivers/common/cnxk/roc_nix_queue.c > index c638cd43e4..67f83acdf2 100644 > --- a/drivers/common/cnxk/roc_nix_queue.c > +++ b/drivers/common/cnxk/roc_nix_queue.c > @@ -969,3 +969,56 @@ roc_nix_sq_fini(struct roc_nix_sq *sq) > > return rc; > } > + > +void > +roc_nix_cq_head_tail_get(struct roc_nix *roc_nix, uint16_t qid, uint32_t *head, > + uint32_t *tail) > +{ > + struct nix *nix = roc_nix_to_nix_priv(roc_nix); > + uint64_t reg, val; > + int64_t *addr; > + > + if (head == NULL || tail == NULL) > + return; > + > + reg = (((uint64_t)qid) << 32); > + addr = (int64_t *)(nix->base + NIX_LF_CQ_OP_STATUS); > + val = roc_atomic64_add_nosync(reg, addr); > + if (val & > + (BIT_ULL(NIX_CQ_OP_STAT_OP_ERR) | BIT_ULL(NIX_CQ_OP_STAT_CQ_ERR))) > + val = 0; > + > + *tail = (uint32_t)(val & 0xFFFFF); > + *head = (uint32_t)((val >> 20) & 0xFFFFF); > +} > + > +void > +roc_nix_sq_head_tail_get(struct roc_nix *roc_nix, uint16_t qid, uint32_t *head, > + uint32_t *tail) > +{ > + struct nix *nix = roc_nix_to_nix_priv(roc_nix); > + struct roc_nix_sq *sq = nix->sqs[qid]; > + uint16_t sqes_per_sqb, sqb_cnt; > + uint64_t reg, val; > + int64_t *addr; > + > + if (head == NULL || tail == NULL) > + return; > + > + reg = (((uint64_t)qid) << 32); > + addr = (int64_t *)(nix->base + NIX_LF_SQ_OP_STATUS); > + val = roc_atomic64_add_nosync(reg, addr); > + if (val & BIT_ULL(NIX_CQ_OP_STAT_OP_ERR)) { > + val = 0; > + return; > + } > + > + *tail = (uint32_t)((val >> 28) & 0x3F); > + *head = (uint32_t)((val >> 20) & 0x3F); > + sqb_cnt = (uint16_t)(val & 0xFFFF); > + > + sqes_per_sqb = 1 << sq->sqes_per_sqb_log2; > + > + /* Update tail index as per used sqb count */ > + *tail += (sqes_per_sqb * (sqb_cnt - 1)); > +} > diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map > index 07c6720f0c..a9dba47e0e 100644 > --- a/drivers/common/cnxk/version.map > +++ b/drivers/common/cnxk/version.map > @@ -107,6 +107,7 @@ INTERNAL { > roc_nix_bpf_timeunit_get; > roc_nix_cq_dump; > roc_nix_cq_fini; > + roc_nix_cq_head_tail_get; > roc_nix_cq_init; > roc_nix_cqe_dump; > roc_nix_dev_fini; > @@ -222,6 +223,7 @@ INTERNAL { > roc_nix_rx_queue_intr_enable; > roc_nix_sq_dump; > roc_nix_sq_fini; > + roc_nix_sq_head_tail_get; > roc_nix_sq_init; > roc_nix_stats_get; > roc_nix_stats_queue_get; > -- > 2.25.1 >