From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796384812; b=IN16PXdsv7VmjEO2PDFiXYnm6JfCe7qPcdnSFxXtZd/4vIXMHlAKCSxcS+7JHjF052sC E9GQSACBTKgXX8s2xZeaVN3IyNte05ywNIE++YvR04bbhrFIUUI8OUtPrs8t12OyG7zPV s1/Rjxibs/4LOTayFCGS12IgyQoCscfVGkICPk6hLccfngo4ywkCDlSQRr84Nm7B4OKlt E/INDbgYPQveA6p8IXOe6bOmiTFk5H3LuSGNrmd5pm9wJdosjDxQrZ2x0ggzUASZK9bKR +M7nknNmgp5Pk13umjblB/TFIOH/5p/wMFrrK1hDqb3XGe0DnwCttOWN8wGGsxbRQRg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384812; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=BxPuxRMQnSWZ8+VKO4AUg/artXjcoOPg8zU5mgPjrjI=; b=cdaWWQ7qvXC9ckNWz94ymEwJ0zIQC1x5xeyesf4rB2Czv+J3p9frcji8alV4gaTSr2/H xMegEgpBRkVtdcsM0I+fL5lJTVrt+F3FmhQsEUz4x+6xNE8bCx7pqtV2yFKfMhLXoymr1 F6xEB6ubJU12SG22dl43D+twTENqCxKQKwQwfjMccqOGNikejNszCTX97jHlREeOsZZxn /ZMRBrvfQPwiIXIuAUEtbyr6vDFLaw9HFG1gFh3zQHrhJJmPtipu7h1hyyVuBfmcaI7r9 ggh/QVI9gYQ5ajpJqV8Iw1IqABEEkGYqzIkXPVJ4+ANCNwomPUgXWaCCGLvWBBWHXyg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=J0JqWatx; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 61106606A322; Fri, 4 Dec 2026 11:46:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=J0JqWatx Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7B781F00931; Fri, 4 Dec 2026 11:46:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384812; bh=BxPuxRMQnSWZ8+VKO4AUg/artXjcoOPg8zU5mgPjrjI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=J0JqWatxSCfuEOr9toplISNWB4PKmYgzS7OKkLqZBv3MAsfVzjDn1ikTOBjX4ntjs GCGgGJjYBPPUWV32Ou0vSwYKxV5bEmjkhlGHMqgz3tSGKnhGsFw9203QXgkfg721dl p4V9RWOt5UBkNuBx1tDnM2GMMhbw5DnEqtXmFrD4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Chengchang Tang , Junxian Huang , Leon Romanovsky , Sasha Levin Subject: [PATCH 6.6 0304/1167] RDMA/hns: Fix missing CQE when UD QP use different SL Date: Fri, 4 Dec 2026 18:55:31 +0900 Message-ID: <20261204100709.943673234@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Chengchang Tang [ Upstream commit 3547f46c31993d41748f0f7936f9d4dc5b5d4b12 ] Due to the hardware contraint, CQEs may be dropped when a UD QP sends with multiple SLs. Pin the SL to the value from the first post_send on the QP to avoid this issue. Fixes: 66d86e529dd5 ("RDMA/hns: Add UD support for HIP09") Signed-off-by: Chengchang Tang Signed-off-by: Junxian Huang Link: https://patch.msgid.link/20260831020324.3540901-2-huangjunxian6@hisilicon.com Signed-off-by: Leon Romanovsky [ sashal: Re-anchored the hunks to the older tree's context (different struct tail and the SL range check in fill_ud_av()); the added code is identical to upstream. ] Signed-off-by: Sasha Levin --- drivers/infiniband/hw/hns/hns_roce_device.h | 1 + drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/infiniband/hw/hns/hns_roce_device.h b/drivers/infiniband/hw/hns/hns_roce_device.h index 03b6546f63cdc..ce2c48f70ab09 100644 --- a/drivers/infiniband/hw/hns/hns_roce_device.h +++ b/drivers/infiniband/hw/hns/hns_roce_device.h @@ -638,6 +638,7 @@ struct hns_roce_qp { struct hns_user_mmap_entry *dwqe_mmap_entry; u32 config; enum hns_roce_cong_type cong_type; + bool ud_sl_set; }; struct hns_roce_ib_iboe { diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c index 2b8afc6fbe87a..e9a92a535f2b3 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c @@ -424,7 +424,8 @@ static int set_ud_opcode(struct hns_roce_v2_ud_send_wqe *ud_sq_wqe, return 0; } -static int fill_ud_av(struct hns_roce_v2_ud_send_wqe *ud_sq_wqe, +static int fill_ud_av(struct hns_roce_qp *qp, + struct hns_roce_v2_ud_send_wqe *ud_sq_wqe, struct hns_roce_ah *ah) { struct ib_device *ib_dev = ah->ibah.device; @@ -438,7 +439,12 @@ static int fill_ud_av(struct hns_roce_v2_ud_send_wqe *ud_sq_wqe, if (WARN_ON(ah->av.sl > MAX_SERVICE_LEVEL)) return -EINVAL; - hr_reg_write(ud_sq_wqe, UD_SEND_WQE_SL, ah->av.sl); + if (!qp->ud_sl_set) { + qp->sl = ah->av.sl; + qp->ud_sl_set = true; + } + + hr_reg_write(ud_sq_wqe, UD_SEND_WQE_SL, qp->sl); ud_sq_wqe->sgid_index = ah->av.gid_index; @@ -488,12 +494,10 @@ static inline int set_ud_wqe(struct hns_roce_qp *qp, qp->qkey : ud_wr(wr)->remote_qkey); hr_reg_write(ud_sq_wqe, UD_SEND_WQE_DQPN, ud_wr(wr)->remote_qpn); - ret = fill_ud_av(ud_sq_wqe, ah); + ret = fill_ud_av(qp, ud_sq_wqe, ah); if (ret) return ret; - qp->sl = to_hr_ah(ud_wr(wr)->ah)->av.sl; - set_extend_sge(qp, wr->sg_list, &curr_idx, valid_num_sge); /* @@ -5234,6 +5238,7 @@ static void v2_set_flushed_fields(struct ib_qp *ibqp, hr_reg_write(context, QPC_SQ_PRODUCER_IDX, hr_qp->sq.head); hr_reg_clear(qpc_mask, QPC_SQ_PRODUCER_IDX); hr_qp->state = IB_QPS_ERR; + hr_qp->ud_sl_set = false; spin_unlock_irqrestore(&hr_qp->sq.lock, sq_flag); if (ibqp->srq || ibqp->qp_type == IB_QPT_XRC_INI) /* no RQ */ -- 2.53.0