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_VFW_H__
18 #define __INCLUDE_PIPELINE_VFW_H__
24 * Pipeline VFW Front End (FE).
25 * Runs on the Master pipeline, responsible for CLI commands.
31 #include "pipeline_vfw_be.h"
33 /* VFW IPV4 and IPV6 enable flags for debugging (Default both on) */
34 extern int vfw_ipv4_enabled;
35 extern int vfw_ipv6_enabled;
37 /* Number of VFW Rules, default 4 * 1024 */
38 extern uint32_t vfw_n_rules;
39 /* VFW Rule Table TRIE - 2 (Active, Standby Global table per ipv4, ipv6 */
40 extern void *vfw_rule_table_ipv4_active;
41 extern void *vfw_rule_table_ipv4_standby;
42 extern void *vfw_rule_table_ipv6_active;
43 extern void *vfw_rule_table_ipv6_standby;
45 #define active_rule_table 0
46 #define standby_rule_table 1
47 #define vfw_add_command 0
48 #define vfw_delete_command 1
49 #define IPV6_32BIT_LENGTH 4
52 * Add VFW rule to the VFW rule table.
53 * Rules are added standby table.
54 * Applyruleset command will activate the change.
55 * Both IPv4 and IPv6 rules can be added.
58 * A pointer to the VFW pipeline parameters.
60 * A pointer to the VFW rule to add.
62 * Priority of the VFW rule.
64 * Port ID of the VFW rule.
66 * Action ID of the VFW rule. Defined in Action Table.
69 * 0 on success, negative on error.
72 app_pipeline_vfw_add_rule(struct app_params *app,
73 struct pipeline_vfw_key *key,
75 uint32_t port_id, uint32_t action_id);
78 * Delete VFW rule from the VFW rule table.
79 * Rules deleted from standby tables.
80 * Applyruleset command will activate the change.
81 * Both IPv4 and IPv6 rules can be deleted.
84 * A pointer to the VFW pipeline parameters.
86 * A pointer to the VFW rule to delete.
89 * 0 on success, negative on error.
92 app_pipeline_vfw_delete_rule(struct app_params *app,
93 struct pipeline_vfw_key *key);
96 * Clear all VFW rules from the VFW rule table.
97 * Rules cleared from standby tables.
98 * Applyruleset command will activate the change.
99 * Both IPv4 and IPv6 rules will be cleared.
102 * A pointer to the VFW pipeline parameters.
105 * 0 on success, negative on error.
107 int app_pipeline_vfw_clearrules(struct app_params *app);
110 * Add Action to the Action table.
111 * Actions are added standby table.
112 * Applyruleset command will activate the change.
115 * A pointer to the VFW pipeline parameters.
117 * A pointer to the Action to add.
120 * 0 on success, negative on error.
123 app_pipeline_action_add(struct app_params *app,
124 struct pipeline_action_key *key);
127 * Delete Action from the Action table.
128 * Actions are deleted from the standby table.
129 * Applyruleset command will activate the change.
132 * A pointer to the VFW pipeline parameters.
134 * A pointer to the Action to delete.
137 * 0 on success, negative on error.
140 app_pipeline_action_delete(struct app_params *app,
141 struct pipeline_action_key *key);
143 extern struct pipeline_type pipeline_vfw;