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

Function pipeline_table_rule_mtr_read

dpdk/examples/ip_pipeline/thread.c:1942–2010  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1940}
1941
1942int
1943pipeline_table_rule_mtr_read(const char *pipeline_name,
1944 uint32_t table_id,
1945 struct table_rule_match *match,
1946 struct rte_table_action_mtr_counters *stats,
1947 int clear)
1948{
1949 struct pipeline *p;
1950 struct table *table;
1951 struct pipeline_msg_req *req;
1952 struct pipeline_msg_rsp *rsp;
1953 struct table_rule *rule;
1954 uint32_t tc_mask;
1955 int status;
1956
1957 /* Check input params */
1958 if ((pipeline_name == NULL) ||
1959 (match == NULL) ||
1960 (stats == NULL))
1961 return -1;
1962
1963 p = pipeline_find(pipeline_name);
1964 if ((p == NULL) ||
1965 (table_id >= p->n_tables) ||
1966 match_check(match, p, table_id))
1967 return -1;
1968
1969 table = &p->table[table_id];
1970 tc_mask = (1 << table->ap->params.mtr.n_tc) - 1;
1971
1972 rule = table_rule_find(table, match);
1973 if (rule == NULL)
1974 return -1;
1975
1976 if (!pipeline_is_running(p)) {
1977 status = rte_table_action_meter_read(table->a,
1978 rule->data,
1979 tc_mask,
1980 stats,
1981 clear);
1982
1983 return status;
1984 }
1985
1986 /* Allocate request */
1987 req = pipeline_msg_alloc();
1988 if (req == NULL)
1989 return -1;
1990
1991 /* Write request */
1992 req->type = PIPELINE_REQ_TABLE_RULE_MTR_READ;
1993 req->id = table_id;
1994 req->table_rule_mtr_read.data = rule->data;
1995 req->table_rule_mtr_read.tc_mask = tc_mask;
1996 req->table_rule_mtr_read.clear = clear;
1997
1998 /* Send request and wait for response */
1999 rsp = pipeline_msg_send_recv(p, req);

Callers 1

Calls 9

match_checkFunction · 0.85
table_rule_findFunction · 0.85
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