From patchwork Sun Nov 28 15:44:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Duszynski X-Patchwork-Id: 104735 X-Patchwork-Delegate: jerinj@marvell.com 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 BD1ECA0548; Sun, 28 Nov 2021 16:46:53 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DFCB34278A; Sun, 28 Nov 2021 16:46:23 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 7913A42767 for ; Sun, 28 Nov 2021 16:46:20 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 1ASEIsIB014713; Sun, 28 Nov 2021 07:46:19 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=aeX7EMDSgPAcuTQI++hw2ZYmbJJNpgcN4ZdCenv3ptU=; b=XUp+W55h07XhwZLcwO+YKZYAd55ZHyAEBjaGqNRjhkEkkQeA+eR0A+xKCLPOH02oKbDZ WHO7Dq1FXiwJw+GP4EPeigwrZn4897jB/xSINby9cIVL5xQoenrabt7hixfaFlqS9I1y zxIOBa5r4bXncvgPik7tX/ynMsbpS7HEG4rkZ44wxA44NSnKMBpq6MLWginim2qnOJEI 9UabL78HIwf4jU4J6g+TvA5rAnII48gh9tTGAm8YFqtwO1hIso6ZukHvy+ko9P9GSjYo q0GXqZXG7lNqPkQKRKsIv+OasnDu+F6kkQV9JONF8ZvJLBlOHSQ/QzndC/698HzSQSc6 sg== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3ckn2satmu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sun, 28 Nov 2021 07:46:19 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sun, 28 Nov 2021 07:46:17 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sun, 28 Nov 2021 07:46:17 -0800 Received: from localhost.localdomain (unknown [10.28.34.39]) by maili.marvell.com (Postfix) with ESMTP id 9860D3F70B7; Sun, 28 Nov 2021 07:46:15 -0800 (PST) From: Tomasz Duszynski To: CC: , , Tomasz Duszynski Subject: [PATCH v2 07/10] raw/cnxk_gpio: support dequeuing buffers Date: Sun, 28 Nov 2021 16:44:39 +0100 Message-ID: <20211128154442.4029049-8-tduszynski@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211128154442.4029049-1-tduszynski@marvell.com> References: <20211117002155.293267-1-tduszynski@marvell.com> <20211128154442.4029049-1-tduszynski@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: zOp1693J_Z_0rdnKF6TUYoZsvcSI3FXi X-Proofpoint-ORIG-GUID: zOp1693J_Z_0rdnKF6TUYoZsvcSI3FXi X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-11-28_06,2021-11-28_01,2020-04-07_01 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 Add support for dequeuing buffers. Signed-off-by: Tomasz Duszynski --- drivers/raw/cnxk_gpio/cnxk_gpio.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/raw/cnxk_gpio/cnxk_gpio.c b/drivers/raw/cnxk_gpio/cnxk_gpio.c index c08ccdfbb8..244a625822 100644 --- a/drivers/raw/cnxk_gpio/cnxk_gpio.c +++ b/drivers/raw/cnxk_gpio/cnxk_gpio.c @@ -307,8 +307,34 @@ cnxk_gpio_enqueue_bufs(struct rte_rawdev *dev, struct rte_rawdev_buf **buffers, return 1; } +static int +cnxk_gpio_dequeue_bufs(struct rte_rawdev *dev, struct rte_rawdev_buf **buffers, + unsigned int count, rte_rawdev_obj_t context) +{ + struct cnxk_gpiochip *gpiochip = dev->dev_private; + unsigned int queue = (size_t)context; + struct cnxk_gpio *gpio; + + if (count == 0) + return 0; + + gpio = cnxk_gpio_lookup(gpiochip, queue); + if (!gpio) + return -ENODEV; + + if (gpio->rsp) { + buffers[0]->buf_addr = gpio->rsp; + gpio->rsp = NULL; + + return 1; + } + + return 0; +} + static const struct rte_rawdev_ops cnxk_gpio_rawdev_ops = { .enqueue_bufs = cnxk_gpio_enqueue_bufs, + .dequeue_bufs = cnxk_gpio_dequeue_bufs, .queue_def_conf = cnxk_gpio_queue_def_conf, .queue_count = cnxk_gpio_queue_count, .queue_setup = cnxk_gpio_queue_setup,