]> git.lizzy.rs Git - plan9front.git/blob - sys/src/9/sgi/etherif.h
ether8169: deal with kernel memory exhaution
[plan9front.git] / sys / src / 9 / sgi / etherif.h
1 enum {
2         MaxEther        = 1,
3         Ntypes          = 8,
4 };
5
6 typedef struct Ether Ether;
7 struct Ether {
8
9         int     ctlrno;
10         int     minmtu;
11         int     maxmtu;
12         uchar   ea[Eaddrlen];
13         
14         int     irq, irqlevel;
15         uintptr port;
16
17         void    (*attach)(Ether*);      /* filled in by reset routine */
18         void    (*detach)(Ether*);
19         void    (*transmit)(Ether*);
20         void    (*interrupt)(Ureg*, void*);
21         long    (*ifstat)(Ether*, void*, long, ulong);
22         long    (*ctl)(Ether*, void*, long); /* custom ctl messages */
23         void    (*power)(Ether*, int);  /* power on/off */
24         void    (*shutdown)(Ether*);    /* shutdown hardware before reboot */
25         void    *ctlr;
26
27         Queue*  oq;
28
29         Netif;
30 };
31
32 extern Block* etheriq(Ether*, Block*, int);
33 extern void addethercard(char*, int(*)(Ether*));
34 extern ulong ethercrc(uchar*, int);
35 extern int parseether(uchar*, char*);
36
37 #define NEXT(x, l)      (((x)+1)%(l))
38 #define PREV(x, l)      (((x) == 0) ? (l)-1: (x)-1)
39 #define HOWMANY(x, y)   (((x)+((y)-1))/(y))
40 #define ROUNDUP(x, y)   (HOWMANY((x), (y))*(y))