DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] compress/isal: fixes ISA-L PMD used with offsets in mbuf
@ 2018-07-10 12:44 Lee Daly
  2018-07-11  8:48 ` De Lara Guarch, Pablo
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Lee Daly @ 2018-07-10 12:44 UTC (permalink / raw)
  To: pablo.de.lara.guarch; +Cc: dev, Lee Daly, stable

This patch allows the ISA-L compression PMD,
to be used with offsets in the mbuf.
Offsets can now be used for source and destination buffers,
during compression or decompression.

Fixes: dc49e6a "compress/isal: add ISA-L compression functionality"
Fixes: 7bf4f06 "compress/isal: add ISA-L decomp functionality"
Cc: stable@dpdk.org

Signed-off-by: Lee Daly <lee.daly@intel.com>
---
 drivers/compress/isal/isal_compress_pmd.c | 60 ++++++++++++++++++++++---------
 1 file changed, 44 insertions(+), 16 deletions(-)

diff --git a/drivers/compress/isal/isal_compress_pmd.c b/drivers/compress/isal/isal_compress_pmd.c
index 0f025a3..747ded1 100644
--- a/drivers/compress/isal/isal_compress_pmd.c
+++ b/drivers/compress/isal/isal_compress_pmd.c
@@ -211,19 +211,6 @@ process_isal_deflate(struct rte_comp_op *op, struct isal_comp_qp *qp,
 	qp->stream->level = priv_xform->compress.level;
 	qp->stream->level_buf_size = priv_xform->level_buffer_size;
 
-	/* Point compression stream structure to input/output buffers */
-	qp->stream->avail_in = op->src.length;
-	qp->stream->next_in = rte_pktmbuf_mtod(op->m_src, uint8_t *);
-	qp->stream->avail_out = op->m_dst->data_len;
-	qp->stream->next_out  = rte_pktmbuf_mtod(op->m_dst, uint8_t *);
-	qp->stream->end_of_stream = 1; /* All input consumed in one go */
-
-	if (unlikely(!qp->stream->next_in || !qp->stream->next_out)) {
-		ISAL_PMD_LOG(ERR, "Invalid source or destination buffers\n");
-		op->status = RTE_COMP_OP_STATUS_INVALID_ARGS;
-		return -1;
-	}
-
 	/* Set op huffman code */
 	if (priv_xform->compress.deflate.huffman == RTE_COMP_HUFFMAN_FIXED)
 		isal_deflate_set_hufftables(qp->stream, NULL,
@@ -238,6 +225,33 @@ process_isal_deflate(struct rte_comp_op *op, struct isal_comp_qp *qp,
 		isal_deflate_set_hufftables(qp->stream, NULL,
 				IGZIP_HUFFTABLE_DEFAULT);
 
+	qp->stream->end_of_stream = 1; /* All input consumed in one go */
+	if ((op->src.length + op->src.offset) > op->m_src->data_len) {
+		ISAL_PMD_LOG(ERR, "Input mbuf not big enough for offset.\n");
+		op->status = RTE_COMP_OP_STATUS_INVALID_ARGS;
+		return -1;
+	}
+	/* Point compression stream to input buffer */
+	qp->stream->avail_in = op->src.length;
+	qp->stream->next_in = rte_pktmbuf_mtod_offset(op->m_src, uint8_t *,
+			op->src.offset);
+
+	if (op->dst.offset > op->m_dst->data_len) {
+		ISAL_PMD_LOG(ERR, "Output mbuf not big enough for offset.\n");
+		op->status = RTE_COMP_OP_STATUS_INVALID_ARGS;
+		return -1;
+	}
+	/*  Point compression stream to output buffer */
+	qp->stream->avail_out = op->m_dst->data_len;
+	qp->stream->next_out  = rte_pktmbuf_mtod_offset(op->m_dst, uint8_t *,
+		op->dst.offset);
+
+	if (unlikely(!qp->stream->next_in || !qp->stream->next_out)) {
+		ISAL_PMD_LOG(ERR, "Invalid source or destination buffers\n");
+		op->status = RTE_COMP_OP_STATUS_INVALID_ARGS;
+		return -1;
+	}
+
 	/* Execute compression operation */
 	ret =  isal_deflate_stateless(qp->stream);
 
@@ -277,11 +291,25 @@ process_isal_inflate(struct rte_comp_op *op, struct isal_comp_qp *qp)
 	/* Initialize decompression state */
 	isal_inflate_init(qp->state);
 
-	/* Point decompression state structure to input/output buffers */
+	if ((op->src.length + op->src.offset) > op->m_src->data_len) {
+		ISAL_PMD_LOG(ERR, "Input mbuf not big enough for offset.\n");
+		op->status = RTE_COMP_OP_STATUS_INVALID_ARGS;
+		return -1;
+	}
+	/* Point decompression state to input buffer */
 	qp->state->avail_in = op->src.length;
-	qp->state->next_in = rte_pktmbuf_mtod(op->m_src, uint8_t *);
+	qp->state->next_in = rte_pktmbuf_mtod_offset(op->m_src, uint8_t *,
+			op->src.offset);
+
+	if (op->dst.offset > op->m_dst->data_len) {
+		ISAL_PMD_LOG(ERR, "Output mbuf not big enough for offset.\n");
+		op->status = RTE_COMP_OP_STATUS_INVALID_ARGS;
+		return -1;
+	}
+	/* Point decompression state to output buffer */
 	qp->state->avail_out = op->m_dst->data_len;
-	qp->state->next_out  = rte_pktmbuf_mtod(op->m_dst, uint8_t *);
+	qp->state->next_out  = rte_pktmbuf_mtod_offset(op->m_dst, uint8_t *,
+			op->dst.offset);
 
 	if (unlikely(!qp->state->next_in || !qp->state->next_out)) {
 		ISAL_PMD_LOG(ERR, "Invalid source or destination buffers\n");
-- 
2.7.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] compress/isal: fixes ISA-L PMD used with offsets in mbuf
  2018-07-10 12:44 [dpdk-dev] [PATCH] compress/isal: fixes ISA-L PMD used with offsets in mbuf Lee Daly
@ 2018-07-11  8:48 ` De Lara Guarch, Pablo
  2018-07-11 13:09 ` De Lara Guarch, Pablo
  2018-07-11 14:21 ` [dpdk-dev] [PATCH v2] compress/isal: fix offset usage Lee Daly
  2 siblings, 0 replies; 6+ messages in thread
From: De Lara Guarch, Pablo @ 2018-07-11  8:48 UTC (permalink / raw)
  To: Daly, Lee; +Cc: dev, stable

Hi Lee,

> -----Original Message-----
> From: Daly, Lee
> Sent: Tuesday, July 10, 2018 1:44 PM
> To: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
> Cc: dev@dpdk.org; Daly, Lee <lee.daly@intel.com>; stable@dpdk.org
> Subject: [PATCH] compress/isal: fixes ISA-L PMD used with offsets in mbuf
> 

No need to use ISA-L PMD in the title, as it is a duplicate.
Also, titles always start with verb in infinitive (fix).
So, maybe a suggestion could be: "compress/isal: fix offset usage"?


> This patch allows the ISA-L compression PMD, to be used with offsets in the
> mbuf.
> Offsets can now be used for source and destination buffers, during compression
> or decompression.
> 
> Fixes: dc49e6a "compress/isal: add ISA-L compression functionality"
> Fixes: 7bf4f06 "compress/isal: add ISA-L decomp functionality"
> Cc: stable@dpdk.org
> 
> Signed-off-by: Lee Daly <lee.daly@intel.com>

...

> +	qp->stream->end_of_stream = 1; /* All input consumed in one go */
> +	if ((op->src.length + op->src.offset) > op->m_src->data_len) {
> +		ISAL_PMD_LOG(ERR, "Input mbuf not big enough for
> offset.\n");

I would rephrase this to "Input buffer not big enough for the length and offset provided".
Same for inflate.

> +		op->status = RTE_COMP_OP_STATUS_INVALID_ARGS;
> +		return -1;
> +	}
> +	/* Point compression stream to input buffer */
> +	qp->stream->avail_in = op->src.length;
> +	qp->stream->next_in = rte_pktmbuf_mtod_offset(op->m_src, uint8_t *,
> +			op->src.offset);
> +
> +	if (op->dst.offset > op->m_dst->data_len) {
> +		ISAL_PMD_LOG(ERR, "Output mbuf not big enough for
> offset.\n");

I would rephrase this to "Output buffer not big enough for the offset provided".
Same for inflate.

> +		op->status = RTE_COMP_OP_STATUS_INVALID_ARGS;
> +		return -1;
> +	}

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] compress/isal: fixes ISA-L PMD used with offsets in mbuf
  2018-07-10 12:44 [dpdk-dev] [PATCH] compress/isal: fixes ISA-L PMD used with offsets in mbuf Lee Daly
  2018-07-11  8:48 ` De Lara Guarch, Pablo
@ 2018-07-11 13:09 ` De Lara Guarch, Pablo
  2018-07-11 14:21 ` [dpdk-dev] [PATCH v2] compress/isal: fix offset usage Lee Daly
  2 siblings, 0 replies; 6+ messages in thread
From: De Lara Guarch, Pablo @ 2018-07-11 13:09 UTC (permalink / raw)
  To: Daly, Lee; +Cc: dev, stable

Hi Lee,

> -----Original Message-----
> From: Daly, Lee
> Sent: Tuesday, July 10, 2018 1:44 PM
> To: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
> Cc: dev@dpdk.org; Daly, Lee <lee.daly@intel.com>; stable@dpdk.org
> Subject: [PATCH] compress/isal: fixes ISA-L PMD used with offsets in mbuf
> 
> This patch allows the ISA-L compression PMD, to be used with offsets in the
> mbuf.
> Offsets can now be used for source and destination buffers, during compression
> or decompression.
> 
> Fixes: dc49e6a "compress/isal: add ISA-L compression functionality"
> Fixes: 7bf4f06 "compress/isal: add ISA-L decomp functionality"
> Cc: stable@dpdk.org
> 
> Signed-off-by: Lee Daly <lee.daly@intel.com>
> ---
>  drivers/compress/isal/isal_compress_pmd.c | 60 ++++++++++++++++++++++----

...

> +	/* Point decompression state to output buffer */
>  	qp->state->avail_out = op->m_dst->data_len;

Actually, I think "avail_out = data_len - dst.offset"

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH v2] compress/isal: fix offset usage
  2018-07-10 12:44 [dpdk-dev] [PATCH] compress/isal: fixes ISA-L PMD used with offsets in mbuf Lee Daly
  2018-07-11  8:48 ` De Lara Guarch, Pablo
  2018-07-11 13:09 ` De Lara Guarch, Pablo
@ 2018-07-11 14:21 ` Lee Daly
  2018-07-13 14:20   ` De Lara Guarch, Pablo
  2 siblings, 1 reply; 6+ messages in thread
From: Lee Daly @ 2018-07-11 14:21 UTC (permalink / raw)
  To: pablo.de.lara.guarch; +Cc: dev, Lee Daly, stable

This patch allows the ISA-L compression PMD,
to be used with offsets in the mbuf.
Offsets can now be used for source and destination buffers,
during compression or decompression.

V2 - commit message change.
   - error log message reword.
   - avail_out not taking offset into account.


Fixes: dc49e6a "compress/isal: add ISA-L compression functionality"
Fixes: 7bf4f06 "compress/isal: add ISA-L decomp functionality"
Cc: stable@dpdk.org

Signed-off-by: Lee Daly <lee.daly@intel.com>
---
 drivers/compress/isal/isal_compress_pmd.c | 66 +++++++++++++++++++++++--------
 1 file changed, 49 insertions(+), 17 deletions(-)

diff --git a/drivers/compress/isal/isal_compress_pmd.c b/drivers/compress/isal/isal_compress_pmd.c
index 0f025a3..78051f1 100644
--- a/drivers/compress/isal/isal_compress_pmd.c
+++ b/drivers/compress/isal/isal_compress_pmd.c
@@ -211,19 +211,6 @@ process_isal_deflate(struct rte_comp_op *op, struct isal_comp_qp *qp,
 	qp->stream->level = priv_xform->compress.level;
 	qp->stream->level_buf_size = priv_xform->level_buffer_size;
 
-	/* Point compression stream structure to input/output buffers */
-	qp->stream->avail_in = op->src.length;
-	qp->stream->next_in = rte_pktmbuf_mtod(op->m_src, uint8_t *);
-	qp->stream->avail_out = op->m_dst->data_len;
-	qp->stream->next_out  = rte_pktmbuf_mtod(op->m_dst, uint8_t *);
-	qp->stream->end_of_stream = 1; /* All input consumed in one go */
-
-	if (unlikely(!qp->stream->next_in || !qp->stream->next_out)) {
-		ISAL_PMD_LOG(ERR, "Invalid source or destination buffers\n");
-		op->status = RTE_COMP_OP_STATUS_INVALID_ARGS;
-		return -1;
-	}
-
 	/* Set op huffman code */
 	if (priv_xform->compress.deflate.huffman == RTE_COMP_HUFFMAN_FIXED)
 		isal_deflate_set_hufftables(qp->stream, NULL,
@@ -238,6 +225,35 @@ process_isal_deflate(struct rte_comp_op *op, struct isal_comp_qp *qp,
 		isal_deflate_set_hufftables(qp->stream, NULL,
 				IGZIP_HUFFTABLE_DEFAULT);
 
+	qp->stream->end_of_stream = 1; /* All input consumed in one go */
+	if ((op->src.length + op->src.offset) > op->m_src->data_len) {
+		ISAL_PMD_LOG(ERR, "Input mbuf not big enough for the length and"
+				" offset provided.\n");
+		op->status = RTE_COMP_OP_STATUS_INVALID_ARGS;
+		return -1;
+	}
+	/* Point compression stream to input buffer */
+	qp->stream->avail_in = op->src.length;
+	qp->stream->next_in = rte_pktmbuf_mtod_offset(op->m_src, uint8_t *,
+			op->src.offset);
+
+	if (op->dst.offset > op->m_dst->data_len) {
+		ISAL_PMD_LOG(ERR, "Output mbuf not big enough for the length"
+				" and offset provided.\n");
+		op->status = RTE_COMP_OP_STATUS_INVALID_ARGS;
+		return -1;
+	}
+	/*  Point compression stream to output buffer */
+	qp->stream->avail_out = op->m_dst->data_len - op->dst.offset;
+	qp->stream->next_out  = rte_pktmbuf_mtod_offset(op->m_dst, uint8_t *,
+		op->dst.offset);
+
+	if (unlikely(!qp->stream->next_in || !qp->stream->next_out)) {
+		ISAL_PMD_LOG(ERR, "Invalid source or destination buffers\n");
+		op->status = RTE_COMP_OP_STATUS_INVALID_ARGS;
+		return -1;
+	}
+
 	/* Execute compression operation */
 	ret =  isal_deflate_stateless(qp->stream);
 
@@ -277,11 +293,27 @@ process_isal_inflate(struct rte_comp_op *op, struct isal_comp_qp *qp)
 	/* Initialize decompression state */
 	isal_inflate_init(qp->state);
 
-	/* Point decompression state structure to input/output buffers */
+	if ((op->src.length + op->src.offset) > op->m_src->data_len) {
+		ISAL_PMD_LOG(ERR, "Input mbuf not big enough for the length and"
+				" offset provided.\n");
+		op->status = RTE_COMP_OP_STATUS_INVALID_ARGS;
+		return -1;
+	}
+	/* Point decompression state to input buffer */
 	qp->state->avail_in = op->src.length;
-	qp->state->next_in = rte_pktmbuf_mtod(op->m_src, uint8_t *);
-	qp->state->avail_out = op->m_dst->data_len;
-	qp->state->next_out  = rte_pktmbuf_mtod(op->m_dst, uint8_t *);
+	qp->state->next_in = rte_pktmbuf_mtod_offset(op->m_src, uint8_t *,
+			op->src.offset);
+
+	if (op->dst.offset > op->m_dst->data_len) {
+		ISAL_PMD_LOG(ERR, "Output mbuf not big enough for the length "
+				"and offset provided.\n");
+		op->status = RTE_COMP_OP_STATUS_INVALID_ARGS;
+		return -1;
+	}
+	/* Point decompression state to output buffer */
+	qp->state->avail_out = op->m_dst->data_len - op->dst.offset;
+	qp->state->next_out  = rte_pktmbuf_mtod_offset(op->m_dst, uint8_t *,
+			op->dst.offset);
 
 	if (unlikely(!qp->state->next_in || !qp->state->next_out)) {
 		ISAL_PMD_LOG(ERR, "Invalid source or destination buffers\n");
-- 
2.7.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH v2] compress/isal: fix offset usage
  2018-07-11 14:21 ` [dpdk-dev] [PATCH v2] compress/isal: fix offset usage Lee Daly
@ 2018-07-13 14:20   ` De Lara Guarch, Pablo
  2018-07-13 14:39     ` De Lara Guarch, Pablo
  0 siblings, 1 reply; 6+ messages in thread
From: De Lara Guarch, Pablo @ 2018-07-13 14:20 UTC (permalink / raw)
  To: Daly, Lee; +Cc: dev, stable



> -----Original Message-----
> From: Daly, Lee
> Sent: Wednesday, July 11, 2018 3:22 PM
> To: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
> Cc: dev@dpdk.org; Daly, Lee <lee.daly@intel.com>; stable@dpdk.org
> Subject: [PATCH v2] compress/isal: fix offset usage
> 
> This patch allows the ISA-L compression PMD, to be used with offsets in the
> mbuf.
> Offsets can now be used for source and destination buffers, during compression
> or decompression.
> 
> V2 - commit message change.
>    - error log message reword.
>    - avail_out not taking offset into account.
> 
> 
> Fixes: dc49e6a "compress/isal: add ISA-L compression functionality"
> Fixes: 7bf4f06 "compress/isal: add ISA-L decomp functionality"

Fixes lines should have 6 bytes of the commit ID

> Cc: stable@dpdk.org
> 
> Signed-off-by: Lee Daly <lee.daly@intel.com>

Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH v2] compress/isal: fix offset usage
  2018-07-13 14:20   ` De Lara Guarch, Pablo
@ 2018-07-13 14:39     ` De Lara Guarch, Pablo
  0 siblings, 0 replies; 6+ messages in thread
From: De Lara Guarch, Pablo @ 2018-07-13 14:39 UTC (permalink / raw)
  To: De Lara Guarch, Pablo, Daly, Lee; +Cc: dev, stable



> -----Original Message-----
> From: stable [mailto:stable-bounces@dpdk.org] On Behalf Of De Lara Guarch,
> Pablo
> Sent: Friday, July 13, 2018 3:20 PM
> To: Daly, Lee <lee.daly@intel.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: Re: [dpdk-stable] [PATCH v2] compress/isal: fix offset usage
> 
> 
> 
> > -----Original Message-----
> > From: Daly, Lee
> > Sent: Wednesday, July 11, 2018 3:22 PM
> > To: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
> > Cc: dev@dpdk.org; Daly, Lee <lee.daly@intel.com>; stable@dpdk.org
> > Subject: [PATCH v2] compress/isal: fix offset usage
> >
> > This patch allows the ISA-L compression PMD, to be used with offsets
> > in the mbuf.
> > Offsets can now be used for source and destination buffers, during
> > compression or decompression.
> >
> > V2 - commit message change.
> >    - error log message reword.
> >    - avail_out not taking offset into account.
> >
> >
> > Fixes: dc49e6a "compress/isal: add ISA-L compression functionality"
> > Fixes: 7bf4f06 "compress/isal: add ISA-L decomp functionality"
> 
> Fixes lines should have 6 bytes of the commit ID
> 
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Lee Daly <lee.daly@intel.com>
> 
> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

Applied to dpdk-next-crypto.
Thanks,

Pablo

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-07-13 14:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-10 12:44 [dpdk-dev] [PATCH] compress/isal: fixes ISA-L PMD used with offsets in mbuf Lee Daly
2018-07-11  8:48 ` De Lara Guarch, Pablo
2018-07-11 13:09 ` De Lara Guarch, Pablo
2018-07-11 14:21 ` [dpdk-dev] [PATCH v2] compress/isal: fix offset usage Lee Daly
2018-07-13 14:20   ` De Lara Guarch, Pablo
2018-07-13 14:39     ` De Lara Guarch, Pablo

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).