Skip to contentSkip to conversation

work around 5701 misalignment

PATCH In review Jesse Barnes 3 participants 3 messages Oct 13, 2004 – Oct 20, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 work around 5701 misalignment

This patch helps deal with 5701s running in PCI-X mode on platforms (like ia64) where unaligned accesses are very expensive. It was made a config option at davem's request, afaik, and only affects 5701s when enabled. Patch originally by John Partridge.

Thanks,
Jesse

===========================================================================
linux/drivers/net/Kconfig
===========================================================================

linux/drivers/net/Kconfig +9 -0
@@ -2062,6 +2062,15 @@
 
 endmenu
 
+config UNALIGNED_EXPENSIVE
+	depends on TIGON3
+	bool "Do aligned kernel buffers for PCI-X 5701 Cards"
+	help 
+		This aligns kernel buffers for PCI-X 5701
+		other cards do not have this problem.
+		This will help performance on 5701 cards
+		and not adversly affect any other cards.
+
 #
 #	10 Gigabit Ethernet
 #

===========================================================================
linux/drivers/net/tg3.c
===========================================================================

linux/drivers/net/tg3.c +6 -1
@@ -2352,7 +2352,12 @@
 
 		len = ((desc->idx_len & RXD_LEN_MASK) >> RXD_LEN_SHIFT) - 4; /* omit crc */
 
-		if (len > RX_COPY_THRESHOLD) {
+		if (len > RX_COPY_THRESHOLD
+#if defined(CONFIG_UNALIGNED_EXPENSIVE)
+                                && tp->rx_offset == 2
+#endif
+)
+{
 			int skb_size;
 
 			skb_size = tg3_alloc_rx_skb(tp, opaque_key,
#1 lore raw

linux/drivers/net/tg3.c line 2358

Quoted 11 lines · Jesse Barnes
linux/drivers/net/tg3.c +4 -1
@@ -2352,7 +2352,12 @@
 
 		len = ((desc->idx_len & RXD_LEN_MASK) >> RXD_LEN_SHIFT) - 4; /* omit crc */
 
-		if (len > RX_COPY_THRESHOLD) {
+		if (len > RX_COPY_THRESHOLD
+#if defined(CONFIG_UNALIGNED_EXPENSIVE)
+                                && tp->rx_offset == 2
+#endif

hmmm, the normal solution is to give RX_COPY_THRESHOLD a per-arch value.
Grep for 'rx_copybreak' in bunches of net drivers.

DaveM might squirm a bit but IMHO RX_COPY_THRESHOLD really is platform-dependent.

Jeff

maintainer
#2 lore raw
Quoted 2 lines · On Wed, 13 Oct 2004 16:57:28 -0400 Jeff Garzik <[email protected]> wrote:

DaveM might squirm a bit but IMHO RX_COPY_THRESHOLD really is platform-dependent.

I'm not totally against such an idea.
We have something similar already in the form
of NET_IP_ALIGN which ppc64 overrides.