From patchwork Wed Jul 6 07:52:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aman Kumar X-Patchwork-Id: 113744 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 42139A0540; Wed, 6 Jul 2022 09:59:13 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BF83542BD3; Wed, 6 Jul 2022 09:57:18 +0200 (CEST) Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by mails.dpdk.org (Postfix) with ESMTP id 2C58840DDE for ; Wed, 6 Jul 2022 09:57:17 +0200 (CEST) Received: by mail-pl1-f180.google.com with SMTP id p9so2864597plr.11 for ; Wed, 06 Jul 2022 00:57:17 -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=MrlXQnMDYiAt9YKytDqU4wT1ZUnpqE+khLVSGceTG5c=; b=lEL6skod/coSwqXJZ8qayX0/uJ2dU8RCn/7MIEa6JlHb3jDzuGBCP95CR1Ydqhh44O AGj7NmJXF5FvY7S2yWPcpHacZCzkbcwIE8N7EOQCs2kEmYD5Hs38WZlOpxpy15co56yG Jglpa5+D3TDtVBK7jantUpMRxdNDegd7LCkPZ5f/2uvehB3zScHHcnMgj7NRPupi6yc9 rPP0viw/aqSzQX+jRbwrROZWX3sa4aAc6YoRCUm+G53a2tZLQgJ9u0iXo2t0shstxG/7 F5bxPVL46TWcVl9Zj8HU1E3gWJrZT1dENNfYUfDwxjjlACQ7LDuewvlPsmcAdYbDZzO0 +ruA== 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=MrlXQnMDYiAt9YKytDqU4wT1ZUnpqE+khLVSGceTG5c=; b=Hy+zovH2j8g+SMGCBKBBit4KJlvUYGQjjCnx56YLbBdGP0gN1XscBDlc0Kifji4jFa tW5EwV25/rjw/RAAxeb5QRd9q8ADglwQyOffy35qYbteS0bUSLMjubRJ8QPdKcYJGigP FOCJ5bR3xIbzF7cUYOsvK4Ij0kFpPdCqAAjBSxLFCU+aQai/kdxwgvDZJbBQmaOwAT3Y uAyBaXZ5/QEwX94bMwer1NHI3ZUayU5BepwQ7dO3xSmHDIeftqzEcf27av7DKR8zXG5E 71uipXXYQxdq8Tsn7Qj+brwZxs64PDXUUB+VNOJm1YebkNklsmdZtfTsUAo6Ub1msF8q ut/w== X-Gm-Message-State: AJIora9Cn7JCxaR2IVXaRJCFoLLMNNwnD6kZ/A8BXI7rEBBjXDmH3mIg 2DdYwmFXyFwZRO939iuRzBhQzqNh6o1mEvMz X-Google-Smtp-Source: AGRyM1uu73Sx1SfSLES4zR7Tp4H1yYTqAYwFEXKqu2gnjIRw3R5g++okbS4ydEVfSzHhwD+Dv8DRdw== X-Received: by 2002:a17:90a:4744:b0:1ee:dfa1:81ea with SMTP id y4-20020a17090a474400b001eedfa181eamr48917618pjg.5.1657094236276; Wed, 06 Jul 2022 00:57:16 -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.57.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 00:57:15 -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 26/29] net/qdma: add datapath burst API for VF Date: Wed, 6 Jul 2022 13:22:16 +0530 Message-Id: <20220706075219.517046-27-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 this patch implements routine for dev_start and dev_stop PMD ops and adds support for RX/TX datapath burst APIs for VF. Signed-off-by: Aman Kumar --- drivers/net/qdma/qdma_vf_ethdev.c | 61 +++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/drivers/net/qdma/qdma_vf_ethdev.c b/drivers/net/qdma/qdma_vf_ethdev.c index 5a54c00893..cbae4c9716 100644 --- a/drivers/net/qdma/qdma_vf_ethdev.c +++ b/drivers/net/qdma/qdma_vf_ethdev.c @@ -334,6 +334,39 @@ static int qdma_queue_context_invalidate(struct rte_eth_dev *dev, uint32_t qid, return rv; } +static int qdma_vf_dev_start(struct rte_eth_dev *dev) +{ + struct qdma_tx_queue *txq; + struct qdma_rx_queue *rxq; + uint32_t qid; + int err; + + PMD_DRV_LOG(INFO, "qdma_dev_start: Starting\n"); + /* prepare descriptor rings for operation */ + for (qid = 0; qid < dev->data->nb_tx_queues; qid++) { + txq = (struct qdma_tx_queue *)dev->data->tx_queues[qid]; + + /* Deferred Queues should not start with dev_start */ + if (!txq->tx_deferred_start) { + err = qdma_vf_dev_tx_queue_start(dev, qid); + if (err != 0) + return err; + } + } + + for (qid = 0; qid < dev->data->nb_rx_queues; qid++) { + rxq = (struct qdma_rx_queue *)dev->data->rx_queues[qid]; + + /* Deferred Queues should not start with dev_start */ + if (!rxq->rx_deferred_start) { + err = qdma_vf_dev_rx_queue_start(dev, qid); + if (err != 0) + return err; + } + } + return 0; +} + static int qdma_vf_dev_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complete) { @@ -361,6 +394,24 @@ static int qdma_vf_dev_infos_get(__rte_unused struct rte_eth_dev *dev, return 0; } +static int qdma_vf_dev_stop(struct rte_eth_dev *dev) +{ + uint32_t qid; +#ifdef RTE_LIBRTE_QDMA_DEBUG_DRIVER + struct qdma_pci_dev *qdma_dev = dev->data->dev_private; + + PMD_DRV_LOG(INFO, "VF-%d(DEVFN) Stop H2C & C2H queues", + qdma_dev->func_id); +#endif + /* reset driver's internal queue structures to default values */ + for (qid = 0; qid < dev->data->nb_tx_queues; qid++) + qdma_vf_dev_tx_queue_stop(dev, qid); + for (qid = 0; qid < dev->data->nb_rx_queues; qid++) + qdma_vf_dev_rx_queue_stop(dev, qid); + + return 0; +} + int qdma_vf_dev_close(struct rte_eth_dev *dev) { struct qdma_pci_dev *qdma_dev = dev->data->dev_private; @@ -371,6 +422,9 @@ int qdma_vf_dev_close(struct rte_eth_dev *dev) PMD_DRV_LOG(INFO, "Closing all queues\n"); + if (dev->data->dev_started) + qdma_vf_dev_stop(dev); + /* iterate over rx queues */ for (qid = 0; qid < dev->data->nb_rx_queues; ++qid) { rxq = dev->data->rx_queues[qid]; @@ -729,6 +783,8 @@ int qdma_vf_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t qid) static struct eth_dev_ops qdma_vf_eth_dev_ops = { .dev_configure = qdma_vf_dev_configure, .dev_infos_get = qdma_vf_dev_infos_get, + .dev_start = qdma_vf_dev_start, + .dev_stop = qdma_vf_dev_stop, .dev_close = qdma_vf_dev_close, .dev_reset = qdma_vf_dev_reset, .link_update = qdma_vf_dev_link_update, @@ -811,6 +867,8 @@ static int eth_qdma_vf_dev_init(struct rte_eth_dev *dev) dma_priv->h2c_bypass_mode = 0; dev->dev_ops = &qdma_vf_eth_dev_ops; + dev->rx_pkt_burst = &qdma_recv_pkts; + dev->tx_pkt_burst = &qdma_xmit_pkts; dma_priv->config_bar_idx = DEFAULT_VF_CONFIG_BAR; dma_priv->bypass_bar_idx = BAR_ID_INVALID; @@ -913,6 +971,9 @@ static int eth_qdma_vf_dev_uninit(struct rte_eth_dev *dev) if (rte_eal_process_type() != RTE_PROC_PRIMARY) return -EPERM; + if (qdma_dev->dev_configured) + qdma_vf_dev_close(dev); + qdma_ethdev_offline(dev); if (qdma_dev->reset_state != RESET_STATE_RECV_PF_RESET_REQ)