2 // Copyright (c) 2017 Intel Corporation
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
17 #ifndef __INCLUDE_PIPELINE_ACL_H__
18 #define __INCLUDE_PIPELINE_ACL_H__
24 * Pipeline ACL Front End (FE).
25 * Runs on the Master pipeline, responsible for CLI commands.
30 #include "pipeline_acl_be.h"
32 /* ACL IPV4 and IPV6 enable flags for debugging (Default both on) */
33 extern int acl_ipv4_enabled;
34 extern int acl_ipv6_enabled;
36 /* Number of ACL Rules, default 4 * 1024 */
37 extern uint32_t acl_n_rules;
38 /* ACL Rule Table TRIE - 2 (Active, Standby Global table per ipv4, ipv6 */
39 extern void *acl_rule_table_ipv4_active;
40 extern void *acl_rule_table_ipv4_standby;
41 extern void *acl_rule_table_ipv6_active;
42 extern void *acl_rule_table_ipv6_standby;
44 #define active_rule_table 0
45 #define standby_rule_table 1
46 #define acl_add_command 0
47 #define acl_delete_command 1
48 #define IPV6_32BIT_LENGTH 4
51 * Add ACL rule to the ACL rule table.
52 * Rules are added standby table.
53 * Applyruleset command will activate the change.
54 * Both IPv4 and IPv6 rules can be added.
57 * A pointer to the ACL pipeline parameters.
59 * A pointer to the ACL rule to add.
61 * Priority of the ACL rule.
63 * Port ID of the ACL rule.
65 * Action ID of the ACL rule. Defined in Action Table.
68 * 0 on success, negative on error.
71 app_pipeline_acl_add_rule(struct app_params *app,
72 struct pipeline_acl_key *key,
74 uint32_t port_id, uint32_t action_id);
77 * Delete ACL rule from the ACL rule table.
78 * Rules deleted from standby tables.
79 * Applyruleset command will activate the change.
80 * Both IPv4 and IPv6 rules can be deleted.
83 * A pointer to the ACL pipeline parameters.
85 * A pointer to the ACL rule to delete.
88 * 0 on success, negative on error.
91 app_pipeline_acl_delete_rule(struct app_params *app,
92 struct pipeline_acl_key *key);
95 * Clear all ACL rules from the ACL rule table.
96 * Rules cleared from standby tables.
97 * Applyruleset command will activate the change.
98 * Both IPv4 and IPv6 rules will be cleared.
101 * A pointer to the ACL pipeline parameters.
104 * 0 on success, negative on error.
106 int app_pipeline_acl_clearrules(struct app_params *app);
109 * Add Action to the Action table.
110 * Actions are added standby table.
111 * Applyruleset command will activate the change.
114 * A pointer to the ACL pipeline parameters.
116 * A pointer to the Action to add.
119 * 0 on success, negative on error.
122 app_pipeline_action_add(struct app_params *app,
123 struct pipeline_action_key *key);
126 * Delete Action from the Action table.
127 * Actions are deleted from the standby table.
128 * Applyruleset command will activate the change.
131 * A pointer to the ACL pipeline parameters.
133 * A pointer to the Action to delete.
136 * 0 on success, negative on error.
139 app_pipeline_action_delete(struct app_params *app,
140 struct pipeline_action_key *key);
142 extern struct pipeline_type pipeline_acl;