lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250507142016.GF3339421@horms.kernel.org>
Date: Wed, 7 May 2025 15:20:16 +0100
From: Simon Horman <horms@...nel.org>
To: Tanmay Jagdale <tanmay@...vell.com>
Cc: bbrezillon@...nel.org, arno@...isbad.org, schalla@...vell.com,
	herbert@...dor.apana.org.au, davem@...emloft.net,
	sgoutham@...vell.com, lcherian@...vell.com, gakula@...vell.com,
	jerinj@...vell.com, hkelam@...vell.com, sbhatta@...vell.com,
	andrew+netdev@...n.ch, edumazet@...gle.com, kuba@...nel.org,
	pabeni@...hat.com, bbhushan2@...vell.com, bhelgaas@...gle.com,
	pstanner@...hat.com, gregkh@...uxfoundation.org,
	peterz@...radead.org, linux@...blig.org,
	krzysztof.kozlowski@...aro.org, giovanni.cabiddu@...el.com,
	linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org,
	netdev@...r.kernel.org, rkannoth@...vell.com, sumang@...vell.com,
	gcherian@...vell.com
Subject: Re: [net-next PATCH v1 11/15] octeontx2-pf: ipsec: Handle NPA
 threshold interrupt

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@...vell.com>

...

> 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);
> +}

...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ