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: <6c788136-514a-429b-8a0c-db37849601a1@intel.com>
Date: Fri, 20 Dec 2024 14:49:02 +0100
From: Przemek Kitszel <przemyslaw.kitszel@...el.com>
To: Jakub Kicinski <kuba@...nel.org>
CC: <netdev@...r.kernel.org>, <edumazet@...gle.com>, <pabeni@...hat.com>,
	<davem@...emloft.net>
Subject: Re: [PATCH net-next 10/10] eth: fbnic: support ring channel set while
 up

On 12/20/24 03:52, Jakub Kicinski wrote:
> Implement the channel count changes. Copy the netdev priv,
> allocate new channels using it. Stop, swap, start.
> Then free the copy of the priv along with the channels it
> holds, which are now the channels that used to be on the
> real priv.
> 
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
> ---
>   drivers/net/ethernet/meta/fbnic/fbnic.h       |   1 +
>   .../net/ethernet/meta/fbnic/fbnic_ethtool.c   | 121 +++++++++++++++++-
>   drivers/net/ethernet/meta/fbnic/fbnic_irq.c   |  11 ++
>   .../net/ethernet/meta/fbnic/fbnic_netdev.h    |   1 +
>   drivers/net/ethernet/meta/fbnic/fbnic_pci.c   |   2 +-
>   drivers/net/ethernet/meta/fbnic/fbnic_txrx.c  |   8 +-
>   drivers/net/ethernet/meta/fbnic/fbnic_txrx.h  |   5 +
>   7 files changed, 143 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/meta/fbnic/fbnic.h b/drivers/net/ethernet/meta/fbnic/fbnic.h

Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@...el.com>

very nice, refreshing and inspirational design

> +static struct fbnic_net *fbnic_clone_create(struct fbnic_net *orig)
> +{
> +	struct fbnic_net *clone;
> +
> +	clone = kmemdup(orig, sizeof(*orig), GFP_KERNEL);
> +	if (!clone)
> +		return NULL;
> +
> +	memset(clone->tx, 0, sizeof(clone->tx));
> +	memset(clone->rx, 0, sizeof(clone->rx));
> +	memset(clone->napi, 0, sizeof(clone->napi));
> +	return clone;
> +}
> +
> +static void fbnic_clone_swap_cfg(struct fbnic_net *orig,
> +				 struct fbnic_net *clone)
> +{
> +	swap(clone->rcq_size, orig->rcq_size);
> +	swap(clone->hpq_size, orig->hpq_size);
> +	swap(clone->ppq_size, orig->ppq_size);
> +	swap(clone->txq_size, orig->txq_size);
> +	swap(clone->num_rx_queues, orig->num_rx_queues);
> +	swap(clone->num_tx_queues, orig->num_tx_queues);
> +	swap(clone->num_napi, orig->num_napi);
> +}


> +static void fbnic_clone_swap(struct fbnic_net *orig,
> +			     struct fbnic_net *clone)
> +{
> +	struct fbnic_dev *fbd = orig->fbd;
> +	unsigned int i;
> +
> +	for (i = 0; i < max(clone->num_napi, orig->num_napi); i++)
> +		fbnic_synchronize_irq(fbd, FBNIC_NON_NAPI_VECTORS + i);
> +	for (i = 0; i < orig->num_napi; i++)
> +		fbnic_aggregate_vector_counters(orig, orig->napi[i]);
> +
> +	fbnic_clone_swap_cfg(orig, clone);
> +
> +	for (i = 0; i < ARRAY_SIZE(orig->napi); i++)
> +		swap(clone->napi[i], orig->napi[i]);
> +	for (i = 0; i < ARRAY_SIZE(orig->tx); i++)
> +		swap(clone->tx[i], orig->tx[i]);
> +	for (i = 0; i < ARRAY_SIZE(orig->rx); i++)
> +		swap(clone->rx[i], orig->rx[i]);

I would perhaps move the above 6 lines to fbnic_clone_swap_cfg()

> +}
> +

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ