From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0074.outbound.protection.outlook.com [104.47.41.74]) by dpdk.org (Postfix) with ESMTP id AEAD81B7C5 for ; Tue, 5 Jun 2018 12:36:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=l/DjMawaqZR6LFNBhuTMqX5QbtsXWtj6hej9njdUD5A=; b=Uqht4sAls1xYlXLTnnqeHaJgnzL0udzBujT41SnaAUsBTuP0DBdlwSxz5ydHnJ0SfrFIwmbA6BltU7Y8dmmzZ0SU2KBa6/0ODiSA1xpCc9IS17b3ZeHGmnNXE4NhthTd/3jkjP1kudB66G1eFtpDJl0byHU/7c3aXfdTmnjHYa8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Shally.Verma@cavium.com; Received: from hyd1sverma-dt.caveonetworks.com (115.113.156.2) by CY4PR0701MB3633.namprd07.prod.outlook.com (2603:10b6:910:92::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.820.11; Tue, 5 Jun 2018 10:35:56 +0000 From: Shally Verma To: pablo.de.lara.guarch@intel.com Cc: fiona.trahe@intel.com, dev@dpdk.org, pathreya@caviumnetworks.com, mchalla@caviumnetworks.com, Ashish Gupta , Sunila Sahu Date: Tue, 5 Jun 2018 16:05:07 +0530 Message-Id: <1528194913-25893-2-git-send-email-shally.verma@caviumnetworks.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1528194913-25893-1-git-send-email-shally.verma@caviumnetworks.com> References: <1528194913-25893-1-git-send-email-shally.verma@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [115.113.156.2] X-ClientProxiedBy: PN1PR0101CA0006.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:e::16) To CY4PR0701MB3633.namprd07.prod.outlook.com (2603:10b6:910:92::35) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:CY4PR0701MB3633; X-Microsoft-Exchange-Diagnostics: 1; CY4PR0701MB3633; 3:KT5kmuFeAkanhHR9slA9/6HdtwSj5EHYiIOD8eP4CkBfUfPx1BJWQ/NfZRXEzPuCb/NRToM54YLTY5MXZtHuq+KgZf3O0OC4HWhfwOK17JCUi7ZBrd862UwqSzlcU+SLVkg1cAwyNcGPuXtdGw1p89M+kE00yzodcPE2x7yfnNtEVJOzVSu+g8Bh+E2BrMPHY9SpRbVv2OVf5yrh/62fl7YLZHZlDMtdocmGyPhsjmjrhNDtSZThUaIO9Yka4Hjb; 25:orz/FG8E/mPB60h5Fx7XE7ZfTo9Mz5uZbZSaxONdo1zWh9fd4qJpTV+MAqKStGsyyCni/O/Shu7H4lq7qP1Ewe4/eKKZi7AZQQfi0mOE8Dw7dxdvNO0lGgr+KMigkSZjt02i8zj9Gj6H30tm7Rf+7Yx0M6Iv5yhPdp39ANrKxejTYhRcbTjotJJktz8CRagvRRmV8SPxVWAqGmpLP3tZiVjiOrK2NDAeiQwKE4uZg7L51809/ZR1blPqEl6wm50R26IBoqHkgIjWxEa1PiwOL1ZmK8HEjrFJ5Acvc00v/KnrX7/ocE/UWKaQtfvvA2rEwLo2c/vRjcTZge0HI05L3w==; 31:xJT2it72MVLrZkFOx+Fv5aW8ehzuC+CqBGGM/CkkY9tEBPlHSxEIc1RbkOPcZRCe0jXXl8ydIJKi+/Q0kMPMXCrw/paGPjQy1tSv9YXwXzN+Nib9Vpgv8g4SJihioyRnNzLGIFk6nUlVX4OSBaaX6yoOILFUDrlKLQzPjCmLfmTw1MMAPetKw7vJIFZE+M5seJ9aR6W6UFBvlPlDjKOacqTLec8eUeie4Fd2aC+fQLY= X-MS-TrafficTypeDiagnostic: CY4PR0701MB3633: X-Microsoft-Exchange-Diagnostics: 1; CY4PR0701MB3633; 20:3aJ8YiKa/a75dIRNOeP4Y4gwRNrAHDb7NgLzcwds0j7TvaKzVtpg5zCHRjsrvm4toxJ4NeA/R9CPoYpcnzmBH4iCGntRzUdSOonhfCzErsXdrdY6G3EOY83zTZJ36NXY4monbrCQiFHcOm9qObyhGGbORQvzyob7rlvtet4COfRQTdx8MYe700iEA5W+eJ10AKhoTdbaRNjKJTPAWjHdtFM/XUABtGgNtZg2ErqUzfRp3ClWbVK7BdVTFyJBHadw+dXm7l+HHEVN5E26g/NRyGyBXX7jbxx6QKd7WQNZ4H/+06I0Vnp30IcFB8eTzEiDOpomMZ20awqRocZ4Khts7IAlTrIaIp+rF52rz3Kf6Vx3liRYsaikg3CGz79TZyYJe7YcpIqCqLnRjwshVYWWnP+5MuBY0Ou+pX4bQ9ymvm2UK65TaoHKF1LiznM4tLJyMj3H4590XypTgR2c/1pVwwMPrT5hjZkfuXcxe+BqSknvCvoNLDzqN/5xAIq2nQZBcVutWEyg+XIA0wuslTyPyLUGX7g2YGOYONe/hgm3sBnznrFLLh0BdLHzMPQb3xCv+IfxGPHj3ViBhmMZ1r6gstjqJ7kdzNsy3r2n+vgEq6U=; 4:MO0H1TTzh7k9kfYgBPs6r5YtfH6qvq5Lkii+qpWB02ciyk6kie79oSDe6B/DNziYDa0/CKOS/s28PLkPlbPmLLNVQidwmB7hBCkjZ87YFapgbfZ7aNvebB1GxJxQ8Lg7yqHagG9oL7ovHv1gF7v1XPDPrW/NvsOVN8aM57Yt152MD5ipspU3LPvm5nz3H9QcqLoGQCDjidQIW8FcragVJhlV6kgSeuf7BhsdhsIZsmMdg+Mx1Yn4aNj1lS4L5fxG8SFX70r8pQLyZqpENw+KjQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(3231254)(944501410)(52105095)(10201501046)(3002001)(149027)(150027)(6041310)(20161123564045)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:CY4PR0701MB3633; BCL:0; PCL:0; RULEID:; SRVR:CY4PR0701MB3633; X-Forefront-PRVS: 0694C54398 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(366004)(39860400002)(346002)(396003)(376002)(189003)(199004)(6486002)(956004)(476003)(36756003)(97736004)(54906003)(5660300001)(316002)(59450400001)(386003)(25786009)(50466002)(69596002)(44832011)(53416004)(2906002)(186003)(48376002)(42882007)(52116002)(16526019)(76176011)(6512007)(486006)(8936002)(6916009)(8676002)(53936002)(6506007)(6116002)(3846002)(81166006)(105586002)(81156014)(2616005)(575784001)(2351001)(26005)(47776003)(51416003)(72206003)(305945005)(6666003)(107886003)(7736002)(16586007)(55236004)(106356001)(2361001)(4326008)(66066001)(478600001)(446003)(50226002)(11346002)(68736007); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR0701MB3633; H:hyd1sverma-dt.caveonetworks.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR0701MB3633; 23:S7U/jlEdfxnMLLJPhJIF31Amx6eAZz5mkOsuN7g?= =?us-ascii?Q?/mCoGFG4JvgARQfYvmUnL9qubx4xgYF2eismdk0LfSVRm6VrFIg+IiTZqs4S?= =?us-ascii?Q?KuK9Bhrv9JpHv5ntqqnHvW2XtnPHWobMYcDmpnR/a4XFhSLSbBW7XljQhNjK?= =?us-ascii?Q?Ser4ThPSZ4ohRs8H58nCYn+fO2Hz6iX+uANx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sIuEU9uUFCSpxWjqn5jpG51lXPDgdEAkVPmQf+C9DUfKf9SiqKLXam5mpoNfEJPXlg+pEi5ERVGFK62Yng2eyGLnO/0MUMI1WqROIAE1g==; 5:51KmKkB0lktmWuzHnWoS+BcCGPBZKlcuCR18SbjGZ68M7NDgpGa1c52uO9UdyOtXzy5AsWkeCCDykvAz0N0CLMHGynVwxhMFVC86VCHLH4OCl93vZrlNo5o/vgvhqJh9i3sk0H0PHsmwr0O+SPMNy3nCaP6i4KxeJrmohVLUTTA=; 24:UfUoWN8kMNOVpNLHhgmLPMSxwzpMjT+btIJTJ/mO9lp7ZlBFNJ7pri2Z6rLA1K6gNVVLdz41qR/HLLjP1b6aJWuLp4il6DUZXJLdyUdNRI4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR0701MB3633; 7:arG+x4Ni2wUlkWNG2uH/tct3Fhb6ctMPnUaO7tfoZTPb6Zfct4vUv3rc41M8kTZCU6d1y+eq6BGj6tnabsjRckGB/n/LKT+jaZllS1WWnJvDCo3o5ZVjuApdhBt+rs0gXuOr1Lf1RsCL5ozXcPWY6iztthcIQCn+NwUIuKW8hXXZktY3+TcpP8r8dxuIXFBRJjfOtJmo9yRay/xJfjwjFkFSrp9ZmRwQxfnR9aMU1H4v3zWlHXGCr+s4PmaUaiDu X-MS-Office365-Filtering-Correlation-Id: a12203fd-2317-4b77-6b90-08d5cad020ae X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jun 2018 10:35:56.7948 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a12203fd-2317-4b77-6b90-08d5cad020ae X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR0701MB3633 Subject: [dpdk-dev] [PATCH v1 1/7] compress/octeontx: add octeontx zip PMD support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jun 2018 10:36:01 -0000 Add octeontx zip pmd support in compressdev driver. Add device probe and remove support. Update makefile to build octeontx zip pmd Signed-off-by: Ashish Gupta Signed-off-by: Shally Verma Signed-off-by: Sunila Sahu --- config/common_base | 6 + drivers/compress/Makefile | 2 +- drivers/compress/octeontx/Makefile | 33 ++++++ drivers/compress/octeontx/meson.build | 10 ++ .../octeontx/rte_pmd_octeontx_compress_version.map | 3 + drivers/compress/octeontx/zip_pmd.c | 129 +++++++++++++++++++++ drivers/compress/octeontx/zipvf.c | 48 ++++++++ drivers/compress/octeontx/zipvf.h | 47 ++++++++ usertools/dpdk-devbind.py | 9 ++ 9 files changed, 286 insertions(+), 1 deletion(-) diff --git a/config/common_base b/config/common_base index 6b0d1cbbb..e56d14b7f 100644 --- a/config/common_base +++ b/config/common_base @@ -584,6 +584,12 @@ CONFIG_RTE_COMPRESS_MAX_DEVS=64 # CONFIG_RTE_COMPRESSDEV_TEST=n +# +# Compile PMD for Octeontx ZIPVF compression device +# +CONFIG_RTE_LIBRTE_PMD_OCTEONTX_ZIPVF=n +CONFIG_RTE_LIBRTE_PMD_OCTEONTX_ZIPVF_DEBUG=n + # # Compile PMD for ISA-L compression device # diff --git a/drivers/compress/Makefile b/drivers/compress/Makefile index 592497f51..62b4e5abe 100644 --- a/drivers/compress/Makefile +++ b/drivers/compress/Makefile @@ -4,5 +4,5 @@ include $(RTE_SDK)/mk/rte.vars.mk DIRS-$(CONFIG_RTE_LIBRTE_PMD_ISAL) += isal - +DIRS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_ZIPVF) += octeontx include $(RTE_SDK)/mk/rte.subdir.mk diff --git a/drivers/compress/octeontx/Makefile b/drivers/compress/octeontx/Makefile new file mode 100644 index 000000000..89078f085 --- /dev/null +++ b/drivers/compress/octeontx/Makefile @@ -0,0 +1,33 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2017-2018 Cavium Networks + +include $(RTE_SDK)/mk/rte.vars.mk + +# library name +LIB = librte_pmd_octeontx_zip.a + +# library version +LIBABIVER := 1 + +# build flags +CFLAGS += $(WERROR_FLAGS) +CFLAGS += -O3 +CFLAGS += -DALLOW_EXPERIMENTAL_API +CFLAGS += -I$(RTE_SDK)/drivers/compress/octeontx/include + +# external library include paths +LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring +LDLIBS += -lrte_compressdev +LDLIBS += -lrte_pci -lrte_bus_pci + +# library source files +SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_ZIPVF) += zip_pmd.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_ZIPVF) += zipvf.c + +# export include files +SYMLINK-y-include += + +# versioning export map +EXPORT_MAP := rte_pmd_octeontx_compress_version.map + +include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/compress/octeontx/meson.build b/drivers/compress/octeontx/meson.build new file mode 100644 index 000000000..cce404337 --- /dev/null +++ b/drivers/compress/octeontx/meson.build @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 Cavium Networks + +sources = files('zipvf.c', 'zip_pmd.c') +allow_experimental_apis = true +includes += include_directories('include') +deps += ['mempool_octeontx', 'bus_pci'] +ext_deps += dep + + diff --git a/drivers/compress/octeontx/rte_pmd_octeontx_compress_version.map b/drivers/compress/octeontx/rte_pmd_octeontx_compress_version.map new file mode 100644 index 000000000..33c1b976f --- /dev/null +++ b/drivers/compress/octeontx/rte_pmd_octeontx_compress_version.map @@ -0,0 +1,3 @@ +EXPERIMENTAL { + local: *; +}; diff --git a/drivers/compress/octeontx/zip_pmd.c b/drivers/compress/octeontx/zip_pmd.c new file mode 100644 index 000000000..1181bed19 --- /dev/null +++ b/drivers/compress/octeontx/zip_pmd.c @@ -0,0 +1,129 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2017-2018 Cavium Networks + */ + +#include +#include +#include +#include +#include +#include "zipvf.h" + +/* global structure to keep driver info */ +struct zip_pmd_private zip_pmd_priv; + +static int +zip_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, + struct rte_pci_device *pci_dev) +{ + int ret = 0; + char compressdev_name[RTE_COMPRESSDEV_NAME_MAX_LEN]; + struct rte_compressdev *compressdev; + struct rte_compressdev_pmd_init_params init_params = { + "", + rte_socket_id(), + }; + + ZIP_PMD_INFO("vendor_id=0x%x device_id=0x%x", + (unsigned int)pci_dev->id.vendor_id, + (unsigned int)pci_dev->id.device_id); + + rte_pci_device_name(&pci_dev->addr, compressdev_name, + sizeof(compressdev_name)); + + compressdev = rte_compressdev_pmd_create(compressdev_name, + &pci_dev->device, sizeof(struct zip_vf), &init_params); + if (compressdev == NULL) { + ZIP_PMD_ERR("driver %s: create failed", init_params.name); + return -ENODEV; + } + + /* + * create only if proc_type is primary. + */ + if (rte_eal_process_type() == RTE_PROC_PRIMARY) { + /* create vf dev with given pmd dev id */ + ret = zipvf_create(compressdev, zip_pmd_priv.num_zipvfs); + if (ret < 0) { + ZIP_PMD_ERR("Device creation failed"); + rte_compressdev_pmd_destroy(compressdev); + return ret; + } + } + + /* TBD: check if driver global structure to be shared + * too among processes. if yes, then zip_pmd_priv + * had to be allocated from shared memzone. Currently + * it is in global data segment + */ + zip_pmd_priv.zipvf_table[zip_pmd_priv.num_zipvfs] = + compressdev->data->dev_private; + zip_pmd_priv.num_zipvfs++; + + compressdev->dev_ops = &octtx_zip_pmd_ops; + /* register rx/tx burst functions for data path */ + compressdev->dequeue_burst = zip_pmd_dequeue_burst_sync; + compressdev->enqueue_burst = zip_pmd_enqueue_burst_sync; + compressdev->feature_flags = RTE_COMPDEV_FF_HW_ACCELERATED; + return ret; +} + +static int +zip_pci_remove(struct rte_pci_device *pci_dev) +{ + struct rte_compressdev *compressdev; + char compressdev_name[RTE_COMPRESSDEV_NAME_MAX_LEN]; + + if (pci_dev == NULL) { + ZIP_PMD_ERR(" Invalid PCI Device\n"); + return -EINVAL; + } + rte_pci_device_name(&pci_dev->addr, compressdev_name, + sizeof(compressdev_name)); + + compressdev = rte_compressdev_pmd_get_named_dev(compressdev_name); + if (compressdev == NULL) + return -ENODEV; + + if (rte_eal_process_type() == RTE_PROC_PRIMARY) { + if (zipvf_destroy(compressdev) < 0) + return -ENODEV; + } + return rte_compressdev_pmd_destroy(compressdev); +} + + + +static struct rte_pci_id pci_id_octtx_zipvf_table[] = { + { + RTE_PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, + PCI_DEVICE_ID_OCTEONTX_ZIPVF), + }, + { + .device_id = 0 + }, +}; + +/** + * Structure that represents a PCI driver + */ +static struct rte_pci_driver octtx_zip_pmd = { + .id_table = pci_id_octtx_zipvf_table, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING, + .probe = zip_pci_probe, + .remove = zip_pci_remove, +}; + +RTE_PMD_REGISTER_PCI(COMPRESSDEV_NAME_ZIP_PMD, octtx_zip_pmd); +RTE_PMD_REGISTER_PCI_TABLE(COMPRESSDEV_NAME_ZIP_PMD, pci_id_octtx_zipvf_table); + +RTE_INIT(octtx_zip_init_log); + +static void +octtx_zip_init_log(void) +{ + octtx_zip_logtype_driver = rte_log_register("comp_octeontx_zip"); + if (octtx_zip_logtype_driver >= 0) + rte_log_set_level(octtx_zip_logtype_driver, RTE_LOG_INFO); +} + diff --git a/drivers/compress/octeontx/zipvf.c b/drivers/compress/octeontx/zipvf.c new file mode 100644 index 000000000..e082c2849 --- /dev/null +++ b/drivers/compress/octeontx/zipvf.c @@ -0,0 +1,48 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2017-2018 Cavium Networks + */ + +#include "zipvf.h" + +int zipvf_create(struct rte_compressdev *compressdev, int vfid) +{ + struct rte_pci_device *pdev = RTE_DEV_TO_PCI(compressdev->device); + struct zip_vf *zipvf = NULL; + char *dev_name = compressdev->data->name; + void *vbar0; + uint64_t reg; + + if (pdev->mem_resource[0].phys_addr == 0ULL) + return -EIO; + + vbar0 = pdev->mem_resource[0].addr; + if (!vbar0) { + ZIP_PMD_ERR("Failed to map BAR0 of %s", dev_name); + return -ENODEV; + } + + zipvf = (struct zip_vf *)(compressdev->data->dev_private); + + if (!zipvf) + return -ENOMEM; + + zipvf->vbar0 = vbar0; + reg = zip_reg_read64(zipvf->vbar0, ZIP_VF_PF_MBOXX(0)); + /* Storing domain in local to ZIP VF */ + zipvf->dom_sdom = reg; + zipvf->pdev = pdev; + zipvf->max_nb_queue_pairs = ZIP_MAX_VF_QUEUE; + zipvf->vfid = vfid; + return 0; +} + +int zipvf_destroy(struct rte_compressdev *compressdev) +{ + struct zip_vf *vf = (struct zip_vf *)(compressdev->data->dev_private); + + /* Rewriting the domain_id in ZIP_VF_MBOX for app rerun */ + zip_reg_write64(vf->vbar0, ZIP_VF_PF_MBOXX(0), vf->dom_sdom); + + return 0; +} + diff --git a/drivers/compress/octeontx/zipvf.h b/drivers/compress/octeontx/zipvf.h new file mode 100644 index 000000000..dcaaf4e46 --- /dev/null +++ b/drivers/compress/octeontx/zipvf.h @@ -0,0 +1,47 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2017-2018 Cavium Networks + */ +#ifndef _RTE_OCTEONTX_ZIP_VF_H_ +#define _RTE_OCTEONTX_ZIP_VF_H_ + +#include +#include +#include +#include + +int octtx_zip_logtype_driver; + + +#define ZIP_PMD_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, \ + octtx_zip_logtype_driver, "%s(): "fmt "\n", \ + __func__, ##args) + +#define ZIP_PMD_INFO(fmt, args...) \ + ZIP_PMD_LOG(INFO, fmt, ## args) +#define ZIP_PMD_ERR(fmt, args...) \ + ZIP_PMD_LOG(ERR, fmt, ## args) +#define ZIP_PMD_WARN(fmt, args...) \ + ZIP_PMD_LOG(WARNING, fmt, ## args) + +/** + * ZIP VF device structure. + */ +struct zip_vf { + int vfid; + /* vf index */ + struct rte_pci_device *pdev; + /* pci device */ + void *vbar0; + /* CSR base address for underlying BAR0 VF.*/ + uint64_t dom_sdom; + /* Storing mbox domain and subdomain id for app rerun*/ + uint32_t max_nb_queue_pairs; + /* pointer to device qps */ + struct rte_mempool *zip_mp; + /* pointer to pools */ +} __rte_cache_aligned; + +int zipvf_create(struct rte_compressdev *compressdev, int vfid); + +#endif /* _RTE_ZIP_VF_H_ */ diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py index d0c420906..1d48a6cba 100755 --- a/usertools/dpdk-devbind.py +++ b/usertools/dpdk-devbind.py @@ -24,6 +24,8 @@ 'SVendor': None, 'SDevice': None} cavium_tim = {'Class': '08', 'Vendor': '177d', 'Device': 'a051', 'SVendor': None, 'SDevice': None} +cavium_zip = {'Class': '12', 'Vendor': '177d', 'Device': 'a037', + 'SVendor': None, 'SDevice': None} avp_vnic = {'Class': '05', 'Vendor': '1af4', 'Device': '1110', 'SVendor': None, 'SDevice': None} @@ -31,6 +33,7 @@ crypto_devices = [encryption_class, intel_processor_class] eventdev_devices = [cavium_sso, cavium_tim] mempool_devices = [cavium_fpa] +compress_devices = [cavium_zip] # global dict ethernet devices present. Dictionary indexed by PCI address. # Each device within this is itself a dictionary of device properties @@ -569,6 +572,10 @@ def show_status(): if status_dev == "mempool" or status_dev == "all": show_device_status(mempool_devices, "Mempool") + if status_dev == "compress" or status_dev == "all": + show_device_status(compress_devices , "Compress") + + def parse_args(): '''Parses the command-line arguments given by the user and takes the appropriate action for each''' @@ -642,6 +649,7 @@ def do_arg_actions(): get_device_details(crypto_devices) get_device_details(eventdev_devices) get_device_details(mempool_devices) + get_device_details(compress_devices) show_status() @@ -654,6 +662,7 @@ def main(): get_device_details(crypto_devices) get_device_details(eventdev_devices) get_device_details(mempool_devices) + get_device_details(compress_devices) do_arg_actions() if __name__ == "__main__": -- 2.14.3