1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
/*
* $FreeBSD$
*/
#ifndef __SYS_DEV_ETHERSWITCH_ETHERSWITCH_H
#define __SYS_DEV_ETHERSWITCH_ETHERSWITCH_H
#include <sys/ioccom.h>
#ifdef _KERNEL
extern devclass_t etherswitch_devclass;
extern driver_t etherswitch_driver;
#endif /* _KERNEL */
struct etherswitch_reg {
uint16_t reg;
uint16_t val;
};
typedef struct etherswitch_reg etherswitch_reg_t;
struct etherswitch_phyreg {
uint16_t phy;
uint16_t reg;
uint16_t val;
};
typedef struct etherswitch_phyreg etherswitch_phyreg_t;
#define ETHERSWITCH_NAMEMAX 64
struct etherswitch_info {
int es_nports;
int es_nvlangroups;
char es_name[ETHERSWITCH_NAMEMAX];
};
typedef struct etherswitch_info etherswitch_info_t;
struct etherswitch_port {
int es_port;
int es_vlangroup;
union {
struct ifreq es_uifr;
struct ifmediareq es_uifmr;
} es_ifu;
#define es_ifr es_ifu.es_uifr
#define es_ifmr es_ifu.es_uifmr
};
typedef struct etherswitch_port etherswitch_port_t;
struct etherswitch_vlangroup {
int es_vlangroup;
int es_vid;
int es_member_ports;
int es_untagged_ports;
int es_fid;
};
typedef struct etherswitch_vlangroup etherswitch_vlangroup_t;
#define ETHERSWITCH_PORTMASK(_port) (1 << (_port))
#define IOETHERSWITCHGETINFO _IOR('i', 1, etherswitch_info_t)
#define IOETHERSWITCHGETREG _IOWR('i', 2, etherswitch_reg_t)
#define IOETHERSWITCHSETREG _IOW('i', 3, etherswitch_reg_t)
#define IOETHERSWITCHGETPORT _IOWR('i', 4, etherswitch_port_t)
#define IOETHERSWITCHSETPORT _IOW('i', 5, etherswitch_port_t)
#define IOETHERSWITCHGETVLANGROUP _IOWR('i', 6, etherswitch_vlangroup_t)
#define IOETHERSWITCHSETVLANGROUP _IOW('i', 7, etherswitch_vlangroup_t)
#define IOETHERSWITCHGETPHYREG _IOWR('i', 8, etherswitch_phyreg_t)
#define IOETHERSWITCHSETPHYREG _IOW('i', 9, etherswitch_phyreg_t)
#endif
|