1/*
2 * Copyright (c) 2014, The Linux Foundation. All rights reserved.
3 * Permission to use, copy, modify, and/or distribute this software for
4 * any purpose with or without fee is hereby granted, provided that the
5 * above copyright notice and this permission notice appear in all copies.
6 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
7 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
8 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
9 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
10 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
11 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
12 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
13 */
14
15
16
17/**
18 * @defgroup fal_port_vlan FAL_PORT_VLAN
19 * @{
20 */
21#ifndef _FAL_PORT_VLAN_H_
22#define _FAL_PORT_VLAN_H_
23
24#ifdef __cplusplus
25extern "C" {
26#endif                          /* __cplusplus */
27
28#include "common/sw.h"
29#include "fal/fal_type.h"
30
31    /**
32    @brief This enum defines 802.1q mode type.
33    */
34    typedef enum {
35        FAL_1Q_DISABLE = 0, /**<  802.1q mode disbale, port based vlan */
36        FAL_1Q_SECURE,      /**<   secure mode, packets which vid isn't in vlan table or source port isn't in vlan port member will be discarded.*/
37        FAL_1Q_CHECK,       /**<   check mode, packets which vid isn't in vlan table will be discarded, packets which source port isn't in vlan port member will forward base on vlan port member*/
38        FAL_1Q_FALLBACK,    /**<   fallback mode, packets which vid isn't in vlan table will forwarded base on port vlan, packet's which source port isn't in vlan port member will forward base on vlan port member.*/
39        FAL_1Q_MODE_BUTT
40    }
41    fal_pt_1qmode_t;
42
43    /**
44    @brief This enum defines receive packets tagged mode.
45    */
46    typedef enum
47    {
48        FAL_INVLAN_ADMIT_ALL = 0,  /**<  receive all packets include tagged and untagged */
49        FAL_INVLAN_ADMIT_TAGGED,   /**<  only receive tagged packets*/
50        FAL_INVLAN_ADMIT_UNTAGGED, /**<  only receive untagged packets include priority tagged */
51        FAL_INVLAN_MODE_BUTT
52    } fal_pt_invlan_mode_t;
53
54    /**
55    @brief This enum defines vlan propagation mode.
56    */
57    typedef enum
58    {
59        FAL_VLAN_PROPAGATION_DISABLE = 0, /**<  vlan propagation disable */
60        FAL_VLAN_PROPAGATION_CLONE,       /**<  vlan paopagation mode is clone */
61        FAL_VLAN_PROPAGATION_REPLACE,     /**<  vlan paopagation mode is repalce */
62        FAL_VLAN_PROPAGATION_MODE_BUTT
63    } fal_vlan_propagation_mode_t;
64
65    /**
66      @details  Fields description:
67
68     o_vid - original vlan id
69     s_vid - service vid id
70     c_vid - custom vid id
71     bi_dir - entry search direction
72     forward_dir - entry search direction only be forward
73     reverse_dir - entry search direction only be reverse
74     o_vid_is_cvid - o_vid in entry means c_vid not s_vid
75     s_vid_enable  - s_vid in entry is valid
76     c_vid_enable  - c_vid in entry is valid
77     one_2_one_vlan- the entry used for 1:1 vlan
78    @brief This structure defines the vlan translation entry.
79
80    */
81    typedef struct
82    {
83        a_uint32_t o_vid;
84        a_uint32_t s_vid;
85        a_uint32_t c_vid;
86        a_bool_t   bi_dir;       /**< lookup can be forward and reverse*/
87        a_bool_t   forward_dir;  /**< lookup direction only can be from o_vid to s_vid and/or c_vid*/
88        a_bool_t   reverse_dir;  /**< lookup direction only can be from s_vid and/or c_vid to o_vid*/
89        a_bool_t   o_vid_is_cvid;
90        a_bool_t   s_vid_enable;
91        a_bool_t   c_vid_enable;
92        a_bool_t   one_2_one_vlan;
93    } fal_vlan_trans_entry_t;
94
95    /**
96    @brief This enum defines qinq working mode.
97    */
98    typedef enum
99    {
100        FAL_QINQ_CTAG_MODE = 0,
101        FAL_QINQ_STAG_MODE,
102        FAL_QINQ_MODE_BUTT
103    } fal_qinq_mode_t;
104
105    /**
106    @brief This enum defines port role in qinq mode.
107    */
108    typedef enum
109    {
110        FAL_QINQ_EDGE_PORT = 0,
111        FAL_QINQ_CORE_PORT,
112        FAL_QINQ_PORT_ROLE_BUTT
113    } fal_qinq_port_role_t;
114
115
116    sw_error_t
117    fal_port_1qmode_set(a_uint32_t dev_id, fal_port_t port_id,
118                        fal_pt_1qmode_t port_1qmode);
119
120
121
122    sw_error_t
123    fal_port_1qmode_get(a_uint32_t dev_id, fal_port_t port_id,
124                        fal_pt_1qmode_t * pport_1qmode);
125
126
127
128    sw_error_t
129    fal_port_egvlanmode_set(a_uint32_t dev_id, fal_port_t port_id,
130                            fal_pt_1q_egmode_t port_egvlanmode);
131
132
133
134    sw_error_t
135    fal_port_egvlanmode_get(a_uint32_t dev_id, fal_port_t port_id,
136                            fal_pt_1q_egmode_t * pport_egvlanmode);
137
138
139
140    sw_error_t
141    fal_portvlan_member_add(a_uint32_t dev_id, fal_port_t port_id,
142                            fal_port_t mem_port_id);
143
144
145
146    sw_error_t
147    fal_portvlan_member_del(a_uint32_t dev_id, fal_port_t port_id,
148                            fal_port_t mem_port_id);
149
150
151
152    sw_error_t
153    fal_portvlan_member_update(a_uint32_t dev_id, fal_port_t port_id,
154                               fal_pbmp_t mem_port_map);
155
156
157
158    sw_error_t
159    fal_portvlan_member_get(a_uint32_t dev_id, fal_port_t port_id,
160                            fal_pbmp_t * mem_port_map);
161
162
163
164    sw_error_t
165    fal_port_default_vid_set(a_uint32_t dev_id, fal_port_t port_id,
166                             a_uint32_t vid);
167
168
169
170    sw_error_t
171    fal_port_default_vid_get(a_uint32_t dev_id, fal_port_t port_id,
172                             a_uint32_t * vid);
173
174
175
176    sw_error_t
177    fal_port_force_default_vid_set(a_uint32_t dev_id, fal_port_t port_id,
178                                   a_bool_t enable);
179
180
181
182    sw_error_t
183    fal_port_force_default_vid_get(a_uint32_t dev_id, fal_port_t port_id,
184                                   a_bool_t * enable);
185
186
187
188    sw_error_t
189    fal_port_force_portvlan_set(a_uint32_t dev_id, fal_port_t port_id,
190                                a_bool_t enable);
191
192
193
194    sw_error_t
195    fal_port_force_portvlan_get(a_uint32_t dev_id, fal_port_t port_id,
196                                a_bool_t * enable);
197
198
199
200    sw_error_t
201    fal_port_nestvlan_set(a_uint32_t dev_id, fal_port_t port_id,
202                          a_bool_t enable);
203
204
205
206    sw_error_t
207    fal_port_nestvlan_get(a_uint32_t dev_id, fal_port_t port_id,
208                          a_bool_t * enable);
209
210
211
212    sw_error_t
213    fal_nestvlan_tpid_set(a_uint32_t dev_id, a_uint32_t tpid);
214
215
216
217    sw_error_t
218    fal_nestvlan_tpid_get(a_uint32_t dev_id, a_uint32_t * tpid);
219
220
221    sw_error_t
222    fal_port_invlan_mode_set(a_uint32_t dev_id, fal_port_t port_id,
223                             fal_pt_invlan_mode_t mode);
224
225
226    sw_error_t
227    fal_port_invlan_mode_get(a_uint32_t dev_id, fal_port_t port_id,
228                             fal_pt_invlan_mode_t * mode);
229
230
231    sw_error_t
232    fal_port_tls_set(a_uint32_t dev_id, fal_port_t port_id,
233                     a_bool_t enable);
234
235
236    sw_error_t
237    fal_port_tls_get(a_uint32_t dev_id, fal_port_t port_id,
238                     a_bool_t * enable);
239
240
241    sw_error_t
242    fal_port_pri_propagation_set(a_uint32_t dev_id, fal_port_t port_id,
243                                 a_bool_t enable);
244
245
246    sw_error_t
247    fal_port_pri_propagation_get(a_uint32_t dev_id, fal_port_t port_id,
248                                 a_bool_t * enable);
249
250
251    sw_error_t
252    fal_port_default_svid_set(a_uint32_t dev_id, fal_port_t port_id,
253                              a_uint32_t vid);
254
255
256    sw_error_t
257    fal_port_default_svid_get(a_uint32_t dev_id, fal_port_t port_id,
258                              a_uint32_t * vid);
259
260
261    sw_error_t
262    fal_port_default_cvid_set(a_uint32_t dev_id, fal_port_t port_id,
263                              a_uint32_t vid);
264
265
266    sw_error_t
267    fal_port_default_cvid_get(a_uint32_t dev_id, fal_port_t port_id,
268                              a_uint32_t * vid);
269
270
271    sw_error_t
272    fal_port_vlan_propagation_set(a_uint32_t dev_id, fal_port_t port_id,
273                                  fal_vlan_propagation_mode_t mode);
274
275
276    sw_error_t
277    fal_port_vlan_propagation_get(a_uint32_t dev_id, fal_port_t port_id,
278                                  fal_vlan_propagation_mode_t * mode);
279
280
281    sw_error_t
282    fal_port_vlan_trans_add(a_uint32_t dev_id, fal_port_t port_id, fal_vlan_trans_entry_t *entry);
283
284
285    sw_error_t
286    fal_port_vlan_trans_del(a_uint32_t dev_id, fal_port_t port_id, fal_vlan_trans_entry_t *entry);
287
288
289    sw_error_t
290    fal_port_vlan_trans_get(a_uint32_t dev_id, fal_port_t port_id, fal_vlan_trans_entry_t *entry);
291
292
293    sw_error_t
294    fal_qinq_mode_set(a_uint32_t dev_id, fal_qinq_mode_t mode);
295
296
297    sw_error_t
298    fal_qinq_mode_get(a_uint32_t dev_id, fal_qinq_mode_t * mode);
299
300
301    sw_error_t
302    fal_port_qinq_role_set(a_uint32_t dev_id, fal_port_t port_id, fal_qinq_port_role_t role);
303
304
305    sw_error_t
306    fal_port_qinq_role_get(a_uint32_t dev_id, fal_port_t port_id, fal_qinq_port_role_t * role);
307
308
309    sw_error_t
310    fal_port_vlan_trans_iterate(a_uint32_t dev_id, fal_port_t port_id,
311                                a_uint32_t * iterator, fal_vlan_trans_entry_t * entry);
312
313
314    sw_error_t
315    fal_port_mac_vlan_xlt_set(a_uint32_t dev_id, fal_port_t port_id,
316                              a_bool_t enable);
317
318
319    sw_error_t
320    fal_port_mac_vlan_xlt_get(a_uint32_t dev_id, fal_port_t port_id,
321                              a_bool_t * enable);
322
323    sw_error_t
324    fal_netisolate_set(a_uint32_t dev_id, a_uint32_t enable);
325
326    sw_error_t
327    fal_netisolate_get(a_uint32_t dev_id, a_uint32_t * enable);
328
329    sw_error_t
330    fal_eg_trans_filter_bypass_en_set(a_uint32_t dev_id, a_uint32_t enable);
331
332    sw_error_t
333    fal_eg_trans_filter_bypass_en_get(a_uint32_t dev_id, a_uint32_t * enable);
334
335    sw_error_t
336    fal_port_vrf_id_set(a_uint32_t dev_id, fal_port_t port_id,
337                              a_uint32_t vrf_id);
338
339    sw_error_t
340    fal_port_vrf_id_get(a_uint32_t dev_id, fal_port_t port_id,
341                              a_uint32_t * vrf_id);
342
343
344#ifdef __cplusplus
345}
346#endif                          /* __cplusplus */
347#endif                          /* _PORT_VLAN_H_ */
348/**
349 * @}
350 */
351