public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH rdma-next 0/8] Introduce vector CALC support
@ 2016-02-20  7:47 Leon Romanovsky
       [not found] ` <1455954465-15141-1-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
  0 siblings, 1 reply; 17+ messages in thread
From: Leon Romanovsky @ 2016-02-20  7:47 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA, saeedm-VPRAkNaXOzVWk0Htik3J/w
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky

From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

This patch set introduces vector CALC support.

This feature takes as input several vectors of equal length,
combines them with a single operation type, producing result vectors
which are sent to the destination.

The proposed operations are "add, and, or, xor, max, min" and "swap
endianness".

The hardware processes the data an MTU of at a time, processing the elements
of each segment in parallel.

This patch set depends on commit b4ff3a36d3e4 ("net/mlx5: Use offset based
reserved field names in the IFC header file") which is part of net tree.

The series consists from two parts: IB and net.

NET part (patches #1-3)
* Patch #1 fixes ATOMIC capability mode. This change has  no impact on
* the system, since MAX property is not in use for ATOMIC.
* Patch #2 merges two device capability calls in one.
* Patch #3 adds infrastructure to support vector CALC querying.
  IB part (patches #4-8)
* Patch #4 refactors device query code by eliminating the unnecessary zeroing
  of variables
* Patch #5 converts device capability mask from u32 to be u64 and support more
  than 32 device capabilities.
* Patch #6 adds vector CALC device capability flag.
* Patch #7 exports all possible supported operations.
* Patch #8 advertises the mlx5 driver support of vector CALC.

Leon Romanovsky (8):
  net/mlx5_core: Fix caching ATOMIC endian mode capability
  net/mlx5_core: Refactor device capability function
  net/mlx5_core: Introduce offload arithmetic hardware capabilities
  IB/core: Replace setting the zero values in ib_uverbs_ex_query_device
  IB/{core,ulp} Support above 32 possible device capability flags
  IB/core: Add offload arithmetic operations support
  IB/core: Exposure supported CALC capabilities
  IB/mlx5: Exposure offload arithmetic operations

 drivers/infiniband/core/uverbs_cmd.c           | 29 +++++++------
 drivers/infiniband/hw/mlx5/main.c              |  3 ++
 drivers/infiniband/ulp/ipoib/ipoib_main.c      |  2 +-
 drivers/net/ethernet/mellanox/mlx5/core/fw.c   | 57 ++++++--------------------
 drivers/net/ethernet/mellanox/mlx5/core/main.c | 24 +++++++----
 include/linux/mlx5/device.h                    |  6 +++
 include/linux/mlx5/driver.h                    |  3 +-
 include/linux/mlx5/mlx5_ifc.h                  | 31 +++++++++++++-
 include/rdma/ib_verbs.h                        | 29 ++++++++++++-
 include/uapi/rdma/ib_user_verbs.h              | 13 ++++++
 10 files changed, 124 insertions(+), 73 deletions(-)

-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH rdma-next 1/8] net/mlx5_core: Fix caching ATOMIC endian mode capability
       [not found] ` <1455954465-15141-1-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
@ 2016-02-20  7:47   ` Leon Romanovsky
  2016-02-20  7:47   ` [PATCH rdma-next 2/8] net/mlx5_core: Refactor device capability function Leon Romanovsky
                     ` (6 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Leon Romanovsky @ 2016-02-20  7:47 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA, saeedm-VPRAkNaXOzVWk0Htik3J/w
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky

From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Add caching of maximum device capability of ATOMIC endian mode.

Fixes: f91e6d8941bf ('net/mlx5_core: Add setting ATOMIC endian mode')
Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Reviewed-by: Saeed Mahameed <saeedm-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 drivers/net/ethernet/mellanox/mlx5/core/main.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index 1545a94..b86fe50 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -423,6 +423,10 @@ static int handle_hca_cap_atomic(struct mlx5_core_dev *dev)
 					 HCA_CAP_OPMOD_GET_CUR);
 		if (err)
 			return err;
+		err = mlx5_core_get_caps(dev, MLX5_CAP_ATOMIC,
+					 HCA_CAP_OPMOD_GET_MAX);
+		if (err)
+			return err;
 	} else {
 		return 0;
 	}
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH rdma-next 2/8] net/mlx5_core: Refactor device capability function
       [not found] ` <1455954465-15141-1-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
  2016-02-20  7:47   ` [PATCH rdma-next 1/8] net/mlx5_core: Fix caching ATOMIC endian mode capability Leon Romanovsky
@ 2016-02-20  7:47   ` Leon Romanovsky
  2016-02-20  7:47   ` [PATCH rdma-next 3/8] net/mlx5_core: Introduce offload arithmetic hardware capabilities Leon Romanovsky
                     ` (5 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Leon Romanovsky @ 2016-02-20  7:47 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA, saeedm-VPRAkNaXOzVWk0Htik3J/w
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky

From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Device capability function was called similar in all places.
It was called twice for every queried parameter, while the
difference between calls was in HCA capability mode only.

The change proposed unify these calls into one function.

Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Reviewed-by: Saeed Mahameed <saeedm-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 drivers/net/ethernet/mellanox/mlx5/core/fw.c   | 55 ++++----------------------
 drivers/net/ethernet/mellanox/mlx5/core/main.c | 28 +++++++------
 include/linux/mlx5/driver.h                    |  3 +-
 3 files changed, 24 insertions(+), 62 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fw.c b/drivers/net/ethernet/mellanox/mlx5/core/fw.c
index aa1ab47..fe6dfd8 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fw.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fw.c
@@ -98,88 +98,49 @@ int mlx5_query_hca_caps(struct mlx5_core_dev *dev)
 {
 	int err;
 
-	err = mlx5_core_get_caps(dev, MLX5_CAP_GENERAL, HCA_CAP_OPMOD_GET_CUR);
-	if (err)
-		return err;
-
-	err = mlx5_core_get_caps(dev, MLX5_CAP_GENERAL, HCA_CAP_OPMOD_GET_MAX);
+	err = mlx5_core_get_caps(dev, MLX5_CAP_GENERAL);
 	if (err)
 		return err;
 
 	if (MLX5_CAP_GEN(dev, eth_net_offloads)) {
-		err = mlx5_core_get_caps(dev, MLX5_CAP_ETHERNET_OFFLOADS,
-					 HCA_CAP_OPMOD_GET_CUR);
-		if (err)
-			return err;
-		err = mlx5_core_get_caps(dev, MLX5_CAP_ETHERNET_OFFLOADS,
-					 HCA_CAP_OPMOD_GET_MAX);
+		err = mlx5_core_get_caps(dev, MLX5_CAP_ETHERNET_OFFLOADS);
 		if (err)
 			return err;
 	}
 
 	if (MLX5_CAP_GEN(dev, pg)) {
-		err = mlx5_core_get_caps(dev, MLX5_CAP_ODP,
-					 HCA_CAP_OPMOD_GET_CUR);
-		if (err)
-			return err;
-		err = mlx5_core_get_caps(dev, MLX5_CAP_ODP,
-					 HCA_CAP_OPMOD_GET_MAX);
+		err = mlx5_core_get_caps(dev, MLX5_CAP_ODP);
 		if (err)
 			return err;
 	}
 
 	if (MLX5_CAP_GEN(dev, atomic)) {
-		err = mlx5_core_get_caps(dev, MLX5_CAP_ATOMIC,
-					 HCA_CAP_OPMOD_GET_CUR);
-		if (err)
-			return err;
-		err = mlx5_core_get_caps(dev, MLX5_CAP_ATOMIC,
-					 HCA_CAP_OPMOD_GET_MAX);
+		err = mlx5_core_get_caps(dev, MLX5_CAP_ATOMIC);
 		if (err)
 			return err;
 	}
 
 	if (MLX5_CAP_GEN(dev, roce)) {
-		err = mlx5_core_get_caps(dev, MLX5_CAP_ROCE,
-					 HCA_CAP_OPMOD_GET_CUR);
-		if (err)
-			return err;
-		err = mlx5_core_get_caps(dev, MLX5_CAP_ROCE,
-					 HCA_CAP_OPMOD_GET_MAX);
+		err = mlx5_core_get_caps(dev, MLX5_CAP_ROCE);
 		if (err)
 			return err;
 	}
 
 	if (MLX5_CAP_GEN(dev, nic_flow_table)) {
-		err = mlx5_core_get_caps(dev, MLX5_CAP_FLOW_TABLE,
-					 HCA_CAP_OPMOD_GET_CUR);
-		if (err)
-			return err;
-		err = mlx5_core_get_caps(dev, MLX5_CAP_FLOW_TABLE,
-					 HCA_CAP_OPMOD_GET_MAX);
+		err = mlx5_core_get_caps(dev, MLX5_CAP_FLOW_TABLE);
 		if (err)
 			return err;
 	}
 
 	if (MLX5_CAP_GEN(dev, vport_group_manager) &&
 	    MLX5_CAP_GEN(dev, eswitch_flow_table)) {
-		err = mlx5_core_get_caps(dev, MLX5_CAP_ESWITCH_FLOW_TABLE,
-					 HCA_CAP_OPMOD_GET_CUR);
-		if (err)
-			return err;
-		err = mlx5_core_get_caps(dev, MLX5_CAP_ESWITCH_FLOW_TABLE,
-					 HCA_CAP_OPMOD_GET_MAX);
+		err = mlx5_core_get_caps(dev, MLX5_CAP_ESWITCH_FLOW_TABLE);
 		if (err)
 			return err;
 	}
 
 	if (MLX5_CAP_GEN(dev, eswitch_flow_table)) {
-		err = mlx5_core_get_caps(dev, MLX5_CAP_ESWITCH,
-					 HCA_CAP_OPMOD_GET_CUR);
-		if (err)
-			return err;
-		err = mlx5_core_get_caps(dev, MLX5_CAP_ESWITCH,
-					 HCA_CAP_OPMOD_GET_MAX);
+		err = mlx5_core_get_caps(dev, MLX5_CAP_ESWITCH);
 		if (err)
 			return err;
 	}
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index b86fe50..9397768 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -341,8 +341,9 @@ static u16 to_fw_pkey_sz(u32 size)
 	}
 }
 
-int mlx5_core_get_caps(struct mlx5_core_dev *dev, enum mlx5_cap_type cap_type,
-		       enum mlx5_cap_mode cap_mode)
+static int mlx5_core_get_caps_mode(struct mlx5_core_dev *dev,
+				   enum mlx5_cap_type cap_type,
+				   enum mlx5_cap_mode cap_mode)
 {
 	u8 in[MLX5_ST_SZ_BYTES(query_hca_cap_in)];
 	int out_sz = MLX5_ST_SZ_BYTES(query_hca_cap_out);
@@ -392,6 +393,16 @@ query_ex:
 	return err;
 }
 
+int mlx5_core_get_caps(struct mlx5_core_dev *dev, enum mlx5_cap_type cap_type)
+{
+	int ret;
+
+	ret = mlx5_core_get_caps_mode(dev, cap_type, HCA_CAP_OPMOD_GET_CUR);
+	if (ret)
+		return ret;
+	return mlx5_core_get_caps_mode(dev, cap_type, HCA_CAP_OPMOD_GET_MAX);
+}
+
 static int set_caps(struct mlx5_core_dev *dev, void *in, int in_sz, int opmod)
 {
 	u32 out[MLX5_ST_SZ_DW(set_hca_cap_out)];
@@ -419,12 +430,7 @@ static int handle_hca_cap_atomic(struct mlx5_core_dev *dev)
 	int err;
 
 	if (MLX5_CAP_GEN(dev, atomic)) {
-		err = mlx5_core_get_caps(dev, MLX5_CAP_ATOMIC,
-					 HCA_CAP_OPMOD_GET_CUR);
-		if (err)
-			return err;
-		err = mlx5_core_get_caps(dev, MLX5_CAP_ATOMIC,
-					 HCA_CAP_OPMOD_GET_MAX);
+		err = mlx5_core_get_caps(dev, MLX5_CAP_ATOMIC);
 		if (err)
 			return err;
 	} else {
@@ -466,11 +472,7 @@ static int handle_hca_cap(struct mlx5_core_dev *dev)
 	if (!set_ctx)
 		goto query_ex;
 
-	err = mlx5_core_get_caps(dev, MLX5_CAP_GENERAL, HCA_CAP_OPMOD_GET_MAX);
-	if (err)
-		goto query_ex;
-
-	err = mlx5_core_get_caps(dev, MLX5_CAP_GENERAL, HCA_CAP_OPMOD_GET_CUR);
+	err = mlx5_core_get_caps(dev, MLX5_CAP_GENERAL);
 	if (err)
 		goto query_ex;
 
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 1e3006d..1f1d971 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -706,8 +706,7 @@ void mlx5_cmd_use_events(struct mlx5_core_dev *dev);
 void mlx5_cmd_use_polling(struct mlx5_core_dev *dev);
 int mlx5_cmd_status_to_err(struct mlx5_outbox_hdr *hdr);
 int mlx5_cmd_status_to_err_v2(void *ptr);
-int mlx5_core_get_caps(struct mlx5_core_dev *dev, enum mlx5_cap_type cap_type,
-		       enum mlx5_cap_mode cap_mode);
+int mlx5_core_get_caps(struct mlx5_core_dev *dev, enum mlx5_cap_type cap_type);
 int mlx5_cmd_exec(struct mlx5_core_dev *dev, void *in, int in_size, void *out,
 		  int out_size);
 int mlx5_cmd_exec_cb(struct mlx5_core_dev *dev, void *in, int in_size,
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH rdma-next 3/8] net/mlx5_core: Introduce offload arithmetic hardware capabilities
       [not found] ` <1455954465-15141-1-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
  2016-02-20  7:47   ` [PATCH rdma-next 1/8] net/mlx5_core: Fix caching ATOMIC endian mode capability Leon Romanovsky
  2016-02-20  7:47   ` [PATCH rdma-next 2/8] net/mlx5_core: Refactor device capability function Leon Romanovsky
@ 2016-02-20  7:47   ` Leon Romanovsky
       [not found]     ` <1455954465-15141-4-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
  2016-02-20  7:47   ` [PATCH rdma-next 4/8] IB/core: Replace setting the zero values in ib_uverbs_ex_query_device Leon Romanovsky
                     ` (4 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Leon Romanovsky @ 2016-02-20  7:47 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA, saeedm-VPRAkNaXOzVWk0Htik3J/w
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky, Sagi Grimberg

From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Define the necessary hardware structures for the offload
arithmetic capabilities and read/cache them on driver load.

Signed-off-by: Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Reviewed-by: Saeed Mahameed <saeedm-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 drivers/net/ethernet/mellanox/mlx5/core/fw.c |  6 ++++++
 include/linux/mlx5/device.h                  |  6 ++++++
 include/linux/mlx5/mlx5_ifc.h                | 31 +++++++++++++++++++++++++++-
 3 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fw.c b/drivers/net/ethernet/mellanox/mlx5/core/fw.c
index fe6dfd8..75c7ae6 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fw.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fw.c
@@ -145,6 +145,12 @@ int mlx5_query_hca_caps(struct mlx5_core_dev *dev)
 			return err;
 	}
 
+	if (MLX5_CAP_GEN(dev, vector_calc)) {
+		err = mlx5_core_get_caps(dev, MLX5_CAP_VECTOR_CALC);
+		if (err)
+			return err;
+	}
+
 	return 0;
 }
 
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
index 987764a..1f2cedf 100644
--- a/include/linux/mlx5/device.h
+++ b/include/linux/mlx5/device.h
@@ -1196,6 +1196,8 @@ enum mlx5_cap_type {
 	MLX5_CAP_FLOW_TABLE,
 	MLX5_CAP_ESWITCH_FLOW_TABLE,
 	MLX5_CAP_ESWITCH,
+	MLX5_CAP_RESERVED,
+	MLX5_CAP_VECTOR_CALC,
 	/* NUM OF CAP Types */
 	MLX5_CAP_NUM
 };
@@ -1258,6 +1260,10 @@ enum mlx5_cap_type {
 #define MLX5_CAP_ODP(mdev, cap)\
 	MLX5_GET(odp_cap, mdev->hca_caps_cur[MLX5_CAP_ODP], cap)
 
+#define MLX5_CAP_VECTOR_CALC(mdev, cap) \
+	MLX5_GET(vector_calc_cap, \
+		 mdev->hca_caps_cur[MLX5_CAP_VECTOR_CALC], cap)
+
 enum {
 	MLX5_CMD_STAT_OK			= 0x0,
 	MLX5_CMD_STAT_INT_ERR			= 0x1,
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index 455d9cc..d34ad50 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -617,6 +617,33 @@ struct mlx5_ifc_odp_cap_bits {
 	u8         reserved_at_80[0x720];
 };
 
+struct mlx5_ifc_calc_op {
+	u8        reserved_at_0[0x10];
+	u8        reserved_at_10[0x9];
+	u8        op_swap_endianness[0x1];
+	u8        op_min[0x1];
+	u8        op_xor[0x1];
+	u8        op_or[0x1];
+	u8        op_and[0x1];
+	u8        op_max[0x1];
+	u8        op_add[0x1];
+};
+
+struct mlx5_ifc_vector_calc_cap_bits {
+	u8         calc_matrix[0x1];
+	u8         reserved_at_1[0x1f];
+	u8         reserved_at_20[0x8];
+	u8         max_vec_count[0x8];
+	u8         reserved_at_30[0xd];
+	u8         max_chunk_size[0x3];
+	struct mlx5_ifc_calc_op calc0;
+	struct mlx5_ifc_calc_op calc1;
+	struct mlx5_ifc_calc_op calc2;
+	struct mlx5_ifc_calc_op calc3;
+
+	u8         reserved_at_e0[0x720];
+};
+
 enum {
 	MLX5_WQ_TYPE_LINKED_LIST  = 0x0,
 	MLX5_WQ_TYPE_CYCLIC       = 0x1,
@@ -781,7 +808,8 @@ struct mlx5_ifc_cmd_hca_cap_bits {
 	u8         cd[0x1];
 	u8         reserved_at_22c[0x1];
 	u8         apm[0x1];
-	u8         reserved_at_22e[0x7];
+	u8         vector_calc[0x1];
+	u8         reserved_at_22f[0x6];
 	u8         qkv[0x1];
 	u8         pkv[0x1];
 	u8         reserved_at_237[0x4];
@@ -1918,6 +1946,7 @@ union mlx5_ifc_hca_cap_union_bits {
 	struct mlx5_ifc_flow_table_nic_cap_bits flow_table_nic_cap;
 	struct mlx5_ifc_flow_table_eswitch_cap_bits flow_table_eswitch_cap;
 	struct mlx5_ifc_e_switch_cap_bits e_switch_cap;
+	struct mlx5_ifc_vector_calc_cap_bits vector_calc_cap;
 	u8         reserved_at_0[0x8000];
 };
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH rdma-next 4/8] IB/core: Replace setting the zero values in ib_uverbs_ex_query_device
       [not found] ` <1455954465-15141-1-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
                     ` (2 preceding siblings ...)
  2016-02-20  7:47   ` [PATCH rdma-next 3/8] net/mlx5_core: Introduce offload arithmetic hardware capabilities Leon Romanovsky
@ 2016-02-20  7:47   ` Leon Romanovsky
  2016-02-20  7:47   ` [PATCH rdma-next 5/8] IB/{core,ulp} Support above 32 possible device capability flags Leon Romanovsky
                     ` (3 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Leon Romanovsky @ 2016-02-20  7:47 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA, saeedm-VPRAkNaXOzVWk0Htik3J/w
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky

From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

The setting to zero during variable initialization eliminates
the need to explicitly set to zero variables and structures.

Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 drivers/infiniband/core/uverbs_cmd.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index 6ffc9c4..c647d67 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -3583,9 +3583,9 @@ int ib_uverbs_ex_query_device(struct ib_uverbs_file *file,
 			      struct ib_udata *ucore,
 			      struct ib_udata *uhw)
 {
-	struct ib_uverbs_ex_query_device_resp resp;
+	struct ib_uverbs_ex_query_device_resp resp = { {0} };
 	struct ib_uverbs_ex_query_device  cmd;
-	struct ib_device_attr attr;
+	struct ib_device_attr attr = {0};
 	int err;
 
 	if (ucore->inlen < sizeof(cmd))
@@ -3606,14 +3606,11 @@ int ib_uverbs_ex_query_device(struct ib_uverbs_file *file,
 	if (ucore->outlen < resp.response_length)
 		return -ENOSPC;
 
-	memset(&attr, 0, sizeof(attr));
-
 	err = ib_dev->query_device(ib_dev, &attr, uhw);
 	if (err)
 		return err;
 
 	copy_query_dev_fields(file, ib_dev, &resp.base, &attr);
-	resp.comp_mask = 0;
 
 	if (ucore->outlen < resp.response_length + sizeof(resp.odp_caps))
 		goto end;
@@ -3626,9 +3623,6 @@ int ib_uverbs_ex_query_device(struct ib_uverbs_file *file,
 		attr.odp_caps.per_transport_caps.uc_odp_caps;
 	resp.odp_caps.per_transport_caps.ud_odp_caps =
 		attr.odp_caps.per_transport_caps.ud_odp_caps;
-	resp.odp_caps.reserved = 0;
-#else
-	memset(&resp.odp_caps, 0, sizeof(resp.odp_caps));
 #endif
 	resp.response_length += sizeof(resp.odp_caps);
 
@@ -3646,8 +3640,5 @@ int ib_uverbs_ex_query_device(struct ib_uverbs_file *file,
 
 end:
 	err = ib_copy_to_udata(ucore, &resp, resp.response_length);
-	if (err)
-		return err;
-
-	return 0;
+	return err;
 }
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH rdma-next 5/8] IB/{core,ulp} Support above 32 possible device capability flags
       [not found] ` <1455954465-15141-1-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
                     ` (3 preceding siblings ...)
  2016-02-20  7:47   ` [PATCH rdma-next 4/8] IB/core: Replace setting the zero values in ib_uverbs_ex_query_device Leon Romanovsky
@ 2016-02-20  7:47   ` Leon Romanovsky
       [not found]     ` <1455954465-15141-6-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
  2016-02-20  7:47   ` [PATCH rdma-next 6/8] IB/core: Add offload arithmetic operations support Leon Romanovsky
                     ` (2 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Leon Romanovsky @ 2016-02-20  7:47 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA, saeedm-VPRAkNaXOzVWk0Htik3J/w
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky

From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

The old bitwise device_cap_flags variable was limited to u32 which
has all bits already defined. In order to overcome it, we converted
device_cap_flags variable to be u64 type.

Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 drivers/infiniband/core/uverbs_cmd.c      | 2 +-
 drivers/infiniband/ulp/ipoib/ipoib_main.c | 2 +-
 include/rdma/ib_verbs.h                   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index c647d67..6887252 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -402,7 +402,7 @@ static void copy_query_dev_fields(struct ib_uverbs_file *file,
 	resp->hw_ver		= attr->hw_ver;
 	resp->max_qp		= attr->max_qp;
 	resp->max_qp_wr		= attr->max_qp_wr;
-	resp->device_cap_flags	= attr->device_cap_flags;
+	resp->device_cap_flags	= lower_32_bits(attr->device_cap_flags);
 	resp->max_sge		= attr->max_sge;
 	resp->max_sge_rd	= attr->max_sge_rd;
 	resp->max_cq		= attr->max_cq;
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 25509bb..6d53330 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -1762,7 +1762,7 @@ int ipoib_add_pkey_attr(struct net_device *dev)
 
 int ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca)
 {
-	priv->hca_caps = hca->attrs.device_cap_flags;
+	priv->hca_caps = (int)hca->attrs.device_cap_flags;
 
 	if (priv->hca_caps & IB_DEVICE_UD_IP_CSUM) {
 		priv->dev->hw_features = NETIF_F_SG |
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 284b00c..2ff1fd1 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -273,7 +273,7 @@ struct ib_device_attr {
 	u32			hw_ver;
 	int			max_qp;
 	int			max_qp_wr;
-	int			device_cap_flags;
+	u64			device_cap_flags;
 	int			max_sge;
 	int			max_sge_rd;
 	int			max_cq;
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH rdma-next 6/8] IB/core: Add offload arithmetic operations support
       [not found] ` <1455954465-15141-1-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
                     ` (4 preceding siblings ...)
  2016-02-20  7:47   ` [PATCH rdma-next 5/8] IB/{core,ulp} Support above 32 possible device capability flags Leon Romanovsky
@ 2016-02-20  7:47   ` Leon Romanovsky
       [not found]     ` <1455954465-15141-7-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
  2016-02-20  7:47   ` [PATCH rdma-next 7/8] IB/core: Exposure supported CALC capabilities Leon Romanovsky
  2016-02-20  7:47   ` [PATCH rdma-next 8/8] IB/mlx5: Exposure offload arithmetic operations Leon Romanovsky
  7 siblings, 1 reply; 17+ messages in thread
From: Leon Romanovsky @ 2016-02-20  7:47 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA, saeedm-VPRAkNaXOzVWk0Htik3J/w
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky

From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

The offload arithmetic operations support allows to the user to
benefit from the parallel calculation of several input vectors of
equal length.

The newly added flag indicates this ability.

Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Reviewed-by: Matan Barak <matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 drivers/infiniband/core/uverbs_cmd.c | 3 +++
 include/rdma/ib_verbs.h              | 8 +++++++-
 include/uapi/rdma/ib_user_verbs.h    | 5 +++++
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index 6887252..3a3f573 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -3638,6 +3638,9 @@ int ib_uverbs_ex_query_device(struct ib_uverbs_file *file,
 	resp.hca_core_clock = attr.hca_core_clock;
 	resp.response_length += sizeof(resp.hca_core_clock);
 
+	resp.device_cap_flags2 = upper_32_bits(attr.device_cap_flags);
+	resp.response_length += sizeof(resp.device_cap_flags2);
+
 end:
 	err = ib_copy_to_udata(ucore, &resp, resp.response_length);
 	return err;
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 2ff1fd1..51aabf8 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -208,10 +208,16 @@ enum ib_device_cap_flags {
 	 * of I/O operations with single completion queue managed
 	 * by hardware.
 	 */
-	IB_DEVICE_CROSS_CHANNEL		= (1 << 27),
+	IB_DEVICE_CROSS_CHANNEL			= (1 << 27),
 	IB_DEVICE_MANAGED_FLOW_STEERING		= (1 << 29),
 	IB_DEVICE_SIGNATURE_HANDOVER		= (1 << 30),
 	IB_DEVICE_ON_DEMAND_PAGING		= (1 << 31),
+	/*
+	 * The offload arithmetic operations support allows to
+	 * the user to benefit from the parallel calculation of
+	 * several input vectors of equal length.
+	 */
+	IB_DEVICE_VECTOR_CALC                   = (1ULL << 32),
 };
 
 enum ib_signature_prot_cap {
diff --git a/include/uapi/rdma/ib_user_verbs.h b/include/uapi/rdma/ib_user_verbs.h
index 8126c14..e024c82 100644
--- a/include/uapi/rdma/ib_user_verbs.h
+++ b/include/uapi/rdma/ib_user_verbs.h
@@ -226,6 +226,11 @@ struct ib_uverbs_ex_query_device_resp {
 	struct ib_uverbs_odp_caps odp_caps;
 	__u64 timestamp_mask;
 	__u64 hca_core_clock; /* in KHZ */
+	/*
+	 * Original capability field is limited
+	 * by __u32 variable.  Need to increase this field
+	 */
+	__u64 device_cap_flags2;
 };
 
 struct ib_uverbs_query_port {
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH rdma-next 7/8] IB/core: Exposure supported CALC capabilities
       [not found] ` <1455954465-15141-1-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
                     ` (5 preceding siblings ...)
  2016-02-20  7:47   ` [PATCH rdma-next 6/8] IB/core: Add offload arithmetic operations support Leon Romanovsky
@ 2016-02-20  7:47   ` Leon Romanovsky
       [not found]     ` <1455954465-15141-8-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
  2016-02-20  7:47   ` [PATCH rdma-next 8/8] IB/mlx5: Exposure offload arithmetic operations Leon Romanovsky
  7 siblings, 1 reply; 17+ messages in thread
From: Leon Romanovsky @ 2016-02-20  7:47 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA, saeedm-VPRAkNaXOzVWk0Htik3J/w
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky

From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Add support to return CALC capabilities.

Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Reviewed-by: Matan Barak <matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 drivers/infiniband/core/uverbs_cmd.c |  9 +++++++++
 include/rdma/ib_verbs.h              | 19 +++++++++++++++++++
 include/uapi/rdma/ib_user_verbs.h    |  8 ++++++++
 3 files changed, 36 insertions(+)

diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index 3a3f573..3618ca5 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -3641,6 +3641,15 @@ int ib_uverbs_ex_query_device(struct ib_uverbs_file *file,
 	resp.device_cap_flags2 = upper_32_bits(attr.device_cap_flags);
 	resp.response_length += sizeof(resp.device_cap_flags2);
 
+	if (ucore->outlen < resp.response_length + sizeof(resp.calc_caps))
+		goto end;
+
+	resp.calc_caps.calc_matrix = attr.calc_caps.calc_matrix;
+	resp.calc_caps.max_vector_count = attr.calc_caps.max_vector_count;
+	resp.calc_caps.max_chunk_size = attr.calc_caps.max_chunk_size;
+	resp.calc_caps.op_cap = attr.calc_caps.op_cap;
+	resp.response_length += sizeof(resp.calc_caps);
+
 end:
 	err = ib_copy_to_udata(ucore, &resp, resp.response_length);
 	return err;
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 51aabf8..1f74ebb 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -258,6 +258,24 @@ struct ib_odp_caps {
 	} per_transport_caps;
 };
 
+enum ib_calc_operations {
+	IB_CALC_NONE,
+	IB_CALC_ADD,
+	IB_CALC_MAX,
+	IB_CALC_AND,
+	IB_CALC_OR,
+	IB_CALC_XOR,
+	IB_CALC_MIN,
+	IB_CALC_SWAP_ENDIANNESS
+};
+
+struct ib_calc_caps {
+	u32	calc_matrix;
+	u32	max_vector_count;
+	u32	max_chunk_size;
+	u32	op_cap;
+};
+
 enum ib_cq_creation_flags {
 	IB_CQ_FLAGS_TIMESTAMP_COMPLETION   = 1 << 0,
 	IB_CQ_FLAGS_IGNORE_OVERRUN	   = 1 << 1,
@@ -315,6 +333,7 @@ struct ib_device_attr {
 	struct ib_odp_caps	odp_caps;
 	uint64_t		timestamp_mask;
 	uint64_t		hca_core_clock; /* in KHZ */
+	struct ib_calc_caps	calc_caps;
 };
 
 enum ib_mtu {
diff --git a/include/uapi/rdma/ib_user_verbs.h b/include/uapi/rdma/ib_user_verbs.h
index e024c82..c88d8e2 100644
--- a/include/uapi/rdma/ib_user_verbs.h
+++ b/include/uapi/rdma/ib_user_verbs.h
@@ -219,6 +219,13 @@ struct ib_uverbs_odp_caps {
 	__u32 reserved;
 };
 
+struct ib_uverbs_calc_caps {
+	__u32	calc_matrix;
+	__u32	max_vector_count;
+	__u32	max_chunk_size;
+	__u32	op_cap;
+};
+
 struct ib_uverbs_ex_query_device_resp {
 	struct ib_uverbs_query_device_resp base;
 	__u32 comp_mask;
@@ -231,6 +238,7 @@ struct ib_uverbs_ex_query_device_resp {
 	 * by __u32 variable.  Need to increase this field
 	 */
 	__u64 device_cap_flags2;
+	struct ib_uverbs_calc_caps calc_caps;
 };
 
 struct ib_uverbs_query_port {
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH rdma-next 8/8] IB/mlx5: Exposure offload arithmetic operations
       [not found] ` <1455954465-15141-1-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
                     ` (6 preceding siblings ...)
  2016-02-20  7:47   ` [PATCH rdma-next 7/8] IB/core: Exposure supported CALC capabilities Leon Romanovsky
@ 2016-02-20  7:47   ` Leon Romanovsky
       [not found]     ` <1455954465-15141-9-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
  7 siblings, 1 reply; 17+ messages in thread
From: Leon Romanovsky @ 2016-02-20  7:47 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA, saeedm-VPRAkNaXOzVWk0Htik3J/w
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky

From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Advertise the offload arithmetic operations support.

Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Reviewed-by: Matan Barak <matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 drivers/infiniband/hw/mlx5/main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 03c418c..9e92f48 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -549,6 +549,9 @@ static int mlx5_ib_query_device(struct ib_device *ibdev,
 	if (MLX5_CAP_GEN(mdev, cd))
 		props->device_cap_flags |= IB_DEVICE_CROSS_CHANNEL;
 
+	if (MLX5_CAP_GEN(dev->mdev, vector_calc))
+		props->device_cap_flags |= IB_DEVICE_VECTOR_CALC;
+
 	return 0;
 }
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH rdma-next 3/8] net/mlx5_core: Introduce offload arithmetic hardware capabilities
       [not found]     ` <1455954465-15141-4-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
@ 2016-02-20 15:13       ` Leon Romanovsky
  2016-02-28 22:05       ` Max Gurtovoy
  1 sibling, 0 replies; 17+ messages in thread
From: Leon Romanovsky @ 2016-02-20 15:13 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA, saeedm-VPRAkNaXOzVWk0Htik3J/w
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky, Sagi Grimberg

Hi Doug

On Sat, Feb 20, 2016 at 09:47:40AM +0200, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

I had a problem with my git setup and created author field wrongly.
It should be "From: Sagi Grimeberg <sagigo-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>" and not as
written.

Do you want me to resend whole series with appropriate version
number and changelog?

> 
> Define the necessary hardware structures for the offload
> arithmetic capabilities and read/cache them on driver load.
> 
> Signed-off-by: Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Reviewed-by: Saeed Mahameed <saeedm-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/fw.c |  6 ++++++
>  include/linux/mlx5/device.h                  |  6 ++++++
>  include/linux/mlx5/mlx5_ifc.h                | 31 +++++++++++++++++++++++++++-
>  3 files changed, 42 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fw.c b/drivers/net/ethernet/mellanox/mlx5/core/fw.c
> index fe6dfd8..75c7ae6 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/fw.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/fw.c
> @@ -145,6 +145,12 @@ int mlx5_query_hca_caps(struct mlx5_core_dev *dev)
>  			return err;
>  	}
>  
> +	if (MLX5_CAP_GEN(dev, vector_calc)) {
> +		err = mlx5_core_get_caps(dev, MLX5_CAP_VECTOR_CALC);
> +		if (err)
> +			return err;
> +	}
> +
>  	return 0;
>  }
>  
> diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
> index 987764a..1f2cedf 100644
> --- a/include/linux/mlx5/device.h
> +++ b/include/linux/mlx5/device.h
> @@ -1196,6 +1196,8 @@ enum mlx5_cap_type {
>  	MLX5_CAP_FLOW_TABLE,
>  	MLX5_CAP_ESWITCH_FLOW_TABLE,
>  	MLX5_CAP_ESWITCH,
> +	MLX5_CAP_RESERVED,
> +	MLX5_CAP_VECTOR_CALC,
>  	/* NUM OF CAP Types */
>  	MLX5_CAP_NUM
>  };
> @@ -1258,6 +1260,10 @@ enum mlx5_cap_type {
>  #define MLX5_CAP_ODP(mdev, cap)\
>  	MLX5_GET(odp_cap, mdev->hca_caps_cur[MLX5_CAP_ODP], cap)
>  
> +#define MLX5_CAP_VECTOR_CALC(mdev, cap) \
> +	MLX5_GET(vector_calc_cap, \
> +		 mdev->hca_caps_cur[MLX5_CAP_VECTOR_CALC], cap)
> +
>  enum {
>  	MLX5_CMD_STAT_OK			= 0x0,
>  	MLX5_CMD_STAT_INT_ERR			= 0x1,
> diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
> index 455d9cc..d34ad50 100644
> --- a/include/linux/mlx5/mlx5_ifc.h
> +++ b/include/linux/mlx5/mlx5_ifc.h
> @@ -617,6 +617,33 @@ struct mlx5_ifc_odp_cap_bits {
>  	u8         reserved_at_80[0x720];
>  };
>  
> +struct mlx5_ifc_calc_op {
> +	u8        reserved_at_0[0x10];
> +	u8        reserved_at_10[0x9];
> +	u8        op_swap_endianness[0x1];
> +	u8        op_min[0x1];
> +	u8        op_xor[0x1];
> +	u8        op_or[0x1];
> +	u8        op_and[0x1];
> +	u8        op_max[0x1];
> +	u8        op_add[0x1];
> +};
> +
> +struct mlx5_ifc_vector_calc_cap_bits {
> +	u8         calc_matrix[0x1];
> +	u8         reserved_at_1[0x1f];
> +	u8         reserved_at_20[0x8];
> +	u8         max_vec_count[0x8];
> +	u8         reserved_at_30[0xd];
> +	u8         max_chunk_size[0x3];
> +	struct mlx5_ifc_calc_op calc0;
> +	struct mlx5_ifc_calc_op calc1;
> +	struct mlx5_ifc_calc_op calc2;
> +	struct mlx5_ifc_calc_op calc3;
> +
> +	u8         reserved_at_e0[0x720];
> +};
> +
>  enum {
>  	MLX5_WQ_TYPE_LINKED_LIST  = 0x0,
>  	MLX5_WQ_TYPE_CYCLIC       = 0x1,
> @@ -781,7 +808,8 @@ struct mlx5_ifc_cmd_hca_cap_bits {
>  	u8         cd[0x1];
>  	u8         reserved_at_22c[0x1];
>  	u8         apm[0x1];
> -	u8         reserved_at_22e[0x7];
> +	u8         vector_calc[0x1];
> +	u8         reserved_at_22f[0x6];
>  	u8         qkv[0x1];
>  	u8         pkv[0x1];
>  	u8         reserved_at_237[0x4];
> @@ -1918,6 +1946,7 @@ union mlx5_ifc_hca_cap_union_bits {
>  	struct mlx5_ifc_flow_table_nic_cap_bits flow_table_nic_cap;
>  	struct mlx5_ifc_flow_table_eswitch_cap_bits flow_table_eswitch_cap;
>  	struct mlx5_ifc_e_switch_cap_bits e_switch_cap;
> +	struct mlx5_ifc_vector_calc_cap_bits vector_calc_cap;
>  	u8         reserved_at_0[0x8000];
>  };
>  
> -- 
> 2.1.4
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH rdma-next 5/8] IB/{core,ulp} Support above 32 possible device capability flags
       [not found]     ` <1455954465-15141-6-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
@ 2016-02-21  7:39       ` Haggai Eran
       [not found]         ` <56C969B5.5080802-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 17+ messages in thread
From: Haggai Eran @ 2016-02-21  7:39 UTC (permalink / raw)
  To: Leon Romanovsky, dledford-H+wXaHxf7aLQT0dZR+AlfA,
	saeedm-VPRAkNaXOzVWk0Htik3J/w
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky

On 20/02/2016 09:47, Leon Romanovsky wrote:
> --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
> +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
> @@ -1762,7 +1762,7 @@ int ipoib_add_pkey_attr(struct net_device *dev)
>  
>  int ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca)
>  {
> -	priv->hca_caps = hca->attrs.device_cap_flags;
> +	priv->hca_caps = (int)hca->attrs.device_cap_flags;

Won't it be better to increase the size of priv->hca_caps? Someone in the 
future will probably attempt to check one of the new device caps through
this field and will be surprised to see it is only partial.

>  
>  	if (priv->hca_caps & IB_DEVICE_UD_IP_CSUM) {
>  		priv->dev->hw_features = NETIF_F_SG |
> diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
> index 284b00c..2ff1fd1 100644
> --- a/include/rdma/ib_verbs.h
> +++ b/include/rdma/ib_verbs.h
> @@ -273,7 +273,7 @@ struct ib_device_attr {
>  	u32			hw_ver;
>  	int			max_qp;
>  	int			max_qp_wr;
> -	int			device_cap_flags;
> +	u64			device_cap_flags;
>  	int			max_sge;
>  	int			max_sge_rd;
>  	int			max_cq;
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH rdma-next 5/8] IB/{core,ulp} Support above 32 possible device capability flags
       [not found]         ` <56C969B5.5080802-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
@ 2016-02-21  8:00           ` Leon Romanovsky
       [not found]             ` <20160221080053.GL30450-2ukJVAZIZ/Y@public.gmane.org>
  0 siblings, 1 reply; 17+ messages in thread
From: Leon Romanovsky @ 2016-02-21  8:00 UTC (permalink / raw)
  To: Haggai Eran
  Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA, saeedm-VPRAkNaXOzVWk0Htik3J/w,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky

On Sun, Feb 21, 2016 at 09:39:33AM +0200, Haggai Eran wrote:
> On 20/02/2016 09:47, Leon Romanovsky wrote:
> > --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
> > +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
> > @@ -1762,7 +1762,7 @@ int ipoib_add_pkey_attr(struct net_device *dev)
> >  
> >  int ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca)
> >  {
> > -	priv->hca_caps = hca->attrs.device_cap_flags;
> > +	priv->hca_caps = (int)hca->attrs.device_cap_flags;
> 
> Won't it be better to increase the size of priv->hca_caps? Someone in the 
> future will probably attempt to check one of the new device caps through
> this field and will be surprised to see it is only partial.

My changes were intended to minimize the impact on the existing code base. The future
developer will be expected to check his code when he adds new device
capability above 32 bit limit. In this change, he will update the ipoib
properly expose it.

Current implementation doesn't change ipoib behavior and easy for
review without extra knowledge of ipoib internals, so let's stay this
change as is.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH rdma-next 5/8] IB/{core,ulp} Support above 32 possible device capability flags
       [not found]             ` <20160221080053.GL30450-2ukJVAZIZ/Y@public.gmane.org>
@ 2016-02-22 20:02               ` Jason Gunthorpe
  0 siblings, 0 replies; 17+ messages in thread
From: Jason Gunthorpe @ 2016-02-22 20:02 UTC (permalink / raw)
  To: Haggai Eran, dledford-H+wXaHxf7aLQT0dZR+AlfA,
	saeedm-VPRAkNaXOzVWk0Htik3J/w, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	Leon Romanovsky

On Sun, Feb 21, 2016 at 10:00:53AM +0200, Leon Romanovsky wrote:
> Current implementation doesn't change ipoib behavior and easy for
> review without extra knowledge of ipoib internals, so let's stay this
> change as is.

It is one line to fix ipoib's size, and avoids this subtle future land
mine. I'm with Haggi on this.

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH rdma-next 7/8] IB/core: Exposure supported CALC capabilities
       [not found]     ` <1455954465-15141-8-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
@ 2016-02-22 20:04       ` Jason Gunthorpe
  0 siblings, 0 replies; 17+ messages in thread
From: Jason Gunthorpe @ 2016-02-22 20:04 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA, saeedm-VPRAkNaXOzVWk0Htik3J/w,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky

On Sat, Feb 20, 2016 at 09:47:44AM +0200, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> 
> Add support to return CALC capabilities.

Can we please fully document these non-standard things?

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH rdma-next 3/8] net/mlx5_core: Introduce offload arithmetic hardware capabilities
       [not found]     ` <1455954465-15141-4-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
  2016-02-20 15:13       ` Leon Romanovsky
@ 2016-02-28 22:05       ` Max Gurtovoy
  1 sibling, 0 replies; 17+ messages in thread
From: Max Gurtovoy @ 2016-02-28 22:05 UTC (permalink / raw)
  To: Leon Romanovsky, dledford-H+wXaHxf7aLQT0dZR+AlfA,
	saeedm-VPRAkNaXOzVWk0Htik3J/w
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky, Sagi Grimberg



On 2/20/2016 9:47 AM, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
>
> Define the necessary hardware structures for the offload
> arithmetic capabilities and read/cache them on driver load.
>
> Signed-off-by: Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Reviewed-by: Saeed Mahameed <saeedm-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> ---

Looks good, wanted to add this myself as part of Erasure Coding.

Acked-by: Max Gurtovoy <maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH rdma-next 6/8] IB/core: Add offload arithmetic operations support
       [not found]     ` <1455954465-15141-7-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
@ 2016-02-28 22:22       ` Max Gurtovoy
  0 siblings, 0 replies; 17+ messages in thread
From: Max Gurtovoy @ 2016-02-28 22:22 UTC (permalink / raw)
  To: Leon Romanovsky, dledford-H+wXaHxf7aLQT0dZR+AlfA,
	saeedm-VPRAkNaXOzVWk0Htik3J/w
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky



On 2/20/2016 9:47 AM, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
>
> The offload arithmetic operations support allows to the user to
> benefit from the parallel calculation of several input vectors of
> equal length.
>
> The newly added flag indicates this ability.
>
> Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Reviewed-by: Matan Barak <matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> ---
>   drivers/infiniband/core/uverbs_cmd.c | 3 +++
>   include/rdma/ib_verbs.h              | 8 +++++++-
>   include/uapi/rdma/ib_user_verbs.h    | 5 +++++
>   3 files changed, 15 insertions(+), 1 deletion(-)

Looks good. I can use it while pushing the erasure coding.

Acked-by: Max Gurtovoy <maxg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH rdma-next 8/8] IB/mlx5: Exposure offload arithmetic operations
       [not found]     ` <1455954465-15141-9-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
@ 2016-02-28 22:40       ` Max Gurtovoy
  0 siblings, 0 replies; 17+ messages in thread
From: Max Gurtovoy @ 2016-02-28 22:40 UTC (permalink / raw)
  To: Leon Romanovsky, dledford-H+wXaHxf7aLQT0dZR+AlfA,
	saeedm-VPRAkNaXOzVWk0Htik3J/w
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky



On 2/20/2016 9:47 AM, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
>
> Advertise the offload arithmetic operations support.
>
> Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Reviewed-by: Matan Barak <matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> ---
>   drivers/infiniband/hw/mlx5/main.c | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
> index 03c418c..9e92f48 100644
> --- a/drivers/infiniband/hw/mlx5/main.c
> +++ b/drivers/infiniband/hw/mlx5/main.c
> @@ -549,6 +549,9 @@ static int mlx5_ib_query_device(struct ib_device *ibdev,
>   	if (MLX5_CAP_GEN(mdev, cd))
>   		props->device_cap_flags |= IB_DEVICE_CROSS_CHANNEL;
>
> +	if (MLX5_CAP_GEN(dev->mdev, vector_calc))
> +		props->device_cap_flags |= IB_DEVICE_VECTOR_CALC;

won't you like to advertise max_vector_count cap ?

props->calc_caps.max_vector_count =
                 MLX5_CAP_VECTOR_CALC(dev->mdev, max_vec_count);


> +
>   	return 0;
>   }
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2016-02-28 22:40 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-20  7:47 [PATCH rdma-next 0/8] Introduce vector CALC support Leon Romanovsky
     [not found] ` <1455954465-15141-1-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
2016-02-20  7:47   ` [PATCH rdma-next 1/8] net/mlx5_core: Fix caching ATOMIC endian mode capability Leon Romanovsky
2016-02-20  7:47   ` [PATCH rdma-next 2/8] net/mlx5_core: Refactor device capability function Leon Romanovsky
2016-02-20  7:47   ` [PATCH rdma-next 3/8] net/mlx5_core: Introduce offload arithmetic hardware capabilities Leon Romanovsky
     [not found]     ` <1455954465-15141-4-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
2016-02-20 15:13       ` Leon Romanovsky
2016-02-28 22:05       ` Max Gurtovoy
2016-02-20  7:47   ` [PATCH rdma-next 4/8] IB/core: Replace setting the zero values in ib_uverbs_ex_query_device Leon Romanovsky
2016-02-20  7:47   ` [PATCH rdma-next 5/8] IB/{core,ulp} Support above 32 possible device capability flags Leon Romanovsky
     [not found]     ` <1455954465-15141-6-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
2016-02-21  7:39       ` Haggai Eran
     [not found]         ` <56C969B5.5080802-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-02-21  8:00           ` Leon Romanovsky
     [not found]             ` <20160221080053.GL30450-2ukJVAZIZ/Y@public.gmane.org>
2016-02-22 20:02               ` Jason Gunthorpe
2016-02-20  7:47   ` [PATCH rdma-next 6/8] IB/core: Add offload arithmetic operations support Leon Romanovsky
     [not found]     ` <1455954465-15141-7-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
2016-02-28 22:22       ` Max Gurtovoy
2016-02-20  7:47   ` [PATCH rdma-next 7/8] IB/core: Exposure supported CALC capabilities Leon Romanovsky
     [not found]     ` <1455954465-15141-8-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
2016-02-22 20:04       ` Jason Gunthorpe
2016-02-20  7:47   ` [PATCH rdma-next 8/8] IB/mlx5: Exposure offload arithmetic operations Leon Romanovsky
     [not found]     ` <1455954465-15141-9-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
2016-02-28 22:40       ` Max Gurtovoy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox