On Fri, May 02, 2025 at 06:49:52PM +0530, Tanmay Jagdale wrote: > 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 <tanmay@xxxxxxxxxxx> ... > diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.c b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.c > index b88c1b4c5839..365327ab9079 100644 > --- a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.c > +++ b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_ipsec.c > @@ -519,10 +519,77 @@ static int cn10k_ipsec_setup_nix_rx_hw_resources(struct otx2_nic *pfvf) > return err; > } > > +static void cn10k_ipsec_npa_refill_inb_ipsecq(struct work_struct *work) > +{ > + struct cn10k_ipsec *ipsec = container_of(work, struct cn10k_ipsec, > + refill_npa_inline_ipsecq); > + struct otx2_nic *pfvf = container_of(ipsec, struct otx2_nic, ipsec); > + struct otx2_pool *pool = NULL; > + struct otx2_qset *qset = NULL; > + u64 val, *ptr, op_int = 0, count; > + int err, pool_id, idx; > + dma_addr_t bufptr; > + > + qset = &pfvf->qset; > + > + val = otx2_read64(pfvf, NPA_LF_QINTX_INT(0)); > + if (!(val & 1)) > + return; > + > + ptr = otx2_get_regaddr(pfvf, NPA_LF_AURA_OP_INT); Sparse complains about __iomem annotations around here: .../cn10k_ipsec.c:539:13: warning: incorrect type in assignment (different address spaces) .../cn10k_ipsec.c:539:13: expected unsigned long long [usertype] *ptr .../cn10k_ipsec.c:539:13: got void [noderef] __iomem * .../cn10k_ipsec.c:549:21: warning: incorrect type in assignment (different address spaces) .../cn10k_ipsec.c:549:21: expected unsigned long long [usertype] *ptr .../cn10k_ipsec.c:549:21: got void [noderef] __iomem * .../cn10k_ipsec.c:620:13: warning: incorrect type in assignment (different address spaces) .../cn10k_ipsec.c:620:13: expected void *ptr .../cn10k_ipsec.c:620:13: got void [noderef] __iomem * > + val = otx2_atomic64_add(((u64)pfvf->ipsec.inb_ipsec_pool << 44), ptr); > + > + /* Error interrupt bits */ > + if (val & 0xff) > + op_int = (val & 0xff); > + > + /* Refill buffers on a Threshold interrupt */ > + if (val & (1 << 16)) { > + /* Get the current number of buffers consumed */ > + ptr = otx2_get_regaddr(pfvf, NPA_LF_AURA_OP_CNT); > + count = otx2_atomic64_add(((u64)pfvf->ipsec.inb_ipsec_pool << 44), ptr); > + count &= GENMASK_ULL(35, 0); > + > + /* Refill */ > + pool_id = pfvf->ipsec.inb_ipsec_pool; > + pool = &pfvf->qset.pool[pool_id]; > + > + for (idx = 0; idx < count; idx++) { > + err = otx2_alloc_rbuf(pfvf, pool, &bufptr, pool_id, idx); > + if (err) { > + netdev_err(pfvf->netdev, > + "Insufficient memory for IPsec pool buffers\n"); > + break; > + } > + pfvf->hw_ops->aura_freeptr(pfvf, pool_id, > + bufptr + OTX2_HEAD_ROOM); > + } > + > + op_int |= (1 << 16); > + } > + > + /* Clear/ACK Interrupt */ > + if (op_int) > + otx2_write64(pfvf, NPA_LF_AURA_OP_INT, > + ((u64)pfvf->ipsec.inb_ipsec_pool << 44) | op_int); > +} ...