| 1836 | } |
| 1837 | |
| 1838 | int |
| 1839 | pipeline_table_mtr_profile_add(const char *pipeline_name, |
| 1840 | uint32_t table_id, |
| 1841 | uint32_t meter_profile_id, |
| 1842 | struct rte_table_action_meter_profile *profile) |
| 1843 | { |
| 1844 | struct pipeline *p; |
| 1845 | struct pipeline_msg_req *req; |
| 1846 | struct pipeline_msg_rsp *rsp; |
| 1847 | int status; |
| 1848 | |
| 1849 | /* Check input params */ |
| 1850 | if ((pipeline_name == NULL) || |
| 1851 | (profile == NULL)) |
| 1852 | return -1; |
| 1853 | |
| 1854 | p = pipeline_find(pipeline_name); |
| 1855 | if ((p == NULL) || |
| 1856 | (table_id >= p->n_tables)) |
| 1857 | return -1; |
| 1858 | |
| 1859 | if (!pipeline_is_running(p)) { |
| 1860 | struct rte_table_action *a = p->table[table_id].a; |
| 1861 | |
| 1862 | status = rte_table_action_meter_profile_add(a, |
| 1863 | meter_profile_id, |
| 1864 | profile); |
| 1865 | |
| 1866 | return status; |
| 1867 | } |
| 1868 | |
| 1869 | /* Allocate request */ |
| 1870 | req = pipeline_msg_alloc(); |
| 1871 | if (req == NULL) |
| 1872 | return -1; |
| 1873 | |
| 1874 | /* Write request */ |
| 1875 | req->type = PIPELINE_REQ_TABLE_MTR_PROFILE_ADD; |
| 1876 | req->id = table_id; |
| 1877 | req->table_mtr_profile_add.meter_profile_id = meter_profile_id; |
| 1878 | memcpy(&req->table_mtr_profile_add.profile, profile, sizeof(*profile)); |
| 1879 | |
| 1880 | /* Send request and wait for response */ |
| 1881 | rsp = pipeline_msg_send_recv(p, req); |
| 1882 | |
| 1883 | /* Read response */ |
| 1884 | status = rsp->status; |
| 1885 | |
| 1886 | /* Free response */ |
| 1887 | pipeline_msg_free(rsp); |
| 1888 | |
| 1889 | return status; |
| 1890 | } |
| 1891 | |
| 1892 | int |
| 1893 | pipeline_table_mtr_profile_delete(const char *pipeline_name, |
no test coverage detected