| 1922 | " | table <table_name> match <field0> ...\n"; |
| 1923 | |
| 1924 | static void |
| 1925 | cmd_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); |
no test coverage detected