| 807 | " [balance offset <key_offset> mask <key_mask> port <port_id0> ... <port_id15>]\n"; |
| 808 | |
| 809 | static void |
| 810 | cmd_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 | } |
no test coverage detected