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

Function flow_verbs_validate

dpdk/drivers/net/mlx5/mlx5_flow_verbs.c:1303–1590  ·  view source on GitHub ↗

* Internal validation function. For validating both actions and items. * * @param[in] dev * Pointer to the Ethernet device structure. * @param[in] attr * Pointer to the flow attributes. * @param[in] items * Pointer to the list of items. * @param[in] actions * Pointer to the list of actions. * @param[in] external * This flow rule is created by request external to PMD. * @param

Source from the content-addressed store, hash-verified

1301 * 0 on success, a negative errno value otherwise and rte_errno is set.
1302 */
1303static int
1304flow_verbs_validate(struct rte_eth_dev *dev,
1305 const struct rte_flow_attr *attr,
1306 const struct rte_flow_item items[],
1307 const struct rte_flow_action actions[],
1308 bool external __rte_unused,
1309 int hairpin __rte_unused,
1310 struct rte_flow_error *error)
1311{
1312 int ret;
1313 uint64_t action_flags = 0;
1314 uint64_t item_flags = 0;
1315 uint64_t last_item = 0;
1316 uint8_t next_protocol = 0xff;
1317 uint16_t ether_type = 0;
1318 bool is_empty_vlan = false;
1319 uint16_t udp_dport = 0;
1320 /* Verbs interface does not support groups higher than 0. */
1321 bool is_root = true;
1322
1323 if (items == NULL)
1324 return -1;
1325 ret = flow_verbs_validate_attributes(dev, attr, error);
1326 if (ret < 0)
1327 return ret;
1328 for (; items->type != RTE_FLOW_ITEM_TYPE_END; items++) {
1329 int tunnel = !!(item_flags & MLX5_FLOW_LAYER_TUNNEL);
1330 int ret = 0;
1331
1332 switch (items->type) {
1333#ifdef HAVE_IBV_FLOW_SPEC_ESP
1334 case RTE_FLOW_ITEM_TYPE_ESP:
1335 ret = mlx5_flow_os_validate_item_esp(items, item_flags,
1336 next_protocol,
1337 error);
1338 if (ret < 0)
1339 return ret;
1340 last_item = MLX5_FLOW_ITEM_ESP;
1341 break;
1342#endif
1343 case RTE_FLOW_ITEM_TYPE_VOID:
1344 break;
1345 case RTE_FLOW_ITEM_TYPE_ETH:
1346 ret = mlx5_flow_validate_item_eth(items, item_flags,
1347 false, error);
1348 if (ret < 0)
1349 return ret;
1350 last_item = tunnel ? MLX5_FLOW_LAYER_INNER_L2 :
1351 MLX5_FLOW_LAYER_OUTER_L2;
1352 if (items->mask != NULL && items->spec != NULL) {
1353 ether_type =
1354 ((const struct rte_flow_item_eth *)
1355 items->spec)->hdr.ether_type;
1356 ether_type &=
1357 ((const struct rte_flow_item_eth *)
1358 items->mask)->hdr.ether_type;
1359 if (ether_type == RTE_BE16(RTE_ETHER_TYPE_VLAN))
1360 is_empty_vlan = true;

Callers

nothing calls this directly

Tested by

no test coverage detected