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