/*------------------------------------------------------------------------------------------*\ * cpmac port management * * * * The idea is to provide a generalized interface to the cpmac driver. Each device can * * return information about the existing hardware and can be used to configure any * * existing switches for VLAN use. * * * * To request information about the hardware, send an ioctl AVM_CPMAC_IOCTL_INFO to a * * cpmac device and provide a pointer to a memory region for the port information. The * * answer consists of the number of available devices (eth0...), called internal_ports, * * and the number of external ports of the queried device. * * * * Configuring the switch hardware is done via sending an AVM_CPMAC_IOCTL_CONFIG to the * * corresponding device. The parts of the configuration structure are: * * * * groups - Number of VLAN groups, that should be configured. 0 means none. * * vlan - Structure to configure the given VLAN groups. The entries consist of * * id - VLAN ID, for which information is given * * source_mask - mask for ports that should tag packets with the given ID * * target_mask - mask for ports that should receive packets tagged with the * * given ID * * * * Comments: - Avoid assigning more than one source tag per port. Only the last one counts! * * - Packets leaving the internal port keep their tag * * any external port get their tag removed * \*------------------------------------------------------------------------------------------*/ #define AVM_CPMAC_MAX_PORTS 16 #define AVM_CPMAC_IOCTL_INFO (SIOCDEVPRIVATE + 0) #define AVM_CPMAC_IOCTL_CONFIG (SIOCDEVPRIVATE + 1) struct avm_switch_info { unsigned int internal_ports; /* Number of overall internal ports */ unsigned int external_ports; /* Number of external ports for the queried device */ }; struct avm_switch_struct { unsigned int groups; /* Total number of VLAN groups */ struct { unsigned int id; /* ID of the VLAN group (preferrably 2-15) */ unsigned int source_mask; /* Mask for the ports that should tag packets */ unsigned int target_mask; /* Mask for the ports that should receive tagged packets */ } vlan[AVM_CPMAC_MAX_PORTS]; };