patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] net/mlx5: fix concurrent use of Tx offloads
@ 2019-01-28 13:49 Dekel Peled
  2019-01-29  7:54 ` Yongseok Koh
  2019-01-29 11:27 ` [dpdk-stable] [PATCH v2] " Dekel Peled
  0 siblings, 2 replies; 7+ messages in thread
From: Dekel Peled @ 2019-01-28 13:49 UTC (permalink / raw)
  To: yskoh, shahafs; +Cc: dev, orika, dekelp, stable

Original patch implemented the use of match_metadata offload in the
different burst functions.
The concurrent use of match_metadata and multi_segs offloads was
not handled.

This patch updates function txq_scatter_v(), to pass metadata value
from mbuf to wqe, when indicated by offload flags.

Fixes: 6bd7fbd03c62 ("net/mlx5: support metadata as flow rule criteria")
Cc: stable@dpdk.org

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
---
 drivers/net/mlx5/mlx5_rxtx_vec_neon.h | 10 +++++++---
 drivers/net/mlx5/mlx5_rxtx_vec_sse.h  | 10 ++++++----
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
index 883fe1b..cfcb923 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
+++ b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
@@ -104,6 +104,7 @@
 		sizeof(struct mlx5_wqe) / MLX5_WQE_DWORD_SIZE;
 	unsigned int n;
 	volatile struct mlx5_wqe *wqe = NULL;
+	uint32_t metadata_ol = txq->offloads & DEV_TX_OFFLOAD_MATCH_METADATA;
 
 	assert(elts_n > pkts_n);
 	mlx5_tx_complete(txq);
@@ -127,6 +128,9 @@
 		uint8x16_t *t_wqe;
 		uint8_t *dseg;
 		uint8x16_t ctrl;
+		rte_be32_t metadata = (metadata_ol &&
+				       (pkts[n]->ol_flags & PKT_TX_METADATA)) ?
+						pkts[n]->tx_metadata : 0;
 
 		assert(segs_n);
 		max_elts = elts_n - (elts_head - txq->elts_tail);
@@ -164,9 +168,9 @@
 		ctrl = vqtbl1q_u8(ctrl, ctrl_shuf_m);
 		vst1q_u8((void *)t_wqe, ctrl);
 		/* Fill ESEG in the header. */
-		vst1q_u16((void *)(t_wqe + 1),
-			  ((uint16x8_t) { 0, 0, cs_flags, rte_cpu_to_be_16(len),
-					  0, 0, 0, 0 }));
+		vst1q_u32((void *)(t_wqe + 1), ((uint32x4_t) { 0,
+					 cs_flags << 16 | rte_cpu_to_be_16(len),
+					 metadata, 0 }));
 		txq->wqe_ci = wqe_ci;
 	}
 	if (!n)
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
index 14117c4..dbc7d6f 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
+++ b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
@@ -104,6 +104,7 @@
 		sizeof(struct mlx5_wqe) / MLX5_WQE_DWORD_SIZE;
 	unsigned int n;
 	volatile struct mlx5_wqe *wqe = NULL;
+	uint32_t metadata_ol = txq->offloads & DEV_TX_OFFLOAD_MATCH_METADATA;
 
 	assert(elts_n > pkts_n);
 	mlx5_tx_complete(txq);
@@ -125,6 +126,9 @@
 		uint16_t max_wqe;
 		__m128i *t_wqe, *dseg;
 		__m128i ctrl;
+		rte_be32_t metadata = (metadata_ol &&
+				       (pkts[n]->ol_flags & PKT_TX_METADATA)) ?
+						pkts[n]->tx_metadata : 0;
 
 		assert(segs_n);
 		max_elts = elts_n - (elts_head - txq->elts_tail);
@@ -164,10 +168,8 @@
 		ctrl = _mm_shuffle_epi8(ctrl, shuf_mask_ctrl);
 		_mm_store_si128(t_wqe, ctrl);
 		/* Fill ESEG in the header. */
-		_mm_store_si128(t_wqe + 1,
-				_mm_set_epi16(0, 0, 0, 0,
-					      rte_cpu_to_be_16(len), cs_flags,
-					      0, 0));
+		_mm_store_si128(t_wqe + 1, _mm_set_epi32(0, metadata,
+				(rte_cpu_to_be_16(len) << 16) | cs_flags, 0));
 		txq->wqe_ci = wqe_ci;
 	}
 	if (!n)
-- 
1.8.3.1

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

* Re: [dpdk-stable] [PATCH] net/mlx5: fix concurrent use of Tx offloads
  2019-01-28 13:49 [dpdk-stable] [PATCH] net/mlx5: fix concurrent use of Tx offloads Dekel Peled
@ 2019-01-29  7:54 ` Yongseok Koh
  2019-01-29 11:27 ` [dpdk-stable] [PATCH v2] " Dekel Peled
  1 sibling, 0 replies; 7+ messages in thread
From: Yongseok Koh @ 2019-01-29  7:54 UTC (permalink / raw)
  To: Dekel Peled; +Cc: Shahaf Shuler, dev, Ori Kam, stable

> On Jan 28, 2019, at 10:49 PM, Dekel Peled <dekelp@mellanox.com> wrote:
> 
> Original patch implemented the use of match_metadata offload in the
> different burst functions.
> The concurrent use of match_metadata and multi_segs offloads was
> not handled.
> 
> This patch updates function txq_scatter_v(), to pass metadata value
> from mbuf to wqe, when indicated by offload flags.
> 
> Fixes: 6bd7fbd03c62 ("net/mlx5: support metadata as flow rule criteria")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Dekel Peled <dekelp@mellanox.com>
> ---
> drivers/net/mlx5/mlx5_rxtx_vec_neon.h | 10 +++++++---
> drivers/net/mlx5/mlx5_rxtx_vec_sse.h  | 10 ++++++----
> 2 files changed, 13 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
> index 883fe1b..cfcb923 100644
> --- a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
> +++ b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
> @@ -104,6 +104,7 @@
> 		sizeof(struct mlx5_wqe) / MLX5_WQE_DWORD_SIZE;
> 	unsigned int n;
> 	volatile struct mlx5_wqe *wqe = NULL;
> +	uint32_t metadata_ol = txq->offloads & DEV_TX_OFFLOAD_MATCH_METADATA;

Shouldn't it be uint64_t?
Or, you just can inline it as there's only one occurrence below.

> 
> 	assert(elts_n > pkts_n);
> 	mlx5_tx_complete(txq);
> @@ -127,6 +128,9 @@
> 		uint8x16_t *t_wqe;
> 		uint8_t *dseg;
> 		uint8x16_t ctrl;
> +		rte_be32_t metadata = (metadata_ol &&
> +				       (pkts[n]->ol_flags & PKT_TX_METADATA)) ?
> +						pkts[n]->tx_metadata : 0;

Please fix indentation.
There're a few more below. Please fix all.

Thanks,
Yongseok

> 
> 		assert(segs_n);
> 		max_elts = elts_n - (elts_head - txq->elts_tail);
> @@ -164,9 +168,9 @@
> 		ctrl = vqtbl1q_u8(ctrl, ctrl_shuf_m);
> 		vst1q_u8((void *)t_wqe, ctrl);
> 		/* Fill ESEG in the header. */
> -		vst1q_u16((void *)(t_wqe + 1),
> -			  ((uint16x8_t) { 0, 0, cs_flags, rte_cpu_to_be_16(len),
> -					  0, 0, 0, 0 }));
> +		vst1q_u32((void *)(t_wqe + 1), ((uint32x4_t) { 0,
> +					 cs_flags << 16 | rte_cpu_to_be_16(len),
> +					 metadata, 0 }));
> 		txq->wqe_ci = wqe_ci;
> 	}
> 	if (!n)
> diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
> index 14117c4..dbc7d6f 100644
> --- a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
> +++ b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
> @@ -104,6 +104,7 @@
> 		sizeof(struct mlx5_wqe) / MLX5_WQE_DWORD_SIZE;
> 	unsigned int n;
> 	volatile struct mlx5_wqe *wqe = NULL;
> +	uint32_t metadata_ol = txq->offloads & DEV_TX_OFFLOAD_MATCH_METADATA;
> 
> 	assert(elts_n > pkts_n);
> 	mlx5_tx_complete(txq);
> @@ -125,6 +126,9 @@
> 		uint16_t max_wqe;
> 		__m128i *t_wqe, *dseg;
> 		__m128i ctrl;
> +		rte_be32_t metadata = (metadata_ol &&
> +				       (pkts[n]->ol_flags & PKT_TX_METADATA)) ?
> +						pkts[n]->tx_metadata : 0;
> 
> 		assert(segs_n);
> 		max_elts = elts_n - (elts_head - txq->elts_tail);
> @@ -164,10 +168,8 @@
> 		ctrl = _mm_shuffle_epi8(ctrl, shuf_mask_ctrl);
> 		_mm_store_si128(t_wqe, ctrl);
> 		/* Fill ESEG in the header. */
> -		_mm_store_si128(t_wqe + 1,
> -				_mm_set_epi16(0, 0, 0, 0,
> -					      rte_cpu_to_be_16(len), cs_flags,
> -					      0, 0));
> +		_mm_store_si128(t_wqe + 1, _mm_set_epi32(0, metadata,
> +				(rte_cpu_to_be_16(len) << 16) | cs_flags, 0));
> 		txq->wqe_ci = wqe_ci;
> 	}
> 	if (!n)
> -- 
> 1.8.3.1
> 

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

* [dpdk-stable] [PATCH v2] net/mlx5: fix concurrent use of Tx offloads
  2019-01-28 13:49 [dpdk-stable] [PATCH] net/mlx5: fix concurrent use of Tx offloads Dekel Peled
  2019-01-29  7:54 ` Yongseok Koh
@ 2019-01-29 11:27 ` Dekel Peled
  2019-01-30  4:06   ` Yongseok Koh
  2019-01-30  6:43   ` [dpdk-stable] [PATCH v3] net/mlx5: fix Tx metadata for multi-segment packet Dekel Peled
  1 sibling, 2 replies; 7+ messages in thread
From: Dekel Peled @ 2019-01-29 11:27 UTC (permalink / raw)
  To: yskoh, shahafs; +Cc: dev, orika, dekelp, stable

Original patch implemented the use of match_metadata offload in the
different burst functions.
The concurrent use of match_metadata and multi_segs offloads was
not handled.

This patch updates function txq_scatter_v(), to pass metadata value
from mbuf to wqe, when indicated by offload flags.

Fixes: 6bd7fbd03c62 ("net/mlx5: support metadata as flow rule criteria")
Cc: stable@dpdk.org

Signed-off-by: Dekel Peled <dekelp@mellanox.com>

---
v2: Apply code review comments.
---
---
 drivers/net/mlx5/mlx5_rxtx_vec_neon.h | 11 ++++++++---
 drivers/net/mlx5/mlx5_rxtx_vec_sse.h  | 11 +++++++----
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
index 883fe1b..7353457 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
+++ b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
@@ -104,6 +104,8 @@
 		sizeof(struct mlx5_wqe) / MLX5_WQE_DWORD_SIZE;
 	unsigned int n;
 	volatile struct mlx5_wqe *wqe = NULL;
+	bool metadata_ol =
+		txq->offloads & DEV_TX_OFFLOAD_MATCH_METADATA ? true : false;
 
 	assert(elts_n > pkts_n);
 	mlx5_tx_complete(txq);
@@ -127,6 +129,9 @@
 		uint8x16_t *t_wqe;
 		uint8_t *dseg;
 		uint8x16_t ctrl;
+		rte_be32_t metadata = (metadata_ol &&
+				       (pkts[n]->ol_flags & PKT_TX_METADATA)) ?
+					pkts[n]->tx_metadata : 0;
 
 		assert(segs_n);
 		max_elts = elts_n - (elts_head - txq->elts_tail);
@@ -164,9 +169,9 @@
 		ctrl = vqtbl1q_u8(ctrl, ctrl_shuf_m);
 		vst1q_u8((void *)t_wqe, ctrl);
 		/* Fill ESEG in the header. */
-		vst1q_u16((void *)(t_wqe + 1),
-			  ((uint16x8_t) { 0, 0, cs_flags, rte_cpu_to_be_16(len),
-					  0, 0, 0, 0 }));
+		vst1q_u32((void *)(t_wqe + 1), ((uint32x4_t){ 0,
+			  cs_flags << 16 | rte_cpu_to_be_16(len),
+			  metadata, 0 }));
 		txq->wqe_ci = wqe_ci;
 	}
 	if (!n)
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
index 14117c4..7b580d3 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
+++ b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
@@ -104,6 +104,8 @@
 		sizeof(struct mlx5_wqe) / MLX5_WQE_DWORD_SIZE;
 	unsigned int n;
 	volatile struct mlx5_wqe *wqe = NULL;
+	bool metadata_ol =
+		txq->offloads & DEV_TX_OFFLOAD_MATCH_METADATA ? true : false;
 
 	assert(elts_n > pkts_n);
 	mlx5_tx_complete(txq);
@@ -125,6 +127,9 @@
 		uint16_t max_wqe;
 		__m128i *t_wqe, *dseg;
 		__m128i ctrl;
+		rte_be32_t metadata = (metadata_ol &&
+				       (pkts[n]->ol_flags & PKT_TX_METADATA)) ?
+					pkts[n]->tx_metadata : 0;
 
 		assert(segs_n);
 		max_elts = elts_n - (elts_head - txq->elts_tail);
@@ -164,10 +169,8 @@
 		ctrl = _mm_shuffle_epi8(ctrl, shuf_mask_ctrl);
 		_mm_store_si128(t_wqe, ctrl);
 		/* Fill ESEG in the header. */
-		_mm_store_si128(t_wqe + 1,
-				_mm_set_epi16(0, 0, 0, 0,
-					      rte_cpu_to_be_16(len), cs_flags,
-					      0, 0));
+		_mm_store_si128(t_wqe + 1, _mm_set_epi32(0, metadata,
+				(rte_cpu_to_be_16(len) << 16) | cs_flags, 0));
 		txq->wqe_ci = wqe_ci;
 	}
 	if (!n)
-- 
1.8.3.1

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

* Re: [dpdk-stable] [PATCH v2] net/mlx5: fix concurrent use of Tx offloads
  2019-01-29 11:27 ` [dpdk-stable] [PATCH v2] " Dekel Peled
@ 2019-01-30  4:06   ` Yongseok Koh
  2019-01-30  6:43   ` [dpdk-stable] [PATCH v3] net/mlx5: fix Tx metadata for multi-segment packet Dekel Peled
  1 sibling, 0 replies; 7+ messages in thread
From: Yongseok Koh @ 2019-01-30  4:06 UTC (permalink / raw)
  To: Dekel Peled; +Cc: Shahaf Shuler, dev, Ori Kam, stable

On Tue, Jan 29, 2019 at 01:27:56PM +0200, Dekel Peled wrote:
> Original patch implemented the use of match_metadata offload in the
> different burst functions.
> The concurrent use of match_metadata and multi_segs offloads was
> not handled.
> 
> This patch updates function txq_scatter_v(), to pass metadata value
> from mbuf to wqe, when indicated by offload flags.
> 
> Fixes: 6bd7fbd03c62 ("net/mlx5: support metadata as flow rule criteria")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Dekel Peled <dekelp@mellanox.com>
> 
> ---

Not sure if the title represents this patch well.
	net/mlx5: fix concurrent use of Tx offloads

How about,
	net/mlx5: fix Tx metadata for multi-segment packet

> v2: Apply code review comments.
> ---
> ---
>  drivers/net/mlx5/mlx5_rxtx_vec_neon.h | 11 ++++++++---
>  drivers/net/mlx5/mlx5_rxtx_vec_sse.h  | 11 +++++++----
>  2 files changed, 15 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
> index 883fe1b..7353457 100644
> --- a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
> +++ b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
> @@ -104,6 +104,8 @@
>  		sizeof(struct mlx5_wqe) / MLX5_WQE_DWORD_SIZE;
>  	unsigned int n;
>  	volatile struct mlx5_wqe *wqe = NULL;
> +	bool metadata_ol =
> +		txq->offloads & DEV_TX_OFFLOAD_MATCH_METADATA ? true : false;
>  
>  	assert(elts_n > pkts_n);
>  	mlx5_tx_complete(txq);
> @@ -127,6 +129,9 @@
>  		uint8x16_t *t_wqe;
>  		uint8_t *dseg;
>  		uint8x16_t ctrl;
> +		rte_be32_t metadata = (metadata_ol &&
> +				       (pkts[n]->ol_flags & PKT_TX_METADATA)) ?
> +					pkts[n]->tx_metadata : 0;

Why pkts[n] instead of buf?
And indentation.

		rte_be32_t metadata =
			metadata_ol && (buf->ol_flags & PKT_TX_METADATA) ?
			buf->tx_metadata : 0;

>  
>  		assert(segs_n);
>  		max_elts = elts_n - (elts_head - txq->elts_tail);
> @@ -164,9 +169,9 @@
>  		ctrl = vqtbl1q_u8(ctrl, ctrl_shuf_m);
>  		vst1q_u8((void *)t_wqe, ctrl);
>  		/* Fill ESEG in the header. */
> -		vst1q_u16((void *)(t_wqe + 1),
> -			  ((uint16x8_t) { 0, 0, cs_flags, rte_cpu_to_be_16(len),
> -					  0, 0, 0, 0 }));
> +		vst1q_u32((void *)(t_wqe + 1), ((uint32x4_t){ 0,
> +			  cs_flags << 16 | rte_cpu_to_be_16(len),
> +			  metadata, 0 }));

Indentation.

		vst1q_u32((void *)(t_wqe + 1),
			  ((uint32x4_t){ 0, cs_flags << 16 |
					    rte_cpu_to_be_16(len),
					 metadata, 0 }));

>  		txq->wqe_ci = wqe_ci;
>  	}
>  	if (!n)
> diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
> index 14117c4..7b580d3 100644
> --- a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
> +++ b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
> @@ -104,6 +104,8 @@
>  		sizeof(struct mlx5_wqe) / MLX5_WQE_DWORD_SIZE;
>  	unsigned int n;
>  	volatile struct mlx5_wqe *wqe = NULL;
> +	bool metadata_ol =
> +		txq->offloads & DEV_TX_OFFLOAD_MATCH_METADATA ? true : false;
>  
>  	assert(elts_n > pkts_n);
>  	mlx5_tx_complete(txq);
> @@ -125,6 +127,9 @@
>  		uint16_t max_wqe;
>  		__m128i *t_wqe, *dseg;
>  		__m128i ctrl;
> +		rte_be32_t metadata = (metadata_ol &&
> +				       (pkts[n]->ol_flags & PKT_TX_METADATA)) ?
> +					pkts[n]->tx_metadata : 0;

		rte_be32_t metadata =
			metadata_ol && (buf->ol_flags & PKT_TX_METADATA) ?
			buf->tx_metadata : 0;

>  
>  		assert(segs_n);
>  		max_elts = elts_n - (elts_head - txq->elts_tail);
> @@ -164,10 +169,8 @@
>  		ctrl = _mm_shuffle_epi8(ctrl, shuf_mask_ctrl);
>  		_mm_store_si128(t_wqe, ctrl);
>  		/* Fill ESEG in the header. */
> -		_mm_store_si128(t_wqe + 1,
> -				_mm_set_epi16(0, 0, 0, 0,
> -					      rte_cpu_to_be_16(len), cs_flags,
> -					      0, 0));
> +		_mm_store_si128(t_wqe + 1, _mm_set_epi32(0, metadata,
> +				(rte_cpu_to_be_16(len) << 16) | cs_flags, 0));

		_mm_store_si128(t_wqe + 1,
				_mm_set_epi32(0, metadata,
					      (rte_cpu_to_be_16(len) << 16) |
					      cs_flags, 0));

Thanks,
Yongseok

>  		txq->wqe_ci = wqe_ci;
>  	}
>  	if (!n)
> -- 
> 1.8.3.1
> 

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

* [dpdk-stable] [PATCH v3] net/mlx5: fix Tx metadata for multi-segment packet
  2019-01-29 11:27 ` [dpdk-stable] [PATCH v2] " Dekel Peled
  2019-01-30  4:06   ` Yongseok Koh
@ 2019-01-30  6:43   ` Dekel Peled
  2019-01-30  7:24     ` Yongseok Koh
  1 sibling, 1 reply; 7+ messages in thread
From: Dekel Peled @ 2019-01-30  6:43 UTC (permalink / raw)
  To: yskoh, shahafs; +Cc: dev, orika, dekelp, stable

Original patch implemented the use of match_metadata offload in the
different burst functions.
The concurrent use of match_metadata and multi_segs offloads was
not handled.

This patch updates function txq_scatter_v(), to pass metadata value
from mbuf to wqe, when indicated by offload flags.

Fixes: 6bd7fbd03c62 ("net/mlx5: support metadata as flow rule criteria")
Cc: stable@dpdk.org

Signed-off-by: Dekel Peled <dekelp@mellanox.com>

---
v3: Update title, modify indentation.
v2: Apply code review comments.
---
---
 drivers/net/mlx5/mlx5_rxtx_vec_neon.h | 12 +++++++++---
 drivers/net/mlx5/mlx5_rxtx_vec_sse.h  | 11 ++++++++---
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
index 883fe1b..38e915c 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
+++ b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
@@ -104,6 +104,8 @@
 		sizeof(struct mlx5_wqe) / MLX5_WQE_DWORD_SIZE;
 	unsigned int n;
 	volatile struct mlx5_wqe *wqe = NULL;
+	bool metadata_ol =
+		txq->offloads & DEV_TX_OFFLOAD_MATCH_METADATA ? true : false;
 
 	assert(elts_n > pkts_n);
 	mlx5_tx_complete(txq);
@@ -127,6 +129,9 @@
 		uint8x16_t *t_wqe;
 		uint8_t *dseg;
 		uint8x16_t ctrl;
+		rte_be32_t metadata =
+			metadata_ol && (buf->ol_flags & PKT_TX_METADATA) ?
+			buf->tx_metadata : 0;
 
 		assert(segs_n);
 		max_elts = elts_n - (elts_head - txq->elts_tail);
@@ -164,9 +169,10 @@
 		ctrl = vqtbl1q_u8(ctrl, ctrl_shuf_m);
 		vst1q_u8((void *)t_wqe, ctrl);
 		/* Fill ESEG in the header. */
-		vst1q_u16((void *)(t_wqe + 1),
-			  ((uint16x8_t) { 0, 0, cs_flags, rte_cpu_to_be_16(len),
-					  0, 0, 0, 0 }));
+		vst1q_u32((void *)(t_wqe + 1),
+			  ((uint32x4_t){ 0,
+					 cs_flags << 16 | rte_cpu_to_be_16(len),
+					 metadata, 0 }));
 		txq->wqe_ci = wqe_ci;
 	}
 	if (!n)
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
index 14117c4..fb384ef 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
+++ b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
@@ -104,6 +104,8 @@
 		sizeof(struct mlx5_wqe) / MLX5_WQE_DWORD_SIZE;
 	unsigned int n;
 	volatile struct mlx5_wqe *wqe = NULL;
+	bool metadata_ol =
+		txq->offloads & DEV_TX_OFFLOAD_MATCH_METADATA ? true : false;
 
 	assert(elts_n > pkts_n);
 	mlx5_tx_complete(txq);
@@ -125,6 +127,9 @@
 		uint16_t max_wqe;
 		__m128i *t_wqe, *dseg;
 		__m128i ctrl;
+		rte_be32_t metadata =
+			metadata_ol && (buf->ol_flags & PKT_TX_METADATA) ?
+			buf->tx_metadata : 0;
 
 		assert(segs_n);
 		max_elts = elts_n - (elts_head - txq->elts_tail);
@@ -165,9 +170,9 @@
 		_mm_store_si128(t_wqe, ctrl);
 		/* Fill ESEG in the header. */
 		_mm_store_si128(t_wqe + 1,
-				_mm_set_epi16(0, 0, 0, 0,
-					      rte_cpu_to_be_16(len), cs_flags,
-					      0, 0));
+				_mm_set_epi32(0, metadata,
+					      (rte_cpu_to_be_16(len) << 16) |
+					      cs_flags, 0));
 		txq->wqe_ci = wqe_ci;
 	}
 	if (!n)
-- 
1.8.3.1

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

* Re: [dpdk-stable] [PATCH v3] net/mlx5: fix Tx metadata for multi-segment packet
  2019-01-30  6:43   ` [dpdk-stable] [PATCH v3] net/mlx5: fix Tx metadata for multi-segment packet Dekel Peled
@ 2019-01-30  7:24     ` Yongseok Koh
  2019-02-10 15:10       ` Shahaf Shuler
  0 siblings, 1 reply; 7+ messages in thread
From: Yongseok Koh @ 2019-01-30  7:24 UTC (permalink / raw)
  To: Dekel Peled; +Cc: Shahaf Shuler, dev, Ori Kam, stable

> On Jan 30, 2019, at 3:43 PM, Dekel Peled <dekelp@mellanox.com> wrote:
> 
> Original patch implemented the use of match_metadata offload in the
> different burst functions.
> The concurrent use of match_metadata and multi_segs offloads was
> not handled.
> 
> This patch updates function txq_scatter_v(), to pass metadata value
> from mbuf to wqe, when indicated by offload flags.
> 
> Fixes: 6bd7fbd03c62 ("net/mlx5: support metadata as flow rule criteria")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Dekel Peled <dekelp@mellanox.com>
> 
> ---

Acked-by: Yongseok Koh <yskoh@mellanox.com>
 
Thanks

> v3: Update title, modify indentation.
> v2: Apply code review comments.
> ---
> ---
> drivers/net/mlx5/mlx5_rxtx_vec_neon.h | 12 +++++++++---
> drivers/net/mlx5/mlx5_rxtx_vec_sse.h  | 11 ++++++++---
> 2 files changed, 17 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
> index 883fe1b..38e915c 100644
> --- a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
> +++ b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
> @@ -104,6 +104,8 @@
> 		sizeof(struct mlx5_wqe) / MLX5_WQE_DWORD_SIZE;
> 	unsigned int n;
> 	volatile struct mlx5_wqe *wqe = NULL;
> +	bool metadata_ol =
> +		txq->offloads & DEV_TX_OFFLOAD_MATCH_METADATA ? true : false;
> 
> 	assert(elts_n > pkts_n);
> 	mlx5_tx_complete(txq);
> @@ -127,6 +129,9 @@
> 		uint8x16_t *t_wqe;
> 		uint8_t *dseg;
> 		uint8x16_t ctrl;
> +		rte_be32_t metadata =
> +			metadata_ol && (buf->ol_flags & PKT_TX_METADATA) ?
> +			buf->tx_metadata : 0;
> 
> 		assert(segs_n);
> 		max_elts = elts_n - (elts_head - txq->elts_tail);
> @@ -164,9 +169,10 @@
> 		ctrl = vqtbl1q_u8(ctrl, ctrl_shuf_m);
> 		vst1q_u8((void *)t_wqe, ctrl);
> 		/* Fill ESEG in the header. */
> -		vst1q_u16((void *)(t_wqe + 1),
> -			  ((uint16x8_t) { 0, 0, cs_flags, rte_cpu_to_be_16(len),
> -					  0, 0, 0, 0 }));
> +		vst1q_u32((void *)(t_wqe + 1),
> +			  ((uint32x4_t){ 0,
> +					 cs_flags << 16 | rte_cpu_to_be_16(len),
> +					 metadata, 0 }));
> 		txq->wqe_ci = wqe_ci;
> 	}
> 	if (!n)
> diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
> index 14117c4..fb384ef 100644
> --- a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
> +++ b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
> @@ -104,6 +104,8 @@
> 		sizeof(struct mlx5_wqe) / MLX5_WQE_DWORD_SIZE;
> 	unsigned int n;
> 	volatile struct mlx5_wqe *wqe = NULL;
> +	bool metadata_ol =
> +		txq->offloads & DEV_TX_OFFLOAD_MATCH_METADATA ? true : false;
> 
> 	assert(elts_n > pkts_n);
> 	mlx5_tx_complete(txq);
> @@ -125,6 +127,9 @@
> 		uint16_t max_wqe;
> 		__m128i *t_wqe, *dseg;
> 		__m128i ctrl;
> +		rte_be32_t metadata =
> +			metadata_ol && (buf->ol_flags & PKT_TX_METADATA) ?
> +			buf->tx_metadata : 0;
> 
> 		assert(segs_n);
> 		max_elts = elts_n - (elts_head - txq->elts_tail);
> @@ -165,9 +170,9 @@
> 		_mm_store_si128(t_wqe, ctrl);
> 		/* Fill ESEG in the header. */
> 		_mm_store_si128(t_wqe + 1,
> -				_mm_set_epi16(0, 0, 0, 0,
> -					      rte_cpu_to_be_16(len), cs_flags,
> -					      0, 0));
> +				_mm_set_epi32(0, metadata,
> +					      (rte_cpu_to_be_16(len) << 16) |
> +					      cs_flags, 0));
> 		txq->wqe_ci = wqe_ci;
> 	}
> 	if (!n)
> -- 
> 1.8.3.1
> 

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

* Re: [dpdk-stable] [PATCH v3] net/mlx5: fix Tx metadata for multi-segment packet
  2019-01-30  7:24     ` Yongseok Koh
@ 2019-02-10 15:10       ` Shahaf Shuler
  0 siblings, 0 replies; 7+ messages in thread
From: Shahaf Shuler @ 2019-02-10 15:10 UTC (permalink / raw)
  To: Yongseok Koh, Dekel Peled; +Cc: dev, Ori Kam, stable

Wednesday, January 30, 2019 9:24 AM, Yongseok Koh:
> Subject: Re: [PATCH v3] net/mlx5: fix Tx metadata for multi-segment packet
> 
> > On Jan 30, 2019, at 3:43 PM, Dekel Peled <dekelp@mellanox.com> wrote:
> >
> > Original patch implemented the use of match_metadata offload in the
> > different burst functions.
> > The concurrent use of match_metadata and multi_segs offloads was not
> > handled.
> >
> > This patch updates function txq_scatter_v(), to pass metadata value
> > from mbuf to wqe, when indicated by offload flags.
> >
> > Fixes: 6bd7fbd03c62 ("net/mlx5: support metadata as flow rule
> > criteria")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Dekel Peled <dekelp@mellanox.com>

Applied to next-net-mlx, thanks .

> >
> > ---
> 
> Acked-by: Yongseok Koh <yskoh@mellanox.com>
> 
> Thanks
> 
> > v3: Update title, modify indentation.
> > v2: Apply code review comments.
> > ---
> > ---
> > drivers/net/mlx5/mlx5_rxtx_vec_neon.h | 12 +++++++++---
> > drivers/net/mlx5/mlx5_rxtx_vec_sse.h  | 11 ++++++++---
> > 2 files changed, 17 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
> > b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
> > index 883fe1b..38e915c 100644
> > --- a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
> > +++ b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h
> > @@ -104,6 +104,8 @@
> > 		sizeof(struct mlx5_wqe) / MLX5_WQE_DWORD_SIZE;
> > 	unsigned int n;
> > 	volatile struct mlx5_wqe *wqe = NULL;
> > +	bool metadata_ol =
> > +		txq->offloads & DEV_TX_OFFLOAD_MATCH_METADATA ?
> true : false;
> >
> > 	assert(elts_n > pkts_n);
> > 	mlx5_tx_complete(txq);
> > @@ -127,6 +129,9 @@
> > 		uint8x16_t *t_wqe;
> > 		uint8_t *dseg;
> > 		uint8x16_t ctrl;
> > +		rte_be32_t metadata =
> > +			metadata_ol && (buf->ol_flags &
> PKT_TX_METADATA) ?
> > +			buf->tx_metadata : 0;
> >
> > 		assert(segs_n);
> > 		max_elts = elts_n - (elts_head - txq->elts_tail); @@ -164,9
> +169,10
> > @@
> > 		ctrl = vqtbl1q_u8(ctrl, ctrl_shuf_m);
> > 		vst1q_u8((void *)t_wqe, ctrl);
> > 		/* Fill ESEG in the header. */
> > -		vst1q_u16((void *)(t_wqe + 1),
> > -			  ((uint16x8_t) { 0, 0, cs_flags,
> rte_cpu_to_be_16(len),
> > -					  0, 0, 0, 0 }));
> > +		vst1q_u32((void *)(t_wqe + 1),
> > +			  ((uint32x4_t){ 0,
> > +					 cs_flags << 16 |
> rte_cpu_to_be_16(len),
> > +					 metadata, 0 }));
> > 		txq->wqe_ci = wqe_ci;
> > 	}
> > 	if (!n)
> > diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
> > b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
> > index 14117c4..fb384ef 100644
> > --- a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
> > +++ b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h
> > @@ -104,6 +104,8 @@
> > 		sizeof(struct mlx5_wqe) / MLX5_WQE_DWORD_SIZE;
> > 	unsigned int n;
> > 	volatile struct mlx5_wqe *wqe = NULL;
> > +	bool metadata_ol =
> > +		txq->offloads & DEV_TX_OFFLOAD_MATCH_METADATA ?
> true : false;
> >
> > 	assert(elts_n > pkts_n);
> > 	mlx5_tx_complete(txq);
> > @@ -125,6 +127,9 @@
> > 		uint16_t max_wqe;
> > 		__m128i *t_wqe, *dseg;
> > 		__m128i ctrl;
> > +		rte_be32_t metadata =
> > +			metadata_ol && (buf->ol_flags &
> PKT_TX_METADATA) ?
> > +			buf->tx_metadata : 0;
> >
> > 		assert(segs_n);
> > 		max_elts = elts_n - (elts_head - txq->elts_tail); @@ -165,9
> +170,9
> > @@
> > 		_mm_store_si128(t_wqe, ctrl);
> > 		/* Fill ESEG in the header. */
> > 		_mm_store_si128(t_wqe + 1,
> > -				_mm_set_epi16(0, 0, 0, 0,
> > -					      rte_cpu_to_be_16(len), cs_flags,
> > -					      0, 0));
> > +				_mm_set_epi32(0, metadata,
> > +					      (rte_cpu_to_be_16(len) << 16) |
> > +					      cs_flags, 0));
> > 		txq->wqe_ci = wqe_ci;
> > 	}
> > 	if (!n)
> > --
> > 1.8.3.1
> >

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

end of thread, other threads:[~2019-02-10 15:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-28 13:49 [dpdk-stable] [PATCH] net/mlx5: fix concurrent use of Tx offloads Dekel Peled
2019-01-29  7:54 ` Yongseok Koh
2019-01-29 11:27 ` [dpdk-stable] [PATCH v2] " Dekel Peled
2019-01-30  4:06   ` Yongseok Koh
2019-01-30  6:43   ` [dpdk-stable] [PATCH v3] net/mlx5: fix Tx metadata for multi-segment packet Dekel Peled
2019-01-30  7:24     ` Yongseok Koh
2019-02-10 15:10       ` Shahaf Shuler

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