Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3f2aa566 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'mlx4-order-0-allocations-and-page-recycling'

Eric Dumazet says:

====================
mlx4: order-0 allocations and page recycling

As mentioned half a year ago, we better switch mlx4 driver to order-0
allocations and page recycling.

This reduces vulnerability surface thanks to better skb->truesize
tracking and provides better performance in most cases.
(33 Gbit for one TCP flow on my lab hosts)

I will provide for linux-4.13 a patch on top of this series,
trying to improve data locality as described in
https://www.spinics.net/lists/netdev/msg422258.html



v2 provides an ethtool -S new counter (rx_alloc_pages) and
code factorization, plus Tariq fix.

v3 includes various fixes based on Tariq tests and feedback
from Saeed and Tariq.

v4 rebased on net-next for inclusion in linux-4.12, as requested
by Tariq.

Worth noting this patch series deletes ~250 lines of code ;)
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 3c66d1c7 68b8df46
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -117,7 +117,7 @@ static const char main_strings[][ETH_GSTRING_LEN] = {
	/* port statistics */
	"tso_packets",
	"xmit_more",
	"queue_stopped", "wake_queue", "tx_timeout", "rx_alloc_failed",
	"queue_stopped", "wake_queue", "tx_timeout", "rx_alloc_pages",
	"rx_csum_good", "rx_csum_none", "rx_csum_complete", "tx_chksum_offload",

	/* pf statistics */
+2 −0
Original line number Diff line number Diff line
@@ -213,6 +213,7 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset)
	priv->port_stats.rx_chksum_good = 0;
	priv->port_stats.rx_chksum_none = 0;
	priv->port_stats.rx_chksum_complete = 0;
	priv->port_stats.rx_alloc_pages = 0;
	priv->xdp_stats.rx_xdp_drop    = 0;
	priv->xdp_stats.rx_xdp_tx      = 0;
	priv->xdp_stats.rx_xdp_tx_full = 0;
@@ -223,6 +224,7 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset)
		priv->port_stats.rx_chksum_good += READ_ONCE(ring->csum_ok);
		priv->port_stats.rx_chksum_none += READ_ONCE(ring->csum_none);
		priv->port_stats.rx_chksum_complete += READ_ONCE(ring->csum_complete);
		priv->port_stats.rx_alloc_pages += READ_ONCE(ring->rx_alloc_pages);
		priv->xdp_stats.rx_xdp_drop	+= READ_ONCE(ring->xdp_drop);
		priv->xdp_stats.rx_xdp_tx	+= READ_ONCE(ring->xdp_tx);
		priv->xdp_stats.rx_xdp_tx_full	+= READ_ONCE(ring->xdp_tx_full);
+186 −421

File changed.

Preview size limit exceeded, changes collapsed.

+0 −6
Original line number Diff line number Diff line
@@ -81,14 +81,11 @@ static int mlx4_en_test_loopback(struct mlx4_en_priv *priv)
{
	u32 loopback_ok = 0;
	int i;
	bool gro_enabled;

        priv->loopback_ok = 0;
	priv->validate_loopback = 1;
	gro_enabled = priv->dev->features & NETIF_F_GRO;

	mlx4_en_update_loopback_state(priv->dev, priv->dev->features);
	priv->dev->features &= ~NETIF_F_GRO;

	/* xmit */
	if (mlx4_en_test_loopback_xmit(priv)) {
@@ -111,9 +108,6 @@ static int mlx4_en_test_loopback(struct mlx4_en_priv *priv)

	priv->validate_loopback = 0;

	if (gro_enabled)
		priv->dev->features |= NETIF_F_GRO;

	mlx4_en_update_loopback_state(priv->dev, priv->dev->features);
	return !loopback_ok;
}
+1 −3
Original line number Diff line number Diff line
@@ -354,13 +354,11 @@ u32 mlx4_en_recycle_tx_desc(struct mlx4_en_priv *priv,
	struct mlx4_en_rx_alloc frame = {
		.page = tx_info->page,
		.dma = tx_info->map0_dma,
		.page_offset = XDP_PACKET_HEADROOM,
		.page_size = PAGE_SIZE,
	};

	if (!mlx4_en_rx_recycle(ring->recycle_ring, &frame)) {
		dma_unmap_page(priv->ddev, tx_info->map0_dma,
			       PAGE_SIZE, priv->frag_info[0].dma_dir);
			       PAGE_SIZE, priv->dma_dir);
		put_page(tx_info->page);
	}

Loading