Introduce vector CALC support
Subsystems (4)
cover Introduce vector CALC support
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
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(-)
Signature · 6 lines
2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1455954465-15141-1-git-send-email-leon-2ukJVAZIZ/[email protected]
PATCH 1/8 net/mlx5_core: Fix caching ATOMIC endian mode capability
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
Add caching of maximum device capability of ATOMIC endian mode.
--- drivers/net/ethernet/mellanox/mlx5/core/main.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/main.c +4 -0
@@ -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 ; }
Signature · 6 lines
2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/8 net/mlx5_core: Refactor device capability function
In reply to a message not in the archiveFrom: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
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.
--- 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(-)
drivers/net/ethernet/mellanox/mlx5/core/fw.c +8 -47
@@ -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; }
drivers/net/ethernet/mellanox/mlx5/core/main.c +15 -13
@@ -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;
include/linux/mlx5/driver.h +1 -2
@@ -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,
Signature · 6 lines
2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 3/8 net/mlx5_core: Introduce offload arithmetic hardware capabilities
In reply to a message not in the archiveFrom: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
Define the necessary hardware structures for the offload arithmetic capabilities and read/cache them on driver load.
--- 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(-)
drivers/net/ethernet/mellanox/mlx5/core/fw.c +6 -0
@@ -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 ; }
include/linux/mlx5/device.h +6 -0
@@ -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 ,
include/linux/mlx5/mlx5_ifc.h +30 -1
@@ -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 ]; };
Signature · 6 lines
2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1455954465-15141-4-git-send-email-leon-2ukJVAZIZ/[email protected]
Re: [PATCH rdma-next 3/8] net/mlx5_core: Introduce offload arithmetic hardware capabilities
Hi Doug
Quoted 1 line · Leon Romanovsky
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
I had a problem with my git setup and created author field wrongly.
It should be "From: Sagi Grimeberg <sagigo-VPRAkNaXOzVWk0Htik3J/[email protected]>" and not as written.
Do you want me to resend whole series with appropriate version number and changelog?
Quoted 113 lines
Define the necessary hardware structures for the offload arithmetic capabilities and read/cache them on driver load.
--- 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(-)drivers/net/ethernet/mellanox/mlx5/core/fw.c +6
-0@@ -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 ; }include/linux/mlx5/device.h +6
-0@@ -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 ,include/linux/mlx5/mlx5_ifc.h +30
-1@@ -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 ]; };Signature · 1 line
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Max Gurtovoy
Acked-byRe: [PATCH rdma-next 3/8] net/mlx5_core: Introduce offload arithmetic hardware capabilities
In reply to a message not in the archiveQuoted 9 lines · Leon Romanovsky
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
Define the necessary hardware structures for the offload arithmetic capabilities and read/cache them on driver load.
---
Looks good, wanted to add this myself as part of Erasure Coding.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 4/8 IB/core: Replace setting the zero values in ib_uverbs_ex_query_device
In reply to a message not in the archiveFrom: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
The setting to zero during variable initialization eliminates the need to explicitly set to zero variables and structures.
--- drivers/infiniband/core/uverbs_cmd.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-)
drivers/infiniband/core/uverbs_cmd.c +3 -12
@@ -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; }
Signature · 6 lines
2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 5/8 IB/{core,ulp} Support above 32 possible device capability flags
In reply to a message not in the archiveFrom: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
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.
--- 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(-)
drivers/infiniband/core/uverbs_cmd.c +1 -1
@@ -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;
drivers/infiniband/ulp/ipoib/ipoib_main.c +1 -1
@@ -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 |
include/rdma/ib_verbs.h +1 -1
@@ -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;
Signature · 6 lines
2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1455954465-15141-6-git-send-email-leon-2ukJVAZIZ/[email protected]
Re: [PATCH rdma-next 5/8] IB/{core,ulp} Support above 32 possible device capability flags
drivers/infiniband/ulp/ipoib/ipoib_main.c int ipoib_add_pkey_attr(struct net_device *dev) · line 1765
Quoted 8 lines · Leon Romanovsky
drivers/infiniband/ulp/ipoib/ipoib_main.c +1
-1@@ -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.
Quoted 9 lines
drivers/infiniband/ulp/ipoib/ipoib_main.c +0
-0if (priv->hca_caps &IB_DEVICE_UD_IP_CSUM ) { priv->dev->hw_features = NETIF_F_SG |include/rdma/ib_verbs.h +0
-0
include/rdma/ib_verbs.h struct ib_device_attr { · line 279
Quoted 8 lines
include/rdma/ib_verbs.h +1
-1@@ -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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 56C969B5.5080802-VPRAkNaXOzVWk0Htik3J/[email protected]
Re: [PATCH rdma-next 5/8] IB/{core,ulp} Support above 32 possible device capability flags
Quoted 5 lines · Haggai Eran
Quoted 4 lines · Leon Romanovsky
drivers/infiniband/ulp/ipoib/ipoib_main.c +0
-0@@ -1762,7 +1762,7 @@ int ipoib_add_pkey_attr(struct net_device *dev)
Quoted 8 lines
drivers/infiniband/ulp/ipoib/ipoib_main.c int ipoib_add_pkey_attr(struct net_device *dev) · line 1765
Quoted 4 lines
drivers/infiniband/ulp/ipoib/ipoib_main.c +1
-1int 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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20160221080053.GL30450-2ukJVAZIZ/[email protected]
Re: [PATCH rdma-next 5/8] IB/{core,ulp} Support above 32 possible device capability flags
Quoted 3 lines · Leon Romanovsky
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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 6/8 IB/core: Add offload arithmetic operations support
In reply to a message not in the archiveFrom: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
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.
--- 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(-)
drivers/infiniband/core/uverbs_cmd.c +3 -0
@@ -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;
include/rdma/ib_verbs.h +7 -1
@@ -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 {
include/uapi/rdma/ib_user_verbs.h +5 -0
@@ -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 {
Signature · 6 lines
2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1455954465-15141-7-git-send-email-leon-2ukJVAZIZ/[email protected]
Max Gurtovoy
Acked-byRe: [PATCH rdma-next 6/8] IB/core: Add offload arithmetic operations support
Quoted 8 lines · Leon Romanovsky
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
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.
Quoted 7 lines
--- 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.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 7/8 IB/core: Exposure supported CALC capabilities
In reply to a message not in the archiveFrom: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
Add support to return CALC capabilities.
--- 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(+)
drivers/infiniband/core/uverbs_cmd.c +9 -0
@@ -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;
include/rdma/ib_verbs.h +19 -0
@@ -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 {
include/uapi/rdma/ib_user_verbs.h +8 -0
@@ -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 {
Signature · 6 lines
2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1455954465-15141-8-git-send-email-leon-2ukJVAZIZ/[email protected]
Re: [PATCH rdma-next 7/8] IB/core: Exposure supported CALC capabilities
Quoted 3 lines · Leon Romanovsky
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 8/8 IB/mlx5: Exposure offload arithmetic operations
In reply to a message not in the archiveFrom: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
Advertise the offload arithmetic operations support.
--- drivers/infiniband/hw/mlx5/main.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/infiniband/hw/mlx5/main.c +3 -0
@@ -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 ; }
Signature · 6 lines
2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1455954465-15141-9-git-send-email-leon-2ukJVAZIZ/[email protected]
Re: [PATCH rdma-next 8/8] IB/mlx5: Exposure offload arithmetic operations
Quoted 15 lines · Leon Romanovsky
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
Advertise the offload arithmetic operations support.
--- drivers/infiniband/hw/mlx5/main.c | 3 +++ 1 file changed, 3 insertions(+)drivers/infiniband/hw/mlx5/main.c +0
-0
drivers/infiniband/hw/mlx5/main.c static int mlx5_ib_query_device(struct ib_device *ibdev, · line 553
Quoted 5 lines
drivers/infiniband/hw/mlx5/main.c +2
-0@@ -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);
drivers/infiniband/hw/mlx5/main.c static int mlx5_ib_query_device(struct ib_device *ibdev, · line 557
Quoted 5 lines
drivers/infiniband/hw/mlx5/main.c +1
-0+return 0 ; }
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html