Re: [PATCH net-next v2 10/14] octeontx2-pf: ipsec: Handle NPA threshold interrupt
From: Tanmay Jagdale <hidden>
Date: 2025-07-10 08:43:00
Also in:
linux-crypto
Hi Simon, On 2025-06-20 at 16:30:38, Simon Horman (horms@kernel.org) wrote:
On Wed, Jun 18, 2025 at 05:00:04PM +0530, Tanmay Jagdale wrote:quoted
The NPA Aura pool that is dedicated for 1st pass inline IPsec flows raises an interrupt when the buffers of that aura_id drop below a threshold value. Add the following changes to handle this interrupt - Increase the number of MSIX vectors requested for the PF/VF to include NPA vector. - Create a workqueue (refill_npa_inline_ipsecq) to allocate and refill buffers to the pool. - When the interrupt is raised, schedule the workqueue entry, cn10k_ipsec_npa_refill_inb_ipsecq(), where the current count of consumed buffers is determined via NPA_LF_AURA_OP_CNT and then replenished. Signed-off-by: Tanmay Jagdale <redacted> --- Changes in V2: - Fixed sparse warnings V1 Link: https://lore.kernel.org/netdev/20250502132005.611698-12-tanmay@marvell.com/ (local) .../marvell/octeontx2/nic/cn10k_ipsec.c | 94 ++++++++++++++++++- .../marvell/octeontx2/nic/cn10k_ipsec.h | 1 + .../ethernet/marvell/octeontx2/nic/otx2_pf.c | 4 + .../ethernet/marvell/octeontx2/nic/otx2_reg.h | 2 + .../ethernet/marvell/octeontx2/nic/otx2_vf.c | 4 + 5 files changed, 104 insertions(+), 1 deletion(-)diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.c b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.c...quoted
static int cn10k_inb_cpt_init(struct net_device *netdev) { struct otx2_nic *pfvf = netdev_priv(netdev); - int ret = 0; + int ret = 0, vec; + char *irq_name; + void *ptr; + u64 val; ret = cn10k_ipsec_setup_nix_rx_hw_resources(pfvf); if (ret) {@@ -528,6 +587,34 @@ static int cn10k_inb_cpt_init(struct net_device *netdev) return ret; } + /* Work entry for refilling the NPA queue for ingress inline IPSec */ + INIT_WORK(&pfvf->ipsec.refill_npa_inline_ipsecq, + cn10k_ipsec_npa_refill_inb_ipsecq); + + /* Register NPA interrupt */ + vec = pfvf->hw.npa_msixoff; + irq_name = &pfvf->hw.irq_name[vec * NAME_SIZE]; + snprintf(irq_name, NAME_SIZE, "%s-npa-qint", pfvf->netdev->name); + + ret = request_irq(pci_irq_vector(pfvf->pdev, vec), + cn10k_ipsec_npa_inb_ipsecq_intr_handler, 0, + irq_name, pfvf); + if (ret) { + dev_err(pfvf->dev, + "RVUPF%d: IRQ registration failed for NPA QINT\n", + rvu_get_pf(pfvf->pdev, pfvf->pcifunc)); + return ret; + } + + /* Enable NPA threshold interrupt */ + ptr = otx2_get_regaddr(pfvf, NPA_LF_AURA_OP_INT);Hi Tanmay,
Hi Simon,
ptr is set but otherwise unused in this function. Probably it should be removed.
ACK. ptr is unused and I have removed it for the next version.
Flagged by clang and gcc with -Wunused-but-set-variable Also, Sparse warns that the return type of otx2_get_regaddr() is void __iomem *, but ptr does not have an __iomem annotation.
With Regards, Tanmay
quoted
+ val = BIT_ULL(43) | BIT_ULL(17); + otx2_write64(pfvf, NPA_LF_AURA_OP_INT, + ((u64)pfvf->ipsec.inb_ipsec_pool << 44) | val); + + /* Enable interrupt */ + otx2_write64(pfvf, NPA_LF_QINTX_ENA_W1S(0), BIT_ULL(0)); + return ret; }