* [PATCH net v3 0/3] disable interrupts and ensure dbell updation
@ 2026-01-07 13:18 Vimlesh Kumar
2026-01-07 13:18 ` [PATCH net v3 1/3] octeon_ep: disable per ring interrupts Vimlesh Kumar
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Vimlesh Kumar @ 2026-01-07 13:18 UTC (permalink / raw)
To: netdev, linux-kernel; +Cc: sedara, srasheed, hgani, Vimlesh Kumar
Disable per ring interrupts when netdev goes down and ensure dbell BADDR
updation for both PFs and VFs by adding wait and check for updated value.
Vimlesh Kumar (3):
octeon_ep: disable per ring interrupts
octeon_ep: ensure dbell BADDR updation
octeon_ep_vf: ensure dbell BADDR updation
V3:
- Use reverse christmas tree order variable declaration.
- Return error if timeout happens during setup oq.
V2: https://lore.kernel.org/all/20251219100751.3063135-1-vimleshk@marvell.com/
V1: https://lore.kernel.org/all/20251212122304.2562229-1-vimleshk@marvell.com/
.../marvell/octeon_ep/octep_cn9k_pf.c | 21 ++++--
.../marvell/octeon_ep/octep_cnxk_pf.c | 64 +++++++++++++++----
.../ethernet/marvell/octeon_ep/octep_main.h | 2 +-
.../marvell/octeon_ep/octep_regs_cn9k_pf.h | 1 +
.../marvell/octeon_ep/octep_regs_cnxk_pf.h | 1 +
.../net/ethernet/marvell/octeon_ep/octep_rx.c | 4 +-
.../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 +-
10 files changed, 118 insertions(+), 23 deletions(-)
--
2.47.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH net v3 1/3] octeon_ep: disable per ring interrupts
2026-01-07 13:18 [PATCH net v3 0/3] disable interrupts and ensure dbell updation Vimlesh Kumar
@ 2026-01-07 13:18 ` Vimlesh Kumar
2026-01-07 13:18 ` [PATCH net v3 2/3] octeon_ep: ensure dbell BADDR updation Vimlesh Kumar
2026-01-07 13:18 ` [PATCH net v3 3/3] octeon_ep_vf: " Vimlesh Kumar
2 siblings, 0 replies; 7+ messages in thread
From: Vimlesh Kumar @ 2026-01-07 13:18 UTC (permalink / raw)
To: netdev, linux-kernel
Cc: sedara, srasheed, hgani, Vimlesh Kumar, Veerasenareddy Burru,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Satananda Burla, Abhijit Ayarekar
Disable the MSI-X per ring interrupt for every PF ring when PF
netdev goes down.
Fixes: 1f2c2d0cee023 ("octeon_ep: add hardware configuration APIs")
Signed-off-by: Sathesh Edara <sedara@marvell.com>
Signed-off-by: Shinas Rasheed <srasheed@marvell.com>
Signed-off-by: Vimlesh Kumar <vimleshk@marvell.com>
---
V3:
- No change
V2: https://lore.kernel.org/all/20251219100751.3063135-2-vimleshk@marvell.com/
V1: https://lore.kernel.org/all/20251212122304.2562229-2-vimleshk@marvell.com/
.../ethernet/marvell/octeon_ep/octep_cn9k_pf.c | 18 +++++++++++++++---
.../ethernet/marvell/octeon_ep/octep_cnxk_pf.c | 18 +++++++++++++++---
.../marvell/octeon_ep/octep_regs_cn9k_pf.h | 1 +
.../marvell/octeon_ep/octep_regs_cnxk_pf.h | 1 +
4 files changed, 32 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_cn9k_pf.c b/drivers/net/ethernet/marvell/octeon_ep/octep_cn9k_pf.c
index b5805969404f..2574a6061e3d 100644
--- a/drivers/net/ethernet/marvell/octeon_ep/octep_cn9k_pf.c
+++ b/drivers/net/ethernet/marvell/octeon_ep/octep_cn9k_pf.c
@@ -696,14 +696,26 @@ static void octep_enable_interrupts_cn93_pf(struct octep_device *oct)
/* Disable all interrupts */
static void octep_disable_interrupts_cn93_pf(struct octep_device *oct)
{
- u64 intr_mask = 0ULL;
+ u64 reg_val, intr_mask = 0ULL;
int srn, num_rings, i;
srn = CFG_GET_PORTS_PF_SRN(oct->conf);
num_rings = CFG_GET_PORTS_ACTIVE_IO_RINGS(oct->conf);
- for (i = 0; i < num_rings; i++)
- intr_mask |= (0x1ULL << (srn + i));
+ for (i = 0; i < num_rings; i++) {
+ intr_mask |= (BIT_ULL(srn + i));
+ reg_val = octep_read_csr64(oct,
+ CN93_SDP_R_IN_INT_LEVELS(srn + i));
+ reg_val &= (~CN93_INT_ENA_BIT);
+ octep_write_csr64(oct,
+ CN93_SDP_R_IN_INT_LEVELS(srn + i), reg_val);
+
+ reg_val = octep_read_csr64(oct,
+ CN93_SDP_R_OUT_INT_LEVELS(srn + i));
+ reg_val &= (~CN93_INT_ENA_BIT);
+ octep_write_csr64(oct,
+ CN93_SDP_R_OUT_INT_LEVELS(srn + i), reg_val);
+ }
octep_write_csr64(oct, CN93_SDP_EPF_IRERR_RINT_ENA_W1C, intr_mask);
octep_write_csr64(oct, CN93_SDP_EPF_ORERR_RINT_ENA_W1C, intr_mask);
diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_cnxk_pf.c b/drivers/net/ethernet/marvell/octeon_ep/octep_cnxk_pf.c
index 5de0b5ecbc5f..73cd0ca758f0 100644
--- a/drivers/net/ethernet/marvell/octeon_ep/octep_cnxk_pf.c
+++ b/drivers/net/ethernet/marvell/octeon_ep/octep_cnxk_pf.c
@@ -720,14 +720,26 @@ static void octep_enable_interrupts_cnxk_pf(struct octep_device *oct)
/* Disable all interrupts */
static void octep_disable_interrupts_cnxk_pf(struct octep_device *oct)
{
- u64 intr_mask = 0ULL;
+ u64 reg_val, intr_mask = 0ULL;
int srn, num_rings, i;
srn = CFG_GET_PORTS_PF_SRN(oct->conf);
num_rings = CFG_GET_PORTS_ACTIVE_IO_RINGS(oct->conf);
- for (i = 0; i < num_rings; i++)
- intr_mask |= (0x1ULL << (srn + i));
+ for (i = 0; i < num_rings; i++) {
+ intr_mask |= BIT_ULL(srn + i);
+ reg_val = octep_read_csr64(oct,
+ CNXK_SDP_R_IN_INT_LEVELS(srn + i));
+ reg_val &= (~CNXK_INT_ENA_BIT);
+ octep_write_csr64(oct,
+ CNXK_SDP_R_IN_INT_LEVELS(srn + i), reg_val);
+
+ reg_val = octep_read_csr64(oct,
+ CNXK_SDP_R_OUT_INT_LEVELS(srn + i));
+ reg_val &= (~CNXK_INT_ENA_BIT);
+ octep_write_csr64(oct,
+ CNXK_SDP_R_OUT_INT_LEVELS(srn + i), reg_val);
+ }
octep_write_csr64(oct, CNXK_SDP_EPF_IRERR_RINT_ENA_W1C, intr_mask);
octep_write_csr64(oct, CNXK_SDP_EPF_ORERR_RINT_ENA_W1C, intr_mask);
diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_regs_cn9k_pf.h b/drivers/net/ethernet/marvell/octeon_ep/octep_regs_cn9k_pf.h
index ca473502d7a0..42cb199bd085 100644
--- a/drivers/net/ethernet/marvell/octeon_ep/octep_regs_cn9k_pf.h
+++ b/drivers/net/ethernet/marvell/octeon_ep/octep_regs_cn9k_pf.h
@@ -386,5 +386,6 @@
#define CN93_PEM_BAR4_INDEX 7
#define CN93_PEM_BAR4_INDEX_SIZE 0x400000ULL
#define CN93_PEM_BAR4_INDEX_OFFSET (CN93_PEM_BAR4_INDEX * CN93_PEM_BAR4_INDEX_SIZE)
+#define CN93_INT_ENA_BIT (BIT_ULL(62))
#endif /* _OCTEP_REGS_CN9K_PF_H_ */
diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_regs_cnxk_pf.h b/drivers/net/ethernet/marvell/octeon_ep/octep_regs_cnxk_pf.h
index e637d7c8224d..9eaadded9c50 100644
--- a/drivers/net/ethernet/marvell/octeon_ep/octep_regs_cnxk_pf.h
+++ b/drivers/net/ethernet/marvell/octeon_ep/octep_regs_cnxk_pf.h
@@ -412,5 +412,6 @@
#define CNXK_PEM_BAR4_INDEX 7
#define CNXK_PEM_BAR4_INDEX_SIZE 0x400000ULL
#define CNXK_PEM_BAR4_INDEX_OFFSET (CNXK_PEM_BAR4_INDEX * CNXK_PEM_BAR4_INDEX_SIZE)
+#define CNXK_INT_ENA_BIT (BIT_ULL(62))
#endif /* _OCTEP_REGS_CNXK_PF_H_ */
--
2.47.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net v3 2/3] octeon_ep: ensure dbell BADDR updation
2026-01-07 13:18 [PATCH net v3 0/3] disable interrupts and ensure dbell updation Vimlesh Kumar
2026-01-07 13:18 ` [PATCH net v3 1/3] octeon_ep: disable per ring interrupts Vimlesh Kumar
@ 2026-01-07 13:18 ` Vimlesh Kumar
2026-01-07 13:18 ` [PATCH net v3 3/3] octeon_ep_vf: " Vimlesh Kumar
2 siblings, 0 replies; 7+ messages in thread
From: Vimlesh Kumar @ 2026-01-07 13:18 UTC (permalink / raw)
To: netdev, linux-kernel
Cc: sedara, srasheed, hgani, Vimlesh Kumar, Veerasenareddy Burru,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni
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 <sedara@marvell.com>
Signed-off-by: Shinas Rasheed <srasheed@marvell.com>
Signed-off-by: Vimlesh Kumar <vimleshk@marvell.com>
---
V3:
- Use reverse christmas tree order variable declaration.
- Return error if timeout happens during setup oq.
V2: https://lore.kernel.org/all/20251219100751.3063135-3-vimleshk@marvell.com/
V1: https://lore.kernel.org/all/20251212122304.2562229-3-vimleshk@marvell.com/
.../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/drivers/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_device *oct, int iq_no)
}
/* Setup registers for a hardware Rx Queue */
-static void octep_setup_oq_regs_cn93_pf(struct octep_device *oct, int oq_no)
+static int octep_setup_oq_regs_cn93_pf(struct octep_device *oct, int oq_no)
{
u64 reg_val;
u64 oq_ctl = 0ULL;
@@ -355,6 +355,7 @@ static void octep_setup_oq_regs_cn93_pf(struct octep_device *oct, int oq_no)
reg_val = ((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;
}
/* Setup registers for a PF mailbox */
diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_cnxk_pf.c b/drivers/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 <linux/pci.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
+#include <linux/jiffies.h>
#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)
}
/* Setup registers for a hardware Rx Queue */
-static void octep_setup_oq_regs_cnxk_pf(struct octep_device *oct, int oq_no)
+static int octep_setup_oq_regs_cnxk_pf(struct octep_device *oct, int oq_no)
{
- u64 reg_val;
- u64 oq_ctl = 0ULL;
- u32 time_threshold = 0;
struct octep_oq *oq = oct->oq[oq_no];
+ unsigned long t_out_jiffies;
+ u32 time_threshold = 0;
+ u64 oq_ctl = 0ULL;
+ u64 reg_ba_val;
+ u64 reg_val;
oq_no += CFG_GET_PORTS_PF_SRN(oct->conf);
reg_val = 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_device *oct, int oq_no)
reg_val = 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 = octep_read_csr64(oct, CNXK_SDP_R_OUT_SLIST_BADDR(oq_no));
+
+ if (reg_ba_val != oq->desc_ring_dma) {
+ t_out_jiffies = jiffies + 10 * HZ;
+ do {
+ if (reg_ba_val == 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 =
+ octep_read_csr64(oct,
+ CNXK_SDP_R_OUT_SLIST_BADDR(oq_no));
+ } while ((reg_ba_val != oq->desc_ring_dma) &&
+ time_before(jiffies, t_out_jiffies));
+
+ if (reg_ba_val != oq->desc_ring_dma)
+ return -EAGAIN;
+ }
reg_val &= ~(CNXK_R_OUT_CTL_IMODE);
reg_val &= ~(CNXK_R_OUT_CTL_ROR_P);
@@ -356,10 +389,6 @@ static void octep_setup_oq_regs_cnxk_pf(struct octep_device *oct, int oq_no)
reg_val |= (CNXK_R_OUT_CTL_ES_P);
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);
oq_ctl = octep_read_csr64(oct, CNXK_SDP_R_OUT_CONTROL(oq_no));
@@ -385,6 +414,7 @@ static void octep_setup_oq_regs_cnxk_pf(struct octep_device *oct, int oq_no)
reg_val &= ~0xFFFFFFFFULL;
reg_val |= CFG_GET_OQ_WMARK(oct->conf);
octep_write_csr64(oct, CNXK_SDP_R_OUT_WMARK(oq_no), reg_val);
+ return 0;
}
/* 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 {
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);
irqreturn_t (*mbox_intr_handler)(void *ioq_vector);
diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_rx.c b/drivers/net/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;
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++;
return 0;
--
2.47.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net v3 3/3] octeon_ep_vf: ensure dbell BADDR updation
2026-01-07 13:18 [PATCH net v3 0/3] disable interrupts and ensure dbell updation Vimlesh Kumar
2026-01-07 13:18 ` [PATCH net v3 1/3] octeon_ep: disable per ring interrupts Vimlesh Kumar
2026-01-07 13:18 ` [PATCH net v3 2/3] octeon_ep: ensure dbell BADDR updation Vimlesh Kumar
@ 2026-01-07 13:18 ` Vimlesh Kumar
2026-01-12 14:39 ` Simon Horman
2 siblings, 1 reply; 7+ messages in thread
From: Vimlesh Kumar @ 2026-01-07 13:18 UTC (permalink / raw)
To: netdev, linux-kernel
Cc: sedara, srasheed, hgani, Vimlesh Kumar, Veerasenareddy Burru,
Satananda Burla, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
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 <sedara@marvell.com>
Signed-off-by: Shinas Rasheed <srasheed@marvell.com>
Signed-off-by: Vimlesh Kumar <vimleshk@marvell.com>
---
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.com/
V1: https://lore.kernel.org/all/20251212122304.2562229-4-vimleshk@marvell.com/
.../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/drivers/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)
}
/* Setup registers for a hardware Rx Queue */
-static void octep_vf_setup_oq_regs_cn93(struct octep_vf_device *oct, int oq_no)
+static int octep_vf_setup_oq_regs_cn93(struct octep_vf_device *oct, int oq_no)
{
struct octep_vf_oq *oq = oct->oq[oq_no];
u32 time_threshold = 0;
@@ -239,6 +239,7 @@ static void octep_vf_setup_oq_regs_cn93(struct octep_vf_device *oct, int oq_no)
time_threshold = CFG_GET_OQ_INTR_TIME(oct->conf);
reg_val = ((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;
}
/* Setup registers for a VF mailbox */
diff --git a/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_cnxk.c b/drivers/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)
}
/* Setup registers for a hardware Rx Queue */
-static void octep_vf_setup_oq_regs_cnxk(struct octep_vf_device *oct, int oq_no)
+static int octep_vf_setup_oq_regs_cnxk(struct octep_vf_device *oct, int oq_no)
{
struct octep_vf_oq *oq = oct->oq[oq_no];
+ unsigned long t_out_jiffies;
u32 time_threshold = 0;
u64 oq_ctl = ULL(0);
+ u64 reg_ba_val;
u64 reg_val;
reg_val = 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_vf_device *oct, int oq_no)
reg_val = 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 = octep_vf_read_csr64(oct,
+ CNXK_VF_SDP_R_OUT_SLIST_BADDR(oq_no));
+ if (reg_ba_val != oq->desc_ring_dma) {
+ t_out_jiffies = jiffies + 10 * HZ;
+ do {
+ if (reg_ba_val == 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 =
+ octep_vf_read_csr64(oct,
+ CNXK_VF_SDP_R_OUT_SLIST_BADDR
+ (oq_no));
+ } while ((reg_ba_val != oq->desc_ring_dma) &&
+ time_before(jiffies, t_out_jiffies));
+
+ if (reg_ba_val != oq->desc_ring_dma)
+ return -EAGAIN;
+ }
reg_val &= ~(CNXK_VF_R_OUT_CTL_IMODE);
reg_val &= ~(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 |= (CNXK_VF_R_OUT_CTL_ES_P);
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_count);
oq_ctl = 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 &= ~GENMASK_ULL(31, 0);
reg_val |= CFG_GET_OQ_WMARK(oct->conf);
octep_vf_write_csr64(oct, CNXK_VF_SDP_R_OUT_WMARK(oq_no), reg_val);
+ return 0;
}
/* Setup registers for a VF mailbox */
diff --git a/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_main.h b/drivers/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 {
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);
irqreturn_t (*non_ioq_intr_handler)(void *ioq_vector);
diff --git a/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_rx.c b/drivers/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 *oct, int q_no)
goto oq_fill_buff_err;
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++;
return 0;
--
2.47.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH net v3 3/3] octeon_ep_vf: ensure dbell BADDR updation
2026-01-07 13:18 ` [PATCH net v3 3/3] octeon_ep_vf: " Vimlesh Kumar
@ 2026-01-12 14:39 ` Simon Horman
2026-01-15 9:34 ` [EXTERNAL] " Vimlesh Kumar
0 siblings, 1 reply; 7+ messages in thread
From: Simon Horman @ 2026-01-12 14:39 UTC (permalink / raw)
To: Vimlesh Kumar
Cc: netdev, linux-kernel, sedara, srasheed, hgani,
Veerasenareddy Burru, Satananda Burla, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
On Wed, Jan 07, 2026 at 01:18:56PM +0000, Vimlesh Kumar wrote:
> 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 <sedara@marvell.com>
> Signed-off-by: Shinas Rasheed <srasheed@marvell.com>
> Signed-off-by: Vimlesh Kumar <vimleshk@marvell.com>
> ---
> V3:
> - Use reverse christmas tree order variable declaration.
> - Return error if timeout happens during setup oq.
...
> diff --git a/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_rx.c b/drivers/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 *oct, int q_no)
> goto oq_fill_buff_err;
>
> 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;
> +
Hi Vimlesh, all,
I think that a new label needs to be added to the unwind ladder such that
octep_vf_oq_free_ring_buffers() is called if the error condition above is met.
Likewise in patch 2/3.
Flagged by Claude Code with Review Prompts[1]
[1] https://github.com/masoncl/review-prompts/
> oct->num_oqs++;
>
> return 0;
--
pw-bot: cr
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [EXTERNAL] Re: [PATCH net v3 3/3] octeon_ep_vf: ensure dbell BADDR updation
2026-01-12 14:39 ` Simon Horman
@ 2026-01-15 9:34 ` Vimlesh Kumar
2026-01-15 13:46 ` Simon Horman
0 siblings, 1 reply; 7+ messages in thread
From: Vimlesh Kumar @ 2026-01-15 9:34 UTC (permalink / raw)
To: Simon Horman
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Sathesh B Edara, Shinas Rasheed, Haseeb Gani,
Veerasenareddy Burru, Satananda Burla, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
> -----Original Message-----
> From: Simon Horman <horms@kernel.org>
> Sent: Monday, January 12, 2026 8:10 PM
> To: Vimlesh Kumar <vimleshk@marvell.com>
> Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org; Sathesh B Edara
> <sedara@marvell.com>; Shinas Rasheed <srasheed@marvell.com>; Haseeb
> Gani <hgani@marvell.com>; Veerasenareddy Burru <vburru@marvell.com>;
> Satananda Burla <sburla@marvell.com>; Andrew Lunn
> <andrew+netdev@lunn.ch>; David S. Miller <davem@davemloft.net>; Eric
> Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo
> Abeni <pabeni@redhat.com>
> Subject: [EXTERNAL] Re: [PATCH net v3 3/3] octeon_ep_vf: ensure dbell
> BADDR updation
>
> On Wed, Jan 07, 2026 at 01: 18: 56PM +0000, Vimlesh Kumar wrote: > 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
> On Wed, Jan 07, 2026 at 01:18:56PM +0000, Vimlesh Kumar wrote:
> > 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 <sedara@marvell.com>
> > Signed-off-by: Shinas Rasheed <srasheed@marvell.com>
> > Signed-off-by: Vimlesh Kumar <vimleshk@marvell.com>
> > ---
> > V3:
> > - Use reverse christmas tree order variable declaration.
> > - Return error if timeout happens during setup oq.
>
> ...
>
> > diff --git a/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_rx.c
> > b/drivers/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
> *oct, int q_no)
> > goto oq_fill_buff_err;
> >
> > 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;
> > +
>
> Hi Vimlesh, all,
>
> I think that a new label needs to be added to the unwind ladder such that
> octep_vf_oq_free_ring_buffers() is called if the error condition above is met.
>
> Likewise in patch 2/3.
Hi Simon,
octep_vf_oq_free_ring_buffers() is being called from the caller function octep_vf_setup_oqs() in the error case and hence not required over here.
Thanks
>
> Flagged by Claude Code with Review Prompts[1]
>
> [1] https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__github.com_masoncl_review-
> 2Dprompts_&d=DwIBAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=bhf3N5Cr9NFbZwl
> a6EbZhYpRHhQzfrqxMipYIZpCMYA&m=FfpYblNbMkIojadKLj-GdBWB6u-
> Fb6osfQGlrjmP0PqQ9rhSeXbkGuz1wCiBQ4E3&s=G-Y_oT4DW9Z5J8Wc-e-
> XXQRgVCn_9DXTCDuknMqHrlI&e=
>
> > oct->num_oqs++;
> >
> > return 0;
>
> --
> pw-bot: cr
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [EXTERNAL] Re: [PATCH net v3 3/3] octeon_ep_vf: ensure dbell BADDR updation
2026-01-15 9:34 ` [EXTERNAL] " Vimlesh Kumar
@ 2026-01-15 13:46 ` Simon Horman
0 siblings, 0 replies; 7+ messages in thread
From: Simon Horman @ 2026-01-15 13:46 UTC (permalink / raw)
To: Vimlesh Kumar
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Sathesh B Edara, Shinas Rasheed, Haseeb Gani,
Veerasenareddy Burru, Satananda Burla, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
On Thu, Jan 15, 2026 at 09:34:23AM +0000, Vimlesh Kumar wrote:
>
>
> > -----Original Message-----
> > From: Simon Horman <horms@kernel.org>
> > Sent: Monday, January 12, 2026 8:10 PM
> > To: Vimlesh Kumar <vimleshk@marvell.com>
> > Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org; Sathesh B Edara
> > <sedara@marvell.com>; Shinas Rasheed <srasheed@marvell.com>; Haseeb
> > Gani <hgani@marvell.com>; Veerasenareddy Burru <vburru@marvell.com>;
> > Satananda Burla <sburla@marvell.com>; Andrew Lunn
> > <andrew+netdev@lunn.ch>; David S. Miller <davem@davemloft.net>; Eric
> > Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo
> > Abeni <pabeni@redhat.com>
> > Subject: [EXTERNAL] Re: [PATCH net v3 3/3] octeon_ep_vf: ensure dbell
> > BADDR updation
> >
> > On Wed, Jan 07, 2026 at 01: 18: 56PM +0000, Vimlesh Kumar wrote: > 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
> > On Wed, Jan 07, 2026 at 01:18:56PM +0000, Vimlesh Kumar wrote:
> > > 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 <sedara@marvell.com>
> > > Signed-off-by: Shinas Rasheed <srasheed@marvell.com>
> > > Signed-off-by: Vimlesh Kumar <vimleshk@marvell.com>
> > > ---
> > > V3:
> > > - Use reverse christmas tree order variable declaration.
> > > - Return error if timeout happens during setup oq.
> >
> > ...
> >
> > > diff --git a/drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_rx.c
> > > b/drivers/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
> > *oct, int q_no)
> > > goto oq_fill_buff_err;
> > >
> > > 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;
> > > +
> >
> > Hi Vimlesh, all,
> >
> > I think that a new label needs to be added to the unwind ladder such that
> > octep_vf_oq_free_ring_buffers() is called if the error condition above is met.
> >
> > Likewise in patch 2/3.
>
> Hi Simon,
>
> octep_vf_oq_free_ring_buffers() is being called from the caller function octep_vf_setup_oqs() in the error case and hence not required over here.
Ok. I'm not a big fan of asymmetric clean-up paths.
But I agree that would prevent leaks.
...
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-01-15 13:46 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-07 13:18 [PATCH net v3 0/3] disable interrupts and ensure dbell updation Vimlesh Kumar
2026-01-07 13:18 ` [PATCH net v3 1/3] octeon_ep: disable per ring interrupts Vimlesh Kumar
2026-01-07 13:18 ` [PATCH net v3 2/3] octeon_ep: ensure dbell BADDR updation Vimlesh Kumar
2026-01-07 13:18 ` [PATCH net v3 3/3] octeon_ep_vf: " Vimlesh Kumar
2026-01-12 14:39 ` Simon Horman
2026-01-15 9:34 ` [EXTERNAL] " Vimlesh Kumar
2026-01-15 13:46 ` Simon Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox