Received: by 10.192.165.156 with SMTP id m28csp69855imm; Tue, 10 Apr 2018 16:37:46 -0700 (PDT) X-Google-Smtp-Source: AIpwx48cKBsdDjSDFAgChLEGWi+qpG/Gwo1aR/i9Swa4RfEv263m/OGzPaYElRpPKSde+Tt63fws X-Received: by 2002:a17:902:9a44:: with SMTP id x4-v6mr2514069plv.312.1523403466610; Tue, 10 Apr 2018 16:37:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523403466; cv=none; d=google.com; s=arc-20160816; b=Xsq7b1HIdWPDkmot0Y86QwQA+Uu6gWrcTy//jybk5lphopr8NPzRUv48tmuaQf+YSF iS1xFxfphwKbJkff+70doCMU5OZkBc4hHGv5hPy3FOV9pxzWQbJ0W6i90d6B3e/mH4tt m5QNwf0A9hNBy8G2VFs+m/6CnIQdg2DVQ98bki9XSTiAb2371vdoTRI8LD+GtC7oUHPx sbSK7lDVWbyYAIXnJxX8KT+Tb9FM1lN7sYAoICnwTVbsXrn1/kVY7Hpg663VzvP8K36W dIZ3C+rWAlNGphLnvm8Pg2qHeRuASPasWafqoujnAADJpVWF3uF+r/LQut/pqrrnoL0u 8qfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=SCCEChsNrRSBiLYczgKdoUMY6cUdf1Y77rVnFREiXvw=; b=yQT/OqGaHfkPiylYtnMZ/H+v+LDIfbaZK4JNWcBJjNjjQDck3yts//i7PgHMSjs8QF zA4M4ZYxrDIU7IJzRRBT6zWJv/xYLGA9FiifEy48YOu80MczPQh+mkFf6Hnj6rO+CpAt mheIz/yasSDAFgboq0Xr9fc6C7qB7MAhmDxDZ5qI8QkkDXEQF5qW/THwNsfI+BsIJ0uH oHqPRI4HOMGbTeVLRGIqfFWc3d2IYGjG03wRedQuo0Pjn2VZNu/tVyKiYbYO7Uk8sKZj tIOklmSrkkGrWXtzK5Xc9/kLrcxV0rkPiwgX08mMYinvwDlA0B6de4vBZUQlcVPTj8Ye Vhlw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w9si2876792pfl.268.2018.04.10.16.37.10; Tue, 10 Apr 2018 16:37:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754300AbeDJXcn (ORCPT + 99 others); Tue, 10 Apr 2018 19:32:43 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:39104 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752605AbeDJW2Z (ORCPT ); Tue, 10 Apr 2018 18:28:25 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id C29AFD29; Tue, 10 Apr 2018 22:28:24 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lijun Ou , Yixian Liu , "Wei Hu (Xavier)" , Leon Romanovsky , Jason Gunthorpe , Sasha Levin Subject: [PATCH 4.15 039/168] RDMA/hns: Update the usage of sr_max and rr_max field Date: Wed, 11 Apr 2018 00:23:01 +0200 Message-Id: <20180410212801.854640922@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212800.144079021@linuxfoundation.org> References: <20180410212800.144079021@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: oulijun [ Upstream commit 4f3f7a704b3bff9e4eb322ab3c989b505f7562eb ] This patch fixes the usage with sr_max filed and rr_max of qp context when modify qp. Its modifications include: 1. Adjust location of filling sr_max filed of qpc 2. Only assign the number of responder resource if IB_QP_MAX_DEST_RD_ATOMIC bit is set 3. Only assign the number of outstanding resource if IB_QP_MAX_QP_RD_ATOMIC 4. Fix the assgin algorithms for the field of sr_max and rr_max of qp context Signed-off-by: Lijun Ou Signed-off-by: Yixian Liu Signed-off-by: Wei Hu (Xavier) Reviewed-by: Leon Romanovsky Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c @@ -2463,11 +2463,14 @@ static int modify_qp_init_to_rtr(struct roce_set_bit(qpc_mask->byte_28_at_fl, V2_QPC_BYTE_28_LBI_S, 0); } - roce_set_field(context->byte_140_raq, V2_QPC_BYTE_140_RR_MAX_M, - V2_QPC_BYTE_140_RR_MAX_S, - ilog2((unsigned int)attr->max_dest_rd_atomic)); - roce_set_field(qpc_mask->byte_140_raq, V2_QPC_BYTE_140_RR_MAX_M, - V2_QPC_BYTE_140_RR_MAX_S, 0); + if ((attr_mask & IB_QP_MAX_DEST_RD_ATOMIC) && + attr->max_dest_rd_atomic) { + roce_set_field(context->byte_140_raq, V2_QPC_BYTE_140_RR_MAX_M, + V2_QPC_BYTE_140_RR_MAX_S, + fls(attr->max_dest_rd_atomic - 1)); + roce_set_field(qpc_mask->byte_140_raq, V2_QPC_BYTE_140_RR_MAX_M, + V2_QPC_BYTE_140_RR_MAX_S, 0); + } roce_set_field(context->byte_56_dqpn_err, V2_QPC_BYTE_56_DQPN_M, V2_QPC_BYTE_56_DQPN_S, attr->dest_qp_num); @@ -2557,12 +2560,6 @@ static int modify_qp_init_to_rtr(struct V2_QPC_BYTE_168_LP_SGEN_INI_M, V2_QPC_BYTE_168_LP_SGEN_INI_S, 0); - roce_set_field(context->byte_208_irrl, V2_QPC_BYTE_208_SR_MAX_M, - V2_QPC_BYTE_208_SR_MAX_S, - ilog2((unsigned int)attr->max_rd_atomic)); - roce_set_field(qpc_mask->byte_208_irrl, V2_QPC_BYTE_208_SR_MAX_M, - V2_QPC_BYTE_208_SR_MAX_S, 0); - roce_set_field(context->byte_28_at_fl, V2_QPC_BYTE_28_SL_M, V2_QPC_BYTE_28_SL_S, rdma_ah_get_sl(&attr->ah_attr)); roce_set_field(qpc_mask->byte_28_at_fl, V2_QPC_BYTE_28_SL_M, @@ -2766,6 +2763,14 @@ static int modify_qp_rtr_to_rts(struct i roce_set_field(qpc_mask->byte_196_sq_psn, V2_QPC_BYTE_196_SQ_MAX_PSN_M, V2_QPC_BYTE_196_SQ_MAX_PSN_S, 0); + if ((attr_mask & IB_QP_MAX_QP_RD_ATOMIC) && attr->max_rd_atomic) { + roce_set_field(context->byte_208_irrl, V2_QPC_BYTE_208_SR_MAX_M, + V2_QPC_BYTE_208_SR_MAX_S, + fls(attr->max_rd_atomic - 1)); + roce_set_field(qpc_mask->byte_208_irrl, + V2_QPC_BYTE_208_SR_MAX_M, + V2_QPC_BYTE_208_SR_MAX_S, 0); + } return 0; }