Remove all flow rules. */
| 3693 | |
| 3694 | /** Remove all flow rules. */ |
| 3695 | int |
| 3696 | port_flow_flush(portid_t port_id) |
| 3697 | { |
| 3698 | struct rte_flow_error error; |
| 3699 | struct rte_port *port; |
| 3700 | int ret = 0; |
| 3701 | |
| 3702 | if (port_id_is_invalid(port_id, ENABLED_WARN) || |
| 3703 | port_id == (portid_t)RTE_PORT_ALL) |
| 3704 | return -EINVAL; |
| 3705 | |
| 3706 | port = &ports[port_id]; |
| 3707 | |
| 3708 | if (port->flow_list == NULL) |
| 3709 | return ret; |
| 3710 | |
| 3711 | /* Poisoning to make sure PMDs update it in case of error. */ |
| 3712 | memset(&error, 0x44, sizeof(error)); |
| 3713 | if (rte_flow_flush(port_id, &error)) { |
| 3714 | port_flow_complain(&error); |
| 3715 | } |
| 3716 | |
| 3717 | while (port->flow_list) { |
| 3718 | struct port_flow *pf = port->flow_list->next; |
| 3719 | |
| 3720 | free(port->flow_list); |
| 3721 | port->flow_list = pf; |
| 3722 | } |
| 3723 | return ret; |
| 3724 | } |
| 3725 | |
| 3726 | /** Dump flow rules. */ |
| 3727 | int |