DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/2] net/mlx5: scatter FCS with decapsulation
@ 2020-07-15 13:10 Suanming Mou
  2020-07-15 13:10 ` [dpdk-dev] [PATCH 1/2] common/mlx5: add scatter FCS with decap capability query Suanming Mou
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Suanming Mou @ 2020-07-15 13:10 UTC (permalink / raw)
  To: viacheslavo, matan; +Cc: orika, rasland, dev

There are some limitations on the some NICs (at least on ConnectX-6DX
and BlueField2) with supporting FCS (frame checksum) scattering for
the  tunnel decapsulated packets.

For the case only one of the features can be supported in the same time,
and the new devarg "decap_en" is introduced to provide the choice to the
users.

If FCS scattering feature is not supposed to be engaged by application,
this new devarg should be specified as "decap_en=0", forcing the FCS
feature enable and rejecting tunnel decap actions in the rte_flow engine.
If FCS scatter is not needed and application supposes to use tunnel
decapsulation in rte_flow, the devarg can be omitted or set to non-zero
value (this is default settings).

Suanming Mou (2):
  common/mlx5: add scatter FCS with decap capability query
  net/mlx5: add decap enable device argument

 doc/guides/nics/mlx5.rst             | 15 +++++++++++++++
 drivers/common/mlx5/mlx5_devx_cmds.c |  2 ++
 drivers/common/mlx5/mlx5_devx_cmds.h |  1 +
 drivers/common/mlx5/mlx5_prm.h       |  4 +++-
 drivers/net/mlx5/linux/mlx5_os.c     | 12 ++++++++++--
 drivers/net/mlx5/mlx5.c              |  6 ++++++
 drivers/net/mlx5/mlx5.h              |  1 +
 drivers/net/mlx5/mlx5_flow_dv.c      |  5 +++++
 8 files changed, 43 insertions(+), 3 deletions(-)

-- 
1.8.3.1


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

* [dpdk-dev] [PATCH 1/2] common/mlx5: add scatter FCS with decap capability query
  2020-07-15 13:10 [dpdk-dev] [PATCH 0/2] net/mlx5: scatter FCS with decapsulation Suanming Mou
@ 2020-07-15 13:10 ` Suanming Mou
  2020-07-15 13:10 ` [dpdk-dev] [PATCH 2/2] net/mlx5: add decap enable device argument Suanming Mou
  2020-07-19  9:45 ` [dpdk-dev] [PATCH 0/2] net/mlx5: scatter FCS with decapsulation Raslan Darawsheh
  2 siblings, 0 replies; 4+ messages in thread
From: Suanming Mou @ 2020-07-15 13:10 UTC (permalink / raw)
  To: viacheslavo, matan; +Cc: orika, rasland, dev

As scatter FCS might be not supported for decapsulated tunnel
packets in some NIC HW, an new capability bit which indicates
if scatter FCS works with decap is added.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
---
 doc/guides/nics/mlx5.rst             | 5 +++++
 drivers/common/mlx5/mlx5_devx_cmds.c | 2 ++
 drivers/common/mlx5/mlx5_devx_cmds.h | 1 +
 drivers/common/mlx5/mlx5_prm.h       | 4 +++-
 4 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index 4b6d8fb..97261d6 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -279,6 +279,11 @@ Limitations
 
     Other TCP packets (e.g. with MPLS label) received on Rx queue with LRO enabled, will be received with bad checksum.
 
+- KEEP_CRC:
+
+  - KEEP_CRC offload cannot be supported with decapsulation for some NICs(such as ConnectX-6DX and BlueField2).
+    The new capability bit scatter_fcs_w_decap_disable shows the supporting for the NICs.
+
 Statistics
 ----------
 
diff --git a/drivers/common/mlx5/mlx5_devx_cmds.c b/drivers/common/mlx5/mlx5_devx_cmds.c
index 2179a83..4cd92a9 100644
--- a/drivers/common/mlx5/mlx5_devx_cmds.c
+++ b/drivers/common/mlx5/mlx5_devx_cmds.c
@@ -467,6 +467,8 @@ struct mlx5_devx_obj *
 	attr->vdpa.queue_counters_valid = !!(MLX5_GET64(cmd_hca_cap, hcattr,
 							general_obj_types) &
 				  MLX5_GENERAL_OBJ_TYPES_CAP_VIRTIO_Q_COUNTERS);
+	attr->scatter_fcs_w_decap_disable =
+		MLX5_GET(cmd_hca_cap, hcattr, scatter_fcs_w_decap_disable);
 	if (attr->qos.sup) {
 		MLX5_SET(query_hca_cap_in, in, op_mod,
 			 MLX5_GET_HCA_CAP_OP_MOD_QOS_CAP |
diff --git a/drivers/common/mlx5/mlx5_devx_cmds.h b/drivers/common/mlx5/mlx5_devx_cmds.h
index 25704ef..930f78f 100644
--- a/drivers/common/mlx5/mlx5_devx_cmds.h
+++ b/drivers/common/mlx5/mlx5_devx_cmds.h
@@ -90,6 +90,7 @@ struct mlx5_hca_attr {
 	uint32_t vhca_id:16;
 	uint32_t relaxed_ordering_write:1;
 	uint32_t relaxed_ordering_read:1;
+	uint32_t scatter_fcs_w_decap_disable:1;
 	struct mlx5_hca_qos_attr qos;
 	struct mlx5_hca_vdpa_attr vdpa;
 };
diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h
index c63795f..d157457 100644
--- a/drivers/common/mlx5/mlx5_prm.h
+++ b/drivers/common/mlx5/mlx5_prm.h
@@ -996,7 +996,9 @@ struct mlx5_ifc_cmd_hca_cap_bits {
 	u8 log_max_qp[0x5];
 	u8 reserved_at_a0[0xb];
 	u8 log_max_srq[0x5];
-	u8 reserved_at_b0[0x10];
+	u8 reserved_at_b0[0xb];
+	u8 scatter_fcs_w_decap_disable[0x1];
+	u8 reserved_at_bc[0x4];
 	u8 reserved_at_c0[0x8];
 	u8 log_max_cq_sz[0x8];
 	u8 reserved_at_d0[0xb];
-- 
1.8.3.1


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

* [dpdk-dev] [PATCH 2/2] net/mlx5: add decap enable device argument
  2020-07-15 13:10 [dpdk-dev] [PATCH 0/2] net/mlx5: scatter FCS with decapsulation Suanming Mou
  2020-07-15 13:10 ` [dpdk-dev] [PATCH 1/2] common/mlx5: add scatter FCS with decap capability query Suanming Mou
@ 2020-07-15 13:10 ` Suanming Mou
  2020-07-19  9:45 ` [dpdk-dev] [PATCH 0/2] net/mlx5: scatter FCS with decapsulation Raslan Darawsheh
  2 siblings, 0 replies; 4+ messages in thread
From: Suanming Mou @ 2020-07-15 13:10 UTC (permalink / raw)
  To: viacheslavo, matan; +Cc: orika, rasland, dev

There are some limitations on the some NICs (at least on ConnectX-6DX
and BlueField2) with supporting FCS (frame checksum) scattering for
the  tunnel decapsulated packets.

For the case only one of the features can be supported in the same time,
and the new devarg "decap_en" is introduced to provide the choice to the
users.

If FCS scattering feature is not supposed to be engaged by application,
this new devarg should be specified as "decap_en=0", forcing the FCS
feature enable and rejecting tunnel decap actions in the rte_flow engine.
If FCS scatter is not needed and application supposes to use tunnel
decapsulation in rte_flow, the devarg can be omitted or set to non-zero
value (this is default settings).

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
---
 doc/guides/nics/mlx5.rst         | 10 ++++++++++
 drivers/net/mlx5/linux/mlx5_os.c | 12 ++++++++++--
 drivers/net/mlx5/mlx5.c          |  6 ++++++
 drivers/net/mlx5/mlx5.h          |  1 +
 drivers/net/mlx5/mlx5_flow_dv.c  |  5 +++++
 5 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index 97261d6..ccf38b6 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -884,6 +884,16 @@ Driver options
 
   By default, the PMD will set this value to 0.
 
+- ``decap_en`` parameter [int]
+
+  The new devarg ``decap_en`` is introduced to provide the choice to the NICs
+  which does not support FCS (frame checksum) scattering for the tunnel
+  decapsulated packets. By set the devarg value 0 to force the FCS feature
+  enable and rejecting tunnel decap actions in the rte_flow engine for these
+  special NICs.
+
+  By default, the PMD will set this value to 1.
+
 .. _mlx5_firmware_config:
 
 Firmware configuration
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index 2dc57b2..37420cb 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -780,8 +780,6 @@
 		(config.hw_vlan_strip ? "" : "not "));
 	config.hw_fcs_strip = !!(sh->device_attr.raw_packet_caps &
 				 IBV_RAW_PACKET_CAP_SCATTER_FCS);
-	DRV_LOG(DEBUG, "FCS stripping configuration is %ssupported",
-		(config.hw_fcs_strip ? "" : "not "));
 #if defined(HAVE_IBV_WQ_FLAG_RX_END_PADDING)
 	hw_padding = !!sh->device_attr.rx_pad_end_addr_align;
 #elif defined(HAVE_IBV_WQ_FLAGS_PCI_WRITE_END_PADDING)
@@ -879,6 +877,15 @@
 		}
 #endif
 	}
+	/*
+	 * If HW has bug working with tunnel packet decapsulation and
+	 * scatter FCS, and decapsulation is needed, clear the hw_fcs_strip
+	 * bit. Then DEV_RX_OFFLOAD_KEEP_CRC bit will not be set anymore.
+	 */
+	if (config.hca_attr.scatter_fcs_w_decap_disable && config.decap_en)
+		config.hw_fcs_strip = 0;
+	DRV_LOG(DEBUG, "FCS stripping configuration is %ssupported",
+		(config.hw_fcs_strip ? "" : "not "));
 	if (config.mprq.enabled && mprq) {
 		if (config.mprq.stride_num_n &&
 		    (config.mprq.stride_num_n > mprq_max_stride_num_n ||
@@ -1652,6 +1659,7 @@
 		},
 		.dv_esw_en = 1,
 		.dv_flow_en = 1,
+		.decap_en = 1,
 		.log_hp_size = MLX5_ARG_UNSET,
 	};
 	/* Device specific configuration. */
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 0c654ed..9daacaf 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -167,6 +167,9 @@
 /* Flow memory reclaim mode. */
 #define MLX5_RECLAIM_MEM "reclaim_mem_mode"
 
+/* Decap will be used or not. */
+#define MLX5_DECAP_EN "decap_en"
+
 static const char *MZ_MLX5_PMD_SHARED_DATA = "mlx5_pmd_shared_data";
 
 /* Shared memory between primary and secondary processes. */
@@ -1374,6 +1377,8 @@ struct mlx5_dev_ctx_shared *
 			return -rte_errno;
 		}
 		config->reclaim_mode = tmp;
+	} else if (strcmp(MLX5_DECAP_EN, key) == 0) {
+		config->decap_en = !!tmp;
 	} else {
 		DRV_LOG(WARNING, "%s: unknown parameter", key);
 		rte_errno = EINVAL;
@@ -1430,6 +1435,7 @@ struct mlx5_dev_ctx_shared *
 		MLX5_CLASS_ARG_NAME,
 		MLX5_HP_BUF_SIZE,
 		MLX5_RECLAIM_MEM,
+		MLX5_DECAP_EN,
 		NULL,
 	};
 	struct rte_kvargs *kvlist;
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 46e66eb..c7b6a84 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -216,6 +216,7 @@ struct mlx5_dev_config {
 	unsigned int devx:1; /* Whether devx interface is available or not. */
 	unsigned int dest_tir:1; /* Whether advanced DR API is available. */
 	unsigned int reclaim_mode:2; /* Memory reclaim mode. */
+	unsigned int decap_en:1; /* Whether decap will be used or not. */
 	struct {
 		unsigned int enabled:1; /* Whether MPRQ is enabled. */
 		unsigned int stride_num_n; /* Number of strides. */
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 8b5b683..37db7c5 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -2428,6 +2428,11 @@ struct field_modify_info modify_tcp[] = {
 {
 	const struct mlx5_priv *priv = dev->data->dev_private;
 
+	if (priv->config.hca_attr.scatter_fcs_w_decap_disable &&
+	    !priv->config.decap_en)
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
+					  "decap is not enabled");
 	if (action_flags & MLX5_FLOW_XCAP_ACTIONS)
 		return rte_flow_error_set(error, ENOTSUP,
 					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
-- 
1.8.3.1


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

* Re: [dpdk-dev] [PATCH 0/2] net/mlx5: scatter FCS with decapsulation
  2020-07-15 13:10 [dpdk-dev] [PATCH 0/2] net/mlx5: scatter FCS with decapsulation Suanming Mou
  2020-07-15 13:10 ` [dpdk-dev] [PATCH 1/2] common/mlx5: add scatter FCS with decap capability query Suanming Mou
  2020-07-15 13:10 ` [dpdk-dev] [PATCH 2/2] net/mlx5: add decap enable device argument Suanming Mou
@ 2020-07-19  9:45 ` Raslan Darawsheh
  2 siblings, 0 replies; 4+ messages in thread
From: Raslan Darawsheh @ 2020-07-19  9:45 UTC (permalink / raw)
  To: Suanming Mou, Slava Ovsiienko, Matan Azrad; +Cc: Ori Kam, dev

Hi,

> -----Original Message-----
> From: Suanming Mou <suanmingm@mellanox.com>
> Sent: Wednesday, July 15, 2020 4:10 PM
> To: Slava Ovsiienko <viacheslavo@mellanox.com>; Matan Azrad
> <matan@mellanox.com>
> Cc: Ori Kam <orika@mellanox.com>; Raslan Darawsheh
> <rasland@mellanox.com>; dev@dpdk.org
> Subject: [PATCH 0/2] net/mlx5: scatter FCS with decapsulation
> 
> There are some limitations on the some NICs (at least on ConnectX-6DX
> and BlueField2) with supporting FCS (frame checksum) scattering for
> the  tunnel decapsulated packets.
> 
> For the case only one of the features can be supported in the same time,
> and the new devarg "decap_en" is introduced to provide the choice to the
> users.
> 
> If FCS scattering feature is not supposed to be engaged by application,
> this new devarg should be specified as "decap_en=0", forcing the FCS
> feature enable and rejecting tunnel decap actions in the rte_flow engine.
> If FCS scatter is not needed and application supposes to use tunnel
> decapsulation in rte_flow, the devarg can be omitted or set to non-zero
> value (this is default settings).
> 
> Suanming Mou (2):
>   common/mlx5: add scatter FCS with decap capability query
>   net/mlx5: add decap enable device argument
> 
>  doc/guides/nics/mlx5.rst             | 15 +++++++++++++++
>  drivers/common/mlx5/mlx5_devx_cmds.c |  2 ++
>  drivers/common/mlx5/mlx5_devx_cmds.h |  1 +
>  drivers/common/mlx5/mlx5_prm.h       |  4 +++-
>  drivers/net/mlx5/linux/mlx5_os.c     | 12 ++++++++++--
>  drivers/net/mlx5/mlx5.c              |  6 ++++++
>  drivers/net/mlx5/mlx5.h              |  1 +
>  drivers/net/mlx5/mlx5_flow_dv.c      |  5 +++++
>  8 files changed, 43 insertions(+), 3 deletions(-)
> 
> --
> 1.8.3.1

Series rebased and applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

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

end of thread, other threads:[~2020-07-19  9:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-15 13:10 [dpdk-dev] [PATCH 0/2] net/mlx5: scatter FCS with decapsulation Suanming Mou
2020-07-15 13:10 ` [dpdk-dev] [PATCH 1/2] common/mlx5: add scatter FCS with decap capability query Suanming Mou
2020-07-15 13:10 ` [dpdk-dev] [PATCH 2/2] net/mlx5: add decap enable device argument Suanming Mou
2020-07-19  9:45 ` [dpdk-dev] [PATCH 0/2] net/mlx5: scatter FCS with decapsulation Raslan Darawsheh

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git