[PATCH net-next 10/15] net: enetc: simplify and rename PSIIER enable/disable helpers
From: <hidden>
Date: 2026-06-05 07:24:00
Also in:
imx, lkml
Subsystem:
freescale enetc ethernet drivers, networking drivers, the rest · Maintainers:
Claudiu Manoil, Vladimir Oltean, Wei Fang, Clark Wang, Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds
From: Wei Fang <wei.fang@nxp.com> The PSIIER register controls two categories of interrupt sources: message-receive (MR) interrupts, which fire when a VF sends a mailbox message to the PSI, and VF FLR interrupts, which fire when a VF performs a Function Level Reset. The current helpers enetc_msg_enable_mr_int() and enetc_msg_disable_mr_int() use a read-modify-write sequence to update only the MR bits in PSIIER, intending to preserve any other bits that may be set. However, VF FLR interrupt support is not yet implemented, so PSIIER only ever holds MR interrupt bits at this point. The read-modify-write is therefore unnecessary overhead. Simplify enetc_disable_psiier_interrupts() to write 0 directly to PSIIER, disabling all interrupt sources at once, and simplify enetc_enable_psiier_interrupts() to write the MR mask directly without reading the current register value first. Rename both helpers from the MR-specific names to names that reflect their true scope, i.e. managing all PSIIER interrupt sources rather than just the MR bits. This prepares the code for a future patch that adds VF FLR interrupt support, at which point enetc_enable_psiier_interrupts() will be extended to also set the corresponding FLR bits. Signed-off-by: Wei Fang <wei.fang@nxp.com> --- .../net/ethernet/freescale/enetc/enetc_msg.c | 30 ++++++++----------- 1 file changed, 12 insertions(+), 18 deletions(-)
diff --git a/drivers/net/ethernet/freescale/enetc/enetc_msg.c b/drivers/net/ethernet/freescale/enetc/enetc_msg.c
index 7dcb1dcdec84..d9560e2c5385 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc_msg.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc_msg.c@@ -11,23 +11,17 @@ ENETC_MSG_CLASS_ID_PERMISSION_DENY) #define ENETC_PF_MSG_SPEED(s) FIELD_PREP(ENETC_PF_MSG_CLASS_CODE, (s)) -static void enetc_msg_disable_mr_int(struct enetc_pf *pf) +static void enetc_disable_psiier_interrupts(struct enetc_pf *pf) { struct enetc_hw *hw = &pf->si->hw; - u32 psiier; - psiier = enetc_rd(hw, ENETC_PSIIER) & ~ENETC_PSIMR_MASK(pf->num_vfs); - - /* disable MR int source(s) */ - enetc_wr(hw, ENETC_PSIIER, psiier); + enetc_wr(hw, ENETC_PSIIER, 0); } -static void enetc_msg_enable_mr_int(struct enetc_pf *pf) +static void enetc_enable_psiier_interrupts(struct enetc_pf *pf) { + u32 psiier = ENETC_PSIMR_MASK(pf->num_vfs); struct enetc_hw *hw = &pf->si->hw; - u32 psiier; - - psiier = enetc_rd(hw, ENETC_PSIIER) | ENETC_PSIMR_MASK(pf->num_vfs); enetc_wr(hw, ENETC_PSIIER, psiier); }
@@ -37,7 +31,7 @@ static irqreturn_t enetc_msg_psi_msix(int irq, void *data) struct enetc_si *si = (struct enetc_si *)data; struct enetc_pf *pf = enetc_si_priv(si); - enetc_msg_disable_mr_int(pf); + enetc_disable_psiier_interrupts(pf); schedule_work(&si->msg_task); return IRQ_HANDLED;
@@ -545,7 +539,7 @@ static void enetc_msg_task(struct work_struct *work) } out: - enetc_msg_enable_mr_int(pf); + enetc_enable_psiier_interrupts(pf); } /* Init */
@@ -620,8 +614,8 @@ static int enetc_msg_psi_init(struct enetc_pf *pf) /* set one IRQ entry for PSI message receive notification (SI int) */ enetc_wr(&si->hw, ENETC_SIMSIVR, ENETC_SI_INT_IDX); - /* enable MR interrupts */ - enetc_msg_enable_mr_int(pf); + /* enable PSIIER interrupts */ + enetc_enable_psiier_interrupts(pf); return 0;
@@ -637,16 +631,16 @@ static void enetc_msg_psi_free(struct enetc_pf *pf) struct enetc_si *si = pf->si; int i; - /* disable MR interrupts */ - enetc_msg_disable_mr_int(pf); + /* disable PSIIER interrupts */ + enetc_disable_psiier_interrupts(pf); /* de-register message passing interrupt handler */ free_irq(pci_irq_vector(si->pdev, ENETC_SI_INT_IDX), si); cancel_work_sync(&si->msg_task); - /* MR interrupts may be re-enabled by workqueue */ - enetc_msg_disable_mr_int(pf); + /* PSIIER interrupts may be re-enabled by workqueue */ + enetc_disable_psiier_interrupts(pf); for (i = 0; i < pf->num_vfs; i++) enetc_msg_free_mbx(si, i);
--
2.34.1