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

Function cmd_pipeline_regwr

dpdk/examples/pipeline/cli.c:1924–2031  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1922 " | table <table_name> match <field0> ...\n";
1923
1924static void
1925cmd_pipeline_regwr(char **tokens,
1926 uint32_t n_tokens,
1927 char *out,
1928 size_t out_size,
1929 void *obj __rte_unused)
1930{
1931 struct rte_swx_pipeline *p;
1932 struct rte_swx_ctl_pipeline *ctl;
1933 const char *pipeline_name, *name;
1934 uint64_t value = 0;
1935 int status;
1936
1937 if (n_tokens < 7) {
1938 snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
1939 return;
1940 }
1941
1942 pipeline_name = tokens[1];
1943 p = rte_swx_pipeline_find(pipeline_name);
1944 ctl = rte_swx_ctl_pipeline_find(pipeline_name);
1945 if (!p || !ctl) {
1946 snprintf(out, out_size, MSG_ARG_INVALID, "pipeline_name");
1947 return;
1948 }
1949
1950 if (strcmp(tokens[2], "regwr")) {
1951 snprintf(out, out_size, MSG_ARG_NOT_FOUND, "regwr");
1952 return;
1953 }
1954
1955 name = tokens[3];
1956
1957 if (strcmp(tokens[4], "value")) {
1958 snprintf(out, out_size, MSG_ARG_NOT_FOUND, "value");
1959 return;
1960 }
1961
1962 if (parser_read_uint64(&value, tokens[5])) {
1963 snprintf(out, out_size, MSG_ARG_INVALID, "value");
1964 return;
1965 }
1966
1967 /* index. */
1968 if (!strcmp(tokens[6], "index")) {
1969 uint32_t idx = 0;
1970
1971 if (n_tokens != 8) {
1972 snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
1973 return;
1974 }
1975
1976 if (parser_read_uint32(&idx, tokens[7])) {
1977 snprintf(out, out_size, MSG_ARG_INVALID, "index");
1978 return;
1979 }
1980
1981 status = rte_swx_ctl_pipeline_regarray_write(p, name, idx, value);

Callers 1

cli_processFunction · 0.85

Calls 10

snprintfFunction · 0.85
rte_swx_pipeline_findFunction · 0.85
strcmpFunction · 0.85
parse_table_entryFunction · 0.85
parser_read_uint64Function · 0.70
parser_read_uint32Function · 0.70
table_entry_freeFunction · 0.70

Tested by

no test coverage detected