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

Function flow_dv_prepare

dpdk/drivers/net/mlx5/mlx5_flow_dv.c:8817–8859  ·  view source on GitHub ↗

* Internal preparation function. Allocates the DV flow size, * this size is constant. * * @param[in] dev * Pointer to the rte_eth_dev 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[out] error * Pointer to the error structure. * * @return * Po

Source from the content-addressed store, hash-verified

8815 * otherwise NULL and rte_errno is set.
8816 */
8817static struct mlx5_flow *
8818flow_dv_prepare(struct rte_eth_dev *dev,
8819 const struct rte_flow_attr *attr __rte_unused,
8820 const struct rte_flow_item items[] __rte_unused,
8821 const struct rte_flow_action actions[] __rte_unused,
8822 struct rte_flow_error *error)
8823{
8824 uint32_t handle_idx = 0;
8825 struct mlx5_flow *dev_flow;
8826 struct mlx5_flow_handle *dev_handle;
8827 struct mlx5_priv *priv = dev->data->dev_private;
8828 struct mlx5_flow_workspace *wks = mlx5_flow_get_thread_workspace();
8829
8830 MLX5_ASSERT(wks);
8831 wks->skip_matcher_reg = 0;
8832 wks->policy = NULL;
8833 wks->final_policy = NULL;
8834 wks->vport_meta_tag = 0;
8835 /* In case of corrupting the memory. */
8836 if (wks->flow_idx >= MLX5_NUM_MAX_DEV_FLOWS) {
8837 rte_flow_error_set(error, ENOSPC,
8838 RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
8839 "not free temporary device flow");
8840 return NULL;
8841 }
8842 dev_handle = mlx5_ipool_zmalloc(priv->sh->ipool[MLX5_IPOOL_MLX5_FLOW],
8843 &handle_idx);
8844 if (!dev_handle) {
8845 rte_flow_error_set(error, ENOMEM,
8846 RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
8847 "not enough memory to create flow handle");
8848 return NULL;
8849 }
8850 MLX5_ASSERT(wks->flow_idx < RTE_DIM(wks->flows));
8851 dev_flow = &wks->flows[wks->flow_idx++];
8852 memset(dev_flow, 0, sizeof(*dev_flow));
8853 dev_flow->handle = dev_handle;
8854 dev_flow->handle_idx = handle_idx;
8855 dev_flow->dv.value.size = MLX5_ST_SZ_BYTES(fte_match_param);
8856 dev_flow->ingress = attr->ingress;
8857 dev_flow->dv.transfer = attr->transfer;
8858 return dev_flow;
8859}
8860
8861#ifdef RTE_LIBRTE_MLX5_DEBUG
8862/**

Callers

nothing calls this directly

Calls 4

rte_flow_error_setFunction · 0.85
mlx5_ipool_zmallocFunction · 0.85
memsetFunction · 0.85

Tested by

no test coverage detected