1 /* dev.h */
2 /*
3 Copyright (C) 1992 Ross Biro
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
8 any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19 The Author may be reached as bir7@leland.stanford.edu or
20 C/O Department of Mathematics; Stanford University; Stanford, CA 94305
21 */
22 /* $Id: dev.h,v 0.8.4.7 1993/01/23 18:00:11 bir7 Exp $ */
23 /* $Log: dev.h,v $
24 * Revision 0.8.4.7 1993/01/23 18:00:11 bir7
25 * Fixed problems from merging.
26 *
27 * Revision 0.8.4.6 1993/01/22 22:58:08 bir7
28 * Changed so transmitting takes place in bottom half of interrupt routine.
29 *
30 * Revision 0.8.4.5 1992/12/08 20:49:15 bir7
31 * Edited ctrl-h's out of log messages.
32 *
33 * Revision 0.8.4.4 1992/12/06 23:29:59 bir7
34 * Converted to using lower half interrupt routine.
35 *
36 * Revision 0.8.4.3 1992/12/05 21:35:53 bir7
37 * Updated dev->init type.
38 *
39 * Revision 0.8.4.2 1992/12/03 19:54:12 bir7
40 * Added paranoid queue checking.
41 *
42 * Revision 0.8.4.1 1992/11/10 00:17:18 bir7
43 * version change only.
44 *
45 * Revision 0.8.3.2 1992/11/10 00:14:47 bir7
46 * Changed malloc to kmalloc and added Id and Log
47 *
48 */
49
50 #ifndef _TCP_DEV_H
51 #define _TCP_DEV_H
52 /* for future expansion when we will have different priorities. */
53 #define DEV_NUMBUFFS 3
54 #define MAX_ADDR_LEN 6
55 #define MAX_HEADER 14
56 #define MAX_ROUTE 16
57
58 struct device
59 {
60 char *name;
61 unsigned long rmem_end;
62 unsigned long rmem_start;
63 unsigned long mem_end;
64 unsigned long mem_start;
65 unsigned short base_addr;
66 unsigned char irq;
67 volatile unsigned char start:1,
68 tbusy:1,
69 loopback:1,
70 interrupt:1,
71 up:1;
72 struct device *next;
73 int (*init)(struct device *dev);
74 unsigned long trans_start;
75 volatile struct sk_buff * volatile buffs[DEV_NUMBUFFS];
76 struct sk_buff *backlog; /* no longer used. */
77 int (*open)(struct device *dev);
78 int (*stop)(struct device *dev);
79 int (*hard_start_xmit) (struct sk_buff *skb, struct device *dev);
80 int (*hard_header) (unsigned char *buff, struct device *dev,
81 unsigned short type, unsigned long daddr,
82 unsigned long saddr, unsigned len);
83 void (*add_arp) (unsigned long addr, struct sk_buff *skb,
84 struct device *dev);
85 void (*queue_xmit)(struct sk_buff *skb, struct device *dev, int pri);
86 int (*rebuild_header)(void *eth, struct device *dev);
87 unsigned short (*type_trans) (struct sk_buff *skb, struct device *dev);
88 void (*send_packet)(struct sk_buff *skb, struct device *dev); /* no longer
89 used */
90 void *private;
91
92 unsigned short type;
93 unsigned short hard_header_len;
94 unsigned short mtu;
95 unsigned char broadcast[MAX_ADDR_LEN];
96 unsigned char dev_addr[MAX_ADDR_LEN];
97 unsigned char addr_len;
98 };
99
100 extern struct device *dev_base;
101
102 struct packet_type
103 {
104 unsigned short type; /* This is really NET16(ether_type) other devices
105 will have to translate appropriately. */
106 unsigned short copy:1;
107 int (*func) (struct sk_buff *, struct device *, struct packet_type *);
108 void *data;
109 struct packet_type *next;
110 };
111
112 /* used by dev_rint */
113 #define IN_SKBUFF 1
114 #define DEV_QUEUE_MAGIC 0x17432895
115
116
117 extern struct packet_type *ptype_base;
118 void dev_queue_xmit (struct sk_buff *skb, struct device *dev, int pri);
119 int dev_rint (unsigned char *buff, long len, int flags, struct device *dev);
120 void dev_tint ( struct device *dev);
121 void dev_add_pack (struct packet_type *pt);
122 void dev_remove_pack (struct packet_type *pt);
123 struct device *get_dev (char *name);
124 void inet_bh (void *tmp);
125
126
127 #endif