From patchwork Fri Dec 9 17:54:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nikolova, Tatyana E" X-Patchwork-Id: 9468807 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DB93A60586 for ; Fri, 9 Dec 2016 17:55:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D2405285A1 for ; Fri, 9 Dec 2016 17:55:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C6E4028682; Fri, 9 Dec 2016 17:55:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 502FE285A1 for ; Fri, 9 Dec 2016 17:55:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752524AbcLIRzf (ORCPT ); Fri, 9 Dec 2016 12:55:35 -0500 Received: from mga02.intel.com ([134.134.136.20]:36583 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752513AbcLIRzf (ORCPT ); Fri, 9 Dec 2016 12:55:35 -0500 Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP; 09 Dec 2016 09:55:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,324,1477983600"; d="scan'208";a="40919131" Received: from tenikolo-mobl2.amr.corp.intel.com ([10.122.41.238]) by fmsmga006.fm.intel.com with ESMTP; 09 Dec 2016 09:55:33 -0800 From: Tatyana Nikolova To: jgunthorpe@obsidianresearch.com, dledford@redhat.com, leonro@mellanox.com Cc: linux-rdma@vger.kernel.org, e1000-rdma@lists.sourceforge.net Subject: [PATCH V2 01/10] i40iw: Optimize setting fragments Date: Fri, 9 Dec 2016 11:54:55 -0600 Message-Id: <1481306104-19352-2-git-send-email-tatyana.e.nikolova@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1481306104-19352-1-git-send-email-tatyana.e.nikolova@intel.com> References: <1481306104-19352-1-git-send-email-tatyana.e.nikolova@intel.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Mustafa Ismail Small optimizations replace subtract and multiply with add. Signed-off-by: Mustafa Ismail Signed-off-by: Tatyana Nikolova --- providers/i40iw/i40iw_uk.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/providers/i40iw/i40iw_uk.c b/providers/i40iw/i40iw_uk.c index aff3de6..4d353b5 100644 --- a/providers/i40iw/i40iw_uk.c +++ b/providers/i40iw/i40iw_uk.c @@ -291,9 +291,9 @@ static enum i40iw_status_code i40iw_rdma_write(struct i40iw_qp_uk *qp, i40iw_set_fragment(wqe, I40IW_BYTE_0, op_info->lo_sg_list); - for (i = 1; i < op_info->num_lo_sges; i++) { - byte_off = I40IW_BYTE_32 + (i - 1) * 16; + for (i = 1, byte_off = I40IW_BYTE_32; i < op_info->num_lo_sges; i++) { i40iw_set_fragment(wqe, byte_off, &op_info->lo_sg_list[i]); + byte_off += 16; } i40iw_wmb(); /* make sure WQE is populated before valid bit is set */ @@ -404,9 +404,9 @@ static enum i40iw_status_code i40iw_send(struct i40iw_qp_uk *qp, i40iw_set_fragment(wqe, I40IW_BYTE_0, op_info->sg_list); - for (i = 1; i < op_info->num_sges; i++) { - byte_off = I40IW_BYTE_32 + (i - 1) * 16; + for (i = 1, byte_off = I40IW_BYTE_32; i < op_info->num_sges; i++) { i40iw_set_fragment(wqe, byte_off, &op_info->sg_list[i]); + byte_off += 16; } i40iw_wmb(); /* make sure WQE is populated before valid bit is set */ @@ -692,9 +692,9 @@ static enum i40iw_status_code i40iw_post_receive(struct i40iw_qp_uk *qp, i40iw_set_fragment(wqe, I40IW_BYTE_0, info->sg_list); - for (i = 1; i < info->num_sges; i++) { - byte_off = I40IW_BYTE_32 + (i - 1) * 16; + for (i = 1, byte_off = I40IW_BYTE_32; i < info->num_sges; i++) { i40iw_set_fragment(wqe, byte_off, &info->sg_list[i]); + byte_off += 16; } i40iw_wmb(); /* make sure WQE is populated before valid bit is set */