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

Function mlx5_flow_create

dpdk/drivers/net/mlx5/mlx5_flow.c:7993–8042  ·  view source on GitHub ↗

* Create a flow. * * @see rte_flow_create() * @see rte_flow_ops */

Source from the content-addressed store, hash-verified

7991 * @see rte_flow_ops
7992 */
7993struct rte_flow *
7994mlx5_flow_create(struct rte_eth_dev *dev,
7995 const struct rte_flow_attr *attr,
7996 const struct rte_flow_item items[],
7997 const struct rte_flow_action actions[],
7998 struct rte_flow_error *error)
7999{
8000 struct mlx5_priv *priv = dev->data->dev_private;
8001 struct rte_flow_attr *new_attr = (void *)(uintptr_t)attr;
8002 uint32_t prio = attr->priority;
8003 uint32_t flow_idx;
8004
8005 if (priv->sh->config.dv_flow_en == 2) {
8006 rte_flow_error_set(error, ENOTSUP,
8007 RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
8008 NULL,
8009 "Flow non-Q creation not supported");
8010 return NULL;
8011 }
8012 /*
8013 * If the device is not started yet, it is not allowed to created a
8014 * flow from application. PMD default flows and traffic control flows
8015 * are not affected.
8016 */
8017 if (unlikely(!dev->data->dev_started)) {
8018 DRV_LOG(DEBUG, "port %u is not started when "
8019 "inserting a flow", dev->data->port_id);
8020 rte_flow_error_set(error, ENODEV,
8021 RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
8022 NULL,
8023 "port not started");
8024 return NULL;
8025 }
8026 if (unlikely(mlx5_need_cache_flow(priv, attr))) {
8027 if (attr->transfer ||
8028 (attr->ingress && !(priv->mode_info.mode_flag &
8029 RTE_PMD_MLX5_FLOW_ENGINE_FLAG_STANDBY_DUP_INGRESS)))
8030 new_attr->priority += 1;
8031 }
8032 flow_idx = flow_list_create(dev, MLX5_FLOW_TYPE_GEN, attr, items, actions, true, error);
8033 if (!flow_idx)
8034 return NULL;
8035 if (unlikely(mlx5_need_cache_flow(priv, attr))) {
8036 if (mlx5_flow_cache_flow_info(dev, attr, prio, items, actions, flow_idx)) {
8037 flow_list_destroy(dev, MLX5_FLOW_TYPE_GEN, flow_idx);
8038 flow_idx = 0;
8039 }
8040 }
8041 return (void *)(uintptr_t)flow_idx;
8042}
8043
8044/**
8045 * Destroy a flow in a list.

Callers

nothing calls this directly

Calls 5

rte_flow_error_setFunction · 0.85
mlx5_need_cache_flowFunction · 0.85
flow_list_createFunction · 0.85
flow_list_destroyFunction · 0.85

Tested by

no test coverage detected