| 941 | }; |
| 942 | |
| 943 | static int |
| 944 | cxgbe_rtef_parse_items(struct rte_flow *flow, |
| 945 | const struct rte_flow_item items[], |
| 946 | struct rte_flow_error *e) |
| 947 | { |
| 948 | struct adapter *adap = ethdev2adap(flow->dev); |
| 949 | const struct rte_flow_item *i; |
| 950 | char repeat[ARRAY_SIZE(parseitem)] = {0}; |
| 951 | |
| 952 | for (i = items; i->type != RTE_FLOW_ITEM_TYPE_END; i++) { |
| 953 | struct chrte_fparse *idx; |
| 954 | int ret; |
| 955 | |
| 956 | if (i->type >= ARRAY_SIZE(parseitem)) |
| 957 | return rte_flow_error_set(e, ENOTSUP, |
| 958 | RTE_FLOW_ERROR_TYPE_ITEM, |
| 959 | i, "Item not supported"); |
| 960 | |
| 961 | switch (i->type) { |
| 962 | case RTE_FLOW_ITEM_TYPE_VOID: |
| 963 | continue; |
| 964 | default: |
| 965 | /* check if item is repeated */ |
| 966 | if (repeat[i->type] && |
| 967 | i->type != RTE_FLOW_ITEM_TYPE_VLAN) |
| 968 | return rte_flow_error_set(e, ENOTSUP, |
| 969 | RTE_FLOW_ERROR_TYPE_ITEM, i, |
| 970 | "parse items cannot be repeated(except void/vlan)"); |
| 971 | |
| 972 | repeat[i->type] = 1; |
| 973 | |
| 974 | /* validate the item */ |
| 975 | ret = cxgbe_validate_item(i, e); |
| 976 | if (ret) |
| 977 | return ret; |
| 978 | |
| 979 | idx = &flow->item_parser[i->type]; |
| 980 | if (!idx || !idx->fptr) { |
| 981 | return rte_flow_error_set(e, ENOTSUP, |
| 982 | RTE_FLOW_ERROR_TYPE_ITEM, i, |
| 983 | "Item not supported"); |
| 984 | } else { |
| 985 | ret = idx->fptr(idx->dmask, i, &flow->fs, e); |
| 986 | if (ret) |
| 987 | return ret; |
| 988 | } |
| 989 | } |
| 990 | } |
| 991 | |
| 992 | cxgbe_tweak_filter_spec(adap, &flow->fs); |
| 993 | cxgbe_fill_filter_region(adap, &flow->fs); |
| 994 | |
| 995 | return 0; |
| 996 | } |
| 997 | |
| 998 | static int |
| 999 | cxgbe_flow_parse(struct rte_flow *flow, |
no test coverage detected