[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#430934: (no subject)



Looking at similar things that were done for the Tulip driver, and also for 
Via-rhine, here comes a patch that fixes the bug. This patch will be sent to 
the netdev mailing-list as well.
--
-- 
Cordialement, Florian Fainelli
---------------------------------------------
--- drivers/net/r8169.c.old	2007-07-06 12:30:10.000000000 +0200
+++ drivers/net/r8169.c	2007-07-06 12:28:58.000000000 +0200
@@ -68,6 +68,7 @@
 
 #include <asm/io.h>
 #include <asm/irq.h>
+#include <asm/unaligned.h>
 
 #ifdef CONFIG_R8169_NAPI
 #define NAPI_SUFFIX	"-NAPI"
@@ -223,7 +224,9 @@
 
 MODULE_DEVICE_TABLE(pci, rtl8169_pci_tbl);
 
+#if !defined(__sparc__)
 static int rx_copybreak = 200;
+#endif
 static int use_dac;
 static struct {
 	u32 msg_enable;
@@ -463,8 +466,10 @@
 MODULE_DESCRIPTION("RealTek RTL-8169 Gigabit Ethernet driver");
 module_param_array(media, int, &num_media, 0);
 MODULE_PARM_DESC(media, "force phy operation. Deprecated by ethtool (8).");
+#if !defined(__sparc__)
 module_param(rx_copybreak, int, 0);
 MODULE_PARM_DESC(rx_copybreak, "Copy breakpoint for copy-only-tiny-frames");
+#endif
 module_param(use_dac, int, 0);
 MODULE_PARM_DESC(use_dac, "Enable PCI DAC. Unsafe on 32 bit PCI slot.");
 module_param_named(debug, debug.msg_enable, int, 0);
@@ -2472,10 +2477,24 @@
 {
 	int ret = -1;
 
-	if (pkt_size < rx_copybreak) {
+#if defined(__sparc__)
+	if (pkt_size) {
 		struct sk_buff *skb;
 
+		skb = dev_alloc_skb(pkt_size + 4);
+		int i;
+		/* align the data to the ip header - should be faster than copying the entire packet */
+		for (i = pkt_size - (pkt_size % 4); i >= 0; i -= 4) {
+			put_unaligned(*((u32 *) (skb->data + i)), (u32 *) (skb->data + i + 2));
+		}
+		skb->data += 2;
+		skb->tail += 2;
+#else
+	if (pkt_size < rx_copybreak) {
+                struct sk_buff *skb;
+
 		skb = dev_alloc_skb(pkt_size + align);
+#endif
 		if (skb) {
 			skb_reserve(skb, (align - 1) & (u32)skb->data);
 			eth_copy_and_sum(skb, sk_buff[0]->data, pkt_size, 0);

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: