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_acl DESS_ACL
18 * @{
19 */
20#ifndef _DESS_ACL_H_
21#define _DESS_ACL_H_
22
23#ifdef __cplusplus
24extern "C" {
25#endif                          /* __cplusplus */
26
27#include "fal/fal_acl.h"
28
29    sw_error_t dess_acl_init(a_uint32_t dev_id);
30
31    sw_error_t dess_acl_reset(a_uint32_t dev_id);
32
33    sw_error_t dess_acl_cleanup(a_uint32_t dev_id);
34
35
36#ifdef IN_ACL
37#define DESS_ACL_INIT(rv, dev_id) \
38    { \
39        rv = dess_acl_init(dev_id); \
40        SW_RTN_ON_ERROR(rv); \
41    }
42
43#define DESS_ACL_RESET(rv, dev_id) \
44    { \
45        rv = dess_acl_reset(dev_id); \
46        SW_RTN_ON_ERROR(rv); \
47    }
48#define DESS_ACL_CLEANUP(rv, dev_id) \
49    { \
50        rv = dess_acl_cleanup(dev_id); \
51        SW_RTN_ON_ERROR(rv); \
52    }
53#else
54#define DESS_ACL_INIT(rv, dev_id)
55#define DESS_ACL_RESET(rv, dev_id)
56#define DESS_ACL_CLEANUP(rv, dev_id)
57#endif
58
59#ifdef HSL_STANDALONG
60
61
62    HSL_LOCAL sw_error_t
63    dess_acl_list_creat(a_uint32_t dev_id, a_uint32_t list_id,
64                        a_uint32_t list_pri);
65
66    HSL_LOCAL sw_error_t
67    dess_acl_rule_add(a_uint32_t dev_id, a_uint32_t list_id,
68                      a_uint32_t rule_id, a_uint32_t rule_nr,
69                      fal_acl_rule_t * rule);
70
71    HSL_LOCAL sw_error_t
72    dess_acl_rule_delete(a_uint32_t dev_id, a_uint32_t list_id,
73                         a_uint32_t rule_id, a_uint32_t rule_nr);
74
75    HSL_LOCAL sw_error_t
76    dess_acl_rule_query(a_uint32_t dev_id, a_uint32_t list_id,
77                        a_uint32_t rule_id, fal_acl_rule_t * rule);
78
79    HSL_LOCAL a_uint32_t
80    dess_acl_rule_get_offset(a_uint32_t dev_id, a_uint32_t list_id, a_uint32_t rule_id);
81
82    HSL_LOCAL sw_error_t
83    dess_acl_rule_sync_multi_portmap(a_uint32_t dev_id, a_uint32_t pos, a_uint32_t *act);
84
85    HSL_LOCAL sw_error_t
86    dess_acl_list_bind(a_uint32_t dev_id, a_uint32_t list_id,
87                       fal_acl_direc_t direc, fal_acl_bind_obj_t obj_t,
88                       a_uint32_t obj_idx);
89
90    HSL_LOCAL sw_error_t
91    dess_acl_list_unbind(a_uint32_t dev_id, a_uint32_t list_id,
92                         fal_acl_direc_t direc, fal_acl_bind_obj_t obj_t,
93                         a_uint32_t obj_idx);
94
95    HSL_LOCAL sw_error_t
96    dess_acl_status_set(a_uint32_t dev_id, a_bool_t enable);
97
98    HSL_LOCAL sw_error_t
99    dess_acl_list_destroy(a_uint32_t dev_id, a_uint32_t list_id);
100
101    HSL_LOCAL sw_error_t
102    dess_acl_status_get(a_uint32_t dev_id, a_bool_t * enable);
103
104    HSL_LOCAL sw_error_t
105    dess_acl_list_dump(a_uint32_t dev_id);
106
107    HSL_LOCAL sw_error_t
108    dess_acl_rule_dump(a_uint32_t dev_id);
109
110    HSL_LOCAL sw_error_t
111    dess_acl_port_udf_profile_set(a_uint32_t dev_id, fal_port_t port_id,
112                                  fal_acl_udf_type_t udf_type,
113                                  a_uint32_t offset, a_uint32_t length);
114
115    HSL_LOCAL sw_error_t
116    dess_acl_port_udf_profile_get(a_uint32_t dev_id, fal_port_t port_id,
117                                  fal_acl_udf_type_t udf_type,
118                                  a_uint32_t * offset, a_uint32_t * length);
119
120    HSL_LOCAL sw_error_t
121    dess_acl_rule_active(a_uint32_t dev_id, a_uint32_t list_id,
122                         a_uint32_t rule_id, a_uint32_t rule_nr);
123
124    HSL_LOCAL sw_error_t
125    dess_acl_rule_deactive(a_uint32_t dev_id, a_uint32_t list_id,
126                           a_uint32_t rule_id, a_uint32_t rule_nr);
127    HSL_LOCAL sw_error_t
128    dess_acl_rule_src_filter_sts_set(a_uint32_t dev_id,
129                                     a_uint32_t rule_id, a_bool_t enable);
130
131    HSL_LOCAL sw_error_t
132    dess_acl_rule_src_filter_sts_get(a_uint32_t dev_id,
133                                     a_uint32_t rule_id, a_bool_t* enable);
134
135#endif
136
137#ifdef __cplusplus
138}
139#endif                          /* __cplusplus */
140#endif                          /* _DESS_ACL_H_ */
141/**
142 * @}
143 */
144