Patchwork [net] r8169: remove the obsolete and incorrect AMD workaround

login
register
mail settings
Submitter Timo Teräs
Date Jan. 22, 2013, 8:30 a.m.
Message ID <1358843435-24719-1-git-send-email-timo.teras@iki.fi>
Download mbox | patch
Permalink /patch/214467/
State Accepted
Delegated to: David Miller
Headers show

Comments

Timo Teräs - Jan. 22, 2013, 8:30 a.m.
This was introduced in commit 6dccd16 "r8169: merge with version
6.001.00 of Realtek's r8169 driver". I did not find the version
6.001.00 online, but in 6.002.00 or any later r8169 from Realtek
this hunk is no longer present.

Also commit 05af214 "r8169: fix Ethernet Hangup for RTL8110SC
rev d" claims to have fixed this issue otherwise.

The magic compare mask of 0xfffe000 is dubious as it masks
parts of the Reserved part, and parts of the VLAN tag. But this
does not make much sense as the VLAN tag parts are perfectly
valid there. In matter of fact this seems to be triggered with
any VLAN tagged packet as RxVlanTag bit is matched. I would
suspect 0xfffe0000 was intended to test reserved part only.

Finally, this hunk is evil as it can cause more packets to be
handled than what was NAPI quota causing net/core/dev.c:
net_rx_action(): WARN_ON_ONCE(work > weight) to trigger, and
mess up the NAPI state causing device to hang.

As result, any system using VLANs and having high receive
traffic (so that NAPI poll budget limits rtl_rx) would result
in device hang.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
---
I decided to suggest just removal without the suggested WARN_ON_ONCE.
This is because the test is incorrect as explained above, and not
present anywhere else either. Oh yeah, and I'm feeling brave today ;)

If acceptable, this should go to -stable too. The hunk was introduced
in v2.6.23-rc1 and the alternate fix went in to v2.6.32-rc6.

 drivers/net/ethernet/realtek/r8169.c | 7 -------
 1 file changed, 7 deletions(-)
françois romieu - Jan. 23, 2013, 12:05 a.m.
Timo Teräs <timo.teras@iki.fi> :
[...]

Acked-by: Francois Romieu <romieu@fr.zoreil.com>

desc->opts2 is now a bit different in the RxRes path - the only path
where the patch can be noticed. I hope it won't uncloak something else.
David Miller - Jan. 23, 2013, 12:42 a.m.
From: Francois Romieu <romieu@fr.zoreil.com>
Date: Wed, 23 Jan 2013 01:05:41 +0100

> Timo Teräs <timo.teras@iki.fi> :
> [...]
> 
> Acked-by: Francois Romieu <romieu@fr.zoreil.com>
> 
> desc->opts2 is now a bit different in the RxRes path - the only path
> where the patch can be noticed. I hope it won't uncloak something else.

Francois, do you want me to apply this directly or do you want
to submit this yourself along with any other r8169 changes you
might have queued up?

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Timo Teräs - Jan. 23, 2013, 6:14 a.m.
On Wed, 23 Jan 2013 01:05:41 +0100 Francois Romieu
<romieu@fr.zoreil.com> wrote:

> Timo Teräs <timo.teras@iki.fi> :
> [...]
> 
> Acked-by: Francois Romieu <romieu@fr.zoreil.com>
> 
> desc->opts2 is now a bit different in the RxRes path - the only path
> where the patch can be noticed. I hope it won't uncloak something
> else.

I was wondering what you mean by this. But as it seems
rtl8169_rx_vlan_tag() is doing opts2 = 0 in receive path. So the
only effect the workaround would have had was for the error path
packets.

So if this worries you, would it make sense to just unconditionally set
opts2 to zero also in the error path?

Actually, this sounds wrong. Why is rtl8169_rx_vlan_tag() which is
fiddling opts2 invoked *after* rtl8169_mark_to_asic() ? This means it
can overwrite the tag info if the queue is full.

- Timo
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Jan. 23, 2013, 6:52 p.m.
From: Francois Romieu <romieu@fr.zoreil.com>
Date: Wed, 23 Jan 2013 01:05:41 +0100

> Timo Teräs <timo.teras@iki.fi> :
> [...]
> 
> Acked-by: Francois Romieu <romieu@fr.zoreil.com>

No reply, so I am just going to assume you wanted me to integrate
this directly, so I've done so.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index ed96f30..c28bc31 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -6111,13 +6111,6 @@  process_pkt:
 			tp->rx_stats.bytes += pkt_size;
 			u64_stats_update_end(&tp->rx_stats.syncp);
 		}
-
-		/* Work around for AMD plateform. */
-		if ((desc->opts2 & cpu_to_le32(0xfffe000)) &&
-		    (tp->mac_version == RTL_GIGA_MAC_VER_05)) {
-			desc->opts2 = 0;
-			cur_rx++;
-		}
 	}
 
 	count = cur_rx - tp->cur_rx;