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

Function mlx4_flow_prepare

dpdk/drivers/net/mlx4/mlx4_flow.c:663–922  ·  view source on GitHub ↗

* Make sure a flow rule is supported and initialize associated structure. * * @param priv * Pointer to private structure. * @param[in] attr * Flow rule attributes. * @param[in] pattern * Pattern specification (list terminated by the END pattern item). * @param[in] actions * Associated actions (list terminated by the END action). * @param[out] error * Perform verbose error repo

Source from the content-addressed store, hash-verified

661 * 0 on success, a negative errno value otherwise and rte_errno is set.
662 */
663static int
664mlx4_flow_prepare(struct mlx4_priv *priv,
665 const struct rte_flow_attr *attr,
666 const struct rte_flow_item pattern[],
667 const struct rte_flow_action actions[],
668 struct rte_flow_error *error,
669 struct rte_flow **addr)
670{
671 const struct rte_flow_item *item;
672 const struct rte_flow_action *action;
673 const struct mlx4_flow_proc_item *proc;
674 struct rte_flow temp = { .ibv_attr_size = sizeof(*temp.ibv_attr) };
675 struct rte_flow *flow = &temp;
676 const char *msg = NULL;
677 int overlap;
678
679 if (attr->group)
680 return rte_flow_error_set
681 (error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ATTR_GROUP,
682 NULL, "groups are not supported");
683 if (attr->priority > MLX4_FLOW_PRIORITY_LAST)
684 return rte_flow_error_set
685 (error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY,
686 NULL, "maximum priority level is "
687 MLX4_STR_EXPAND(MLX4_FLOW_PRIORITY_LAST));
688 if (attr->egress)
689 return rte_flow_error_set
690 (error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ATTR_EGRESS,
691 NULL, "egress is not supported");
692 if (attr->transfer)
693 return rte_flow_error_set
694 (error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ATTR_TRANSFER,
695 NULL, "transfer is not supported");
696 if (!attr->ingress)
697 return rte_flow_error_set
698 (error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ATTR_INGRESS,
699 NULL, "only ingress is supported");
700fill:
701 overlap = 0;
702 proc = mlx4_flow_proc_item_list;
703 flow->priority = attr->priority;
704 /* Go over pattern. */
705 for (item = pattern; item->type; ++item) {
706 const struct mlx4_flow_proc_item *next = NULL;
707 unsigned int i;
708 int err;
709
710 if (item->type == RTE_FLOW_ITEM_TYPE_VOID)
711 continue;
712 if (item->type == MLX4_FLOW_ITEM_TYPE_INTERNAL) {
713 flow->internal = 1;
714 continue;
715 }
716 if ((item->type != RTE_FLOW_ITEM_TYPE_VLAN && flow->promisc) ||
717 flow->allmulti) {
718 msg = "mlx4 does not support additional matching"
719 " criteria combined with indiscriminate"
720 " matching on Ethernet headers";

Callers 2

mlx4_flow_validateFunction · 0.85
mlx4_flow_createFunction · 0.85

Calls 7

rte_flow_error_setFunction · 0.85
mlx4_flow_item_checkFunction · 0.85
mlx4_rss_getFunction · 0.85
mlx4_conv_rss_typesFunction · 0.85
mlx4_rss_putFunction · 0.85
mlx4_zmallocvFunction · 0.85
rte_is_power_of_2Function · 0.50

Tested by

no test coverage detected