From nobody Mon Feb 9 01:46:11 2026 Received: from mx0a-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) (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 B074229B776; Fri, 30 Jan 2026 14:16:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.148.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769782582; cv=none; b=GGxpb3vSRUQJQ6AKeXo8w7gUglbYCfNdMjP88LtHQgCI3UBl1c09bWTkVzSxyoCl2YpaNsotZoD2eQKVRrELA8SmfY6uHl9Un0RtzphVEx1Id5GtmtNhE8eLL9Nj5STTV12Zqs+BJiBdOds4BLtemt28V6kM3D3YHggu1aYE4ak= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769782582; c=relaxed/simple; bh=/1RWOwQSFGC89wVNbP16ojfzQ7Ov7ITW0M/8qiDhigU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GgyNzHJJNnXc7FIJoKFYy1DT3HF5SLINBfBsbZvQBQrdm5A9No9vBnOgi4JAPMiGg/hRuMlZ+9dUa1bplnbGNNvB2TSoogAvN3yeZWq262HBSlIRFXXZdt1uako0BxGhXUrXzmFjvg8UFNFCOhuOVQaitmnQ2EMXmliRxi6XbVI= 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=WJYFrpzj; arc=none smtp.client-ip=67.231.148.174 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="WJYFrpzj" Received: from pps.filterd (m0431384.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 60TNYcEu1038949; Fri, 30 Jan 2026 06:16:12 -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=8 Zx/GFkNmbM70gRkZhy2WGwJTDybAOkuL3R5q7taMXw=; b=WJYFrpzj/DE9FiKsS ky2zpM3VHwwtCFz0TcHVxxvCj8htipkQ6C6OZkCUENY4ADXzQ6VOGZX/JekoxGhI 2m5RmNfxHlujYq/VMKZfqeoEKnJPZyPbKwh1nkcx1FktspoT0U7063qxys+DoaAG OsW8qq6w0w/ABZpDlDgOnrCIPWi50sEWAtm3n/+zJXf147khh9VYmDQH+7WY2hM8 GMdoLrx+pHP6UGp7HeWvjlPD3esmSBfx2qa89MkUKk1/lPmCNfvsapHLdz+HLsCW 1PRVpdO3k1//F3uJXTs2O/Q8Yy+bk7ugRqes3qKOE1oRFZOWH+wM3E1VaV28jgv2 SXKOQ== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 4c0h861hx8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 30 Jan 2026 06:16:12 -0800 (PST) Received: from DC6WP-EXCH02.marvell.com (10.76.176.209) by DC6WP-EXCH02.marvell.com (10.76.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:11 -0800 Received: from maili.marvell.com (10.69.176.80) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server id 15.2.1544.25 via Frontend Transport; Fri, 30 Jan 2026 06:16:10 -0800 Received: from sapphire1.sclab.marvell.com (unknown [10.111.132.245]) by maili.marvell.com (Postfix) with ESMTP id 61B3F3F70E3; Fri, 30 Jan 2026 06:16:10 -0800 (PST) From: Vimlesh Kumar To: , CC: , , , "Vimlesh Kumar" , Veerasenareddy Burru , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , "Paolo Abeni" Subject: [PATCH RESEND net v3 2/3] octeon_ep: ensure dbell BADDR updation Date: Fri, 30 Jan 2026 14:15:46 +0000 Message-ID: <20260130141549.827020-3-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=MPZtWcZl c=1 sm=1 tr=0 ts=697cbd2c cx=c_pps a=gIfcoYsirJbf48DBMSPrZA==:117 a=gIfcoYsirJbf48DBMSPrZA==:17 a=vUbySO9Y5rIA:10 a=VkNPw1HP01LnGYTKEx00:22 a=VwQbUJbxAAAA:8 a=M5GUcnROAAAA:8 a=HhD5TD71VMN5Ao0PvCkA:9 a=OBjm3rFKGHvpk9ecZwUJ:22 X-Proofpoint-ORIG-GUID: Nsyiv5fqNw8CQm1o5JJ1fOTDgT1tRktY X-Proofpoint-GUID: Nsyiv5fqNw8CQm1o5JJ1fOTDgT1tRktY X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTMwMDExNiBTYWx0ZWRfX50Aua7zMCLmU +TQYyTLI4gglu/K1DpuMzKh8WcicZOvDNIz20tXqGBmtBtMNAym19B1GvaS8Z949QFJH9rdvRg8 Swzm7hHgg7sjv6Op/jwKnkZNmKc4rZ/x9ba6vX7yuqxM3rhgglGWkohSR9Wj3PCv+BsF0umVtnU a+fijmeJyhBcl4Uhq9SA4LmEyk3YdCH/KEFY9I0TDxb7932D21rdq7uWQLI15hT/YDb/x1k1Vxv f93TZ8D7KNDogp3xlqaQk9IvTJp1jp8QIwGz6u9pWqOuQKvdfjx8FeZBRxU9rgiqKDJdVqrG1PT urSd/RlknEF02HbIU/U6fRbeskfXxDH83yFLUVJLxJzoqmXo3cxS8nwLQ0DPLzeH5C9d6FbT44R P86ubbvlR7/zhxNnLMoxZqBWzsylgOUuDeJKalKhjum75PJKMch0VL+7wWkLXScEV4od81fnthh vc2HhldiOkkxv/XJxwg== 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: 0807dc76f3bf5 ("octeon_ep: support Octeon CN10K devices") 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. =20 V2: https://lore.kernel.org/all/20251219100751.3063135-3-vimleshk@marvell.c= om/ V1: https://lore.kernel.org/all/20251212122304.2562229-3-vimleshk@marvell.c= om/ .../marvell/octeon_ep/octep_cn9k_pf.c | 3 +- .../marvell/octeon_ep/octep_cnxk_pf.c | 46 +++++++++++++++---- .../ethernet/marvell/octeon_ep/octep_main.h | 2 +- .../net/ethernet/marvell/octeon_ep/octep_rx.c | 4 +- 4 files changed, 44 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_cn9k_pf.c b/drive= rs/net/ethernet/marvell/octeon_ep/octep_cn9k_pf.c index 2574a6061e3d..2a5cebbf1ff8 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_cn9k_pf.c +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_cn9k_pf.c @@ -307,7 +307,7 @@ static void octep_setup_iq_regs_cn93_pf(struct octep_de= vice *oct, int iq_no) } =20 /* Setup registers for a hardware Rx Queue */ -static void octep_setup_oq_regs_cn93_pf(struct octep_device *oct, int oq_n= o) +static int octep_setup_oq_regs_cn93_pf(struct octep_device *oct, int oq_no) { u64 reg_val; u64 oq_ctl =3D 0ULL; @@ -355,6 +355,7 @@ static void octep_setup_oq_regs_cn93_pf(struct octep_de= vice *oct, int oq_no) reg_val =3D ((u64)time_threshold << 32) | CFG_GET_OQ_INTR_PKT(oct->conf); octep_write_csr64(oct, CN93_SDP_R_OUT_INT_LEVELS(oq_no), reg_val); + return 0; } =20 /* Setup registers for a PF mailbox */ diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_cnxk_pf.c b/drive= rs/net/ethernet/marvell/octeon_ep/octep_cnxk_pf.c index 73cd0ca758f0..8d17ff71507f 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_cnxk_pf.c +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_cnxk_pf.c @@ -8,6 +8,7 @@ #include #include #include +#include =20 #include "octep_config.h" #include "octep_main.h" @@ -327,12 +328,14 @@ static void octep_setup_iq_regs_cnxk_pf(struct octep_= device *oct, int iq_no) } =20 /* Setup registers for a hardware Rx Queue */ -static void octep_setup_oq_regs_cnxk_pf(struct octep_device *oct, int oq_n= o) +static int octep_setup_oq_regs_cnxk_pf(struct octep_device *oct, int oq_no) { - u64 reg_val; - u64 oq_ctl =3D 0ULL; - u32 time_threshold =3D 0; struct octep_oq *oq =3D oct->oq[oq_no]; + unsigned long t_out_jiffies; + u32 time_threshold =3D 0; + u64 oq_ctl =3D 0ULL; + u64 reg_ba_val; + u64 reg_val; =20 oq_no +=3D CFG_GET_PORTS_PF_SRN(oct->conf); reg_val =3D octep_read_csr64(oct, CNXK_SDP_R_OUT_CONTROL(oq_no)); @@ -343,6 +346,36 @@ static void octep_setup_oq_regs_cnxk_pf(struct octep_d= evice *oct, int oq_no) reg_val =3D octep_read_csr64(oct, CNXK_SDP_R_OUT_CONTROL(oq_no)); } while (!(reg_val & CNXK_R_OUT_CTL_IDLE)); } + octep_write_csr64(oct, CNXK_SDP_R_OUT_WMARK(oq_no), oq->max_count); + /* Wait for WMARK to get applied */ + usleep_range(10, 15); + + octep_write_csr64(oct, CNXK_SDP_R_OUT_SLIST_BADDR(oq_no), + oq->desc_ring_dma); + octep_write_csr64(oct, CNXK_SDP_R_OUT_SLIST_RSIZE(oq_no), + oq->max_count); + reg_ba_val =3D octep_read_csr64(oct, CNXK_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_write_csr64(oct, + CNXK_SDP_R_OUT_SLIST_BADDR(oq_no), + oq->desc_ring_dma); + octep_write_csr64(oct, + CNXK_SDP_R_OUT_SLIST_RSIZE(oq_no), + oq->max_count); + reg_ba_val =3D + octep_read_csr64(oct, + CNXK_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_R_OUT_CTL_IMODE); reg_val &=3D ~(CNXK_R_OUT_CTL_ROR_P); @@ -356,10 +389,6 @@ static void octep_setup_oq_regs_cnxk_pf(struct octep_d= evice *oct, int oq_no) reg_val |=3D (CNXK_R_OUT_CTL_ES_P); =20 octep_write_csr64(oct, CNXK_SDP_R_OUT_CONTROL(oq_no), reg_val); - octep_write_csr64(oct, CNXK_SDP_R_OUT_SLIST_BADDR(oq_no), - oq->desc_ring_dma); - octep_write_csr64(oct, CNXK_SDP_R_OUT_SLIST_RSIZE(oq_no), - oq->max_count); =20 oq_ctl =3D octep_read_csr64(oct, CNXK_SDP_R_OUT_CONTROL(oq_no)); =20 @@ -385,6 +414,7 @@ static void octep_setup_oq_regs_cnxk_pf(struct octep_de= vice *oct, int oq_no) reg_val &=3D ~0xFFFFFFFFULL; reg_val |=3D CFG_GET_OQ_WMARK(oct->conf); octep_write_csr64(oct, CNXK_SDP_R_OUT_WMARK(oq_no), reg_val); + return 0; } =20 /* Setup registers for a PF mailbox */ diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_main.h b/drivers/= net/ethernet/marvell/octeon_ep/octep_main.h index 81ac4267811c..35d0ff289a70 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_main.h +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_main.h @@ -77,7 +77,7 @@ struct octep_pci_win_regs { =20 struct octep_hw_ops { void (*setup_iq_regs)(struct octep_device *oct, int q); - void (*setup_oq_regs)(struct octep_device *oct, int q); + int (*setup_oq_regs)(struct octep_device *oct, int q); void (*setup_mbox_regs)(struct octep_device *oct, int mbox); =20 irqreturn_t (*mbox_intr_handler)(void *ioq_vector); diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_rx.c b/drivers/ne= t/ethernet/marvell/octeon_ep/octep_rx.c index 82b6b19e76b4..1581cc468d74 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_rx.c +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_rx.c @@ -170,7 +170,9 @@ static int octep_setup_oq(struct octep_device *oct, int= q_no) goto oq_fill_buff_err; =20 octep_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