From patchwork Wed Apr 27 14:04:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matan Barak X-Patchwork-Id: 8957961 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C7DD8BF29F for ; Wed, 27 Apr 2016 14:05:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E3D702022D for ; Wed, 27 Apr 2016 14:05:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 80DDC20253 for ; Wed, 27 Apr 2016 14:05:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752510AbcD0OFk (ORCPT ); Wed, 27 Apr 2016 10:05:40 -0400 Received: from [193.47.165.129] ([193.47.165.129]:37897 "EHLO mellanox.co.il" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752205AbcD0OFj (ORCPT ); Wed, 27 Apr 2016 10:05:39 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from matanb@mellanox.com) with ESMTPS (AES256-SHA encrypted); 27 Apr 2016 17:04:56 +0300 Received: from rsws33.mtr.labs.mlnx (dev-r-vrt-064.mtr.labs.mlnx [10.212.64.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id u3RE4u0n012242; Wed, 27 Apr 2016 17:04:56 +0300 From: Matan Barak To: Doug Ledford Cc: linux-rdma@vger.kernel.org, Majd Dibbiny , Matan Barak , Christoph Lameter , Bodong Wang Subject: [PATCH V1 for-next 1/2] IB/core: Report LSO capabilities when querying device Date: Wed, 27 Apr 2016 17:04:51 +0300 Message-Id: <1461765892-1285-2-git-send-email-matanb@mellanox.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1461765892-1285-1-git-send-email-matanb@mellanox.com> References: <1461765892-1285-1-git-send-email-matanb@mellanox.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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: Bodong Wang LSO capabilities include the max LSO packet size in bytes and which QP types does the hardware support. Relevant verbs to report LSO capabilities from kernel to user space are updated accordingly. Signed-off-by: Bodong Wang Signed-off-by: Majd Dibbiny Signed-off-by: Matan Barak --- drivers/infiniband/core/uverbs_cmd.c | 7 +++++++ include/rdma/ib_verbs.h | 6 ++++++ include/uapi/rdma/ib_user_verbs.h | 6 ++++++ 3 files changed, 19 insertions(+) diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c index 6fdc7ec..b0fb94b 100644 --- a/drivers/infiniband/core/uverbs_cmd.c +++ b/drivers/infiniband/core/uverbs_cmd.c @@ -3655,6 +3655,13 @@ 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); + if (ucore->outlen < resp.response_length + sizeof(resp.lso_caps)) + goto end; + + resp.lso_caps.max_lso = attr.lso_caps.max_lso; + resp.lso_caps.supported_qpts = attr.lso_caps.supported_qpts; + resp.response_length += sizeof(resp.lso_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 fb2cef4..d5a466f 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -271,6 +271,11 @@ struct ib_cq_init_attr { u32 flags; }; +struct ib_lso_caps { + u32 max_lso; + u32 supported_qpts; /* Use enum ib_qp_type */ +}; + struct ib_device_attr { u64 fw_ver; __be64 sys_image_guid; @@ -317,6 +322,7 @@ struct ib_device_attr { struct ib_odp_caps odp_caps; uint64_t timestamp_mask; uint64_t hca_core_clock; /* in KHZ */ + struct ib_lso_caps lso_caps; }; enum ib_mtu { diff --git a/include/uapi/rdma/ib_user_verbs.h b/include/uapi/rdma/ib_user_verbs.h index 8126c14..fa039f5 100644 --- a/include/uapi/rdma/ib_user_verbs.h +++ b/include/uapi/rdma/ib_user_verbs.h @@ -219,6 +219,11 @@ struct ib_uverbs_odp_caps { __u32 reserved; }; +struct ib_uverbs_lso_caps { + __u32 max_lso; + __u32 supported_qpts; /* Use enum ib_qp_type */ +}; + struct ib_uverbs_ex_query_device_resp { struct ib_uverbs_query_device_resp base; __u32 comp_mask; @@ -226,6 +231,7 @@ struct ib_uverbs_ex_query_device_resp { struct ib_uverbs_odp_caps odp_caps; __u64 timestamp_mask; __u64 hca_core_clock; /* in KHZ */ + struct ib_uverbs_lso_caps lso_caps; }; struct ib_uverbs_query_port {