netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] mlx4: exploit skb->xmit_more to conditionally send doorbell
@ 2014-09-25 14:17 Eric Dumazet
  2014-09-25 14:43 ` Jesper Dangaard Brouer
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Eric Dumazet @ 2014-09-25 14:17 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Amir Vadai

From: Eric Dumazet <edumazet@google.com>

skb->xmit_more tells us if another skb is coming next.

We need to send doorbell when : xmit_more is not set,
or txqueue is stopped (preventing next skb to come immediately)

Tested with a modified pktgen version, I got a 40% increase of
throughput.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 drivers/net/ethernet/mellanox/mlx4/en_tx.c |   23 +++++++++++++------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
index c44f4237b9be..adedc47e947d 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
@@ -667,6 +667,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
 	int lso_header_size;
 	void *fragptr;
 	bool bounce = false;
+	bool send_doorbell;
 
 	if (!priv->port_up)
 		goto tx_drop;
@@ -878,12 +879,16 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
 
 	skb_tx_timestamp(skb);
 
-	if (ring->bf_enabled && desc_size <= MAX_BF && !bounce && !vlan_tx_tag_present(skb)) {
+	send_doorbell = !skb->xmit_more || netif_xmit_stopped(ring->tx_queue);
+
+	if (ring->bf_enabled && desc_size <= MAX_BF && !bounce &&
+	    !vlan_tx_tag_present(skb) && send_doorbell) {
 		tx_desc->ctrl.bf_qpn |= cpu_to_be32(ring->doorbell_qpn);
 
 		op_own |= htonl((bf_index & 0xffff) << 8);
-		/* Ensure new descirptor hits memory
-		* before setting ownership of this descriptor to HW */
+		/* Ensure new descriptor hits memory
+		 * before setting ownership of this descriptor to HW
+		 */
 		wmb();
 		tx_desc->ctrl.owner_opcode = op_own;
 
@@ -896,12 +901,16 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
 
 		ring->bf.offset ^= ring->bf.buf_size;
 	} else {
-		/* Ensure new descirptor hits memory
-		* before setting ownership of this descriptor to HW */
+		/* Ensure new descriptor hits memory
+		 * before setting ownership of this descriptor to HW
+		 */
 		wmb();
 		tx_desc->ctrl.owner_opcode = op_own;
-		wmb();
-		iowrite32be(ring->doorbell_qpn, ring->bf.uar->map + MLX4_SEND_DOORBELL);
+		if (send_doorbell) {
+			wmb();
+			iowrite32be(ring->doorbell_qpn,
+				    ring->bf.uar->map + MLX4_SEND_DOORBELL);
+		}
 	}
 
 	return NETDEV_TX_OK;

^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2014-09-29 16:27 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-25 14:17 [PATCH net-next] mlx4: exploit skb->xmit_more to conditionally send doorbell Eric Dumazet
2014-09-25 14:43 ` Jesper Dangaard Brouer
2014-09-25 15:06   ` Eric Dumazet
2014-09-25 15:36     ` Eric Dumazet
2014-09-25 15:40       ` Eric Dumazet
2014-09-25 16:19       ` Eric Dumazet
2014-09-25 20:47       ` Eric Dumazet
2014-09-25 20:58         ` Joe Perches
2014-09-25 21:20         ` [PATCH net-next] net: reorganize sk_buff for faster __copy_skb_header() Eric Dumazet
2014-09-26  8:35           ` Jesper Dangaard Brouer
2014-09-28 21:37           ` David Miller
2014-09-29  4:06             ` David Miller
2014-09-29  4:57               ` Eric Dumazet
2014-09-29  5:18           ` [PATCH v2 " Eric Dumazet
2014-09-29 16:27             ` David Miller
2014-09-25 15:53 ` [PATCH net-next] mlx4: exploit skb->xmit_more to conditionally send doorbell Alexei Starovoitov
2014-09-25 16:05   ` Eric Dumazet
2014-09-25 16:08     ` Alexei Starovoitov
2014-09-28 21:27 ` David Miller

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).