All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] net/mlx5: fix flow API mark combined with drop
@ 2017-01-20 15:27 Nelio Laranjeiro
  2017-01-20 15:27 ` [PATCH 2/2] net/mlx5: fix Rx packet validation and type Nelio Laranjeiro
  2017-01-20 16:47 ` [PATCH 1/2] net/mlx5: fix flow API mark combined with drop Adrien Mazarguil
  0 siblings, 2 replies; 6+ messages in thread
From: Nelio Laranjeiro @ 2017-01-20 15:27 UTC (permalink / raw)
  To: dev; +Cc: Adrien Mazarguil

Fixes: ea3bc3b1df94 ("net/mlx5: support mark flow action")

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
---
 drivers/net/mlx5/mlx5_flow.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index d7ed686..7b97a61 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -480,7 +480,7 @@ priv_flow_validate(struct priv *priv,
 			goto exit_action_not_supported;
 		}
 	}
-	if (action.mark && !flow->ibv_attr)
+	if (action.mark && !flow->ibv_attr && !action.drop)
 		flow->offset += sizeof(struct ibv_exp_flow_spec_action_tag);
 	if (!action.queue && !action.drop) {
 		rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE,
@@ -1042,6 +1042,7 @@ priv_flow_create(struct priv *priv,
 				 actions->conf)->index;
 		} else if (actions->type == RTE_FLOW_ACTION_TYPE_DROP) {
 			action.drop = 1;
+			action.mark = 0;
 		} else if (actions->type == RTE_FLOW_ACTION_TYPE_MARK) {
 			const struct rte_flow_action_mark *mark =
 				(const struct rte_flow_action_mark *)
@@ -1049,7 +1050,7 @@ priv_flow_create(struct priv *priv,
 
 			if (mark)
 				action.mark_id = mark->id;
-			action.mark = 1;
+			action.mark = !action.drop;
 		} else {
 			rte_flow_error_set(error, ENOTSUP,
 					   RTE_FLOW_ERROR_TYPE_ACTION,
-- 
2.1.4

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

* [PATCH 2/2] net/mlx5: fix Rx packet validation and type
  2017-01-20 15:27 [PATCH 1/2] net/mlx5: fix flow API mark combined with drop Nelio Laranjeiro
@ 2017-01-20 15:27 ` Nelio Laranjeiro
  2017-01-20 16:48   ` Adrien Mazarguil
  2017-01-20 16:47 ` [PATCH 1/2] net/mlx5: fix flow API mark combined with drop Adrien Mazarguil
  1 sibling, 1 reply; 6+ messages in thread
From: Nelio Laranjeiro @ 2017-01-20 15:27 UTC (permalink / raw)
  To: dev; +Cc: Adrien Mazarguil, stable

Rx checksum validation and packet type offloads are read from the wrong
location.

Fixes: 501505c5608a ("net/mlx: fix IPv4 and IPv6 packet type")
Fixes: 350f4c482e46 ("net/mlx5: fix Rx checksum macros")
Fixes: 6218063b39a6 ("net/mlx5: refactor Rx data path")

Cc: stable@dpdk.org
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
---
 drivers/net/mlx5/mlx5_prm.h  | 47 +++++++++++++++++++++++++----------------
 drivers/net/mlx5/mlx5_rxtx.c | 50 +++++++++++++++++++-------------------------
 2 files changed, 50 insertions(+), 47 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_prm.h b/drivers/net/mlx5/mlx5_prm.h
index d9bb332..755b5d7 100644
--- a/drivers/net/mlx5/mlx5_prm.h
+++ b/drivers/net/mlx5/mlx5_prm.h
@@ -64,9 +64,6 @@
 /* Invalidate a CQE. */
 #define MLX5_CQE_INVALIDATE (MLX5_CQE_INVALID << 4)
 
-/* CQE value to inform that VLAN is stripped. */
-#define MLX5_CQE_VLAN_STRIPPED 0x1
-
 /* Maximum number of packets a multi-packet WQE can handle. */
 #define MLX5_MPW_DSEG_MAX 5
 
@@ -87,26 +84,41 @@
 #define MLX5_OPCODE_TSO MLX5_OPCODE_LSO_MPW /* Compat with OFED 3.3. */
 #endif
 
-/* IPv4 packet. */
-#define MLX5_CQE_RX_IPV4_PACKET (1u << 2)
+/* CQE value to inform that VLAN is stripped. */
+#define MLX5_CQE_VLAN_STRIPPED (1u << 0)
+
+/* IPv4 options. */
+#define MLX5_CQE_RX_IP_EXT_OPTS_PACKET (1u << 1)
 
 /* IPv6 packet. */
-#define MLX5_CQE_RX_IPV6_PACKET (1u << 3)
+#define MLX5_CQE_RX_IPV6_PACKET (1u << 2)
+
+/* IPv4 packet. */
+#define MLX5_CQE_RX_IPV4_PACKET (1u << 3)
 
-/* Outer IPv4 packet. */
-#define MLX5_CQE_RX_OUTER_IPV4_PACKET (1u << 7)
+/* TCP packet. */
+#define MLX5_CQE_RX_TCP_PACKET (1u << 4)
 
-/* Outer IPv6 packet. */
-#define MLX5_CQE_RX_OUTER_IPV6_PACKET (1u << 8)
+/* UDP packet. */
+#define MLX5_CQE_RX_UDP_PACKET (1u << 5)
 
-/* Tunnel packet bit in the CQE. */
-#define MLX5_CQE_RX_TUNNEL_PACKET (1u << 4)
+/* IP is fragmented. */
+#define MLX5_CQE_RX_IP_FRAG_PACKET (1u << 7)
+
+/* L2 header is valid. */
+#define MLX5_CQE_RX_L2_HDR_VALID (1u << 8)
 
-/* Outer IP checksum OK. */
-#define MLX5_CQE_RX_OUTER_IP_CSUM_OK (1u << 5)
+/* L3 header is valid. */
+#define MLX5_CQE_RX_L3_HDR_VALID (1u << 9)
 
-/* Outer UDP header and checksum OK. */
-#define MLX5_CQE_RX_OUTER_TCP_UDP_CSUM_OK (1u << 6)
+/* L4 header is valid. */
+#define MLX5_CQE_RX_L4_HDR_VALID (1u << 10)
+
+/* Outer packet, 0 IPv4, 1 IPv6. */
+#define MLX5_CQE_RX_OUTER_PACKET (1u << 1)
+
+/* Tunnel packet bit in the CQE. */
+#define MLX5_CQE_RX_TUNNEL_PACKET (1u << 0)
 
 /* INVALID is used by packets matching no flow rules. */
 #define MLX5_FLOW_MARK_INVALID 0
@@ -188,8 +200,7 @@ struct mlx5_cqe {
 	uint32_t rx_hash_res;
 	uint8_t rx_hash_type;
 	uint8_t rsvd1[11];
-	uint8_t hds_ip_ext;
-	uint8_t l4_hdr_type_etc;
+	uint16_t hdr_type_etc;
 	uint16_t vlan_info;
 	uint8_t rsvd2[12];
 	uint32_t byte_cnt;
diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
index 56c7f78..f88b3eb 100644
--- a/drivers/net/mlx5/mlx5_rxtx.c
+++ b/drivers/net/mlx5/mlx5_rxtx.c
@@ -1107,23 +1107,20 @@ static inline uint32_t
 rxq_cq_to_pkt_type(volatile struct mlx5_cqe *cqe)
 {
 	uint32_t pkt_type;
-	uint8_t flags = cqe->l4_hdr_type_etc;
+	uint16_t flags = ntohs(cqe->hdr_type_etc);
 
-	if (cqe->pkt_info & MLX5_CQE_RX_TUNNEL_PACKET)
+	if (cqe->pkt_info & MLX5_CQE_RX_TUNNEL_PACKET) {
 		pkt_type =
 			TRANSPOSE(flags,
-				  MLX5_CQE_RX_OUTER_IPV4_PACKET,
-				  RTE_PTYPE_L3_IPV4_EXT_UNKNOWN) |
-			TRANSPOSE(flags,
-				  MLX5_CQE_RX_OUTER_IPV6_PACKET,
-				  RTE_PTYPE_L3_IPV6_EXT_UNKNOWN) |
-			TRANSPOSE(flags,
 				  MLX5_CQE_RX_IPV4_PACKET,
 				  RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN) |
 			TRANSPOSE(flags,
 				  MLX5_CQE_RX_IPV6_PACKET,
 				  RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN);
-	else
+		pkt_type |= ((cqe->pkt_info & MLX5_CQE_RX_OUTER_PACKET) ?
+			     RTE_PTYPE_L3_IPV6_EXT_UNKNOWN :
+			     RTE_PTYPE_L3_IPV4_EXT_UNKNOWN);
+	} else {
 		pkt_type =
 			TRANSPOSE(flags,
 				  MLX5_CQE_L3_HDR_TYPE_IPV6,
@@ -1131,6 +1128,7 @@ rxq_cq_to_pkt_type(volatile struct mlx5_cqe *cqe)
 			TRANSPOSE(flags,
 				  MLX5_CQE_L3_HDR_TYPE_IPV4,
 				  RTE_PTYPE_L3_IPV4_EXT_UNKNOWN);
+	}
 	return pkt_type;
 }
 
@@ -1248,28 +1246,22 @@ static inline uint32_t
 rxq_cq_to_ol_flags(struct rxq *rxq, volatile struct mlx5_cqe *cqe)
 {
 	uint32_t ol_flags = 0;
-	uint8_t l3_hdr = (cqe->l4_hdr_type_etc) & MLX5_CQE_L3_HDR_TYPE_MASK;
-	uint8_t l4_hdr = (cqe->l4_hdr_type_etc) & MLX5_CQE_L4_HDR_TYPE_MASK;
-
-	if ((l3_hdr == MLX5_CQE_L3_HDR_TYPE_IPV4) ||
-	    (l3_hdr == MLX5_CQE_L3_HDR_TYPE_IPV6))
-		ol_flags |= TRANSPOSE(cqe->hds_ip_ext,
-				      MLX5_CQE_L3_OK,
-				      PKT_RX_IP_CKSUM_GOOD);
-	if ((l4_hdr == MLX5_CQE_L4_HDR_TYPE_TCP) ||
-	    (l4_hdr == MLX5_CQE_L4_HDR_TYPE_TCP_EMP_ACK) ||
-	    (l4_hdr == MLX5_CQE_L4_HDR_TYPE_TCP_ACK) ||
-	    (l4_hdr == MLX5_CQE_L4_HDR_TYPE_UDP))
-		ol_flags |= TRANSPOSE(cqe->hds_ip_ext,
-				      MLX5_CQE_L4_OK,
-				      PKT_RX_L4_CKSUM_GOOD);
+	uint16_t flags = ntohs(cqe->hdr_type_etc);
+
+	ol_flags =
+		TRANSPOSE(flags,
+			  MLX5_CQE_RX_L3_HDR_VALID,
+			  PKT_RX_IP_CKSUM_GOOD) |
+		TRANSPOSE(flags,
+			  MLX5_CQE_RX_L4_HDR_VALID,
+			  PKT_RX_L4_CKSUM_GOOD);
 	if ((cqe->pkt_info & MLX5_CQE_RX_TUNNEL_PACKET) && (rxq->csum_l2tun))
 		ol_flags |=
-			TRANSPOSE(cqe->l4_hdr_type_etc,
-				  MLX5_CQE_RX_OUTER_IP_CSUM_OK,
+			TRANSPOSE(flags,
+				  MLX5_CQE_RX_L3_HDR_VALID,
 				  PKT_RX_IP_CKSUM_GOOD) |
-			TRANSPOSE(cqe->l4_hdr_type_etc,
-				  MLX5_CQE_RX_OUTER_TCP_UDP_CSUM_OK,
+			TRANSPOSE(flags,
+				  MLX5_CQE_RX_L4_HDR_VALID,
 				  PKT_RX_L4_CKSUM_GOOD);
 	return ol_flags;
 }
@@ -1376,7 +1368,7 @@ mlx5_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
 					pkt->ol_flags |=
 						rxq_cq_to_ol_flags(rxq, cqe);
 				}
-				if (cqe->l4_hdr_type_etc &
+				if (cqe->hdr_type_etc &
 				    MLX5_CQE_VLAN_STRIPPED) {
 					pkt->ol_flags |= PKT_RX_VLAN_PKT |
 						PKT_RX_VLAN_STRIPPED;
-- 
2.1.4

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

* Re: [PATCH 1/2] net/mlx5: fix flow API mark combined with drop
  2017-01-20 15:27 [PATCH 1/2] net/mlx5: fix flow API mark combined with drop Nelio Laranjeiro
  2017-01-20 15:27 ` [PATCH 2/2] net/mlx5: fix Rx packet validation and type Nelio Laranjeiro
@ 2017-01-20 16:47 ` Adrien Mazarguil
  2017-01-20 18:43   ` Ferruh Yigit
  1 sibling, 1 reply; 6+ messages in thread
From: Adrien Mazarguil @ 2017-01-20 16:47 UTC (permalink / raw)
  To: Nelio Laranjeiro; +Cc: dev

On Fri, Jan 20, 2017 at 04:27:28PM +0100, Nelio Laranjeiro wrote:
> Fixes: ea3bc3b1df94 ("net/mlx5: support mark flow action")
> 
> Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> ---
>  drivers/net/mlx5/mlx5_flow.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>

-- 
Adrien Mazarguil
6WIND

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

* Re: [PATCH 2/2] net/mlx5: fix Rx packet validation and type
  2017-01-20 15:27 ` [PATCH 2/2] net/mlx5: fix Rx packet validation and type Nelio Laranjeiro
@ 2017-01-20 16:48   ` Adrien Mazarguil
  2017-01-20 18:44     ` Ferruh Yigit
  0 siblings, 1 reply; 6+ messages in thread
From: Adrien Mazarguil @ 2017-01-20 16:48 UTC (permalink / raw)
  To: Nelio Laranjeiro; +Cc: dev, stable

On Fri, Jan 20, 2017 at 04:27:29PM +0100, Nelio Laranjeiro wrote:
> Rx checksum validation and packet type offloads are read from the wrong
> location.
> 
> Fixes: 501505c5608a ("net/mlx: fix IPv4 and IPv6 packet type")
> Fixes: 350f4c482e46 ("net/mlx5: fix Rx checksum macros")
> Fixes: 6218063b39a6 ("net/mlx5: refactor Rx data path")
> 
> Cc: stable@dpdk.org
> Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> ---
>  drivers/net/mlx5/mlx5_prm.h  | 47 +++++++++++++++++++++++++----------------
>  drivers/net/mlx5/mlx5_rxtx.c | 50 +++++++++++++++++++-------------------------
>  2 files changed, 50 insertions(+), 47 deletions(-)

Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>

-- 
Adrien Mazarguil
6WIND

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

* Re: [PATCH 1/2] net/mlx5: fix flow API mark combined with drop
  2017-01-20 16:47 ` [PATCH 1/2] net/mlx5: fix flow API mark combined with drop Adrien Mazarguil
@ 2017-01-20 18:43   ` Ferruh Yigit
  0 siblings, 0 replies; 6+ messages in thread
From: Ferruh Yigit @ 2017-01-20 18:43 UTC (permalink / raw)
  To: Adrien Mazarguil, Nelio Laranjeiro; +Cc: dev

On 1/20/2017 4:47 PM, Adrien Mazarguil wrote:
> On Fri, Jan 20, 2017 at 04:27:28PM +0100, Nelio Laranjeiro wrote:
>> Fixes: ea3bc3b1df94 ("net/mlx5: support mark flow action")
>>
>> Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
>> ---
>>  drivers/net/mlx5/mlx5_flow.c | 5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>

Applied to dpdk-next-net/master, thanks.

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

* Re: [PATCH 2/2] net/mlx5: fix Rx packet validation and type
  2017-01-20 16:48   ` Adrien Mazarguil
@ 2017-01-20 18:44     ` Ferruh Yigit
  0 siblings, 0 replies; 6+ messages in thread
From: Ferruh Yigit @ 2017-01-20 18:44 UTC (permalink / raw)
  To: Adrien Mazarguil, Nelio Laranjeiro; +Cc: dev, stable

On 1/20/2017 4:48 PM, Adrien Mazarguil wrote:
> On Fri, Jan 20, 2017 at 04:27:29PM +0100, Nelio Laranjeiro wrote:
>> Rx checksum validation and packet type offloads are read from the wrong
>> location.
>>
>> Fixes: 501505c5608a ("net/mlx: fix IPv4 and IPv6 packet type")
>> Fixes: 350f4c482e46 ("net/mlx5: fix Rx checksum macros")
>> Fixes: 6218063b39a6 ("net/mlx5: refactor Rx data path")
>>
>> Cc: stable@dpdk.org
>> Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
>> ---
>>  drivers/net/mlx5/mlx5_prm.h  | 47 +++++++++++++++++++++++++----------------
>>  drivers/net/mlx5/mlx5_rxtx.c | 50 +++++++++++++++++++-------------------------
>>  2 files changed, 50 insertions(+), 47 deletions(-)
> 
> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>

Applied to dpdk-next-net/master, thanks.

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

end of thread, other threads:[~2017-01-20 18:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-20 15:27 [PATCH 1/2] net/mlx5: fix flow API mark combined with drop Nelio Laranjeiro
2017-01-20 15:27 ` [PATCH 2/2] net/mlx5: fix Rx packet validation and type Nelio Laranjeiro
2017-01-20 16:48   ` Adrien Mazarguil
2017-01-20 18:44     ` Ferruh Yigit
2017-01-20 16:47 ` [PATCH 1/2] net/mlx5: fix flow API mark combined with drop Adrien Mazarguil
2017-01-20 18:43   ` Ferruh Yigit

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.