| 543 | } |
| 544 | |
| 545 | static int |
| 546 | create_default_flow(uint16_t portid) |
| 547 | { |
| 548 | struct rte_flow_action action[2]; |
| 549 | struct rte_flow_item pattern[2]; |
| 550 | struct rte_flow_attr attr = {0}; |
| 551 | struct rte_flow_error err; |
| 552 | struct rte_flow *flow; |
| 553 | int ret; |
| 554 | |
| 555 | /* Add the default rte_flow to enable SECURITY for all ESP packets */ |
| 556 | |
| 557 | pattern[0].type = RTE_FLOW_ITEM_TYPE_ESP; |
| 558 | pattern[0].spec = NULL; |
| 559 | pattern[0].mask = NULL; |
| 560 | pattern[0].last = NULL; |
| 561 | pattern[1].type = RTE_FLOW_ITEM_TYPE_END; |
| 562 | |
| 563 | action[0].type = RTE_FLOW_ACTION_TYPE_SECURITY; |
| 564 | action[0].conf = NULL; |
| 565 | action[1].type = RTE_FLOW_ACTION_TYPE_END; |
| 566 | action[1].conf = NULL; |
| 567 | |
| 568 | attr.ingress = 1; |
| 569 | |
| 570 | ret = rte_flow_validate(portid, &attr, pattern, action, &err); |
| 571 | if (ret) { |
| 572 | printf("\nValidate flow failed, ret = %d\n", ret); |
| 573 | return -1; |
| 574 | } |
| 575 | flow = rte_flow_create(portid, &attr, pattern, action, &err); |
| 576 | if (flow == NULL) { |
| 577 | printf("\nDefault flow rule create failed\n"); |
| 578 | return -1; |
| 579 | } |
| 580 | |
| 581 | default_flow[portid] = flow; |
| 582 | |
| 583 | return 0; |
| 584 | } |
| 585 | |
| 586 | static void |
| 587 | destroy_default_flow(uint16_t portid) |
no test coverage detected