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: <20220110092224.5a8ecddf@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net>
Date:   Mon, 10 Jan 2022 09:22:24 -0800
From:   Jakub Kicinski <kuba@...nel.org>
To:     Martin Habets <habetsm.xilinx@...il.com>
Cc:     Íñigo Huguet <ihuguet@...hat.com>,
        davem@...emloft.net, ecree.xilinx@...il.com,
        netdev@...r.kernel.org, dinang@...inx.com
Subject: Re: [PATCH net-next] sfc: The size of the RX recycle ring should be
 more flexible

On Mon, 10 Jan 2022 08:58:21 +0000 Martin Habets wrote:
> +static unsigned int efx_ef10_recycle_ring_size(const struct efx_nic *efx)
> +{
> +	unsigned int ret;
> +
> +	/* There is no difference between PFs and VFs. The side is based on
> +	 * the maximum link speed of a given NIC.
> +	 */
> +	switch (efx->pci_dev->device & 0xfff) {
> +	case 0x0903:	/* Farmingdale can do up to 10G */
> +#ifdef CONFIG_PPC64
> +		ret = 4 * EFX_RECYCLE_RING_SIZE_10G;
> +#else
> +		ret = EFX_RECYCLE_RING_SIZE_10G;
> +#endif
> +		break;
> +	case 0x0923:	/* Greenport can do up to 40G */
> +	case 0x0a03:	/* Medford can do up to 40G */
> +#ifdef CONFIG_PPC64
> +		ret = 16 * EFX_RECYCLE_RING_SIZE_10G;
> +#else
> +		ret = 4 * EFX_RECYCLE_RING_SIZE_10G;
> +#endif
> +		break;
> +	default:	/* Medford2 can do up to 100G */
> +		ret = 10 * EFX_RECYCLE_RING_SIZE_10G;
> +	}
> +	return ret;
> +}

Why not factor out the 4x scaling for powerpc outside of the switch?

The callback could return the scaling factor but failing that:

static unsigned int efx_ef10_recycle_ring_size(const struct efx_nic *efx)
{
	unsigned int ret = EFX_RECYCLE_RING_SIZE_10G;;

	/* There is no difference between PFs and VFs. The side is based on
	 * the maximum link speed of a given NIC.
	 */
	switch (efx->pci_dev->device & 0xfff) {
	case 0x0903:	/* Farmingdale can do up to 10G */
		break;
	case 0x0923:	/* Greenport can do up to 40G */
	case 0x0a03:	/* Medford can do up to 40G */
		ret *= 4;
		break;
	default:	/* Medford2 can do up to 100G */
		ret *= 10;
	}

	if (IS_ENABLED(CONFIG_PPC64))
		ret *= 4;

	return ret;
}

Other than that - net-next is closed, please switch to RFC postings
until it opens back up once 5.17-rc1 is cut. Thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ