Lines 1-25
Link Here
|
1 |
/****************************************************************************** |
1 |
/****************************************************************************** |
2 |
* |
2 |
* |
3 |
* Name: skge.c |
3 |
* Name: skge.c |
4 |
* Project: GEnesis, PCI Gigabit Ethernet Adapter |
4 |
* Project: GEnesis, PCI Gigabit Ethernet Adapter |
5 |
* Version: $Revision: 1.45 $ |
5 |
* Version: $Revision: 1.60.2.37 $ |
6 |
* Date: $Date: 2004/02/12 14:41:02 $ |
6 |
* Date: $Date: 2005/03/30 12:18:57 $ |
7 |
* Purpose: The main driver source module |
7 |
* Purpose: The main driver source module |
8 |
* |
8 |
* |
9 |
******************************************************************************/ |
9 |
******************************************************************************/ |
10 |
|
10 |
|
11 |
/****************************************************************************** |
11 |
/****************************************************************************** |
12 |
* |
12 |
* |
13 |
* (C)Copyright 1998-2002 SysKonnect GmbH. |
13 |
* (C)Copyright 1998-2002 SysKonnect GmbH. |
14 |
* (C)Copyright 2002-2003 Marvell. |
14 |
* (C)Copyright 2002-2004 Marvell. |
15 |
* |
15 |
* |
16 |
* Driver for Marvell Yukon chipset and SysKonnect Gigabit Ethernet |
16 |
* Driver for Marvell Yukon chipset and SysKonnect Gigabit Ethernet |
17 |
* Server Adapters. |
17 |
* Server Adapters. |
18 |
* |
18 |
* |
19 |
* Created 10-Feb-1999, based on Linux' acenic.c, 3c59x.c and |
19 |
* Author: Mirko Lindner (mlindner@syskonnect.de) |
20 |
* SysKonnects GEnesis Solaris driver |
20 |
* Ralph Roesler (rroesler@syskonnect.de) |
21 |
* Author: Christoph Goos (cgoos@syskonnect.de) |
|
|
22 |
* Mirko Lindner (mlindner@syskonnect.de) |
23 |
* |
21 |
* |
24 |
* Address all question to: linux@syskonnect.de |
22 |
* Address all question to: linux@syskonnect.de |
25 |
* |
23 |
* |
Lines 38-121
Link Here
|
38 |
|
36 |
|
39 |
/****************************************************************************** |
37 |
/****************************************************************************** |
40 |
* |
38 |
* |
41 |
* Possible compiler options (#define xxx / -Dxxx): |
|
|
42 |
* |
43 |
* debugging can be enable by changing SK_DEBUG_CHKMOD and |
44 |
* SK_DEBUG_CHKCAT in makefile (described there). |
45 |
* |
46 |
******************************************************************************/ |
47 |
|
48 |
/****************************************************************************** |
49 |
* |
50 |
* Description: |
39 |
* Description: |
51 |
* |
40 |
* |
52 |
* This is the main module of the Linux GE driver. |
41 |
* All source files in this sk98lin directory except of the sk98lin |
53 |
* |
42 |
* Linux specific files |
54 |
* All source files except skge.c, skdrv1st.h, skdrv2nd.h and sktypes.h |
43 |
* |
55 |
* are part of SysKonnect's COMMON MODULES for the SK-98xx adapters. |
44 |
* - skdim.c |
56 |
* Those are used for drivers on multiple OS', so some thing may seem |
45 |
* - skethtool.c |
57 |
* unnecessary complicated on Linux. Please do not try to 'clean up' |
46 |
* - skge.c |
58 |
* them without VERY good reasons, because this will make it more |
47 |
* - skproc.c |
59 |
* difficult to keep the Linux driver in synchronisation with the |
48 |
* - sky2.c |
60 |
* other versions. |
49 |
* - Makefile |
61 |
* |
50 |
* - h/skdrv1st.h |
62 |
* Include file hierarchy: |
51 |
* - h/skdrv2nd.h |
63 |
* |
52 |
* - h/sktypes.h |
64 |
* <linux/module.h> |
53 |
* - h/skversion.h |
65 |
* |
54 |
* |
66 |
* "h/skdrv1st.h" |
55 |
* are part of SysKonnect's common modules for the SK-9xxx adapters. |
67 |
* <linux/types.h> |
56 |
* |
68 |
* <linux/kernel.h> |
57 |
* Those common module files which are not Linux specific are used to |
69 |
* <linux/string.h> |
58 |
* build drivers on different OS' (e.g. Windows, MAC OS) so that those |
70 |
* <linux/errno.h> |
59 |
* drivers are based on the same set of files |
71 |
* <linux/ioport.h> |
60 |
* |
72 |
* <linux/slab.h> |
61 |
* At a first glance, this seems to complicate things unnescessarily on |
73 |
* <linux/interrupt.h> |
62 |
* Linux, but please do not try to 'clean up' them without VERY good |
74 |
* <linux/pci.h> |
63 |
* reasons, because this will make it more difficult to keep the sk98lin |
75 |
* <linux/bitops.h> |
64 |
* driver for Linux in synchronisation with the other drivers running on |
76 |
* <asm/byteorder.h> |
65 |
* other operating systems. |
77 |
* <asm/io.h> |
|
|
78 |
* <linux/netdevice.h> |
79 |
* <linux/etherdevice.h> |
80 |
* <linux/skbuff.h> |
81 |
* those three depending on kernel version used: |
82 |
* <linux/bios32.h> |
83 |
* <linux/init.h> |
84 |
* <asm/uaccess.h> |
85 |
* <net/checksum.h> |
86 |
* |
87 |
* "h/skerror.h" |
88 |
* "h/skdebug.h" |
89 |
* "h/sktypes.h" |
90 |
* "h/lm80.h" |
91 |
* "h/xmac_ii.h" |
92 |
* |
93 |
* "h/skdrv2nd.h" |
94 |
* "h/skqueue.h" |
95 |
* "h/skgehwt.h" |
96 |
* "h/sktimer.h" |
97 |
* "h/ski2c.h" |
98 |
* "h/skgepnmi.h" |
99 |
* "h/skvpd.h" |
100 |
* "h/skgehw.h" |
101 |
* "h/skgeinit.h" |
102 |
* "h/skaddr.h" |
103 |
* "h/skgesirq.h" |
104 |
* "h/skcsum.h" |
105 |
* "h/skrlmt.h" |
106 |
* |
66 |
* |
107 |
******************************************************************************/ |
67 |
******************************************************************************/ |
108 |
|
68 |
|
109 |
#include "h/skversion.h" |
69 |
#include "h/skversion.h" |
110 |
|
70 |
|
111 |
#include <linux/module.h> |
71 |
#include <linux/module.h> |
112 |
#include <linux/moduleparam.h> |
|
|
113 |
#include <linux/init.h> |
72 |
#include <linux/init.h> |
|
|
73 |
#include <linux/ethtool.h> |
74 |
|
75 |
#ifdef CONFIG_PROC_FS |
114 |
#include <linux/proc_fs.h> |
76 |
#include <linux/proc_fs.h> |
|
|
77 |
#endif |
115 |
|
78 |
|
116 |
#include "h/skdrv1st.h" |
79 |
#include "h/skdrv1st.h" |
117 |
#include "h/skdrv2nd.h" |
80 |
#include "h/skdrv2nd.h" |
118 |
|
81 |
|
|
|
82 |
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9) |
83 |
#include <linux/moduleparam.h> |
84 |
#endif |
85 |
|
119 |
/******************************************************************************* |
86 |
/******************************************************************************* |
120 |
* |
87 |
* |
121 |
* Defines |
88 |
* Defines |
Lines 125-186
Link Here
|
125 |
/* for debuging on x86 only */ |
92 |
/* for debuging on x86 only */ |
126 |
/* #define BREAKPOINT() asm(" int $3"); */ |
93 |
/* #define BREAKPOINT() asm(" int $3"); */ |
127 |
|
94 |
|
128 |
/* use the transmit hw checksum driver functionality */ |
|
|
129 |
#define USE_SK_TX_CHECKSUM |
130 |
|
131 |
/* use the receive hw checksum driver functionality */ |
132 |
#define USE_SK_RX_CHECKSUM |
133 |
|
134 |
/* use the scatter-gather functionality with sendfile() */ |
135 |
#define SK_ZEROCOPY |
136 |
|
137 |
/* use of a transmit complete interrupt */ |
138 |
#define USE_TX_COMPLETE |
139 |
|
140 |
/* |
141 |
* threshold for copying small receive frames |
142 |
* set to 0 to avoid copying, set to 9001 to copy all frames |
143 |
*/ |
144 |
#define SK_COPY_THRESHOLD 50 |
145 |
|
146 |
/* number of adapters that can be configured via command line params */ |
147 |
#define SK_MAX_CARD_PARAM 16 |
148 |
|
149 |
|
150 |
|
151 |
/* |
152 |
* use those defines for a compile-in version of the driver instead |
153 |
* of command line parameters |
154 |
*/ |
155 |
// #define LINK_SPEED_A {"Auto", } |
156 |
// #define LINK_SPEED_B {"Auto", } |
157 |
// #define AUTO_NEG_A {"Sense", } |
158 |
// #define AUTO_NEG_B {"Sense", } |
159 |
// #define DUP_CAP_A {"Both", } |
160 |
// #define DUP_CAP_B {"Both", } |
161 |
// #define FLOW_CTRL_A {"SymOrRem", } |
162 |
// #define FLOW_CTRL_B {"SymOrRem", } |
163 |
// #define ROLE_A {"Auto", } |
164 |
// #define ROLE_B {"Auto", } |
165 |
// #define PREF_PORT {"A", } |
166 |
// #define CON_TYPE {"Auto", } |
167 |
// #define RLMT_MODE {"CheckLinkState", } |
168 |
|
169 |
#define DEV_KFREE_SKB(skb) dev_kfree_skb(skb) |
170 |
#define DEV_KFREE_SKB_IRQ(skb) dev_kfree_skb_irq(skb) |
171 |
#define DEV_KFREE_SKB_ANY(skb) dev_kfree_skb_any(skb) |
172 |
|
173 |
|
95 |
|
174 |
/* Set blink mode*/ |
96 |
/* Set blink mode*/ |
175 |
#define OEM_CONFIG_VALUE ( SK_ACT_LED_BLINK | \ |
97 |
#define OEM_CONFIG_VALUE ( SK_ACT_LED_BLINK | \ |
176 |
SK_DUP_LED_NORMAL | \ |
98 |
SK_DUP_LED_NORMAL | \ |
177 |
SK_LED_LINK100_ON) |
99 |
SK_LED_LINK100_ON) |
178 |
|
100 |
|
179 |
|
101 |
#define CLEAR_AND_START_RX(Port) SK_OUT8(pAC->IoBase, RxQueueAddr[(Port)]+Q_CSR, CSR_START | CSR_IRQ_CL_F) |
180 |
/* Isr return value */ |
102 |
#define CLEAR_TX_IRQ(Port,Prio) SK_OUT8(pAC->IoBase, TxQueueAddr[(Port)][(Prio)]+Q_CSR, CSR_IRQ_CL_F) |
181 |
#define SkIsrRetVar irqreturn_t |
|
|
182 |
#define SkIsrRetNone IRQ_NONE |
183 |
#define SkIsrRetHandled IRQ_HANDLED |
184 |
|
103 |
|
185 |
|
104 |
|
186 |
/******************************************************************************* |
105 |
/******************************************************************************* |
Lines 189-200
Link Here
|
189 |
* |
108 |
* |
190 |
******************************************************************************/ |
109 |
******************************************************************************/ |
191 |
|
110 |
|
|
|
111 |
static int __devinit sk98lin_init_device(struct pci_dev *pdev, const struct pci_device_id *ent); |
112 |
static void sk98lin_remove_device(struct pci_dev *pdev); |
113 |
#ifdef CONFIG_PM |
114 |
static int sk98lin_suspend(struct pci_dev *pdev, u32 state); |
115 |
static int sk98lin_resume(struct pci_dev *pdev); |
116 |
static void SkEnableWOMagicPacket(SK_AC *pAC, SK_IOC IoC, SK_MAC_ADDR MacAddr); |
117 |
#endif |
118 |
#ifdef Y2_RECOVERY |
119 |
static void SkGeHandleKernelTimer(unsigned long ptr); |
120 |
void SkGeCheckTimer(DEV_NET *pNet); |
121 |
#endif |
192 |
static void FreeResources(struct SK_NET_DEVICE *dev); |
122 |
static void FreeResources(struct SK_NET_DEVICE *dev); |
193 |
static int SkGeBoardInit(struct SK_NET_DEVICE *dev, SK_AC *pAC); |
123 |
static int SkGeBoardInit(struct SK_NET_DEVICE *dev, SK_AC *pAC); |
194 |
static SK_BOOL BoardAllocMem(SK_AC *pAC); |
124 |
static SK_BOOL BoardAllocMem(SK_AC *pAC); |
195 |
static void BoardFreeMem(SK_AC *pAC); |
125 |
static void BoardFreeMem(SK_AC *pAC); |
196 |
static void BoardInitMem(SK_AC *pAC); |
126 |
static void BoardInitMem(SK_AC *pAC); |
197 |
static void SetupRing(SK_AC*, void*, uintptr_t, RXD**, RXD**, RXD**, int*, SK_BOOL); |
127 |
static void SetupRing(SK_AC*, void*, uintptr_t, RXD**, RXD**, RXD**, int*, int*, SK_BOOL); |
198 |
static SkIsrRetVar SkGeIsr(int irq, void *dev_id, struct pt_regs *ptregs); |
128 |
static SkIsrRetVar SkGeIsr(int irq, void *dev_id, struct pt_regs *ptregs); |
199 |
static SkIsrRetVar SkGeIsrOnePort(int irq, void *dev_id, struct pt_regs *ptregs); |
129 |
static SkIsrRetVar SkGeIsrOnePort(int irq, void *dev_id, struct pt_regs *ptregs); |
200 |
static int SkGeOpen(struct SK_NET_DEVICE *dev); |
130 |
static int SkGeOpen(struct SK_NET_DEVICE *dev); |
Lines 210-266
Link Here
|
210 |
static void FreeTxDescriptors(SK_AC*pAC, TX_PORT*); |
140 |
static void FreeTxDescriptors(SK_AC*pAC, TX_PORT*); |
211 |
static void FillRxRing(SK_AC*, RX_PORT*); |
141 |
static void FillRxRing(SK_AC*, RX_PORT*); |
212 |
static SK_BOOL FillRxDescriptor(SK_AC*, RX_PORT*); |
142 |
static SK_BOOL FillRxDescriptor(SK_AC*, RX_PORT*); |
|
|
143 |
#ifdef CONFIG_SK98LIN_NAPI |
144 |
static int SkGePoll(struct net_device *dev, int *budget); |
145 |
static void ReceiveIrq(SK_AC*, RX_PORT*, SK_BOOL, int*, int); |
146 |
#else |
213 |
static void ReceiveIrq(SK_AC*, RX_PORT*, SK_BOOL); |
147 |
static void ReceiveIrq(SK_AC*, RX_PORT*, SK_BOOL); |
214 |
static void ClearAndStartRx(SK_AC*, int); |
148 |
#endif |
215 |
static void ClearTxIrq(SK_AC*, int, int); |
|
|
216 |
static void ClearRxRing(SK_AC*, RX_PORT*); |
149 |
static void ClearRxRing(SK_AC*, RX_PORT*); |
217 |
static void ClearTxRing(SK_AC*, TX_PORT*); |
150 |
static void ClearTxRing(SK_AC*, TX_PORT*); |
218 |
static int SkGeChangeMtu(struct SK_NET_DEVICE *dev, int new_mtu); |
151 |
static int SkGeChangeMtu(struct SK_NET_DEVICE *dev, int new_mtu); |
219 |
static void PortReInitBmu(SK_AC*, int); |
152 |
static void PortReInitBmu(SK_AC*, int); |
220 |
static int SkGeIocMib(DEV_NET*, unsigned int, int); |
153 |
static int SkGeIocMib(DEV_NET*, unsigned int, int); |
221 |
static int SkGeInitPCI(SK_AC *pAC); |
154 |
static int SkGeInitPCI(SK_AC *pAC); |
222 |
static void StartDrvCleanupTimer(SK_AC *pAC); |
|
|
223 |
static void StopDrvCleanupTimer(SK_AC *pAC); |
224 |
static int XmitFrameSG(SK_AC*, TX_PORT*, struct sk_buff*); |
225 |
|
226 |
#ifdef SK_DIAG_SUPPORT |
227 |
static SK_U32 ParseDeviceNbrFromSlotName(const char *SlotName); |
155 |
static SK_U32 ParseDeviceNbrFromSlotName(const char *SlotName); |
228 |
static int SkDrvInitAdapter(SK_AC *pAC, int devNbr); |
156 |
static int SkDrvInitAdapter(SK_AC *pAC, int devNbr); |
229 |
static int SkDrvDeInitAdapter(SK_AC *pAC, int devNbr); |
157 |
static int SkDrvDeInitAdapter(SK_AC *pAC, int devNbr); |
230 |
#endif |
158 |
extern void SkLocalEventQueue( SK_AC *pAC, |
|
|
159 |
SK_U32 Class, |
160 |
SK_U32 Event, |
161 |
SK_U32 Param1, |
162 |
SK_U32 Param2, |
163 |
SK_BOOL Flag); |
164 |
extern void SkLocalEventQueue64( SK_AC *pAC, |
165 |
SK_U32 Class, |
166 |
SK_U32 Event, |
167 |
SK_U64 Param, |
168 |
SK_BOOL Flag); |
169 |
|
170 |
static int XmitFrameSG(SK_AC*, TX_PORT*, struct sk_buff*); |
231 |
|
171 |
|
232 |
/******************************************************************************* |
172 |
/******************************************************************************* |
233 |
* |
173 |
* |
234 |
* Extern Function Prototypes |
174 |
* Extern Function Prototypes |
235 |
* |
175 |
* |
236 |
******************************************************************************/ |
176 |
******************************************************************************/ |
237 |
static const char SKRootName[] = "sk98lin"; |
|
|
238 |
static struct proc_dir_entry *pSkRootDir; |
239 |
extern struct file_operations sk_proc_fops; |
240 |
|
241 |
static inline void SkGeProcCreate(struct net_device *dev) |
242 |
{ |
243 |
struct proc_dir_entry *pe; |
244 |
|
177 |
|
245 |
if (pSkRootDir && |
178 |
extern SK_BOOL SkY2AllocateResources(SK_AC *pAC); |
246 |
(pe = create_proc_entry(dev->name, S_IRUGO, pSkRootDir))) { |
179 |
extern void SkY2FreeResources(SK_AC *pAC); |
247 |
pe->proc_fops = &sk_proc_fops; |
180 |
extern void SkY2AllocateRxBuffers(SK_AC *pAC,SK_IOC IoC,int Port); |
248 |
pe->data = dev; |
181 |
extern void SkY2FreeRxBuffers(SK_AC *pAC,SK_IOC IoC,int Port); |
249 |
pe->owner = THIS_MODULE; |
182 |
extern void SkY2FreeTxBuffers(SK_AC *pAC,SK_IOC IoC,int Port); |
250 |
} |
183 |
extern SkIsrRetVar SkY2Isr(int irq,void *dev_id,struct pt_regs *ptregs); |
251 |
} |
184 |
extern int SkY2Xmit(struct sk_buff *skb,struct SK_NET_DEVICE *dev); |
252 |
|
185 |
extern void SkY2PortStop(SK_AC *pAC,SK_IOC IoC,int Port,int Dir,int RstMode); |
253 |
static inline void SkGeProcRemove(struct net_device *dev) |
186 |
extern void SkY2PortStart(SK_AC *pAC,SK_IOC IoC,int Port); |
254 |
{ |
187 |
extern int SkY2RlmtSend(SK_AC *pAC,int PortNr,struct sk_buff *pMessage); |
255 |
if (pSkRootDir) |
188 |
extern void SkY2RestartStatusUnit(SK_AC *pAC); |
256 |
remove_proc_entry(dev->name, pSkRootDir); |
189 |
#ifdef CONFIG_SK98LIN_NAPI |
257 |
} |
190 |
extern int SkY2Poll(struct net_device *dev, int *budget); |
|
|
191 |
#endif |
258 |
|
192 |
|
259 |
extern void SkDimEnableModerationIfNeeded(SK_AC *pAC); |
193 |
extern void SkDimEnableModerationIfNeeded(SK_AC *pAC); |
260 |
extern void SkDimDisplayModerationSettings(SK_AC *pAC); |
|
|
261 |
extern void SkDimStartModerationTimer(SK_AC *pAC); |
194 |
extern void SkDimStartModerationTimer(SK_AC *pAC); |
262 |
extern void SkDimModerate(SK_AC *pAC); |
195 |
extern void SkDimModerate(SK_AC *pAC); |
263 |
extern void SkGeBlinkTimer(unsigned long data); |
196 |
|
|
|
197 |
extern int SkEthIoctl(struct net_device *netdev, struct ifreq *ifr); |
198 |
|
199 |
#ifdef CONFIG_PROC_FS |
200 |
static const char SK_Root_Dir_entry[] = "sk98lin"; |
201 |
static struct proc_dir_entry *pSkRootDir; |
202 |
extern struct file_operations sk_proc_fops; |
203 |
#endif |
264 |
|
204 |
|
265 |
#ifdef DEBUG |
205 |
#ifdef DEBUG |
266 |
static void DumpMsg(struct sk_buff*, char*); |
206 |
static void DumpMsg(struct sk_buff*, char*); |
Lines 269-280
Link Here
|
269 |
#endif |
209 |
#endif |
270 |
|
210 |
|
271 |
/* global variables *********************************************************/ |
211 |
/* global variables *********************************************************/ |
|
|
212 |
static const char *BootString = BOOT_STRING; |
213 |
struct SK_NET_DEVICE *SkGeRootDev = NULL; |
272 |
static SK_BOOL DoPrintInterfaceChange = SK_TRUE; |
214 |
static SK_BOOL DoPrintInterfaceChange = SK_TRUE; |
273 |
extern struct ethtool_ops SkGeEthtoolOps; |
|
|
274 |
|
215 |
|
275 |
/* local variables **********************************************************/ |
216 |
/* local variables **********************************************************/ |
276 |
static uintptr_t TxQueueAddr[SK_MAX_MACS][2] = {{0x680, 0x600},{0x780, 0x700}}; |
217 |
static uintptr_t TxQueueAddr[SK_MAX_MACS][2] = {{0x680, 0x600},{0x780, 0x700}}; |
277 |
static uintptr_t RxQueueAddr[SK_MAX_MACS] = {0x400, 0x480}; |
218 |
static uintptr_t RxQueueAddr[SK_MAX_MACS] = {0x400, 0x480}; |
|
|
219 |
static int sk98lin_max_boards_found = 0; |
220 |
|
221 |
#ifdef CONFIG_PROC_FS |
222 |
static struct proc_dir_entry *pSkRootDir; |
223 |
#endif |
224 |
|
225 |
|
226 |
|
227 |
static struct pci_device_id sk98lin_pci_tbl[] __devinitdata = { |
228 |
/* { pci_vendor_id, pci_device_id, * SAMPLE ENTRY! * |
229 |
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, */ |
230 |
{ 0x10b7, 0x1700, /* 3Com (10b7), Gigabit Ethernet Adapter */ |
231 |
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, |
232 |
{ 0x10b7, 0x80eb, /* 3Com (10b7), 3Com 3C940B Gigabit LOM Ethernet Adapter */ |
233 |
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, |
234 |
{ 0x1148, 0x4300, /* SysKonnect (1148), SK-98xx Gigabit Ethernet Server Adapter */ |
235 |
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, |
236 |
{ 0x1148, 0x4320, /* SysKonnect (1148), SK-98xx V2.0 Gigabit Ethernet Adapter */ |
237 |
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, |
238 |
{ 0x1148, 0x9000, /* SysKonnect (1148), SK-9Sxx 10/100/1000Base-T Server Adapter */ |
239 |
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, |
240 |
{ 0x1148, 0x9E00, /* SysKonnect (1148), SK-9Exx 10/100/1000Base-T Adapter */ |
241 |
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, |
242 |
{ 0x1186, 0x4b00, /* D-Link (1186), Gigabit Ethernet Adapter */ |
243 |
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, |
244 |
{ 0x1186, 0x4b01, /* D-Link (1186), Gigabit Ethernet Adapter */ |
245 |
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, |
246 |
{ 0x1186, 0x4c00, /* D-Link (1186), Gigabit Ethernet Adapter */ |
247 |
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, |
248 |
{ 0x11ab, 0x4320, /* Marvell (11ab), Gigabit Ethernet Controller */ |
249 |
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, |
250 |
{ 0x11ab, 0x4340, /* Marvell (11ab), Gigabit Ethernet Controller */ |
251 |
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, |
252 |
{ 0x11ab, 0x4341, /* Marvell (11ab), Gigabit Ethernet Controller */ |
253 |
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, |
254 |
{ 0x11ab, 0x4342, /* Marvell (11ab), Gigabit Ethernet Controller */ |
255 |
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, |
256 |
{ 0x11ab, 0x4343, /* Marvell (11ab), Gigabit Ethernet Controller */ |
257 |
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, |
258 |
{ 0x11ab, 0x4344, /* Marvell (11ab), Gigabit Ethernet Controller */ |
259 |
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, |
260 |
{ 0x11ab, 0x4345, /* Marvell (11ab), Gigabit Ethernet Controller */ |
261 |
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, |
262 |
{ 0x11ab, 0x4346, /* Marvell (11ab), Gigabit Ethernet Controller */ |
263 |
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, |
264 |
{ 0x11ab, 0x4347, /* Marvell (11ab), Gigabit Ethernet Controller */ |
265 |
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, |
266 |
{ 0x11ab, 0x4350, /* Marvell (11ab), Fast Ethernet Controller */ |
267 |
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, |
268 |
{ 0x11ab, 0x4351, /* Marvell (11ab), Fast Ethernet Controller */ |
269 |
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, |
270 |
{ 0x11ab, 0x4360, /* Marvell (11ab), Gigabit Ethernet Controller */ |
271 |
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, |
272 |
{ 0x11ab, 0x4361, /* Marvell (11ab), Gigabit Ethernet Controller */ |
273 |
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, |
274 |
{ 0x11ab, 0x4362, /* Marvell (11ab), Gigabit Ethernet Controller */ |
275 |
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, |
276 |
{ 0x11ab, 0x5005, /* Marvell (11ab), Belkin */ |
277 |
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, |
278 |
{ 0x1371, 0x434e, /* CNet (1371), GigaCard Network Adapter */ |
279 |
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, |
280 |
{ 0x1737, 0x1032, /* Linksys (1737), Gigabit Network Adapter */ |
281 |
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, |
282 |
{ 0x1737, 0x1064, /* Linksys (1737), Gigabit Network Adapter */ |
283 |
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, |
284 |
{ 0, } |
285 |
}; |
286 |
|
287 |
MODULE_DEVICE_TABLE(pci, sk98lin_pci_tbl); |
288 |
|
289 |
static struct pci_driver sk98lin_driver = { |
290 |
.name = DRIVER_FILE_NAME, |
291 |
.id_table = sk98lin_pci_tbl, |
292 |
.probe = sk98lin_init_device, |
293 |
.remove = __devexit_p(sk98lin_remove_device), |
294 |
#ifdef CONFIG_PM |
295 |
.suspend = sk98lin_suspend, |
296 |
.resume = sk98lin_resume |
297 |
#endif |
298 |
}; |
299 |
|
300 |
|
301 |
/***************************************************************************** |
302 |
* |
303 |
* sk98lin_init_device - initialize the adapter |
304 |
* |
305 |
* Description: |
306 |
* This function initializes the adapter. Resources for |
307 |
* the adapter are allocated and the adapter is brought into Init 1 |
308 |
* state. |
309 |
* |
310 |
* Returns: |
311 |
* 0, if everything is ok |
312 |
* !=0, on error |
313 |
*/ |
314 |
static int __devinit sk98lin_init_device(struct pci_dev *pdev, |
315 |
const struct pci_device_id *ent) |
316 |
|
317 |
{ |
318 |
static SK_BOOL sk98lin_boot_string = SK_FALSE; |
319 |
static SK_BOOL sk98lin_proc_entry = SK_FALSE; |
320 |
static int sk98lin_boards_found = 0; |
321 |
SK_AC *pAC; |
322 |
DEV_NET *pNet = NULL; |
323 |
struct SK_NET_DEVICE *dev = NULL; |
324 |
int retval; |
325 |
#ifdef CONFIG_PROC_FS |
326 |
struct proc_dir_entry *pProcFile; |
327 |
#endif |
328 |
|
329 |
retval = pci_enable_device(pdev); |
330 |
if (retval) { |
331 |
printk(KERN_ERR "Cannot enable PCI device, " |
332 |
"aborting.\n"); |
333 |
return retval; |
334 |
} |
335 |
|
336 |
dev = NULL; |
337 |
pNet = NULL; |
338 |
|
339 |
|
340 |
/* INSERT * We have to find the power-management capabilities */ |
341 |
/* Find power-management capability. */ |
342 |
|
343 |
|
344 |
|
345 |
/* Configure DMA attributes. */ |
346 |
retval = pci_set_dma_mask(pdev, (u64) 0xffffffffffffffffULL); |
347 |
if (!retval) { |
348 |
retval = pci_set_dma_mask(pdev, (u64) 0xffffffff); |
349 |
if (retval) |
350 |
return retval; |
351 |
} else { |
352 |
return retval; |
353 |
} |
354 |
|
355 |
|
356 |
if ((dev = alloc_etherdev(sizeof(DEV_NET))) == NULL) { |
357 |
printk(KERN_ERR "Unable to allocate etherdev " |
358 |
"structure!\n"); |
359 |
return -ENODEV; |
360 |
} |
361 |
|
362 |
pNet = dev->priv; |
363 |
pNet->pAC = kmalloc(sizeof(SK_AC), GFP_KERNEL); |
364 |
if (pNet->pAC == NULL){ |
365 |
free_netdev(dev); |
366 |
printk(KERN_ERR "Unable to allocate adapter " |
367 |
"structure!\n"); |
368 |
return -ENODEV; |
369 |
} |
370 |
|
371 |
|
372 |
/* Print message */ |
373 |
if (!sk98lin_boot_string) { |
374 |
/* set display flag to TRUE so that */ |
375 |
/* we only display this string ONCE */ |
376 |
sk98lin_boot_string = SK_TRUE; |
377 |
printk("%s\n", BootString); |
378 |
} |
379 |
|
380 |
memset(pNet->pAC, 0, sizeof(SK_AC)); |
381 |
pAC = pNet->pAC; |
382 |
pAC->PciDev = pdev; |
383 |
pAC->PciDevId = pdev->device; |
384 |
pAC->dev[0] = dev; |
385 |
pAC->dev[1] = dev; |
386 |
sprintf(pAC->Name, "SysKonnect SK-98xx"); |
387 |
pAC->CheckQueue = SK_FALSE; |
388 |
|
389 |
dev->irq = pdev->irq; |
390 |
retval = SkGeInitPCI(pAC); |
391 |
if (retval) { |
392 |
printk("SKGE: PCI setup failed: %i\n", retval); |
393 |
free_netdev(dev); |
394 |
return -ENODEV; |
395 |
} |
396 |
|
397 |
SET_MODULE_OWNER(dev); |
398 |
|
399 |
dev->open = &SkGeOpen; |
400 |
dev->stop = &SkGeClose; |
401 |
dev->get_stats = &SkGeStats; |
402 |
dev->set_multicast_list = &SkGeSetRxMode; |
403 |
dev->set_mac_address = &SkGeSetMacAddr; |
404 |
dev->do_ioctl = &SkGeIoctl; |
405 |
dev->change_mtu = &SkGeChangeMtu; |
406 |
dev->flags &= ~IFF_RUNNING; |
407 |
SET_NETDEV_DEV(dev, &pdev->dev); |
408 |
|
409 |
pAC->Index = sk98lin_boards_found; |
410 |
|
411 |
if (SkGeBoardInit(dev, pAC)) { |
412 |
free_netdev(dev); |
413 |
return -ENODEV; |
414 |
} else { |
415 |
ProductStr(pAC); |
416 |
} |
417 |
|
418 |
/* shifter to later moment in time... */ |
419 |
if (CHIP_ID_YUKON_2(pAC)) { |
420 |
dev->hard_start_xmit = &SkY2Xmit; |
421 |
} else { |
422 |
dev->hard_start_xmit = &SkGeXmit; |
423 |
} |
424 |
|
425 |
#ifdef NETIF_F_TSO |
426 |
#ifdef USE_SK_TSO_FEATURE |
427 |
if (CHIP_ID_YUKON_2(pAC)) { |
428 |
dev->features |= NETIF_F_TSO; |
429 |
} |
430 |
#endif |
431 |
#endif |
432 |
#ifdef CONFIG_SK98LIN_ZEROCOPY |
433 |
if (pAC->GIni.GIChipId != CHIP_ID_GENESIS) |
434 |
dev->features |= NETIF_F_SG; |
435 |
#endif |
436 |
#ifdef USE_SK_TX_CHECKSUM |
437 |
if (pAC->GIni.GIChipId != CHIP_ID_GENESIS) |
438 |
dev->features |= NETIF_F_IP_CSUM; |
439 |
#endif |
440 |
#ifdef USE_SK_RX_CHECKSUM |
441 |
pAC->RxPort[0].UseRxCsum = SK_TRUE; |
442 |
if (pAC->GIni.GIMacsFound == 2 ) { |
443 |
pAC->RxPort[1].UseRxCsum = SK_TRUE; |
444 |
} |
445 |
#endif |
446 |
|
447 |
/* Save the hardware revision */ |
448 |
pAC->HWRevision = (((pAC->GIni.GIPciHwRev >> 4) & 0x0F)*10) + |
449 |
(pAC->GIni.GIPciHwRev & 0x0F); |
450 |
|
451 |
/* Set driver globals */ |
452 |
pAC->Pnmi.pDriverFileName = DRIVER_FILE_NAME; |
453 |
pAC->Pnmi.pDriverReleaseDate = DRIVER_REL_DATE; |
454 |
|
455 |
SK_MEMSET(&(pAC->PnmiBackup), 0, sizeof(SK_PNMI_STRUCT_DATA)); |
456 |
SK_MEMCPY(&(pAC->PnmiBackup), &(pAC->PnmiStruct), |
457 |
sizeof(SK_PNMI_STRUCT_DATA)); |
458 |
|
459 |
/* Register net device */ |
460 |
retval = register_netdev(dev); |
461 |
if (retval) { |
462 |
printk(KERN_ERR "SKGE: Could not register device.\n"); |
463 |
FreeResources(dev); |
464 |
free_netdev(dev); |
465 |
return retval; |
466 |
} |
467 |
|
468 |
/* Save initial device name */ |
469 |
strcpy(pNet->InitialDevName, dev->name); |
470 |
|
471 |
/* Set network to off */ |
472 |
netif_stop_queue(dev); |
473 |
netif_carrier_off(dev); |
474 |
|
475 |
/* Print adapter specific string from vpd and config settings */ |
476 |
printk("%s: %s\n", pNet->InitialDevName, pAC->DeviceStr); |
477 |
printk(" PrefPort:%c RlmtMode:%s\n", |
478 |
'A' + pAC->Rlmt.Net[0].Port[pAC->Rlmt.Net[0].PrefPort]->PortNumber, |
479 |
(pAC->RlmtMode==0) ? "Check Link State" : |
480 |
((pAC->RlmtMode==1) ? "Check Link State" : |
481 |
((pAC->RlmtMode==3) ? "Check Local Port" : |
482 |
((pAC->RlmtMode==7) ? "Check Segmentation" : |
483 |
((pAC->RlmtMode==17) ? "Dual Check Link State" :"Error"))))); |
484 |
|
485 |
SkGeYellowLED(pAC, pAC->IoBase, 1); |
486 |
|
487 |
memcpy((caddr_t) &dev->dev_addr, |
488 |
(caddr_t) &pAC->Addr.Net[0].CurrentMacAddress, 6); |
489 |
|
490 |
/* First adapter... Create proc and print message */ |
491 |
#ifdef CONFIG_PROC_FS |
492 |
if (!sk98lin_proc_entry) { |
493 |
sk98lin_proc_entry = SK_TRUE; |
494 |
SK_MEMCPY(&SK_Root_Dir_entry, BootString, |
495 |
sizeof(SK_Root_Dir_entry) - 1); |
496 |
|
497 |
/*Create proc (directory)*/ |
498 |
if(!pSkRootDir) { |
499 |
pSkRootDir = proc_mkdir(SK_Root_Dir_entry, proc_net); |
500 |
if (!pSkRootDir) { |
501 |
printk(KERN_WARNING "%s: Unable to create /proc/net/%s", |
502 |
dev->name, SK_Root_Dir_entry); |
503 |
} else { |
504 |
pSkRootDir->owner = THIS_MODULE; |
505 |
} |
506 |
} |
507 |
} |
508 |
|
509 |
/* Create proc file */ |
510 |
if (pSkRootDir && |
511 |
(pProcFile = create_proc_entry(pNet->InitialDevName, S_IRUGO, |
512 |
pSkRootDir))) { |
513 |
pProcFile->proc_fops = &sk_proc_fops; |
514 |
pProcFile->data = dev; |
515 |
} |
516 |
|
517 |
#endif |
518 |
|
519 |
pNet->PortNr = 0; |
520 |
pNet->NetNr = 0; |
521 |
|
522 |
sk98lin_boards_found++; |
523 |
pci_set_drvdata(pdev, dev); |
524 |
|
525 |
/* More then one port found */ |
526 |
if ((pAC->GIni.GIMacsFound == 2 ) && (pAC->RlmtNets == 2)) { |
527 |
if ((dev = alloc_etherdev(sizeof(DEV_NET))) == 0) { |
528 |
printk(KERN_ERR "Unable to allocate etherdev " |
529 |
"structure!\n"); |
530 |
return -ENODEV; |
531 |
} |
532 |
|
533 |
pAC->dev[1] = dev; |
534 |
pNet = dev->priv; |
535 |
pNet->PortNr = 1; |
536 |
pNet->NetNr = 1; |
537 |
pNet->pAC = pAC; |
538 |
|
539 |
if (CHIP_ID_YUKON_2(pAC)) { |
540 |
dev->hard_start_xmit = &SkY2Xmit; |
541 |
} else { |
542 |
dev->hard_start_xmit = &SkGeXmit; |
543 |
} |
544 |
dev->open = &SkGeOpen; |
545 |
dev->stop = &SkGeClose; |
546 |
dev->get_stats = &SkGeStats; |
547 |
dev->set_multicast_list = &SkGeSetRxMode; |
548 |
dev->set_mac_address = &SkGeSetMacAddr; |
549 |
dev->do_ioctl = &SkGeIoctl; |
550 |
dev->change_mtu = &SkGeChangeMtu; |
551 |
dev->flags &= ~IFF_RUNNING; |
552 |
|
553 |
#ifdef NETIF_F_TSO |
554 |
#ifdef USE_SK_TSO_FEATURE |
555 |
if (CHIP_ID_YUKON_2(pAC)) { |
556 |
dev->features |= NETIF_F_TSO; |
557 |
} |
558 |
#endif |
559 |
#endif |
560 |
#ifdef CONFIG_SK98LIN_ZEROCOPY |
561 |
/* Don't handle if Genesis chipset */ |
562 |
if (pAC->GIni.GIChipId != CHIP_ID_GENESIS) |
563 |
dev->features |= NETIF_F_SG; |
564 |
#endif |
565 |
#ifdef USE_SK_TX_CHECKSUM |
566 |
/* Don't handle if Genesis chipset */ |
567 |
if (pAC->GIni.GIChipId != CHIP_ID_GENESIS) |
568 |
dev->features |= NETIF_F_IP_CSUM; |
569 |
#endif |
570 |
|
571 |
if (register_netdev(dev)) { |
572 |
printk(KERN_ERR "SKGE: Could not register device.\n"); |
573 |
free_netdev(dev); |
574 |
pAC->dev[1] = pAC->dev[0]; |
575 |
} else { |
576 |
|
577 |
/* Save initial device name */ |
578 |
strcpy(pNet->InitialDevName, dev->name); |
579 |
|
580 |
/* Set network to off */ |
581 |
netif_stop_queue(dev); |
582 |
netif_carrier_off(dev); |
583 |
|
584 |
|
585 |
#ifdef CONFIG_PROC_FS |
586 |
if (pSkRootDir |
587 |
&& (pProcFile = create_proc_entry(pNet->InitialDevName, |
588 |
S_IRUGO, pSkRootDir))) { |
589 |
pProcFile->proc_fops = &sk_proc_fops; |
590 |
pProcFile->data = dev; |
591 |
} |
592 |
#endif |
593 |
|
594 |
memcpy((caddr_t) &dev->dev_addr, |
595 |
(caddr_t) &pAC->Addr.Net[1].CurrentMacAddress, 6); |
596 |
|
597 |
printk("%s: %s\n", pNet->InitialDevName, pAC->DeviceStr); |
598 |
printk(" PrefPort:B RlmtMode:Dual Check Link State\n"); |
599 |
} |
600 |
} |
601 |
|
602 |
pAC->Index = sk98lin_boards_found; |
603 |
sk98lin_max_boards_found = sk98lin_boards_found; |
604 |
return 0; |
605 |
} |
606 |
|
607 |
|
278 |
|
608 |
|
279 |
/***************************************************************************** |
609 |
/***************************************************************************** |
280 |
* |
610 |
* |
Lines 299-305
Link Here
|
299 |
dev->mem_start = pci_resource_start (pdev, 0); |
629 |
dev->mem_start = pci_resource_start (pdev, 0); |
300 |
pci_set_master(pdev); |
630 |
pci_set_master(pdev); |
301 |
|
631 |
|
302 |
if (pci_request_regions(pdev, pAC->Name) != 0) { |
632 |
if (pci_request_regions(pdev, DRIVER_FILE_NAME) != 0) { |
303 |
retval = 2; |
633 |
retval = 2; |
304 |
goto out_disable; |
634 |
goto out_disable; |
305 |
} |
635 |
} |
Lines 320-326
Link Here
|
320 |
/* |
650 |
/* |
321 |
* Remap the regs into kernel space. |
651 |
* Remap the regs into kernel space. |
322 |
*/ |
652 |
*/ |
323 |
pAC->IoBase = ioremap_nocache(dev->mem_start, 0x4000); |
653 |
pAC->IoBase = (char*)ioremap_nocache(dev->mem_start, 0x4000); |
324 |
|
654 |
|
325 |
if (!pAC->IoBase){ |
655 |
if (!pAC->IoBase){ |
326 |
retval = 3; |
656 |
retval = 3; |
Lines 336-341
Link Here
|
336 |
return retval; |
666 |
return retval; |
337 |
} |
667 |
} |
338 |
|
668 |
|
|
|
669 |
#ifdef Y2_RECOVERY |
670 |
/***************************************************************************** |
671 |
* |
672 |
* SkGeHandleKernelTimer - Handle the kernel timer requests |
673 |
* |
674 |
* Description: |
675 |
* If the requested time interval for the timer has elapsed, |
676 |
* this function checks the link state. |
677 |
* |
678 |
* Returns: N/A |
679 |
* |
680 |
*/ |
681 |
static void SkGeHandleKernelTimer( |
682 |
unsigned long ptr) /* holds the pointer to adapter control context */ |
683 |
{ |
684 |
DEV_NET *pNet = (DEV_NET*) ptr; |
685 |
|
686 |
pNet->TimerExpired = SK_TRUE; |
687 |
} |
688 |
|
689 |
/***************************************************************************** |
690 |
* |
691 |
* sk98lin_check_timer - Resume the the card |
692 |
* |
693 |
* Description: |
694 |
* This function checks the kernel timer |
695 |
* |
696 |
* Returns: N/A |
697 |
* |
698 |
*/ |
699 |
void SkGeCheckTimer( |
700 |
DEV_NET *pNet) /* holds the pointer to adapter control context */ |
701 |
{ |
702 |
SK_AC *pAC = pNet->pAC; |
703 |
SK_BOOL StartTimer = SK_TRUE; |
704 |
#ifdef Y2_RX_CHECK |
705 |
SK_BOOL ZeroRegister = SK_FALSE; |
706 |
SK_U8 FifoReadPointer; |
707 |
SK_U8 FifoReadLevel; |
708 |
SK_U32 BmuStateMachine; |
709 |
#endif |
710 |
|
711 |
if (pNet->InRecover) |
712 |
return; |
713 |
|
714 |
#define TXPORT pAC->TxPort[pNet->PortNr][TX_PRIO_LOW] |
715 |
#define RXPORT pAC->RxPort[pNet->PortNr] |
716 |
|
717 |
if ( (CHIP_ID_YUKON_2(pAC)) && |
718 |
(netif_running(pAC->dev[pNet->PortNr]))) { |
719 |
|
720 |
#ifdef Y2_RX_CHECK |
721 |
/* Check the receiver only if link is up*/ |
722 |
if ( (netif_carrier_ok(pAC->dev[pNet->PortNr])) && |
723 |
(pNet->LastJiffies == pAC->dev[pNet->PortNr]->last_rx)) { |
724 |
|
725 |
/* Nothing received */ |
726 |
/* Get the register values */ |
727 |
SK_IN8(pAC->IoBase, 0x0448, &FifoReadPointer); |
728 |
SK_IN8(pAC->IoBase, 0x044a, &FifoReadLevel); |
729 |
SK_IN32(pAC->IoBase, 0x043c, &BmuStateMachine); |
730 |
|
731 |
/* Check the register values */ |
732 |
if ((pNet->FifoReadPointer != FifoReadPointer) || |
733 |
(pNet->FifoReadLevel != FifoReadLevel) || |
734 |
(pNet->BmuStateMachine != BmuStateMachine)) { |
735 |
|
736 |
/* Check the values */ |
737 |
if ((pNet->FifoReadPointer) || |
738 |
(pNet->FifoReadLevel) || |
739 |
(pNet->BmuStateMachine)) { |
740 |
|
741 |
/* Check the jiffies again */ |
742 |
if (pNet->LastJiffies == |
743 |
pAC->dev[pNet->PortNr]->last_rx) { |
744 |
/* Still nothing received */ |
745 |
SkLocalEventQueue(pAC, SKGE_DRV, |
746 |
SK_DRV_RECOVER,pNet->PortNr,-1,SK_FALSE); |
747 |
} else { |
748 |
ZeroRegister = SK_TRUE; |
749 |
} |
750 |
} else { |
751 |
pNet->FifoReadPointer = FifoReadPointer; |
752 |
pNet->FifoReadLevel = FifoReadLevel; |
753 |
pNet->BmuStateMachine = BmuStateMachine; |
754 |
|
755 |
} |
756 |
} else { |
757 |
if ((FifoReadLevel != 0) && |
758 |
(FifoReadPointer > 0)) { |
759 |
/* Check the jiffies again */ |
760 |
if (pNet->LastJiffies == |
761 |
pAC->dev[pNet->PortNr]->last_rx) { |
762 |
/* Still nothing received */ |
763 |
SkLocalEventQueue(pAC, SKGE_DRV, |
764 |
SK_DRV_RECOVER,pNet->PortNr,-1,SK_FALSE); |
765 |
} else { |
766 |
ZeroRegister = SK_TRUE; |
767 |
} |
768 |
} else { |
769 |
ZeroRegister = SK_TRUE; |
770 |
} |
771 |
} |
772 |
} else { |
773 |
/* Clear the values */ |
774 |
if ((pNet->FifoReadPointer) || |
775 |
(pNet->FifoReadLevel) || |
776 |
(pNet->BmuStateMachine)) { |
777 |
ZeroRegister = SK_TRUE; |
778 |
} |
779 |
pNet->LastJiffies = |
780 |
pAC->dev[pNet->PortNr]->last_rx; |
781 |
} |
782 |
|
783 |
/* Clear the register values */ |
784 |
if (ZeroRegister) { |
785 |
pNet->FifoReadPointer = 0; |
786 |
pNet->FifoReadLevel = 0; |
787 |
pNet->BmuStateMachine = 0; |
788 |
} |
789 |
#endif |
790 |
|
791 |
/* Checkthe transmitter */ |
792 |
if (!(IS_Q_EMPTY(&TXPORT.TxAQ_working))) { |
793 |
if (TXPORT.LastDone != TXPORT.TxALET.Done) { |
794 |
TXPORT.LastDone = TXPORT.TxALET.Done; |
795 |
pNet->TransmitTimeoutTimer = 0; |
796 |
} else { |
797 |
pNet->TransmitTimeoutTimer++; |
798 |
if (pNet->TransmitTimeoutTimer >= 10) { |
799 |
pNet->TransmitTimeoutTimer = 0; |
800 |
#ifdef CHECK_TRANSMIT_TIMEOUT |
801 |
StartTimer = SK_FALSE; |
802 |
SkLocalEventQueue(pAC, SKGE_DRV, |
803 |
SK_DRV_RECOVER,pNet->PortNr,-1,SK_FALSE); |
804 |
#endif |
805 |
} |
806 |
} |
807 |
} |
808 |
|
809 |
#ifdef CHECK_TRANSMIT_TIMEOUT |
810 |
pNet->KernelTimer.expires = jiffies + (HZ/4); /* 250ms */ |
811 |
add_timer(&pNet->KernelTimer); |
812 |
pNet->TimerExpired = SK_FALSE; |
813 |
#endif |
814 |
} |
815 |
} |
816 |
#endif |
817 |
|
818 |
|
819 |
#ifdef CONFIG_PM |
820 |
/***************************************************************************** |
821 |
* |
822 |
* sk98lin_resume - Resume the the card |
823 |
* |
824 |
* Description: |
825 |
* This function resumes the card into the D0 state |
826 |
* |
827 |
* Returns: N/A |
828 |
* |
829 |
*/ |
830 |
static int sk98lin_resume( |
831 |
struct pci_dev *pdev) /* the device that is to resume */ |
832 |
{ |
833 |
struct net_device *dev = pci_get_drvdata(pdev); |
834 |
DEV_NET *pNet = (DEV_NET*) dev->priv; |
835 |
SK_AC *pAC = pNet->pAC; |
836 |
SK_U16 PmCtlSts; |
837 |
|
838 |
/* Set the power state to D0 */ |
839 |
pci_set_power_state(pdev, 0); |
840 |
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9) |
841 |
pci_restore_state(pdev); |
842 |
#else |
843 |
pci_restore_state(pdev, pAC->PciState); |
844 |
#endif |
845 |
|
846 |
/* Set the adapter power state to D0 */ |
847 |
SkPciReadCfgWord(pAC, PCI_PM_CTL_STS, &PmCtlSts); |
848 |
PmCtlSts &= ~(PCI_PM_STATE_D3); /* reset all DState bits */ |
849 |
PmCtlSts |= PCI_PM_STATE_D0; |
850 |
SkPciWriteCfgWord(pAC, PCI_PM_CTL_STS, PmCtlSts); |
851 |
|
852 |
/* Reinit the adapter and start the port again */ |
853 |
pAC->BoardLevel = SK_INIT_DATA; |
854 |
SkDrvLeaveDiagMode(pAC); |
855 |
|
856 |
netif_device_attach(dev); |
857 |
netif_start_queue(dev); |
858 |
return 0; |
859 |
} |
860 |
|
861 |
/***************************************************************************** |
862 |
* |
863 |
* sk98lin_suspend - Suspend the card |
864 |
* |
865 |
* Description: |
866 |
* This function suspends the card into a defined state |
867 |
* |
868 |
* Returns: N/A |
869 |
* |
870 |
*/ |
871 |
static int sk98lin_suspend( |
872 |
struct pci_dev *pdev, /* pointer to the device that is to suspend */ |
873 |
u32 state) /* what power state is desired by Linux? */ |
874 |
{ |
875 |
struct net_device *dev = pci_get_drvdata(pdev); |
876 |
DEV_NET *pNet = (DEV_NET*) dev->priv; |
877 |
SK_AC *pAC = pNet->pAC; |
878 |
SK_U16 PciPMControlStatus; |
879 |
SK_U16 PciPMCapabilities; |
880 |
SK_MAC_ADDR MacAddr; |
881 |
int i; |
882 |
|
883 |
/* GEnesis and first yukon revs do not support power management */ |
884 |
if (pAC->GIni.GIChipId == CHIP_ID_YUKON) { |
885 |
if (pAC->GIni.GIChipRev == 0) { |
886 |
return 0; /* power management not supported */ |
887 |
} |
888 |
} |
889 |
|
890 |
if (pAC->GIni.GIChipId == CHIP_ID_GENESIS) { |
891 |
return 0; /* not supported for this chipset */ |
892 |
} |
893 |
|
894 |
if (pAC->WolInfo.ConfiguredWolOptions == 0) { |
895 |
return 0; /* WOL possible, but disabled via ethtool */ |
896 |
} |
897 |
|
898 |
if(netif_running(dev)) { |
899 |
netif_stop_queue(dev); /* stop device if running */ |
900 |
} |
901 |
|
902 |
netif_device_detach(dev); |
903 |
|
904 |
/* read the PM control/status register from the PCI config space */ |
905 |
SK_IN16(pAC->IoBase, PCI_C(pAC, PCI_PM_CTL_STS), &PciPMControlStatus); |
906 |
|
907 |
/* read the power management capabilities from the config space */ |
908 |
SK_IN16(pAC->IoBase, PCI_C(pAC, PCI_PM_CAP_REG), &PciPMCapabilities); |
909 |
|
910 |
/* Enable WakeUp with Magic Packet - get MAC address from adapter */ |
911 |
for (i = 0; i < SK_MAC_ADDR_LEN; i++) { |
912 |
/* virtual address: will be used for data */ |
913 |
SK_IN8(pAC->IoBase, (B2_MAC_1 + i), &MacAddr.a[i]); |
914 |
} |
915 |
|
916 |
SkDrvEnterDiagMode(pAC); |
917 |
SkEnableWOMagicPacket(pAC, pAC->IoBase, MacAddr); |
918 |
|
919 |
pci_enable_wake(pdev, 3, 1); |
920 |
pci_enable_wake(pdev, 4, 1); /* 4 == D3 cold */ |
921 |
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9) |
922 |
pci_save_state(pdev); |
923 |
#else |
924 |
pci_save_state(pdev, pAC->PciState); |
925 |
#endif |
926 |
pci_set_power_state(pdev, state); /* set the state */ |
927 |
|
928 |
return 0; |
929 |
} |
930 |
|
931 |
|
932 |
/****************************************************************************** |
933 |
* |
934 |
* SkEnableWOMagicPacket - Enable Wake on Magic Packet on the adapter |
935 |
* |
936 |
* Context: |
937 |
* init, pageable |
938 |
* the adapter should be de-initialized before calling this function |
939 |
* |
940 |
* Returns: |
941 |
* nothing |
942 |
*/ |
943 |
|
944 |
static void SkEnableWOMagicPacket( |
945 |
SK_AC *pAC, /* Adapter Control Context */ |
946 |
SK_IOC IoC, /* I/O control context */ |
947 |
SK_MAC_ADDR MacAddr) /* MacAddr expected in magic packet */ |
948 |
{ |
949 |
SK_U16 Word; |
950 |
SK_U32 DWord; |
951 |
int i; |
952 |
int HwPortIndex; |
953 |
int Port = 0; |
954 |
|
955 |
/* use Port 0 as long as we do not have any dual port cards which support WOL */ |
956 |
HwPortIndex = 0; |
957 |
DWord = 0; |
958 |
|
959 |
SK_OUT16(IoC, 0x0004, 0x0002); /* clear S/W Reset */ |
960 |
SK_OUT16(IoC, 0x0f10, 0x0002); /* clear Link Reset */ |
961 |
|
962 |
/* |
963 |
* PHY Configuration: |
964 |
* Autonegotioation is enalbed, advertise 10 HD, 10 FD, |
965 |
* 100 HD, and 100 FD. |
966 |
*/ |
967 |
if ((pAC->GIni.GIChipId == CHIP_ID_YUKON_EC) || |
968 |
(pAC->GIni.GIChipId == CHIP_ID_YUKON) || |
969 |
(pAC->GIni.GIChipId == CHIP_ID_YUKON_LITE)) { |
970 |
|
971 |
SK_OUT16(IoC, 0x0004, 0x0800); /* enable CLK_RUN */ |
972 |
SK_OUT8(IoC, 0x0007, 0xa9); /* enable VAUX */ |
973 |
|
974 |
/* WA code for COMA mode */ |
975 |
/* Only for yukon plus based chipsets rev A3 */ |
976 |
if (pAC->GIni.GIChipRev == CHIP_REV_YU_LITE_A3) { |
977 |
SK_IN32(IoC, B2_GP_IO, &DWord); |
978 |
DWord |= GP_DIR_9; /* set to output */ |
979 |
DWord &= ~GP_IO_9; /* clear PHY reset (active high) */ |
980 |
SK_OUT32(IoC, B2_GP_IO, DWord); /* clear PHY reset */ |
981 |
} |
982 |
|
983 |
if ((pAC->GIni.GIChipId == CHIP_ID_YUKON_LITE) || |
984 |
(pAC->GIni.GIChipId == CHIP_ID_YUKON)) { |
985 |
SK_OUT32(IoC, 0x0f04, 0x01f04001); /* set PHY reset */ |
986 |
SK_OUT32(IoC, 0x0f04, 0x01f04002); /* clear PHY reset */ |
987 |
} else { |
988 |
SK_OUT8(IoC, 0x0f04, 0x02); /* clear PHY reset */ |
989 |
} |
990 |
|
991 |
SK_OUT8(IoC, 0x0f00, 0x02); /* clear MAC reset */ |
992 |
SkGmPhyWrite(pAC, IoC, Port, 4, 0x01e1); /* advertise 10/100 HD/FD */ |
993 |
SkGmPhyWrite(pAC, IoC, Port, 9, 0x0000); /* do not advertise 1000 HD/FD */ |
994 |
SkGmPhyWrite(pAC, IoC, Port, 00, 0xB300); /* 100 MBit, disable Autoneg */ |
995 |
} else if (pAC->GIni.GIChipId == CHIP_ID_YUKON_FE) { |
996 |
SK_OUT8(IoC, 0x0007, 0xa9); /* enable VAUX */ |
997 |
SK_OUT8(IoC, 0x0f04, 0x02); /* clear PHY reset */ |
998 |
SK_OUT8(IoC, 0x0f00, 0x02); /* clear MAC reset */ |
999 |
SkGmPhyWrite(pAC, IoC, Port, 16, 0x0130); /* Enable Automatic Crossover */ |
1000 |
SkGmPhyWrite(pAC, IoC, Port, 00, 0xB300); /* 100 MBit, disable Autoneg */ |
1001 |
} |
1002 |
|
1003 |
|
1004 |
/* |
1005 |
* MAC Configuration: |
1006 |
* Set the MAC to 100 HD and enable the auto update features |
1007 |
* for Speed, Flow Control and Duplex Mode. |
1008 |
* If autonegotiation completes successfully the |
1009 |
* MAC takes the link parameters from the PHY. |
1010 |
* If the link partner doesn't support autonegotiation |
1011 |
* the MAC can receive magic packets if the link partner |
1012 |
* uses 100 HD. |
1013 |
*/ |
1014 |
SK_OUT16(IoC, 0x2804, 0x3832); |
1015 |
|
1016 |
|
1017 |
/* |
1018 |
* Set Up Magic Packet parameters |
1019 |
*/ |
1020 |
for (i = 0; i < 6; i+=2) { /* set up magic packet MAC address */ |
1021 |
SK_IN16(IoC, 0x100 + i, &Word); |
1022 |
SK_OUT16(IoC, 0xf24 + i, Word); |
1023 |
} |
1024 |
|
1025 |
SK_OUT16(IoC, 0x0f20, 0x0208); /* enable PME on magic packet */ |
1026 |
/* and on wake up frame */ |
1027 |
|
1028 |
/* |
1029 |
* Set up PME generation |
1030 |
*/ |
1031 |
/* set PME legacy mode */ |
1032 |
/* Only for PCI express based chipsets */ |
1033 |
if ((pAC->GIni.GIChipId == CHIP_ID_YUKON_EC) || |
1034 |
(pAC->GIni.GIChipId == CHIP_ID_YUKON_FE)) { |
1035 |
SkPciReadCfgDWord(pAC, 0x40, &DWord); |
1036 |
DWord |= 0x8000; |
1037 |
SkPciWriteCfgDWord(pAC, 0x40, DWord); |
1038 |
} |
1039 |
|
1040 |
/* clear PME status and switch adapter to DState */ |
1041 |
SkPciReadCfgWord(pAC, 0x4c, &Word); |
1042 |
Word |= 0x103; |
1043 |
SkPciWriteCfgWord(pAC, 0x4c, Word); |
1044 |
} /* SkEnableWOMagicPacket */ |
1045 |
#endif |
1046 |
|
339 |
|
1047 |
|
340 |
/***************************************************************************** |
1048 |
/***************************************************************************** |
341 |
* |
1049 |
* |
Lines 354-373
Link Here
|
354 |
DEV_NET *pNet; |
1062 |
DEV_NET *pNet; |
355 |
SK_AC *pAC; |
1063 |
SK_AC *pAC; |
356 |
|
1064 |
|
357 |
pNet = netdev_priv(dev); |
1065 |
if (dev->priv) { |
358 |
pAC = pNet->pAC; |
1066 |
pNet = (DEV_NET*) dev->priv; |
359 |
AllocFlag = pAC->AllocFlag; |
1067 |
pAC = pNet->pAC; |
360 |
if (pAC->PciDev) { |
1068 |
AllocFlag = pAC->AllocFlag; |
361 |
pci_release_regions(pAC->PciDev); |
1069 |
if (pAC->PciDev) { |
362 |
} |
1070 |
pci_release_regions(pAC->PciDev); |
363 |
if (AllocFlag & SK_ALLOC_IRQ) { |
1071 |
} |
364 |
free_irq(dev->irq, dev); |
1072 |
if (AllocFlag & SK_ALLOC_IRQ) { |
365 |
} |
1073 |
free_irq(dev->irq, dev); |
366 |
if (pAC->IoBase) { |
1074 |
} |
367 |
iounmap(pAC->IoBase); |
1075 |
if (pAC->IoBase) { |
368 |
} |
1076 |
iounmap(pAC->IoBase); |
369 |
if (pAC->pDescrMem) { |
1077 |
} |
370 |
BoardFreeMem(pAC); |
1078 |
if (CHIP_ID_YUKON_2(pAC)) { |
|
|
1079 |
SkY2FreeResources(pAC); |
1080 |
} else { |
1081 |
BoardFreeMem(pAC); |
1082 |
} |
371 |
} |
1083 |
} |
372 |
|
1084 |
|
373 |
} /* FreeResources */ |
1085 |
} /* FreeResources */ |
Lines 376-381
Link Here
|
376 |
MODULE_DESCRIPTION("SysKonnect SK-NET Gigabit Ethernet SK-98xx driver"); |
1088 |
MODULE_DESCRIPTION("SysKonnect SK-NET Gigabit Ethernet SK-98xx driver"); |
377 |
MODULE_LICENSE("GPL"); |
1089 |
MODULE_LICENSE("GPL"); |
378 |
|
1090 |
|
|
|
1091 |
|
379 |
#ifdef LINK_SPEED_A |
1092 |
#ifdef LINK_SPEED_A |
380 |
static char *Speed_A[SK_MAX_CARD_PARAM] = LINK_SPEED; |
1093 |
static char *Speed_A[SK_MAX_CARD_PARAM] = LINK_SPEED; |
381 |
#else |
1094 |
#else |
Lines 457-465
Link Here
|
457 |
static int IntsPerSec[SK_MAX_CARD_PARAM]; |
1170 |
static int IntsPerSec[SK_MAX_CARD_PARAM]; |
458 |
static char *Moderation[SK_MAX_CARD_PARAM]; |
1171 |
static char *Moderation[SK_MAX_CARD_PARAM]; |
459 |
static char *ModerationMask[SK_MAX_CARD_PARAM]; |
1172 |
static char *ModerationMask[SK_MAX_CARD_PARAM]; |
460 |
static char *AutoSizing[SK_MAX_CARD_PARAM]; |
|
|
461 |
static char *Stats[SK_MAX_CARD_PARAM]; |
462 |
|
1173 |
|
|
|
1174 |
static char *LowLatency[SK_MAX_CARD_PARAM]; |
1175 |
|
1176 |
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9) |
463 |
module_param_array(Speed_A, charp, NULL, 0); |
1177 |
module_param_array(Speed_A, charp, NULL, 0); |
464 |
module_param_array(Speed_B, charp, NULL, 0); |
1178 |
module_param_array(Speed_B, charp, NULL, 0); |
465 |
module_param_array(AutoNeg_A, charp, NULL, 0); |
1179 |
module_param_array(AutoNeg_A, charp, NULL, 0); |
Lines 476-484
Link Here
|
476 |
/* used for interrupt moderation */ |
1190 |
/* used for interrupt moderation */ |
477 |
module_param_array(IntsPerSec, int, NULL, 0); |
1191 |
module_param_array(IntsPerSec, int, NULL, 0); |
478 |
module_param_array(Moderation, charp, NULL, 0); |
1192 |
module_param_array(Moderation, charp, NULL, 0); |
479 |
module_param_array(Stats, charp, NULL, 0); |
|
|
480 |
module_param_array(ModerationMask, charp, NULL, 0); |
1193 |
module_param_array(ModerationMask, charp, NULL, 0); |
481 |
module_param_array(AutoSizing, charp, NULL, 0); |
1194 |
module_param_array(LowLatency, charp, NULL, 0); |
|
|
1195 |
#else |
1196 |
MODULE_PARM(Speed_A, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); |
1197 |
MODULE_PARM(Speed_B, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); |
1198 |
MODULE_PARM(AutoNeg_A, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); |
1199 |
MODULE_PARM(AutoNeg_B, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); |
1200 |
MODULE_PARM(DupCap_A, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); |
1201 |
MODULE_PARM(DupCap_B, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); |
1202 |
MODULE_PARM(FlowCtrl_A, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); |
1203 |
MODULE_PARM(FlowCtrl_B, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); |
1204 |
MODULE_PARM(Role_A, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); |
1205 |
MODULE_PARM(Role_B, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); |
1206 |
MODULE_PARM(ConType, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); |
1207 |
MODULE_PARM(PrefPort, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); |
1208 |
MODULE_PARM(RlmtMode, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); |
1209 |
MODULE_PARM(IntsPerSec, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "i"); |
1210 |
MODULE_PARM(Moderation, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); |
1211 |
MODULE_PARM(ModerationMask, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); |
1212 |
MODULE_PARM(LowLatency, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); |
1213 |
#endif |
1214 |
|
1215 |
|
1216 |
/***************************************************************************** |
1217 |
* |
1218 |
* sk98lin_remove_device - device deinit function |
1219 |
* |
1220 |
* Description: |
1221 |
* Disable adapter if it is still running, free resources, |
1222 |
* free device struct. |
1223 |
* |
1224 |
* Returns: N/A |
1225 |
*/ |
1226 |
|
1227 |
static void sk98lin_remove_device(struct pci_dev *pdev) |
1228 |
{ |
1229 |
DEV_NET *pNet; |
1230 |
SK_AC *pAC; |
1231 |
struct SK_NET_DEVICE *next; |
1232 |
unsigned long Flags; |
1233 |
struct net_device *dev = pci_get_drvdata(pdev); |
1234 |
|
1235 |
|
1236 |
/* Device not available. Return. */ |
1237 |
if (!dev) |
1238 |
return; |
1239 |
|
1240 |
pNet = (DEV_NET*) dev->priv; |
1241 |
pAC = pNet->pAC; |
1242 |
next = pAC->Next; |
1243 |
|
1244 |
netif_stop_queue(dev); |
1245 |
SkGeYellowLED(pAC, pAC->IoBase, 0); |
1246 |
|
1247 |
if(pAC->BoardLevel == SK_INIT_RUN) { |
1248 |
/* board is still alive */ |
1249 |
spin_lock_irqsave(&pAC->SlowPathLock, Flags); |
1250 |
SkLocalEventQueue(pAC, SKGE_RLMT, SK_RLMT_STOP, |
1251 |
0, -1, SK_FALSE); |
1252 |
SkLocalEventQueue(pAC, SKGE_RLMT, SK_RLMT_STOP, |
1253 |
1, -1, SK_TRUE); |
1254 |
|
1255 |
/* disable interrupts */ |
1256 |
SK_OUT32(pAC->IoBase, B0_IMSK, 0); |
1257 |
SkGeDeInit(pAC, pAC->IoBase); |
1258 |
spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); |
1259 |
pAC->BoardLevel = SK_INIT_DATA; |
1260 |
/* We do NOT check here, if IRQ was pending, of course*/ |
1261 |
} |
1262 |
|
1263 |
if(pAC->BoardLevel == SK_INIT_IO) { |
1264 |
/* board is still alive */ |
1265 |
SkGeDeInit(pAC, pAC->IoBase); |
1266 |
pAC->BoardLevel = SK_INIT_DATA; |
1267 |
} |
1268 |
|
1269 |
if ((pAC->GIni.GIMacsFound == 2) && pAC->RlmtNets == 2){ |
1270 |
unregister_netdev(pAC->dev[1]); |
1271 |
free_netdev(pAC->dev[1]); |
1272 |
} |
1273 |
|
1274 |
FreeResources(dev); |
1275 |
|
1276 |
#ifdef CONFIG_PROC_FS |
1277 |
/* Remove the sk98lin procfs device entries */ |
1278 |
if ((pAC->GIni.GIMacsFound == 2) && pAC->RlmtNets == 2){ |
1279 |
remove_proc_entry(pAC->dev[1]->name, pSkRootDir); |
1280 |
} |
1281 |
remove_proc_entry(pNet->InitialDevName, pSkRootDir); |
1282 |
#endif |
1283 |
|
1284 |
dev->get_stats = NULL; |
1285 |
/* |
1286 |
* otherwise unregister_netdev calls get_stats with |
1287 |
* invalid IO ... :-( |
1288 |
*/ |
1289 |
unregister_netdev(dev); |
1290 |
free_netdev(dev); |
1291 |
kfree(pAC); |
1292 |
sk98lin_max_boards_found--; |
1293 |
|
1294 |
#ifdef CONFIG_PROC_FS |
1295 |
/* Remove all Proc entries if last device */ |
1296 |
if (sk98lin_max_boards_found == 0) { |
1297 |
/* clear proc-dir */ |
1298 |
remove_proc_entry(pSkRootDir->name, proc_net); |
1299 |
} |
1300 |
#endif |
1301 |
|
1302 |
} |
1303 |
|
482 |
|
1304 |
|
483 |
/***************************************************************************** |
1305 |
/***************************************************************************** |
484 |
* |
1306 |
* |
Lines 516-527
Link Here
|
516 |
spin_lock_init(&pAC->TxPort[i][0].TxDesRingLock); |
1338 |
spin_lock_init(&pAC->TxPort[i][0].TxDesRingLock); |
517 |
spin_lock_init(&pAC->RxPort[i].RxDesRingLock); |
1339 |
spin_lock_init(&pAC->RxPort[i].RxDesRingLock); |
518 |
} |
1340 |
} |
519 |
spin_lock_init(&pAC->SlowPathLock); |
|
|
520 |
|
1341 |
|
521 |
/* setup phy_id blink timer */ |
1342 |
spin_lock_init(&pAC->SlowPathLock); |
522 |
pAC->BlinkTimer.function = SkGeBlinkTimer; |
1343 |
spin_lock_init(&pAC->TxQueueLock); /* for Yukon2 chipsets */ |
523 |
pAC->BlinkTimer.data = (unsigned long) dev; |
1344 |
spin_lock_init(&pAC->SetPutIndexLock); /* for Yukon2 chipsets */ |
524 |
init_timer(&pAC->BlinkTimer); |
|
|
525 |
|
1345 |
|
526 |
/* level 0 init common modules here */ |
1346 |
/* level 0 init common modules here */ |
527 |
|
1347 |
|
Lines 545-554
Link Here
|
545 |
SK_PNMI_SET_DRIVER_DESCR(pAC, DescrString); |
1365 |
SK_PNMI_SET_DRIVER_DESCR(pAC, DescrString); |
546 |
SK_PNMI_SET_DRIVER_VER(pAC, VerStr); |
1366 |
SK_PNMI_SET_DRIVER_VER(pAC, VerStr); |
547 |
|
1367 |
|
548 |
spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); |
|
|
549 |
|
550 |
/* level 1 init common modules here (HW init) */ |
1368 |
/* level 1 init common modules here (HW init) */ |
551 |
spin_lock_irqsave(&pAC->SlowPathLock, Flags); |
|
|
552 |
if (SkGeInit(pAC, pAC->IoBase, SK_INIT_IO) != 0) { |
1369 |
if (SkGeInit(pAC, pAC->IoBase, SK_INIT_IO) != 0) { |
553 |
printk("sk98lin: HWInit (1) failed.\n"); |
1370 |
printk("sk98lin: HWInit (1) failed.\n"); |
554 |
spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); |
1371 |
spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); |
Lines 560-610
Link Here
|
560 |
SkAddrInit( pAC, pAC->IoBase, SK_INIT_IO); |
1377 |
SkAddrInit( pAC, pAC->IoBase, SK_INIT_IO); |
561 |
SkRlmtInit( pAC, pAC->IoBase, SK_INIT_IO); |
1378 |
SkRlmtInit( pAC, pAC->IoBase, SK_INIT_IO); |
562 |
SkTimerInit(pAC, pAC->IoBase, SK_INIT_IO); |
1379 |
SkTimerInit(pAC, pAC->IoBase, SK_INIT_IO); |
|
|
1380 |
#ifdef Y2_RECOVERY |
1381 |
/* mark entries invalid */ |
1382 |
pAC->LastPort = 3; |
1383 |
pAC->LastOpc = 0xFF; |
1384 |
#endif |
563 |
|
1385 |
|
564 |
/* Set chipset type support */ |
1386 |
/* Set chipset type support */ |
565 |
pAC->ChipsetType = 0; |
|
|
566 |
if ((pAC->GIni.GIChipId == CHIP_ID_YUKON) || |
1387 |
if ((pAC->GIni.GIChipId == CHIP_ID_YUKON) || |
567 |
(pAC->GIni.GIChipId == CHIP_ID_YUKON_LITE)) { |
1388 |
(pAC->GIni.GIChipId == CHIP_ID_YUKON_LITE) || |
568 |
pAC->ChipsetType = 1; |
1389 |
(pAC->GIni.GIChipId == CHIP_ID_YUKON_LP)) { |
|
|
1390 |
pAC->ChipsetType = 1; /* Yukon chipset (descriptor logic) */ |
1391 |
} else if (CHIP_ID_YUKON_2(pAC)) { |
1392 |
pAC->ChipsetType = 2; /* Yukon2 chipset (list logic) */ |
1393 |
} else { |
1394 |
pAC->ChipsetType = 0; /* Genesis chipset (descriptor logic) */ |
569 |
} |
1395 |
} |
570 |
|
1396 |
|
|
|
1397 |
/* wake on lan support */ |
1398 |
pAC->WolInfo.SupportedWolOptions = 0; |
1399 |
#if defined (ETHTOOL_GWOL) && defined (ETHTOOL_SWOL) |
1400 |
if (pAC->GIni.GIChipId != CHIP_ID_GENESIS) { |
1401 |
pAC->WolInfo.SupportedWolOptions = WAKE_MAGIC; |
1402 |
if (pAC->GIni.GIChipId == CHIP_ID_YUKON) { |
1403 |
if (pAC->GIni.GIChipRev == 0) { |
1404 |
pAC->WolInfo.SupportedWolOptions = 0; |
1405 |
} |
1406 |
} |
1407 |
} |
1408 |
#endif |
1409 |
pAC->WolInfo.ConfiguredWolOptions = pAC->WolInfo.SupportedWolOptions; |
1410 |
|
571 |
GetConfiguration(pAC); |
1411 |
GetConfiguration(pAC); |
572 |
if (pAC->RlmtNets == 2) { |
1412 |
if (pAC->RlmtNets == 2) { |
573 |
pAC->GIni.GIPortUsage = SK_MUL_LINK; |
1413 |
pAC->GIni.GIPortUsage = SK_MUL_LINK; |
574 |
} |
1414 |
} |
575 |
|
1415 |
|
576 |
pAC->BoardLevel = SK_INIT_IO; |
1416 |
pAC->BoardLevel = SK_INIT_IO; |
577 |
spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); |
1417 |
spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); |
578 |
|
1418 |
|
579 |
if (pAC->GIni.GIMacsFound == 2) { |
1419 |
if (!CHIP_ID_YUKON_2(pAC)) { |
580 |
Ret = request_irq(dev->irq, SkGeIsr, SA_SHIRQ, pAC->Name, dev); |
1420 |
#ifdef CONFIG_SK98LIN_NAPI |
581 |
} else if (pAC->GIni.GIMacsFound == 1) { |
1421 |
dev->poll = &SkGePoll; |
582 |
Ret = request_irq(dev->irq, SkGeIsrOnePort, SA_SHIRQ, |
1422 |
dev->weight = 64; |
583 |
pAC->Name, dev); |
1423 |
#endif |
584 |
} else { |
1424 |
if (pAC->GIni.GIMacsFound == 2) { |
585 |
printk(KERN_WARNING "sk98lin: Illegal number of ports: %d\n", |
1425 |
Ret = request_irq(dev->irq, SkGeIsr, SA_SHIRQ, dev->name, dev); |
586 |
pAC->GIni.GIMacsFound); |
1426 |
} else if (pAC->GIni.GIMacsFound == 1) { |
587 |
return -EAGAIN; |
1427 |
Ret = request_irq(dev->irq, SkGeIsrOnePort, SA_SHIRQ, dev->name, dev); |
|
|
1428 |
} else { |
1429 |
printk(KERN_WARNING "sk98lin: Illegal number of ports: %d\n", |
1430 |
pAC->GIni.GIMacsFound); |
1431 |
return -EAGAIN; |
1432 |
} |
1433 |
} |
1434 |
else { |
1435 |
Ret = request_irq(dev->irq, SkY2Isr, SA_SHIRQ, dev->name, dev); |
1436 |
#ifdef CONFIG_SK98LIN_NAPI |
1437 |
dev->poll = &SkY2Poll; |
1438 |
dev->weight = 64; |
1439 |
#endif |
588 |
} |
1440 |
} |
589 |
|
1441 |
|
590 |
if (Ret) { |
1442 |
if (Ret) { |
591 |
printk(KERN_WARNING "sk98lin: Requested IRQ %d is busy.\n", |
1443 |
printk(KERN_WARNING "sk98lin: Requested IRQ %d is busy.\n", |
592 |
dev->irq); |
1444 |
dev->irq); |
593 |
return -EAGAIN; |
1445 |
return -EAGAIN; |
594 |
} |
1446 |
} |
595 |
pAC->AllocFlag |= SK_ALLOC_IRQ; |
1447 |
pAC->AllocFlag |= SK_ALLOC_IRQ; |
596 |
|
1448 |
|
597 |
/* Alloc memory for this board (Mem for RxD/TxD) : */ |
1449 |
/* |
598 |
if(!BoardAllocMem(pAC)) { |
1450 |
** Alloc descriptor/LETable memory for this board (both RxD/TxD) |
599 |
printk("No memory for descriptor rings.\n"); |
1451 |
*/ |
600 |
return(-EAGAIN); |
1452 |
if (CHIP_ID_YUKON_2(pAC)) { |
|
|
1453 |
if (!SkY2AllocateResources(pAC)) { |
1454 |
printk("No memory for Yukon2 settings\n"); |
1455 |
return(-EAGAIN); |
1456 |
} |
1457 |
} else { |
1458 |
if(!BoardAllocMem(pAC)) { |
1459 |
printk("No memory for descriptor rings.\n"); |
1460 |
return(-EAGAIN); |
1461 |
} |
601 |
} |
1462 |
} |
602 |
|
1463 |
|
|
|
1464 |
#ifdef SK_USE_CSUM |
603 |
SkCsSetReceiveFlags(pAC, |
1465 |
SkCsSetReceiveFlags(pAC, |
604 |
SKCS_PROTO_IP | SKCS_PROTO_TCP | SKCS_PROTO_UDP, |
1466 |
SKCS_PROTO_IP | SKCS_PROTO_TCP | SKCS_PROTO_UDP, |
605 |
&pAC->CsOfs1, &pAC->CsOfs2, 0); |
1467 |
&pAC->CsOfs1, &pAC->CsOfs2, 0); |
606 |
pAC->CsOfs = (pAC->CsOfs2 << 16) | pAC->CsOfs1; |
1468 |
pAC->CsOfs = (pAC->CsOfs2 << 16) | pAC->CsOfs1; |
|
|
1469 |
#endif |
607 |
|
1470 |
|
|
|
1471 |
/* |
1472 |
** Function BoardInitMem() for Yukon dependent settings... |
1473 |
*/ |
608 |
BoardInitMem(pAC); |
1474 |
BoardInitMem(pAC); |
609 |
/* tschilling: New common function with minimum size check. */ |
1475 |
/* tschilling: New common function with minimum size check. */ |
610 |
DualNet = SK_FALSE; |
1476 |
DualNet = SK_FALSE; |
Lines 616-626
Link Here
|
616 |
pAC, |
1482 |
pAC, |
617 |
pAC->ActivePort, |
1483 |
pAC->ActivePort, |
618 |
DualNet)) { |
1484 |
DualNet)) { |
619 |
BoardFreeMem(pAC); |
1485 |
if (CHIP_ID_YUKON_2(pAC)) { |
|
|
1486 |
SkY2FreeResources(pAC); |
1487 |
} else { |
1488 |
BoardFreeMem(pAC); |
1489 |
} |
1490 |
|
620 |
printk("sk98lin: SkGeInitAssignRamToQueues failed.\n"); |
1491 |
printk("sk98lin: SkGeInitAssignRamToQueues failed.\n"); |
621 |
return(-EAGAIN); |
1492 |
return(-EAGAIN); |
622 |
} |
1493 |
} |
623 |
|
1494 |
|
|
|
1495 |
/* |
1496 |
* Register the device here |
1497 |
*/ |
1498 |
pAC->Next = SkGeRootDev; |
1499 |
SkGeRootDev = dev; |
1500 |
|
624 |
return (0); |
1501 |
return (0); |
625 |
} /* SkGeBoardInit */ |
1502 |
} /* SkGeBoardInit */ |
626 |
|
1503 |
|
Lines 710-725
Link Here
|
710 |
|
1587 |
|
711 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, |
1588 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, |
712 |
("BoardFreeMem\n")); |
1589 |
("BoardFreeMem\n")); |
|
|
1590 |
|
1591 |
if (pAC->pDescrMem) { |
1592 |
|
713 |
#if (BITS_PER_LONG == 32) |
1593 |
#if (BITS_PER_LONG == 32) |
714 |
AllocLength = (RX_RING_SIZE + TX_RING_SIZE) * pAC->GIni.GIMacsFound + 8; |
1594 |
AllocLength = (RX_RING_SIZE + TX_RING_SIZE) * pAC->GIni.GIMacsFound + 8; |
715 |
#else |
1595 |
#else |
716 |
AllocLength = (RX_RING_SIZE + TX_RING_SIZE) * pAC->GIni.GIMacsFound |
1596 |
AllocLength = (RX_RING_SIZE + TX_RING_SIZE) * pAC->GIni.GIMacsFound |
717 |
+ RX_RING_SIZE + 8; |
1597 |
+ RX_RING_SIZE + 8; |
718 |
#endif |
1598 |
#endif |
719 |
|
1599 |
|
720 |
pci_free_consistent(pAC->PciDev, AllocLength, |
1600 |
pci_free_consistent(pAC->PciDev, AllocLength, |
721 |
pAC->pDescrMem, pAC->pDescrMemDMA); |
1601 |
pAC->pDescrMem, pAC->pDescrMemDMA); |
722 |
pAC->pDescrMem = NULL; |
1602 |
pAC->pDescrMem = NULL; |
|
|
1603 |
} |
723 |
} /* BoardFreeMem */ |
1604 |
} /* BoardFreeMem */ |
724 |
|
1605 |
|
725 |
|
1606 |
|
Lines 728-734
Link Here
|
728 |
* BoardInitMem - initiate the descriptor rings |
1609 |
* BoardInitMem - initiate the descriptor rings |
729 |
* |
1610 |
* |
730 |
* Description: |
1611 |
* Description: |
731 |
* This function sets the descriptor rings up in memory. |
1612 |
* This function sets the descriptor rings or LETables up in memory. |
732 |
* The adapter is initialized with the descriptor start addresses. |
1613 |
* The adapter is initialized with the descriptor start addresses. |
733 |
* |
1614 |
* |
734 |
* Returns: N/A |
1615 |
* Returns: N/A |
Lines 743-776
Link Here
|
743 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, |
1624 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, |
744 |
("BoardInitMem\n")); |
1625 |
("BoardInitMem\n")); |
745 |
|
1626 |
|
746 |
RxDescrSize = (((sizeof(RXD) - 1) / DESCR_ALIGN) + 1) * DESCR_ALIGN; |
1627 |
if (!pAC->GIni.GIYukon2) { |
747 |
pAC->RxDescrPerRing = RX_RING_SIZE / RxDescrSize; |
1628 |
RxDescrSize = (((sizeof(RXD) - 1) / DESCR_ALIGN) + 1) * DESCR_ALIGN; |
748 |
TxDescrSize = (((sizeof(TXD) - 1) / DESCR_ALIGN) + 1) * DESCR_ALIGN; |
1629 |
pAC->RxDescrPerRing = RX_RING_SIZE / RxDescrSize; |
749 |
pAC->TxDescrPerRing = TX_RING_SIZE / RxDescrSize; |
1630 |
TxDescrSize = (((sizeof(TXD) - 1) / DESCR_ALIGN) + 1) * DESCR_ALIGN; |
|
|
1631 |
pAC->TxDescrPerRing = TX_RING_SIZE / RxDescrSize; |
750 |
|
1632 |
|
751 |
for (i=0; i<pAC->GIni.GIMacsFound; i++) { |
1633 |
for (i=0; i<pAC->GIni.GIMacsFound; i++) { |
752 |
SetupRing( |
1634 |
SetupRing( |
753 |
pAC, |
1635 |
pAC, |
754 |
pAC->TxPort[i][0].pTxDescrRing, |
1636 |
pAC->TxPort[i][0].pTxDescrRing, |
755 |
pAC->TxPort[i][0].VTxDescrRing, |
1637 |
pAC->TxPort[i][0].VTxDescrRing, |
756 |
(RXD**)&pAC->TxPort[i][0].pTxdRingHead, |
1638 |
(RXD**)&pAC->TxPort[i][0].pTxdRingHead, |
757 |
(RXD**)&pAC->TxPort[i][0].pTxdRingTail, |
1639 |
(RXD**)&pAC->TxPort[i][0].pTxdRingTail, |
758 |
(RXD**)&pAC->TxPort[i][0].pTxdRingPrev, |
1640 |
(RXD**)&pAC->TxPort[i][0].pTxdRingPrev, |
759 |
&pAC->TxPort[i][0].TxdRingFree, |
1641 |
&pAC->TxPort[i][0].TxdRingFree, |
760 |
SK_TRUE); |
1642 |
&pAC->TxPort[i][0].TxdRingPrevFree, |
761 |
SetupRing( |
1643 |
SK_TRUE); |
762 |
pAC, |
1644 |
SetupRing( |
763 |
pAC->RxPort[i].pRxDescrRing, |
1645 |
pAC, |
764 |
pAC->RxPort[i].VRxDescrRing, |
1646 |
pAC->RxPort[i].pRxDescrRing, |
765 |
&pAC->RxPort[i].pRxdRingHead, |
1647 |
pAC->RxPort[i].VRxDescrRing, |
766 |
&pAC->RxPort[i].pRxdRingTail, |
1648 |
&pAC->RxPort[i].pRxdRingHead, |
767 |
&pAC->RxPort[i].pRxdRingPrev, |
1649 |
&pAC->RxPort[i].pRxdRingTail, |
768 |
&pAC->RxPort[i].RxdRingFree, |
1650 |
&pAC->RxPort[i].pRxdRingPrev, |
769 |
SK_FALSE); |
1651 |
&pAC->RxPort[i].RxdRingFree, |
|
|
1652 |
&pAC->RxPort[i].RxdRingFree, |
1653 |
SK_FALSE); |
1654 |
} |
770 |
} |
1655 |
} |
771 |
} /* BoardInitMem */ |
1656 |
} /* BoardInitMem */ |
772 |
|
1657 |
|
773 |
|
|
|
774 |
/***************************************************************************** |
1658 |
/***************************************************************************** |
775 |
* |
1659 |
* |
776 |
* SetupRing - create one descriptor ring |
1660 |
* SetupRing - create one descriptor ring |
Lines 790-795
Link Here
|
790 |
RXD **ppRingTail, /* address where the tail should be written */ |
1674 |
RXD **ppRingTail, /* address where the tail should be written */ |
791 |
RXD **ppRingPrev, /* address where the tail should be written */ |
1675 |
RXD **ppRingPrev, /* address where the tail should be written */ |
792 |
int *pRingFree, /* address where the # of free descr. goes */ |
1676 |
int *pRingFree, /* address where the # of free descr. goes */ |
|
|
1677 |
int *pRingPrevFree, /* address where the # of free descr. goes */ |
793 |
SK_BOOL IsTx) /* flag: is this a tx ring */ |
1678 |
SK_BOOL IsTx) /* flag: is this a tx ring */ |
794 |
{ |
1679 |
{ |
795 |
int i; /* loop counter */ |
1680 |
int i; /* loop counter */ |
Lines 832-842
Link Here
|
832 |
} |
1717 |
} |
833 |
pPrevDescr->pNextRxd = (RXD*) pMemArea; |
1718 |
pPrevDescr->pNextRxd = (RXD*) pMemArea; |
834 |
pPrevDescr->VNextRxd = VMemArea; |
1719 |
pPrevDescr->VNextRxd = VMemArea; |
835 |
pDescr = (RXD*) pMemArea; |
1720 |
pDescr = (RXD*) pMemArea; |
836 |
*ppRingHead = (RXD*) pMemArea; |
1721 |
*ppRingHead = (RXD*) pMemArea; |
837 |
*ppRingTail = *ppRingHead; |
1722 |
*ppRingTail = *ppRingHead; |
838 |
*ppRingPrev = pPrevDescr; |
1723 |
*ppRingPrev = pPrevDescr; |
839 |
*pRingFree = DescrNum; |
1724 |
*pRingFree = DescrNum; |
|
|
1725 |
*pRingPrevFree = DescrNum; |
840 |
} /* SetupRing */ |
1726 |
} /* SetupRing */ |
841 |
|
1727 |
|
842 |
|
1728 |
|
Lines 901-907
Link Here
|
901 |
SK_AC *pAC; |
1787 |
SK_AC *pAC; |
902 |
SK_U32 IntSrc; /* interrupts source register contents */ |
1788 |
SK_U32 IntSrc; /* interrupts source register contents */ |
903 |
|
1789 |
|
904 |
pNet = netdev_priv(dev); |
1790 |
pNet = (DEV_NET*) dev->priv; |
905 |
pAC = pNet->pAC; |
1791 |
pAC = pNet->pAC; |
906 |
|
1792 |
|
907 |
/* |
1793 |
/* |
Lines 912-917
Link Here
|
912 |
return SkIsrRetNone; |
1798 |
return SkIsrRetNone; |
913 |
} |
1799 |
} |
914 |
|
1800 |
|
|
|
1801 |
#ifdef CONFIG_SK98LIN_NAPI |
1802 |
if (netif_rx_schedule_prep(dev)) { |
1803 |
pAC->GIni.GIValIrqMask &= ~(NAPI_DRV_IRQS); |
1804 |
SK_OUT32(pAC->IoBase, B0_IMSK, pAC->GIni.GIValIrqMask); |
1805 |
__netif_rx_schedule(dev); |
1806 |
} |
1807 |
|
1808 |
#ifdef USE_TX_COMPLETE /* only if tx complete interrupt used */ |
1809 |
if (IntSrc & IS_XA1_F) { |
1810 |
CLEAR_TX_IRQ(0, TX_PRIO_LOW); |
1811 |
} |
1812 |
if (IntSrc & IS_XA2_F) { |
1813 |
CLEAR_TX_IRQ(1, TX_PRIO_LOW); |
1814 |
} |
1815 |
#endif |
1816 |
|
1817 |
|
1818 |
#else |
915 |
while (((IntSrc & IRQ_MASK) & ~SPECIAL_IRQS) != 0) { |
1819 |
while (((IntSrc & IRQ_MASK) & ~SPECIAL_IRQS) != 0) { |
916 |
#if 0 /* software irq currently not used */ |
1820 |
#if 0 /* software irq currently not used */ |
917 |
if (IntSrc & IS_IRQ_SW) { |
1821 |
if (IntSrc & IS_IRQ_SW) { |
Lines 925-930
Link Here
|
925 |
SK_DBGCAT_DRV_INT_SRC, |
1829 |
SK_DBGCAT_DRV_INT_SRC, |
926 |
("EOF RX1 IRQ\n")); |
1830 |
("EOF RX1 IRQ\n")); |
927 |
ReceiveIrq(pAC, &pAC->RxPort[0], SK_TRUE); |
1831 |
ReceiveIrq(pAC, &pAC->RxPort[0], SK_TRUE); |
|
|
1832 |
CLEAR_AND_START_RX(0); |
928 |
SK_PNMI_CNT_RX_INTR(pAC, 0); |
1833 |
SK_PNMI_CNT_RX_INTR(pAC, 0); |
929 |
} |
1834 |
} |
930 |
if (IntSrc & IS_R2_F) { |
1835 |
if (IntSrc & IS_R2_F) { |
Lines 932-937
Link Here
|
932 |
SK_DBGCAT_DRV_INT_SRC, |
1837 |
SK_DBGCAT_DRV_INT_SRC, |
933 |
("EOF RX2 IRQ\n")); |
1838 |
("EOF RX2 IRQ\n")); |
934 |
ReceiveIrq(pAC, &pAC->RxPort[1], SK_TRUE); |
1839 |
ReceiveIrq(pAC, &pAC->RxPort[1], SK_TRUE); |
|
|
1840 |
CLEAR_AND_START_RX(1); |
935 |
SK_PNMI_CNT_RX_INTR(pAC, 1); |
1841 |
SK_PNMI_CNT_RX_INTR(pAC, 1); |
936 |
} |
1842 |
} |
937 |
#ifdef USE_TX_COMPLETE /* only if tx complete interrupt used */ |
1843 |
#ifdef USE_TX_COMPLETE /* only if tx complete interrupt used */ |
Lines 939-944
Link Here
|
939 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, |
1845 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, |
940 |
SK_DBGCAT_DRV_INT_SRC, |
1846 |
SK_DBGCAT_DRV_INT_SRC, |
941 |
("EOF AS TX1 IRQ\n")); |
1847 |
("EOF AS TX1 IRQ\n")); |
|
|
1848 |
CLEAR_TX_IRQ(0, TX_PRIO_LOW); |
942 |
SK_PNMI_CNT_TX_INTR(pAC, 0); |
1849 |
SK_PNMI_CNT_TX_INTR(pAC, 0); |
943 |
spin_lock(&pAC->TxPort[0][TX_PRIO_LOW].TxDesRingLock); |
1850 |
spin_lock(&pAC->TxPort[0][TX_PRIO_LOW].TxDesRingLock); |
944 |
FreeTxDescriptors(pAC, &pAC->TxPort[0][TX_PRIO_LOW]); |
1851 |
FreeTxDescriptors(pAC, &pAC->TxPort[0][TX_PRIO_LOW]); |
Lines 948-953
Link Here
|
948 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, |
1855 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, |
949 |
SK_DBGCAT_DRV_INT_SRC, |
1856 |
SK_DBGCAT_DRV_INT_SRC, |
950 |
("EOF AS TX2 IRQ\n")); |
1857 |
("EOF AS TX2 IRQ\n")); |
|
|
1858 |
CLEAR_TX_IRQ(1, TX_PRIO_LOW); |
951 |
SK_PNMI_CNT_TX_INTR(pAC, 1); |
1859 |
SK_PNMI_CNT_TX_INTR(pAC, 1); |
952 |
spin_lock(&pAC->TxPort[1][TX_PRIO_LOW].TxDesRingLock); |
1860 |
spin_lock(&pAC->TxPort[1][TX_PRIO_LOW].TxDesRingLock); |
953 |
FreeTxDescriptors(pAC, &pAC->TxPort[1][TX_PRIO_LOW]); |
1861 |
FreeTxDescriptors(pAC, &pAC->TxPort[1][TX_PRIO_LOW]); |
Lines 958-995
Link Here
|
958 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, |
1866 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, |
959 |
SK_DBGCAT_DRV_INT_SRC, |
1867 |
SK_DBGCAT_DRV_INT_SRC, |
960 |
("EOF SY TX1 IRQ\n")); |
1868 |
("EOF SY TX1 IRQ\n")); |
|
|
1869 |
CLEAR_TX_IRQ(0, TX_PRIO_HIGH); |
961 |
SK_PNMI_CNT_TX_INTR(pAC, 1); |
1870 |
SK_PNMI_CNT_TX_INTR(pAC, 1); |
962 |
spin_lock(&pAC->TxPort[0][TX_PRIO_HIGH].TxDesRingLock); |
1871 |
spin_lock(&pAC->TxPort[0][TX_PRIO_HIGH].TxDesRingLock); |
963 |
FreeTxDescriptors(pAC, 0, TX_PRIO_HIGH); |
1872 |
FreeTxDescriptors(pAC, 0, TX_PRIO_HIGH); |
964 |
spin_unlock(&pAC->TxPort[0][TX_PRIO_HIGH].TxDesRingLock); |
1873 |
spin_unlock(&pAC->TxPort[0][TX_PRIO_HIGH].TxDesRingLock); |
965 |
ClearTxIrq(pAC, 0, TX_PRIO_HIGH); |
|
|
966 |
} |
1874 |
} |
967 |
if (IntSrc & IS_XS2_F) { |
1875 |
if (IntSrc & IS_XS2_F) { |
968 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, |
1876 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, |
969 |
SK_DBGCAT_DRV_INT_SRC, |
1877 |
SK_DBGCAT_DRV_INT_SRC, |
970 |
("EOF SY TX2 IRQ\n")); |
1878 |
("EOF SY TX2 IRQ\n")); |
|
|
1879 |
CLEAR_TX_IRQ(1, TX_PRIO_HIGH); |
971 |
SK_PNMI_CNT_TX_INTR(pAC, 1); |
1880 |
SK_PNMI_CNT_TX_INTR(pAC, 1); |
972 |
spin_lock(&pAC->TxPort[1][TX_PRIO_HIGH].TxDesRingLock); |
1881 |
spin_lock(&pAC->TxPort[1][TX_PRIO_HIGH].TxDesRingLock); |
973 |
FreeTxDescriptors(pAC, 1, TX_PRIO_HIGH); |
1882 |
FreeTxDescriptors(pAC, 1, TX_PRIO_HIGH); |
974 |
spin_unlock(&pAC->TxPort[1][TX_PRIO_HIGH].TxDesRingLock); |
1883 |
spin_unlock(&pAC->TxPort[1][TX_PRIO_HIGH].TxDesRingLock); |
975 |
ClearTxIrq(pAC, 1, TX_PRIO_HIGH); |
|
|
976 |
} |
1884 |
} |
977 |
#endif |
1885 |
#endif |
978 |
#endif |
1886 |
#endif |
979 |
|
1887 |
|
980 |
/* do all IO at once */ |
|
|
981 |
if (IntSrc & IS_R1_F) |
982 |
ClearAndStartRx(pAC, 0); |
983 |
if (IntSrc & IS_R2_F) |
984 |
ClearAndStartRx(pAC, 1); |
985 |
#ifdef USE_TX_COMPLETE /* only if tx complete interrupt used */ |
986 |
if (IntSrc & IS_XA1_F) |
987 |
ClearTxIrq(pAC, 0, TX_PRIO_LOW); |
988 |
if (IntSrc & IS_XA2_F) |
989 |
ClearTxIrq(pAC, 1, TX_PRIO_LOW); |
990 |
#endif |
991 |
SK_IN32(pAC->IoBase, B0_ISRC, &IntSrc); |
1888 |
SK_IN32(pAC->IoBase, B0_ISRC, &IntSrc); |
992 |
} /* while (IntSrc & IRQ_MASK != 0) */ |
1889 |
} /* while (IntSrc & IRQ_MASK != 0) */ |
|
|
1890 |
#endif |
993 |
|
1891 |
|
994 |
IntSrc &= pAC->GIni.GIValIrqMask; |
1892 |
IntSrc &= pAC->GIni.GIValIrqMask; |
995 |
if ((IntSrc & SPECIAL_IRQS) || pAC->CheckQueue) { |
1893 |
if ((IntSrc & SPECIAL_IRQS) || pAC->CheckQueue) { |
Lines 1003-1020
Link Here
|
1003 |
SkEventDispatcher(pAC, pAC->IoBase); |
1901 |
SkEventDispatcher(pAC, pAC->IoBase); |
1004 |
spin_unlock(&pAC->SlowPathLock); |
1902 |
spin_unlock(&pAC->SlowPathLock); |
1005 |
} |
1903 |
} |
1006 |
/* |
1904 |
|
1007 |
* do it all again is case we cleared an interrupt that |
1905 |
#ifndef CONFIG_SK98LIN_NAPI |
1008 |
* came in after handling the ring (OUTs may be delayed |
1906 |
/* Handle interrupts */ |
1009 |
* in hardware buffers, but are through after IN) |
|
|
1010 |
* |
1011 |
* rroesler: has been commented out and shifted to |
1012 |
* SkGeDrvEvent(), because it is timer |
1013 |
* guarded now |
1014 |
* |
1015 |
ReceiveIrq(pAC, &pAC->RxPort[0], SK_TRUE); |
1907 |
ReceiveIrq(pAC, &pAC->RxPort[0], SK_TRUE); |
1016 |
ReceiveIrq(pAC, &pAC->RxPort[1], SK_TRUE); |
1908 |
ReceiveIrq(pAC, &pAC->RxPort[1], SK_TRUE); |
1017 |
*/ |
1909 |
#endif |
1018 |
|
1910 |
|
1019 |
if (pAC->CheckQueue) { |
1911 |
if (pAC->CheckQueue) { |
1020 |
pAC->CheckQueue = SK_FALSE; |
1912 |
pAC->CheckQueue = SK_FALSE; |
Lines 1050-1056
Link Here
|
1050 |
SK_AC *pAC; |
1942 |
SK_AC *pAC; |
1051 |
SK_U32 IntSrc; /* interrupts source register contents */ |
1943 |
SK_U32 IntSrc; /* interrupts source register contents */ |
1052 |
|
1944 |
|
1053 |
pNet = netdev_priv(dev); |
1945 |
pNet = (DEV_NET*) dev->priv; |
1054 |
pAC = pNet->pAC; |
1946 |
pAC = pNet->pAC; |
1055 |
|
1947 |
|
1056 |
/* |
1948 |
/* |
Lines 1061-1066
Link Here
|
1061 |
return SkIsrRetNone; |
1953 |
return SkIsrRetNone; |
1062 |
} |
1954 |
} |
1063 |
|
1955 |
|
|
|
1956 |
#ifdef CONFIG_SK98LIN_NAPI |
1957 |
if (netif_rx_schedule_prep(dev)) { |
1958 |
// CLEAR_AND_START_RX(0); |
1959 |
// CLEAR_TX_IRQ(0, TX_PRIO_LOW); |
1960 |
pAC->GIni.GIValIrqMask &= ~(NAPI_DRV_IRQS); |
1961 |
SK_OUT32(pAC->IoBase, B0_IMSK, pAC->GIni.GIValIrqMask); |
1962 |
__netif_rx_schedule(dev); |
1963 |
} |
1964 |
|
1965 |
#ifdef USE_TX_COMPLETE /* only if tx complete interrupt used */ |
1966 |
if (IntSrc & IS_XA1_F) { |
1967 |
CLEAR_TX_IRQ(0, TX_PRIO_LOW); |
1968 |
} |
1969 |
#endif |
1970 |
#else |
1064 |
while (((IntSrc & IRQ_MASK) & ~SPECIAL_IRQS) != 0) { |
1971 |
while (((IntSrc & IRQ_MASK) & ~SPECIAL_IRQS) != 0) { |
1065 |
#if 0 /* software irq currently not used */ |
1972 |
#if 0 /* software irq currently not used */ |
1066 |
if (IntSrc & IS_IRQ_SW) { |
1973 |
if (IntSrc & IS_IRQ_SW) { |
Lines 1074-1079
Link Here
|
1074 |
SK_DBGCAT_DRV_INT_SRC, |
1981 |
SK_DBGCAT_DRV_INT_SRC, |
1075 |
("EOF RX1 IRQ\n")); |
1982 |
("EOF RX1 IRQ\n")); |
1076 |
ReceiveIrq(pAC, &pAC->RxPort[0], SK_TRUE); |
1983 |
ReceiveIrq(pAC, &pAC->RxPort[0], SK_TRUE); |
|
|
1984 |
CLEAR_AND_START_RX(0); |
1077 |
SK_PNMI_CNT_RX_INTR(pAC, 0); |
1985 |
SK_PNMI_CNT_RX_INTR(pAC, 0); |
1078 |
} |
1986 |
} |
1079 |
#ifdef USE_TX_COMPLETE /* only if tx complete interrupt used */ |
1987 |
#ifdef USE_TX_COMPLETE /* only if tx complete interrupt used */ |
Lines 1081-1086
Link Here
|
1081 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, |
1989 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, |
1082 |
SK_DBGCAT_DRV_INT_SRC, |
1990 |
SK_DBGCAT_DRV_INT_SRC, |
1083 |
("EOF AS TX1 IRQ\n")); |
1991 |
("EOF AS TX1 IRQ\n")); |
|
|
1992 |
CLEAR_TX_IRQ(0, TX_PRIO_LOW); |
1084 |
SK_PNMI_CNT_TX_INTR(pAC, 0); |
1993 |
SK_PNMI_CNT_TX_INTR(pAC, 0); |
1085 |
spin_lock(&pAC->TxPort[0][TX_PRIO_LOW].TxDesRingLock); |
1994 |
spin_lock(&pAC->TxPort[0][TX_PRIO_LOW].TxDesRingLock); |
1086 |
FreeTxDescriptors(pAC, &pAC->TxPort[0][TX_PRIO_LOW]); |
1995 |
FreeTxDescriptors(pAC, &pAC->TxPort[0][TX_PRIO_LOW]); |
Lines 1091-1114
Link Here
|
1091 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, |
2000 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, |
1092 |
SK_DBGCAT_DRV_INT_SRC, |
2001 |
SK_DBGCAT_DRV_INT_SRC, |
1093 |
("EOF SY TX1 IRQ\n")); |
2002 |
("EOF SY TX1 IRQ\n")); |
|
|
2003 |
CLEAR_TX_IRQ(0, TX_PRIO_HIGH); |
1094 |
SK_PNMI_CNT_TX_INTR(pAC, 0); |
2004 |
SK_PNMI_CNT_TX_INTR(pAC, 0); |
1095 |
spin_lock(&pAC->TxPort[0][TX_PRIO_HIGH].TxDesRingLock); |
2005 |
spin_lock(&pAC->TxPort[0][TX_PRIO_HIGH].TxDesRingLock); |
1096 |
FreeTxDescriptors(pAC, 0, TX_PRIO_HIGH); |
2006 |
FreeTxDescriptors(pAC, 0, TX_PRIO_HIGH); |
1097 |
spin_unlock(&pAC->TxPort[0][TX_PRIO_HIGH].TxDesRingLock); |
2007 |
spin_unlock(&pAC->TxPort[0][TX_PRIO_HIGH].TxDesRingLock); |
1098 |
ClearTxIrq(pAC, 0, TX_PRIO_HIGH); |
|
|
1099 |
} |
2008 |
} |
1100 |
#endif |
2009 |
#endif |
1101 |
#endif |
2010 |
#endif |
1102 |
|
2011 |
|
1103 |
/* do all IO at once */ |
|
|
1104 |
if (IntSrc & IS_R1_F) |
1105 |
ClearAndStartRx(pAC, 0); |
1106 |
#ifdef USE_TX_COMPLETE /* only if tx complete interrupt used */ |
1107 |
if (IntSrc & IS_XA1_F) |
1108 |
ClearTxIrq(pAC, 0, TX_PRIO_LOW); |
1109 |
#endif |
1110 |
SK_IN32(pAC->IoBase, B0_ISRC, &IntSrc); |
2012 |
SK_IN32(pAC->IoBase, B0_ISRC, &IntSrc); |
1111 |
} /* while (IntSrc & IRQ_MASK != 0) */ |
2013 |
} /* while (IntSrc & IRQ_MASK != 0) */ |
|
|
2014 |
#endif |
1112 |
|
2015 |
|
1113 |
IntSrc &= pAC->GIni.GIValIrqMask; |
2016 |
IntSrc &= pAC->GIni.GIValIrqMask; |
1114 |
if ((IntSrc & SPECIAL_IRQS) || pAC->CheckQueue) { |
2017 |
if ((IntSrc & SPECIAL_IRQS) || pAC->CheckQueue) { |
Lines 1122-1138
Link Here
|
1122 |
SkEventDispatcher(pAC, pAC->IoBase); |
2025 |
SkEventDispatcher(pAC, pAC->IoBase); |
1123 |
spin_unlock(&pAC->SlowPathLock); |
2026 |
spin_unlock(&pAC->SlowPathLock); |
1124 |
} |
2027 |
} |
1125 |
/* |
2028 |
|
1126 |
* do it all again is case we cleared an interrupt that |
2029 |
#ifndef CONFIG_SK98LIN_NAPI |
1127 |
* came in after handling the ring (OUTs may be delayed |
|
|
1128 |
* in hardware buffers, but are through after IN) |
1129 |
* |
1130 |
* rroesler: has been commented out and shifted to |
1131 |
* SkGeDrvEvent(), because it is timer |
1132 |
* guarded now |
1133 |
* |
1134 |
ReceiveIrq(pAC, &pAC->RxPort[0], SK_TRUE); |
2030 |
ReceiveIrq(pAC, &pAC->RxPort[0], SK_TRUE); |
1135 |
*/ |
2031 |
#endif |
1136 |
|
2032 |
|
1137 |
/* IRQ is processed - Enable IRQs again*/ |
2033 |
/* IRQ is processed - Enable IRQs again*/ |
1138 |
SK_OUT32(pAC->IoBase, B0_IMSK, pAC->GIni.GIValIrqMask); |
2034 |
SK_OUT32(pAC->IoBase, B0_IMSK, pAC->GIni.GIValIrqMask); |
Lines 1140-1164
Link Here
|
1140 |
return SkIsrRetHandled; |
2036 |
return SkIsrRetHandled; |
1141 |
} /* SkGeIsrOnePort */ |
2037 |
} /* SkGeIsrOnePort */ |
1142 |
|
2038 |
|
1143 |
#ifdef CONFIG_NET_POLL_CONTROLLER |
|
|
1144 |
/**************************************************************************** |
1145 |
* |
1146 |
* SkGePollController - polling receive, for netconsole |
1147 |
* |
1148 |
* Description: |
1149 |
* Polling receive - used by netconsole and other diagnostic tools |
1150 |
* to allow network i/o with interrupts disabled. |
1151 |
* |
1152 |
* Returns: N/A |
1153 |
*/ |
1154 |
static void SkGePollController(struct net_device *dev) |
1155 |
{ |
1156 |
disable_irq(dev->irq); |
1157 |
SkGeIsr(dev->irq, dev, NULL); |
1158 |
enable_irq(dev->irq); |
1159 |
} |
1160 |
#endif |
1161 |
|
1162 |
/**************************************************************************** |
2039 |
/**************************************************************************** |
1163 |
* |
2040 |
* |
1164 |
* SkGeOpen - handle start of initialized adapter |
2041 |
* SkGeOpen - handle start of initialized adapter |
Lines 1176-1202
Link Here
|
1176 |
* != 0 on error |
2053 |
* != 0 on error |
1177 |
*/ |
2054 |
*/ |
1178 |
static int SkGeOpen( |
2055 |
static int SkGeOpen( |
1179 |
struct SK_NET_DEVICE *dev) |
2056 |
struct SK_NET_DEVICE *dev) /* the device that is to be opened */ |
1180 |
{ |
2057 |
{ |
1181 |
DEV_NET *pNet; |
2058 |
DEV_NET *pNet = (DEV_NET*) dev->priv; |
1182 |
SK_AC *pAC; |
2059 |
SK_AC *pAC = pNet->pAC; |
1183 |
unsigned long Flags; /* for spin lock */ |
2060 |
unsigned long Flags; /* for the spin locks */ |
1184 |
int i; |
2061 |
int CurrMac; /* loop ctr for ports */ |
1185 |
SK_EVPARA EvPara; /* an event parameter union */ |
|
|
1186 |
|
2062 |
|
1187 |
pNet = netdev_priv(dev); |
|
|
1188 |
pAC = pNet->pAC; |
1189 |
|
1190 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, |
2063 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, |
1191 |
("SkGeOpen: pAC=0x%lX:\n", (unsigned long)pAC)); |
2064 |
("SkGeOpen: pAC=0x%lX:\n", (unsigned long)pAC)); |
1192 |
|
2065 |
|
1193 |
#ifdef SK_DIAG_SUPPORT |
|
|
1194 |
if (pAC->DiagModeActive == DIAG_ACTIVE) { |
2066 |
if (pAC->DiagModeActive == DIAG_ACTIVE) { |
1195 |
if (pAC->Pnmi.DiagAttached == SK_DIAG_RUNNING) { |
2067 |
if (pAC->Pnmi.DiagAttached == SK_DIAG_RUNNING) { |
1196 |
return (-1); /* still in use by diag; deny actions */ |
2068 |
return (-1); /* still in use by diag; deny actions */ |
1197 |
} |
2069 |
} |
1198 |
} |
2070 |
} |
1199 |
#endif |
2071 |
|
|
|
2072 |
if (!try_module_get(THIS_MODULE)) { |
2073 |
return (-1); /* increase of usage count not possible */ |
2074 |
} |
1200 |
|
2075 |
|
1201 |
/* Set blink mode */ |
2076 |
/* Set blink mode */ |
1202 |
if ((pAC->PciDev->vendor == 0x1186) || (pAC->PciDev->vendor == 0x11ab )) |
2077 |
if ((pAC->PciDev->vendor == 0x1186) || (pAC->PciDev->vendor == 0x11ab )) |
Lines 1205-1210
Link Here
|
1205 |
if (pAC->BoardLevel == SK_INIT_DATA) { |
2080 |
if (pAC->BoardLevel == SK_INIT_DATA) { |
1206 |
/* level 1 init common modules here */ |
2081 |
/* level 1 init common modules here */ |
1207 |
if (SkGeInit(pAC, pAC->IoBase, SK_INIT_IO) != 0) { |
2082 |
if (SkGeInit(pAC, pAC->IoBase, SK_INIT_IO) != 0) { |
|
|
2083 |
module_put(THIS_MODULE); /* decrease usage count */ |
1208 |
printk("%s: HWInit (1) failed.\n", pAC->dev[pNet->PortNr]->name); |
2084 |
printk("%s: HWInit (1) failed.\n", pAC->dev[pNet->PortNr]->name); |
1209 |
return (-1); |
2085 |
return (-1); |
1210 |
} |
2086 |
} |
Lines 1215-1225
Link Here
|
1215 |
SkRlmtInit (pAC, pAC->IoBase, SK_INIT_IO); |
2091 |
SkRlmtInit (pAC, pAC->IoBase, SK_INIT_IO); |
1216 |
SkTimerInit (pAC, pAC->IoBase, SK_INIT_IO); |
2092 |
SkTimerInit (pAC, pAC->IoBase, SK_INIT_IO); |
1217 |
pAC->BoardLevel = SK_INIT_IO; |
2093 |
pAC->BoardLevel = SK_INIT_IO; |
|
|
2094 |
#ifdef Y2_RECOVERY |
2095 |
/* mark entries invalid */ |
2096 |
pAC->LastPort = 3; |
2097 |
pAC->LastOpc = 0xFF; |
2098 |
#endif |
1218 |
} |
2099 |
} |
1219 |
|
2100 |
|
1220 |
if (pAC->BoardLevel != SK_INIT_RUN) { |
2101 |
if (pAC->BoardLevel != SK_INIT_RUN) { |
1221 |
/* tschilling: Level 2 init modules here, check return value. */ |
2102 |
/* tschilling: Level 2 init modules here, check return value. */ |
1222 |
if (SkGeInit(pAC, pAC->IoBase, SK_INIT_RUN) != 0) { |
2103 |
if (SkGeInit(pAC, pAC->IoBase, SK_INIT_RUN) != 0) { |
|
|
2104 |
module_put(THIS_MODULE); /* decrease usage count */ |
1223 |
printk("%s: HWInit (2) failed.\n", pAC->dev[pNet->PortNr]->name); |
2105 |
printk("%s: HWInit (2) failed.\n", pAC->dev[pNet->PortNr]->name); |
1224 |
return (-1); |
2106 |
return (-1); |
1225 |
} |
2107 |
} |
Lines 1230-1249
Link Here
|
1230 |
SkRlmtInit (pAC, pAC->IoBase, SK_INIT_RUN); |
2112 |
SkRlmtInit (pAC, pAC->IoBase, SK_INIT_RUN); |
1231 |
SkTimerInit (pAC, pAC->IoBase, SK_INIT_RUN); |
2113 |
SkTimerInit (pAC, pAC->IoBase, SK_INIT_RUN); |
1232 |
pAC->BoardLevel = SK_INIT_RUN; |
2114 |
pAC->BoardLevel = SK_INIT_RUN; |
|
|
2115 |
|
2116 |
#ifdef SK_YUKON2 |
2117 |
#if 0 |
2118 |
for (CurrMac=0; CurrMac<pAC->GIni.GIMacsFound; CurrMac++) { |
2119 |
if (CHIP_ID_YUKON_2(pAC)) { |
2120 |
if (pPrt->PState >= SK_PRT_INIT) { |
2121 |
SkY2PortStart(pAC, pAC->IoBase, CurrMac); |
2122 |
} |
2123 |
} else { |
2124 |
/* Enable transmit descriptor polling. */ |
2125 |
SkGePollTxD(pAC, pAC->IoBase, CurrMac, SK_TRUE); |
2126 |
FillRxRing(pAC, &pAC->RxPort[CurrMac]); |
2127 |
SkMacRxTxEnable(pAC, pAC->IoBase, pNet->PortNr); |
2128 |
} |
2129 |
} |
2130 |
#endif |
2131 |
#endif |
2132 |
|
1233 |
} |
2133 |
} |
1234 |
|
2134 |
|
1235 |
for (i=0; i<pAC->GIni.GIMacsFound; i++) { |
2135 |
for (CurrMac=0; CurrMac<pAC->GIni.GIMacsFound; CurrMac++) { |
1236 |
/* Enable transmit descriptor polling. */ |
2136 |
#ifdef SK_YUKON2 |
1237 |
SkGePollTxD(pAC, pAC->IoBase, i, SK_TRUE); |
2137 |
#if 0 |
1238 |
FillRxRing(pAC, &pAC->RxPort[i]); |
2138 |
if (CHIP_ID_YUKON_2(pAC)) { |
|
|
2139 |
if (pAC->GIni.GP[CurrMac].PState < SK_PRT_INIT) { |
2140 |
printk("SkGeOpen: will start port %i\n", CurrMac); |
2141 |
SkY2PortStart(pAC, pAC->IoBase, CurrMac); |
2142 |
} else { |
2143 |
printk("SkGeOpen: Port %i already started->skipped!\n", CurrMac); |
2144 |
} |
2145 |
} else { |
2146 |
#endif |
2147 |
#endif |
2148 |
if (!CHIP_ID_YUKON_2(pAC)) { |
2149 |
/* Enable transmit descriptor polling. */ |
2150 |
SkGePollTxD(pAC, pAC->IoBase, CurrMac, SK_TRUE); |
2151 |
FillRxRing(pAC, &pAC->RxPort[CurrMac]); |
2152 |
SkMacRxTxEnable(pAC, pAC->IoBase, pNet->PortNr); |
2153 |
} |
1239 |
} |
2154 |
} |
1240 |
SkGeYellowLED(pAC, pAC->IoBase, 1); |
|
|
1241 |
|
2155 |
|
1242 |
StartDrvCleanupTimer(pAC); |
2156 |
SkGeYellowLED(pAC, pAC->IoBase, 1); |
1243 |
SkDimEnableModerationIfNeeded(pAC); |
2157 |
SkDimEnableModerationIfNeeded(pAC); |
1244 |
SkDimDisplayModerationSettings(pAC); |
|
|
1245 |
|
2158 |
|
1246 |
pAC->GIni.GIValIrqMask &= IRQ_MASK; |
2159 |
if (!CHIP_ID_YUKON_2(pAC)) { |
|
|
2160 |
/* |
2161 |
** Has been setup already at SkGeInit(SK_INIT_IO), |
2162 |
** but additional masking added for Genesis & Yukon |
2163 |
** chipsets -> modify it... |
2164 |
*/ |
2165 |
pAC->GIni.GIValIrqMask &= IRQ_MASK; |
2166 |
#ifndef USE_TX_COMPLETE |
2167 |
pAC->GIni.GIValIrqMask &= ~(TX_COMPL_IRQS); |
2168 |
#endif |
2169 |
} |
1247 |
|
2170 |
|
1248 |
/* enable Interrupts */ |
2171 |
/* enable Interrupts */ |
1249 |
SK_OUT32(pAC->IoBase, B0_IMSK, pAC->GIni.GIValIrqMask); |
2172 |
SK_OUT32(pAC->IoBase, B0_IMSK, pAC->GIni.GIValIrqMask); |
Lines 1252-1276
Link Here
|
1252 |
spin_lock_irqsave(&pAC->SlowPathLock, Flags); |
2175 |
spin_lock_irqsave(&pAC->SlowPathLock, Flags); |
1253 |
|
2176 |
|
1254 |
if ((pAC->RlmtMode != 0) && (pAC->MaxPorts == 0)) { |
2177 |
if ((pAC->RlmtMode != 0) && (pAC->MaxPorts == 0)) { |
1255 |
EvPara.Para32[0] = pAC->RlmtNets; |
2178 |
SkLocalEventQueue(pAC, SKGE_RLMT, SK_RLMT_SET_NETS, |
1256 |
EvPara.Para32[1] = -1; |
2179 |
pAC->RlmtNets, -1, SK_FALSE); |
1257 |
SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_SET_NETS, |
2180 |
SkLocalEventQueue(pAC, SKGE_RLMT, SK_RLMT_MODE_CHANGE, |
1258 |
EvPara); |
2181 |
pAC->RlmtMode, 0, SK_FALSE); |
1259 |
EvPara.Para32[0] = pAC->RlmtMode; |
|
|
1260 |
EvPara.Para32[1] = 0; |
1261 |
SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_MODE_CHANGE, |
1262 |
EvPara); |
1263 |
} |
2182 |
} |
1264 |
|
2183 |
|
1265 |
EvPara.Para32[0] = pNet->NetNr; |
2184 |
SkLocalEventQueue(pAC, SKGE_RLMT, SK_RLMT_START, |
1266 |
EvPara.Para32[1] = -1; |
2185 |
pNet->NetNr, -1, SK_TRUE); |
1267 |
SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_START, EvPara); |
|
|
1268 |
SkEventDispatcher(pAC, pAC->IoBase); |
1269 |
spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); |
2186 |
spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); |
1270 |
|
2187 |
|
1271 |
pAC->MaxPorts++; |
2188 |
#ifdef Y2_RECOVERY |
1272 |
pNet->Up = 1; |
2189 |
pNet->InRecover = SK_FALSE; |
1273 |
|
2190 |
|
|
|
2191 |
/* Initialize the kernel timer */ |
2192 |
init_timer(&pNet->KernelTimer); |
2193 |
pNet->KernelTimer.function = SkGeHandleKernelTimer; |
2194 |
pNet->KernelTimer.data = (unsigned long) pNet; |
2195 |
pNet->KernelTimer.expires = jiffies + (HZ/4); /* initially 250ms */ |
2196 |
pNet->TimerExpired = SK_FALSE; |
2197 |
add_timer(&pNet->KernelTimer); |
2198 |
#endif |
2199 |
|
2200 |
pAC->MaxPorts++; |
1274 |
|
2201 |
|
1275 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, |
2202 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, |
1276 |
("SkGeOpen suceeded\n")); |
2203 |
("SkGeOpen suceeded\n")); |
Lines 1291-1322
Link Here
|
1291 |
* error code - on error |
2218 |
* error code - on error |
1292 |
*/ |
2219 |
*/ |
1293 |
static int SkGeClose( |
2220 |
static int SkGeClose( |
1294 |
struct SK_NET_DEVICE *dev) |
2221 |
struct SK_NET_DEVICE *dev) /* the device that is to be closed */ |
1295 |
{ |
2222 |
{ |
1296 |
DEV_NET *pNet; |
2223 |
DEV_NET *pNet = (DEV_NET*) dev->priv; |
1297 |
DEV_NET *newPtrNet; |
2224 |
SK_AC *pAC = pNet->pAC; |
1298 |
SK_AC *pAC; |
2225 |
DEV_NET *newPtrNet; |
1299 |
|
2226 |
unsigned long Flags; /* for the spin locks */ |
1300 |
unsigned long Flags; /* for spin lock */ |
2227 |
int CurrMac; /* loop ctr for the current MAC */ |
1301 |
int i; |
2228 |
int PortIdx; |
1302 |
int PortIdx; |
2229 |
#ifdef CONFIG_SK98LIN_NAPI |
1303 |
SK_EVPARA EvPara; |
2230 |
int WorkToDo = 1; /* min(*budget, dev->quota); */ |
1304 |
|
2231 |
int WorkDone = 0; |
|
|
2232 |
#endif |
1305 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, |
2233 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, |
1306 |
("SkGeClose: pAC=0x%lX ", (unsigned long)pAC)); |
2234 |
("SkGeClose: pAC=0x%lX ", (unsigned long)pAC)); |
1307 |
|
2235 |
|
1308 |
pNet = netdev_priv(dev); |
2236 |
#ifdef Y2_RECOVERY |
1309 |
pAC = pNet->pAC; |
2237 |
del_timer(&pNet->KernelTimer); |
|
|
2238 |
#endif |
1310 |
|
2239 |
|
1311 |
#ifdef SK_DIAG_SUPPORT |
|
|
1312 |
if (pAC->DiagModeActive == DIAG_ACTIVE) { |
2240 |
if (pAC->DiagModeActive == DIAG_ACTIVE) { |
1313 |
if (pAC->DiagFlowCtrl == SK_FALSE) { |
2241 |
if (pAC->DiagFlowCtrl == SK_FALSE) { |
|
|
2242 |
module_put(THIS_MODULE); |
1314 |
/* |
2243 |
/* |
1315 |
** notify that the interface which has been closed |
2244 |
** notify that the interface which has been closed |
1316 |
** by operator interaction must not be started up |
2245 |
** by operator interaction must not be started up |
1317 |
** again when the DIAG has finished. |
2246 |
** again when the DIAG has finished. |
1318 |
*/ |
2247 |
*/ |
1319 |
newPtrNet = netdev_priv(pAC->dev[0]); |
2248 |
newPtrNet = (DEV_NET *) pAC->dev[0]->priv; |
1320 |
if (newPtrNet == pNet) { |
2249 |
if (newPtrNet == pNet) { |
1321 |
pAC->WasIfUp[0] = SK_FALSE; |
2250 |
pAC->WasIfUp[0] = SK_FALSE; |
1322 |
} else { |
2251 |
} else { |
Lines 1327-1333
Link Here
|
1327 |
pAC->DiagFlowCtrl = SK_FALSE; |
2256 |
pAC->DiagFlowCtrl = SK_FALSE; |
1328 |
} |
2257 |
} |
1329 |
} |
2258 |
} |
1330 |
#endif |
|
|
1331 |
|
2259 |
|
1332 |
netif_stop_queue(dev); |
2260 |
netif_stop_queue(dev); |
1333 |
|
2261 |
|
Lines 1336-1343
Link Here
|
1336 |
else |
2264 |
else |
1337 |
PortIdx = pNet->NetNr; |
2265 |
PortIdx = pNet->NetNr; |
1338 |
|
2266 |
|
1339 |
StopDrvCleanupTimer(pAC); |
|
|
1340 |
|
1341 |
/* |
2267 |
/* |
1342 |
* Clear multicast table, promiscuous mode .... |
2268 |
* Clear multicast table, promiscuous mode .... |
1343 |
*/ |
2269 |
*/ |
Lines 1349-1394
Link Here
|
1349 |
spin_lock_irqsave(&pAC->SlowPathLock, Flags); |
2275 |
spin_lock_irqsave(&pAC->SlowPathLock, Flags); |
1350 |
/* disable interrupts */ |
2276 |
/* disable interrupts */ |
1351 |
SK_OUT32(pAC->IoBase, B0_IMSK, 0); |
2277 |
SK_OUT32(pAC->IoBase, B0_IMSK, 0); |
1352 |
EvPara.Para32[0] = pNet->NetNr; |
2278 |
SkLocalEventQueue(pAC, SKGE_RLMT, SK_RLMT_STOP, |
1353 |
EvPara.Para32[1] = -1; |
2279 |
pNet->NetNr, -1, SK_TRUE); |
1354 |
SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_STOP, EvPara); |
|
|
1355 |
SkEventDispatcher(pAC, pAC->IoBase); |
1356 |
SK_OUT32(pAC->IoBase, B0_IMSK, 0); |
2280 |
SK_OUT32(pAC->IoBase, B0_IMSK, 0); |
1357 |
/* stop the hardware */ |
2281 |
/* stop the hardware */ |
1358 |
SkGeDeInit(pAC, pAC->IoBase); |
2282 |
/* SkGeDeInit(pAC, pAC->IoBase); */ |
1359 |
pAC->BoardLevel = SK_INIT_DATA; |
2283 |
/* pAC->BoardLevel = SK_INIT_DATA; */ |
|
|
2284 |
if (CHIP_ID_YUKON_2(pAC)) { |
2285 |
SkY2PortStop( pAC, |
2286 |
pAC->IoBase, |
2287 |
pNet->NetNr, |
2288 |
SK_STOP_ALL, |
2289 |
SK_HARD_RST |
2290 |
); |
2291 |
} |
2292 |
else { |
2293 |
SkGeStopPort( pAC, |
2294 |
pAC->IoBase, |
2295 |
pNet->NetNr, |
2296 |
SK_STOP_ALL, |
2297 |
SK_HARD_RST); |
2298 |
} |
1360 |
spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); |
2299 |
spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); |
1361 |
} else { |
2300 |
} else { |
1362 |
|
2301 |
|
1363 |
spin_lock_irqsave(&pAC->SlowPathLock, Flags); |
2302 |
spin_lock_irqsave(&pAC->SlowPathLock, Flags); |
1364 |
EvPara.Para32[0] = pNet->NetNr; |
2303 |
SkLocalEventQueue(pAC, SKGE_RLMT, SK_RLMT_STOP, |
1365 |
EvPara.Para32[1] = -1; |
2304 |
pNet->NetNr, -1, SK_FALSE); |
1366 |
SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_STOP, EvPara); |
2305 |
SkLocalEventQueue(pAC, SKGE_PNMI, SK_PNMI_EVT_XMAC_RESET, |
1367 |
SkPnmiEvent(pAC, pAC->IoBase, SK_PNMI_EVT_XMAC_RESET, EvPara); |
2306 |
pNet->NetNr, -1, SK_TRUE); |
1368 |
SkEventDispatcher(pAC, pAC->IoBase); |
|
|
1369 |
spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); |
2307 |
spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); |
1370 |
|
2308 |
|
1371 |
/* Stop port */ |
2309 |
/* Stop port */ |
1372 |
spin_lock_irqsave(&pAC->TxPort[pNet->PortNr] |
2310 |
spin_lock_irqsave(&pAC->TxPort[pNet->PortNr] |
1373 |
[TX_PRIO_LOW].TxDesRingLock, Flags); |
2311 |
[TX_PRIO_LOW].TxDesRingLock, Flags); |
1374 |
SkGeStopPort(pAC, pAC->IoBase, pNet->PortNr, |
2312 |
if (CHIP_ID_YUKON_2(pAC)) { |
1375 |
SK_STOP_ALL, SK_HARD_RST); |
2313 |
SkY2PortStop(pAC, pAC->IoBase, pNet->PortNr, |
|
|
2314 |
SK_STOP_ALL, SK_HARD_RST); |
2315 |
} |
2316 |
else { |
2317 |
SkGeStopPort(pAC, pAC->IoBase, pNet->PortNr, |
2318 |
SK_STOP_ALL, SK_HARD_RST); |
2319 |
} |
1376 |
spin_unlock_irqrestore(&pAC->TxPort[pNet->PortNr] |
2320 |
spin_unlock_irqrestore(&pAC->TxPort[pNet->PortNr] |
1377 |
[TX_PRIO_LOW].TxDesRingLock, Flags); |
2321 |
[TX_PRIO_LOW].TxDesRingLock, Flags); |
1378 |
} |
2322 |
} |
1379 |
|
2323 |
|
1380 |
if (pAC->RlmtNets == 1) { |
2324 |
if (pAC->RlmtNets == 1) { |
1381 |
/* clear all descriptor rings */ |
2325 |
/* clear all descriptor rings */ |
1382 |
for (i=0; i<pAC->GIni.GIMacsFound; i++) { |
2326 |
for (CurrMac=0; CurrMac<pAC->GIni.GIMacsFound; CurrMac++) { |
1383 |
ReceiveIrq(pAC, &pAC->RxPort[i], SK_TRUE); |
2327 |
if (!CHIP_ID_YUKON_2(pAC)) { |
1384 |
ClearRxRing(pAC, &pAC->RxPort[i]); |
2328 |
#ifdef CONFIG_SK98LIN_NAPI |
1385 |
ClearTxRing(pAC, &pAC->TxPort[i][TX_PRIO_LOW]); |
2329 |
WorkToDo = 1; |
|
|
2330 |
ReceiveIrq(pAC,&pAC->RxPort[CurrMac], |
2331 |
SK_TRUE,&WorkDone,WorkToDo); |
2332 |
#else |
2333 |
ReceiveIrq(pAC,&pAC->RxPort[CurrMac],SK_TRUE); |
2334 |
#endif |
2335 |
ClearRxRing(pAC, &pAC->RxPort[CurrMac]); |
2336 |
ClearTxRing(pAC, &pAC->TxPort[CurrMac][TX_PRIO_LOW]); |
2337 |
} else { |
2338 |
SkY2FreeRxBuffers(pAC, pAC->IoBase, CurrMac); |
2339 |
SkY2FreeTxBuffers(pAC, pAC->IoBase, CurrMac); |
2340 |
} |
1386 |
} |
2341 |
} |
1387 |
} else { |
2342 |
} else { |
1388 |
/* clear port descriptor rings */ |
2343 |
/* clear port descriptor rings */ |
1389 |
ReceiveIrq(pAC, &pAC->RxPort[pNet->PortNr], SK_TRUE); |
2344 |
if (!CHIP_ID_YUKON_2(pAC)) { |
1390 |
ClearRxRing(pAC, &pAC->RxPort[pNet->PortNr]); |
2345 |
#ifdef CONFIG_SK98LIN_NAPI |
1391 |
ClearTxRing(pAC, &pAC->TxPort[pNet->PortNr][TX_PRIO_LOW]); |
2346 |
WorkToDo = 1; |
|
|
2347 |
ReceiveIrq(pAC, &pAC->RxPort[pNet->PortNr], SK_TRUE, &WorkDone, WorkToDo); |
2348 |
#else |
2349 |
ReceiveIrq(pAC, &pAC->RxPort[pNet->PortNr], SK_TRUE); |
2350 |
#endif |
2351 |
ClearRxRing(pAC, &pAC->RxPort[pNet->PortNr]); |
2352 |
ClearTxRing(pAC, &pAC->TxPort[pNet->PortNr][TX_PRIO_LOW]); |
2353 |
} |
2354 |
else { |
2355 |
SkY2FreeRxBuffers(pAC, pAC->IoBase, pNet->PortNr); |
2356 |
SkY2FreeTxBuffers(pAC, pAC->IoBase, pNet->PortNr); |
2357 |
} |
1392 |
} |
2358 |
} |
1393 |
|
2359 |
|
1394 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, |
2360 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, |
Lines 1399-1406
Link Here
|
1399 |
sizeof(SK_PNMI_STRUCT_DATA)); |
2365 |
sizeof(SK_PNMI_STRUCT_DATA)); |
1400 |
|
2366 |
|
1401 |
pAC->MaxPorts--; |
2367 |
pAC->MaxPorts--; |
1402 |
pNet->Up = 0; |
2368 |
module_put(THIS_MODULE); |
1403 |
|
|
|
1404 |
return (0); |
2369 |
return (0); |
1405 |
} /* SkGeClose */ |
2370 |
} /* SkGeClose */ |
1406 |
|
2371 |
|
Lines 1426-1432
Link Here
|
1426 |
SK_AC *pAC; |
2391 |
SK_AC *pAC; |
1427 |
int Rc; /* return code of XmitFrame */ |
2392 |
int Rc; /* return code of XmitFrame */ |
1428 |
|
2393 |
|
1429 |
pNet = netdev_priv(dev); |
2394 |
pNet = (DEV_NET*) dev->priv; |
1430 |
pAC = pNet->pAC; |
2395 |
pAC = pNet->pAC; |
1431 |
|
2396 |
|
1432 |
if ((!skb_shinfo(skb)->nr_frags) || |
2397 |
if ((!skb_shinfo(skb)->nr_frags) || |
Lines 1458-1466
Link Here
|
1458 |
} |
2423 |
} |
1459 |
|
2424 |
|
1460 |
/* Transmitter out of resources? */ |
2425 |
/* Transmitter out of resources? */ |
|
|
2426 |
#ifdef USE_TX_COMPLETE |
1461 |
if (Rc <= 0) { |
2427 |
if (Rc <= 0) { |
1462 |
netif_stop_queue(dev); |
2428 |
netif_stop_queue(dev); |
1463 |
} |
2429 |
} |
|
|
2430 |
#endif |
1464 |
|
2431 |
|
1465 |
/* If not taken, give buffer ownership back to the |
2432 |
/* If not taken, give buffer ownership back to the |
1466 |
* queueing layer. |
2433 |
* queueing layer. |
Lines 1472-1477
Link Here
|
1472 |
return (0); |
2439 |
return (0); |
1473 |
} /* SkGeXmit */ |
2440 |
} /* SkGeXmit */ |
1474 |
|
2441 |
|
|
|
2442 |
#ifdef CONFIG_SK98LIN_NAPI |
2443 |
/***************************************************************************** |
2444 |
* |
2445 |
* SkGePoll - NAPI Rx polling callback for GEnesis and Yukon chipsets |
2446 |
* |
2447 |
* Description: |
2448 |
* Called by the Linux system in case NAPI polling is activated |
2449 |
* |
2450 |
* Returns: |
2451 |
* The number of work data still to be handled |
2452 |
*/ |
2453 |
static int SkGePoll(struct net_device *dev, int *budget) |
2454 |
{ |
2455 |
SK_AC *pAC = ((DEV_NET*)(dev->priv))->pAC; /* pointer to adapter context */ |
2456 |
int WorkToDo = min(*budget, dev->quota); |
2457 |
int WorkDone = 0; |
2458 |
|
2459 |
if (pAC->dev[0] != pAC->dev[1]) { |
2460 |
#ifdef USE_TX_COMPLETE |
2461 |
spin_lock(&pAC->TxPort[1][TX_PRIO_LOW].TxDesRingLock); |
2462 |
FreeTxDescriptors(pAC, &pAC->TxPort[1][TX_PRIO_LOW]); |
2463 |
spin_unlock(&pAC->TxPort[1][TX_PRIO_LOW].TxDesRingLock); |
2464 |
#endif |
2465 |
ReceiveIrq(pAC, &pAC->RxPort[1], SK_TRUE, &WorkDone, WorkToDo); |
2466 |
CLEAR_AND_START_RX(1); |
2467 |
} |
2468 |
#ifdef USE_TX_COMPLETE |
2469 |
spin_lock(&pAC->TxPort[0][TX_PRIO_LOW].TxDesRingLock); |
2470 |
FreeTxDescriptors(pAC, &pAC->TxPort[0][TX_PRIO_LOW]); |
2471 |
spin_unlock(&pAC->TxPort[0][TX_PRIO_LOW].TxDesRingLock); |
2472 |
#endif |
2473 |
ReceiveIrq(pAC, &pAC->RxPort[0], SK_TRUE, &WorkDone, WorkToDo); |
2474 |
CLEAR_AND_START_RX(0); |
2475 |
|
2476 |
*budget -= WorkDone; |
2477 |
dev->quota -= WorkDone; |
2478 |
|
2479 |
if(WorkDone < WorkToDo) { |
2480 |
netif_rx_complete(dev); |
2481 |
/* enable interrupts again */ |
2482 |
pAC->GIni.GIValIrqMask |= (NAPI_DRV_IRQS); |
2483 |
#ifndef USE_TX_COMPLETE |
2484 |
pAC->GIni.GIValIrqMask &= ~(TX_COMPL_IRQS); |
2485 |
#endif |
2486 |
SK_OUT32(pAC->IoBase, B0_IMSK, pAC->GIni.GIValIrqMask); |
2487 |
} |
2488 |
return (WorkDone >= WorkToDo); |
2489 |
} /* SkGePoll */ |
2490 |
#endif |
1475 |
|
2491 |
|
1476 |
/***************************************************************************** |
2492 |
/***************************************************************************** |
1477 |
* |
2493 |
* |
Lines 1496-1502
Link Here
|
1496 |
* < 0 - on failure: other problems ( -> return failure to upper layers) |
2512 |
* < 0 - on failure: other problems ( -> return failure to upper layers) |
1497 |
*/ |
2513 |
*/ |
1498 |
static int XmitFrame( |
2514 |
static int XmitFrame( |
1499 |
SK_AC *pAC, /* pointer to adapter context */ |
2515 |
SK_AC *pAC, /* pointer to adapter context */ |
1500 |
TX_PORT *pTxPort, /* pointer to struct of port to send to */ |
2516 |
TX_PORT *pTxPort, /* pointer to struct of port to send to */ |
1501 |
struct sk_buff *pMessage) /* pointer to send-message */ |
2517 |
struct sk_buff *pMessage) /* pointer to send-message */ |
1502 |
{ |
2518 |
{ |
Lines 1512-1522
Link Here
|
1512 |
|
2528 |
|
1513 |
spin_lock_irqsave(&pTxPort->TxDesRingLock, Flags); |
2529 |
spin_lock_irqsave(&pTxPort->TxDesRingLock, Flags); |
1514 |
#ifndef USE_TX_COMPLETE |
2530 |
#ifndef USE_TX_COMPLETE |
1515 |
FreeTxDescriptors(pAC, pTxPort); |
2531 |
if ((pTxPort->TxdRingPrevFree - pTxPort->TxdRingFree) > 6) { |
|
|
2532 |
FreeTxDescriptors(pAC, pTxPort); |
2533 |
pTxPort->TxdRingPrevFree = pTxPort->TxdRingFree; |
2534 |
} |
1516 |
#endif |
2535 |
#endif |
1517 |
if (pTxPort->TxdRingFree == 0) { |
2536 |
if (pTxPort->TxdRingFree == 0) { |
1518 |
/* |
2537 |
/* |
1519 |
** no enough free descriptors in ring at the moment. |
2538 |
** not enough free descriptors in ring at the moment. |
1520 |
** Maybe free'ing some old one help? |
2539 |
** Maybe free'ing some old one help? |
1521 |
*/ |
2540 |
*/ |
1522 |
FreeTxDescriptors(pAC, pTxPort); |
2541 |
FreeTxDescriptors(pAC, pTxPort); |
Lines 1602-1608
Link Here
|
1602 |
BMU_IRQ_EOF | |
2621 |
BMU_IRQ_EOF | |
1603 |
#endif |
2622 |
#endif |
1604 |
pMessage->len; |
2623 |
pMessage->len; |
1605 |
} else { |
2624 |
} else { |
1606 |
pTxd->TBControl = BMU_OWN | BMU_STF | BMU_CHECK | |
2625 |
pTxd->TBControl = BMU_OWN | BMU_STF | BMU_CHECK | |
1607 |
BMU_SW | BMU_EOF | |
2626 |
BMU_SW | BMU_EOF | |
1608 |
#ifdef USE_TX_COMPLETE |
2627 |
#ifdef USE_TX_COMPLETE |
Lines 2022-2054
Link Here
|
2022 |
* Returns: N/A |
3041 |
* Returns: N/A |
2023 |
*/ |
3042 |
*/ |
2024 |
static void ReceiveIrq( |
3043 |
static void ReceiveIrq( |
2025 |
SK_AC *pAC, /* pointer to adapter context */ |
3044 |
#ifdef CONFIG_SK98LIN_NAPI |
2026 |
RX_PORT *pRxPort, /* pointer to receive port struct */ |
3045 |
SK_AC *pAC, /* pointer to adapter context */ |
2027 |
SK_BOOL SlowPathLock) /* indicates if SlowPathLock is needed */ |
3046 |
RX_PORT *pRxPort, /* pointer to receive port struct */ |
2028 |
{ |
3047 |
SK_BOOL SlowPathLock, /* indicates if SlowPathLock is needed */ |
2029 |
RXD *pRxd; /* pointer to receive descriptors */ |
3048 |
int *WorkDone, |
2030 |
SK_U32 Control; /* control field of descriptor */ |
3049 |
int WorkToDo) |
2031 |
struct sk_buff *pMsg; /* pointer to message holding frame */ |
3050 |
#else |
2032 |
struct sk_buff *pNewMsg; /* pointer to a new message for copying frame */ |
3051 |
SK_AC *pAC, /* pointer to adapter context */ |
2033 |
int FrameLength; /* total length of received frame */ |
3052 |
RX_PORT *pRxPort, /* pointer to receive port struct */ |
2034 |
int IpFrameLength; |
3053 |
SK_BOOL SlowPathLock) /* indicates if SlowPathLock is needed */ |
2035 |
SK_MBUF *pRlmtMbuf; /* ptr to a buffer for giving a frame to rlmt */ |
3054 |
#endif |
2036 |
SK_EVPARA EvPara; /* an event parameter union */ |
3055 |
{ |
2037 |
unsigned long Flags; /* for spin lock */ |
3056 |
RXD *pRxd; /* pointer to receive descriptors */ |
2038 |
int PortIndex = pRxPort->PortIndex; |
3057 |
struct sk_buff *pMsg; /* pointer to message holding frame */ |
2039 |
unsigned int Offset; |
3058 |
struct sk_buff *pNewMsg; /* pointer to new message for frame copy */ |
2040 |
unsigned int NumBytes; |
3059 |
SK_MBUF *pRlmtMbuf; /* ptr to buffer for giving frame to RLMT */ |
2041 |
unsigned int ForRlmt; |
3060 |
SK_EVPARA EvPara; /* an event parameter union */ |
2042 |
SK_BOOL IsBc; |
3061 |
SK_U32 Control; /* control field of descriptor */ |
2043 |
SK_BOOL IsMc; |
3062 |
unsigned long Flags; /* for spin lock handling */ |
2044 |
SK_BOOL IsBadFrame; /* Bad frame */ |
3063 |
int PortIndex = pRxPort->PortIndex; |
2045 |
|
3064 |
int FrameLength; /* total length of received frame */ |
2046 |
SK_U32 FrameStat; |
3065 |
int IpFrameLength; /* IP length of the received frame */ |
2047 |
unsigned short Csum1; |
3066 |
unsigned int Offset; |
2048 |
unsigned short Csum2; |
3067 |
unsigned int NumBytes; |
2049 |
unsigned short Type; |
3068 |
unsigned int RlmtNotifier; |
2050 |
int Result; |
3069 |
SK_BOOL IsBc; /* we received a broadcast packet */ |
2051 |
SK_U64 PhysAddr; |
3070 |
SK_BOOL IsMc; /* we received a multicast packet */ |
|
|
3071 |
SK_BOOL IsBadFrame; /* the frame received is bad! */ |
3072 |
SK_U32 FrameStat; |
3073 |
unsigned short Csum1; |
3074 |
unsigned short Csum2; |
3075 |
unsigned short Type; |
3076 |
int Result; |
3077 |
SK_U64 PhysAddr; |
2052 |
|
3078 |
|
2053 |
rx_start: |
3079 |
rx_start: |
2054 |
/* do forever; exit if BMU_OWN found */ |
3080 |
/* do forever; exit if BMU_OWN found */ |
Lines 2070-2075
Link Here
|
2070 |
|
3096 |
|
2071 |
Control = pRxd->RBControl; |
3097 |
Control = pRxd->RBControl; |
2072 |
|
3098 |
|
|
|
3099 |
#ifdef CONFIG_SK98LIN_NAPI |
3100 |
if (*WorkDone >= WorkToDo) { |
3101 |
break; |
3102 |
} |
3103 |
(*WorkDone)++; |
3104 |
#endif |
3105 |
|
2073 |
/* check if this descriptor is ready */ |
3106 |
/* check if this descriptor is ready */ |
2074 |
if ((Control & BMU_OWN) != 0) { |
3107 |
if ((Control & BMU_OWN) != 0) { |
2075 |
/* this descriptor is not yet ready */ |
3108 |
/* this descriptor is not yet ready */ |
Lines 2078-2084
Link Here
|
2078 |
FillRxRing(pAC, pRxPort); |
3111 |
FillRxRing(pAC, pRxPort); |
2079 |
return; |
3112 |
return; |
2080 |
} |
3113 |
} |
2081 |
pAC->DynIrqModInfo.NbrProcessedDescr++; |
|
|
2082 |
|
3114 |
|
2083 |
/* get length of frame and check it */ |
3115 |
/* get length of frame and check it */ |
2084 |
FrameLength = Control & BMU_BBC; |
3116 |
FrameLength = Control & BMU_BBC; |
Lines 2097-2104
Link Here
|
2097 |
FrameStat = pRxd->FrameStat; |
3129 |
FrameStat = pRxd->FrameStat; |
2098 |
|
3130 |
|
2099 |
/* check for frame length mismatch */ |
3131 |
/* check for frame length mismatch */ |
2100 |
#define XMR_FS_LEN_SHIFT 18 |
3132 |
#define XMR_FS_LEN_SHIFT 18 |
2101 |
#define GMR_FS_LEN_SHIFT 16 |
3133 |
#define GMR_FS_LEN_SHIFT 16 |
2102 |
if (pAC->GIni.GIChipId == CHIP_ID_GENESIS) { |
3134 |
if (pAC->GIni.GIChipId == CHIP_ID_GENESIS) { |
2103 |
if (FrameLength != (SK_U32) (FrameStat >> XMR_FS_LEN_SHIFT)) { |
3135 |
if (FrameLength != (SK_U32) (FrameStat >> XMR_FS_LEN_SHIFT)) { |
2104 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, |
3136 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, |
Lines 2108-2115
Link Here
|
2108 |
(SK_U32) (FrameStat >> XMR_FS_LEN_SHIFT))); |
3140 |
(SK_U32) (FrameStat >> XMR_FS_LEN_SHIFT))); |
2109 |
goto rx_failed; |
3141 |
goto rx_failed; |
2110 |
} |
3142 |
} |
2111 |
} |
3143 |
} else { |
2112 |
else { |
|
|
2113 |
if (FrameLength != (SK_U32) (FrameStat >> GMR_FS_LEN_SHIFT)) { |
3144 |
if (FrameLength != (SK_U32) (FrameStat >> GMR_FS_LEN_SHIFT)) { |
2114 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, |
3145 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, |
2115 |
SK_DBGCAT_DRV_RX_PROGRESS, |
3146 |
SK_DBGCAT_DRV_RX_PROGRESS, |
Lines 2152-2157
Link Here
|
2152 |
"Control: %x\nRxStat: %x\n", |
3183 |
"Control: %x\nRxStat: %x\n", |
2153 |
Control, FrameStat)); |
3184 |
Control, FrameStat)); |
2154 |
|
3185 |
|
|
|
3186 |
PhysAddr = ((SK_U64) pRxd->VDataHigh) << (SK_U64)32; |
3187 |
PhysAddr |= (SK_U64) pRxd->VDataLow; |
3188 |
|
3189 |
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,5) |
3190 |
pci_dma_sync_single(pAC->PciDev, |
3191 |
(dma_addr_t) PhysAddr, |
3192 |
FrameLength, |
3193 |
PCI_DMA_FROMDEVICE); |
3194 |
#else |
3195 |
pci_dma_sync_single_for_cpu(pAC->PciDev, |
3196 |
(dma_addr_t) PhysAddr, |
3197 |
FrameLength, |
3198 |
PCI_DMA_FROMDEVICE); |
3199 |
#endif |
2155 |
ReQueueRxBuffer(pAC, pRxPort, pMsg, |
3200 |
ReQueueRxBuffer(pAC, pRxPort, pMsg, |
2156 |
pRxd->VDataHigh, pRxd->VDataLow); |
3201 |
pRxd->VDataHigh, pRxd->VDataLow); |
2157 |
|
3202 |
|
Lines 2171-2199
Link Here
|
2171 |
skb_put(pNewMsg, FrameLength); |
3216 |
skb_put(pNewMsg, FrameLength); |
2172 |
PhysAddr = ((SK_U64) pRxd->VDataHigh) << (SK_U64)32; |
3217 |
PhysAddr = ((SK_U64) pRxd->VDataHigh) << (SK_U64)32; |
2173 |
PhysAddr |= (SK_U64) pRxd->VDataLow; |
3218 |
PhysAddr |= (SK_U64) pRxd->VDataLow; |
|
|
3219 |
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,5) |
3220 |
pci_dma_sync_single(pAC->PciDev, |
3221 |
(dma_addr_t) PhysAddr, |
3222 |
FrameLength, |
3223 |
PCI_DMA_FROMDEVICE); |
3224 |
#else |
3225 |
pci_dma_sync_single_for_device(pAC->PciDev, |
3226 |
(dma_addr_t) PhysAddr, |
3227 |
FrameLength, |
3228 |
PCI_DMA_FROMDEVICE); |
3229 |
#endif |
2174 |
|
3230 |
|
2175 |
pci_dma_sync_single_for_cpu(pAC->PciDev, |
|
|
2176 |
(dma_addr_t) PhysAddr, |
2177 |
FrameLength, |
2178 |
PCI_DMA_FROMDEVICE); |
2179 |
eth_copy_and_sum(pNewMsg, pMsg->data, |
3231 |
eth_copy_and_sum(pNewMsg, pMsg->data, |
2180 |
FrameLength, 0); |
3232 |
FrameLength, 0); |
2181 |
pci_dma_sync_single_for_device(pAC->PciDev, |
|
|
2182 |
(dma_addr_t) PhysAddr, |
2183 |
FrameLength, |
2184 |
PCI_DMA_FROMDEVICE); |
2185 |
ReQueueRxBuffer(pAC, pRxPort, pMsg, |
3233 |
ReQueueRxBuffer(pAC, pRxPort, pMsg, |
2186 |
pRxd->VDataHigh, pRxd->VDataLow); |
3234 |
pRxd->VDataHigh, pRxd->VDataLow); |
2187 |
|
3235 |
|
2188 |
pMsg = pNewMsg; |
3236 |
pMsg = pNewMsg; |
2189 |
|
3237 |
|
2190 |
} |
3238 |
} else { |
2191 |
else { |
|
|
2192 |
/* |
3239 |
/* |
2193 |
* if large frame, or SKB allocation failed, pass |
3240 |
* if large frame, or SKB allocation failed, pass |
2194 |
* the SKB directly to the networking |
3241 |
* the SKB directly to the networking |
2195 |
*/ |
3242 |
*/ |
2196 |
|
|
|
2197 |
PhysAddr = ((SK_U64) pRxd->VDataHigh) << (SK_U64)32; |
3243 |
PhysAddr = ((SK_U64) pRxd->VDataHigh) << (SK_U64)32; |
2198 |
PhysAddr |= (SK_U64) pRxd->VDataLow; |
3244 |
PhysAddr |= (SK_U64) pRxd->VDataLow; |
2199 |
|
3245 |
|
Lines 2202-2320
Link Here
|
2202 |
PhysAddr, |
3248 |
PhysAddr, |
2203 |
pAC->RxBufSize - 2, |
3249 |
pAC->RxBufSize - 2, |
2204 |
PCI_DMA_FROMDEVICE); |
3250 |
PCI_DMA_FROMDEVICE); |
|
|
3251 |
skb_put(pMsg, FrameLength); /* set message len */ |
3252 |
pMsg->ip_summed = CHECKSUM_NONE; /* initial default */ |
2205 |
|
3253 |
|
2206 |
/* set length in message */ |
3254 |
if (pRxPort->UseRxCsum) { |
2207 |
skb_put(pMsg, FrameLength); |
3255 |
Type = ntohs(*((short*)&pMsg->data[12])); |
2208 |
/* hardware checksum */ |
3256 |
if (Type == 0x800) { |
2209 |
Type = ntohs(*((short*)&pMsg->data[12])); |
3257 |
IpFrameLength = (int) ntohs((unsigned short) |
2210 |
|
3258 |
((unsigned short *) pMsg->data)[8]); |
2211 |
#ifdef USE_SK_RX_CHECKSUM |
3259 |
if ((FrameLength - IpFrameLength) == 0xe) { |
2212 |
if (Type == 0x800) { |
3260 |
Csum1=le16_to_cpu(pRxd->TcpSums & 0xffff); |
2213 |
Csum1=le16_to_cpu(pRxd->TcpSums & 0xffff); |
3261 |
Csum2=le16_to_cpu((pRxd->TcpSums >> 16) & 0xffff); |
2214 |
Csum2=le16_to_cpu((pRxd->TcpSums >> 16) & 0xffff); |
3262 |
if ((((Csum1 & 0xfffe) && (Csum2 & 0xfffe)) && |
2215 |
IpFrameLength = (int) ntohs((unsigned short) |
3263 |
(pAC->GIni.GIChipId == CHIP_ID_GENESIS)) || |
2216 |
((unsigned short *) pMsg->data)[8]); |
3264 |
(pAC->ChipsetType)) { |
2217 |
|
3265 |
Result = SkCsGetReceiveInfo(pAC, &pMsg->data[14], |
2218 |
/* |
3266 |
Csum1, Csum2, PortIndex); |
2219 |
* Test: If frame is padded, a check is not possible! |
3267 |
if ((Result == SKCS_STATUS_IP_FRAGMENT) || |
2220 |
* Frame not padded? Length difference must be 14 (0xe)! |
3268 |
(Result == SKCS_STATUS_IP_CSUM_OK) || |
2221 |
*/ |
3269 |
(Result == SKCS_STATUS_TCP_CSUM_OK) || |
2222 |
if ((FrameLength - IpFrameLength) != 0xe) { |
3270 |
(Result == SKCS_STATUS_UDP_CSUM_OK)) { |
2223 |
/* Frame padded => TCP offload not possible! */ |
3271 |
pMsg->ip_summed = CHECKSUM_UNNECESSARY; |
2224 |
pMsg->ip_summed = CHECKSUM_NONE; |
3272 |
} else if ((Result == SKCS_STATUS_TCP_CSUM_ERROR) || |
2225 |
} else { |
3273 |
(Result == SKCS_STATUS_UDP_CSUM_ERROR) || |
2226 |
/* Frame not padded => TCP offload! */ |
3274 |
(Result == SKCS_STATUS_IP_CSUM_ERROR_UDP) || |
2227 |
if ((((Csum1 & 0xfffe) && (Csum2 & 0xfffe)) && |
3275 |
(Result == SKCS_STATUS_IP_CSUM_ERROR_TCP) || |
2228 |
(pAC->GIni.GIChipId == CHIP_ID_GENESIS)) || |
3276 |
(Result == SKCS_STATUS_IP_CSUM_ERROR)) { |
2229 |
(pAC->ChipsetType)) { |
3277 |
/* HW Checksum error */ |
2230 |
Result = SkCsGetReceiveInfo(pAC, |
3278 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, |
2231 |
&pMsg->data[14], |
3279 |
SK_DBGCAT_DRV_RX_PROGRESS, |
2232 |
Csum1, Csum2, pRxPort->PortIndex); |
3280 |
("skge: CRC error. Frame dropped!\n")); |
2233 |
if (Result == |
3281 |
goto rx_failed; |
2234 |
SKCS_STATUS_IP_FRAGMENT || |
3282 |
} else { |
2235 |
Result == |
3283 |
pMsg->ip_summed = CHECKSUM_NONE; |
2236 |
SKCS_STATUS_IP_CSUM_OK || |
3284 |
} |
2237 |
Result == |
3285 |
}/* checksumControl calculation valid */ |
2238 |
SKCS_STATUS_TCP_CSUM_OK || |
3286 |
} /* Frame length check */ |
2239 |
Result == |
3287 |
} /* IP frame */ |
2240 |
SKCS_STATUS_UDP_CSUM_OK) { |
3288 |
} /* pRxPort->UseRxCsum */ |
2241 |
pMsg->ip_summed = |
|
|
2242 |
CHECKSUM_UNNECESSARY; |
2243 |
} |
2244 |
else if (Result == |
2245 |
SKCS_STATUS_TCP_CSUM_ERROR || |
2246 |
Result == |
2247 |
SKCS_STATUS_UDP_CSUM_ERROR || |
2248 |
Result == |
2249 |
SKCS_STATUS_IP_CSUM_ERROR_UDP || |
2250 |
Result == |
2251 |
SKCS_STATUS_IP_CSUM_ERROR_TCP || |
2252 |
Result == |
2253 |
SKCS_STATUS_IP_CSUM_ERROR ) { |
2254 |
/* HW Checksum error */ |
2255 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, |
2256 |
SK_DBGCAT_DRV_RX_PROGRESS, |
2257 |
("skge: CRC error. Frame dropped!\n")); |
2258 |
goto rx_failed; |
2259 |
} else { |
2260 |
pMsg->ip_summed = |
2261 |
CHECKSUM_NONE; |
2262 |
} |
2263 |
}/* checksumControl calculation valid */ |
2264 |
} /* Frame length check */ |
2265 |
} /* IP frame */ |
2266 |
#else |
2267 |
pMsg->ip_summed = CHECKSUM_NONE; |
2268 |
#endif |
2269 |
} /* frame > SK_COPY_TRESHOLD */ |
3289 |
} /* frame > SK_COPY_TRESHOLD */ |
2270 |
|
3290 |
|
2271 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, 1,("V")); |
3291 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, 1,("V")); |
2272 |
ForRlmt = SK_RLMT_RX_PROTOCOL; |
3292 |
RlmtNotifier = SK_RLMT_RX_PROTOCOL; |
2273 |
#if 0 |
|
|
2274 |
IsBc = (FrameStat & XMR_FS_BC)==XMR_FS_BC; |
2275 |
#endif |
2276 |
SK_RLMT_PRE_LOOKAHEAD(pAC, PortIndex, FrameLength, |
3293 |
SK_RLMT_PRE_LOOKAHEAD(pAC, PortIndex, FrameLength, |
2277 |
IsBc, &Offset, &NumBytes); |
3294 |
IsBc, &Offset, &NumBytes); |
2278 |
if (NumBytes != 0) { |
3295 |
if (NumBytes != 0) { |
2279 |
#if 0 |
3296 |
SK_RLMT_LOOKAHEAD(pAC,PortIndex,&pMsg->data[Offset], |
2280 |
IsMc = (FrameStat & XMR_FS_MC)==XMR_FS_MC; |
3297 |
IsBc,IsMc,&RlmtNotifier); |
2281 |
#endif |
|
|
2282 |
SK_RLMT_LOOKAHEAD(pAC, PortIndex, |
2283 |
&pMsg->data[Offset], |
2284 |
IsBc, IsMc, &ForRlmt); |
2285 |
} |
3298 |
} |
2286 |
if (ForRlmt == SK_RLMT_RX_PROTOCOL) { |
3299 |
if (RlmtNotifier == SK_RLMT_RX_PROTOCOL) { |
2287 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, 1,("W")); |
3300 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, 1,("W")); |
2288 |
/* send up only frames from active port */ |
3301 |
/* send up only frames from active port */ |
2289 |
if ((PortIndex == pAC->ActivePort) || |
3302 |
if ((PortIndex == pAC->ActivePort)||(pAC->RlmtNets == 2)) { |
2290 |
(pAC->RlmtNets == 2)) { |
|
|
2291 |
/* frame for upper layer */ |
2292 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, 1,("U")); |
3303 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, 1,("U")); |
2293 |
#ifdef xDEBUG |
3304 |
#ifdef xDEBUG |
2294 |
DumpMsg(pMsg, "Rx"); |
3305 |
DumpMsg(pMsg, "Rx"); |
2295 |
#endif |
3306 |
#endif |
2296 |
SK_PNMI_CNT_RX_OCTETS_DELIVERED(pAC, |
3307 |
SK_PNMI_CNT_RX_OCTETS_DELIVERED(pAC,FrameLength,PortIndex); |
2297 |
FrameLength, pRxPort->PortIndex); |
3308 |
pMsg->dev = pAC->dev[PortIndex]; |
2298 |
|
3309 |
pMsg->protocol = eth_type_trans(pMsg,pAC->dev[PortIndex]); |
2299 |
pMsg->dev = pAC->dev[pRxPort->PortIndex]; |
3310 |
netif_rx(pMsg); /* frame for upper layer */ |
2300 |
pMsg->protocol = eth_type_trans(pMsg, |
3311 |
pAC->dev[PortIndex]->last_rx = jiffies; |
2301 |
pAC->dev[pRxPort->PortIndex]); |
3312 |
} else { |
2302 |
netif_rx(pMsg); |
|
|
2303 |
pAC->dev[pRxPort->PortIndex]->last_rx = jiffies; |
2304 |
} |
2305 |
else { |
2306 |
/* drop frame */ |
2307 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, |
3313 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, |
2308 |
SK_DBGCAT_DRV_RX_PROGRESS, |
3314 |
SK_DBGCAT_DRV_RX_PROGRESS,("D")); |
2309 |
("D")); |
3315 |
DEV_KFREE_SKB(pMsg); /* drop frame */ |
2310 |
DEV_KFREE_SKB(pMsg); |
|
|
2311 |
} |
3316 |
} |
2312 |
|
3317 |
} else { /* packet for RLMT stack */ |
2313 |
} /* if not for rlmt */ |
|
|
2314 |
else { |
2315 |
/* packet for rlmt */ |
2316 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, |
3318 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, |
2317 |
SK_DBGCAT_DRV_RX_PROGRESS, ("R")); |
3319 |
SK_DBGCAT_DRV_RX_PROGRESS,("R")); |
2318 |
pRlmtMbuf = SkDrvAllocRlmtMbuf(pAC, |
3320 |
pRlmtMbuf = SkDrvAllocRlmtMbuf(pAC, |
2319 |
pAC->IoBase, FrameLength); |
3321 |
pAC->IoBase, FrameLength); |
2320 |
if (pRlmtMbuf != NULL) { |
3322 |
if (pRlmtMbuf != NULL) { |
Lines 2342-2373
Link Here
|
2342 |
} |
3344 |
} |
2343 |
|
3345 |
|
2344 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, |
3346 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, |
2345 |
SK_DBGCAT_DRV_RX_PROGRESS, |
3347 |
SK_DBGCAT_DRV_RX_PROGRESS,("Q")); |
2346 |
("Q")); |
|
|
2347 |
} |
3348 |
} |
2348 |
if ((pAC->dev[pRxPort->PortIndex]->flags & |
3349 |
if ((pAC->dev[PortIndex]->flags & (IFF_PROMISC | IFF_ALLMULTI)) || |
2349 |
(IFF_PROMISC | IFF_ALLMULTI)) != 0 || |
3350 |
(RlmtNotifier & SK_RLMT_RX_PROTOCOL)) { |
2350 |
(ForRlmt & SK_RLMT_RX_PROTOCOL) == |
3351 |
pMsg->dev = pAC->dev[PortIndex]; |
2351 |
SK_RLMT_RX_PROTOCOL) { |
3352 |
pMsg->protocol = eth_type_trans(pMsg,pAC->dev[PortIndex]); |
2352 |
pMsg->dev = pAC->dev[pRxPort->PortIndex]; |
|
|
2353 |
pMsg->protocol = eth_type_trans(pMsg, |
2354 |
pAC->dev[pRxPort->PortIndex]); |
2355 |
netif_rx(pMsg); |
3353 |
netif_rx(pMsg); |
2356 |
pAC->dev[pRxPort->PortIndex]->last_rx = jiffies; |
3354 |
pAC->dev[PortIndex]->last_rx = jiffies; |
2357 |
} |
3355 |
} else { |
2358 |
else { |
|
|
2359 |
DEV_KFREE_SKB(pMsg); |
3356 |
DEV_KFREE_SKB(pMsg); |
2360 |
} |
3357 |
} |
2361 |
|
3358 |
} /* if packet for RLMT stack */ |
2362 |
} /* if packet for rlmt */ |
|
|
2363 |
} /* for ... scanning the RXD ring */ |
3359 |
} /* for ... scanning the RXD ring */ |
2364 |
|
3360 |
|
2365 |
/* RXD ring is empty -> fill and restart */ |
3361 |
/* RXD ring is empty -> fill and restart */ |
2366 |
FillRxRing(pAC, pRxPort); |
3362 |
FillRxRing(pAC, pRxPort); |
2367 |
/* do not start if called from Close */ |
|
|
2368 |
if (pAC->BoardLevel > SK_INIT_DATA) { |
2369 |
ClearAndStartRx(pAC, PortIndex); |
2370 |
} |
2371 |
return; |
3363 |
return; |
2372 |
|
3364 |
|
2373 |
rx_failed: |
3365 |
rx_failed: |
Lines 2391-2439
Link Here
|
2391 |
|
3383 |
|
2392 |
} /* ReceiveIrq */ |
3384 |
} /* ReceiveIrq */ |
2393 |
|
3385 |
|
2394 |
|
|
|
2395 |
/***************************************************************************** |
2396 |
* |
2397 |
* ClearAndStartRx - give a start receive command to BMU, clear IRQ |
2398 |
* |
2399 |
* Description: |
2400 |
* This function sends a start command and a clear interrupt |
2401 |
* command for one receive queue to the BMU. |
2402 |
* |
2403 |
* Returns: N/A |
2404 |
* none |
2405 |
*/ |
2406 |
static void ClearAndStartRx( |
2407 |
SK_AC *pAC, /* pointer to the adapter context */ |
2408 |
int PortIndex) /* index of the receive port (XMAC) */ |
2409 |
{ |
2410 |
SK_OUT8(pAC->IoBase, |
2411 |
RxQueueAddr[PortIndex]+Q_CSR, |
2412 |
CSR_START | CSR_IRQ_CL_F); |
2413 |
} /* ClearAndStartRx */ |
2414 |
|
2415 |
|
2416 |
/***************************************************************************** |
2417 |
* |
2418 |
* ClearTxIrq - give a clear transmit IRQ command to BMU |
2419 |
* |
2420 |
* Description: |
2421 |
* This function sends a clear tx IRQ command for one |
2422 |
* transmit queue to the BMU. |
2423 |
* |
2424 |
* Returns: N/A |
2425 |
*/ |
2426 |
static void ClearTxIrq( |
2427 |
SK_AC *pAC, /* pointer to the adapter context */ |
2428 |
int PortIndex, /* index of the transmit port (XMAC) */ |
2429 |
int Prio) /* priority or normal queue */ |
2430 |
{ |
2431 |
SK_OUT8(pAC->IoBase, |
2432 |
TxQueueAddr[PortIndex][Prio]+Q_CSR, |
2433 |
CSR_IRQ_CL_F); |
2434 |
} /* ClearTxIrq */ |
2435 |
|
2436 |
|
2437 |
/***************************************************************************** |
3386 |
/***************************************************************************** |
2438 |
* |
3387 |
* |
2439 |
* ClearRxRing - remove all buffers from the receive ring |
3388 |
* ClearRxRing - remove all buffers from the receive ring |
Lines 2522-2552
Link Here
|
2522 |
static int SkGeSetMacAddr(struct SK_NET_DEVICE *dev, void *p) |
3471 |
static int SkGeSetMacAddr(struct SK_NET_DEVICE *dev, void *p) |
2523 |
{ |
3472 |
{ |
2524 |
|
3473 |
|
2525 |
DEV_NET *pNet = netdev_priv(dev); |
3474 |
DEV_NET *pNet = (DEV_NET*) dev->priv; |
2526 |
SK_AC *pAC = pNet->pAC; |
3475 |
SK_AC *pAC = pNet->pAC; |
|
|
3476 |
int Ret; |
2527 |
|
3477 |
|
2528 |
struct sockaddr *addr = p; |
3478 |
struct sockaddr *addr = p; |
2529 |
unsigned long Flags; |
3479 |
unsigned long Flags; |
2530 |
|
3480 |
|
2531 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, |
3481 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, |
2532 |
("SkGeSetMacAddr starts now...\n")); |
3482 |
("SkGeSetMacAddr starts now...\n")); |
2533 |
if(netif_running(dev)) |
|
|
2534 |
return -EBUSY; |
2535 |
|
3483 |
|
2536 |
memcpy(dev->dev_addr, addr->sa_data,dev->addr_len); |
3484 |
memcpy(dev->dev_addr, addr->sa_data,dev->addr_len); |
2537 |
|
3485 |
|
2538 |
spin_lock_irqsave(&pAC->SlowPathLock, Flags); |
3486 |
spin_lock_irqsave(&pAC->SlowPathLock, Flags); |
2539 |
|
3487 |
|
2540 |
if (pAC->RlmtNets == 2) |
3488 |
if (pAC->RlmtNets == 2) |
2541 |
SkAddrOverride(pAC, pAC->IoBase, pNet->NetNr, |
3489 |
Ret = SkAddrOverride(pAC, pAC->IoBase, pNet->NetNr, |
2542 |
(SK_MAC_ADDR*)dev->dev_addr, SK_ADDR_VIRTUAL_ADDRESS); |
3490 |
(SK_MAC_ADDR*)dev->dev_addr, SK_ADDR_VIRTUAL_ADDRESS); |
2543 |
else |
3491 |
else |
2544 |
SkAddrOverride(pAC, pAC->IoBase, pAC->ActivePort, |
3492 |
Ret = SkAddrOverride(pAC, pAC->IoBase, pAC->ActivePort, |
2545 |
(SK_MAC_ADDR*)dev->dev_addr, SK_ADDR_VIRTUAL_ADDRESS); |
3493 |
(SK_MAC_ADDR*)dev->dev_addr, SK_ADDR_VIRTUAL_ADDRESS); |
2546 |
|
|
|
2547 |
|
2548 |
|
3494 |
|
2549 |
spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); |
3495 |
spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); |
|
|
3496 |
|
3497 |
if (Ret != SK_ADDR_OVERRIDE_SUCCESS) |
3498 |
return -EBUSY; |
3499 |
|
2550 |
return 0; |
3500 |
return 0; |
2551 |
} /* SkGeSetMacAddr */ |
3501 |
} /* SkGeSetMacAddr */ |
2552 |
|
3502 |
|
Lines 2579-2585
Link Here
|
2579 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, |
3529 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, |
2580 |
("SkGeSetRxMode starts now... ")); |
3530 |
("SkGeSetRxMode starts now... ")); |
2581 |
|
3531 |
|
2582 |
pNet = netdev_priv(dev); |
3532 |
pNet = (DEV_NET*) dev->priv; |
2583 |
pAC = pNet->pAC; |
3533 |
pAC = pNet->pAC; |
2584 |
if (pAC->RlmtNets == 1) |
3534 |
if (pAC->RlmtNets == 1) |
2585 |
PortIdx = pAC->ActivePort; |
3535 |
PortIdx = pAC->ActivePort; |
Lines 2641-2657
Link Here
|
2641 |
*/ |
3591 |
*/ |
2642 |
static int SkGeChangeMtu(struct SK_NET_DEVICE *dev, int NewMtu) |
3592 |
static int SkGeChangeMtu(struct SK_NET_DEVICE *dev, int NewMtu) |
2643 |
{ |
3593 |
{ |
2644 |
DEV_NET *pNet; |
3594 |
DEV_NET *pNet; |
2645 |
DEV_NET *pOtherNet; |
3595 |
struct net_device *otherdev; |
2646 |
SK_AC *pAC; |
3596 |
SK_AC *pAC; |
2647 |
unsigned long Flags; |
3597 |
unsigned long Flags; |
2648 |
int i; |
3598 |
int i; |
2649 |
SK_EVPARA EvPara; |
3599 |
SK_U8 Speed[SK_MAX_MACS]; |
|
|
3600 |
SK_U8 LinkMode[SK_MAX_MACS]; |
3601 |
SK_U8 FlowCtrl[SK_MAX_MACS]; |
3602 |
SK_U8 MSMode[SK_MAX_MACS]; |
3603 |
SK_BOOL LinkStatus[SK_MAX_MACS]; |
3604 |
#ifdef CONFIG_SK98LIN_NAPI |
3605 |
int WorkToDo = 1; // min(*budget, dev->quota); |
3606 |
int WorkDone = 0; |
3607 |
#endif |
2650 |
|
3608 |
|
2651 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, |
3609 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, |
2652 |
("SkGeChangeMtu starts now...\n")); |
3610 |
("SkGeChangeMtu starts now...\n")); |
2653 |
|
3611 |
|
2654 |
pNet = netdev_priv(dev); |
3612 |
pNet = (DEV_NET*) dev->priv; |
2655 |
pAC = pNet->pAC; |
3613 |
pAC = pNet->pAC; |
2656 |
|
3614 |
|
2657 |
if ((NewMtu < 68) || (NewMtu > SK_JUMBO_MTU)) { |
3615 |
if ((NewMtu < 68) || (NewMtu > SK_JUMBO_MTU)) { |
Lines 2662-2668
Link Here
|
2662 |
return -EINVAL; |
3620 |
return -EINVAL; |
2663 |
} |
3621 |
} |
2664 |
|
3622 |
|
2665 |
#ifdef SK_DIAG_SUPPORT |
|
|
2666 |
if (pAC->DiagModeActive == DIAG_ACTIVE) { |
3623 |
if (pAC->DiagModeActive == DIAG_ACTIVE) { |
2667 |
if (pAC->DiagFlowCtrl == SK_FALSE) { |
3624 |
if (pAC->DiagFlowCtrl == SK_FALSE) { |
2668 |
return -1; /* still in use, deny any actions of MTU */ |
3625 |
return -1; /* still in use, deny any actions of MTU */ |
Lines 2670-2684
Link Here
|
2670 |
pAC->DiagFlowCtrl = SK_FALSE; |
3627 |
pAC->DiagFlowCtrl = SK_FALSE; |
2671 |
} |
3628 |
} |
2672 |
} |
3629 |
} |
2673 |
#endif |
|
|
2674 |
|
3630 |
|
2675 |
pNet->Mtu = NewMtu; |
3631 |
otherdev = pAC->dev[1 - pNet->NetNr]; |
2676 |
pOtherNet = netdev_priv(pAC->dev[1 - pNet->NetNr]); |
3632 |
if (NewMtu <= 1500 && otherdev != dev |
2677 |
if ((pOtherNet->Mtu>1500) && (NewMtu<=1500) && (pOtherNet->Up==1)) { |
3633 |
&& netif_running(otherdev) && otherdev->mtu > 1500) |
2678 |
return(0); |
3634 |
return 0; |
2679 |
} |
|
|
2680 |
|
3635 |
|
2681 |
pAC->RxBufSize = NewMtu + 32; |
3636 |
pAC->RxBufSize = NewMtu + 32; |
|
|
3637 |
while (pAC->RxBufSize % 8) { /* RxBufSize must be a multiple of 8 */ |
3638 |
pAC->RxBufSize = pAC->RxBufSize + 1; |
3639 |
} |
2682 |
dev->mtu = NewMtu; |
3640 |
dev->mtu = NewMtu; |
2683 |
|
3641 |
|
2684 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, |
3642 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, |
Lines 2694-2719
Link Here
|
2694 |
/* |
3652 |
/* |
2695 |
** Notify RLMT that any ports are to be stopped |
3653 |
** Notify RLMT that any ports are to be stopped |
2696 |
*/ |
3654 |
*/ |
2697 |
EvPara.Para32[0] = 0; |
3655 |
|
2698 |
EvPara.Para32[1] = -1; |
|
|
2699 |
if ((pAC->GIni.GIMacsFound == 2 ) && (pAC->RlmtNets == 2)) { |
3656 |
if ((pAC->GIni.GIMacsFound == 2 ) && (pAC->RlmtNets == 2)) { |
2700 |
SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_STOP, EvPara); |
3657 |
SkLocalEventQueue(pAC, SKGE_RLMT, SK_RLMT_STOP, |
2701 |
EvPara.Para32[0] = 1; |
3658 |
0, -1, SK_FALSE); |
2702 |
SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_STOP, EvPara); |
3659 |
SkLocalEventQueue(pAC, SKGE_RLMT, SK_RLMT_STOP, |
|
|
3660 |
1, -1, SK_TRUE); |
2703 |
} else { |
3661 |
} else { |
2704 |
SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_STOP, EvPara); |
3662 |
SkLocalEventQueue(pAC, SKGE_RLMT, SK_RLMT_STOP, |
|
|
3663 |
0, -1, SK_TRUE); |
2705 |
} |
3664 |
} |
2706 |
|
3665 |
|
2707 |
/* |
|
|
2708 |
** After calling the SkEventDispatcher(), RLMT is aware about |
2709 |
** the stopped ports -> configuration can take place! |
2710 |
*/ |
2711 |
SkEventDispatcher(pAC, pAC->IoBase); |
2712 |
|
2713 |
for (i=0; i<pAC->GIni.GIMacsFound; i++) { |
3666 |
for (i=0; i<pAC->GIni.GIMacsFound; i++) { |
2714 |
spin_lock(&pAC->TxPort[i][TX_PRIO_LOW].TxDesRingLock); |
3667 |
spin_lock(&pAC->TxPort[i][TX_PRIO_LOW].TxDesRingLock); |
2715 |
netif_stop_queue(pAC->dev[i]); |
3668 |
if (netif_running(pAC->dev[i])) { |
|
|
3669 |
LinkStatus[i] = SK_TRUE; |
3670 |
netif_stop_queue(pAC->dev[i]); |
3671 |
} else { |
3672 |
LinkStatus[i] = SK_FALSE; |
3673 |
} |
2716 |
|
3674 |
|
|
|
3675 |
/* Save the config data */ |
3676 |
Speed[i] = pAC->GIni.GP[i].PLinkSpeed; |
3677 |
LinkMode[i] = pAC->GIni.GP[i].PLinkModeConf; |
3678 |
FlowCtrl[i] = pAC->GIni.GP[i].PFlowCtrlMode; |
3679 |
MSMode[i] = pAC->GIni.GP[i].PMSMode; |
2717 |
} |
3680 |
} |
2718 |
|
3681 |
|
2719 |
/* |
3682 |
/* |
Lines 2762-2768
Link Here
|
2762 |
** enable/disable hardware support for long frames |
3725 |
** enable/disable hardware support for long frames |
2763 |
*/ |
3726 |
*/ |
2764 |
if (NewMtu > 1500) { |
3727 |
if (NewMtu > 1500) { |
2765 |
// pAC->JumboActivated = SK_TRUE; /* is never set back !!! */ |
|
|
2766 |
pAC->GIni.GIPortUsage = SK_JUMBO_LINK; |
3728 |
pAC->GIni.GIPortUsage = SK_JUMBO_LINK; |
2767 |
} else { |
3729 |
} else { |
2768 |
if ((pAC->GIni.GIMacsFound == 2 ) && (pAC->RlmtNets == 2)) { |
3730 |
if ((pAC->GIni.GIMacsFound == 2 ) && (pAC->RlmtNets == 2)) { |
Lines 2779-2790
Link Here
|
2779 |
SkAddrInit( pAC, pAC->IoBase, SK_INIT_IO); |
3741 |
SkAddrInit( pAC, pAC->IoBase, SK_INIT_IO); |
2780 |
SkRlmtInit( pAC, pAC->IoBase, SK_INIT_IO); |
3742 |
SkRlmtInit( pAC, pAC->IoBase, SK_INIT_IO); |
2781 |
SkTimerInit(pAC, pAC->IoBase, SK_INIT_IO); |
3743 |
SkTimerInit(pAC, pAC->IoBase, SK_INIT_IO); |
2782 |
|
3744 |
|
2783 |
/* |
3745 |
/* |
2784 |
** tschilling: |
|
|
2785 |
** Speed and others are set back to default in level 1 init! |
3746 |
** Speed and others are set back to default in level 1 init! |
2786 |
*/ |
3747 |
*/ |
2787 |
GetConfiguration(pAC); |
3748 |
for (i=0; i<pAC->GIni.GIMacsFound; i++) { |
|
|
3749 |
pAC->GIni.GP[i].PLinkSpeed = Speed[i]; |
3750 |
pAC->GIni.GP[i].PLinkModeConf = LinkMode[i]; |
3751 |
pAC->GIni.GP[i].PFlowCtrlMode = FlowCtrl[i]; |
3752 |
pAC->GIni.GP[i].PMSMode = MSMode[i]; |
3753 |
} |
2788 |
|
3754 |
|
2789 |
SkGeInit( pAC, pAC->IoBase, SK_INIT_RUN); |
3755 |
SkGeInit( pAC, pAC->IoBase, SK_INIT_RUN); |
2790 |
SkI2cInit( pAC, pAC->IoBase, SK_INIT_RUN); |
3756 |
SkI2cInit( pAC, pAC->IoBase, SK_INIT_RUN); |
Lines 2795-2820
Link Here
|
2795 |
SkTimerInit(pAC, pAC->IoBase, SK_INIT_RUN); |
3761 |
SkTimerInit(pAC, pAC->IoBase, SK_INIT_RUN); |
2796 |
|
3762 |
|
2797 |
/* |
3763 |
/* |
2798 |
** clear and reinit the rx rings here |
3764 |
** clear and reinit the rx rings here, because of new MTU size |
2799 |
*/ |
3765 |
*/ |
2800 |
for (i=0; i<pAC->GIni.GIMacsFound; i++) { |
3766 |
for (i=0; i<pAC->GIni.GIMacsFound; i++) { |
2801 |
ReceiveIrq(pAC, &pAC->RxPort[i], SK_TRUE); |
3767 |
if (LinkStatus[i]) { |
2802 |
ClearRxRing(pAC, &pAC->RxPort[i]); |
3768 |
if (CHIP_ID_YUKON_2(pAC)) { |
2803 |
FillRxRing(pAC, &pAC->RxPort[i]); |
3769 |
SkY2FreeRxBuffers(pAC, pAC->IoBase, i); |
|
|
3770 |
SkY2FreeTxBuffers(pAC, pAC->IoBase, i); |
3771 |
SkY2AllocateRxBuffers(pAC, pAC->IoBase, i); |
3772 |
SkY2RestartStatusUnit(pAC); |
3773 |
SkY2PortStart(pAC, pAC->IoBase, i); |
3774 |
} else { |
3775 |
#ifdef CONFIG_SK98LIN_NAPI |
3776 |
WorkToDo = 1; |
3777 |
ReceiveIrq(pAC, &pAC->RxPort[i], SK_TRUE, &WorkDone, WorkToDo); |
3778 |
#else |
3779 |
ReceiveIrq(pAC, &pAC->RxPort[i], SK_TRUE); |
3780 |
#endif |
3781 |
ClearRxRing(pAC, &pAC->RxPort[i]); |
3782 |
FillRxRing(pAC, &pAC->RxPort[i]); |
2804 |
|
3783 |
|
2805 |
/* |
3784 |
/* |
2806 |
** Enable transmit descriptor polling |
3785 |
** Enable transmit descriptor polling |
2807 |
*/ |
3786 |
*/ |
2808 |
SkGePollTxD(pAC, pAC->IoBase, i, SK_TRUE); |
3787 |
SkGePollTxD(pAC, pAC->IoBase, i, SK_TRUE); |
2809 |
FillRxRing(pAC, &pAC->RxPort[i]); |
3788 |
FillRxRing(pAC, &pAC->RxPort[i]); |
2810 |
}; |
3789 |
} |
|
|
3790 |
} |
3791 |
} |
2811 |
|
3792 |
|
2812 |
SkGeYellowLED(pAC, pAC->IoBase, 1); |
3793 |
SkGeYellowLED(pAC, pAC->IoBase, 1); |
2813 |
SkDimEnableModerationIfNeeded(pAC); |
3794 |
SkDimEnableModerationIfNeeded(pAC); |
2814 |
SkDimDisplayModerationSettings(pAC); |
|
|
2815 |
|
3795 |
|
2816 |
netif_start_queue(pAC->dev[pNet->PortNr]); |
|
|
2817 |
for (i=pAC->GIni.GIMacsFound-1; i>=0; i--) { |
3796 |
for (i=pAC->GIni.GIMacsFound-1; i>=0; i--) { |
|
|
3797 |
if (LinkStatus[i]) { |
3798 |
netif_start_queue(pAC->dev[pNet->PortNr]); |
3799 |
} |
2818 |
spin_unlock(&pAC->TxPort[i][TX_PRIO_LOW].TxDesRingLock); |
3800 |
spin_unlock(&pAC->TxPort[i][TX_PRIO_LOW].TxDesRingLock); |
2819 |
} |
3801 |
} |
2820 |
|
3802 |
|
Lines 2824-2867
Link Here
|
2824 |
SK_OUT32(pAC->IoBase, B0_IMSK, pAC->GIni.GIValIrqMask); |
3806 |
SK_OUT32(pAC->IoBase, B0_IMSK, pAC->GIni.GIValIrqMask); |
2825 |
SK_OUT32(pAC->IoBase, B0_HWE_IMSK, IRQ_HWE_MASK); |
3807 |
SK_OUT32(pAC->IoBase, B0_HWE_IMSK, IRQ_HWE_MASK); |
2826 |
|
3808 |
|
2827 |
SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_START, EvPara); |
|
|
2828 |
SkEventDispatcher(pAC, pAC->IoBase); |
2829 |
|
2830 |
/* |
3809 |
/* |
2831 |
** Notify RLMT about the changing and restarting one (or more) ports |
3810 |
** Notify RLMT about the changing and restarting one (or more) ports |
2832 |
*/ |
3811 |
*/ |
2833 |
if ((pAC->GIni.GIMacsFound == 2 ) && (pAC->RlmtNets == 2)) { |
3812 |
if ((pAC->GIni.GIMacsFound == 2 ) && (pAC->RlmtNets == 2)) { |
2834 |
EvPara.Para32[0] = pAC->RlmtNets; |
3813 |
SkLocalEventQueue(pAC, SKGE_RLMT, SK_RLMT_SET_NETS, |
2835 |
EvPara.Para32[1] = -1; |
3814 |
pAC->RlmtNets, -1, SK_FALSE); |
2836 |
SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_SET_NETS, EvPara); |
3815 |
if (otherdev != dev && netif_running(otherdev)) { |
2837 |
EvPara.Para32[0] = pNet->PortNr; |
3816 |
DEV_NET *pOtherNet = |
2838 |
EvPara.Para32[1] = -1; |
3817 |
(DEV_NET*)pAC->dev[1 - pNet->NetNr]->priv; |
2839 |
SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_START, EvPara); |
3818 |
SkLocalEventQueue(pAC, SKGE_RLMT, SK_RLMT_START, |
2840 |
|
3819 |
pNet->PortNr, -1, SK_FALSE); |
2841 |
if (pOtherNet->Up) { |
3820 |
SkLocalEventQueue(pAC, SKGE_RLMT, SK_RLMT_START, |
2842 |
EvPara.Para32[0] = pOtherNet->PortNr; |
3821 |
pOtherNet->PortNr, -1, SK_TRUE); |
2843 |
SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_START, EvPara); |
3822 |
} else { |
|
|
3823 |
SkLocalEventQueue(pAC, SKGE_RLMT, SK_RLMT_START, |
3824 |
pNet->PortNr, -1, SK_TRUE); |
2844 |
} |
3825 |
} |
2845 |
} else { |
3826 |
} else { |
2846 |
SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_START, EvPara); |
3827 |
SkLocalEventQueue(pAC, SKGE_RLMT, SK_RLMT_START, |
|
|
3828 |
0, -1, SK_TRUE); |
2847 |
} |
3829 |
} |
2848 |
|
3830 |
|
2849 |
SkEventDispatcher(pAC, pAC->IoBase); |
|
|
2850 |
spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); |
3831 |
spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); |
2851 |
|
3832 |
return 0; |
2852 |
/* |
|
|
2853 |
** While testing this driver with latest kernel 2.5 (2.5.70), it |
2854 |
** seems as if upper layers have a problem to handle a successful |
2855 |
** return value of '0'. If such a zero is returned, the complete |
2856 |
** system hangs for several minutes (!), which is in acceptable. |
2857 |
** |
2858 |
** Currently it is not clear, what the exact reason for this problem |
2859 |
** is. The implemented workaround for 2.5 is to return the desired |
2860 |
** new MTU size if all needed changes for the new MTU size where |
2861 |
** performed. In kernels 2.2 and 2.4, a zero value is returned, |
2862 |
** which indicates the successful change of the mtu-size. |
2863 |
*/ |
2864 |
return NewMtu; |
2865 |
|
3833 |
|
2866 |
} /* SkGeChangeMtu */ |
3834 |
} /* SkGeChangeMtu */ |
2867 |
|
3835 |
|
Lines 2879-2922
Link Here
|
2879 |
*/ |
3847 |
*/ |
2880 |
static struct net_device_stats *SkGeStats(struct SK_NET_DEVICE *dev) |
3848 |
static struct net_device_stats *SkGeStats(struct SK_NET_DEVICE *dev) |
2881 |
{ |
3849 |
{ |
2882 |
DEV_NET *pNet = netdev_priv(dev); |
3850 |
DEV_NET *pNet = (DEV_NET*) dev->priv; |
2883 |
SK_AC *pAC = pNet->pAC; |
3851 |
SK_AC *pAC = pNet->pAC; |
2884 |
SK_PNMI_STRUCT_DATA *pPnmiStruct; /* structure for all Pnmi-Data */ |
3852 |
SK_PNMI_STRUCT_DATA *pPnmiStruct; /* structure for all Pnmi-Data */ |
2885 |
SK_PNMI_STAT *pPnmiStat; /* pointer to virtual XMAC stat. data */ |
3853 |
SK_PNMI_STAT *pPnmiStat; /* pointer to virtual XMAC stat. data */ |
2886 |
SK_PNMI_CONF *pPnmiConf; /* pointer to virtual link config. */ |
3854 |
SK_PNMI_CONF *pPnmiConf; /* pointer to virtual link config. */ |
2887 |
unsigned int Size; /* size of pnmi struct */ |
3855 |
unsigned int Size; /* size of pnmi struct */ |
2888 |
unsigned long Flags; /* for spin lock */ |
3856 |
unsigned long Flags; /* for spin lock */ |
2889 |
|
3857 |
|
2890 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, |
3858 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, |
2891 |
("SkGeStats starts now...\n")); |
3859 |
("SkGeStats starts now...\n")); |
2892 |
pPnmiStruct = &pAC->PnmiStruct; |
3860 |
pPnmiStruct = &pAC->PnmiStruct; |
2893 |
|
3861 |
|
2894 |
#ifdef SK_DIAG_SUPPORT |
3862 |
if ((pAC->DiagModeActive == DIAG_NOTACTIVE) && |
2895 |
if ((pAC->DiagModeActive == DIAG_NOTACTIVE) && |
3863 |
(pAC->BoardLevel == SK_INIT_RUN)) { |
2896 |
(pAC->BoardLevel == SK_INIT_RUN)) { |
3864 |
SK_MEMSET(pPnmiStruct, 0, sizeof(SK_PNMI_STRUCT_DATA)); |
2897 |
#endif |
3865 |
spin_lock_irqsave(&pAC->SlowPathLock, Flags); |
2898 |
SK_MEMSET(pPnmiStruct, 0, sizeof(SK_PNMI_STRUCT_DATA)); |
3866 |
Size = SK_PNMI_STRUCT_SIZE; |
2899 |
spin_lock_irqsave(&pAC->SlowPathLock, Flags); |
3867 |
SkPnmiGetStruct(pAC, pAC->IoBase, pPnmiStruct, &Size, pNet->NetNr); |
2900 |
Size = SK_PNMI_STRUCT_SIZE; |
3868 |
spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); |
2901 |
SkPnmiGetStruct(pAC, pAC->IoBase, pPnmiStruct, &Size, pNet->NetNr); |
|
|
2902 |
spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); |
2903 |
#ifdef SK_DIAG_SUPPORT |
2904 |
} |
3869 |
} |
2905 |
#endif |
|
|
2906 |
|
3870 |
|
2907 |
pPnmiStat = &pPnmiStruct->Stat[0]; |
3871 |
pPnmiStat = &pPnmiStruct->Stat[0]; |
2908 |
pPnmiConf = &pPnmiStruct->Conf[0]; |
3872 |
pPnmiConf = &pPnmiStruct->Conf[0]; |
2909 |
|
3873 |
|
2910 |
pAC->stats.rx_packets = (SK_U32) pPnmiStruct->RxDeliveredCts & 0xFFFFFFFF; |
3874 |
pAC->stats.rx_packets = (SK_U32) pPnmiStruct->RxDeliveredCts & 0xFFFFFFFF; |
2911 |
pAC->stats.tx_packets = (SK_U32) pPnmiStat->StatTxOkCts & 0xFFFFFFFF; |
3875 |
pAC->stats.tx_packets = (SK_U32) pPnmiStat->StatTxOkCts & 0xFFFFFFFF; |
2912 |
pAC->stats.rx_bytes = (SK_U32) pPnmiStruct->RxOctetsDeliveredCts; |
3876 |
pAC->stats.rx_bytes = (SK_U32) pPnmiStruct->RxOctetsDeliveredCts; |
2913 |
pAC->stats.tx_bytes = (SK_U32) pPnmiStat->StatTxOctetsOkCts; |
3877 |
pAC->stats.tx_bytes = (SK_U32) pPnmiStat->StatTxOctetsOkCts; |
2914 |
|
3878 |
|
2915 |
if (pNet->Mtu <= 1500) { |
3879 |
if (dev->mtu <= 1500) { |
2916 |
pAC->stats.rx_errors = (SK_U32) pPnmiStruct->InErrorsCts & 0xFFFFFFFF; |
3880 |
pAC->stats.rx_errors = (SK_U32) pPnmiStruct->InErrorsCts & 0xFFFFFFFF; |
2917 |
} else { |
3881 |
} else { |
2918 |
pAC->stats.rx_errors = (SK_U32) ((pPnmiStruct->InErrorsCts - |
3882 |
pAC->stats.rx_errors = (SK_U32) ((pPnmiStruct->InErrorsCts - |
2919 |
pPnmiStat->StatRxTooLongCts) & 0xFFFFFFFF); |
3883 |
pPnmiStat->StatRxTooLongCts) & 0xFFFFFFFF); |
2920 |
} |
3884 |
} |
2921 |
|
3885 |
|
2922 |
|
3886 |
|
Lines 2961-2992
Link Here
|
2961 |
* 0, if everything is ok |
3925 |
* 0, if everything is ok |
2962 |
* !=0, on error |
3926 |
* !=0, on error |
2963 |
*/ |
3927 |
*/ |
2964 |
static int SkGeIoctl(struct SK_NET_DEVICE *dev, struct ifreq *rq, int cmd) |
3928 |
static int SkGeIoctl( |
2965 |
{ |
3929 |
struct SK_NET_DEVICE *dev, /* the device the IOCTL is to be performed on */ |
2966 |
DEV_NET *pNet; |
3930 |
struct ifreq *rq, /* additional request structure containing data */ |
2967 |
SK_AC *pAC; |
3931 |
int cmd) /* requested IOCTL command number */ |
2968 |
void *pMemBuf; |
3932 |
{ |
2969 |
struct pci_dev *pdev = NULL; |
3933 |
DEV_NET *pNet = (DEV_NET*) dev->priv; |
2970 |
SK_GE_IOCTL Ioctl; |
3934 |
SK_AC *pAC = pNet->pAC; |
2971 |
unsigned int Err = 0; |
3935 |
struct pci_dev *pdev = NULL; |
2972 |
int Size = 0; |
3936 |
void *pMemBuf; |
2973 |
int Ret = 0; |
3937 |
SK_GE_IOCTL Ioctl; |
2974 |
unsigned int Length = 0; |
3938 |
unsigned long Flags; /* for spin lock */ |
2975 |
int HeaderLength = sizeof(SK_U32) + sizeof(SK_U32); |
3939 |
unsigned int Err = 0; |
|
|
3940 |
unsigned int Length = 0; |
3941 |
int HeaderLength = sizeof(SK_U32) + sizeof(SK_U32); |
3942 |
int Size = 0; |
3943 |
int Ret = 0; |
2976 |
|
3944 |
|
2977 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, |
3945 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, |
2978 |
("SkGeIoctl starts now...\n")); |
3946 |
("SkGeIoctl starts now...\n")); |
2979 |
|
3947 |
|
2980 |
pNet = netdev_priv(dev); |
|
|
2981 |
pAC = pNet->pAC; |
2982 |
|
2983 |
if(copy_from_user(&Ioctl, rq->ifr_data, sizeof(SK_GE_IOCTL))) { |
3948 |
if(copy_from_user(&Ioctl, rq->ifr_data, sizeof(SK_GE_IOCTL))) { |
2984 |
return -EFAULT; |
3949 |
return -EFAULT; |
2985 |
} |
3950 |
} |
2986 |
|
3951 |
|
2987 |
switch(cmd) { |
3952 |
switch(cmd) { |
2988 |
case SK_IOCTL_SETMIB: |
3953 |
case SIOCETHTOOL: |
2989 |
case SK_IOCTL_PRESETMIB: |
3954 |
return SkEthIoctl(dev, rq); |
|
|
3955 |
case SK_IOCTL_SETMIB: /* FALL THRU */ |
3956 |
case SK_IOCTL_PRESETMIB: /* FALL THRU (if capable!) */ |
2990 |
if (!capable(CAP_NET_ADMIN)) return -EPERM; |
3957 |
if (!capable(CAP_NET_ADMIN)) return -EPERM; |
2991 |
case SK_IOCTL_GETMIB: |
3958 |
case SK_IOCTL_GETMIB: |
2992 |
if(copy_from_user(&pAC->PnmiStruct, Ioctl.pData, |
3959 |
if(copy_from_user(&pAC->PnmiStruct, Ioctl.pData, |
Lines 3013-3018
Link Here
|
3013 |
if (NULL == (pMemBuf = kmalloc(Length, GFP_KERNEL))) { |
3980 |
if (NULL == (pMemBuf = kmalloc(Length, GFP_KERNEL))) { |
3014 |
return -ENOMEM; |
3981 |
return -ENOMEM; |
3015 |
} |
3982 |
} |
|
|
3983 |
spin_lock_irqsave(&pAC->SlowPathLock, Flags); |
3016 |
if(copy_from_user(pMemBuf, Ioctl.pData, Length)) { |
3984 |
if(copy_from_user(pMemBuf, Ioctl.pData, Length)) { |
3017 |
Err = -EFAULT; |
3985 |
Err = -EFAULT; |
3018 |
goto fault_gen; |
3986 |
goto fault_gen; |
Lines 3031-3040
Link Here
|
3031 |
goto fault_gen; |
3999 |
goto fault_gen; |
3032 |
} |
4000 |
} |
3033 |
fault_gen: |
4001 |
fault_gen: |
|
|
4002 |
spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); |
3034 |
kfree(pMemBuf); /* cleanup everything */ |
4003 |
kfree(pMemBuf); /* cleanup everything */ |
3035 |
break; |
4004 |
break; |
3036 |
#ifdef SK_DIAG_SUPPORT |
4005 |
case SK_IOCTL_DIAG: |
3037 |
case SK_IOCTL_DIAG: |
|
|
3038 |
if (!capable(CAP_NET_ADMIN)) return -EPERM; |
4006 |
if (!capable(CAP_NET_ADMIN)) return -EPERM; |
3039 |
if (Ioctl.Len < (sizeof(pAC->PnmiStruct) + HeaderLength)) { |
4007 |
if (Ioctl.Len < (sizeof(pAC->PnmiStruct) + HeaderLength)) { |
3040 |
Length = Ioctl.Len; |
4008 |
Length = Ioctl.Len; |
Lines 3071-3077
Link Here
|
3071 |
fault_diag: |
4039 |
fault_diag: |
3072 |
kfree(pMemBuf); /* cleanup everything */ |
4040 |
kfree(pMemBuf); /* cleanup everything */ |
3073 |
break; |
4041 |
break; |
3074 |
#endif |
|
|
3075 |
default: |
4042 |
default: |
3076 |
Err = -EOPNOTSUPP; |
4043 |
Err = -EOPNOTSUPP; |
3077 |
} |
4044 |
} |
Lines 3103-3114
Link Here
|
3103 |
unsigned int Size, /* length of ioctl data */ |
4070 |
unsigned int Size, /* length of ioctl data */ |
3104 |
int mode) /* flag for set/preset */ |
4071 |
int mode) /* flag for set/preset */ |
3105 |
{ |
4072 |
{ |
3106 |
unsigned long Flags; /* for spin lock */ |
4073 |
SK_AC *pAC = pNet->pAC; |
3107 |
SK_AC *pAC; |
4074 |
unsigned long Flags; /* for spin lock */ |
3108 |
|
4075 |
|
3109 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, |
4076 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, |
3110 |
("SkGeIocMib starts now...\n")); |
4077 |
("SkGeIocMib starts now...\n")); |
3111 |
pAC = pNet->pAC; |
4078 |
|
3112 |
/* access MIB */ |
4079 |
/* access MIB */ |
3113 |
spin_lock_irqsave(&pAC->SlowPathLock, Flags); |
4080 |
spin_lock_irqsave(&pAC->SlowPathLock, Flags); |
3114 |
switch(mode) { |
4081 |
switch(mode) { |
Lines 3151-3167
Link Here
|
3151 |
SK_I32 Port; /* preferred port */ |
4118 |
SK_I32 Port; /* preferred port */ |
3152 |
SK_BOOL AutoSet; |
4119 |
SK_BOOL AutoSet; |
3153 |
SK_BOOL DupSet; |
4120 |
SK_BOOL DupSet; |
3154 |
int LinkSpeed = SK_LSPEED_AUTO; /* Link speed */ |
4121 |
int LinkSpeed = SK_LSPEED_AUTO; /* Link speed */ |
3155 |
int AutoNeg = 1; /* autoneg off (0) or on (1) */ |
4122 |
int AutoNeg = 1; /* autoneg off (0) or on (1) */ |
3156 |
int DuplexCap = 0; /* 0=both,1=full,2=half */ |
4123 |
int DuplexCap = 0; /* 0=both,1=full,2=half */ |
3157 |
int FlowCtrl = SK_FLOW_MODE_SYM_OR_REM; /* FlowControl */ |
4124 |
int FlowCtrl = SK_FLOW_MODE_SYM_OR_REM; /* FlowControl */ |
3158 |
int MSMode = SK_MS_MODE_AUTO; /* master/slave mode */ |
4125 |
int MSMode = SK_MS_MODE_AUTO; /* master/slave mode */ |
3159 |
|
4126 |
int IrqModMaskOffset = 6; /* all ints moderated=default */ |
3160 |
SK_BOOL IsConTypeDefined = SK_TRUE; |
4127 |
|
3161 |
SK_BOOL IsLinkSpeedDefined = SK_TRUE; |
4128 |
SK_BOOL IsConTypeDefined = SK_TRUE; |
3162 |
SK_BOOL IsFlowCtrlDefined = SK_TRUE; |
4129 |
SK_BOOL IsLinkSpeedDefined = SK_TRUE; |
3163 |
SK_BOOL IsRoleDefined = SK_TRUE; |
4130 |
SK_BOOL IsFlowCtrlDefined = SK_TRUE; |
3164 |
SK_BOOL IsModeDefined = SK_TRUE; |
4131 |
SK_BOOL IsRoleDefined = SK_TRUE; |
|
|
4132 |
SK_BOOL IsModeDefined = SK_TRUE; |
3165 |
/* |
4133 |
/* |
3166 |
* The two parameters AutoNeg. and DuplexCap. map to one configuration |
4134 |
* The two parameters AutoNeg. and DuplexCap. map to one configuration |
3167 |
* parameter. The mapping is described by this table: |
4135 |
* parameter. The mapping is described by this table: |
Lines 3179-3184
Link Here
|
3179 |
{SK_LMODE_AUTOBOTH , SK_LMODE_AUTOFULL , SK_LMODE_AUTOHALF }, |
4147 |
{SK_LMODE_AUTOBOTH , SK_LMODE_AUTOFULL , SK_LMODE_AUTOHALF }, |
3180 |
{SK_LMODE_AUTOSENSE, SK_LMODE_AUTOSENSE, SK_LMODE_AUTOSENSE} }; |
4148 |
{SK_LMODE_AUTOSENSE, SK_LMODE_AUTOSENSE, SK_LMODE_AUTOSENSE} }; |
3181 |
|
4149 |
|
|
|
4150 |
SK_U32 IrqModMask[7][2] = |
4151 |
{ { IRQ_MASK_RX_ONLY , Y2_DRIVER_IRQS }, |
4152 |
{ IRQ_MASK_TX_ONLY , Y2_DRIVER_IRQS }, |
4153 |
{ IRQ_MASK_SP_ONLY , Y2_SPECIAL_IRQS }, |
4154 |
{ IRQ_MASK_SP_RX , Y2_IRQ_MASK }, |
4155 |
{ IRQ_MASK_TX_RX , Y2_DRIVER_IRQS }, |
4156 |
{ IRQ_MASK_SP_TX , Y2_IRQ_MASK }, |
4157 |
{ IRQ_MASK_RX_TX_SP, Y2_IRQ_MASK } }; |
4158 |
|
3182 |
#define DC_BOTH 0 |
4159 |
#define DC_BOTH 0 |
3183 |
#define DC_FULL 1 |
4160 |
#define DC_FULL 1 |
3184 |
#define DC_HALF 2 |
4161 |
#define DC_HALF 2 |
Lines 3218-3224
Link Here
|
3218 |
** |
4195 |
** |
3219 |
** This ConType parameter is used for all ports of the adapter! |
4196 |
** This ConType parameter is used for all ports of the adapter! |
3220 |
*/ |
4197 |
*/ |
3221 |
if ( (ConType != NULL) && |
4198 |
if ( (ConType != NULL) && |
3222 |
(pAC->Index < SK_MAX_CARD_PARAM) && |
4199 |
(pAC->Index < SK_MAX_CARD_PARAM) && |
3223 |
(ConType[pAC->Index] != NULL) ) { |
4200 |
(ConType[pAC->Index] != NULL) ) { |
3224 |
|
4201 |
|
Lines 3244-3283
Link Here
|
3244 |
M_CurrPort.PMSMode = SK_MS_MODE_AUTO; |
4221 |
M_CurrPort.PMSMode = SK_MS_MODE_AUTO; |
3245 |
M_CurrPort.PLinkSpeed = SK_LSPEED_AUTO; |
4222 |
M_CurrPort.PLinkSpeed = SK_LSPEED_AUTO; |
3246 |
} |
4223 |
} |
3247 |
} else if (strcmp(ConType[pAC->Index],"100FD")==0) { |
4224 |
} else if (strcmp(ConType[pAC->Index],"100FD")==0) { |
3248 |
for (Port = 0; Port < SK_MAX_MACS; Port++) { |
4225 |
for (Port = 0; Port < SK_MAX_MACS; Port++) { |
3249 |
M_CurrPort.PLinkModeConf = Capabilities[AN_OFF][DC_FULL]; |
4226 |
M_CurrPort.PLinkModeConf = Capabilities[AN_OFF][DC_FULL]; |
3250 |
M_CurrPort.PFlowCtrlMode = SK_FLOW_MODE_NONE; |
4227 |
M_CurrPort.PFlowCtrlMode = SK_FLOW_MODE_NONE; |
3251 |
M_CurrPort.PMSMode = SK_MS_MODE_AUTO; |
4228 |
M_CurrPort.PMSMode = SK_MS_MODE_AUTO; |
3252 |
M_CurrPort.PLinkSpeed = SK_LSPEED_100MBPS; |
4229 |
M_CurrPort.PLinkSpeed = SK_LSPEED_100MBPS; |
3253 |
} |
4230 |
} |
3254 |
} else if (strcmp(ConType[pAC->Index],"100HD")==0) { |
4231 |
} else if (strcmp(ConType[pAC->Index],"100HD")==0) { |
3255 |
for (Port = 0; Port < SK_MAX_MACS; Port++) { |
4232 |
for (Port = 0; Port < SK_MAX_MACS; Port++) { |
3256 |
M_CurrPort.PLinkModeConf = Capabilities[AN_OFF][DC_HALF]; |
4233 |
M_CurrPort.PLinkModeConf = Capabilities[AN_OFF][DC_HALF]; |
3257 |
M_CurrPort.PFlowCtrlMode = SK_FLOW_MODE_NONE; |
4234 |
M_CurrPort.PFlowCtrlMode = SK_FLOW_MODE_NONE; |
3258 |
M_CurrPort.PMSMode = SK_MS_MODE_AUTO; |
4235 |
M_CurrPort.PMSMode = SK_MS_MODE_AUTO; |
3259 |
M_CurrPort.PLinkSpeed = SK_LSPEED_100MBPS; |
4236 |
M_CurrPort.PLinkSpeed = SK_LSPEED_100MBPS; |
3260 |
} |
4237 |
} |
3261 |
} else if (strcmp(ConType[pAC->Index],"10FD")==0) { |
4238 |
} else if (strcmp(ConType[pAC->Index],"10FD")==0) { |
3262 |
for (Port = 0; Port < SK_MAX_MACS; Port++) { |
4239 |
for (Port = 0; Port < SK_MAX_MACS; Port++) { |
3263 |
M_CurrPort.PLinkModeConf = Capabilities[AN_OFF][DC_FULL]; |
4240 |
M_CurrPort.PLinkModeConf = Capabilities[AN_OFF][DC_FULL]; |
3264 |
M_CurrPort.PFlowCtrlMode = SK_FLOW_MODE_NONE; |
4241 |
M_CurrPort.PFlowCtrlMode = SK_FLOW_MODE_NONE; |
3265 |
M_CurrPort.PMSMode = SK_MS_MODE_AUTO; |
4242 |
M_CurrPort.PMSMode = SK_MS_MODE_AUTO; |
3266 |
M_CurrPort.PLinkSpeed = SK_LSPEED_10MBPS; |
4243 |
M_CurrPort.PLinkSpeed = SK_LSPEED_10MBPS; |
3267 |
} |
4244 |
} |
3268 |
} else if (strcmp(ConType[pAC->Index],"10HD")==0) { |
4245 |
} else if (strcmp(ConType[pAC->Index],"10HD")==0) { |
3269 |
for (Port = 0; Port < SK_MAX_MACS; Port++) { |
4246 |
for (Port = 0; Port < SK_MAX_MACS; Port++) { |
3270 |
M_CurrPort.PLinkModeConf = Capabilities[AN_OFF][DC_HALF]; |
4247 |
M_CurrPort.PLinkModeConf = Capabilities[AN_OFF][DC_HALF]; |
3271 |
M_CurrPort.PFlowCtrlMode = SK_FLOW_MODE_NONE; |
4248 |
M_CurrPort.PFlowCtrlMode = SK_FLOW_MODE_NONE; |
3272 |
M_CurrPort.PMSMode = SK_MS_MODE_AUTO; |
4249 |
M_CurrPort.PMSMode = SK_MS_MODE_AUTO; |
3273 |
M_CurrPort.PLinkSpeed = SK_LSPEED_10MBPS; |
4250 |
M_CurrPort.PLinkSpeed = SK_LSPEED_10MBPS; |
3274 |
} |
4251 |
} |
3275 |
} else { |
4252 |
} else { |
3276 |
printk("sk98lin: Illegal value \"%s\" for ConType\n", |
4253 |
printk("sk98lin: Illegal value \"%s\" for ConType\n", |
3277 |
ConType[pAC->Index]); |
4254 |
ConType[pAC->Index]); |
3278 |
IsConTypeDefined = SK_FALSE; /* Wrong ConType defined */ |
4255 |
IsConTypeDefined = SK_FALSE; /* Wrong ConType defined */ |
3279 |
} |
4256 |
} |
3280 |
} else { |
4257 |
} else { |
3281 |
IsConTypeDefined = SK_FALSE; /* No ConType defined */ |
4258 |
IsConTypeDefined = SK_FALSE; /* No ConType defined */ |
3282 |
} |
4259 |
} |
3283 |
|
4260 |
|
Lines 3296-3309
Link Here
|
3296 |
} else if (strcmp(Speed_A[pAC->Index],"100")==0) { |
4273 |
} else if (strcmp(Speed_A[pAC->Index],"100")==0) { |
3297 |
LinkSpeed = SK_LSPEED_100MBPS; |
4274 |
LinkSpeed = SK_LSPEED_100MBPS; |
3298 |
} else if (strcmp(Speed_A[pAC->Index],"1000")==0) { |
4275 |
} else if (strcmp(Speed_A[pAC->Index],"1000")==0) { |
3299 |
LinkSpeed = SK_LSPEED_1000MBPS; |
4276 |
if ((pAC->PciDev->vendor == 0x11ab ) && |
|
|
4277 |
(pAC->PciDev->device == 0x4350)) { |
4278 |
LinkSpeed = SK_LSPEED_100MBPS; |
4279 |
printk("sk98lin: Illegal value \"%s\" for Speed_A.\n" |
4280 |
"Gigabit speed not possible with this chip revision!", |
4281 |
Speed_A[pAC->Index]); |
4282 |
} else { |
4283 |
LinkSpeed = SK_LSPEED_1000MBPS; |
4284 |
} |
3300 |
} else { |
4285 |
} else { |
3301 |
printk("sk98lin: Illegal value \"%s\" for Speed_A\n", |
4286 |
printk("sk98lin: Illegal value \"%s\" for Speed_A\n", |
3302 |
Speed_A[pAC->Index]); |
4287 |
Speed_A[pAC->Index]); |
3303 |
IsLinkSpeedDefined = SK_FALSE; |
4288 |
IsLinkSpeedDefined = SK_FALSE; |
3304 |
} |
4289 |
} |
3305 |
} else { |
4290 |
} else { |
3306 |
IsLinkSpeedDefined = SK_FALSE; |
4291 |
if ((pAC->PciDev->vendor == 0x11ab ) && |
|
|
4292 |
(pAC->PciDev->device == 0x4350)) { |
4293 |
/* Gigabit speed not supported |
4294 |
* Swith to speed 100 |
4295 |
*/ |
4296 |
LinkSpeed = SK_LSPEED_100MBPS; |
4297 |
} else { |
4298 |
IsLinkSpeedDefined = SK_FALSE; |
4299 |
} |
3307 |
} |
4300 |
} |
3308 |
|
4301 |
|
3309 |
/* |
4302 |
/* |
Lines 3398-3406
Link Here
|
3398 |
} |
4391 |
} |
3399 |
|
4392 |
|
3400 |
if (!AutoSet && DupSet) { |
4393 |
if (!AutoSet && DupSet) { |
3401 |
printk("sk98lin: Port A: Duplex setting not" |
|
|
3402 |
" possible in\n default AutoNegotiation mode" |
3403 |
" (Sense).\n Using AutoNegotiation On\n"); |
3404 |
AutoNeg = AN_ON; |
4394 |
AutoNeg = AN_ON; |
3405 |
} |
4395 |
} |
3406 |
|
4396 |
|
Lines 3428-3434
Link Here
|
3428 |
FlowCtrl = SK_FLOW_MODE_NONE; |
4418 |
FlowCtrl = SK_FLOW_MODE_NONE; |
3429 |
} else { |
4419 |
} else { |
3430 |
printk("sk98lin: Illegal value \"%s\" for FlowCtrl_A\n", |
4420 |
printk("sk98lin: Illegal value \"%s\" for FlowCtrl_A\n", |
3431 |
FlowCtrl_A[pAC->Index]); |
4421 |
FlowCtrl_A[pAC->Index]); |
3432 |
IsFlowCtrlDefined = SK_FALSE; |
4422 |
IsFlowCtrlDefined = SK_FALSE; |
3433 |
} |
4423 |
} |
3434 |
} else { |
4424 |
} else { |
Lines 3520-3526
Link Here
|
3520 |
** Decide whether to set new config value if somethig valid has |
4510 |
** Decide whether to set new config value if somethig valid has |
3521 |
** been received. |
4511 |
** been received. |
3522 |
*/ |
4512 |
*/ |
3523 |
if (IsLinkSpeedDefined) { |
4513 |
if (IsLinkSpeedDefined) { |
3524 |
pAC->GIni.GP[1].PLinkSpeed = LinkSpeed; |
4514 |
pAC->GIni.GP[1].PLinkSpeed = LinkSpeed; |
3525 |
} |
4515 |
} |
3526 |
|
4516 |
|
Lines 3596-3604
Link Here
|
3596 |
} |
4586 |
} |
3597 |
|
4587 |
|
3598 |
if (!AutoSet && DupSet) { |
4588 |
if (!AutoSet && DupSet) { |
3599 |
printk("sk98lin: Port B: Duplex setting not" |
|
|
3600 |
" possible in\n default AutoNegotiation mode" |
3601 |
" (Sense).\n Using AutoNegotiation On\n"); |
3602 |
AutoNeg = AN_ON; |
4589 |
AutoNeg = AN_ON; |
3603 |
} |
4590 |
} |
3604 |
|
4591 |
|
Lines 3738-3747
Link Here
|
3738 |
} else { |
4725 |
} else { |
3739 |
pAC->RlmtMode = 0; |
4726 |
pAC->RlmtMode = 0; |
3740 |
} |
4727 |
} |
3741 |
|
4728 |
|
|
|
4729 |
#ifdef SK_YUKON2 |
4730 |
/* |
4731 |
** use dualnet config per default |
4732 |
* |
4733 |
pAC->RlmtMode = SK_RLMT_CHECK_LINK; |
4734 |
pAC->RlmtNets = 2; |
4735 |
*/ |
4736 |
#endif |
4737 |
|
4738 |
|
4739 |
/* |
4740 |
** Check the LowLatance parameters |
4741 |
*/ |
4742 |
pAC->LowLatency = SK_FALSE; |
4743 |
if (LowLatency[pAC->Index] != NULL) { |
4744 |
if (strcmp(LowLatency[pAC->Index], "On") == 0) { |
4745 |
pAC->LowLatency = SK_TRUE; |
4746 |
} |
4747 |
} |
4748 |
|
4749 |
|
3742 |
/* |
4750 |
/* |
3743 |
** Check the interrupt moderation parameters |
4751 |
** Check the interrupt moderation parameters |
3744 |
*/ |
4752 |
*/ |
|
|
4753 |
pAC->DynIrqModInfo.IntModTypeSelect = C_INT_MOD_NONE; |
3745 |
if (Moderation[pAC->Index] != NULL) { |
4754 |
if (Moderation[pAC->Index] != NULL) { |
3746 |
if (strcmp(Moderation[pAC->Index], "") == 0) { |
4755 |
if (strcmp(Moderation[pAC->Index], "") == 0) { |
3747 |
pAC->DynIrqModInfo.IntModTypeSelect = C_INT_MOD_NONE; |
4756 |
pAC->DynIrqModInfo.IntModTypeSelect = C_INT_MOD_NONE; |
Lines 3755-3824
Link Here
|
3755 |
printk("sk98lin: Illegal value \"%s\" for Moderation.\n" |
4764 |
printk("sk98lin: Illegal value \"%s\" for Moderation.\n" |
3756 |
" Disable interrupt moderation.\n", |
4765 |
" Disable interrupt moderation.\n", |
3757 |
Moderation[pAC->Index]); |
4766 |
Moderation[pAC->Index]); |
3758 |
pAC->DynIrqModInfo.IntModTypeSelect = C_INT_MOD_NONE; |
|
|
3759 |
} |
3760 |
} else { |
3761 |
pAC->DynIrqModInfo.IntModTypeSelect = C_INT_MOD_NONE; |
3762 |
} |
3763 |
|
3764 |
if (Stats[pAC->Index] != NULL) { |
3765 |
if (strcmp(Stats[pAC->Index], "Yes") == 0) { |
3766 |
pAC->DynIrqModInfo.DisplayStats = SK_TRUE; |
3767 |
} else { |
3768 |
pAC->DynIrqModInfo.DisplayStats = SK_FALSE; |
3769 |
} |
4767 |
} |
3770 |
} else { |
4768 |
} else { |
3771 |
pAC->DynIrqModInfo.DisplayStats = SK_FALSE; |
4769 |
/* Set interrupt moderation if wished */ |
|
|
4770 |
#ifdef CONFIG_SK98LIN_STATINT |
4771 |
pAC->DynIrqModInfo.IntModTypeSelect = C_INT_MOD_STATIC; |
4772 |
#endif |
3772 |
} |
4773 |
} |
3773 |
|
4774 |
|
3774 |
if (ModerationMask[pAC->Index] != NULL) { |
4775 |
if (ModerationMask[pAC->Index] != NULL) { |
3775 |
if (strcmp(ModerationMask[pAC->Index], "Rx") == 0) { |
4776 |
if (strcmp(ModerationMask[pAC->Index], "Rx") == 0) { |
3776 |
pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_RX_ONLY; |
4777 |
IrqModMaskOffset = 0; |
3777 |
} else if (strcmp(ModerationMask[pAC->Index], "Tx") == 0) { |
4778 |
} else if (strcmp(ModerationMask[pAC->Index], "Tx") == 0) { |
3778 |
pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_TX_ONLY; |
4779 |
IrqModMaskOffset = 1; |
3779 |
} else if (strcmp(ModerationMask[pAC->Index], "Sp") == 0) { |
4780 |
} else if (strcmp(ModerationMask[pAC->Index], "Sp") == 0) { |
3780 |
pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_SP_ONLY; |
4781 |
IrqModMaskOffset = 2; |
3781 |
} else if (strcmp(ModerationMask[pAC->Index], "RxSp") == 0) { |
4782 |
} else if (strcmp(ModerationMask[pAC->Index], "RxSp") == 0) { |
3782 |
pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_SP_RX; |
4783 |
IrqModMaskOffset = 3; |
3783 |
} else if (strcmp(ModerationMask[pAC->Index], "SpRx") == 0) { |
4784 |
} else if (strcmp(ModerationMask[pAC->Index], "SpRx") == 0) { |
3784 |
pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_SP_RX; |
4785 |
IrqModMaskOffset = 3; |
3785 |
} else if (strcmp(ModerationMask[pAC->Index], "RxTx") == 0) { |
4786 |
} else if (strcmp(ModerationMask[pAC->Index], "RxTx") == 0) { |
3786 |
pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_TX_RX; |
4787 |
IrqModMaskOffset = 4; |
3787 |
} else if (strcmp(ModerationMask[pAC->Index], "TxRx") == 0) { |
4788 |
} else if (strcmp(ModerationMask[pAC->Index], "TxRx") == 0) { |
3788 |
pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_TX_RX; |
4789 |
IrqModMaskOffset = 4; |
3789 |
} else if (strcmp(ModerationMask[pAC->Index], "TxSp") == 0) { |
4790 |
} else if (strcmp(ModerationMask[pAC->Index], "TxSp") == 0) { |
3790 |
pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_SP_TX; |
4791 |
IrqModMaskOffset = 5; |
3791 |
} else if (strcmp(ModerationMask[pAC->Index], "SpTx") == 0) { |
4792 |
} else if (strcmp(ModerationMask[pAC->Index], "SpTx") == 0) { |
3792 |
pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_SP_TX; |
4793 |
IrqModMaskOffset = 5; |
3793 |
} else if (strcmp(ModerationMask[pAC->Index], "RxTxSp") == 0) { |
4794 |
} else { /* some rubbish stated */ |
3794 |
pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_RX_TX_SP; |
4795 |
// IrqModMaskOffset = 6; ->has been initialized |
3795 |
} else if (strcmp(ModerationMask[pAC->Index], "RxSpTx") == 0) { |
4796 |
// already at the begin of this function... |
3796 |
pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_RX_TX_SP; |
|
|
3797 |
} else if (strcmp(ModerationMask[pAC->Index], "TxRxSp") == 0) { |
3798 |
pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_RX_TX_SP; |
3799 |
} else if (strcmp(ModerationMask[pAC->Index], "TxSpRx") == 0) { |
3800 |
pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_RX_TX_SP; |
3801 |
} else if (strcmp(ModerationMask[pAC->Index], "SpTxRx") == 0) { |
3802 |
pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_RX_TX_SP; |
3803 |
} else if (strcmp(ModerationMask[pAC->Index], "SpRxTx") == 0) { |
3804 |
pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_RX_TX_SP; |
3805 |
} else { /* some rubbish */ |
3806 |
pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_RX_ONLY; |
3807 |
} |
3808 |
} else { /* operator has stated nothing */ |
3809 |
pAC->DynIrqModInfo.MaskIrqModeration = IRQ_MASK_TX_RX; |
3810 |
} |
3811 |
|
3812 |
if (AutoSizing[pAC->Index] != NULL) { |
3813 |
if (strcmp(AutoSizing[pAC->Index], "On") == 0) { |
3814 |
pAC->DynIrqModInfo.AutoSizing = SK_FALSE; |
3815 |
} else { |
3816 |
pAC->DynIrqModInfo.AutoSizing = SK_FALSE; |
3817 |
} |
4797 |
} |
3818 |
} else { /* operator has stated nothing */ |
4798 |
} |
3819 |
pAC->DynIrqModInfo.AutoSizing = SK_FALSE; |
4799 |
if (!CHIP_ID_YUKON_2(pAC)) { |
|
|
4800 |
pAC->DynIrqModInfo.MaskIrqModeration = IrqModMask[IrqModMaskOffset][0]; |
4801 |
} else { |
4802 |
pAC->DynIrqModInfo.MaskIrqModeration = IrqModMask[IrqModMaskOffset][1]; |
3820 |
} |
4803 |
} |
3821 |
|
4804 |
|
|
|
4805 |
if (!CHIP_ID_YUKON_2(pAC)) { |
4806 |
pAC->DynIrqModInfo.MaxModIntsPerSec = C_INTS_PER_SEC_DEFAULT; |
4807 |
} else { |
4808 |
pAC->DynIrqModInfo.MaxModIntsPerSec = C_Y2_INTS_PER_SEC_DEFAULT; |
4809 |
} |
3822 |
if (IntsPerSec[pAC->Index] != 0) { |
4810 |
if (IntsPerSec[pAC->Index] != 0) { |
3823 |
if ((IntsPerSec[pAC->Index]< C_INT_MOD_IPS_LOWER_RANGE) || |
4811 |
if ((IntsPerSec[pAC->Index]< C_INT_MOD_IPS_LOWER_RANGE) || |
3824 |
(IntsPerSec[pAC->Index] > C_INT_MOD_IPS_UPPER_RANGE)) { |
4812 |
(IntsPerSec[pAC->Index] > C_INT_MOD_IPS_UPPER_RANGE)) { |
Lines 3827-3854
Link Here
|
3827 |
IntsPerSec[pAC->Index], |
4815 |
IntsPerSec[pAC->Index], |
3828 |
C_INT_MOD_IPS_LOWER_RANGE, |
4816 |
C_INT_MOD_IPS_LOWER_RANGE, |
3829 |
C_INT_MOD_IPS_UPPER_RANGE, |
4817 |
C_INT_MOD_IPS_UPPER_RANGE, |
3830 |
C_INTS_PER_SEC_DEFAULT); |
4818 |
pAC->DynIrqModInfo.MaxModIntsPerSec); |
3831 |
pAC->DynIrqModInfo.MaxModIntsPerSec = C_INTS_PER_SEC_DEFAULT; |
|
|
3832 |
} else { |
4819 |
} else { |
3833 |
pAC->DynIrqModInfo.MaxModIntsPerSec = IntsPerSec[pAC->Index]; |
4820 |
pAC->DynIrqModInfo.MaxModIntsPerSec = IntsPerSec[pAC->Index]; |
3834 |
} |
4821 |
} |
3835 |
} else { |
4822 |
} |
3836 |
pAC->DynIrqModInfo.MaxModIntsPerSec = C_INTS_PER_SEC_DEFAULT; |
|
|
3837 |
} |
3838 |
|
4823 |
|
3839 |
/* |
4824 |
/* |
3840 |
** Evaluate upper and lower moderation threshold |
4825 |
** Evaluate upper and lower moderation threshold |
3841 |
*/ |
4826 |
*/ |
3842 |
pAC->DynIrqModInfo.MaxModIntsPerSecUpperLimit = |
4827 |
pAC->DynIrqModInfo.MaxModIntsPerSecUpperLimit = |
3843 |
pAC->DynIrqModInfo.MaxModIntsPerSec + |
4828 |
pAC->DynIrqModInfo.MaxModIntsPerSec + |
3844 |
(pAC->DynIrqModInfo.MaxModIntsPerSec / 2); |
4829 |
(pAC->DynIrqModInfo.MaxModIntsPerSec / 5); |
3845 |
|
4830 |
|
3846 |
pAC->DynIrqModInfo.MaxModIntsPerSecLowerLimit = |
4831 |
pAC->DynIrqModInfo.MaxModIntsPerSecLowerLimit = |
3847 |
pAC->DynIrqModInfo.MaxModIntsPerSec - |
4832 |
pAC->DynIrqModInfo.MaxModIntsPerSec - |
3848 |
(pAC->DynIrqModInfo.MaxModIntsPerSec / 2); |
4833 |
(pAC->DynIrqModInfo.MaxModIntsPerSec / 5); |
3849 |
|
|
|
3850 |
pAC->DynIrqModInfo.PrevTimeVal = jiffies; /* initial value */ |
3851 |
|
4834 |
|
|
|
4835 |
pAC->DynIrqModInfo.DynIrqModSampleInterval = |
4836 |
SK_DRV_MODERATION_TIMER_LENGTH; |
3852 |
|
4837 |
|
3853 |
} /* GetConfiguration */ |
4838 |
} /* GetConfiguration */ |
3854 |
|
4839 |
|
Lines 3884-3928
Link Here
|
3884 |
} |
4869 |
} |
3885 |
} /* ProductStr */ |
4870 |
} /* ProductStr */ |
3886 |
|
4871 |
|
3887 |
/***************************************************************************** |
|
|
3888 |
* |
3889 |
* StartDrvCleanupTimer - Start timer to check for descriptors which |
3890 |
* might be placed in descriptor ring, but |
3891 |
* havent been handled up to now |
3892 |
* |
3893 |
* Description: |
3894 |
* This function requests a HW-timer fo the Yukon card. The actions to |
3895 |
* perform when this timer expires, are located in the SkDrvEvent(). |
3896 |
* |
3897 |
* Returns: N/A |
3898 |
*/ |
3899 |
static void |
3900 |
StartDrvCleanupTimer(SK_AC *pAC) { |
3901 |
SK_EVPARA EventParam; /* Event struct for timer event */ |
3902 |
|
3903 |
SK_MEMSET((char *) &EventParam, 0, sizeof(EventParam)); |
3904 |
EventParam.Para32[0] = SK_DRV_RX_CLEANUP_TIMER; |
3905 |
SkTimerStart(pAC, pAC->IoBase, &pAC->DrvCleanupTimer, |
3906 |
SK_DRV_RX_CLEANUP_TIMER_LENGTH, |
3907 |
SKGE_DRV, SK_DRV_TIMER, EventParam); |
3908 |
} |
3909 |
|
3910 |
/***************************************************************************** |
3911 |
* |
3912 |
* StopDrvCleanupTimer - Stop timer to check for descriptors |
3913 |
* |
3914 |
* Description: |
3915 |
* This function requests a HW-timer fo the Yukon card. The actions to |
3916 |
* perform when this timer expires, are located in the SkDrvEvent(). |
3917 |
* |
3918 |
* Returns: N/A |
3919 |
*/ |
3920 |
static void |
3921 |
StopDrvCleanupTimer(SK_AC *pAC) { |
3922 |
SkTimerStop(pAC, pAC->IoBase, &pAC->DrvCleanupTimer); |
3923 |
SK_MEMSET((char *) &pAC->DrvCleanupTimer, 0, sizeof(SK_TIMER)); |
3924 |
} |
3925 |
|
3926 |
/****************************************************************************/ |
4872 |
/****************************************************************************/ |
3927 |
/* functions for common modules *********************************************/ |
4873 |
/* functions for common modules *********************************************/ |
3928 |
/****************************************************************************/ |
4874 |
/****************************************************************************/ |
Lines 4011-4017
Link Here
|
4011 |
SK_U64 SkOsGetTime(SK_AC *pAC) |
4957 |
SK_U64 SkOsGetTime(SK_AC *pAC) |
4012 |
{ |
4958 |
{ |
4013 |
SK_U64 PrivateJiffies; |
4959 |
SK_U64 PrivateJiffies; |
|
|
4960 |
|
4014 |
SkOsGetTimeCurrent(pAC, &PrivateJiffies); |
4961 |
SkOsGetTimeCurrent(pAC, &PrivateJiffies); |
|
|
4962 |
|
4015 |
return PrivateJiffies; |
4963 |
return PrivateJiffies; |
4016 |
} /* SkOsGetTime */ |
4964 |
} /* SkOsGetTime */ |
4017 |
|
4965 |
|
Lines 4166-4194
Link Here
|
4166 |
* |
5114 |
* |
4167 |
*/ |
5115 |
*/ |
4168 |
int SkDrvEvent( |
5116 |
int SkDrvEvent( |
4169 |
SK_AC *pAC, /* pointer to adapter context */ |
5117 |
SK_AC *pAC, /* pointer to adapter context */ |
4170 |
SK_IOC IoC, /* io-context */ |
5118 |
SK_IOC IoC, /* IO control context */ |
4171 |
SK_U32 Event, /* event-id */ |
5119 |
SK_U32 Event, /* event-id */ |
4172 |
SK_EVPARA Param) /* event-parameter */ |
5120 |
SK_EVPARA Param) /* event-parameter */ |
4173 |
{ |
5121 |
{ |
4174 |
SK_MBUF *pRlmtMbuf; /* pointer to a rlmt-mbuf structure */ |
5122 |
SK_MBUF *pRlmtMbuf; /* pointer to a rlmt-mbuf structure */ |
4175 |
struct sk_buff *pMsg; /* pointer to a message block */ |
5123 |
struct sk_buff *pMsg; /* pointer to a message block */ |
4176 |
int FromPort; /* the port from which we switch away */ |
5124 |
SK_BOOL DualNet; |
4177 |
int ToPort; /* the port we switch to */ |
5125 |
SK_U32 Reason; |
4178 |
SK_EVPARA NewPara; /* parameter for further events */ |
5126 |
unsigned long Flags; |
4179 |
int Stat; |
5127 |
int FromPort; /* the port from which we switch away */ |
4180 |
unsigned long Flags; |
5128 |
int ToPort; /* the port we switch to */ |
4181 |
SK_BOOL DualNet; |
5129 |
int Stat; |
|
|
5130 |
DEV_NET *pNet = NULL; |
5131 |
#ifdef CONFIG_SK98LIN_NAPI |
5132 |
int WorkToDo = 1; /* min(*budget, dev->quota); */ |
5133 |
int WorkDone = 0; |
5134 |
#endif |
4182 |
|
5135 |
|
4183 |
switch (Event) { |
5136 |
switch (Event) { |
4184 |
case SK_DRV_ADAP_FAIL: |
|
|
4185 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, |
4186 |
("ADAPTER FAIL EVENT\n")); |
4187 |
printk("%s: Adapter failed.\n", pAC->dev[0]->name); |
4188 |
/* disable interrupts */ |
4189 |
SK_OUT32(pAC->IoBase, B0_IMSK, 0); |
4190 |
/* cgoos */ |
4191 |
break; |
4192 |
case SK_DRV_PORT_FAIL: |
5137 |
case SK_DRV_PORT_FAIL: |
4193 |
FromPort = Param.Para32[0]; |
5138 |
FromPort = Param.Para32[0]; |
4194 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, |
5139 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, |
Lines 4198-4408
Link Here
|
4198 |
} else { |
5143 |
} else { |
4199 |
printk("%s: Port B failed.\n", pAC->dev[1]->name); |
5144 |
printk("%s: Port B failed.\n", pAC->dev[1]->name); |
4200 |
} |
5145 |
} |
4201 |
/* cgoos */ |
|
|
4202 |
break; |
5146 |
break; |
4203 |
case SK_DRV_PORT_RESET: /* SK_U32 PortIdx */ |
5147 |
case SK_DRV_PORT_RESET: |
4204 |
/* action list 4 */ |
|
|
4205 |
FromPort = Param.Para32[0]; |
5148 |
FromPort = Param.Para32[0]; |
4206 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, |
5149 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, |
4207 |
("PORT RESET EVENT, Port: %d ", FromPort)); |
5150 |
("PORT RESET EVENT, Port: %d ", FromPort)); |
4208 |
NewPara.Para64 = FromPort; |
5151 |
SkLocalEventQueue64(pAC, SKGE_PNMI, SK_PNMI_EVT_XMAC_RESET, |
4209 |
SkPnmiEvent(pAC, IoC, SK_PNMI_EVT_XMAC_RESET, NewPara); |
5152 |
FromPort, SK_FALSE); |
4210 |
spin_lock_irqsave( |
5153 |
spin_lock_irqsave( |
4211 |
&pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock, |
5154 |
&pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock, |
4212 |
Flags); |
5155 |
Flags); |
4213 |
|
5156 |
if (CHIP_ID_YUKON_2(pAC)) { |
4214 |
SkGeStopPort(pAC, IoC, FromPort, SK_STOP_ALL, SK_HARD_RST); |
5157 |
SkY2PortStop(pAC, IoC, FromPort, SK_STOP_ALL, SK_HARD_RST); |
|
|
5158 |
} else { |
5159 |
SkGeStopPort(pAC, IoC, FromPort, SK_STOP_ALL, SK_HARD_RST); |
5160 |
} |
4215 |
pAC->dev[Param.Para32[0]]->flags &= ~IFF_RUNNING; |
5161 |
pAC->dev[Param.Para32[0]]->flags &= ~IFF_RUNNING; |
4216 |
spin_unlock_irqrestore( |
5162 |
spin_unlock_irqrestore( |
4217 |
&pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock, |
5163 |
&pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock, |
4218 |
Flags); |
5164 |
Flags); |
4219 |
|
5165 |
|
4220 |
/* clear rx ring from received frames */ |
5166 |
if (!CHIP_ID_YUKON_2(pAC)) { |
4221 |
ReceiveIrq(pAC, &pAC->RxPort[FromPort], SK_FALSE); |
5167 |
#ifdef CONFIG_SK98LIN_NAPI |
4222 |
|
5168 |
WorkToDo = 1; |
4223 |
ClearTxRing(pAC, &pAC->TxPort[FromPort][TX_PRIO_LOW]); |
5169 |
ReceiveIrq(pAC, &pAC->RxPort[FromPort], SK_FALSE, &WorkDone, WorkToDo); |
|
|
5170 |
#else |
5171 |
ReceiveIrq(pAC, &pAC->RxPort[FromPort], SK_FALSE); |
5172 |
#endif |
5173 |
ClearTxRing(pAC, &pAC->TxPort[FromPort][TX_PRIO_LOW]); |
5174 |
} |
4224 |
spin_lock_irqsave( |
5175 |
spin_lock_irqsave( |
4225 |
&pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock, |
5176 |
&pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock, |
4226 |
Flags); |
5177 |
Flags); |
4227 |
|
5178 |
|
4228 |
/* tschilling: Handling of return value inserted. */ |
5179 |
#ifdef USE_TIST_FOR_RESET |
4229 |
if (SkGeInitPort(pAC, IoC, FromPort)) { |
5180 |
if (pAC->GIni.GIYukon2) { |
4230 |
if (FromPort == 0) { |
5181 |
#ifdef Y2_RECOVERY |
4231 |
printk("%s: SkGeInitPort A failed.\n", pAC->dev[0]->name); |
5182 |
/* for Yukon II we want to have tist enabled all the time */ |
|
|
5183 |
if (!SK_ADAPTER_WAITING_FOR_TIST(pAC)) { |
5184 |
Y2_ENABLE_TIST(pAC->IoBase); |
5185 |
} |
5186 |
#else |
5187 |
/* make sure that we do not accept any status LEs from now on */ |
5188 |
if (SK_ADAPTER_WAITING_FOR_TIST(pAC)) { |
5189 |
#endif |
5190 |
/* port already waiting for tist */ |
5191 |
SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DUMP, |
5192 |
("Port %c is now waiting for specific Tist\n", |
5193 |
'A' + FromPort)); |
5194 |
SK_SET_WAIT_BIT_FOR_PORT( |
5195 |
pAC, |
5196 |
SK_PSTATE_WAITING_FOR_SPECIFIC_TIST, |
5197 |
FromPort); |
5198 |
/* get current timestamp */ |
5199 |
Y2_GET_TIST_LOW_VAL(pAC->IoBase, &pAC->MinTistLo); |
5200 |
pAC->MinTistHi = pAC->GIni.GITimeStampCnt; |
5201 |
#ifndef Y2_RECOVERY |
4232 |
} else { |
5202 |
} else { |
4233 |
printk("%s: SkGeInitPort B failed.\n", pAC->dev[1]->name); |
5203 |
/* nobody is waiting yet */ |
|
|
5204 |
SK_SET_WAIT_BIT_FOR_PORT( |
5205 |
pAC, |
5206 |
SK_PSTATE_WAITING_FOR_ANY_TIST, |
5207 |
FromPort); |
5208 |
SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DUMP, |
5209 |
("Port %c is now waiting for any Tist (0x%X)\n", |
5210 |
'A' + FromPort, pAC->AdapterResetState)); |
5211 |
/* start tist */ |
5212 |
Y2_ENABLE_TIST(pAC-IoBase); |
5213 |
} |
5214 |
#endif |
5215 |
} |
5216 |
#endif |
5217 |
|
5218 |
#ifdef Y2_LE_CHECK |
5219 |
/* mark entries invalid */ |
5220 |
pAC->LastPort = 3; |
5221 |
pAC->LastOpc = 0xFF; |
5222 |
#endif |
5223 |
if (CHIP_ID_YUKON_2(pAC)) { |
5224 |
SkY2PortStart(pAC, IoC, FromPort); |
5225 |
} else { |
5226 |
/* tschilling: Handling of return value inserted. */ |
5227 |
if (SkGeInitPort(pAC, IoC, FromPort)) { |
5228 |
if (FromPort == 0) { |
5229 |
printk("%s: SkGeInitPort A failed.\n", pAC->dev[0]->name); |
5230 |
} else { |
5231 |
printk("%s: SkGeInitPort B failed.\n", pAC->dev[1]->name); |
5232 |
} |
4234 |
} |
5233 |
} |
|
|
5234 |
SkAddrMcUpdate(pAC,IoC, FromPort); |
5235 |
PortReInitBmu(pAC, FromPort); |
5236 |
SkGePollTxD(pAC, IoC, FromPort, SK_TRUE); |
5237 |
CLEAR_AND_START_RX(FromPort); |
4235 |
} |
5238 |
} |
4236 |
SkAddrMcUpdate(pAC,IoC, FromPort); |
|
|
4237 |
PortReInitBmu(pAC, FromPort); |
4238 |
SkGePollTxD(pAC, IoC, FromPort, SK_TRUE); |
4239 |
ClearAndStartRx(pAC, FromPort); |
4240 |
spin_unlock_irqrestore( |
5239 |
spin_unlock_irqrestore( |
4241 |
&pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock, |
5240 |
&pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock, |
4242 |
Flags); |
5241 |
Flags); |
4243 |
break; |
5242 |
break; |
4244 |
case SK_DRV_NET_UP: /* SK_U32 PortIdx */ |
5243 |
case SK_DRV_NET_UP: |
4245 |
/* action list 5 */ |
|
|
4246 |
FromPort = Param.Para32[0]; |
5244 |
FromPort = Param.Para32[0]; |
4247 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, |
5245 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, |
4248 |
("NET UP EVENT, Port: %d ", Param.Para32[0])); |
5246 |
("NET UP EVENT, Port: %d ", FromPort)); |
4249 |
/* Mac update */ |
5247 |
SkAddrMcUpdate(pAC,IoC, FromPort); /* Mac update */ |
4250 |
SkAddrMcUpdate(pAC,IoC, FromPort); |
|
|
4251 |
|
4252 |
if (DoPrintInterfaceChange) { |
5248 |
if (DoPrintInterfaceChange) { |
4253 |
printk("%s: network connection up using" |
5249 |
printk("%s: network connection up using port %c\n", |
4254 |
" port %c\n", pAC->dev[Param.Para32[0]]->name, 'A'+Param.Para32[0]); |
5250 |
pAC->dev[FromPort]->name, 'A'+FromPort); |
4255 |
|
5251 |
|
4256 |
/* tschilling: Values changed according to LinkSpeedUsed. */ |
5252 |
/* tschilling: Values changed according to LinkSpeedUsed. */ |
4257 |
Stat = pAC->GIni.GP[FromPort].PLinkSpeedUsed; |
5253 |
Stat = pAC->GIni.GP[FromPort].PLinkSpeedUsed; |
4258 |
if (Stat == SK_LSPEED_STAT_10MBPS) { |
5254 |
if (Stat == SK_LSPEED_STAT_10MBPS) { |
4259 |
printk(" speed: 10\n"); |
5255 |
printk(" speed: 10\n"); |
4260 |
} else if (Stat == SK_LSPEED_STAT_100MBPS) { |
5256 |
} else if (Stat == SK_LSPEED_STAT_100MBPS) { |
4261 |
printk(" speed: 100\n"); |
5257 |
printk(" speed: 100\n"); |
4262 |
} else if (Stat == SK_LSPEED_STAT_1000MBPS) { |
5258 |
} else if (Stat == SK_LSPEED_STAT_1000MBPS) { |
4263 |
printk(" speed: 1000\n"); |
5259 |
printk(" speed: 1000\n"); |
4264 |
} else { |
5260 |
} else { |
4265 |
printk(" speed: unknown\n"); |
5261 |
printk(" speed: unknown\n"); |
4266 |
} |
5262 |
} |
4267 |
|
5263 |
|
|
|
5264 |
Stat = pAC->GIni.GP[FromPort].PLinkModeStatus; |
5265 |
if ((Stat == SK_LMODE_STAT_AUTOHALF) || |
5266 |
(Stat == SK_LMODE_STAT_AUTOFULL)) { |
5267 |
printk(" autonegotiation: yes\n"); |
5268 |
} else { |
5269 |
printk(" autonegotiation: no\n"); |
5270 |
} |
4268 |
|
5271 |
|
4269 |
Stat = pAC->GIni.GP[FromPort].PLinkModeStatus; |
5272 |
if ((Stat == SK_LMODE_STAT_AUTOHALF) || |
4270 |
if (Stat == SK_LMODE_STAT_AUTOHALF || |
5273 |
(Stat == SK_LMODE_STAT_HALF)) { |
4271 |
Stat == SK_LMODE_STAT_AUTOFULL) { |
5274 |
printk(" duplex mode: half\n"); |
4272 |
printk(" autonegotiation: yes\n"); |
5275 |
} else { |
4273 |
} |
5276 |
printk(" duplex mode: full\n"); |
4274 |
else { |
|
|
4275 |
printk(" autonegotiation: no\n"); |
4276 |
} |
4277 |
if (Stat == SK_LMODE_STAT_AUTOHALF || |
4278 |
Stat == SK_LMODE_STAT_HALF) { |
4279 |
printk(" duplex mode: half\n"); |
4280 |
} |
4281 |
else { |
4282 |
printk(" duplex mode: full\n"); |
4283 |
} |
4284 |
Stat = pAC->GIni.GP[FromPort].PFlowCtrlStatus; |
4285 |
if (Stat == SK_FLOW_STAT_REM_SEND ) { |
4286 |
printk(" flowctrl: remote send\n"); |
4287 |
} |
4288 |
else if (Stat == SK_FLOW_STAT_LOC_SEND ){ |
4289 |
printk(" flowctrl: local send\n"); |
4290 |
} |
4291 |
else if (Stat == SK_FLOW_STAT_SYMMETRIC ){ |
4292 |
printk(" flowctrl: symmetric\n"); |
4293 |
} |
4294 |
else { |
4295 |
printk(" flowctrl: none\n"); |
4296 |
} |
4297 |
|
4298 |
/* tschilling: Check against CopperType now. */ |
4299 |
if ((pAC->GIni.GICopperType == SK_TRUE) && |
4300 |
(pAC->GIni.GP[FromPort].PLinkSpeedUsed == |
4301 |
SK_LSPEED_STAT_1000MBPS)) { |
4302 |
Stat = pAC->GIni.GP[FromPort].PMSStatus; |
4303 |
if (Stat == SK_MS_STAT_MASTER ) { |
4304 |
printk(" role: master\n"); |
4305 |
} |
5277 |
} |
4306 |
else if (Stat == SK_MS_STAT_SLAVE ) { |
5278 |
|
4307 |
printk(" role: slave\n"); |
5279 |
Stat = pAC->GIni.GP[FromPort].PFlowCtrlStatus; |
|
|
5280 |
if (Stat == SK_FLOW_STAT_REM_SEND ) { |
5281 |
printk(" flowctrl: remote send\n"); |
5282 |
} else if (Stat == SK_FLOW_STAT_LOC_SEND ) { |
5283 |
printk(" flowctrl: local send\n"); |
5284 |
} else if (Stat == SK_FLOW_STAT_SYMMETRIC ) { |
5285 |
printk(" flowctrl: symmetric\n"); |
5286 |
} else { |
5287 |
printk(" flowctrl: none\n"); |
4308 |
} |
5288 |
} |
4309 |
else { |
5289 |
|
4310 |
printk(" role: ???\n"); |
5290 |
/* tschilling: Check against CopperType now. */ |
|
|
5291 |
if ((pAC->GIni.GICopperType == SK_TRUE) && |
5292 |
(pAC->GIni.GP[FromPort].PLinkSpeedUsed == |
5293 |
SK_LSPEED_STAT_1000MBPS)) { |
5294 |
Stat = pAC->GIni.GP[FromPort].PMSStatus; |
5295 |
if (Stat == SK_MS_STAT_MASTER ) { |
5296 |
printk(" role: master\n"); |
5297 |
} else if (Stat == SK_MS_STAT_SLAVE ) { |
5298 |
printk(" role: slave\n"); |
5299 |
} else { |
5300 |
printk(" role: ???\n"); |
5301 |
} |
4311 |
} |
5302 |
} |
4312 |
} |
|
|
4313 |
|
5303 |
|
4314 |
/* |
5304 |
/* Display interrupt moderation informations */ |
4315 |
Display dim (dynamic interrupt moderation) |
5305 |
if (pAC->DynIrqModInfo.IntModTypeSelect == C_INT_MOD_STATIC) { |
4316 |
informations |
5306 |
printk(" irq moderation: static (%d ints/sec)\n", |
4317 |
*/ |
|
|
4318 |
if (pAC->DynIrqModInfo.IntModTypeSelect == C_INT_MOD_STATIC) |
4319 |
printk(" irq moderation: static (%d ints/sec)\n", |
4320 |
pAC->DynIrqModInfo.MaxModIntsPerSec); |
5307 |
pAC->DynIrqModInfo.MaxModIntsPerSec); |
4321 |
else if (pAC->DynIrqModInfo.IntModTypeSelect == C_INT_MOD_DYNAMIC) |
5308 |
} else if (pAC->DynIrqModInfo.IntModTypeSelect == C_INT_MOD_DYNAMIC) { |
4322 |
printk(" irq moderation: dynamic (%d ints/sec)\n", |
5309 |
printk(" irq moderation: dynamic (%d ints/sec)\n", |
4323 |
pAC->DynIrqModInfo.MaxModIntsPerSec); |
5310 |
pAC->DynIrqModInfo.MaxModIntsPerSec); |
4324 |
else |
5311 |
} else { |
4325 |
printk(" irq moderation: disabled\n"); |
5312 |
printk(" irq moderation: disabled\n"); |
|
|
5313 |
} |
5314 |
|
5315 |
#ifdef NETIF_F_TSO |
5316 |
if (CHIP_ID_YUKON_2(pAC)) { |
5317 |
if (pAC->dev[FromPort]->features & NETIF_F_TSO) { |
5318 |
printk(" tcp offload: enabled\n"); |
5319 |
} else { |
5320 |
printk(" tcp offload: disabled\n"); |
5321 |
} |
5322 |
} |
5323 |
#endif |
4326 |
|
5324 |
|
|
|
5325 |
if (pAC->dev[FromPort]->features & NETIF_F_SG) { |
5326 |
printk(" scatter-gather: enabled\n"); |
5327 |
} else { |
5328 |
printk(" scatter-gather: disabled\n"); |
5329 |
} |
4327 |
|
5330 |
|
4328 |
#ifdef SK_ZEROCOPY |
5331 |
if (pAC->dev[FromPort]->features & NETIF_F_IP_CSUM) { |
4329 |
if (pAC->ChipsetType) |
5332 |
printk(" tx-checksum: enabled\n"); |
4330 |
#ifdef USE_SK_TX_CHECKSUM |
5333 |
} else { |
4331 |
printk(" scatter-gather: enabled\n"); |
5334 |
printk(" tx-checksum: disabled\n"); |
4332 |
#else |
5335 |
} |
4333 |
printk(" tx-checksum: disabled\n"); |
|
|
4334 |
#endif |
4335 |
else |
4336 |
printk(" scatter-gather: disabled\n"); |
4337 |
#else |
4338 |
printk(" scatter-gather: disabled\n"); |
4339 |
#endif |
4340 |
|
5336 |
|
4341 |
#ifndef USE_SK_RX_CHECKSUM |
5337 |
if (pAC->RxPort[FromPort].UseRxCsum) { |
4342 |
printk(" rx-checksum: disabled\n"); |
5338 |
printk(" rx-checksum: enabled\n"); |
|
|
5339 |
} else { |
5340 |
printk(" rx-checksum: disabled\n"); |
5341 |
} |
5342 |
#ifdef CONFIG_SK98LIN_NAPI |
5343 |
printk(" rx-polling: enabled\n"); |
4343 |
#endif |
5344 |
#endif |
4344 |
|
5345 |
if (pAC->LowLatency) { |
|
|
5346 |
printk(" low latency: enabled\n"); |
5347 |
} |
4345 |
} else { |
5348 |
} else { |
4346 |
DoPrintInterfaceChange = SK_TRUE; |
5349 |
DoPrintInterfaceChange = SK_TRUE; |
4347 |
} |
5350 |
} |
4348 |
|
5351 |
|
4349 |
if ((Param.Para32[0] != pAC->ActivePort) && |
5352 |
if ((FromPort != pAC->ActivePort)&&(pAC->RlmtNets == 1)) { |
4350 |
(pAC->RlmtNets == 1)) { |
5353 |
SkLocalEventQueue(pAC, SKGE_DRV, SK_DRV_SWITCH_INTERN, |
4351 |
NewPara.Para32[0] = pAC->ActivePort; |
5354 |
pAC->ActivePort, FromPort, SK_FALSE); |
4352 |
NewPara.Para32[1] = Param.Para32[0]; |
|
|
4353 |
SkEventQueue(pAC, SKGE_DRV, SK_DRV_SWITCH_INTERN, |
4354 |
NewPara); |
4355 |
} |
5355 |
} |
4356 |
|
5356 |
|
4357 |
/* Inform the world that link protocol is up. */ |
5357 |
/* Inform the world that link protocol is up. */ |
4358 |
pAC->dev[Param.Para32[0]]->flags |= IFF_RUNNING; |
5358 |
netif_wake_queue(pAC->dev[FromPort]); |
4359 |
|
5359 |
netif_carrier_on(pAC->dev[FromPort]); |
|
|
5360 |
pAC->dev[FromPort]->flags |= IFF_RUNNING; |
4360 |
break; |
5361 |
break; |
4361 |
case SK_DRV_NET_DOWN: /* SK_U32 Reason */ |
5362 |
case SK_DRV_NET_DOWN: |
4362 |
/* action list 7 */ |
5363 |
Reason = Param.Para32[0]; |
|
|
5364 |
FromPort = Param.Para32[1]; |
4363 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, |
5365 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, |
4364 |
("NET DOWN EVENT ")); |
5366 |
("NET DOWN EVENT ")); |
|
|
5367 |
|
5368 |
/* Stop queue and carrier */ |
5369 |
netif_stop_queue(pAC->dev[FromPort]); |
5370 |
netif_carrier_off(pAC->dev[FromPort]); |
5371 |
|
5372 |
/* Print link change */ |
4365 |
if (DoPrintInterfaceChange) { |
5373 |
if (DoPrintInterfaceChange) { |
4366 |
printk("%s: network connection down\n", |
5374 |
if (pAC->dev[FromPort]->flags & IFF_RUNNING) { |
4367 |
pAC->dev[Param.Para32[1]]->name); |
5375 |
printk("%s: network connection down\n", |
|
|
5376 |
pAC->dev[FromPort]->name); |
5377 |
} |
4368 |
} else { |
5378 |
} else { |
4369 |
DoPrintInterfaceChange = SK_TRUE; |
5379 |
DoPrintInterfaceChange = SK_TRUE; |
4370 |
} |
5380 |
} |
4371 |
pAC->dev[Param.Para32[1]]->flags &= ~IFF_RUNNING; |
5381 |
pAC->dev[FromPort]->flags &= ~IFF_RUNNING; |
4372 |
break; |
5382 |
break; |
4373 |
case SK_DRV_SWITCH_HARD: /* SK_U32 FromPortIdx SK_U32 ToPortIdx */ |
5383 |
case SK_DRV_SWITCH_HARD: /* FALL THRU */ |
4374 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, |
5384 |
case SK_DRV_SWITCH_SOFT: /* FALL THRU */ |
4375 |
("PORT SWITCH HARD ")); |
5385 |
case SK_DRV_SWITCH_INTERN: |
4376 |
case SK_DRV_SWITCH_SOFT: /* SK_U32 FromPortIdx SK_U32 ToPortIdx */ |
|
|
4377 |
/* action list 6 */ |
4378 |
printk("%s: switching to port %c\n", pAC->dev[0]->name, |
4379 |
'A'+Param.Para32[1]); |
4380 |
case SK_DRV_SWITCH_INTERN: /* SK_U32 FromPortIdx SK_U32 ToPortIdx */ |
4381 |
FromPort = Param.Para32[0]; |
5386 |
FromPort = Param.Para32[0]; |
4382 |
ToPort = Param.Para32[1]; |
5387 |
ToPort = Param.Para32[1]; |
|
|
5388 |
printk("%s: switching from port %c to port %c\n", |
5389 |
pAC->dev[0]->name, 'A'+FromPort, 'A'+ToPort); |
4383 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, |
5390 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, |
4384 |
("PORT SWITCH EVENT, From: %d To: %d (Pref %d) ", |
5391 |
("PORT SWITCH EVENT, From: %d To: %d (Pref %d) ", |
4385 |
FromPort, ToPort, pAC->Rlmt.Net[0].PrefPort)); |
5392 |
FromPort, ToPort, pAC->Rlmt.Net[0].PrefPort)); |
4386 |
NewPara.Para64 = FromPort; |
5393 |
SkLocalEventQueue64(pAC, SKGE_PNMI, SK_PNMI_EVT_XMAC_RESET, |
4387 |
SkPnmiEvent(pAC, IoC, SK_PNMI_EVT_XMAC_RESET, NewPara); |
5394 |
FromPort, SK_FALSE); |
4388 |
NewPara.Para64 = ToPort; |
5395 |
SkLocalEventQueue64(pAC, SKGE_PNMI, SK_PNMI_EVT_XMAC_RESET, |
4389 |
SkPnmiEvent(pAC, IoC, SK_PNMI_EVT_XMAC_RESET, NewPara); |
5396 |
ToPort, SK_FALSE); |
4390 |
spin_lock_irqsave( |
5397 |
spin_lock_irqsave( |
4391 |
&pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock, |
5398 |
&pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock, |
4392 |
Flags); |
5399 |
Flags); |
4393 |
spin_lock(&pAC->TxPort[ToPort][TX_PRIO_LOW].TxDesRingLock); |
5400 |
spin_lock(&pAC->TxPort[ToPort][TX_PRIO_LOW].TxDesRingLock); |
4394 |
SkGeStopPort(pAC, IoC, FromPort, SK_STOP_ALL, SK_SOFT_RST); |
5401 |
if (CHIP_ID_YUKON_2(pAC)) { |
4395 |
SkGeStopPort(pAC, IoC, ToPort, SK_STOP_ALL, SK_SOFT_RST); |
5402 |
SkY2PortStop(pAC, IoC, FromPort, SK_STOP_ALL, SK_SOFT_RST); |
|
|
5403 |
SkY2PortStop(pAC, IoC, ToPort, SK_STOP_ALL, SK_SOFT_RST); |
5404 |
} |
5405 |
else { |
5406 |
SkGeStopPort(pAC, IoC, FromPort, SK_STOP_ALL, SK_SOFT_RST); |
5407 |
SkGeStopPort(pAC, IoC, ToPort, SK_STOP_ALL, SK_SOFT_RST); |
5408 |
} |
4396 |
spin_unlock(&pAC->TxPort[ToPort][TX_PRIO_LOW].TxDesRingLock); |
5409 |
spin_unlock(&pAC->TxPort[ToPort][TX_PRIO_LOW].TxDesRingLock); |
4397 |
spin_unlock_irqrestore( |
5410 |
spin_unlock_irqrestore( |
4398 |
&pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock, |
5411 |
&pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock, |
4399 |
Flags); |
5412 |
Flags); |
4400 |
|
5413 |
|
4401 |
ReceiveIrq(pAC, &pAC->RxPort[FromPort], SK_FALSE); /* clears rx ring */ |
|
|
4402 |
ReceiveIrq(pAC, &pAC->RxPort[ToPort], SK_FALSE); /* clears rx ring */ |
4403 |
|
5414 |
|
4404 |
ClearTxRing(pAC, &pAC->TxPort[FromPort][TX_PRIO_LOW]); |
5415 |
if (!CHIP_ID_YUKON_2(pAC)) { |
4405 |
ClearTxRing(pAC, &pAC->TxPort[ToPort][TX_PRIO_LOW]); |
5416 |
#ifdef CONFIG_SK98LIN_NAPI |
|
|
5417 |
WorkToDo = 1; |
5418 |
ReceiveIrq(pAC, &pAC->RxPort[FromPort], SK_FALSE, &WorkDone, WorkToDo); |
5419 |
ReceiveIrq(pAC, &pAC->RxPort[ToPort], SK_FALSE, &WorkDone, WorkToDo); |
5420 |
#else |
5421 |
ReceiveIrq(pAC, &pAC->RxPort[FromPort], SK_FALSE); /* clears rx ring */ |
5422 |
ReceiveIrq(pAC, &pAC->RxPort[ToPort], SK_FALSE); /* clears rx ring */ |
5423 |
#endif |
5424 |
ClearTxRing(pAC, &pAC->TxPort[FromPort][TX_PRIO_LOW]); |
5425 |
ClearTxRing(pAC, &pAC->TxPort[ToPort][TX_PRIO_LOW]); |
5426 |
} |
5427 |
|
4406 |
spin_lock_irqsave( |
5428 |
spin_lock_irqsave( |
4407 |
&pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock, |
5429 |
&pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock, |
4408 |
Flags); |
5430 |
Flags); |
Lines 4429-4503
Link Here
|
4429 |
break; |
5451 |
break; |
4430 |
} |
5452 |
} |
4431 |
#endif |
5453 |
#endif |
4432 |
/* tschilling: Handling of return values inserted. */ |
5454 |
if (!CHIP_ID_YUKON_2(pAC)) { |
4433 |
if (SkGeInitPort(pAC, IoC, FromPort) || |
5455 |
/* tschilling: Handling of return values inserted. */ |
4434 |
SkGeInitPort(pAC, IoC, ToPort)) { |
5456 |
if (SkGeInitPort(pAC, IoC, FromPort) || |
4435 |
printk("%s: SkGeInitPort failed.\n", pAC->dev[0]->name); |
5457 |
SkGeInitPort(pAC, IoC, ToPort)) { |
|
|
5458 |
printk("%s: SkGeInitPort failed.\n", pAC->dev[0]->name); |
5459 |
} |
4436 |
} |
5460 |
} |
4437 |
if (Event == SK_DRV_SWITCH_SOFT) { |
5461 |
if (!CHIP_ID_YUKON_2(pAC)) { |
4438 |
SkMacRxTxEnable(pAC, IoC, FromPort); |
5462 |
if (Event == SK_DRV_SWITCH_SOFT) { |
|
|
5463 |
SkMacRxTxEnable(pAC, IoC, FromPort); |
5464 |
} |
5465 |
SkMacRxTxEnable(pAC, IoC, ToPort); |
4439 |
} |
5466 |
} |
4440 |
SkMacRxTxEnable(pAC, IoC, ToPort); |
5467 |
|
4441 |
SkAddrSwap(pAC, IoC, FromPort, ToPort); |
5468 |
SkAddrSwap(pAC, IoC, FromPort, ToPort); |
4442 |
SkAddrMcUpdate(pAC, IoC, FromPort); |
5469 |
SkAddrMcUpdate(pAC, IoC, FromPort); |
4443 |
SkAddrMcUpdate(pAC, IoC, ToPort); |
5470 |
SkAddrMcUpdate(pAC, IoC, ToPort); |
4444 |
PortReInitBmu(pAC, FromPort); |
5471 |
|
4445 |
PortReInitBmu(pAC, ToPort); |
5472 |
#ifdef USE_TIST_FOR_RESET |
4446 |
SkGePollTxD(pAC, IoC, FromPort, SK_TRUE); |
5473 |
if (pAC->GIni.GIYukon2) { |
4447 |
SkGePollTxD(pAC, IoC, ToPort, SK_TRUE); |
5474 |
/* make sure that we do not accept any status LEs from now on */ |
4448 |
ClearAndStartRx(pAC, FromPort); |
5475 |
SK_DBG_MSG(pAC, SK_DBGMOD_DRV, SK_DBGCAT_DUMP, |
4449 |
ClearAndStartRx(pAC, ToPort); |
5476 |
("both Ports now waiting for specific Tist\n")); |
|
|
5477 |
SK_SET_WAIT_BIT_FOR_PORT( |
5478 |
pAC, |
5479 |
SK_PSTATE_WAITING_FOR_ANY_TIST, |
5480 |
0); |
5481 |
SK_SET_WAIT_BIT_FOR_PORT( |
5482 |
pAC, |
5483 |
SK_PSTATE_WAITING_FOR_ANY_TIST, |
5484 |
1); |
5485 |
|
5486 |
/* start tist */ |
5487 |
Y2_ENABLE_TIST(pAC->IoBase); |
5488 |
} |
5489 |
#endif |
5490 |
if (!CHIP_ID_YUKON_2(pAC)) { |
5491 |
PortReInitBmu(pAC, FromPort); |
5492 |
PortReInitBmu(pAC, ToPort); |
5493 |
SkGePollTxD(pAC, IoC, FromPort, SK_TRUE); |
5494 |
SkGePollTxD(pAC, IoC, ToPort, SK_TRUE); |
5495 |
CLEAR_AND_START_RX(FromPort); |
5496 |
CLEAR_AND_START_RX(ToPort); |
5497 |
} else { |
5498 |
SkY2PortStart(pAC, IoC, FromPort); |
5499 |
SkY2PortStart(pAC, IoC, ToPort); |
5500 |
#ifdef SK_YUKON2 |
5501 |
/* in yukon-II always port 0 has to be started first */ |
5502 |
// SkY2PortStart(pAC, IoC, 0); |
5503 |
// SkY2PortStart(pAC, IoC, 1); |
5504 |
#endif |
5505 |
} |
4450 |
spin_unlock(&pAC->TxPort[ToPort][TX_PRIO_LOW].TxDesRingLock); |
5506 |
spin_unlock(&pAC->TxPort[ToPort][TX_PRIO_LOW].TxDesRingLock); |
4451 |
spin_unlock_irqrestore( |
5507 |
spin_unlock_irqrestore( |
4452 |
&pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock, |
5508 |
&pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock, |
4453 |
Flags); |
5509 |
Flags); |
4454 |
break; |
5510 |
break; |
4455 |
case SK_DRV_RLMT_SEND: /* SK_MBUF *pMb */ |
5511 |
case SK_DRV_RLMT_SEND: /* SK_MBUF *pMb */ |
4456 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, |
5512 |
SK_DBG_MSG(NULL,SK_DBGMOD_DRV,SK_DBGCAT_DRV_EVENT,("RLS ")); |
4457 |
("RLS ")); |
5513 |
pRlmtMbuf = (SK_MBUF*) Param.pParaPtr; |
4458 |
pRlmtMbuf = (SK_MBUF*) Param.pParaPtr; |
5514 |
pMsg = (struct sk_buff*) pRlmtMbuf->pOs; |
4459 |
pMsg = (struct sk_buff*) pRlmtMbuf->pOs; |
5515 |
skb_put(pMsg, pRlmtMbuf->Length); |
4460 |
skb_put(pMsg, pRlmtMbuf->Length); |
5516 |
if (!CHIP_ID_YUKON_2(pAC)) { |
4461 |
if (XmitFrame(pAC, &pAC->TxPort[pRlmtMbuf->PortIdx][TX_PRIO_LOW], |
5517 |
if (XmitFrame(pAC, &pAC->TxPort[pRlmtMbuf->PortIdx][TX_PRIO_LOW], |
4462 |
pMsg) < 0) |
5518 |
pMsg) < 0) { |
|
|
5519 |
DEV_KFREE_SKB_ANY(pMsg); |
5520 |
} |
5521 |
} else { |
5522 |
if (SkY2RlmtSend(pAC, pRlmtMbuf->PortIdx, pMsg) < 0) { |
5523 |
DEV_KFREE_SKB_ANY(pMsg); |
5524 |
} |
5525 |
} |
5526 |
break; |
5527 |
case SK_DRV_TIMER: |
5528 |
if (Param.Para32[0] == SK_DRV_MODERATION_TIMER) { |
5529 |
/* check what IRQs are to be moderated */ |
5530 |
SkDimStartModerationTimer(pAC); |
5531 |
SkDimModerate(pAC); |
5532 |
} else { |
5533 |
printk("Expiration of unknown timer\n"); |
5534 |
} |
5535 |
break; |
5536 |
case SK_DRV_ADAP_FAIL: |
5537 |
#if (!defined (Y2_RECOVERY) && !defined (Y2_LE_CHECK)) |
5538 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, |
5539 |
("ADAPTER FAIL EVENT\n")); |
5540 |
printk("%s: Adapter failed.\n", pAC->dev[0]->name); |
5541 |
SK_OUT32(pAC->IoBase, B0_IMSK, 0); /* disable interrupts */ |
5542 |
break; |
5543 |
#endif |
5544 |
|
5545 |
#if (defined (Y2_RECOVERY) || defined (Y2_LE_CHECK)) |
5546 |
case SK_DRV_RECOVER: |
5547 |
pNet = (DEV_NET *) pAC->dev[0]->priv; |
5548 |
|
5549 |
/* Recover already in progress */ |
5550 |
if (pNet->InRecover) { |
5551 |
break; |
5552 |
} |
5553 |
|
5554 |
netif_stop_queue(pAC->dev[0]); /* stop device if running */ |
5555 |
pNet->InRecover = SK_TRUE; |
5556 |
|
5557 |
FromPort = Param.Para32[0]; |
5558 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, |
5559 |
("PORT RESET EVENT, Port: %d ", FromPort)); |
5560 |
|
5561 |
/* Disable interrupts */ |
5562 |
SK_OUT32(pAC->IoBase, B0_IMSK, 0); |
5563 |
SK_OUT32(pAC->IoBase, B0_HWE_IMSK, 0); |
5564 |
|
5565 |
SkLocalEventQueue64(pAC, SKGE_PNMI, SK_PNMI_EVT_XMAC_RESET, |
5566 |
FromPort, SK_FALSE); |
5567 |
spin_lock_irqsave( |
5568 |
&pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock, |
5569 |
Flags); |
5570 |
if (CHIP_ID_YUKON_2(pAC)) { |
5571 |
if (pAC->GIni.GIMacsFound > 1) { |
5572 |
SkY2PortStop(pAC, IoC, 0, SK_STOP_ALL, SK_SOFT_RST); |
5573 |
SkY2PortStop(pAC, IoC, 1, SK_STOP_ALL, SK_SOFT_RST); |
5574 |
} else { |
5575 |
SkY2PortStop(pAC, IoC, FromPort, SK_STOP_ALL, SK_SOFT_RST); |
5576 |
} |
5577 |
} else { |
5578 |
SkGeStopPort(pAC, IoC, FromPort, SK_STOP_ALL, SK_SOFT_RST); |
5579 |
} |
5580 |
pAC->dev[Param.Para32[0]]->flags &= ~IFF_RUNNING; |
5581 |
spin_unlock_irqrestore( |
5582 |
&pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock, |
5583 |
Flags); |
5584 |
|
5585 |
if (!CHIP_ID_YUKON_2(pAC)) { |
5586 |
#ifdef CONFIG_SK98LIN_NAPI |
5587 |
WorkToDo = 1; |
5588 |
ReceiveIrq(pAC, &pAC->RxPort[FromPort], SK_FALSE, &WorkDone, WorkToDo); |
5589 |
#else |
5590 |
ReceiveIrq(pAC, &pAC->RxPort[FromPort], SK_FALSE); |
5591 |
#endif |
5592 |
ClearTxRing(pAC, &pAC->TxPort[FromPort][TX_PRIO_LOW]); |
5593 |
} |
5594 |
spin_lock_irqsave( |
5595 |
&pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock, |
5596 |
Flags); |
5597 |
|
5598 |
#ifdef USE_TIST_FOR_RESET |
5599 |
if (pAC->GIni.GIYukon2) { |
5600 |
#if 0 |
5601 |
/* make sure that we do not accept any status LEs from now on */ |
5602 |
Y2_ENABLE_TIST(pAC->IoBase); |
5603 |
|
5604 |
/* get current timestamp */ |
5605 |
Y2_GET_TIST_LOW_VAL(pAC->IoBase, &pAC->MinTistLo); |
5606 |
pAC->MinTistHi = pAC->GIni.GITimeStampCnt; |
5607 |
|
5608 |
SK_SET_WAIT_BIT_FOR_PORT( |
5609 |
pAC, |
5610 |
SK_PSTATE_WAITING_FOR_SPECIFIC_TIST, |
5611 |
FromPort); |
5612 |
#endif |
5613 |
if (pAC->GIni.GIMacsFound > 1) { |
5614 |
SK_SET_WAIT_BIT_FOR_PORT( |
5615 |
pAC, |
5616 |
SK_PSTATE_WAITING_FOR_ANY_TIST, |
5617 |
0); |
5618 |
SK_SET_WAIT_BIT_FOR_PORT( |
5619 |
pAC, |
5620 |
SK_PSTATE_WAITING_FOR_ANY_TIST, |
5621 |
1); |
5622 |
} else { |
5623 |
SK_SET_WAIT_BIT_FOR_PORT( |
5624 |
pAC, |
5625 |
SK_PSTATE_WAITING_FOR_ANY_TIST, |
5626 |
FromPort); |
5627 |
} |
5628 |
|
5629 |
/* start tist */ |
5630 |
Y2_ENABLE_TIST(pAC->IoBase); |
5631 |
} |
5632 |
#endif |
5633 |
|
5634 |
|
5635 |
|
5636 |
#ifdef Y2_LE_CHECK |
5637 |
/* mark entries invalid */ |
5638 |
pAC->LastPort = 3; |
5639 |
pAC->LastOpc = 0xFF; |
5640 |
#endif |
5641 |
|
5642 |
#endif |
5643 |
/* Restart ports but do not initialize PHY. */ |
5644 |
if (CHIP_ID_YUKON_2(pAC)) { |
5645 |
if (pAC->GIni.GIMacsFound > 1) { |
5646 |
SkY2PortStart(pAC, IoC, 0); |
5647 |
SkY2PortStart(pAC, IoC, 1); |
5648 |
} else { |
5649 |
SkY2PortStart(pAC, IoC, FromPort); |
5650 |
} |
5651 |
} else { |
5652 |
/* tschilling: Handling of return value inserted. */ |
5653 |
if (SkGeInitPort(pAC, IoC, FromPort)) { |
5654 |
if (FromPort == 0) { |
5655 |
printk("%s: SkGeInitPort A failed.\n", pAC->dev[0]->name); |
5656 |
} else { |
5657 |
printk("%s: SkGeInitPort B failed.\n", pAC->dev[1]->name); |
5658 |
} |
5659 |
} |
5660 |
SkAddrMcUpdate(pAC,IoC, FromPort); |
5661 |
PortReInitBmu(pAC, FromPort); |
5662 |
SkGePollTxD(pAC, IoC, FromPort, SK_TRUE); |
5663 |
CLEAR_AND_START_RX(FromPort); |
5664 |
} |
5665 |
spin_unlock_irqrestore( |
5666 |
&pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock, |
5667 |
Flags); |
4463 |
|
5668 |
|
4464 |
DEV_KFREE_SKB_ANY(pMsg); |
5669 |
#if 0 |
4465 |
break; |
5670 |
/* restart the kernel timer */ |
4466 |
case SK_DRV_TIMER: |
5671 |
pNet = (DEV_NET *) pAC->dev[FromPort]->priv; |
4467 |
if (Param.Para32[0] == SK_DRV_MODERATION_TIMER) { |
5672 |
if (!timer_pending(&pNet->KernelTimer)) { |
4468 |
/* |
5673 |
pNet->KernelTimer.expires = |
4469 |
** expiration of the moderation timer implies that |
5674 |
jiffies + (HZ/4); /* 250ms */ |
4470 |
** dynamic moderation is to be applied |
5675 |
add_timer(&pNet->KernelTimer); |
4471 |
*/ |
|
|
4472 |
SkDimStartModerationTimer(pAC); |
4473 |
SkDimModerate(pAC); |
4474 |
if (pAC->DynIrqModInfo.DisplayStats) { |
4475 |
SkDimDisplayModerationSettings(pAC); |
4476 |
} |
4477 |
} else if (Param.Para32[0] == SK_DRV_RX_CLEANUP_TIMER) { |
4478 |
/* |
4479 |
** check if we need to check for descriptors which |
4480 |
** haven't been handled the last millisecs |
4481 |
*/ |
4482 |
StartDrvCleanupTimer(pAC); |
4483 |
if (pAC->GIni.GIMacsFound == 2) { |
4484 |
ReceiveIrq(pAC, &pAC->RxPort[1], SK_FALSE); |
4485 |
} |
4486 |
ReceiveIrq(pAC, &pAC->RxPort[0], SK_FALSE); |
4487 |
} else { |
4488 |
printk("Expiration of unknown timer\n"); |
4489 |
} |
5676 |
} |
|
|
5677 |
#endif |
5678 |
pNet->InRecover = SK_FALSE; |
5679 |
/* enable Interrupts */ |
5680 |
SK_OUT32(pAC->IoBase, B0_IMSK, pAC->GIni.GIValIrqMask); |
5681 |
SK_OUT32(pAC->IoBase, B0_HWE_IMSK, IRQ_HWE_MASK); |
5682 |
netif_wake_queue(pAC->dev[0]); |
4490 |
break; |
5683 |
break; |
4491 |
default: |
5684 |
default: |
4492 |
break; |
5685 |
break; |
4493 |
} |
5686 |
} |
4494 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, |
5687 |
SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, |
4495 |
("END EVENT ")); |
5688 |
("END EVENT ")); |
4496 |
|
5689 |
|
4497 |
return (0); |
5690 |
return (0); |
4498 |
} /* SkDrvEvent */ |
5691 |
} /* SkDrvEvent */ |
4499 |
|
5692 |
|
4500 |
|
5693 |
|
|
|
5694 |
/****************************************************************************** |
5695 |
* |
5696 |
* SkLocalEventQueue() - add event to queue |
5697 |
* |
5698 |
* Description: |
5699 |
* This function adds an event to the event queue and run the |
5700 |
* SkEventDispatcher. At least Init Level 1 is required to queue events, |
5701 |
* but will be scheduled add Init Level 2. |
5702 |
* |
5703 |
* returns: |
5704 |
* nothing |
5705 |
*/ |
5706 |
void SkLocalEventQueue( |
5707 |
SK_AC *pAC, /* Adapters context */ |
5708 |
SK_U32 Class, /* Event Class */ |
5709 |
SK_U32 Event, /* Event to be queued */ |
5710 |
SK_U32 Param1, /* Event parameter 1 */ |
5711 |
SK_U32 Param2, /* Event parameter 2 */ |
5712 |
SK_BOOL Dispatcher) /* Dispatcher flag: |
5713 |
* TRUE == Call SkEventDispatcher |
5714 |
* FALSE == Don't execute SkEventDispatcher |
5715 |
*/ |
5716 |
{ |
5717 |
SK_EVPARA EvPara; |
5718 |
EvPara.Para32[0] = Param1; |
5719 |
EvPara.Para32[1] = Param2; |
5720 |
|
5721 |
|
5722 |
if (Class == SKGE_PNMI) { |
5723 |
SkPnmiEvent( pAC, |
5724 |
pAC->IoBase, |
5725 |
Event, |
5726 |
EvPara); |
5727 |
} else { |
5728 |
SkEventQueue( pAC, |
5729 |
Class, |
5730 |
Event, |
5731 |
EvPara); |
5732 |
} |
5733 |
|
5734 |
/* Run the dispatcher */ |
5735 |
if (Dispatcher) { |
5736 |
SkEventDispatcher(pAC, pAC->IoBase); |
5737 |
} |
5738 |
|
5739 |
} |
5740 |
|
5741 |
/****************************************************************************** |
5742 |
* |
5743 |
* SkLocalEventQueue64() - add event to queue (64bit version) |
5744 |
* |
5745 |
* Description: |
5746 |
* This function adds an event to the event queue and run the |
5747 |
* SkEventDispatcher. At least Init Level 1 is required to queue events, |
5748 |
* but will be scheduled add Init Level 2. |
5749 |
* |
5750 |
* returns: |
5751 |
* nothing |
5752 |
*/ |
5753 |
void SkLocalEventQueue64( |
5754 |
SK_AC *pAC, /* Adapters context */ |
5755 |
SK_U32 Class, /* Event Class */ |
5756 |
SK_U32 Event, /* Event to be queued */ |
5757 |
SK_U64 Param, /* Event parameter */ |
5758 |
SK_BOOL Dispatcher) /* Dispatcher flag: |
5759 |
* TRUE == Call SkEventDispatcher |
5760 |
* FALSE == Don't execute SkEventDispatcher |
5761 |
*/ |
5762 |
{ |
5763 |
SK_EVPARA EvPara; |
5764 |
EvPara.Para64 = Param; |
5765 |
|
5766 |
|
5767 |
if (Class == SKGE_PNMI) { |
5768 |
SkPnmiEvent( pAC, |
5769 |
pAC->IoBase, |
5770 |
Event, |
5771 |
EvPara); |
5772 |
} else { |
5773 |
SkEventQueue( pAC, |
5774 |
Class, |
5775 |
Event, |
5776 |
EvPara); |
5777 |
} |
5778 |
|
5779 |
/* Run the dispatcher */ |
5780 |
if (Dispatcher) { |
5781 |
SkEventDispatcher(pAC, pAC->IoBase); |
5782 |
} |
5783 |
|
5784 |
} |
5785 |
|
5786 |
|
4501 |
/***************************************************************************** |
5787 |
/***************************************************************************** |
4502 |
* |
5788 |
* |
4503 |
* SkErrorLog - log errors |
5789 |
* SkErrorLog - log errors |
Lines 4547-4554
Link Here
|
4547 |
|
5833 |
|
4548 |
} /* SkErrorLog */ |
5834 |
} /* SkErrorLog */ |
4549 |
|
5835 |
|
4550 |
#ifdef SK_DIAG_SUPPORT |
|
|
4551 |
|
4552 |
/***************************************************************************** |
5836 |
/***************************************************************************** |
4553 |
* |
5837 |
* |
4554 |
* SkDrvEnterDiagMode - handles DIAG attach request |
5838 |
* SkDrvEnterDiagMode - handles DIAG attach request |
Lines 4563-4577
Link Here
|
4563 |
int SkDrvEnterDiagMode( |
5847 |
int SkDrvEnterDiagMode( |
4564 |
SK_AC *pAc) /* pointer to adapter context */ |
5848 |
SK_AC *pAc) /* pointer to adapter context */ |
4565 |
{ |
5849 |
{ |
4566 |
DEV_NET *pNet = netdev_priv(pAc->dev[0]); |
5850 |
SK_AC *pAC = NULL; |
4567 |
SK_AC *pAC = pNet->pAC; |
5851 |
DEV_NET *pNet = NULL; |
|
|
5852 |
|
5853 |
pNet = (DEV_NET *) pAc->dev[0]->priv; |
5854 |
pAC = pNet->pAC; |
4568 |
|
5855 |
|
4569 |
SK_MEMCPY(&(pAc->PnmiBackup), &(pAc->PnmiStruct), |
5856 |
SK_MEMCPY(&(pAc->PnmiBackup), &(pAc->PnmiStruct), |
4570 |
sizeof(SK_PNMI_STRUCT_DATA)); |
5857 |
sizeof(SK_PNMI_STRUCT_DATA)); |
4571 |
|
5858 |
|
4572 |
pAC->DiagModeActive = DIAG_ACTIVE; |
5859 |
pAC->DiagModeActive = DIAG_ACTIVE; |
4573 |
if (pAC->BoardLevel > SK_INIT_DATA) { |
5860 |
if (pAC->BoardLevel > SK_INIT_DATA) { |
4574 |
if (pNet->Up) { |
5861 |
if (netif_running(pAC->dev[0])) { |
4575 |
pAC->WasIfUp[0] = SK_TRUE; |
5862 |
pAC->WasIfUp[0] = SK_TRUE; |
4576 |
pAC->DiagFlowCtrl = SK_TRUE; /* for SkGeClose */ |
5863 |
pAC->DiagFlowCtrl = SK_TRUE; /* for SkGeClose */ |
4577 |
DoPrintInterfaceChange = SK_FALSE; |
5864 |
DoPrintInterfaceChange = SK_FALSE; |
Lines 4579-4587
Link Here
|
4579 |
} else { |
5866 |
} else { |
4580 |
pAC->WasIfUp[0] = SK_FALSE; |
5867 |
pAC->WasIfUp[0] = SK_FALSE; |
4581 |
} |
5868 |
} |
4582 |
if (pNet != netdev_priv(pAC->dev[1])) { |
5869 |
|
4583 |
pNet = netdev_priv(pAC->dev[1]); |
5870 |
if (pNet != (DEV_NET *) pAc->dev[1]->priv) { |
4584 |
if (pNet->Up) { |
5871 |
pNet = (DEV_NET *) pAc->dev[1]->priv; |
|
|
5872 |
if (netif_running(pAC->dev[1])) { |
4585 |
pAC->WasIfUp[1] = SK_TRUE; |
5873 |
pAC->WasIfUp[1] = SK_TRUE; |
4586 |
pAC->DiagFlowCtrl = SK_TRUE; /* for SkGeClose */ |
5874 |
pAC->DiagFlowCtrl = SK_TRUE; /* for SkGeClose */ |
4587 |
DoPrintInterfaceChange = SK_FALSE; |
5875 |
DoPrintInterfaceChange = SK_FALSE; |
Lines 4613-4628
Link Here
|
4613 |
sizeof(SK_PNMI_STRUCT_DATA)); |
5901 |
sizeof(SK_PNMI_STRUCT_DATA)); |
4614 |
pAc->DiagModeActive = DIAG_NOTACTIVE; |
5902 |
pAc->DiagModeActive = DIAG_NOTACTIVE; |
4615 |
pAc->Pnmi.DiagAttached = SK_DIAG_IDLE; |
5903 |
pAc->Pnmi.DiagAttached = SK_DIAG_IDLE; |
4616 |
if (pAc->WasIfUp[0] == SK_TRUE) { |
5904 |
if (pAc->WasIfUp[0] == SK_TRUE) { |
4617 |
pAc->DiagFlowCtrl = SK_TRUE; /* for SkGeClose */ |
5905 |
pAc->DiagFlowCtrl = SK_TRUE; /* for SkGeClose */ |
4618 |
DoPrintInterfaceChange = SK_FALSE; |
5906 |
DoPrintInterfaceChange = SK_FALSE; |
4619 |
SkDrvInitAdapter(pAc, 0); /* first device */ |
5907 |
SkDrvInitAdapter(pAc, 0); /* first device */ |
4620 |
} |
5908 |
} |
4621 |
if (pAc->WasIfUp[1] == SK_TRUE) { |
5909 |
if (pAc->WasIfUp[1] == SK_TRUE) { |
4622 |
pAc->DiagFlowCtrl = SK_TRUE; /* for SkGeClose */ |
5910 |
pAc->DiagFlowCtrl = SK_TRUE; /* for SkGeClose */ |
4623 |
DoPrintInterfaceChange = SK_FALSE; |
5911 |
DoPrintInterfaceChange = SK_FALSE; |
4624 |
SkDrvInitAdapter(pAc, 1); /* second device */ |
5912 |
SkDrvInitAdapter(pAc, 1); /* second device */ |
4625 |
} |
5913 |
} |
4626 |
return(0); |
5914 |
return(0); |
4627 |
} |
5915 |
} |
4628 |
|
5916 |
|
Lines 4702-4712
Link Here
|
4702 |
|
5990 |
|
4703 |
dev = pAC->dev[devNbr]; |
5991 |
dev = pAC->dev[devNbr]; |
4704 |
|
5992 |
|
4705 |
/* On Linux 2.6 the network driver does NOT mess with reference |
5993 |
/* |
4706 |
** counts. The driver MUST be able to be unloaded at any time |
5994 |
** Function SkGeClose() uses MOD_DEC_USE_COUNT (2.2/2.4) |
4707 |
** due to the possibility of hotplug. |
5995 |
** or module_put() (2.6) to decrease the number of users for |
|
|
5996 |
** a device, but if a device is to be put under control of |
5997 |
** the DIAG, that count is OK already and does not need to |
5998 |
** be adapted! Hence the opposite MOD_INC_USE_COUNT or |
5999 |
** try_module_get() needs to be used again to correct that. |
4708 |
*/ |
6000 |
*/ |
|
|
6001 |
if (!try_module_get(THIS_MODULE)) { |
6002 |
return (-1); |
6003 |
} |
6004 |
|
4709 |
if (SkGeClose(dev) != 0) { |
6005 |
if (SkGeClose(dev) != 0) { |
|
|
6006 |
module_put(THIS_MODULE); |
4710 |
return (-1); |
6007 |
return (-1); |
4711 |
} |
6008 |
} |
4712 |
return (0); |
6009 |
return (0); |
Lines 4735-4740
Link Here
|
4735 |
|
6032 |
|
4736 |
if (SkGeOpen(dev) != 0) { |
6033 |
if (SkGeOpen(dev) != 0) { |
4737 |
return (-1); |
6034 |
return (-1); |
|
|
6035 |
} else { |
6036 |
/* |
6037 |
** Function SkGeOpen() uses MOD_INC_USE_COUNT (2.2/2.4) |
6038 |
** or try_module_get() (2.6) to increase the number of |
6039 |
** users for a device, but if a device was just under |
6040 |
** control of the DIAG, that count is OK already and |
6041 |
** does not need to be adapted! Hence the opposite |
6042 |
** MOD_DEC_USE_COUNT or module_put() needs to be used |
6043 |
** again to correct that. |
6044 |
*/ |
6045 |
module_put(THIS_MODULE); |
4738 |
} |
6046 |
} |
4739 |
|
6047 |
|
4740 |
/* |
6048 |
/* |
Lines 4747-4760
Link Here
|
4747 |
|
6055 |
|
4748 |
} /* SkDrvInitAdapter */ |
6056 |
} /* SkDrvInitAdapter */ |
4749 |
|
6057 |
|
4750 |
#endif |
6058 |
static int __init sk98lin_init(void) |
|
|
6059 |
{ |
6060 |
return pci_module_init(&sk98lin_driver); |
6061 |
} |
6062 |
|
6063 |
static void __exit sk98lin_cleanup(void) |
6064 |
{ |
6065 |
pci_unregister_driver(&sk98lin_driver); |
6066 |
} |
6067 |
|
6068 |
module_init(sk98lin_init); |
6069 |
module_exit(sk98lin_cleanup); |
6070 |
|
4751 |
|
6071 |
|
4752 |
#ifdef DEBUG |
6072 |
#ifdef DEBUG |
4753 |
/****************************************************************************/ |
6073 |
/****************************************************************************/ |
4754 |
/* "debug only" section *****************************************************/ |
6074 |
/* "debug only" section *****************************************************/ |
4755 |
/****************************************************************************/ |
6075 |
/****************************************************************************/ |
4756 |
|
6076 |
|
4757 |
|
|
|
4758 |
/***************************************************************************** |
6077 |
/***************************************************************************** |
4759 |
* |
6078 |
* |
4760 |
* DumpMsg - print a frame |
6079 |
* DumpMsg - print a frame |
Lines 4765-4773
Link Here
|
4765 |
* Returns: N/A |
6084 |
* Returns: N/A |
4766 |
* |
6085 |
* |
4767 |
*/ |
6086 |
*/ |
4768 |
static void DumpMsg(struct sk_buff *skb, char *str) |
6087 |
static void DumpMsg( |
|
|
6088 |
struct sk_buff *skb, /* linux' socket buffer */ |
6089 |
char *str) /* additional msg string */ |
4769 |
{ |
6090 |
{ |
4770 |
int msglen; |
6091 |
int msglen = (skb->len > 64) ? 64 : skb->len; |
4771 |
|
6092 |
|
4772 |
if (skb == NULL) { |
6093 |
if (skb == NULL) { |
4773 |
printk("DumpMsg(): NULL-Message\n"); |
6094 |
printk("DumpMsg(): NULL-Message\n"); |
Lines 4779-4797
Link Here
|
4779 |
return; |
6100 |
return; |
4780 |
} |
6101 |
} |
4781 |
|
6102 |
|
4782 |
msglen = skb->len; |
6103 |
printk("DumpMsg: PhysPage: %p\n", |
4783 |
if (msglen > 64) |
6104 |
page_address(virt_to_page(skb->data))); |
4784 |
msglen = 64; |
6105 |
printk("--- Begin of message from %s , len %d (from %d) ----\n", |
4785 |
|
6106 |
str, msglen, skb->len); |
4786 |
printk("--- Begin of message from %s , len %d (from %d) ----\n", str, msglen, skb->len); |
|
|
4787 |
|
4788 |
DumpData((char *)skb->data, msglen); |
6107 |
DumpData((char *)skb->data, msglen); |
4789 |
|
|
|
4790 |
printk("------- End of message ---------\n"); |
6108 |
printk("------- End of message ---------\n"); |
4791 |
} /* DumpMsg */ |
6109 |
} /* DumpMsg */ |
4792 |
|
6110 |
|
4793 |
|
|
|
4794 |
|
4795 |
/***************************************************************************** |
6111 |
/***************************************************************************** |
4796 |
* |
6112 |
* |
4797 |
* DumpData - print a data area |
6113 |
* DumpData - print a data area |
Lines 4803-4825
Link Here
|
4803 |
* Returns: N/A |
6119 |
* Returns: N/A |
4804 |
* |
6120 |
* |
4805 |
*/ |
6121 |
*/ |
4806 |
static void DumpData(char *p, int size) |
6122 |
static void DumpData( |
4807 |
{ |
6123 |
char *p, /* pointer to area containing the data */ |
4808 |
register int i; |
6124 |
int size) /* the size of that data area in bytes */ |
4809 |
int haddr, addr; |
6125 |
{ |
4810 |
char hex_buffer[180]; |
6126 |
register int i; |
4811 |
char asc_buffer[180]; |
6127 |
int haddr = 0, addr = 0; |
4812 |
char HEXCHAR[] = "0123456789ABCDEF"; |
6128 |
char hex_buffer[180] = { '\0' }; |
4813 |
|
6129 |
char asc_buffer[180] = { '\0' }; |
4814 |
addr = 0; |
6130 |
char HEXCHAR[] = "0123456789ABCDEF"; |
4815 |
haddr = 0; |
6131 |
|
4816 |
hex_buffer[0] = 0; |
|
|
4817 |
asc_buffer[0] = 0; |
4818 |
for (i=0; i < size; ) { |
6132 |
for (i=0; i < size; ) { |
4819 |
if (*p >= '0' && *p <='z') |
6133 |
if (*p >= '0' && *p <='z') { |
4820 |
asc_buffer[addr] = *p; |
6134 |
asc_buffer[addr] = *p; |
4821 |
else |
6135 |
} else { |
4822 |
asc_buffer[addr] = '.'; |
6136 |
asc_buffer[addr] = '.'; |
|
|
6137 |
} |
4823 |
addr++; |
6138 |
addr++; |
4824 |
asc_buffer[addr] = 0; |
6139 |
asc_buffer[addr] = 0; |
4825 |
hex_buffer[haddr] = HEXCHAR[(*p & 0xf0) >> 4]; |
6140 |
hex_buffer[haddr] = HEXCHAR[(*p & 0xf0) >> 4]; |
Lines 4845-4871
Link Here
|
4845 |
* DumpLong - print a data area as long values |
6160 |
* DumpLong - print a data area as long values |
4846 |
* |
6161 |
* |
4847 |
* Description: |
6162 |
* Description: |
4848 |
* This function prints a area of data to the system logfile/to the |
6163 |
* This function prints a long variable to the system logfile/to the |
4849 |
* console. |
6164 |
* console. |
4850 |
* |
6165 |
* |
4851 |
* Returns: N/A |
6166 |
* Returns: N/A |
4852 |
* |
6167 |
* |
4853 |
*/ |
6168 |
*/ |
4854 |
static void DumpLong(char *pc, int size) |
6169 |
static void DumpLong( |
4855 |
{ |
6170 |
char *pc, /* location of the variable to print */ |
4856 |
register int i; |
6171 |
int size) /* how large is the variable? */ |
4857 |
int haddr, addr; |
6172 |
{ |
4858 |
char hex_buffer[180]; |
6173 |
register int i; |
4859 |
char asc_buffer[180]; |
6174 |
int haddr = 0, addr = 0; |
4860 |
char HEXCHAR[] = "0123456789ABCDEF"; |
6175 |
char hex_buffer[180] = { '\0' }; |
4861 |
long *p; |
6176 |
char asc_buffer[180] = { '\0' }; |
4862 |
int l; |
6177 |
char HEXCHAR[] = "0123456789ABCDEF"; |
4863 |
|
6178 |
long *p = (long*) pc; |
4864 |
addr = 0; |
6179 |
int l; |
4865 |
haddr = 0; |
6180 |
|
4866 |
hex_buffer[0] = 0; |
|
|
4867 |
asc_buffer[0] = 0; |
4868 |
p = (long*) pc; |
4869 |
for (i=0; i < size; ) { |
6181 |
for (i=0; i < size; ) { |
4870 |
l = (long) *p; |
6182 |
l = (long) *p; |
4871 |
hex_buffer[haddr] = HEXCHAR[(l >> 28) & 0xf]; |
6183 |
hex_buffer[haddr] = HEXCHAR[(l >> 28) & 0xf]; |
Lines 4899-5184
Link Here
|
4899 |
|
6211 |
|
4900 |
#endif |
6212 |
#endif |
4901 |
|
6213 |
|
4902 |
static int __devinit skge_probe_one(struct pci_dev *pdev, |
6214 |
/******************************************************************************* |
4903 |
const struct pci_device_id *ent) |
6215 |
* |
4904 |
{ |
6216 |
* End of file |
4905 |
SK_AC *pAC; |
6217 |
* |
4906 |
DEV_NET *pNet = NULL; |
6218 |
******************************************************************************/ |
4907 |
struct net_device *dev = NULL; |
|
|
4908 |
static int boards_found = 0; |
4909 |
int error = -ENODEV; |
4910 |
|
4911 |
if (pci_enable_device(pdev)) |
4912 |
goto out; |
4913 |
|
4914 |
/* Configure DMA attributes. */ |
4915 |
if (pci_set_dma_mask(pdev, (u64) 0xffffffffffffffffULL) && |
4916 |
pci_set_dma_mask(pdev, (u64) 0xffffffff)) |
4917 |
goto out_disable_device; |
4918 |
|
4919 |
|
4920 |
if ((dev = alloc_etherdev(sizeof(DEV_NET))) == NULL) { |
4921 |
printk(KERN_ERR "Unable to allocate etherdev " |
4922 |
"structure!\n"); |
4923 |
goto out_disable_device; |
4924 |
} |
4925 |
|
4926 |
pNet = netdev_priv(dev); |
4927 |
pNet->pAC = kmalloc(sizeof(SK_AC), GFP_KERNEL); |
4928 |
if (!pNet->pAC) { |
4929 |
printk(KERN_ERR "Unable to allocate adapter " |
4930 |
"structure!\n"); |
4931 |
goto out_free_netdev; |
4932 |
} |
4933 |
|
4934 |
memset(pNet->pAC, 0, sizeof(SK_AC)); |
4935 |
pAC = pNet->pAC; |
4936 |
pAC->PciDev = pdev; |
4937 |
pAC->PciDevId = pdev->device; |
4938 |
pAC->dev[0] = dev; |
4939 |
pAC->dev[1] = dev; |
4940 |
sprintf(pAC->Name, "SysKonnect SK-98xx"); |
4941 |
pAC->CheckQueue = SK_FALSE; |
4942 |
|
4943 |
pNet->Mtu = 1500; |
4944 |
pNet->Up = 0; |
4945 |
dev->irq = pdev->irq; |
4946 |
error = SkGeInitPCI(pAC); |
4947 |
if (error) { |
4948 |
printk("SKGE: PCI setup failed: %i\n", error); |
4949 |
goto out_free_netdev; |
4950 |
} |
4951 |
|
4952 |
SET_MODULE_OWNER(dev); |
4953 |
dev->open = &SkGeOpen; |
4954 |
dev->stop = &SkGeClose; |
4955 |
dev->hard_start_xmit = &SkGeXmit; |
4956 |
dev->get_stats = &SkGeStats; |
4957 |
dev->set_multicast_list = &SkGeSetRxMode; |
4958 |
dev->set_mac_address = &SkGeSetMacAddr; |
4959 |
dev->do_ioctl = &SkGeIoctl; |
4960 |
dev->change_mtu = &SkGeChangeMtu; |
4961 |
#ifdef CONFIG_NET_POLL_CONTROLLER |
4962 |
dev->poll_controller = &SkGePollController; |
4963 |
#endif |
4964 |
dev->flags &= ~IFF_RUNNING; |
4965 |
SET_NETDEV_DEV(dev, &pdev->dev); |
4966 |
SET_ETHTOOL_OPS(dev, &SkGeEthtoolOps); |
4967 |
|
4968 |
#ifdef SK_ZEROCOPY |
4969 |
#ifdef USE_SK_TX_CHECKSUM |
4970 |
if (pAC->ChipsetType) { |
4971 |
/* Use only if yukon hardware */ |
4972 |
/* SK and ZEROCOPY - fly baby... */ |
4973 |
dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM; |
4974 |
} |
4975 |
#endif |
4976 |
#endif |
4977 |
|
4978 |
pAC->Index = boards_found++; |
4979 |
|
4980 |
if (SkGeBoardInit(dev, pAC)) |
4981 |
goto out_free_netdev; |
4982 |
|
4983 |
/* Register net device */ |
4984 |
if (register_netdev(dev)) { |
4985 |
printk(KERN_ERR "SKGE: Could not register device.\n"); |
4986 |
goto out_free_resources; |
4987 |
} |
4988 |
|
4989 |
/* Print adapter specific string from vpd */ |
4990 |
ProductStr(pAC); |
4991 |
printk("%s: %s\n", dev->name, pAC->DeviceStr); |
4992 |
|
4993 |
/* Print configuration settings */ |
4994 |
printk(" PrefPort:%c RlmtMode:%s\n", |
4995 |
'A' + pAC->Rlmt.Net[0].Port[pAC->Rlmt.Net[0].PrefPort]->PortNumber, |
4996 |
(pAC->RlmtMode==0) ? "Check Link State" : |
4997 |
((pAC->RlmtMode==1) ? "Check Link State" : |
4998 |
((pAC->RlmtMode==3) ? "Check Local Port" : |
4999 |
((pAC->RlmtMode==7) ? "Check Segmentation" : |
5000 |
((pAC->RlmtMode==17) ? "Dual Check Link State" :"Error"))))); |
5001 |
|
5002 |
SkGeYellowLED(pAC, pAC->IoBase, 1); |
5003 |
|
5004 |
|
5005 |
memcpy(&dev->dev_addr, &pAC->Addr.Net[0].CurrentMacAddress, 6); |
5006 |
|
5007 |
SkGeProcCreate(dev); |
5008 |
|
5009 |
pNet->PortNr = 0; |
5010 |
pNet->NetNr = 0; |
5011 |
|
5012 |
boards_found++; |
5013 |
|
5014 |
/* More then one port found */ |
5015 |
if ((pAC->GIni.GIMacsFound == 2 ) && (pAC->RlmtNets == 2)) { |
5016 |
if ((dev = alloc_etherdev(sizeof(DEV_NET))) == 0) { |
5017 |
printk(KERN_ERR "Unable to allocate etherdev " |
5018 |
"structure!\n"); |
5019 |
goto out; |
5020 |
} |
5021 |
|
5022 |
pAC->dev[1] = dev; |
5023 |
pNet = netdev_priv(dev); |
5024 |
pNet->PortNr = 1; |
5025 |
pNet->NetNr = 1; |
5026 |
pNet->pAC = pAC; |
5027 |
pNet->Mtu = 1500; |
5028 |
pNet->Up = 0; |
5029 |
|
5030 |
dev->open = &SkGeOpen; |
5031 |
dev->stop = &SkGeClose; |
5032 |
dev->hard_start_xmit = &SkGeXmit; |
5033 |
dev->get_stats = &SkGeStats; |
5034 |
dev->set_multicast_list = &SkGeSetRxMode; |
5035 |
dev->set_mac_address = &SkGeSetMacAddr; |
5036 |
dev->do_ioctl = &SkGeIoctl; |
5037 |
dev->change_mtu = &SkGeChangeMtu; |
5038 |
dev->flags &= ~IFF_RUNNING; |
5039 |
SET_NETDEV_DEV(dev, &pdev->dev); |
5040 |
SET_ETHTOOL_OPS(dev, &SkGeEthtoolOps); |
5041 |
|
5042 |
#ifdef SK_ZEROCOPY |
5043 |
#ifdef USE_SK_TX_CHECKSUM |
5044 |
if (pAC->ChipsetType) { |
5045 |
/* SG and ZEROCOPY - fly baby... */ |
5046 |
dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM; |
5047 |
} |
5048 |
#endif |
5049 |
#endif |
5050 |
|
5051 |
if (register_netdev(dev)) { |
5052 |
printk(KERN_ERR "SKGE: Could not register device.\n"); |
5053 |
free_netdev(dev); |
5054 |
pAC->dev[1] = pAC->dev[0]; |
5055 |
} else { |
5056 |
SkGeProcCreate(dev); |
5057 |
memcpy(&dev->dev_addr, |
5058 |
&pAC->Addr.Net[1].CurrentMacAddress, 6); |
5059 |
|
5060 |
printk("%s: %s\n", dev->name, pAC->DeviceStr); |
5061 |
printk(" PrefPort:B RlmtMode:Dual Check Link State\n"); |
5062 |
} |
5063 |
} |
5064 |
|
5065 |
/* Save the hardware revision */ |
5066 |
pAC->HWRevision = (((pAC->GIni.GIPciHwRev >> 4) & 0x0F)*10) + |
5067 |
(pAC->GIni.GIPciHwRev & 0x0F); |
5068 |
|
5069 |
/* Set driver globals */ |
5070 |
pAC->Pnmi.pDriverFileName = DRIVER_FILE_NAME; |
5071 |
pAC->Pnmi.pDriverReleaseDate = DRIVER_REL_DATE; |
5072 |
|
5073 |
memset(&pAC->PnmiBackup, 0, sizeof(SK_PNMI_STRUCT_DATA)); |
5074 |
memcpy(&pAC->PnmiBackup, &pAC->PnmiStruct, sizeof(SK_PNMI_STRUCT_DATA)); |
5075 |
|
5076 |
pci_set_drvdata(pdev, dev); |
5077 |
return 0; |
5078 |
|
5079 |
out_free_resources: |
5080 |
FreeResources(dev); |
5081 |
out_free_netdev: |
5082 |
free_netdev(dev); |
5083 |
out_disable_device: |
5084 |
pci_disable_device(pdev); |
5085 |
out: |
5086 |
return error; |
5087 |
} |
5088 |
|
5089 |
static void __devexit skge_remove_one(struct pci_dev *pdev) |
5090 |
{ |
5091 |
struct net_device *dev = pci_get_drvdata(pdev); |
5092 |
DEV_NET *pNet = netdev_priv(dev); |
5093 |
SK_AC *pAC = pNet->pAC; |
5094 |
struct net_device *otherdev = pAC->dev[1]; |
5095 |
|
5096 |
SkGeProcRemove(dev); |
5097 |
unregister_netdev(dev); |
5098 |
if (otherdev != dev) |
5099 |
SkGeProcRemove(otherdev); |
5100 |
|
5101 |
SkGeYellowLED(pAC, pAC->IoBase, 0); |
5102 |
|
5103 |
if (pAC->BoardLevel == SK_INIT_RUN) { |
5104 |
SK_EVPARA EvPara; |
5105 |
unsigned long Flags; |
5106 |
|
5107 |
/* board is still alive */ |
5108 |
spin_lock_irqsave(&pAC->SlowPathLock, Flags); |
5109 |
EvPara.Para32[0] = 0; |
5110 |
EvPara.Para32[1] = -1; |
5111 |
SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_STOP, EvPara); |
5112 |
EvPara.Para32[0] = 1; |
5113 |
EvPara.Para32[1] = -1; |
5114 |
SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_STOP, EvPara); |
5115 |
SkEventDispatcher(pAC, pAC->IoBase); |
5116 |
/* disable interrupts */ |
5117 |
SK_OUT32(pAC->IoBase, B0_IMSK, 0); |
5118 |
SkGeDeInit(pAC, pAC->IoBase); |
5119 |
spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); |
5120 |
pAC->BoardLevel = SK_INIT_DATA; |
5121 |
/* We do NOT check here, if IRQ was pending, of course*/ |
5122 |
} |
5123 |
|
5124 |
if (pAC->BoardLevel == SK_INIT_IO) { |
5125 |
/* board is still alive */ |
5126 |
SkGeDeInit(pAC, pAC->IoBase); |
5127 |
pAC->BoardLevel = SK_INIT_DATA; |
5128 |
} |
5129 |
|
5130 |
FreeResources(dev); |
5131 |
free_netdev(dev); |
5132 |
if (otherdev != dev) |
5133 |
free_netdev(otherdev); |
5134 |
kfree(pAC); |
5135 |
} |
5136 |
|
5137 |
static struct pci_device_id skge_pci_tbl[] = { |
5138 |
{ PCI_VENDOR_ID_3COM, 0x1700, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, |
5139 |
{ PCI_VENDOR_ID_3COM, 0x80eb, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, |
5140 |
{ PCI_VENDOR_ID_SYSKONNECT, 0x4300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, |
5141 |
{ PCI_VENDOR_ID_SYSKONNECT, 0x4320, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, |
5142 |
{ PCI_VENDOR_ID_DLINK, 0x4c00, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, |
5143 |
{ PCI_VENDOR_ID_MARVELL, 0x4320, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, |
5144 |
#if 0 /* don't handle Yukon2 cards at the moment -- mlindner@syskonnect.de */ |
5145 |
{ PCI_VENDOR_ID_MARVELL, 0x4360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, |
5146 |
{ PCI_VENDOR_ID_MARVELL, 0x4361, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, |
5147 |
#endif |
5148 |
{ PCI_VENDOR_ID_MARVELL, 0x5005, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, |
5149 |
{ PCI_VENDOR_ID_CNET, 0x434e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, |
5150 |
{ PCI_VENDOR_ID_LINKSYS, 0x1032, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, |
5151 |
{ PCI_VENDOR_ID_LINKSYS, 0x1064, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, |
5152 |
{ 0, } |
5153 |
}; |
5154 |
|
5155 |
static struct pci_driver skge_driver = { |
5156 |
.name = "skge", |
5157 |
.id_table = skge_pci_tbl, |
5158 |
.probe = skge_probe_one, |
5159 |
.remove = __devexit_p(skge_remove_one), |
5160 |
}; |
5161 |
|
5162 |
static int __init skge_init(void) |
5163 |
{ |
5164 |
int error; |
5165 |
|
5166 |
pSkRootDir = proc_mkdir(SKRootName, proc_net); |
5167 |
if (pSkRootDir) |
5168 |
pSkRootDir->owner = THIS_MODULE; |
5169 |
|
5170 |
error = pci_register_driver(&skge_driver); |
5171 |
if (error) |
5172 |
proc_net_remove(SKRootName); |
5173 |
return error; |
5174 |
} |
5175 |
|
5176 |
static void __exit skge_exit(void) |
5177 |
{ |
5178 |
pci_unregister_driver(&skge_driver); |
5179 |
proc_net_remove(SKRootName); |
5180 |
|
5181 |
} |
5182 |
|
6219 |
|
5183 |
module_init(skge_init); |
|
|
5184 |
module_exit(skge_exit); |