netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, gospo@redhat.com,
	Bruce Allan <bruce.w.allan@intel.com>,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next-2.6 PATCH 19/23] e1000e: set pm_qos DMA latency requirement per interface when needed
Date: Sat, 21 Nov 2009 01:27:40 -0800	[thread overview]
Message-ID: <20091121092739.5715.56854.stgit@localhost.localdomain> (raw)
In-Reply-To: <20091121092126.5715.41618.stgit@localhost.localdomain>

From: Bruce Allan <bruce.w.allan@intel.com>

It was pointed out a pm_qos DMA latency requirement set when the driver is
loaded when parts that support early receive of jumbo frames are probed
could have that requirement overidden if another part supported by the
driver (one that does not support early receive of jumbo frames) is probed
later.  Change the DMA latency requirement to be per-interface if needed
instead of per driver.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---

 drivers/net/e1000e/netdev.c |   47 ++++++++++++++++++++++++++-----------------
 1 files changed, 28 insertions(+), 19 deletions(-)

diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 25b0ef8..39f01d9 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -2472,21 +2472,23 @@ static void e1000_configure_rx(struct e1000_adapter *adapter)
 	 * packet size is equal or larger than the specified value (in 8 byte
 	 * units), e.g. using jumbo frames when setting to E1000_ERT_2048
 	 */
-	if ((adapter->flags & FLAG_HAS_ERT) &&
-	    (adapter->netdev->mtu > ETH_DATA_LEN)) {
-		u32 rxdctl = er32(RXDCTL(0));
-		ew32(RXDCTL(0), rxdctl | 0x3);
-		ew32(ERT, E1000_ERT_2048 | (1 << 13));
-		/*
-		 * With jumbo frames and early-receive enabled, excessive
-		 * C4->C2 latencies result in dropped transactions.
-		 */
-		pm_qos_update_requirement(PM_QOS_CPU_DMA_LATENCY,
-					  e1000e_driver_name, 55);
-	} else {
-		pm_qos_update_requirement(PM_QOS_CPU_DMA_LATENCY,
-					  e1000e_driver_name,
-					  PM_QOS_DEFAULT_VALUE);
+	if (adapter->flags & FLAG_HAS_ERT) {
+		if (adapter->netdev->mtu > ETH_DATA_LEN) {
+			u32 rxdctl = er32(RXDCTL(0));
+			ew32(RXDCTL(0), rxdctl | 0x3);
+			ew32(ERT, E1000_ERT_2048 | (1 << 13));
+			/*
+			 * With jumbo frames and early-receive enabled,
+			 * excessive C-state transition latencies result in
+			 * dropped transactions.
+			 */
+			pm_qos_update_requirement(PM_QOS_CPU_DMA_LATENCY,
+						  adapter->netdev->name, 55);
+		} else {
+			pm_qos_update_requirement(PM_QOS_CPU_DMA_LATENCY,
+						  adapter->netdev->name,
+						  PM_QOS_DEFAULT_VALUE);
+		}
 	}
 
 	/* Enable Receives */
@@ -2804,6 +2806,12 @@ int e1000e_up(struct e1000_adapter *adapter)
 {
 	struct e1000_hw *hw = &adapter->hw;
 
+	/* DMA latency requirement to workaround early-receive/jumbo issue */
+	if (adapter->flags & FLAG_HAS_ERT)
+		pm_qos_add_requirement(PM_QOS_CPU_DMA_LATENCY,
+		                       adapter->netdev->name,
+				       PM_QOS_DEFAULT_VALUE);
+
 	/* hardware has been reset, we need to reload some things */
 	e1000_configure(adapter);
 
@@ -2864,6 +2872,10 @@ void e1000e_down(struct e1000_adapter *adapter)
 	e1000_clean_tx_ring(adapter);
 	e1000_clean_rx_ring(adapter);
 
+	if (adapter->flags & FLAG_HAS_ERT)
+		pm_qos_remove_requirement(PM_QOS_CPU_DMA_LATENCY,
+		                          adapter->netdev->name);
+
 	/*
 	 * TODO: for power management, we could drop the link and
 	 * pci_disable_device here.
@@ -5363,9 +5375,7 @@ static int __init e1000_init_module(void)
 	printk(KERN_INFO "%s: Copyright (c) 1999 - 2009 Intel Corporation.\n",
 	       e1000e_driver_name);
 	ret = pci_register_driver(&e1000_driver);
-	pm_qos_add_requirement(PM_QOS_CPU_DMA_LATENCY, e1000e_driver_name,
-			       PM_QOS_DEFAULT_VALUE);
-				
+
 	return ret;
 }
 module_init(e1000_init_module);
@@ -5379,7 +5389,6 @@ module_init(e1000_init_module);
 static void __exit e1000_exit_module(void)
 {
 	pci_unregister_driver(&e1000_driver);
-	pm_qos_remove_requirement(PM_QOS_CPU_DMA_LATENCY, e1000e_driver_name);
 }
 module_exit(e1000_exit_module);
 


  parent reply	other threads:[~2009-11-21  9:27 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-21  9:22 [net-next-2.6 PATCH 01/23] e1000e: check WoL mode is among set of supported modes Jeff Kirsher
2009-11-21  9:22 ` [net-next-2.6 PATCH 02/23] e1000e: add missing tests for 82583 in ethtool functions Jeff Kirsher
2009-11-21  9:22 ` [net-next-2.6 PATCH 03/23] e1000e: clearing interrupt timers causes descriptors to get flushed Jeff Kirsher
2009-11-21  9:22 ` [net-next-2.6 PATCH 04/23] e1000e: function pointers for ethtool set/get offloads Jeff Kirsher
2009-11-21  9:23 ` [net-next-2.6 PATCH 05/23] e1000e: don't clean Rx ring while resetting Jeff Kirsher
2009-11-21  9:23 ` [net-next-2.6 PATCH 06/23] e1000e: link reporting problems Jeff Kirsher
2009-11-21  9:23 ` [net-next-2.6 PATCH 07/23] e1000e: improper return code signage Jeff Kirsher
2009-11-21  9:24 ` [net-next-2.6 PATCH 08/23] e1000e: disable K1 on PCH LOM when in PHY loopback mode Jeff Kirsher
2009-11-21  9:24 ` [net-next-2.6 PATCH 09/23] e1000e: Incorrect MII Link beat reporting Jeff Kirsher
2009-11-21  9:24 ` [net-next-2.6 PATCH 10/23] e1000e: cleanup redundant #include's Jeff Kirsher
2009-11-21  9:25 ` [net-next-2.6 PATCH 11/23] e1000e: consolidate two dbug macros into one simpler one Jeff Kirsher
2009-11-21  9:25 ` [net-next-2.6 PATCH 12/23] e1000e: cleanup ops function pointers Jeff Kirsher
2009-11-21  9:25 ` [net-next-2.6 PATCH 13/23] e1000e: update copyright information Jeff Kirsher
2009-11-21  9:26 ` [net-next-2.6 PATCH 14/23] e1000e: remove comments regarding a non-existent api module Jeff Kirsher
2009-11-21  9:26 ` [net-next-2.6 PATCH 15/23] e1000e: provide comment for 82571 workaround Jeff Kirsher
2009-11-21  9:26 ` [net-next-2.6 PATCH 16/23] e1000e: set bools to true/false instead of 1/0 Jeff Kirsher
2009-11-21  9:27 ` [net-next-2.6 PATCH 17/23] e1000e: cleanup - shift indentation left by exiting early in e1000_tso Jeff Kirsher
2009-11-21  9:27 ` [net-next-2.6 PATCH 18/23] e1000e: cleanup functions that clear hardware statistics Jeff Kirsher
2009-11-21  9:27 ` Jeff Kirsher [this message]
2009-11-21  9:27 ` [net-next-2.6 PATCH 20/23] e1000e: do not error out on identification LED init failure Jeff Kirsher
2009-11-21  9:28 ` [net-next-2.6 PATCH 21/23] e1000e: remove redundant might_sleep() Jeff Kirsher
2009-11-21  9:28 ` [net-next-2.6 PATCH 22/23] e1000e: cosmetic - group local variables of the same type Jeff Kirsher
2009-11-21  9:28 ` [net-next-2.6 PATCH 23/23] e1000e: update Tx Unit hang detection message Jeff Kirsher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091121092739.5715.56854.stgit@localhost.localdomain \
    --to=jeffrey.t.kirsher@intel.com \
    --cc=bruce.w.allan@intel.com \
    --cc=davem@davemloft.net \
    --cc=gospo@redhat.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).