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

Function cmd_pipeline_table

dpdk/examples/ip_pipeline/cli.c:1907–2166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1905" [action <table_action_profile_name>]\n";
1906
1907static void
1908cmd_pipeline_table(char **tokens,
1909 uint32_t n_tokens,
1910 char *out,
1911 size_t out_size)
1912{
1913 uint8_t key_mask[TABLE_RULE_MATCH_SIZE_MAX];
1914 struct table_params p;
1915 char *pipeline_name;
1916 uint32_t t0;
1917 int status;
1918
1919 if (n_tokens < 5) {
1920 snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
1921 return;
1922 }
1923
1924 pipeline_name = tokens[1];
1925
1926 if (strcmp(tokens[2], "table") != 0) {
1927 snprintf(out, out_size, MSG_ARG_NOT_FOUND, "table");
1928 return;
1929 }
1930
1931 if (strcmp(tokens[3], "match") != 0) {
1932 snprintf(out, out_size, MSG_ARG_NOT_FOUND, "match");
1933 return;
1934 }
1935
1936 t0 = 4;
1937 if (strcmp(tokens[t0], "acl") == 0) {
1938 if (n_tokens < t0 + 6) {
1939 snprintf(out, out_size, MSG_ARG_MISMATCH,
1940 "pipeline table acl");
1941 return;
1942 }
1943
1944 p.match_type = TABLE_ACL;
1945
1946 if (strcmp(tokens[t0 + 1], "ipv4") == 0)
1947 p.match.acl.ip_version = 1;
1948 else if (strcmp(tokens[t0 + 1], "ipv6") == 0)
1949 p.match.acl.ip_version = 0;
1950 else {
1951 snprintf(out, out_size, MSG_ARG_NOT_FOUND,
1952 "ipv4 or ipv6");
1953 return;
1954 }
1955
1956 if (strcmp(tokens[t0 + 2], "offset") != 0) {
1957 snprintf(out, out_size, MSG_ARG_NOT_FOUND, "offset");
1958 return;
1959 }
1960
1961 if (parser_read_uint32(&p.match.acl.ip_header_offset,
1962 tokens[t0 + 3]) != 0) {
1963 snprintf(out, out_size, MSG_ARG_INVALID,
1964 "ip_header_offset");

Callers 1

cli_processFunction · 0.85

Calls 5

snprintfFunction · 0.85
strcmpFunction · 0.85
pipeline_table_createFunction · 0.85
parser_read_uint32Function · 0.70
parse_hex_stringFunction · 0.70

Tested by

no test coverage detected