From patchwork Mon Apr 18 16:25:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Majd Dibbiny X-Patchwork-Id: 8873861 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 840DABF29F for ; Mon, 18 Apr 2016 16:26:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A75A8201DD for ; Mon, 18 Apr 2016 16:26:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BB0F4201C8 for ; Mon, 18 Apr 2016 16:26:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751808AbcDRQ0G (ORCPT ); Mon, 18 Apr 2016 12:26:06 -0400 Received: from [193.47.165.129] ([193.47.165.129]:53209 "EHLO mellanox.co.il" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751741AbcDRQ0F (ORCPT ); Mon, 18 Apr 2016 12:26:05 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from majd@mellanox.com) with ESMTPS (AES256-SHA encrypted); 18 Apr 2016 19:25:23 +0300 Received: from dev-l-vrt-202-005.mtl.labs.mlnx (dev-l-vrt-202-005.mtl.labs.mlnx [10.134.202.5]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id u3IGPNAl001365; Mon, 18 Apr 2016 19:25:23 +0300 From: Majd Dibbiny To: dledford@redhat.com Cc: linux-rdma@vger.kernel.org, leonro@mellanox.com, Bodong Wang , Majd Dibbiny , Matan Barak Subject: [PATCH for-next 1/2] IB/core: Report LSO capabilities when querying device Date: Mon, 18 Apr 2016 19:25:16 +0300 Message-Id: <1460996717-18778-2-git-send-email-majd@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1460996717-18778-1-git-send-email-majd@mellanox.com> References: <1460996717-18778-1-git-send-email-majd@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 byte, and what QP types the hardware supports. Relevant verbs to report LSO caps from kernel to user space is 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 {