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