]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - sitara-epos/sitara-epos-kernel.git/blob - include/linux/net_switch_config.h
ti-sdk-am335x-evm-05.05.00.00 on 04.06.00.07
[sitara-epos/sitara-epos-kernel.git] / include / linux / net_switch_config.h
1 /*
2  * Texas Instruments Ethernet Switch Driver
3  *
4  * Copyright (C) 2012 Texas Instruments
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation version 2.
9  *
10  * This program is distributed "as is" WITHOUT ANY WARRANTY of any
11  * kind, whether express or implied; without even the implied warranty
12  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  */
16 /*
17  * Userspace API for Switch Configuration
18  */
20 #ifndef __NET_CONFIG_SWITCH_H__
21 #define __NET_CONFIG_SWITCH_H__
23 enum {
24         CONFIG_SWITCH_INVALID,
25         CONFIG_SWITCH_ADD_MULTICAST,
26         CONFIG_SWITCH_ADD_UNICAST,
27         CONFIG_SWITCH_ADD_OUI,
28         CONFIG_SWITCH_FIND_ADDR,
29         CONFIG_SWITCH_DEL_MULTICAST,
30         CONFIG_SWITCH_DEL_UNICAST,
31         CONFIG_SWITCH_ADD_VLAN,
32         CONFIG_SWITCH_FIND_VLAN,
33         CONFIG_SWITCH_DEL_VLAN,
34         CONFIG_SWITCH_SET_PORT_VLAN_CONFIG,
35         CONFIG_SWITCH_TIMEOUT,
36         CONFIG_SWITCH_DUMP,
37         CONFIG_SWITCH_SET_FLOW_CONTROL,
38         CONFIG_SWITCH_SET_PRIORITY_MAPPING,
39         CONFIG_SWITCH_PORT_STATISTICS_ENABLE,
40         CONFIG_SWITCH_CONFIG_DUMP,
41         CONFIG_SWITCH_RATELIMIT,
42         CONFIG_SWITCH_VID_INGRESS_CHECK,
43         CONFIG_SWITCH_ADD_UNKNOWN_VLAN_INFO,
44         CONFIG_SWITCH_802_1,
45         CONFIG_SWITCH_MACAUTH,
46         CONFIG_SWITCH_SET_PORT_CONFIG,
47         CONFIG_SWITCH_GET_PORT_CONFIG,
48         CONFIG_SWITCH_PORT_STATE,
49         CONFIG_SWITCH_RESET,
50 };
52 enum {
53         ADDR_TYPE_BROADCAST = 1,
54         ADDR_TYPE_MULTICAST,
55         ADDR_TYPE_UNICAST,
56 };
58 enum {
59         PORT_STATE_DISABLED = 0,
60         PORT_STATE_BLOCKED,
61         PORT_STATE_LEARN,
62         PORT_STATE_FORWARD,
63 };
65 struct net_switch_cmd {
66         unsigned int    port;
67         unsigned int    vid;            /* VLAN identifier */
68         unsigned int    prio_port;      /* port priority 0 -7 */
69         unsigned int    CFI_port;       /* port CFI  0 /1 */
70         unsigned int    mem_port;       /* port number 0 - 2 */
71         unsigned char   unreg_multi;    /* unreg multicast Egress Ports */
72         unsigned char   reg_multi;      /* register multicast Egress ports */
73         unsigned char   untag_port;     /* Untag ports */
74         unsigned char   addr[6];
75         unsigned int    flag;
76         unsigned int    blocked;
77         unsigned int    secure;
78         unsigned int    ageable;
79         unsigned int    ale_timeout;
80         unsigned char   aledump;        /* if 1 print ale table */
81 };
83 struct net_switch_port_cmd {
84         unsigned int    port;           /* Port number */
85         unsigned int    direction;      /* Tx -1 / Rx - 0 */
86         unsigned int    addr_type;      /* Address type BroadMulti/Uni cast */
87         unsigned int    limit;          /* multicast/broadcast limit */
88         unsigned int    vlan_ingress_check;
89         unsigned int    port_state;
90         unsigned int    vlan_port_mask;
91         unsigned char   drop_untagged;
92         unsigned char   enable;         /* 1-enable/0-Disable */
93         unsigned int    reg_multi_port_mask;
94         unsigned int    unknown_reg_multi_port_mask;
95         unsigned char   unknown_vlan_member;
96 };
98 struct net_switch_prio_cmd {
99         unsigned char port;
100         unsigned char prio_rx;
101         unsigned char prio_tx;
102         unsigned char prio_switch;
103         unsigned char hostRxCh;         /* packet with switch priority receive
104                                                 on this channel */
105         unsigned char hostRxChSuper;    /* supervisory packet receive on
106                                                 this channel */
107 };
109 struct net_switch_config {
110         unsigned int cmd;       /* API to be invoked by the kernel driver */
111         union {
112                 struct net_switch_cmd switchcmd;
113                 struct net_switch_port_cmd portcmd;
114                 struct net_switch_prio_cmd priocmd;
115                 char buf[4096];         /* Buffer for Ale Dump */
116         } cmd_data;
117         unsigned int ret_type;   /* Return  Success/Failure */
118 };
120 #endif /* __NET_CONFIG_SWITCH_H__*/