From patchwork Sun Sep 14 13:47:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eli Cohen X-Patchwork-Id: 4901421 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4A87F9F2EC for ; Sun, 14 Sep 2014 13:44:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 54061201FB for ; Sun, 14 Sep 2014 13:48:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 839D720200 for ; Sun, 14 Sep 2014 13:48:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752519AbaINNsO (ORCPT ); Sun, 14 Sep 2014 09:48:14 -0400 Received: from mail-wi0-f180.google.com ([209.85.212.180]:54215 "EHLO mail-wi0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752513AbaINNsN (ORCPT ); Sun, 14 Sep 2014 09:48:13 -0400 Received: by mail-wi0-f180.google.com with SMTP id ex7so2876132wid.13 for ; Sun, 14 Sep 2014 06:48:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9FfRLbEEbAwQJUmsF1jPVs8MofvobfKt/Qg/RDuNiTE=; b=Za1q5ZHjhM9By9lP/oep0JJumhPbfTW1fF8i+Rl/bVYFmeFCXgNAtKcmk5z6IAp9lP SgfDLg2NTrhvhsFtYlSdgyTpQSrED3vCisbfrUpVSLsIMUbGEkYBJqGKEHpDsLTsG0Ad +qQ7NCv8lZ64k4MFnwn0D/rccu2BSuYWb7lb38nnv2mkXtEprJKMCvH4w26sKoHsV+WB pD89BD96pUw2EcNgmuJ9qoygzYmLVb9chmb1QHanOFTHYVW8MYK743NhZYeG9nLLDE4Z eIVeH674rGR19b0FA+3XncFYPmMDqgAKNp1Suv3dssEwF/uTxFw/X8Ffl+/63JbHfXn1 Ks8g== X-Gm-Message-State: ALoCoQlNoNlGcOSco2ElQvU0+2AZpbenBd+Nw48c+rvmRIocc6y6alLNV9ix7GsAd/mhpxFP+Mox X-Received: by 10.194.23.8 with SMTP id i8mr2784816wjf.104.1410702491164; Sun, 14 Sep 2014 06:48:11 -0700 (PDT) Received: from localhost (out.voltaire.com. [193.47.165.251]) by mx.google.com with ESMTPSA id pn5sm11265255wjc.4.2014.09.14.06.48.10 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 14 Sep 2014 06:48:10 -0700 (PDT) From: Eli Cohen X-Google-Original-From: Eli Cohen To: roland@kernel.org, dledford@redhat.com Cc: linux-rdma@vger.kernel.org, ogerlitz@mellanox.com, amirv@mellanox.com, Eli Cohen Subject: [PATCH for-next 5/6] IB/mlx5: Remove duplicate code from mlx5_set_path Date: Sun, 14 Sep 2014 16:47:54 +0300 Message-Id: <1410702475-28826-6-git-send-email-eli@mellanox.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1410702475-28826-1-git-send-email-eli@mellanox.com> References: <1410702475-28826-1-git-send-email-eli@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.5 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 Some of the fields where set twice. Re-organize to avoid that. Signed-off-by: Eli Cohen --- drivers/infiniband/hw/mlx5/qp.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c index 8c574b63d77b..34b92fc345b7 100644 --- a/drivers/infiniband/hw/mlx5/qp.c +++ b/drivers/infiniband/hw/mlx5/qp.c @@ -1302,6 +1302,11 @@ static int mlx5_set_path(struct mlx5_ib_dev *dev, const struct ib_ah_attr *ah, path->rlid = cpu_to_be16(ah->dlid); if (ah->ah_flags & IB_AH_GRH) { + if (ah->grh.sgid_index >= dev->mdev->caps.port[port - 1].gid_table_len) { + pr_err(KERN_ERR "sgid_index (%u) too large. max is %d\n", + ah->grh.sgid_index, dev->mdev->caps.port[port - 1].gid_table_len); + return -EINVAL; + } path->grh_mlid |= 1 << 7; path->mgid_index = ah->grh.sgid_index; path->hop_limit = ah->grh.hop_limit; @@ -1317,22 +1322,6 @@ static int mlx5_set_path(struct mlx5_ib_dev *dev, const struct ib_ah_attr *ah, path->static_rate = err; path->port = port; - if (ah->ah_flags & IB_AH_GRH) { - if (ah->grh.sgid_index >= dev->mdev->caps.port[port - 1].gid_table_len) { - pr_err(KERN_ERR "sgid_index (%u) too large. max is %d\n", - ah->grh.sgid_index, dev->mdev->caps.port[port - 1].gid_table_len); - return -EINVAL; - } - - path->grh_mlid |= 1 << 7; - path->mgid_index = ah->grh.sgid_index; - path->hop_limit = ah->grh.hop_limit; - path->tclass_flowlabel = - cpu_to_be32((ah->grh.traffic_class << 20) | - (ah->grh.flow_label)); - memcpy(path->rgid, ah->grh.dgid.raw, 16); - } - if (attr_mask & IB_QP_TIMEOUT) path->ackto_lt = attr->timeout << 3;