linux-mips
[Top] [All Lists]

Re: Titan ethernet driver broken

To: TheNop <TheNop@gmx.net>
Subject: Re: Titan ethernet driver broken
From: Manish Lachwani <mlachwani@mvista.com>
Date: Fri, 19 Nov 2004 09:32:00 -0800
Cc: linux-mips@linux-mips.org
In-reply-to: <419D1F76.6010603@gmx.net>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <419D03DE.8090403@gmx.net> <419D04AA.50508@mvista.com> <419D171E.5040507@gmx.net> <419D173E.6050602@mvista.com> <419D1A2D.5000009@gmx.net> <419D1F76.6010603@gmx.net>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.2) Gecko/20040308
Hello !

If you are interested in creating a patch for supporting Titan GE in older Titan versions (1.0 and 1.1), then I have indicated the part of the diffs below that you will need to apply to the current driver

/*
+ * Do the slowpath route. This route is kicked off
+ * when the IP header is misaligned. Grrr ..
+ */
+static int titan_ge_slowpath(struct sk_buff *skb,
+                               titan_ge_packet *packet,
+                               struct net_device *netdev)
+{
+       struct sk_buff *copy_skb;
+
+       copy_skb = dev_alloc_skb(packet->len + 2);
+
+       if (!copy_skb) {
+               dev_kfree_skb_any(packet->skb);
+               return -1;
+       }
+
+       copy_skb->dev = netdev;
+       skb_reserve(copy_skb, 2);
+       skb_put(copy_skb, packet->len);
+
+       memcpy(copy_skb->data, skb->data, packet->len);
+
+       /* Titan supports Rx checksum offload */
+       copy_skb->ip_summed = CHECKSUM_HW;
+       copy_skb->csum = packet->checksum;
+
+       copy_skb->protocol = eth_type_trans(copy_skb, netdev);
+
+       dev_kfree_skb_any(packet->skb);
+#ifdef TITAN_RX_NAPI
+       netif_receive_skb(copy_skb);
+#else
+       netif_rx(copy_skb);
+#endif
+
+       return 0;
+}
+
+/*
  * Threshold beyond which we do the cleaning of
  * Tx queue and new allocation for the Rx
  * queue
@@ -1434,10 +1421,11 @@
titan_ge_eth->rx_ring_skbs--; +#ifdef TITAN_RX_NAPI
                if (--titan_ge_eth->rx_work_limit < 0)
                        break;
                received_packets++;
-
+#endif
                stats->rx_packets++;
                stats->rx_bytes += packet.len;
@@ -1456,36 +1444,41 @@
                 * idea is to cut down the number of checks and improve
                 * the fastpath.
                 */
+               skb_put(skb, packet.len);
- skb_put(skb, packet.len - 2);
-
-               /*
-                * Increment data pointer by two since thats where
-                * the MAC starts
-                */
-               skb_reserve(skb, 2);
-               skb->protocol = eth_type_trans(skb, netdev);
-               netif_receive_skb(skb);
+ if (titan_ge_slowpath(skb, &packet, netdev) < 0) + goto out_next; +#ifdef TITAN_RX_NAPI
                if (titan_ge_eth->rx_threshold > RX_THRESHOLD) {
                        ack = titan_ge_rx_task(netdev, titan_ge_eth);
                        TITAN_GE_WRITE((0x5048 + (port_num << 8)), ack);
                        titan_ge_eth->rx_threshold = 0;
                } else
                        titan_ge_eth->rx_threshold++;
+#else
+               ack = titan_ge_rx_task(netdev, titan_ge_eth);
+               TITAN_GE_WRITE((0x5048 + (port_num << 8)), ack);
+#endif
+out_next:
+
+#ifdef TITAN_RX_NAPI
                if (titan_ge_eth->tx_threshold > TX_THRESHOLD) {
                        titan_ge_eth->tx_threshold = 0;
                        titan_ge_free_tx_queue(titan_ge_eth);
                }
                else
                        titan_ge_eth->tx_threshold++;
+#endif
}
        return received_packets;
 }

Thanks
Manish Lachwani





<Prev in Thread] Current Thread [Next in Thread>