1 enum 2 { 3 MaxEther = 4, 4 Ntypes = 8, 5 }; 6 7 typedef struct Ether Ether; 8 struct Ether { 9 RWlock; 10 ISAConf; /* hardware info */ 11 12 int ctlrno; 13 ulong tbdf; 14 int minmtu; 15 int maxmtu; 16 17 Netif; 18 19 void (*attach)(Ether*); /* filled in by reset routine */ 20 void (*detach)(Ether*); 21 void (*transmit)(Ether*); 22 void (*interrupt)(Ureg*, void*); 23 long (*ifstat)(Ether*, void*, long, ulong); 24 long (*ctl)(Ether*, void*, long); /* custom ctl messages */ 25 void (*power)(Ether*, int); /* power on/off */ 26 void (*shutdown)(Ether*); /* shutdown hardware before reboot */ 27 28 void* ctlr; 29 uchar ea[Eaddrlen]; 30 void* address; 31 int irq; 32 33 Queue* oq; 34 }; 35 36 extern Block* etheriq(Ether*, Block*, int); 37 extern void addethercard(char*, int(*)(Ether*)); 38 extern ulong ethercrc(uchar*, int); 39 extern int parseether(uchar*, char*); 40 41 #define NEXT(x, l) (((x)+1)%(l)) 42 #define PREV(x, l) (((x) == 0) ? (l)-1: (x)-1) 43