From patchwork Mon Mar 14 11:47:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Noa Osherovich X-Patchwork-Id: 8578691 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 A242F9F54C for ; Mon, 14 Mar 2016 11:48:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AC27520263 for ; Mon, 14 Mar 2016 11:48:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E306920377 for ; Mon, 14 Mar 2016 11:48:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752392AbcCNLsU (ORCPT ); Mon, 14 Mar 2016 07:48:20 -0400 Received: from [193.47.165.129] ([193.47.165.129]:45283 "EHLO mellanox.co.il" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752459AbcCNLsS (ORCPT ); Mon, 14 Mar 2016 07:48:18 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from noaos@mellanox.com) with ESMTPS (AES256-SHA encrypted); 14 Mar 2016 13:47:49 +0200 Received: from vnc20.mtl.labs.mlnx (vnc20.mtl.labs.mlnx [10.7.2.20]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id u2EBlnot025464; Mon, 14 Mar 2016 13:47:49 +0200 Received: from vnc20.mtl.labs.mlnx (localhost.localdomain [127.0.0.1]) by vnc20.mtl.labs.mlnx (8.13.8/8.13.8) with ESMTP id u2EBlnTt002679; Mon, 14 Mar 2016 13:47:49 +0200 Received: (from noaos@localhost) by vnc20.mtl.labs.mlnx (8.13.8/8.13.8/Submit) id u2EBlnMY002678; Mon, 14 Mar 2016 13:47:49 +0200 From: Noa Osherovich To: yishaih@mellanox.com Cc: noaos@mellanox.com, linux-rdma@vger.kernel.org Subject: [PATCH libmlx4 1/2] Handling 0-length sge correctly Date: Mon, 14 Mar 2016 13:47:34 +0200 Message-Id: <1457956055-2593-2-git-send-email-noaos@mellanox.com> X-Mailer: git-send-email 1.7.11.1 In-Reply-To: <1457956055-2593-1-git-send-email-noaos@mellanox.com> References: <1457956055-2593-1-git-send-email-noaos@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.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 When the driver sees a 0-length sge, it should transform that into a 0-length inline segment entry. The HW will then will not add any data to the outgoing package when it encounters that inline entry. Reviewed-by: Jack Morgenstein Signed-off-by: Noa Osherovich Signed-off-by: Yishai Hadas --- src/mlx4.h | 8 ++++++++ src/qp.c | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/mlx4.h b/src/mlx4.h index 519d8f4..f8d2051 100644 --- a/src/mlx4.h +++ b/src/mlx4.h @@ -92,6 +92,14 @@ enum { MLX4_STAT_RATE_OFFSET = 5 }; +#ifndef likely +#ifdef __GNUC__ +#define likely(x) __builtin_expect(!!(x),1) +#else +#define likely(x) (x) +#endif +#endif + enum { MLX4_QP_TABLE_BITS = 8, MLX4_QP_TABLE_SIZE = 1 << MLX4_QP_TABLE_BITS, diff --git a/src/qp.c b/src/qp.c index bc2d2e1..05874d2 100644 --- a/src/qp.c +++ b/src/qp.c @@ -170,7 +170,10 @@ static void set_data_seg(struct mlx4_wqe_data_seg *dseg, struct ibv_sge *sg) */ wmb(); - dseg->byte_count = htonl(sg->length); + if (likely(sg->length)) + dseg->byte_count = htonl(sg->length); + else + dseg->byte_count = htonl(0x80000000); } int mlx4_post_send(struct ibv_qp *ibqp, struct ibv_send_wr *wr,