All pastes #595273 Raw Edit

Stuff

public text v1 · immutable
#595273 ·published 2007-06-29 12:39 UTC
rendered paste body
--- r8169.c     2007-05-02 00:06:22.000000000 +0200
+++ r8169.c.new 2007-06-29 14:38:42.000000000 +0200
@@ -68,6 +68,9 @@

 #include <asm/io.h>
 #include <asm/irq.h>
+#include <asm/unaligned.h>
+
+#define PKT_ALIGN 1

 #ifdef CONFIG_R8169_NAPI
 #define NAPI_SUFFIX    "-NAPI"
@@ -223,7 +226,9 @@

 MODULE_DEVICE_TABLE(pci, rtl8169_pci_tbl);

+#ifndef PKG_ALIGN
 static int rx_copybreak = 200;
+#endif
 static int use_dac;
 static struct {
        u32 msg_enable;
@@ -463,8 +468,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).");
+#ifndef PKT_ALIGN
 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);
@@ -2493,6 +2500,9 @@
 {
        unsigned int cur_rx, rx_left;
        unsigned int delta, count;
+#ifdef PKT_ALIGN
+       int i;
+#endif

        assert(dev != NULL);
        assert(tp != NULL);
@@ -2561,6 +2571,15 @@
                        pci_action(tp->pci_dev, le64_to_cpu(desc->addr),
                                   tp->rx_buf_sz, PCI_DMA_FROMDEVICE);

+#ifdef PKT_ALIGN
+                       /* 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;
+#endif
+
                        skb->dev = dev;
                        skb_put(skb, pkt_size);
                        skb->protocol = eth_type_trans(skb, dev);