DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Daly, Lee" <lee.daly@intel.com>
To: 'Shally Verma' <shally.verma@caviumnetworks.com>
Cc: "Trahe, Fiona" <fiona.trahe@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>,
	"pathreay@caviumnetworks.com" <pathreay@caviumnetworks.com>,
	Sunila Sahu <sunila.sahu@caviumnetworks.com>,
	Ashish Gupta <ashish.gupta@caviumnetworks.com>,
	"De Lara Guarch, Pablo" <pablo.de.lara.guarch@intel.com>
Subject: Re: [dpdk-dev] [PATCH v1 2/6] compress/zlib: add device setup PMD ops
Date: Fri, 15 Jun 2018 11:08:59 +0000	[thread overview]
Message-ID: <F5C6929789601049BEB7272E26735598574988@IRSMSX106.ger.corp.intel.com> (raw)
In-Reply-To: <1526380346-7386-3-git-send-email-shally.verma@caviumnetworks.com>

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 <pablo.de.lara.guarch@intel.com>
> Cc: Trahe, Fiona <fiona.trahe@intel.com>; dev@dpdk.org;
> pathreay@caviumnetworks.com; Sunila Sahu
> <sunila.sahu@caviumnetworks.com>; Ashish Gupta
> <ashish.gupta@caviumnetworks.com>
> 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 <string.h>
>+
>+#include <rte_common.h>
>+#include <rte_malloc.h>
>+#include <rte_compressdev_pmd.h>
>+
>+#include "zlib_pmd_private.h"
>+
>+static const struct rte_compressdev_capabilities zlib_pmd_capabilities[] = {
>+	{   /* Deflate */
>+		.algo = RTE_COMP_ALGO_DEFLATE,
>+		.comp_feature_flags = RTE_COMP_FF_SHAREABLE_PRIV_XFORM,
[Lee] The priv_xform structure in this case is not shareable, as it contains your zlib_stream structure, which contains zlibs own zstream struct. This is not read only, the contents of this zstream will be written to, which means it is not shareable across queue pairs or devices.

>+		.window_size = {
>+			.min = 8,
>+			.max = 15,
>+			.increment = 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 = dev->data->dev_private;
> +	snprintf(internals->mp_name, RTE_MEMPOOL_NAMESIZE,
> +			"stream_mp_%u", dev->data->dev_id);
> +	mp = 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 created please.

> +	if (mp == 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 = dev->data->dev_private;
> +	struct rte_mempool *mp = rte_mempool_lookup(internals-
> >mp_name);
> +	rte_mempool_free(mp);
> +}
> +
[Lee] I believe it would be better to have the freeing functionality in the pmd_close function, as a user may want to stop a device, without freeing its memory, especially since the start function does nothing 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 <zlib.h>
> +#include <rte_comp.h>
> +#include <rte_compressdev.h>
> +#include <rte_compressdev_pmd.h>
> +
> +#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 to 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.

  reply	other threads:[~2018-06-15 11:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-15 10:32 [dpdk-dev] [PATCH v1 0/6]compress: add zlib compression PMD Shally Verma
2018-05-15 10:32 ` [dpdk-dev] [PATCH v1 1/6] compress/zlib: add ZLIB PMD support Shally Verma
2018-06-15 11:08   ` Daly, Lee
2018-05-15 10:32 ` [dpdk-dev] [PATCH v1 2/6] compress/zlib: add device setup PMD ops Shally Verma
2018-06-15 11:08   ` Daly, Lee [this message]
2018-06-22 13:21     ` Verma, Shally
2018-06-25 10:05       ` Daly, Lee
2018-06-25 10:07         ` Verma, Shally
2018-05-15 10:32 ` [dpdk-dev] [PATCH v1 3/6] compress/zlib: add xform and stream create support Shally Verma
2018-06-15 11:09   ` Daly, Lee
2018-05-15 10:32 ` [dpdk-dev] [PATCH v1 4/6] compress/zlib: add enq deq apis Shally Verma
2018-06-15 11:09   ` Daly, Lee
2018-05-15 10:32 ` [dpdk-dev] [PATCH v1 5/6] test: add ZLIB PMD for compressdev tests Shally Verma
2018-05-15 10:32 ` [dpdk-dev] [PATCH v1 6/6] doc: add ZLIB PMD documentation Shally Verma
2018-06-15 11:09   ` Daly, Lee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=F5C6929789601049BEB7272E26735598574988@IRSMSX106.ger.corp.intel.com \
    --to=lee.daly@intel.com \
    --cc=ashish.gupta@caviumnetworks.com \
    --cc=dev@dpdk.org \
    --cc=fiona.trahe@intel.com \
    --cc=pablo.de.lara.guarch@intel.com \
    --cc=pathreay@caviumnetworks.com \
    --cc=shally.verma@caviumnetworks.com \
    --cc=sunila.sahu@caviumnetworks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).