| 1817 | " | table <table_name> match <field0> ...\n"; |
| 1818 | |
| 1819 | static void |
| 1820 | cmd_pipeline_regrd(char **tokens, |
| 1821 | uint32_t n_tokens, |
| 1822 | char *out, |
| 1823 | size_t out_size, |
| 1824 | void *obj __rte_unused) |
| 1825 | { |
| 1826 | struct rte_swx_pipeline *p; |
| 1827 | struct rte_swx_ctl_pipeline *ctl; |
| 1828 | const char *pipeline_name, *name; |
| 1829 | uint64_t value; |
| 1830 | int status; |
| 1831 | |
| 1832 | if (n_tokens < 5) { |
| 1833 | snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); |
| 1834 | return; |
| 1835 | } |
| 1836 | |
| 1837 | pipeline_name = tokens[1]; |
| 1838 | p = rte_swx_pipeline_find(pipeline_name); |
| 1839 | ctl = rte_swx_ctl_pipeline_find(pipeline_name); |
| 1840 | if (!p || !ctl) { |
| 1841 | snprintf(out, out_size, MSG_ARG_INVALID, "pipeline_name"); |
| 1842 | return; |
| 1843 | } |
| 1844 | |
| 1845 | if (strcmp(tokens[2], "regrd")) { |
| 1846 | snprintf(out, out_size, MSG_ARG_NOT_FOUND, "regrd"); |
| 1847 | return; |
| 1848 | } |
| 1849 | |
| 1850 | name = tokens[3]; |
| 1851 | |
| 1852 | /* index. */ |
| 1853 | if (!strcmp(tokens[4], "index")) { |
| 1854 | uint32_t idx = 0; |
| 1855 | |
| 1856 | if (n_tokens != 6) { |
| 1857 | snprintf(out, out_size, MSG_ARG_MISMATCH, tokens[0]); |
| 1858 | return; |
| 1859 | } |
| 1860 | |
| 1861 | if (parser_read_uint32(&idx, tokens[5])) { |
| 1862 | snprintf(out, out_size, MSG_ARG_INVALID, "index"); |
| 1863 | return; |
| 1864 | } |
| 1865 | |
| 1866 | status = rte_swx_ctl_pipeline_regarray_read(p, name, idx, &value); |
| 1867 | if (status) { |
| 1868 | snprintf(out, out_size, "Command failed.\n"); |
| 1869 | return; |
| 1870 | } |
| 1871 | |
| 1872 | snprintf(out, out_size, "0x%" PRIx64 "\n", value); |
| 1873 | return; |
| 1874 | } |
| 1875 | |
| 1876 | /* table. */ |
no test coverage detected