| 1648 | } |
| 1649 | |
| 1650 | int |
| 1651 | pipeline_table_rule_delete(const char *pipeline_name, |
| 1652 | uint32_t table_id, |
| 1653 | struct table_rule_match *match) |
| 1654 | { |
| 1655 | struct pipeline *p; |
| 1656 | struct table *table; |
| 1657 | struct pipeline_msg_req *req; |
| 1658 | struct pipeline_msg_rsp *rsp; |
| 1659 | int status; |
| 1660 | |
| 1661 | /* Check input params */ |
| 1662 | if ((pipeline_name == NULL) || |
| 1663 | (match == NULL)) |
| 1664 | return -1; |
| 1665 | |
| 1666 | p = pipeline_find(pipeline_name); |
| 1667 | if ((p == NULL) || |
| 1668 | (table_id >= p->n_tables) || |
| 1669 | match_check(match, p, table_id)) |
| 1670 | return -1; |
| 1671 | |
| 1672 | table = &p->table[table_id]; |
| 1673 | |
| 1674 | if (!pipeline_is_running(p)) { |
| 1675 | union table_rule_match_low_level match_ll; |
| 1676 | int key_found; |
| 1677 | |
| 1678 | status = match_convert(match, &match_ll, 0); |
| 1679 | if (status) |
| 1680 | return -1; |
| 1681 | |
| 1682 | status = rte_pipeline_table_entry_delete(p->p, |
| 1683 | table_id, |
| 1684 | &match_ll, |
| 1685 | &key_found, |
| 1686 | NULL); |
| 1687 | |
| 1688 | if (status == 0) |
| 1689 | table_rule_delete(table, match); |
| 1690 | |
| 1691 | return status; |
| 1692 | } |
| 1693 | |
| 1694 | /* Allocate request */ |
| 1695 | req = pipeline_msg_alloc(); |
| 1696 | if (req == NULL) |
| 1697 | return -1; |
| 1698 | |
| 1699 | /* Write request */ |
| 1700 | req->type = PIPELINE_REQ_TABLE_RULE_DELETE; |
| 1701 | req->id = table_id; |
| 1702 | memcpy(&req->table_rule_delete.match, match, sizeof(*match)); |
| 1703 | |
| 1704 | /* Send request and wait for response */ |
| 1705 | rsp = pipeline_msg_send_recv(p, req); |
| 1706 | |
| 1707 | /* Read response */ |
no test coverage detected