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

Function cmd_port_in_action_profile

dpdk/examples/ip_pipeline/cli.c:809–966  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

807" [balance offset <key_offset> mask <key_mask> port <port_id0> ... <port_id15>]\n";
808
809static void
810cmd_port_in_action_profile(char **tokens,
811 uint32_t n_tokens,
812 char *out,
813 size_t out_size)
814{
815 struct port_in_action_profile_params p;
816 struct port_in_action_profile *ap;
817 char *name;
818 uint32_t t0;
819
820 memset(&p, 0, sizeof(p));
821
822 if (n_tokens < 5) {
823 snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]);
824 return;
825 }
826
827 if (strcmp(tokens[1], "in") != 0) {
828 snprintf(out, out_size, MSG_ARG_NOT_FOUND, "in");
829 return;
830 }
831
832 if (strcmp(tokens[2], "action") != 0) {
833 snprintf(out, out_size, MSG_ARG_NOT_FOUND, "action");
834 return;
835 }
836
837 if (strcmp(tokens[3], "profile") != 0) {
838 snprintf(out, out_size, MSG_ARG_NOT_FOUND, "profile");
839 return;
840 }
841
842 name = tokens[4];
843
844 t0 = 5;
845
846 if ((t0 < n_tokens) && (strcmp(tokens[t0], "filter") == 0)) {
847 uint32_t size;
848
849 if (n_tokens < t0 + 10) {
850 snprintf(out, out_size, MSG_ARG_MISMATCH, "port in action profile filter");
851 return;
852 }
853
854 if (strcmp(tokens[t0 + 1], "match") == 0)
855 p.fltr.filter_on_match = 1;
856 else if (strcmp(tokens[t0 + 1], "mismatch") == 0)
857 p.fltr.filter_on_match = 0;
858 else {
859 snprintf(out, out_size, MSG_ARG_INVALID, "match or mismatch");
860 return;
861 }
862
863 if (strcmp(tokens[t0 + 2], "offset") != 0) {
864 snprintf(out, out_size, MSG_ARG_NOT_FOUND, "offset");
865 return;
866 }

Callers 1

cli_processFunction · 0.85

Calls 6

memsetFunction · 0.85
snprintfFunction · 0.85
strcmpFunction · 0.85
parser_read_uint32Function · 0.70
parse_hex_stringFunction · 0.70

Tested by

no test coverage detected