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

Function flow_init_single

dpdk/examples/ipsec-secgw/flow.c:276–364  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

274#define MAX_RTE_FLOW_ACTIONS (5)
275
276static void
277flow_init_single(struct flow_rule_entry *rule)
278{
279 struct rte_flow_action action[MAX_RTE_FLOW_ACTIONS] = {};
280 struct rte_flow_item pattern[MAX_RTE_FLOW_PATTERN] = {};
281 struct rte_flow_action_queue queue_action;
282 struct rte_flow_action_mark mark_action;
283 int ret, pattern_idx = 0, act_idx = 0;
284 struct rte_flow_item_mark mark_mask;
285 struct rte_flow_attr attr = {};
286 struct rte_flow_error err = {};
287
288 attr.egress = 0;
289 attr.ingress = 1;
290
291 if (rule->is_queue_set) {
292 queue_action.index = rule->queue;
293 action[act_idx].type = RTE_FLOW_ACTION_TYPE_QUEUE;
294 action[act_idx].conf = &queue_action;
295 act_idx++;
296 }
297
298 if (rule->enable_count) {
299 action[act_idx].type = RTE_FLOW_ACTION_TYPE_COUNT;
300 act_idx++;
301 }
302
303 if (rule->set_security_action) {
304 action[act_idx].type = RTE_FLOW_ACTION_TYPE_SECURITY;
305 action[act_idx].conf = NULL;
306 act_idx++;
307 }
308
309 if (rule->set_mark_action) {
310 mark_action.id = rule->mark_action_val;
311 action[act_idx].type = RTE_FLOW_ACTION_TYPE_MARK;
312 action[act_idx].conf = &mark_action;
313 act_idx++;
314 }
315
316 action[act_idx].type = RTE_FLOW_ACTION_TYPE_END;
317 action[act_idx].conf = NULL;
318
319 if (rule->enable_mark) {
320 mark_mask.id = UINT32_MAX;
321 pattern[pattern_idx].type = RTE_FLOW_ITEM_TYPE_MARK;
322 pattern[pattern_idx].spec = &rule->mark_val;
323 pattern[pattern_idx].mask = &mark_mask;
324 pattern_idx++;
325 }
326
327 if (rule->is_eth) {
328 pattern[pattern_idx].type = RTE_FLOW_ITEM_TYPE_ETH;
329 pattern_idx++;
330 }
331
332 if (rule->is_ipv4) {
333 pattern[pattern_idx].type = RTE_FLOW_ITEM_TYPE_IPV4;

Callers 1

flow_initFunction · 0.85

Calls 2

rte_flow_validateFunction · 0.85
rte_flow_createFunction · 0.85

Tested by

no test coverage detected