All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	alan@lxorguk.ukuu.org.uk, Francois Romieu <romieu@fr.zoreil.com>,
	hayeswang <hayeswang@realtek.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jonathan Nieder <jrnieder@gmail.com>
Subject: [ 66/84] r8169: Rx FIFO overflow fixes.
Date: Thu, 11 Oct 2012 11:03:50 +0900	[thread overview]
Message-ID: <20121011015428.948327309@linuxfoundation.org> (raw)
In-Reply-To: <20121011015417.017144658@linuxfoundation.org>

3.0-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Francois Romieu <romieu@fr.zoreil.com>

commit 811fd3010cf512f2e23e6c4c912aad54516dc706 upstream.

Realtek has specified that the post 8168c gigabit chips and the post
8105e fast ethernet chips recover automatically from a Rx FIFO overflow.
The driver does not need to clear the RxFIFOOver bit of IntrStatus and
it should rather avoid messing it.

The implementation deserves some explanation:
1. events outside of the intr_event bit mask are now ignored. It enforces
   a no-processing policy for the events that either should not be there
   or should be ignored.

2. RxFIFOOver was already ignored in rtl_cfg_infos[RTL_CFG_1] for the
   whole 8168 line of chips with two exceptions:
   - RTL_GIGA_MAC_VER_22 since b5ba6d12bdac21bc0620a5089e0f24e362645efd
     ("use RxFIFO overflow workaround for 8168c chipset.").
     This one should now be correctly handled.
   - RTL_GIGA_MAC_VER_11 (8168b) which requires a different Rx FIFO
     overflow processing.

   Though it does not conform to Realtek suggestion above, the updated
   driver includes no change for RTL_GIGA_MAC_VER_12 and RTL_GIGA_MAC_VER_17.
   Both are 8168b. RTL_GIGA_MAC_VER_12 is common and a bit old so I'd rather
   wait for experimental evidence that the change suggested by Realtek really
   helps or does not hurt in unexpected ways.

   Removed case statements in rtl8169_interrupt are only 8168 relevant.

3. RxFIFOOver is masked for post 8105e 810x chips, namely the sole 8105e
   (RTL_GIGA_MAC_VER_30) itself.

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: hayeswang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/r8169.c |   54 +++++++++++++++++++++++-----------------------------
 1 file changed, 24 insertions(+), 30 deletions(-)

--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -1088,17 +1088,21 @@ static u8 rtl8168d_efuse_read(void __iom
 	return value;
 }
 
-static void rtl8169_irq_mask_and_ack(void __iomem *ioaddr)
+static void rtl8169_irq_mask_and_ack(struct rtl8169_private *tp)
 {
-	RTL_W16(IntrMask, 0x0000);
+	void __iomem *ioaddr = tp->mmio_addr;
 
-	RTL_W16(IntrStatus, 0xffff);
+	RTL_W16(IntrMask, 0x0000);
+	RTL_W16(IntrStatus, tp->intr_event);
+	RTL_R8(ChipCmd);
 }
 
-static void rtl8169_asic_down(void __iomem *ioaddr)
+static void rtl8169_asic_down(struct rtl8169_private *tp)
 {
+	void __iomem *ioaddr = tp->mmio_addr;
+
 	RTL_W8(ChipCmd, 0x00);
-	rtl8169_irq_mask_and_ack(ioaddr);
+	rtl8169_irq_mask_and_ack(tp);
 	RTL_R16(CPlusCmd);
 }
 
@@ -3817,7 +3821,7 @@ static void rtl8169_hw_reset(struct rtl8
 	void __iomem *ioaddr = tp->mmio_addr;
 
 	/* Disable interrupts */
-	rtl8169_irq_mask_and_ack(ioaddr);
+	rtl8169_irq_mask_and_ack(tp);
 
 	if (tp->mac_version == RTL_GIGA_MAC_VER_27 ||
 	    tp->mac_version == RTL_GIGA_MAC_VER_28 ||
@@ -4284,8 +4288,7 @@ static void rtl_hw_start_8168(struct net
 	RTL_W16(IntrMitigate, 0x5151);
 
 	/* Work around for RxFIFO overflow. */
-	if (tp->mac_version == RTL_GIGA_MAC_VER_11 ||
-	    tp->mac_version == RTL_GIGA_MAC_VER_22) {
+	if (tp->mac_version == RTL_GIGA_MAC_VER_11) {
 		tp->intr_event |= RxFIFOOver | PCSTimeout;
 		tp->intr_event &= ~RxOverflow;
 	}
@@ -4467,6 +4470,11 @@ static void rtl_hw_start_8101(struct net
 	void __iomem *ioaddr = tp->mmio_addr;
 	struct pci_dev *pdev = tp->pci_dev;
 
+	if (tp->mac_version >= RTL_GIGA_MAC_VER_30) {
+		tp->intr_event &= ~RxFIFOOver;
+		tp->napi_event &= ~RxFIFOOver;
+	}
+
 	if (tp->mac_version == RTL_GIGA_MAC_VER_13 ||
 	    tp->mac_version == RTL_GIGA_MAC_VER_16) {
 		int cap = tp->pcie_cap;
@@ -4738,7 +4746,7 @@ static void rtl8169_wait_for_quiescence(
 	/* Wait for any pending NAPI task to complete */
 	napi_disable(&tp->napi);
 
-	rtl8169_irq_mask_and_ack(ioaddr);
+	rtl8169_irq_mask_and_ack(tp);
 
 	tp->intr_mask = 0xffff;
 	RTL_W16(IntrMask, tp->intr_event);
@@ -5200,13 +5208,17 @@ static irqreturn_t rtl8169_interrupt(int
 	 */
 	status = RTL_R16(IntrStatus);
 	while (status && status != 0xffff) {
+		status &= tp->intr_event;
+		if (!status)
+			break;
+
 		handled = 1;
 
 		/* Handle all of the error cases first. These will reset
 		 * the chip, so just exit the loop.
 		 */
 		if (unlikely(!netif_running(dev))) {
-			rtl8169_asic_down(ioaddr);
+			rtl8169_asic_down(tp);
 			break;
 		}
 
@@ -5214,27 +5226,9 @@ static irqreturn_t rtl8169_interrupt(int
 			switch (tp->mac_version) {
 			/* Work around for rx fifo overflow */
 			case RTL_GIGA_MAC_VER_11:
-			case RTL_GIGA_MAC_VER_22:
-			case RTL_GIGA_MAC_VER_26:
 				netif_stop_queue(dev);
 				rtl8169_tx_timeout(dev);
 				goto done;
-			/* Testers needed. */
-			case RTL_GIGA_MAC_VER_17:
-			case RTL_GIGA_MAC_VER_19:
-			case RTL_GIGA_MAC_VER_20:
-			case RTL_GIGA_MAC_VER_21:
-			case RTL_GIGA_MAC_VER_23:
-			case RTL_GIGA_MAC_VER_24:
-			case RTL_GIGA_MAC_VER_27:
-			case RTL_GIGA_MAC_VER_28:
-			case RTL_GIGA_MAC_VER_31:
-			/* Experimental science. Pktgen proof. */
-			case RTL_GIGA_MAC_VER_12:
-			case RTL_GIGA_MAC_VER_25:
-				if (status == RxFIFOOver)
-					goto done;
-				break;
 			default:
 				break;
 			}
@@ -5329,7 +5323,7 @@ static void rtl8169_down(struct net_devi
 
 	spin_lock_irq(&tp->lock);
 
-	rtl8169_asic_down(ioaddr);
+	rtl8169_asic_down(tp);
 	/*
 	 * At this point device interrupts can not be enabled in any function,
 	 * as netif_running is not true (rtl8169_interrupt, rtl8169_reset_task,
@@ -5583,7 +5577,7 @@ static void rtl_shutdown(struct pci_dev
 
 	spin_lock_irq(&tp->lock);
 
-	rtl8169_asic_down(ioaddr);
+	rtl8169_asic_down(tp);
 
 	spin_unlock_irq(&tp->lock);
 



  parent reply	other threads:[~2012-10-11  2:20 UTC|newest]

Thread overview: 87+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-11  2:01 [ 00/84] 3.0.46-stable review Greg Kroah-Hartman
2012-10-11  2:02 ` [ 01/84] mn10300: only add -mmem-funcs to KBUILD_CFLAGS if gcc supports it Greg Kroah-Hartman
2012-10-11  2:02 ` [ 02/84] kbuild: make: fix if_changed when command contains backslashes Greg Kroah-Hartman
2012-10-11  2:02 ` [ 03/84] media: rc: ite-cir: Initialise ite_dev::rdev earlier Greg Kroah-Hartman
2012-10-11  2:02 ` [ 04/84] ACPI: run _OSC after ACPI_FULL_INITIALIZATION Greg Kroah-Hartman
2012-10-11  2:02 ` [ 05/84] PCI: acpiphp: check whether _ADR evaluation succeeded Greg Kroah-Hartman
2012-10-11  2:02 ` [ 06/84] lib/gcd.c: prevent possible div by 0 Greg Kroah-Hartman
2012-10-11  2:02 ` [ 07/84] kernel/sys.c: call disable_nonboot_cpus() in kernel_restart() Greg Kroah-Hartman
2012-10-11  2:02 ` [ 08/84] drivers/scsi/atp870u.c: fix bad use of udelay Greg Kroah-Hartman
2012-10-11  2:02 ` [ 09/84] workqueue: add missing smp_wmb() in process_one_work() Greg Kroah-Hartman
2012-10-11  2:02 ` [ 10/84] xfrm: Workaround incompatibility of ESN and async crypto Greg Kroah-Hartman
2012-10-11  2:02 ` [ 11/84] xfrm_user: return error pointer instead of NULL Greg Kroah-Hartman
2012-10-11  2:02 ` [ 12/84] xfrm_user: return error pointer instead of NULL #2 Greg Kroah-Hartman
2012-10-11  2:02 ` [ 13/84] xfrm: fix a read lock imbalance in make_blackhole Greg Kroah-Hartman
2012-10-11  2:02 ` [ 14/84] xfrm_user: fix info leak in copy_to_user_auth() Greg Kroah-Hartman
2012-10-11  2:02 ` [ 15/84] xfrm_user: fix info leak in copy_to_user_state() Greg Kroah-Hartman
2012-10-11  2:03 ` [ 16/84] xfrm_user: fix info leak in copy_to_user_policy() Greg Kroah-Hartman
2012-10-11  2:03 ` [ 17/84] xfrm_user: fix info leak in copy_to_user_tmpl() Greg Kroah-Hartman
2012-10-11  2:03 ` [ 18/84] xfrm_user: dont copy esn replay window twice for new states Greg Kroah-Hartman
2012-10-11  2:03 ` [ 19/84] xfrm_user: ensure user supplied esn replay window is valid Greg Kroah-Hartman
2012-10-11  2:03 ` [ 20/84] net: ethernet: davinci_cpdma: decrease the desc count when cleaning up the remaining packets Greg Kroah-Hartman
2012-10-11  2:03 ` [ 21/84] ixp4xx_hss: fix build failure due to missing linux/module.h inclusion Greg Kroah-Hartman
2012-10-11  2:03 ` [ 22/84] netxen: check for root bus in netxen_mask_aer_correctable Greg Kroah-Hartman
2012-10-11  2:03 ` [ 23/84] net-sched: sch_cbq: avoid infinite loop Greg Kroah-Hartman
2012-10-11  2:03 ` [ 24/84] pkt_sched: fix virtual-start-time update in QFQ Greg Kroah-Hartman
2012-10-11  2:03 ` [ 25/84] sierra_net: Endianess bug fix Greg Kroah-Hartman
2012-10-11  2:03 ` [ 26/84] 8021q: fix mac_len recomputation in vlan_untag() Greg Kroah-Hartman
2012-10-11  2:03 ` [ 27/84] ipv6: release reference of ip6_null_entrys dst entry in __ip6_del_rt Greg Kroah-Hartman
2012-10-11  2:03 ` [ 28/84] tcp: flush DMA queue before sk_wait_data if rcv_wnd is zero Greg Kroah-Hartman
2012-10-11  2:03 ` [ 29/84] sctp: Dont charge for data in sndbuf again when transmitting packet Greg Kroah-Hartman
2012-10-11  2:03 ` [ 30/84] pppoe: drop PPPOX_ZOMBIEs in pppoe_release Greg Kroah-Hartman
2012-10-11  2:03 ` [ 31/84] net: small bug on rxhash calculation Greg Kroah-Hartman
2012-10-11  2:03 ` [ 32/84] net: guard tcp_set_keepalive() to tcp sockets Greg Kroah-Hartman
2012-10-11  2:03 ` [ 33/84] ipv4: raw: fix icmp_filter() Greg Kroah-Hartman
2012-10-11  2:03 ` [ 34/84] ipv6: raw: fix icmpv6_filter() Greg Kroah-Hartman
2012-10-11  2:03 ` [ 35/84] ipv6: mip6: fix mip6_mh_filter() Greg Kroah-Hartman
2012-10-11  2:03 ` [ 36/84] l2tp: fix a typo in l2tp_eth_dev_recv() Greg Kroah-Hartman
2012-10-11  2:03 ` [ 37/84] netrom: copy_datagram_iovec can fail Greg Kroah-Hartman
2012-10-11  2:03 ` [ 38/84] net: do not disable sg for packets requiring no checksum Greg Kroah-Hartman
2012-10-11  2:03 ` [ 39/84] aoe: assert AoE packets marked as " Greg Kroah-Hartman
2012-10-11  2:03 ` [ 40/84] tg3: Fix TSO CAP for 5704 devs w / ASF enabled Greg Kroah-Hartman
2012-10-11  2:03 ` [ 41/84] SCSI: zfcp: Make trace record tags unique Greg Kroah-Hartman
2012-10-11  2:03 ` [ 42/84] SCSI: zfcp: Do not wakeup while suspended Greg Kroah-Hartman
2012-10-11  2:03 ` [ 43/84] SCSI: zfcp: remove invalid reference to list iterator variable Greg Kroah-Hartman
2012-10-11  2:03 ` [ 44/84] SCSI: zfcp: restore refcount check on port_remove Greg Kroah-Hartman
2012-10-11  2:03 ` [ 45/84] SCSI: zfcp: only access zfcp_scsi_dev for valid scsi_device Greg Kroah-Hartman
2012-10-11  2:03 ` [ 46/84] PCI: Check P2P bridge for invalid secondary/subordinate range Greg Kroah-Hartman
2012-10-11  2:03 ` [ 47/84] ext4: online defrag is not supported for journaled files Greg Kroah-Hartman
2012-10-11  2:03 ` [ 48/84] ext4: always set i_op in ext4_mknod() Greg Kroah-Hartman
2012-10-11  2:03 ` [ 49/84] ext4: fix fdatasync() for files with only i_size changes Greg Kroah-Hartman
2012-10-11  2:03 ` [ 50/84] ASoC: wm9712: Fix name of Capture Switch Greg Kroah-Hartman
2012-10-11  2:03 ` [ 51/84] mm: fix invalidate_complete_page2() lock ordering Greg Kroah-Hartman
2012-10-11  2:03 ` [ 52/84] mm: thp: fix pmd_present for split_huge_page and PROT_NONE with THP Greg Kroah-Hartman
2012-10-11  2:03 ` [ 53/84] ALSA: aloop - add locking to timer access Greg Kroah-Hartman
2012-10-11  2:03 ` [ 54/84] ALSA: usb - disable broken hw volume for Tenx TP6911 Greg Kroah-Hartman
2012-10-11  2:03 ` [ 55/84] ALSA: USB: Support for (original) Xbox Communicator Greg Kroah-Hartman
2012-10-11  2:03 ` [ 56/84] drm/radeon: only adjust default clocks on NI GPUs Greg Kroah-Hartman
2012-10-11  2:03 ` [ 57/84] drm/radeon: Add MSI quirk for gateway RS690 Greg Kroah-Hartman
2012-10-11  2:03 ` [ 58/84] drm/radeon: force MSIs on RS690 asics Greg Kroah-Hartman
2012-10-11  2:03 ` [ 59/84] rcu: Fix day-one dyntick-idle stall-warning bug Greg Kroah-Hartman
2012-10-11  2:03 ` [ 60/84] r8169: fix wake on lan setting for non-8111E Greg Kroah-Hartman
2012-10-11  7:15   ` Jonathan Nieder
2012-10-11 10:59     ` Greg Kroah-Hartman
2012-10-11  2:03 ` [ 61/84] r8169: dont enable rx when shutdown Greg Kroah-Hartman
2012-10-11  2:03 ` [ 62/84] r8169: remove erroneous processing of always set bit Greg Kroah-Hartman
2012-10-11  2:03 ` [ 63/84] r8169: jumbo fixes Greg Kroah-Hartman
2012-10-11  2:03 ` [ 64/84] r8169: expand received packet length indication Greg Kroah-Hartman
2012-10-11  2:03 ` [ 65/84] r8169: increase the delay parameter of pm_schedule_suspend Greg Kroah-Hartman
2012-10-11  2:03 ` Greg Kroah-Hartman [this message]
2012-10-11  2:03 ` [ 67/84] r8169: fix Config2 MSIEnable bit setting Greg Kroah-Hartman
2012-10-11  2:03 ` [ 68/84] r8169: missing barriers Greg Kroah-Hartman
2012-10-11  2:03 ` [ 69/84] r8169: runtime resume before shutdown Greg Kroah-Hartman
2012-10-11  2:03 ` [ 70/84] r8169: Config1 is read-only on 8168c and later Greg Kroah-Hartman
2012-10-11  2:03 ` [ 71/84] r8169: 8168c and later require bit 0x20 to be set in Config2 for PME signaling Greg Kroah-Hartman
2012-10-11  2:03 ` [ 72/84] r8169: fix unsigned int wraparound with TSO Greg Kroah-Hartman
2012-10-11  2:03 ` [ 73/84] r8169: call netif_napi_del at errpaths and at driver unload Greg Kroah-Hartman
2012-10-11  2:03 ` [ 74/84] revert "mm: mempolicy: Let vma_merge and vma_split handle vma->vm_policy linkages" Greg Kroah-Hartman
2012-10-11  2:03 ` [ 75/84] mempolicy: remove mempolicy sharing Greg Kroah-Hartman
2012-10-11  2:04 ` [ 76/84] mempolicy: fix a race in shared_policy_replace() Greg Kroah-Hartman
2012-10-11  2:04 ` [ 77/84] mempolicy: fix refcount leak in mpol_set_shared_policy() Greg Kroah-Hartman
2012-10-11  2:04 ` [ 78/84] mempolicy: fix a memory corruption by refcount imbalance in alloc_pages_vma() Greg Kroah-Hartman
2012-10-11  2:04 ` [ 79/84] CPU hotplug, cpusets, suspend: Dont modify cpusets during suspend/resume Greg Kroah-Hartman
2012-10-11  2:04 ` [ 80/84] mtd: autcpu12-nvram: Fix compile breakage Greg Kroah-Hartman
2012-10-11  2:04 ` [ 81/84] mtd: nandsim: bugfix: fail if overridesize is too big Greg Kroah-Hartman
2012-10-11  2:04 ` [ 82/84] mtd: nand: Use the mirror BBT descriptor when reading its version Greg Kroah-Hartman
2012-10-11  2:04 ` [ 83/84] mtd: omap2: fix omap_nand_remove segfault Greg Kroah-Hartman
2012-10-11  2:04 ` [ 84/84] mtd: omap2: fix module loading Greg Kroah-Hartman

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=20121011015428.948327309@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=davem@davemloft.net \
    --cc=hayeswang@realtek.com \
    --cc=jrnieder@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=romieu@fr.zoreil.com \
    --cc=stable@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.