| 1471 | #ifdef HAVE_MLX5_HWS_SUPPORT |
| 1472 | |
| 1473 | static int |
| 1474 | mlx5_traffic_enable_hws(struct rte_eth_dev *dev) |
| 1475 | { |
| 1476 | struct mlx5_priv *priv = dev->data->dev_private; |
| 1477 | struct mlx5_sh_config *config = &priv->sh->config; |
| 1478 | uint64_t flags = 0; |
| 1479 | unsigned int i; |
| 1480 | int ret; |
| 1481 | |
| 1482 | /* |
| 1483 | * With extended metadata enabled, the Tx metadata copy is handled by default |
| 1484 | * Tx tagging flow rules, so default Tx flow rule is not needed. It is only |
| 1485 | * required when representor matching is disabled. |
| 1486 | */ |
| 1487 | if (config->dv_esw_en && |
| 1488 | !config->repr_matching && |
| 1489 | config->dv_xmeta_en == MLX5_XMETA_MODE_META32_HWS && |
| 1490 | priv->master) { |
| 1491 | if (mlx5_flow_hw_create_tx_default_mreg_copy_flow(dev)) |
| 1492 | goto error; |
| 1493 | } |
| 1494 | for (i = 0; i < priv->txqs_n; ++i) { |
| 1495 | struct mlx5_txq_ctrl *txq = mlx5_txq_get(dev, i); |
| 1496 | uint32_t queue; |
| 1497 | |
| 1498 | if (!txq) |
| 1499 | continue; |
| 1500 | queue = mlx5_txq_get_sqn(txq); |
| 1501 | if ((priv->representor || priv->master) && |
| 1502 | config->dv_esw_en && |
| 1503 | config->fdb_def_rule) { |
| 1504 | if (mlx5_flow_hw_esw_create_sq_miss_flow(dev, queue, false)) { |
| 1505 | mlx5_txq_release(dev, i); |
| 1506 | goto error; |
| 1507 | } |
| 1508 | } |
| 1509 | if (config->dv_esw_en && config->repr_matching) { |
| 1510 | if (mlx5_flow_hw_tx_repr_matching_flow(dev, queue, false)) { |
| 1511 | mlx5_txq_release(dev, i); |
| 1512 | goto error; |
| 1513 | } |
| 1514 | } |
| 1515 | mlx5_txq_release(dev, i); |
| 1516 | } |
| 1517 | if (config->fdb_def_rule) { |
| 1518 | if ((priv->master || priv->representor) && config->dv_esw_en) { |
| 1519 | if (!mlx5_flow_hw_esw_create_default_jump_flow(dev)) |
| 1520 | priv->fdb_def_rule = 1; |
| 1521 | else |
| 1522 | goto error; |
| 1523 | } |
| 1524 | } else { |
| 1525 | DRV_LOG(INFO, "port %u FDB default rule is disabled", dev->data->port_id); |
| 1526 | } |
| 1527 | if (!priv->sh->config.lacp_by_user && priv->pf_bond >= 0 && priv->master) |
| 1528 | if (mlx5_flow_hw_lacp_rx_flow(dev)) |
| 1529 | goto error; |
| 1530 | if (priv->isolated) |
no test coverage detected