From patchwork Thu Feb 23 13:34:27 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yevgeny Petrilin X-Patchwork-Id: 142615 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 45942B6EE8 for ; Fri, 24 Feb 2012 00:35:32 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755197Ab2BWNf3 (ORCPT ); Thu, 23 Feb 2012 08:35:29 -0500 Received: from eu1sys200aog109.obsmtp.com ([207.126.144.127]:38041 "HELO eu1sys200aog109.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1754195Ab2BWNf2 (ORCPT ); Thu, 23 Feb 2012 08:35:28 -0500 Received: from MTLCAS02.mtl.com ([194.90.237.34]) (using TLSv1) by eu1sys200aob109.postini.com ([207.126.147.11]) with SMTP ID DSNKT0ZAndNus64UTQpioP80Eg09CoYEIeBz@postini.com; Thu, 23 Feb 2012 13:35:27 UTC Received: from [10.4.45.17] (10.0.13.1) by MTLCAS02.mtl.com (10.0.8.72) with Microsoft SMTP Server id 14.2.247.3; Thu, 23 Feb 2012 15:34:27 +0200 Message-ID: <4F464063.1010001@mellanox.co.il> Date: Thu, 23 Feb 2012 15:34:27 +0200 From: Yevgeny Petrilin User-Agent: Thunderbird 2.0.0.17 (X11/20080914) MIME-Version: 1.0 To: CC: , Subject: [PATCH net-next 2/3] mlx4_en: moderate frequency of TX completions X-Originating-IP: [10.0.13.1] Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org No need to ask for completion for every packet being sent. So the method is to ask for a completion every 16 packets, or when the queue is about to be full. Signed-off-by: Yevgeny Petrilin --- drivers/net/ethernet/mellanox/mlx4/en_tx.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c index ff32505..e452bba 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c @@ -615,6 +615,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) int lso_header_size; void *fragptr; bool bounce = false; + int ring_busy; if (!priv->port_up) goto tx_drop; @@ -638,8 +639,8 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) vlan_tag = vlan_tx_tag_get(skb); /* Check available TXBBs And 2K spare for prefetch */ - if (unlikely(((int)(ring->prod - ring->cons)) > - ring->size - HEADROOM - MAX_DESC_TXBBS)) { + ring_busy = (int)(ring->prod - ring->cons) - (ring->size - HEADROOM - MAX_DESC_TXBBS); + if (unlikely(ring_busy > 0)) { /* every full Tx ring stops queue */ netif_tx_stop_queue(netdev_get_tx_queue(dev, tx_ind)); ring->blocked = 1; @@ -680,6 +681,8 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) !!vlan_tx_tag_present(skb); tx_desc->ctrl.fence_size = (real_size / 16) & 0x3f; tx_desc->ctrl.srcrb_flags = priv->ctrl_flags; + if (!(!(index & 0xf) || vlan_tag || (ring_busy > -MAX_DESC_TXBBS))) + tx_desc->ctrl.srcrb_flags &= cpu_to_be32(~MLX4_WQE_CTRL_CQ_UPDATE); if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { tx_desc->ctrl.srcrb_flags |= cpu_to_be32(MLX4_WQE_CTRL_IP_CSUM | MLX4_WQE_CTRL_TCP_UDP_CSUM);