MCPcopy Create free account
hub / github.com/F-Stack/f-stack / rte_table_acl_build

Function rte_table_acl_build

dpdk/lib/table/rte_table_acl.c:157–208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155RTE_ACL_RULE_DEF(rte_pipeline_acl_rule, RTE_ACL_MAX_FIELDS);
156
157static int
158rte_table_acl_build(struct rte_table_acl *acl, struct rte_acl_ctx **acl_ctx)
159{
160 struct rte_acl_ctx *ctx = NULL;
161 uint32_t n_rules, i;
162 int status;
163
164 /* Create low level ACL table */
165 ctx = rte_acl_create(&acl->acl_params);
166 if (ctx == NULL) {
167 RTE_LOG(ERR, TABLE, "%s: Cannot create low level ACL table\n",
168 __func__);
169 return -1;
170 }
171
172 /* Add rules to low level ACL table */
173 n_rules = 0;
174 for (i = 1; i < acl->n_rules; i++) {
175 if (acl->acl_rule_list[i] != NULL) {
176 status = rte_acl_add_rules(ctx, acl->acl_rule_list[i],
177 1);
178 if (status != 0) {
179 RTE_LOG(ERR, TABLE,
180 "%s: Cannot add rule to low level ACL table\n",
181 __func__);
182 rte_acl_free(ctx);
183 return -1;
184 }
185
186 n_rules++;
187 }
188 }
189
190 if (n_rules == 0) {
191 rte_acl_free(ctx);
192 *acl_ctx = NULL;
193 return 0;
194 }
195
196 /* Build low level ACl table */
197 status = rte_acl_build(ctx, &acl->cfg);
198 if (status != 0) {
199 RTE_LOG(ERR, TABLE,
200 "%s: Cannot build the low level ACL table\n",
201 __func__);
202 rte_acl_free(ctx);
203 return -1;
204 }
205
206 *acl_ctx = ctx;
207 return 0;
208}
209
210static int
211rte_table_acl_entry_add(

Callers 4

rte_table_acl_entry_addFunction · 0.85

Calls 4

rte_acl_createFunction · 0.85
rte_acl_add_rulesFunction · 0.85
rte_acl_freeFunction · 0.85
rte_acl_buildFunction · 0.85

Tested by

no test coverage detected