This source file includes following definitions.
- arcnet_dump_skb
1
2
3
4
5
6
7
8
9
10
11 #ifndef _LINUX_ARCDEVICE_H
12 #define _LINUX_ARCDEVICE_H
13
14 #include <asm/timex.h>
15 #include <linux/if_arcnet.h>
16
17 #ifdef __KERNEL__
18 #include <linux/interrupt.h>
19
20
21
22
23
24
25
26
27
28
29
30 #define RECON_THRESHOLD 30
31
32
33
34
35
36
37
38
39 #define TX_TIMEOUT (HZ * 200 / 1000)
40
41
42 #undef ALPHA_WARNING
43
44
45
46
47
48
49
50
51
52 #define D_NORMAL 1
53 #define D_EXTRA 2
54 #define D_INIT 4
55 #define D_INIT_REASONS 8
56 #define D_RECON 32
57 #define D_PROTO 64
58
59 #define D_DURING 128
60 #define D_TX 256
61 #define D_RX 512
62 #define D_SKB 1024
63 #define D_SKB_SIZE 2048
64 #define D_TIMING 4096
65 #define D_DEBUG 8192
66
67 #ifndef ARCNET_DEBUG_MAX
68 #define ARCNET_DEBUG_MAX (127)
69 #endif
70
71 #ifndef ARCNET_DEBUG
72 #define ARCNET_DEBUG (D_NORMAL | D_EXTRA)
73 #endif
74 extern int arcnet_debug;
75
76 #define BUGLVL(x) ((x) & ARCNET_DEBUG_MAX & arcnet_debug)
77
78
79 #define arc_printk(x, dev, fmt, ...) \
80 do { \
81 if (BUGLVL(x)) { \
82 if ((x) == D_NORMAL) \
83 netdev_warn(dev, fmt, ##__VA_ARGS__); \
84 else if ((x) < D_DURING) \
85 netdev_info(dev, fmt, ##__VA_ARGS__); \
86 else \
87 netdev_dbg(dev, fmt, ##__VA_ARGS__); \
88 } \
89 } while (0)
90
91 #define arc_cont(x, fmt, ...) \
92 do { \
93 if (BUGLVL(x)) \
94 pr_cont(fmt, ##__VA_ARGS__); \
95 } while (0)
96
97
98 #define TIME(dev, name, bytes, call) \
99 do { \
100 if (BUGLVL(D_TIMING)) { \
101 unsigned long _x, _y; \
102 _x = get_cycles(); \
103 call; \
104 _y = get_cycles(); \
105 arc_printk(D_TIMING, dev, \
106 "%s: %d bytes in %lu cycles == %lu Kbytes/100Mcycle\n", \
107 name, bytes, _y - _x, \
108 100000000 / 1024 * bytes / (_y - _x + 1)); \
109 } else { \
110 call; \
111 } \
112 } while (0)
113
114
115
116
117
118
119 #define RESETtime (300)
120
121
122
123
124
125
126
127
128
129
130 #define MTU 253
131 #define MinTU 257
132 #define XMTU 508
133
134
135 #define TXFREEflag 0x01
136 #define TXACKflag 0x02
137 #define RECONflag 0x04
138 #define TESTflag 0x08
139 #define EXCNAKflag 0x08
140 #define RESETflag 0x10
141 #define RES1flag 0x20
142 #define RES2flag 0x40
143 #define NORXflag 0x80
144
145
146 #define AUTOINCflag 0x40
147 #define IOMAPflag 0x02
148 #define ENABLE16flag 0x80
149
150
151
152
153
154
155 #define NOTXcmd 0x01
156 #define NORXcmd 0x02
157 #define TXcmd 0x03
158 #define RXcmd 0x04
159 #define CONFIGcmd 0x05
160 #define CFLAGScmd 0x06
161 #define TESTcmd 0x07
162 #define STARTIOcmd 0x18
163
164
165 #define RESETclear 0x08
166 #define CONFIGclear 0x10
167
168 #define EXCNAKclear 0x0E
169
170
171 #define TESTload 0x08
172
173
174 #define TESTvalue 0321
175
176
177 #define RXbcasts 0x80
178
179
180 #define NORMALconf 0x00
181 #define EXTconf 0x08
182
183
184
185
186 #define ARC_IS_5MBIT 1
187 #define ARC_CAN_10MBIT 2
188
189
190
191 struct ArcProto {
192 char suffix;
193 int mtu;
194 int is_ip;
195
196 void (*rx)(struct net_device *dev, int bufnum,
197 struct archdr *pkthdr, int length);
198 int (*build_header)(struct sk_buff *skb, struct net_device *dev,
199 unsigned short ethproto, uint8_t daddr);
200
201
202 int (*prepare_tx)(struct net_device *dev, struct archdr *pkt,
203 int length, int bufnum);
204 int (*continue_tx)(struct net_device *dev, int bufnum);
205 int (*ack_tx)(struct net_device *dev, int acked);
206 };
207
208 extern struct ArcProto *arc_proto_map[256], *arc_proto_default,
209 *arc_bcast_proto, *arc_raw_proto;
210
211
212
213
214
215 struct Incoming {
216 struct sk_buff *skb;
217 __be16 sequence;
218 uint8_t lastpacket,
219 numpackets;
220 };
221
222
223 struct Outgoing {
224 struct ArcProto *proto;
225
226
227 struct sk_buff *skb;
228 struct archdr *pkt;
229 uint16_t length,
230 dataleft,
231 segnum,
232 numsegs;
233 };
234
235 #define ARCNET_LED_NAME_SZ (IFNAMSIZ + 6)
236
237 struct arcnet_local {
238 uint8_t config,
239 timeout,
240 backplane,
241 clockp,
242 clockm,
243 setup,
244 setup2,
245 intmask;
246 uint8_t default_proto[256];
247 int cur_tx,
248 next_tx,
249 cur_rx;
250 int lastload_dest,
251 lasttrans_dest;
252 int timed_out;
253 unsigned long last_timeout;
254 char *card_name;
255 int card_flags;
256
257
258 spinlock_t lock;
259
260 struct led_trigger *tx_led_trig;
261 char tx_led_trig_name[ARCNET_LED_NAME_SZ];
262 struct led_trigger *recon_led_trig;
263 char recon_led_trig_name[ARCNET_LED_NAME_SZ];
264
265 struct timer_list timer;
266
267 struct net_device *dev;
268 int reply_status;
269 struct tasklet_struct reply_tasklet;
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289 atomic_t buf_lock;
290 int buf_queue[5];
291 int next_buf, first_free_buf;
292
293
294 unsigned long first_recon;
295 unsigned long last_recon;
296 int num_recons;
297 int network_down;
298
299 int excnak_pending;
300
301 struct {
302 uint16_t sequence;
303 __be16 aborted_seq;
304
305 struct Incoming incoming[256];
306 } rfc1201;
307
308
309 struct Outgoing outgoing;
310
311
312 struct {
313 struct module *owner;
314 void (*command)(struct net_device *dev, int cmd);
315 int (*status)(struct net_device *dev);
316 void (*intmask)(struct net_device *dev, int mask);
317 int (*reset)(struct net_device *dev, int really_reset);
318 void (*open)(struct net_device *dev);
319 void (*close)(struct net_device *dev);
320 void (*datatrigger) (struct net_device * dev, int enable);
321 void (*recontrigger) (struct net_device * dev, int enable);
322
323 void (*copy_to_card)(struct net_device *dev, int bufnum,
324 int offset, void *buf, int count);
325 void (*copy_from_card)(struct net_device *dev, int bufnum,
326 int offset, void *buf, int count);
327 } hw;
328
329 void __iomem *mem_start;
330 };
331
332 enum arcnet_led_event {
333 ARCNET_LED_EVENT_RECON,
334 ARCNET_LED_EVENT_OPEN,
335 ARCNET_LED_EVENT_STOP,
336 ARCNET_LED_EVENT_TX,
337 };
338
339 void arcnet_led_event(struct net_device *netdev, enum arcnet_led_event event);
340 void devm_arcnet_led_init(struct net_device *netdev, int index, int subid);
341
342 #if ARCNET_DEBUG_MAX & D_SKB
343 void arcnet_dump_skb(struct net_device *dev, struct sk_buff *skb, char *desc);
344 #else
345 static inline
346 void arcnet_dump_skb(struct net_device *dev, struct sk_buff *skb, char *desc)
347 {
348 }
349 #endif
350
351 void arcnet_unregister_proto(struct ArcProto *proto);
352 irqreturn_t arcnet_interrupt(int irq, void *dev_id);
353 struct net_device *alloc_arcdev(const char *name);
354
355 int arcnet_open(struct net_device *dev);
356 int arcnet_close(struct net_device *dev);
357 netdev_tx_t arcnet_send_packet(struct sk_buff *skb,
358 struct net_device *dev);
359 void arcnet_timeout(struct net_device *dev);
360
361
362
363 #ifdef CONFIG_SA1100_CT6001
364 #define BUS_ALIGN 2
365 #else
366 #define BUS_ALIGN 1
367 #endif
368
369
370
371
372 #define arcnet_inb(addr, offset) \
373 inb((addr) + BUS_ALIGN * (offset))
374 #define arcnet_outb(value, addr, offset) \
375 outb(value, (addr) + BUS_ALIGN * (offset))
376
377 #define arcnet_insb(addr, offset, buffer, count) \
378 insb((addr) + BUS_ALIGN * (offset), buffer, count)
379 #define arcnet_outsb(addr, offset, buffer, count) \
380 outsb((addr) + BUS_ALIGN * (offset), buffer, count)
381
382 #define arcnet_readb(addr, offset) \
383 readb((addr) + (offset))
384 #define arcnet_writeb(value, addr, offset) \
385 writeb(value, (addr) + (offset))
386
387 #endif
388 #endif