[dpdk-dev] [PATCH v3 05/11] compress/isal: add queue pair related ops

De Lara Guarch, Pablo pablo.de.lara.guarch at intel.com
Tue Apr 24 11:56:07 CEST 2018



> -----Original Message-----
> From: Daly, Lee
> Sent: Tuesday, April 17, 2018 2:35 PM
> To: dev at dpdk.org
> Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch at intel.com>; Tucker, Greg B
> <greg.b.tucker at intel.com>; Jain, Deepak K <deepak.k.jain at intel.com>; Trahe,
> Fiona <fiona.trahe at intel.com>; Daly, Lee <lee.daly at intel.com>
> Subject: [PATCH v3 05/11] compress/isal: add queue pair related ops
> 
> Signed-off-by: Lee Daly <lee.daly at intel.com>
> ---
>  drivers/compress/isal/isal_compress_pmd_ops.c     | 110
> +++++++++++++++++++++-
>  drivers/compress/isal/isal_compress_pmd_private.h |   2 +
>  2 files changed, 110 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/compress/isal/isal_compress_pmd_ops.c
> b/drivers/compress/isal/isal_compress_pmd_ops.c
> index 2e9381d..73e4c84 100644
> --- a/drivers/compress/isal/isal_compress_pmd_ops.c
> +++ b/drivers/compress/isal/isal_compress_pmd_ops.c
> @@ -4,6 +4,7 @@
> 
>  #include <rte_common.h>
>  #include <rte_compressdev_pmd.h>
> +#include <rte_malloc.h>
> 
>  #include "isal_compress_pmd_private.h"
> 
> @@ -102,6 +103,111 @@ isal_comp_pmd_info_get(struct rte_compressdev
> *dev __rte_unused,
>  	}
>  }
> 
> +
> +/** Release queue pair */
> +static int
> +isal_comp_pmd_qp_release(struct rte_compressdev *dev, uint16_t qp_id) {
> +struct isal_comp_qp *qp = dev->data->queue_pairs[qp_id];
> +
> +	if (qp == NULL)
> +		return -EINVAL;
> +
> +	if (dev->data->queue_pairs[qp_id] != NULL)
> +		rte_free(dev->data->queue_pairs[qp_id]);
> +
> +	return 0;
> +}
> +
> +/** Create a ring to place process packets on */ static struct rte_ring
> +* isal_comp_pmd_qp_create_processed_pkts_ring(struct isal_comp_qp *qp,
> +		unsigned int ring_size, int socket_id) {
> +	struct rte_ring *r;
> +
> +	r = rte_ring_lookup(qp->name);
> +	if (r) {
> +		if (rte_ring_get_size(r) >= ring_size) {
> +			ISAL_PMD_LOG(DEBUG,
> +				"Reusing existing ring %s for processed
> packets",
> +				qp->name);
> +			return r;
> +		}
> +
> +			ISAL_PMD_LOG(ERR,
> +					"Unable to reuse existing ring %s for
> processed packets",

Remove one tab here, as the line is too long.

> +			 qp->name);
> +		return NULL;
> +	}
> +
> +	return rte_ring_create(qp->name, ring_size, socket_id,
> +			RING_F_SP_ENQ | RING_F_SC_DEQ);
> +}
> +
> +/** set a unique name for the queue pair based on it's name, dev_id and

"its"

> +qp_id */ static int isal_comp_pmd_qp_set_unique_name(struct
> +rte_compressdev *dev, struct isal_comp_qp *qp) {
> +	unsigned int n = snprintf(qp->name, sizeof(qp->name),
> +			"isal_compression_pmd_%u_qp_%u",
> +			dev->data->dev_id, qp->id);

Better to use strlcpy.

> +
> +	if (n >= sizeof(qp->name))
> +		return -1;
> +
> +	return 0;
> +}



More information about the dev mailing list