From nobody Sun Feb 8 21:27:53 2026 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DE85230EF64; Fri, 30 Jan 2026 14:16:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.156.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769782587; cv=none; b=Eiz6OfNQRM/FjPxVr57LDWT6QYfD4spzoPMaxwbtvTPXX1qxdFnxUkBBk+DL2jppKXm6ojgsxEvsKt8t205MZhTox8f7tcHwkvfz5LyxdzZLgIYbxX95S5h/y9GYgJtoKnwoxglzVz+in0ZD54juhvHTKVCrTSO86ZqMEGjDJZo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769782587; c=relaxed/simple; bh=XZgEfBRlm8Icq/d1lLQH/pTfgxm8Gb4CfGRr76LU9iY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=UbGfJm6fqrRIz6Sxaj6e9wJ+wXELri6HZly3Yzvkf+fIDAEYtareDTsouDOvvYaWUbyQ+TLYe+2Wzdi2DtS6dIVmpYBPyajp5XeClxLY1ojniwfc6BJ8NUvjWBlO2oNC8sXxT37YePjz32gzB4RiF37FhwZCJevMwqbqpMX9G9A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com; spf=pass smtp.mailfrom=marvell.com; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b=B8PaGZHO; arc=none smtp.client-ip=67.231.156.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=marvell.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="B8PaGZHO" Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 60U56nts2108507; Fri, 30 Jan 2026 06:16:17 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=1 X8qP0tdIHTcwnkxPdknFT4VQWL38/oIaz5svLxCnlE=; b=B8PaGZHO05cbLLA0m I3q5sWbX7TFah+IUYCqa3Otf1srzHi2yGI+5R7KkTpSXpD8nLQidksN9Rz5R/973 qXYkSLVfTxFRNMRg6+qb9xIkAyXVH+IuJa3nbTEoHtmrGV1gshbdsQGesIybmgeh FPxIVFQ7+WH9VQYSJSMKQzLuUp7l/TsXfKLvPITxWn2aVbaBQhhfihY4jFd2zknM bL/ZdhOZigIqdsMgp4brfryoHvO3Z8y2qYu+3WvV9fBB4fhziRUy5sD9rDOxbeN3 RfKeAVko1Ea2Y4QXRQGkCSqaqzL/rydSFJCrwG2jwByk/orSZJdd8psb18s6N9ZH 2pumA== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 4c0p77rxbk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 30 Jan 2026 06:16:16 -0800 (PST) Received: from DC5-EXCH05.marvell.com (10.69.176.209) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.25; Fri, 30 Jan 2026 06:16:30 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server id 15.2.1544.25 via Frontend Transport; Fri, 30 Jan 2026 06:16:30 -0800 Received: from sapphire1.sclab.marvell.com (unknown [10.111.132.245]) by maili.marvell.com (Postfix) with ESMTP id B50483F711E; Fri, 30 Jan 2026 06:16:14 -0800 (PST) From: Vimlesh Kumar To: , CC: , , , "Vimlesh Kumar" , Veerasenareddy Burru , Satananda Burla , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Subject: [PATCH RESEND net v3 3/3] octeon_ep_vf: ensure dbell BADDR updation Date: Fri, 30 Jan 2026 14:15:47 +0000 Message-ID: <20260130141549.827020-4-vimleshk@marvell.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260130141549.827020-1-vimleshk@marvell.com> References: <20260130141549.827020-1-vimleshk@marvell.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authority-Analysis: v=2.4 cv=aoC/yCZV c=1 sm=1 tr=0 ts=697cbd30 cx=c_pps a=rEv8fa4AjpPjGxpoe8rlIQ==:117 a=rEv8fa4AjpPjGxpoe8rlIQ==:17 a=vUbySO9Y5rIA:10 a=VkNPw1HP01LnGYTKEx00:22 a=VwQbUJbxAAAA:8 a=M5GUcnROAAAA:8 a=9s7rcsES4n5jIWhP9eIA:9 a=OBjm3rFKGHvpk9ecZwUJ:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTMwMDExNiBTYWx0ZWRfX0mIRDn9kPFP3 jp5Th6QvaUMD0KqQ0aF/t3XfS1kgjPSzfOcMxGCISLZvNqgNEy3cOWZhTreHtsqzqDbKKii3+w4 nNa0k4uGJkopEb2fQ2wVqu7LudgPFDftR3JaVMbNloYbhtBEWtrZijkibUQkmvJ/JYgzwni4cR4 2j2CcckVNws8Yc7EFzO1rEHMCl88vl3R9tM8cdj2EFJx4ihCiH7pcOP716SmC/xg74RIWkN07lh mnkryo/s+MLQq5ar9tTYDpG9OWuV6ogo/V+H8LvkULoy9kERl8vmP7qD4Ol4bjATPm8Ad2eunVo x6l+oBVr+CqJADC3h9P5BHVETxaISYX6jsm1R7YjKOHt+AdiNvTsU706NqbS4nheg5hKfOvu7pS fuPsCQWstFoPSe5uYRagACPIsBLa7+8++mQLheRhAVXpAGLoVx5/MvCdW39uiITXMAn/lHoFJ7v 5QuG8PdFaE5z1FAHSHA== X-Proofpoint-GUID: -Jl0xz3ayVtEv3h-B6dCNEqX0GqvMcUd X-Proofpoint-ORIG-GUID: -Jl0xz3ayVtEv3h-B6dCNEqX0GqvMcUd X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-01-30_02,2026-01-29_01,2025-10-01_01 Content-Type: text/plain; charset="utf-8" Make sure the OUT DBELL base address reflects the latest values written to it. Fix: Add a wait until the OUT DBELL base address register is updated with the DMA ring descriptor address, and modify the setup_oq function to properly handle failures. Fixes: 2c0c32c72be29 ("octeon_ep_vf: add hardware configuration APIs") Signed-off-by: Sathesh Edara Signed-off-by: Shinas Rasheed Signed-off-by: Vimlesh Kumar --- V3: - Use reverse christmas tree order variable declaration. - Return error if timeout happens during setup oq. V2: https://lore.kernel.org/all/20251219100751.3063135-4-vimleshk@marvell.c= om/ V1: https://lore.kernel.org/all/20251212122304.2562229-4-vimleshk@marvell.c= om/ .../marvell/octeon_ep_vf/octep_vf_cn9k.c | 3 +- .../marvell/octeon_ep_vf/octep_vf_cnxk.c | 39 +++++++++++++++++-- .../marvell/octeon_ep_vf/octep_vf_main.h | 2 +- .../marvell/octeon_ep_vf/octep_vf_rx.c | 4 +- 4 files changed, 42 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_cn9k.c b/dr= ivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_cn9k.c index 88937fce75f1..4c769b27c278 100644 --- a/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_cn9k.c +++ b/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_cn9k.c @@ -196,7 +196,7 @@ static void octep_vf_setup_iq_regs_cn93(struct octep_vf= _device *oct, int iq_no) } =20 /* Setup registers for a hardware Rx Queue */ -static void octep_vf_setup_oq_regs_cn93(struct octep_vf_device *oct, int o= q_no) +static int octep_vf_setup_oq_regs_cn93(struct octep_vf_device *oct, int oq= _no) { struct octep_vf_oq *oq =3D oct->oq[oq_no]; u32 time_threshold =3D 0; @@ -239,6 +239,7 @@ static void octep_vf_setup_oq_regs_cn93(struct octep_vf= _device *oct, int oq_no) time_threshold =3D CFG_GET_OQ_INTR_TIME(oct->conf); reg_val =3D ((u64)time_threshold << 32) | CFG_GET_OQ_INTR_PKT(oct->conf); octep_vf_write_csr64(oct, CN93_VF_SDP_R_OUT_INT_LEVELS(oq_no), reg_val); + return 0; } =20 /* Setup registers for a VF mailbox */ diff --git a/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_cnxk.c b/dr= ivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_cnxk.c index 1f79dfad42c6..a968b93a6794 100644 --- a/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_cnxk.c +++ b/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_cnxk.c @@ -199,11 +199,13 @@ static void octep_vf_setup_iq_regs_cnxk(struct octep_= vf_device *oct, int iq_no) } =20 /* Setup registers for a hardware Rx Queue */ -static void octep_vf_setup_oq_regs_cnxk(struct octep_vf_device *oct, int o= q_no) +static int octep_vf_setup_oq_regs_cnxk(struct octep_vf_device *oct, int oq= _no) { struct octep_vf_oq *oq =3D oct->oq[oq_no]; + unsigned long t_out_jiffies; u32 time_threshold =3D 0; u64 oq_ctl =3D ULL(0); + u64 reg_ba_val; u64 reg_val; =20 reg_val =3D octep_vf_read_csr64(oct, CNXK_VF_SDP_R_OUT_CONTROL(oq_no)); @@ -214,6 +216,38 @@ static void octep_vf_setup_oq_regs_cnxk(struct octep_v= f_device *oct, int oq_no) reg_val =3D octep_vf_read_csr64(oct, CNXK_VF_SDP_R_OUT_CONTROL(oq_no)); } while (!(reg_val & CNXK_VF_R_OUT_CTL_IDLE)); } + octep_vf_write_csr64(oct, CNXK_VF_SDP_R_OUT_WMARK(oq_no), + oq->max_count); + /* Wait for WMARK to get applied */ + usleep_range(10, 15); + + octep_vf_write_csr64(oct, CNXK_VF_SDP_R_OUT_SLIST_BADDR(oq_no), + oq->desc_ring_dma); + octep_vf_write_csr64(oct, CNXK_VF_SDP_R_OUT_SLIST_RSIZE(oq_no), + oq->max_count); + reg_ba_val =3D octep_vf_read_csr64(oct, + CNXK_VF_SDP_R_OUT_SLIST_BADDR(oq_no)); + if (reg_ba_val !=3D oq->desc_ring_dma) { + t_out_jiffies =3D jiffies + 10 * HZ; + do { + if (reg_ba_val =3D=3D ULLONG_MAX) + return -EFAULT; + octep_vf_write_csr64(oct, + CNXK_VF_SDP_R_OUT_SLIST_BADDR + (oq_no), oq->desc_ring_dma); + octep_vf_write_csr64(oct, + CNXK_VF_SDP_R_OUT_SLIST_RSIZE + (oq_no), oq->max_count); + reg_ba_val =3D + octep_vf_read_csr64(oct, + CNXK_VF_SDP_R_OUT_SLIST_BADDR + (oq_no)); + } while ((reg_ba_val !=3D oq->desc_ring_dma) && + time_before(jiffies, t_out_jiffies)); + + if (reg_ba_val !=3D oq->desc_ring_dma) + return -EAGAIN; + } =20 reg_val &=3D ~(CNXK_VF_R_OUT_CTL_IMODE); reg_val &=3D ~(CNXK_VF_R_OUT_CTL_ROR_P); @@ -227,8 +261,6 @@ static void octep_vf_setup_oq_regs_cnxk(struct octep_vf= _device *oct, int oq_no) reg_val |=3D (CNXK_VF_R_OUT_CTL_ES_P); =20 octep_vf_write_csr64(oct, CNXK_VF_SDP_R_OUT_CONTROL(oq_no), reg_val); - octep_vf_write_csr64(oct, CNXK_VF_SDP_R_OUT_SLIST_BADDR(oq_no), oq->desc_= ring_dma); - octep_vf_write_csr64(oct, CNXK_VF_SDP_R_OUT_SLIST_RSIZE(oq_no), oq->max_c= ount); =20 oq_ctl =3D octep_vf_read_csr64(oct, CNXK_VF_SDP_R_OUT_CONTROL(oq_no)); /* Clear the ISIZE and BSIZE (22-0) */ @@ -250,6 +282,7 @@ static void octep_vf_setup_oq_regs_cnxk(struct octep_vf= _device *oct, int oq_no) reg_val &=3D ~GENMASK_ULL(31, 0); reg_val |=3D CFG_GET_OQ_WMARK(oct->conf); octep_vf_write_csr64(oct, CNXK_VF_SDP_R_OUT_WMARK(oq_no), reg_val); + return 0; } =20 /* Setup registers for a VF mailbox */ diff --git a/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_main.h b/dr= ivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_main.h index b9f13506f462..c74cd2369e90 100644 --- a/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_main.h +++ b/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_main.h @@ -55,7 +55,7 @@ struct octep_vf_mmio { =20 struct octep_vf_hw_ops { void (*setup_iq_regs)(struct octep_vf_device *oct, int q); - void (*setup_oq_regs)(struct octep_vf_device *oct, int q); + int (*setup_oq_regs)(struct octep_vf_device *oct, int q); void (*setup_mbox_regs)(struct octep_vf_device *oct, int mbox); =20 irqreturn_t (*non_ioq_intr_handler)(void *ioq_vector); diff --git a/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_rx.c b/driv= ers/net/ethernet/marvell/octeon_ep_vf/octep_vf_rx.c index d70c8be3cfc4..6446f6bf0b90 100644 --- a/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_rx.c +++ b/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_rx.c @@ -171,7 +171,9 @@ static int octep_vf_setup_oq(struct octep_vf_device *oc= t, int q_no) goto oq_fill_buff_err; =20 octep_vf_oq_reset_indices(oq); - oct->hw_ops.setup_oq_regs(oct, q_no); + if (oct->hw_ops.setup_oq_regs(oct, q_no)) + goto oq_fill_buff_err; + oct->num_oqs++; =20 return 0; --=20 2.47.0