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

Function pipeline_table_mtr_profile_add

dpdk/examples/ip_pipeline/thread.c:1838–1890  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1836}
1837
1838int
1839pipeline_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
1892int
1893pipeline_table_mtr_profile_delete(const char *pipeline_name,

Callers 1

Calls 7

pipeline_is_runningFunction · 0.85
pipeline_msg_allocFunction · 0.85
pipeline_msg_send_recvFunction · 0.85
pipeline_msg_freeFunction · 0.85
pipeline_findFunction · 0.70
memcpyFunction · 0.50

Tested by

no test coverage detected