From patchwork Tue Feb 23 08:25:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Romanovsky X-Patchwork-Id: 8388951 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A27AE9F1D4 for ; Tue, 23 Feb 2016 08:29:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A49F220676 for ; Tue, 23 Feb 2016 08:29:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A552420392 for ; Tue, 23 Feb 2016 08:29:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932760AbcBWI34 (ORCPT ); Tue, 23 Feb 2016 03:29:56 -0500 Received: from mail-wm0-f42.google.com ([74.125.82.42]:34880 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932568AbcBWI34 (ORCPT ); Tue, 23 Feb 2016 03:29:56 -0500 Received: by mail-wm0-f42.google.com with SMTP id c200so208068964wme.0 for ; Tue, 23 Feb 2016 00:29:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leon-nu.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6wKKbwjvZOYeekMjnzCcDF1gpKh1uoelTAKLWsejbqM=; b=z9DAp7eV3ruXb4VUchr7JIKZ6cCIJvN7LeX3OKdlnZKfxKyxjbL1DytRn09H7b/F1S piPa6oKoEpilUgzw8vHfiWECGcYO6T1L9zgKuUjqQqQNZ2PQrZN7/tG4nttq65KrK1// O5nHR8D/5blkn1UqvoubO6DkD08CGbldKNTuHGvck9LzbZ9Kkx4NWvc4IcMWh3C8zjMr ACZnpHSz3rzUWXsbyHNqqUFbdpgNjS3UpMdj36+OT9zs7u003zSq5HM2kAjQDlx6raBD vn2cID7FQywllUfjNLGPbT2zb1yhLBAH6hRrilXW1vvJk3w6igb4qrKw6FCUtY4MYXna vwwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6wKKbwjvZOYeekMjnzCcDF1gpKh1uoelTAKLWsejbqM=; b=E2l6xHF8IqEmzlzGHKPqCckNSIy5J5e08ozYFGXVQwrrcqDOiK9jlvGsJ0qbXM8e9o onPMqkkBfjttWRzmAoXPdl/7DMACgvr6p07cWqtjgHOcC77rOM2bv1kOivqbabIwO2Rf rXLbjdyk4rsqk55kBak7eMQKg9zhFQU1es7HpFUApwH5szY3co7CcKscfQvXgr6i0086 JPzA7vKIZmXfjdKFg3pE5Y/KkEdzRhEUK/sgkuQvycbOPiIlnEbj7o2zH1swXNV17Ip3 teoIZjDbFAQJJDdcQsKTh7O26Ll8HGXhWQ8uijEKoxs4z6wBWbCf/RXKqdJof3HzW660 VMww== X-Gm-Message-State: AG10YORGunNDRqBUBHs15jOnNnGvK6xYNe811AjM5gv/N7o0azqQ3sFWmwl3eoRiVIO7+A== X-Received: by 10.194.81.103 with SMTP id z7mr31543449wjx.25.1456216195097; Tue, 23 Feb 2016 00:29:55 -0800 (PST) Received: from localhost ([213.57.247.249]) by smtp.gmail.com with ESMTPSA id lz5sm28418355wjb.5.2016.02.23.00.29.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Feb 2016 00:29:54 -0800 (PST) From: Leon Romanovsky To: dledford@redhat.com, saeedm@mellanox.com Cc: linux-rdma@vger.kernel.org, Leon Romanovsky Subject: [PATCH rdma-next V1 7/8] IB/core: Advertise supported vector CALC capabilities Date: Tue, 23 Feb 2016 10:25:27 +0200 Message-Id: <1456215928-9305-8-git-send-email-leon@leon.nu> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1456215928-9305-1-git-send-email-leon@leon.nu> References: <1456215928-9305-1-git-send-email-leon@leon.nu> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Leon Romanovsky This vector CALC feature allows different offloaded arithmetic calculations of several vectors of equal length. In order to properly use this feature, the user space applications need to know the supported properties, like operations, size and maximal number of vectors. The properties exposed are: * calc_matrix - If set, vector CALC matrix is supported. * max_vector_count - Maximum number of vectors supported. * max_chunk_size - Maximum chunk size supported. * op_cap - Bit mask indicates which vector CALC operations are supported: Bit 1: ADD operation Bit 2: MAX operation Bit 3: AND operation Bit 4: OR operation Bit 5: XOR operation Bit 6: MIN operation Bit 7: SWAP_ENDIANNESS operation This change returns vector CALC supported properties to the caller. Signed-off-by: Leon Romanovsky Reviewed-by: Matan Barak --- 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 {