Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Martin Habets <habetsm.xilinx@gmail.com>
Cc: "Íñigo Huguet" <ihuguet@redhat.com>,
	davem@davemloft.net, ecree.xilinx@gmail.com,
	netdev@vger.kernel.org, dinang@xilinx.com
Subject: Re: [PATCH net-next] sfc: The size of the RX recycle ring should be more flexible
Date: Mon, 10 Jan 2022 09:22:24 -0800	[thread overview]
Message-ID: <20220110092224.5a8ecddf@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net> (raw)
In-Reply-To: <20220110085820.zi73go4etyyrkixr@gmail.com>

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!

  parent reply	other threads:[~2022-01-10 17:22 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-18 15:14 Bad performance in RX with sfc 40G Íñigo Huguet
2021-11-18 17:19 ` Eric Dumazet
2021-12-02 14:26   ` Íñigo Huguet
2021-11-20  8:31 ` Martin Habets
2021-12-09 12:06   ` Íñigo Huguet
2021-12-23 13:18     ` Íñigo Huguet
2022-01-02  9:22       ` Martin Habets
2022-01-10  8:58         ` [PATCH net-next] sfc: The size of the RX recycle ring should be more flexible Martin Habets
2022-01-10  9:31           ` Íñigo Huguet
2022-01-12  9:05             ` Martin Habets
2022-01-31 11:08             ` Martin Habets
2022-01-10 17:22           ` Jakub Kicinski [this message]
2022-01-12  9:08             ` Martin Habets
2022-01-31 11:10           ` [PATCH V2 " Martin Habets
2022-02-02  5:10             ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220110092224.5a8ecddf@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=dinang@xilinx.com \
    --cc=ecree.xilinx@gmail.com \
    --cc=habetsm.xilinx@gmail.com \
    --cc=ihuguet@redhat.com \
    --cc=netdev@vger.kernel.org \
    --subject='Re: [PATCH net-next] sfc: The size of the RX recycle ring should be more flexible' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).