* Protocol-independent flow API support */
| 1234 | * Protocol-independent flow API support |
| 1235 | */ |
| 1236 | static int |
| 1237 | sfc_flow_parse_attr(struct sfc_adapter *sa, |
| 1238 | const struct rte_flow_attr *attr, |
| 1239 | struct rte_flow *flow, |
| 1240 | struct rte_flow_error *error) |
| 1241 | { |
| 1242 | struct sfc_flow_spec *spec = &flow->spec; |
| 1243 | struct sfc_flow_spec_filter *spec_filter = &spec->filter; |
| 1244 | struct sfc_flow_spec_mae *spec_mae = &spec->mae; |
| 1245 | struct sfc_mae *mae = &sa->mae; |
| 1246 | |
| 1247 | if (attr == NULL) { |
| 1248 | rte_flow_error_set(error, EINVAL, |
| 1249 | RTE_FLOW_ERROR_TYPE_ATTR, NULL, |
| 1250 | "NULL attribute"); |
| 1251 | return -rte_errno; |
| 1252 | } |
| 1253 | if (attr->group != 0) { |
| 1254 | rte_flow_error_set(error, ENOTSUP, |
| 1255 | RTE_FLOW_ERROR_TYPE_ATTR_GROUP, attr, |
| 1256 | "Groups are not supported"); |
| 1257 | return -rte_errno; |
| 1258 | } |
| 1259 | if (attr->egress != 0 && attr->transfer == 0) { |
| 1260 | rte_flow_error_set(error, ENOTSUP, |
| 1261 | RTE_FLOW_ERROR_TYPE_ATTR_EGRESS, attr, |
| 1262 | "Egress is not supported"); |
| 1263 | return -rte_errno; |
| 1264 | } |
| 1265 | if (attr->ingress == 0 && attr->transfer == 0) { |
| 1266 | rte_flow_error_set(error, ENOTSUP, |
| 1267 | RTE_FLOW_ERROR_TYPE_ATTR_INGRESS, attr, |
| 1268 | "Ingress is compulsory"); |
| 1269 | return -rte_errno; |
| 1270 | } |
| 1271 | if (attr->transfer == 0) { |
| 1272 | if (attr->priority != 0) { |
| 1273 | rte_flow_error_set(error, ENOTSUP, |
| 1274 | RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY, |
| 1275 | attr, "Priorities are unsupported"); |
| 1276 | return -rte_errno; |
| 1277 | } |
| 1278 | spec->type = SFC_FLOW_SPEC_FILTER; |
| 1279 | spec_filter->template.efs_flags |= EFX_FILTER_FLAG_RX; |
| 1280 | spec_filter->template.efs_rss_context = EFX_RSS_CONTEXT_DEFAULT; |
| 1281 | spec_filter->template.efs_priority = EFX_FILTER_PRI_MANUAL; |
| 1282 | } else { |
| 1283 | if (mae->status != SFC_MAE_STATUS_ADMIN) { |
| 1284 | rte_flow_error_set(error, ENOTSUP, |
| 1285 | RTE_FLOW_ERROR_TYPE_ATTR_TRANSFER, |
| 1286 | attr, "Transfer is not supported"); |
| 1287 | return -rte_errno; |
| 1288 | } |
| 1289 | if (attr->priority > mae->nb_action_rule_prios_max) { |
| 1290 | rte_flow_error_set(error, ENOTSUP, |
| 1291 | RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY, |
| 1292 | attr, "Unsupported priority level"); |
| 1293 | return -rte_errno; |
no test coverage detected