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]
Date: Tue, 25 Jun 2024 17:18:34 -0400
From: Joe Damato <jdamato@...tly.com>
To: Alexander Duyck <alexander.duyck@...il.com>
Cc: netdev@...r.kernel.org, Alexander Duyck <alexanderduyck@...com>,
	kuba@...nel.org, davem@...emloft.net, pabeni@...hat.com
Subject: Re: [net-next PATCH v2 07/15] eth: fbnic: Allocate a netdevice and
 napi vectors with queues

On Tue, Jun 25, 2024 at 07:36:03AM -0700, Alexander Duyck wrote:
> From: Alexander Duyck <alexanderduyck@...com>

[...]

> +int fbnic_alloc_napi_vectors(struct fbnic_net *fbn)
> +{
> +	unsigned int txq_idx = 0, rxq_idx = 0, v_idx = FBNIC_NON_NAPI_VECTORS;
> +	unsigned int num_tx = fbn->num_tx_queues;
> +	unsigned int num_rx = fbn->num_rx_queues;
> +	unsigned int num_napi = fbn->num_napi;
> +	struct fbnic_dev *fbd = fbn->fbd;
> +	int err;
> +
> +	/* Allocate 1 Tx queue per napi vector */
> +	if (num_napi < FBNIC_MAX_TXQS && num_napi == num_tx + num_rx) {
> +		while (num_tx) {
> +			err = fbnic_alloc_napi_vector(fbd, fbn,
> +						      num_napi, v_idx,
> +						      1, txq_idx, 0, 0);
> +			if (err)
> +				goto free_vectors;
> +
> +			/* Update counts and index */
> +			num_tx--;
> +			txq_idx++;
> +
> +			v_idx++;
> +		}
> +	}
> +
> +	/* Allocate Tx/Rx queue pairs per vector, or allocate remaining Rx */
> +	while (num_rx | num_tx) {
> +		int tqpv = DIV_ROUND_UP(num_tx, num_napi - txq_idx);
> +		int rqpv = DIV_ROUND_UP(num_rx, num_napi - rxq_idx);
> +
> +		err = fbnic_alloc_napi_vector(fbd, fbn, num_napi, v_idx,
> +					      tqpv, txq_idx, rqpv, rxq_idx);

Mostly a nit / suggestion (and not a reason to hold this back): In
the future, adding support for netif_queue_set_napi would be great,
as would netif_napi_set_irq.

Apologies if you've already added that in a future patch that I
missed.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ