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 * @defgroup dess_fdb DESS_FDB
18 * @{
19 */
20#ifndef _DESS_FDB_H_
21#define _DESS_FDB_H_
22
23#ifdef __cplusplus
24extern "C" {
25#endif                          /* __cplusplus */
26
27#include "fal/fal_fdb.h"
28
29    sw_error_t dess_fdb_init(a_uint32_t dev_id);
30
31#ifdef IN_FDB
32#define DESS_FDB_INIT(rv, dev_id) \
33    { \
34        rv = dess_fdb_init(dev_id); \
35        SW_RTN_ON_ERROR(rv); \
36    }
37#else
38#define DESS_FDB_INIT(rv, dev_id)
39#endif
40
41#ifdef HSL_STANDALONG
42
43    HSL_LOCAL sw_error_t
44    dess_fdb_add(a_uint32_t dev_id, const fal_fdb_entry_t * entry);
45
46    HSL_LOCAL sw_error_t
47    dess_fdb_find(a_uint32_t dev_id, fal_fdb_entry_t * entry);
48
49    HSL_LOCAL sw_error_t
50    dess_fdb_del_all(a_uint32_t dev_id, a_uint32_t flag);
51
52    HSL_LOCAL sw_error_t
53    dess_fdb_del_by_port(a_uint32_t dev_id, fal_port_t port_id,
54                         a_uint32_t flag);
55
56    HSL_LOCAL sw_error_t
57    dess_fdb_del_by_mac(a_uint32_t dev_id, const fal_fdb_entry_t * entry);
58
59    HSL_LOCAL sw_error_t
60    dess_fdb_extend_next(a_uint32_t dev_id, fal_fdb_op_t * op,
61                         fal_fdb_entry_t * entry);
62
63    HSL_LOCAL sw_error_t
64    dess_fdb_extend_first(a_uint32_t dev_id, fal_fdb_op_t * option,
65                          fal_fdb_entry_t * entry);
66
67    HSL_LOCAL sw_error_t
68    dess_fdb_transfer(a_uint32_t dev_id, fal_port_t old_port,
69                      fal_port_t new_port, a_uint32_t fid,
70                      fal_fdb_op_t * option);
71
72    HSL_LOCAL sw_error_t
73    dess_fdb_port_learn_set(a_uint32_t dev_id, fal_port_t port_id,
74                            a_bool_t enable);
75
76    HSL_LOCAL sw_error_t
77    dess_fdb_port_learn_get(a_uint32_t dev_id, fal_port_t port_id,
78                            a_bool_t * enable);
79
80    HSL_LOCAL sw_error_t
81    dess_fdb_age_ctrl_set(a_uint32_t dev_id, a_bool_t enable);
82
83    HSL_LOCAL sw_error_t
84    dess_fdb_age_ctrl_get(a_uint32_t dev_id, a_bool_t * enable);
85
86    HSL_LOCAL sw_error_t
87    dess_fdb_vlan_ivl_svl_set(a_uint32_t dev_id, fal_fdb_smode smode);
88
89    HSL_LOCAL sw_error_t
90    dess_fdb_vlan_ivl_svl_get(a_uint32_t dev_id, fal_fdb_smode * smode);
91
92    HSL_LOCAL sw_error_t
93    dess_fdb_age_time_set(a_uint32_t dev_id, a_uint32_t * time);
94
95    HSL_LOCAL sw_error_t
96    dess_fdb_age_time_get(a_uint32_t dev_id, a_uint32_t * time);
97
98    HSL_LOCAL sw_error_t
99    dess_port_fdb_learn_limit_set(a_uint32_t dev_id, fal_port_t port_id,
100                                  a_bool_t enable, a_uint32_t cnt);
101
102    HSL_LOCAL sw_error_t
103    dess_port_fdb_learn_limit_get(a_uint32_t dev_id, fal_port_t port_id,
104                                  a_bool_t * enable, a_uint32_t * cnt);
105
106    HSL_LOCAL sw_error_t
107    dess_port_fdb_learn_exceed_cmd_set(a_uint32_t dev_id,
108                                       fal_port_t port_id,
109                                       fal_fwd_cmd_t cmd);
110
111    HSL_LOCAL sw_error_t
112    dess_port_fdb_learn_exceed_cmd_get(a_uint32_t dev_id,
113                                       fal_port_t port_id,
114                                       fal_fwd_cmd_t * cmd);
115
116    HSL_LOCAL sw_error_t
117    dess_fdb_learn_limit_set(a_uint32_t dev_id, a_bool_t enable,
118                             a_uint32_t cnt);
119
120    HSL_LOCAL sw_error_t
121    dess_fdb_learn_limit_get(a_uint32_t dev_id, a_bool_t * enable,
122                             a_uint32_t * cnt);
123
124    HSL_LOCAL sw_error_t
125    dess_fdb_learn_exceed_cmd_set(a_uint32_t dev_id, fal_fwd_cmd_t cmd);
126
127    HSL_LOCAL sw_error_t
128    dess_fdb_learn_exceed_cmd_get(a_uint32_t dev_id, fal_fwd_cmd_t * cmd);
129
130    HSL_LOCAL sw_error_t
131    dess_fdb_resv_add(a_uint32_t dev_id, fal_fdb_entry_t * entry);
132
133    HSL_LOCAL sw_error_t
134    dess_fdb_resv_del(a_uint32_t dev_id, fal_fdb_entry_t * entry);
135
136    HSL_LOCAL sw_error_t
137    dess_fdb_resv_find(a_uint32_t dev_id, fal_fdb_entry_t * entry);
138
139    HSL_LOCAL sw_error_t
140    dess_fdb_resv_iterate(a_uint32_t dev_id, a_uint32_t * iterator,
141                          fal_fdb_entry_t * entry);
142
143    HSL_LOCAL sw_error_t
144    dess_fdb_port_learn_static_set(a_uint32_t dev_id, fal_port_t port_id,
145                                   a_bool_t enable);
146
147    HSL_LOCAL sw_error_t
148    dess_fdb_port_learn_static_get(a_uint32_t dev_id, fal_port_t port_id,
149                                   a_bool_t * enable);
150
151    HSL_LOCAL sw_error_t
152    dess_fdb_port_add(a_uint32_t dev_id, a_uint32_t fid, fal_mac_addr_t * addr, fal_port_t port_id);
153
154    HSL_LOCAL sw_error_t
155    dess_fdb_port_del(a_uint32_t dev_id, a_uint32_t fid, fal_mac_addr_t * addr, fal_port_t port_id);
156
157
158#endif
159
160#ifdef __cplusplus
161}
162#endif                          /* __cplusplus */
163#endif                          /* _DESS_FDB_H_ */
164
165/**
166 * @}
167 */
168
169