Thread (15 messages) 15 messages, 5 authors, 2022-02-02

Re: [PATCH net-next] sfc: The size of the RX recycle ring should be more flexible

From: Jakub Kicinski <kuba@kernel.org>
Date: 2022-01-10 17:22:30

On Mon, 10 Jan 2022 08:58:21 +0000 Martin Habets wrote:
quoted hunk ↗ jump to hunk
+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!
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help