From patchwork Tue Nov 29 02:33:16 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Herbert X-Patchwork-Id: 128203 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 C7B0F1007D2 for ; Tue, 29 Nov 2011 13:33:26 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752845Ab1K2CdV (ORCPT ); Mon, 28 Nov 2011 21:33:21 -0500 Received: from mail-gx0-f202.google.com ([209.85.161.202]:56668 "EHLO mail-gx0-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751939Ab1K2CdV (ORCPT ); Mon, 28 Nov 2011 21:33:21 -0500 Received: by ggnp2 with SMTP id p2so609679ggn.1 for ; Mon, 28 Nov 2011 18:33:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=beta; h=date:from:to:subject:message-id:user-agent:mime-version :content-type; bh=DKzXGEclYlWtTOot2uvJzU5o9/Bo5Vg+qu0/Ajcp2l4=; b=rDFUvuiyFjQ1mjj3sZL1JLVjM2fvjxPTzsz5Jtogzh1vV5E3VeKLXw4iZPrZF3VKZf 7iQvpIiSN9RiXWZMXjHA== Received: by 10.236.190.200 with SMTP id e48mr4010746yhn.5.1322534000704; Mon, 28 Nov 2011 18:33:20 -0800 (PST) Received: by 10.236.190.200 with SMTP id e48mr4010727yhn.5.1322534000634; Mon, 28 Nov 2011 18:33:20 -0800 (PST) Received: from wpzn4.hot.corp.google.com (216-239-44-65.google.com [216.239.44.65]) by gmr-mx.google.com with ESMTPS id g4si11209553anh.0.2011.11.28.18.33.20 (version=TLSv1/SSLv3 cipher=AES128-SHA); Mon, 28 Nov 2011 18:33:20 -0800 (PST) Received: from wpaz5.hot.corp.google.com (wpaz5.hot.corp.google.com [172.24.198.69]) by wpzn4.hot.corp.google.com (Postfix) with ESMTPS id 8421F1E004D; Mon, 28 Nov 2011 18:33:20 -0800 (PST) Received: from pokey.mtv.corp.google.com (pokey.mtv.corp.google.com [172.18.96.23]) by wpaz5.hot.corp.google.com with ESMTP id pAT2XGbj029617; Mon, 28 Nov 2011 18:33:16 -0800 Received: by pokey.mtv.corp.google.com (Postfix, from userid 60832) id 3864022F044; Mon, 28 Nov 2011 18:33:16 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by pokey.mtv.corp.google.com (Postfix) with ESMTP id 3793622F02E; Mon, 28 Nov 2011 18:33:16 -0800 (PST) Date: Mon, 28 Nov 2011 18:33:16 -0800 (PST) From: Tom Herbert To: davem@davemloft.net, netdev@vger.kernel.org Subject: [PATCH v4 06/10] e1000e: Support for byte queue limits Message-ID: User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Changes to e1000e to use byte queue limits. Signed-off-by: Tom Herbert --- drivers/net/ethernet/intel/e1000e/netdev.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index a5bd7a3..c6e9763 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c @@ -1079,6 +1079,7 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter) unsigned int i, eop; unsigned int count = 0; unsigned int total_tx_bytes = 0, total_tx_packets = 0; + unsigned int bytes_compl = 0, pkts_compl = 0; i = tx_ring->next_to_clean; eop = tx_ring->buffer_info[i].next_to_watch; @@ -1096,6 +1097,10 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter) if (cleaned) { total_tx_packets += buffer_info->segs; total_tx_bytes += buffer_info->bytecount; + if (buffer_info->skb) { + bytes_compl += buffer_info->skb->len; + pkts_compl++; + } } e1000_put_txbuf(adapter, buffer_info); @@ -1114,6 +1119,8 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter) tx_ring->next_to_clean = i; + netdev_completed_queue(netdev, pkts_compl, bytes_compl); + #define TX_WAKE_THRESHOLD 32 if (count && netif_carrier_ok(netdev) && e1000_desc_unused(tx_ring) >= TX_WAKE_THRESHOLD) { @@ -2240,6 +2247,7 @@ static void e1000_clean_tx_ring(struct e1000_adapter *adapter) e1000_put_txbuf(adapter, buffer_info); } + netdev_reset_queue(adapter->netdev); size = sizeof(struct e1000_buffer) * tx_ring->count; memset(tx_ring->buffer_info, 0, size); @@ -5027,6 +5035,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb, /* if count is 0 then mapping error has occurred */ count = e1000_tx_map(adapter, skb, first, max_per_txd, nr_frags, mss); if (count) { + netdev_sent_queue(netdev, skb->len); e1000_tx_queue(adapter, tx_flags, count); /* Make sure there is space in the ring for the next send. */ e1000_maybe_stop_tx(netdev, MAX_SKB_FRAGS + 2);