From patchwork Tue Sep 22 20:20:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bodong Wang X-Patchwork-Id: 7245391 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 355319F6CD for ; Tue, 22 Sep 2015 20:20:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1A22B20A29 for ; Tue, 22 Sep 2015 20:20:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 12F6920A30 for ; Tue, 22 Sep 2015 20:20:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759594AbbIVUUh (ORCPT ); Tue, 22 Sep 2015 16:20:37 -0400 Received: from mail-ob0-f174.google.com ([209.85.214.174]:33491 "EHLO mail-ob0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759591AbbIVUUd (ORCPT ); Tue, 22 Sep 2015 16:20:33 -0400 Received: by obbbh8 with SMTP id bh8so17445468obb.0 for ; Tue, 22 Sep 2015 13:20:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cGqdjGIztJia8x5GaNhK4JbkFgt1RvmQNtbD4Q413MI=; b=a4mmI2z9jSg7wpJ03rrB3jgPkfafKcVV0OuDNbulmRIcHomqVUdkb37+pO9A4Dfwhr /1oQ/ZaxQBX4WKSzQZnDozgt7diG+6YLKpW49y3oGtHYJn/YpiGpaFMJv53FsnJXA0Gb 6N/r7qoPN9RIMw+S6ukwE4Fvo8qdCmHv2vgk20mP92/46CZK9Q/Wbq7YejlhUjKhINFs nMewI+XxFnhudbbENvbssxbtLu7JAyZLIuQDIICt75F5re2gzSN5D4GXXyUFtiLJ8i/i yhj5pOV7QZuCIG7GmryI3T6kmWv3MnjN0FKerPYLOKY1MF97mcP6QlX9KcWUB8Ur/olM qPvw== X-Received: by 10.182.115.230 with SMTP id jr6mr17469022obb.72.1442953232590; Tue, 22 Sep 2015 13:20:32 -0700 (PDT) Received: from localhost.localdomain ([207.140.101.5]) by smtp.gmail.com with ESMTPSA id lh4sm1647574obc.3.2015.09.22.13.20.31 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Sep 2015 13:20:32 -0700 (PDT) From: wbd2905@gmail.com X-Google-Original-From: bodong@mellanox.com To: dledford@redhat.com Cc: ogerlitz@mellanox.com, bodong@mellanox.com, moshel@mellanox.com, haggaie@mellanox.com, matanb@mellanox.com, linux-rdma@vger.kernel.org Subject: [v1] libibverbs: Report checksum offload capabilities Date: Tue, 22 Sep 2015 23:20:21 +0300 Message-Id: <1442953221-104830-2-git-send-email-bodong@mellanox.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1442953221-104830-1-git-send-email-bodong@mellanox.com> References: <1442953221-104830-1-git-send-email-bodong@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=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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: Bodong Wang Add IBV_DEVICE_UD_IP_CSUM, IBV_DEVICE_RAW_IP_CSUM and IBV_DEVICE_RC_IP_CSUM to device capability enum field. These enum will denote IPv4 checksum offload support for UD, RAW and RC QPs. Flags IBV_SEND_IP_CSUM and IBV_WC_IP_CSUM_OK are added for utilizing this capability for send and receive separately. Signed-off-by: Bodong Wang --- include/infiniband/verbs.h | 14 ++++++++++++-- man/ibv_poll_cq.3 | 5 +++++ man/ibv_post_send.3 | 4 ++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/include/infiniband/verbs.h b/include/infiniband/verbs.h index 1ff5265..ae22768 100644 --- a/include/infiniband/verbs.h +++ b/include/infiniband/verbs.h @@ -116,7 +116,10 @@ enum ibv_device_cap_flags { IBV_DEVICE_RC_RNR_NAK_GEN = 1 << 12, IBV_DEVICE_SRQ_RESIZE = 1 << 13, IBV_DEVICE_N_NOTIFY_CQ = 1 << 14, + IBV_DEVICE_UD_IP_CSUM = 1 << 18, IBV_DEVICE_XRC = 1 << 20, + IBV_DEVICE_RC_IP_CSUM = 1 << 25, + IBV_DEVICE_RAW_IP_CSUM = 1 << 26, IBV_DEVICE_MANAGED_FLOW_STEERING = 1 << 29 }; @@ -348,9 +351,14 @@ enum ibv_wc_opcode { IBV_WC_RECV_RDMA_WITH_IMM }; +enum { + IBV_WC_IP_CSUM_OK_SHIFT = 2 +}; + enum ibv_wc_flags { IBV_WC_GRH = 1 << 0, - IBV_WC_WITH_IMM = 1 << 1 + IBV_WC_WITH_IMM = 1 << 1, + IBV_WC_IP_CSUM_OK = 1 << IBV_WC_IP_CSUM_OK_SHIFT }; struct ibv_wc { @@ -688,7 +696,8 @@ enum ibv_send_flags { IBV_SEND_FENCE = 1 << 0, IBV_SEND_SIGNALED = 1 << 1, IBV_SEND_SOLICITED = 1 << 2, - IBV_SEND_INLINE = 1 << 3 + IBV_SEND_INLINE = 1 << 3, + IBV_SEND_IP_CSUM = 1 << 4 }; struct ibv_sge { @@ -1459,6 +1468,7 @@ ibv_query_device_ex(struct ibv_context *context, legacy: memset(attr, 0, sizeof(*attr)); ret = ibv_query_device(context, &attr->orig_attr); + return ret; } diff --git a/man/ibv_poll_cq.3 b/man/ibv_poll_cq.3 index 57c6daa..bbf48ff 100644 --- a/man/ibv_poll_cq.3 +++ b/man/ibv_poll_cq.3 @@ -50,6 +50,11 @@ It is either 0 or the bitwise OR of one or more of the following flags: .B IBV_WC_GRH \fR GRH is present (valid only for UD QPs) .TP .B IBV_WC_WITH_IMM \fR Immediate data value is valid +.TP +.B IBV_WC_IP_CSUM_OK \fR TCP/UDP checksum over IPv4 and IPv4 header checksum are +verified. +Valid only when \fBdevice_cap_flags\fR in device_attr indicates current QP is +supported by checksum offload. .PP Not all .I wc diff --git a/man/ibv_post_send.3 b/man/ibv_post_send.3 index 33fbb50..eeea078 100644 --- a/man/ibv_post_send.3 +++ b/man/ibv_post_send.3 @@ -98,6 +98,10 @@ The attribute send_flags describes the properties of the \s-1WR\s0. It is either .TP .B IBV_SEND_INLINE \fR Send data in given gather list as inline data in a send WQE. Valid only for Send and RDMA Write. The L_Key will not be checked. +.TP +.B IBV_SEND_IP_CSUM \fR Offload the IPv4 and TCP/UDP checksum calculation. +Valid only when \fBdevice_cap_flags\fR in device_attr indicates current QP is +supported by checksum offload. .SH "RETURN VALUE" .B ibv_post_send() returns 0 on success, or the value of errno on failure (which indicates the failure reason).