From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0063.outbound.protection.outlook.com [104.47.40.63]) by dpdk.org (Postfix) with ESMTP id EB37E1B91C for ; Fri, 22 Jun 2018 15:21:40 +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=RZ5zkIEd7fWD4H9R1wmkEp0pGG3jGi7LxfcXAgsb1hs=; b=bI6Fsoi1dyjFFYQ2L3F97r/VuMGn18ekWmc34ygq4UVqviCQ3kCnBhvSCzUVkcWMGe+uOr0Aqkkws8UZyZEhKKI7uEB6PGdTsYRF2i2/owNvF/h7e0Asa8k6lKQxm58oZm4O1k27vUweHytDOv5Fd9/k+vJUlWurKSMOV+v5g8E= Received: from CY4PR0701MB3634.namprd07.prod.outlook.com (52.132.101.164) by CY4PR0701MB3780.namprd07.prod.outlook.com (52.132.102.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.863.19; Fri, 22 Jun 2018 13:21:38 +0000 Received: from CY4PR0701MB3634.namprd07.prod.outlook.com ([fe80::f55a:7354:8d2f:cf0b]) by CY4PR0701MB3634.namprd07.prod.outlook.com ([fe80::f55a:7354:8d2f:cf0b%2]) with mapi id 15.20.0863.021; Fri, 22 Jun 2018 13:21:36 +0000 From: "Verma, Shally" To: "Daly, Lee" CC: "Trahe, Fiona" , "dev@dpdk.org" , "pathreay@caviumnetworks.com" , "Sahu, Sunila" , "Gupta, Ashish" , "De Lara Guarch, Pablo" Thread-Topic: [dpdk-dev] [PATCH v1 2/6] compress/zlib: add device setup PMD ops Thread-Index: AQHT7Dgou/fNPKY/1kaq6EF706bcK6RhWhSAgAsjOpA= Date: Fri, 22 Jun 2018 13:21:36 +0000 Message-ID: References: <1526380346-7386-1-git-send-email-shally.verma@caviumnetworks.com> <1526380346-7386-3-git-send-email-shally.verma@caviumnetworks.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Shally.Verma@cavium.com; x-originating-ip: [117.98.211.75] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; CY4PR0701MB3780; 7:AZMl6+oZMLSlZd4iasMEHEEM8FiJOYnp3dcFSbG9Q0w3dIXVO23jf9y9EBGnDBxVwv5pz/THjSuDyurIaL9KTMp/vMb+SBZI01RqFGtvL25QQKszDr/FFQVkY2vL2q01qHBwOXENKQ8DfU9KlbP+yzdI48Cgka7osTC3chD24vLealfglVszhgiezDWJF1hsj0oEQ0UeZ2z3oKUGMHthk0GLjgHYWZWNU3nPyd6yWCJLIOiovl+q7/yI7rP4491m x-ms-exchange-antispam-srfa-diagnostics: SOS;SOR; x-forefront-antispam-report: SFV:SKI; SCL:-1; SFV:NSPM; SFS:(10009020)(39380400002)(39860400002)(376002)(396003)(366004)(346002)(199004)(189003)(13464003)(7696005)(3846002)(97736004)(6116002)(316002)(4326008)(14454004)(99286004)(478600001)(66066001)(5250100002)(25786009)(53936002)(229853002)(5660300001)(2900100001)(105586002)(106356001)(7736002)(74316002)(9686003)(486006)(76176011)(102836004)(68736007)(6436002)(59450400001)(305945005)(11346002)(6916009)(26005)(446003)(3280700002)(86362001)(3660700001)(54906003)(476003)(8676002)(6246003)(81166006)(81156014)(8936002)(2906002)(72206003)(33656002)(6506007)(186003)(53546011)(55016002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR0701MB3780; H:CY4PR0701MB3634.namprd07.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; x-ms-office365-filtering-correlation-id: 93b4b20a-365e-4a65-6843-08d5d84314ec x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(711020)(2017052603328)(7153060)(7193020); SRVR:CY4PR0701MB3780; x-ms-traffictypediagnostic: CY4PR0701MB3780: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(228905959029699); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231254)(944501410)(52105095)(10201501046)(3002001)(93006095)(93001095)(149027)(150027)(6041310)(20161123562045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011)(7699016); SRVR:CY4PR0701MB3780; BCL:0; PCL:0; RULEID:; SRVR:CY4PR0701MB3780; x-forefront-prvs: 071156160B received-spf: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: FpRm3MkVPt/4BnRRmyE3BXdVfBalIcYaCY8glg4U0SwBqam6wzBRCU3kYY8buHFQLMXEWzLuTJ4l1ZbimeCKAIXouEu6pGa363RcCIwZHZ7hMNw/JjcV2gazdPhAh/xHJaOd3aALRXiM0sPe0Y0iOt5RUG3dEZbwWGmz+vrYi2BqZS37StzmAcEgiDdRn0Tw/QBq/4mhvJ2e/PmnePR6V8/wSdZtGHsht5zOXb6kRRZ35aNg+A9iOSKNYVdVQ+dKj9F9ozqUyLFDrPTl7Q03zDsVx+WdTb74ycGNj6BN4DijG5KMMJLmjNgDV/0/1sRnkLdXMh85Tqww38Idqu0lOQ== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-Network-Message-Id: 93b4b20a-365e-4a65-6843-08d5d84314ec X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Jun 2018 13:21:36.6520 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR0701MB3780 Subject: Re: [dpdk-dev] [PATCH v1 2/6] compress/zlib: add device setup PMD ops 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: Fri, 22 Jun 2018 13:21:41 -0000 Hi Lee >-----Original Message----- >From: Daly, Lee [mailto:lee.daly@intel.com] >Sent: 15 June 2018 16:39 >To: Verma, Shally >Cc: Trahe, Fiona ; dev@dpdk.org; pathreay@caviumnet= works.com; Sahu, Sunila ; >Gupta, Ashish ; De Lara Guarch, Pablo >Subject: RE: [dpdk-dev] [PATCH v1 2/6] compress/zlib: add device setup PMD= ops > >External Email > >Hi Shally, >Comments inline. > > >> -----Original Message----- >> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Shally Verma >> Sent: Tuesday, May 15, 2018 11:32 AM >> To: De Lara Guarch, Pablo >> Cc: Trahe, Fiona ; dev@dpdk.org; >> pathreay@caviumnetworks.com; Sunila Sahu >> ; Ashish Gupta >> >> Subject: [dpdk-dev] [PATCH v1 2/6] compress/zlib: add device setup PMD >> ops >> >>diff --git a/drivers/compress/zlib/zlib_pmd_ops.c b/drivers/compress/zlib= /zlib_pmd_ops.c >>new file mode 100644 >>index 0000000..0bd42f3 >>--- /dev/null >>+++ b/drivers/compress/zlib/zlib_pmd_ops.c >>@@ -0,0 +1,238 @@ >>+/* SPDX-License-Identifier: BSD-3-Clause >>+ * Copyright(c) 2018 Cavium Networks >>+ */ >>+ >>+#include >>+ >>+#include >>+#include >>+#include >>+ >>+#include "zlib_pmd_private.h" >>+ >>+static const struct rte_compressdev_capabilities zlib_pmd_capabilities[]= =3D { >>+ { /* Deflate */ >>+ .algo =3D RTE_COMP_ALGO_DEFLATE, >>+ .comp_feature_flags =3D RTE_COMP_FF_SHAREABLE_PRIV_XFORM, >[Lee] The priv_xform structure in this case is not shareable, as it contai= ns your zlib_stream structure, which contains zlibs own zstream >struct. This is not read only, the contents of this zstream will be writte= n to, which means it is not shareable across queue pairs or >devices. > [Shally] Per my understanding, SHAREABLE_PRIV_XFORM here means xform is sha= reable by all ops in one single enqueue_burst() but not across devices or q= ps by multiple threads in parallel. Does your implementation support such u= sage of shareable priv_xforms? Thanks for review. Shally >>+ .window_size =3D { >>+ .min =3D 8, >>+ .max =3D 15, >>+ .increment =3D 2 >>+ }, >>+ }, >>+ >>+ RTE_COMP_END_OF_CAPABILITIES_LIST() >>+ >>+}; >> +/** Configure device */ >> +static int >> +zlib_pmd_config(struct rte_compressdev *dev, >> + struct rte_compressdev_config *config) { >> + struct rte_mempool *mp; >> + >> + struct zlib_private *internals =3D dev->data->dev_private; >> + snprintf(internals->mp_name, RTE_MEMPOOL_NAMESIZE, >> + "stream_mp_%u", dev->data->dev_id); >> + mp =3D rte_mempool_create(internals->mp_name, >> + config->max_nb_priv_xforms + config- >> >max_nb_streams, >> + sizeof(struct zlib_priv_xform), >> + 0, 0, NULL, NULL, NULL, >> + NULL, config->socket_id, >> + 0); >[Lee] Could you add a mempool_lookup here to ensure its not already create= d please. > >> + if (mp =3D=3D NULL) { >> + ZLIB_LOG_ERR("Cannot create private xform pool on socket >> %d\n", >> + config->socket_id); >> + return -ENOMEM; >> + } >> + return 0; >> +} >> + >> +/** Start device */ >> +static int >> +zlib_pmd_start(__rte_unused struct rte_compressdev *dev) { >> + return 0; >> +} >> + >> +/** Stop device */ >> +static void >> +zlib_pmd_stop(struct rte_compressdev *dev) { >> + struct zlib_private *internals =3D dev->data->dev_private; >> + struct rte_mempool *mp =3D rte_mempool_lookup(internals- >> >mp_name); >> + rte_mempool_free(mp); >> +} >> + >[Lee] I believe it would be better to have the freeing functionality in th= e pmd_close function, as a user may want to stop a device, >without freeing its memory, especially since the start function does nothi= ng here. i.e. if the user stops device then starts again, >memory needed has been free'd but not realloc'ed. Hope this makes sense. > >> +/** Close device */ >> +static int >> +zlib_pmd_close(__rte_unused struct rte_compressdev *dev) { >> + return 0; >> +} > ><...> >> diff --git a/drivers/compress/zlib/zlib_pmd_private.h >> b/drivers/compress/zlib/zlib_pmd_private.h >> new file mode 100644 >> index 0000000..d29dc59 >> --- /dev/null >> +++ b/drivers/compress/zlib/zlib_pmd_private.h >> @@ -0,0 +1,77 @@ >> +/* SPDX-License-Identifier: BSD-3-Clause >> + * Copyright(c) 2017-2018 Cavium Networks */ >> + >> +#ifndef _RTE_ZLIB_PMD_PRIVATE_H_ >> +#define _RTE_ZLIB_PMD_PRIVATE_H_ >> + >> +#include >> +#include >> +#include >> +#include >> + >> +#define COMPRESSDEV_NAME_ZLIB_PMD compress_zlib >> +/**< ZLIB PMD device name */ >> + >> +#define ZLIB_PMD_MAX_NB_QUEUE_PAIRS 1 >> +/**< ZLIB PMD specified queue pairs */ >[Lee] Doesn't look like this macro is being used anywhere, may be better t= o remove this altogether as there is no limit in software for >queue pairs. > >> + >> +#define DEF_MEM_LEVEL 8 >> + >> +int zlib_logtype_driver; >> +#define ZLIB_LOG(level, fmt, args...) \ >> + rte_log(RTE_LOG_ ## level, zlib_logtype_driver, "%s(): "fmt "\n", = \ >> + __func__, ##args) >> + >> +#define ZLIB_LOG_INFO(fmt, args...) \ >> + ZLIB_LOG(INFO, fmt, ## args) >> +#define ZLIB_LOG_ERR(fmt, args...) \ >> + ZLIB_LOG(ERR, fmt, ## args) >> +#define ZLIB_LOG_WARN(fmt, args...) \ >> + ZLIB_LOG(WARNING, fmt, ## args) >[Lee] See previous comments re/ static logging. > >> + >> +struct zlib_private { >> + uint32_t max_nb_queue_pairs; >> + char mp_name[RTE_MEMPOOL_NAMESIZE]; >> +}; >> + >Thanks, >Lee.