From patchwork Wed Aug 5 15:34:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Vadai X-Patchwork-Id: 6951221 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 C16CF9F373 for ; Wed, 5 Aug 2015 15:35:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E0D7520412 for ; Wed, 5 Aug 2015 15:35:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E4C812041F for ; Wed, 5 Aug 2015 15:35:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753171AbbHEPff (ORCPT ); Wed, 5 Aug 2015 11:35:35 -0400 Received: from [193.47.165.129] ([193.47.165.129]:60314 "EHLO mellanox.co.il" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752619AbbHEPfc (ORCPT ); Wed, 5 Aug 2015 11:35:32 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from amirv@mellanox.com) with ESMTPS (AES256-SHA encrypted); 5 Aug 2015 18:35:09 +0300 Received: from swl095.mtl.labs.mlnx (swl095.mtl.labs.mlnx [10.7.17.95]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id t75FZ9dJ032619; Wed, 5 Aug 2015 18:35:09 +0300 From: Amir Vadai To: Doug Ledford Cc: linux-rdma@vger.kernel.org, Yevgeny Petrilin , Or Gerlitz , Tal Alon , Moshe Lazer , Bodong Wang , Eric Dube , Amir Vadai Subject: [PATCH for-next 1/2] IB/core: Add support for RX/TX checksum offload capabilities report Date: Wed, 5 Aug 2015 18:34:26 +0300 Message-Id: <1438788867-18332-2-git-send-email-amirv@mellanox.com> X-Mailer: git-send-email 2.4.3.413.ga5fe668 In-Reply-To: <1438788867-18332-1-git-send-email-amirv@mellanox.com> References: <1438788867-18332-1-git-send-email-amirv@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.0 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 - TX/RX checksum offload capabilities are now reporting through a new member "csum_cap" inside ib_device_attr. - The capabilities cover IP_HDR and TCP_UDP. Signed-off-by: Bodong Wang Signed-off-by: Amir Vadai --- drivers/infiniband/core/uverbs_cmd.c | 6 ++++++ include/rdma/ib_verbs.h | 8 ++++++++ include/uapi/rdma/ib_user_verbs.h | 2 ++ 3 files changed, 16 insertions(+) diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c index bbb02ff..c3d7c54 100644 --- a/drivers/infiniband/core/uverbs_cmd.c +++ b/drivers/infiniband/core/uverbs_cmd.c @@ -3435,6 +3435,12 @@ int ib_uverbs_ex_query_device(struct ib_uverbs_file *file, copy_query_dev_fields(file, &resp.base, &attr); resp.comp_mask = 0; + if (ucore->outlen < resp.response_length + sizeof(resp.csum_caps)) + goto end; + + resp.csum_caps = attr.csum_caps; + resp.response_length += sizeof(resp.csum_caps); + if (ucore->outlen < resp.response_length + sizeof(resp.odp_caps)) goto end; diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 0940051..582483e 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -190,6 +190,13 @@ struct ib_cq_init_attr { u32 flags; }; +enum ib_csum_cap_flags { + IB_CSUM_RX_TCP_UDP = 1 << 0, + IB_CSUM_RX_IP_HDR = 1 << 1, + IB_CSUM_TX_TCP_UDP = 1 << 2, + IB_CSUM_TX_IP_HDR = 1 << 3 +}; + struct ib_device_attr { u64 fw_ver; __be64 sys_image_guid; @@ -236,6 +243,7 @@ struct ib_device_attr { struct ib_odp_caps odp_caps; uint64_t timestamp_mask; uint64_t hca_core_clock; /* in KHZ */ + u32 csum_caps; }; enum ib_mtu { diff --git a/include/uapi/rdma/ib_user_verbs.h b/include/uapi/rdma/ib_user_verbs.h index 978841e..5eb7de1 100644 --- a/include/uapi/rdma/ib_user_verbs.h +++ b/include/uapi/rdma/ib_user_verbs.h @@ -205,6 +205,7 @@ struct ib_uverbs_query_device_resp { struct ib_uverbs_ex_query_device { __u32 comp_mask; + __u32 csum_caps; __u32 reserved; }; @@ -221,6 +222,7 @@ struct ib_uverbs_odp_caps { struct ib_uverbs_ex_query_device_resp { struct ib_uverbs_query_device_resp base; __u32 comp_mask; + __u32 csum_caps; __u32 response_length; struct ib_uverbs_odp_caps odp_caps; __u64 timestamp_mask;