From patchwork Wed Jul 6 07:52:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aman Kumar X-Patchwork-Id: 113736 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7AE61A0540; Wed, 6 Jul 2022 09:58:04 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 55F1342B9F; Wed, 6 Jul 2022 09:56:58 +0200 (CEST) Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) by mails.dpdk.org (Postfix) with ESMTP id F3A8A42B72 for ; Wed, 6 Jul 2022 09:56:56 +0200 (CEST) Received: by mail-pj1-f54.google.com with SMTP id y14-20020a17090a644e00b001ef775f7118so11148159pjm.2 for ; Wed, 06 Jul 2022 00:56:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vvdntech-in.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ER6Dz/wooWHFKx026z30WCQH+NurYE7skyST/zxTbFk=; b=g5XeaOAYwiCe+oxEF17Xrik7ExyJAUocucCcvsXW3GApcJ+4PqTBjN+ac17SPg7VX9 S0EqxDhgEmK1roxt9gpkR+bEDV7g2hr3EJvWXmRr4caOtbKF72+SP0QZs6kG8Rif2sPC F2bpNAw9DxOpuJXRNAGetvtz2F/nVgdcDY9gJyj7/1n1jo4EbDE8LU2I75LEqD/6fgBB uYvz3a2X3wQfG7XyocMdjSJ/WlgZKE0lbaO9U2XuV5+hN7vOuCZDtoISRPPfK+dk/0KS +pTM6GKfrJRkNr2TbLN7sKI4twCYcZ4GB7D+iz7EjUx6aYx5FKq9Bo70Nu9SvBX+60Tt 40PA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ER6Dz/wooWHFKx026z30WCQH+NurYE7skyST/zxTbFk=; b=lVp+jaPhLUeKQjZzxQnf2u2smHudduC5G8Q1Mocao41fv/sOqwrNNinSLf6aZgQfPf xnX+hRd/3TgxTPHlOMcrVxK0HsrTGiPLMSyV3ViJSJ6VjDrHBJay9to7pepbkDKbiYzR 1ydjnZQdg/S+MFb6uF2ScYGnM6dYBydkKehimoRfnrBdKtwy93wHfUCaOr4luLPbReNv cYgm8CTr+AkXH35FAdKnw3X/+dxwARYgqs+Dv+3KhsaHyVtGUijwAm+gYbNB4mn3x7e3 hUwHFx5CvC1bT1dvP+NaQDKC6YeVCNExOyd/K4tEUYX6xp80mMP8B20lPEKU6jLK5jg5 IxGg== X-Gm-Message-State: AJIora/RM+yiPzQfjrtqCG96zlGby0jrPsVEKEwEotLRO2Dc8yifIujP E/wtjujsYe8AlFJNgdevjeW9yzhnUTzTTeCV X-Google-Smtp-Source: AGRyM1sUNPNbNkwQBnqrP8JamFPYaRqpyfYYIV3zeGXHsgaYk5pxlZ6kFrup/amItETfziY/aYbmRw== X-Received: by 2002:a17:90b:38c5:b0:1ef:a7ad:ebb9 with SMTP id nn5-20020a17090b38c500b001efa7adebb9mr5474305pjb.110.1657094215973; Wed, 06 Jul 2022 00:56:55 -0700 (PDT) Received: from 470--5GDC--BLR.blore.vvdntech.com ([106.51.39.131]) by smtp.gmail.com with ESMTPSA id r4-20020a17090a438400b001ef81574355sm7378805pjg.12.2022.07.06.00.56.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 00:56:55 -0700 (PDT) From: Aman Kumar To: dev@dpdk.org Cc: maxime.coquelin@redhat.com, david.marchand@redhat.com, aman.kumar@vvdntech.in Subject: [RFC PATCH 18/29] net/qdma: add Tx queue reclaim routine Date: Wed, 6 Jul 2022 13:22:08 +0530 Message-Id: <20220706075219.517046-19-aman.kumar@vvdntech.in> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220706075219.517046-1-aman.kumar@vvdntech.in> References: <20220706075219.517046-1-aman.kumar@vvdntech.in> MIME-Version: 1.0 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 define function for dev->tx_done_cleanup for net_qdma PMD. Signed-off-by: Aman Kumar --- drivers/net/qdma/qdma_devops.c | 8 -------- drivers/net/qdma/qdma_rxtx.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/drivers/net/qdma/qdma_devops.c b/drivers/net/qdma/qdma_devops.c index 10d7d67b87..12391790f0 100644 --- a/drivers/net/qdma/qdma_devops.c +++ b/drivers/net/qdma/qdma_devops.c @@ -1717,14 +1717,6 @@ qdma_dev_txq_info_get(struct rte_eth_dev *dev, uint16_t tx_queue_id, qinfo->nb_desc = txq->nb_tx_desc - 1; } -int qdma_dev_tx_done_cleanup(void *tx_queue, uint32_t free_cnt) -{ - (void)tx_queue; - (void)free_cnt; - - return 0; -} - static struct eth_dev_ops qdma_eth_dev_ops = { .dev_configure = qdma_dev_configure, .dev_infos_get = qdma_dev_infos_get, diff --git a/drivers/net/qdma/qdma_rxtx.c b/drivers/net/qdma/qdma_rxtx.c index 1605c9973c..6842203ada 100644 --- a/drivers/net/qdma/qdma_rxtx.c +++ b/drivers/net/qdma/qdma_rxtx.c @@ -531,6 +531,34 @@ qdma_dev_rx_descriptor_status(void *rx_queue, uint16_t offset) return RTE_ETH_RX_DESC_AVAIL; } +/** + * DPDK callback to request the driver to free mbufs + * currently cached by the driver. + * + * @param tx_queue + * Pointer to Tx queue specific data structure. + * @param free_cnt + * Maximum number of packets to free. Use 0 to indicate all possible packets + * should be freed. Note that a packet may be using multiple mbufs. + * + * @return + * Failure: < 0 + * Success: >= 0 + * 0-n: Number of packets freed. More packets may still remain in ring that + * are in use. + */ +int +qdma_dev_tx_done_cleanup(void *tx_queue, uint32_t free_cnt) +{ + struct qdma_tx_queue *txq = tx_queue; + + if ((uint16_t)free_cnt >= (txq->nb_tx_desc - 1)) + return -EINVAL; + + /* Free transmitted mbufs back to pool */ + return reclaim_tx_mbuf(txq, txq->wb_status->cidx, free_cnt); +} + /* Transmit API for Streaming mode */ uint16_t qdma_xmit_pkts_st(struct qdma_tx_queue *txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)