summaryrefslogtreecommitdiff
blob: a51f89b995368c7548aaed7528b0c92be5ef032d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
--- ixp400_eth.c
+++ ixp400_eth.c
@@ -128,6 +128,7 @@ static int dev_max_count = 2; /* only NP
 static int dev_max_count = 3; /* all NPEs are used */
 #endif
 
+static int dev_max_count = 1;
 #ifndef CONFIG_IXP400_NAPI
 /* netdev_max_backlog: ideally /proc/sys/net/core/netdev_max_backlog, but any 
  * value > 46 looks to work. This is used to control the maximum number of 
@@ -157,7 +158,11 @@ MODULE_PARM(dev_max_count, "i");
 MODULE_PARM_DESC(dev_max_count, "Number of devices to initialize");
 
 /* devices will be called ixp0 and ixp1 */
+#ifdef IX_DEVICE_NAME_ETH
+#define DEVICE_NAME "eth"
+#else
 #define DEVICE_NAME "ixp"
+#endif
 
 /* boolean values for PHY link speed, duplex, and autonegotiation */
 #define PHY_SPEED_10    0
@@ -347,6 +352,12 @@ static int dev_pmu_timer_init(void);
 extern void 
 ixEthTxFrameDoneQMCallback(IxQMgrQId qId, IxQMgrCallbackId callbackId);
 
+#ifdef CONFIG_NET_POLL_CONTROLLER
+/* poll controller (needed for netconsole et al) */
+static void
+ixp425eth_poll_controller(struct net_device *dev);
+#endif
+
 /* Private device data */
 typedef struct {
     spinlock_t lock;  /* multicast management lock */
@@ -1838,7 +1849,11 @@ static inline void dev_eth_type_trans(un
     skb->len -= header_len;
    
     /* fill the pkt arrival time (set at the irq callback entry) */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
     skb->stamp = irq_stamp;
+#else
+    skb_set_timestamp(skb, &irq_stamp);
+#endif
  
     /* fill the input device field */
     skb->dev = dev;
@@ -2028,6 +2043,16 @@ static void rx_cb(UINT32 callbackTag, IX
 	skb->tail = skb->data + len;
 	skb->len = len;
 	
+#ifndef __ARMEB__
+	{
+	    /* Byte swap all words containing data from the buffer. */
+	    unsigned long *p = (unsigned long*)((unsigned)skb->data & ~0x3);
+	    unsigned long *e = (unsigned long*)(((unsigned)skb->data + skb->len + 3) & ~0x3);
+	    while (p < e)
+		*p = ntohl(*p), ++p;
+	}
+#endif
+	
 #ifdef DEBUG_DUMP
 	skb_dump("rx", skb);
 #endif
@@ -2418,6 +2443,16 @@ static int dev_hard_start_xmit(struct sk
 	return 0;
     }
 
+#ifndef __ARMEB__
+    {
+	/* Byte swap all words containing data from the buffer. */
+	unsigned long *p = (unsigned long*)((unsigned)skb->data & ~0x3);
+	unsigned long *e = (unsigned long*)(((unsigned)skb->data + skb->len + 3) & ~0x3);
+	while (p < e)
+	    *p = ntohl(*p), ++p;
+    }
+#endif
+
 #ifdef DEBUG_DUMP
     skb_dump("tx", skb);
 #endif
@@ -3014,7 +3049,7 @@ static int phy_init(void)
 }
 
 /* set port MAC addr and update the dev struct if successfull */
-int dev_set_mac_address(struct net_device *dev, void *addr)
+static int set_mac_address(struct net_device *dev, void *addr)
 {
     int res;
     IxEthAccMacAddr npeMacAddr;
@@ -3052,6 +3087,19 @@ int dev_set_mac_address(struct net_devic
     return 0;
 }
 
+#ifdef CONFIG_NET_POLL_CONTROLLER
+/*
+ * Polling receive - used by netconsole and other diagnostic tools
+ * to allow network i/o with interrupts disabled.
+ * (stolen from 8139too.c by siddy)
+ */
+static void ixp425eth_poll_controller(struct net_device *dev)
+{
+        disable_irq(dev->irq);
+        dev_qmgr_os_isr(dev->irq, dev, NULL);
+        enable_irq(dev->irq);
+}
+#endif
 
 /* 
  *  TX QDISC
@@ -3241,6 +3289,8 @@ static int __devinit dev_eth_probe(struc
 	kmalloc(sizeof(struct semaphore), GFP_KERNEL);
     if (!priv->maintenanceCheckThreadComplete)
     {
+	P_ERROR("%s: Failed to allocate maintenance semaphore %d\n",
+		ndev->name, priv->port_id);
 	goto error;
     }
     priv->lock = SPIN_LOCK_UNLOCKED;
@@ -3265,8 +3315,11 @@ static int __devinit dev_eth_probe(struc
     ndev->get_stats = dev_get_stats;
     ndev->set_multicast_list = dev_set_multicast_list;
     ndev->flags |= IFF_MULTICAST;
+#ifdef CONFIG_NET_POLL_CONTROLLER
+    ndev->poll_controller = ixp425eth_poll_controller;
+#endif
 
-    ndev->set_mac_address = dev_set_mac_address;
+    ndev->set_mac_address = set_mac_address;
 
 #ifdef CONFIG_IXP400_NAPI
     ndev->poll = &dev_rx_poll;
@@ -3347,7 +3400,11 @@ static int __devinit dev_eth_probe(struc
 
 #if IS_KERNEL26
     if (register_netdev(ndev))
+    {
+	P_ERROR("%s: Failed to register netdevice %d\n",
+		ndev->name, priv->port_id);
     	goto error;
+    }
 #else
     found_devices++;
 #endif /* IS_KERNEL26 */
@@ -3357,6 +3414,8 @@ static int __devinit dev_eth_probe(struc
     /* register EthAcc callbacks for this port */
     if (dev_rxtxcallback_register(portId, (UINT32)ndev))
     {
+    	P_ERROR("%s: Failed to register callback %d\n",
+		ndev->name, priv->port_id);
     	goto error;
     }
 
@@ -3380,6 +3439,7 @@ static int __devinit dev_eth_probe(struc
 
 /* Error handling: enter here whenever error detected */
 error:
+    P_ERROR("%s: dev_eth_probe fails\n", ndev->name);
     TRACE;
 
 #ifdef CONFIG_IXP400_ETH_QDISC_ENABLED
@@ -3515,6 +3575,9 @@ static int __init ixp400_eth_init(void)
     TRACE;
 
     P_INFO("Initializing IXP400 NPE Ethernet driver software v. " MOD_VERSION " \n");
+#ifdef IX_OSAL_ENSURE_ON
+    ixOsalLogLevelSet(IX_OSAL_LOG_LVL_ALL);
+#endif
 
     TRACE;