* Synchronize flow rules. * * This function synchronizes flow rules with the state of the device by * taking into account isolated mode and whether target queues are * configured. * * @param priv * Pointer to private structure. * @param[out] error * Perform verbose error reporting if not NULL. * * @return * 0 on success, a negative errno value otherwise and rte_errno is set. */
| 1531 | * 0 on success, a negative errno value otherwise and rte_errno is set. |
| 1532 | */ |
| 1533 | int |
| 1534 | mlx4_flow_sync(struct mlx4_priv *priv, struct rte_flow_error *error) |
| 1535 | { |
| 1536 | struct rte_flow *flow; |
| 1537 | int ret; |
| 1538 | |
| 1539 | /* Internal flow rules are guaranteed to come first in the list. */ |
| 1540 | if (priv->isolated) { |
| 1541 | /* |
| 1542 | * Get rid of them in isolated mode, stop at the first |
| 1543 | * non-internal rule found. |
| 1544 | */ |
| 1545 | for (flow = LIST_FIRST(&priv->flows); |
| 1546 | flow && flow->internal; |
| 1547 | flow = LIST_FIRST(&priv->flows)) |
| 1548 | claim_zero(mlx4_flow_destroy(ETH_DEV(priv), flow, |
| 1549 | error)); |
| 1550 | } else { |
| 1551 | /* Refresh internal rules. */ |
| 1552 | ret = mlx4_flow_internal(priv, error); |
| 1553 | if (ret) |
| 1554 | return ret; |
| 1555 | } |
| 1556 | /* Toggle the remaining flow rules . */ |
| 1557 | LIST_FOREACH(flow, &priv->flows, next) { |
| 1558 | ret = mlx4_flow_toggle(priv, flow, priv->started, error); |
| 1559 | if (ret) |
| 1560 | return ret; |
| 1561 | } |
| 1562 | if (!priv->started) |
| 1563 | MLX4_ASSERT(!priv->drop); |
| 1564 | return 0; |
| 1565 | } |
| 1566 | |
| 1567 | /** |
| 1568 | * Clean up all flow rules. |
no test coverage detected