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