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 88081A0540; Wed, 6 Jul 2022 09:56:10 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7450B40E50; Wed, 6 Jul 2022 09:56:10 +0200 (CEST) Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) by mails.dpdk.org (Postfix) with ESMTP id CA7F340691 for ; Wed, 6 Jul 2022 09:56:09 +0200 (CEST) Received: by mail-pj1-f43.google.com with SMTP id z12-20020a17090a7b8c00b001ef84000b8bso9172773pjc.1 for ; Wed, 06 Jul 2022 00:56:09 -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=VO4MoOoplGYYElTucpko2HqmLq2WXyyrH49MijaGmi0=; b=XOzVadT7Qpzo0xBuZOzJzUTLbGLmeyWp0ZAVFK15hUPDRQ5pD1Rlqo34CXZ2SugoqN RaABEtkxUwdTWupBMKmLsNElg9/Con4SUOrdHXWkQg4CYVlsSC0ovhigWmoBSeXcQl4O 5DwGOgwtBnSagMLX1zyojx1wR9idAPKcZn3V3CtZbVWe2hlPCbSeXVojqF9o9IPnYIkH ZXFBgcb1nV+j1eIpnW7y1j5VguX9J1DYf/xWCTRIPGkdbppxRTqizKMEelkabrMhiDFt 0zHbqN5N/O9T84u+YkG9VrVwr2JWmLb/qWc6tCPSyyiYN0t86yjzW7m8A8GtGdj8y7+V jHYg== 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=VO4MoOoplGYYElTucpko2HqmLq2WXyyrH49MijaGmi0=; b=a/3TyekLvtHHDJAwwKrTKc9x194pvdje5SKXhkdqN7WUXtNOqnq+qh8xKo3ndPjmct GYqf+1vVVvBAdpniJBhstA4vFQ4kQB5Brdym4KrpyQUMWDRnPfdnRUrYyJFL8z5ODqhe SOd2SLLPfUKM5ESNqR067Be2w2tv/lROY6Eno5haxsetnSab/99YM+UbmaSUssRRno+U G+ebvc2r86j1SzN+T3WY7Y/QloRy1GDi7hy9Wbggtq4mD/g5tN/kInlZuehHn5uDRx9Y ydvAiF416NGLHkn1+K6cptAzrwSD1mxN0sYieX9+VsxFKLnsKEBFcPcuV2GCJBjyAh+B P89g== X-Gm-Message-State: AJIora8SXcFskVA10mjgYrSbPb08aWllww66lvNhhxR+j3OQvGrZyt3k MlHa6FzPV+Ylj75RMl/9O31ExsxQYosikJ0+ X-Google-Smtp-Source: AGRyM1sfE5S69vmZR65TGH++iJJlOd2SWvlZx+Ova7cHhmFDEqUEj2+gyPSQJ59rcSoZ6KrWPG40dA== X-Received: by 2002:a17:90b:390e:b0:1ed:1133:8711 with SMTP id ob14-20020a17090b390e00b001ed11338711mr46376766pjb.90.1657094168825; Wed, 06 Jul 2022 00:56:08 -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.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 00:56:08 -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 01/29] net/qdma: add net PMD template Date: Wed, 6 Jul 2022 13:21:51 +0530 Message-Id: <20220706075219.517046-2-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 Content-Transfer-Encoding: 8bit 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 probe and remove function template for qdma PMD. define supported PCI device table. Signed-off-by: Aman Kumar --- drivers/net/qdma/meson.build | 18 ++++++ drivers/net/qdma/qdma_ethdev.c | 107 +++++++++++++++++++++++++++++++++ drivers/net/qdma/version.map | 3 + 3 files changed, 128 insertions(+) create mode 100644 drivers/net/qdma/meson.build create mode 100644 drivers/net/qdma/qdma_ethdev.c create mode 100644 drivers/net/qdma/version.map diff --git a/drivers/net/qdma/meson.build b/drivers/net/qdma/meson.build new file mode 100644 index 0000000000..fe9d2d48d7 --- /dev/null +++ b/drivers/net/qdma/meson.build @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2021-2022 Xilinx, Inc. All rights reserved. +# Copyright(c) 2022 VVDN Technologies Private Limited. All rights reserved. + +if not is_linux + build = false + reason = 'only supported on Linux' +endif +if (not dpdk_conf.has('RTE_ARCH_X86_64')) + build = false + reason = 'only supported on x86_64' +endif + +includes += include_directories('.') + +sources = files( + 'qdma_ethdev.c', +) diff --git a/drivers/net/qdma/qdma_ethdev.c b/drivers/net/qdma/qdma_ethdev.c new file mode 100644 index 0000000000..35d7c88658 --- /dev/null +++ b/drivers/net/qdma/qdma_ethdev.c @@ -0,0 +1,107 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2017-2022 Xilinx, Inc. All rights reserved. + * Copyright(c) 2022 VVDN Technologies Private Limited. All rights reserved. + */ + +#include +#include +#include +#include +#include + +/* + * The set of PCI devices this driver supports + */ +static struct rte_pci_id qdma_pci_id_tbl[] = { +#define RTE_PCI_DEV_ID_DECL(vend, dev) {RTE_PCI_DEVICE(vend, dev)}, +#ifndef PCI_VENDOR_ID_VVDN +#define PCI_VENDOR_ID_VVDN 0x1f44 +#endif + + /** Gen 3 PF */ + /** PCIe lane width x8 */ + RTE_PCI_DEV_ID_DECL(PCI_VENDOR_ID_VVDN, 0x0201) /** PF */ + + { .vendor_id = 0, /* sentinel */ }, +}; + +/** + * DPDK callback to register a PCI device. + * + * This function creates an Ethernet device for each port of a given + * PCI device. + * + * @param[in] dev + * Pointer to Ethernet device structure. + * + * @return + * 0 on success, negative errno value on failure. + */ +static int qdma_eth_dev_init(struct rte_eth_dev *dev) +{ + struct rte_pci_device *pci_dev; + + /* sanity checks */ + if (dev == NULL) + return -EINVAL; + if (dev->data == NULL) + return -EINVAL; + if (dev->data->dev_private == NULL) + return -EINVAL; + + pci_dev = RTE_ETH_DEV_TO_PCI(dev); + if (pci_dev == NULL) + return -EINVAL; + + /* for secondary processes, we don't initialise any further as primary + * has already done this work. + */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return 0; + + return 0; +} + +/** + * DPDK callback to deregister PCI device. + * + * @param[in] dev + * Pointer to Ethernet device structure. + * + * @return + * 0 on success, negative errno value on failure. + */ +static int qdma_eth_dev_uninit(struct rte_eth_dev *dev) +{ + /* sanity checks */ + if (dev == NULL) + return -EINVAL; + /* only uninitialize in the primary process */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return -EPERM; + + return 0; +} + +static int eth_qdma_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, + struct rte_pci_device *pci_dev) +{ + return rte_eth_dev_pci_generic_probe(pci_dev, 0, + qdma_eth_dev_init); +} + +/* Detach a ethdev interface */ +static int eth_qdma_pci_remove(struct rte_pci_device *pci_dev) +{ + return rte_eth_dev_pci_generic_remove(pci_dev, qdma_eth_dev_uninit); +} + +static struct rte_pci_driver rte_qdma_pmd = { + .id_table = qdma_pci_id_tbl, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING, + .probe = eth_qdma_pci_probe, + .remove = eth_qdma_pci_remove, +}; + +RTE_PMD_REGISTER_PCI(net_qdma, rte_qdma_pmd); +RTE_PMD_REGISTER_PCI_TABLE(net_qdma, qdma_pci_id_tbl); diff --git a/drivers/net/qdma/version.map b/drivers/net/qdma/version.map new file mode 100644 index 0000000000..c2e0723b4c --- /dev/null +++ b/drivers/net/qdma/version.map @@ -0,0 +1,3 @@ +DPDK_22 { + local: *; +}; -- 2.36.1