cfgfile: fix leak on creation error
[dpdk.git] / drivers / net / mlx5 / mlx5_flow.c
index 452fde5..f392f1f 100644 (file)
@@ -786,6 +786,8 @@ priv_flow_convert_actions(struct priv *priv,
                        goto exit_action_not_supported;
                }
        }
+       if (parser->drop && parser->mark)
+               parser->mark = 0;
        if (!parser->queues_n && !parser->drop) {
                rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_HANDLE,
                                   NULL, "no valid action");
@@ -1172,9 +1174,17 @@ priv_flow_convert(struct priv *priv,
         * Last step. Complete missing specification to reach the RSS
         * configuration.
         */
-       if (parser->queues_n > 1) {
+       if (parser->drop) {
+               /*
+                * Drop queue priority needs to be adjusted to
+                * their most specific layer priority.
+                */
+               parser->drop_q.ibv_attr->priority =
+                       attr->priority +
+                       hash_rxq_init[parser->layer].flow_priority;
+       } else if (parser->queues_n > 1) {
                priv_flow_convert_finalise(priv, parser);
-       } else if (!parser->drop) {
+       } else {
                /*
                 * Action queue have their priority overridden with
                 * Ethernet priority, this priority needs to be adjusted to
@@ -1679,9 +1689,9 @@ priv_flow_create_action_queue_drop(struct priv *priv,
        };
        ++parser->drop_q.ibv_attr->num_of_specs;
        parser->drop_q.offset += size;
+       flow->drxq.ibv_attr = parser->drop_q.ibv_attr;
        if (!priv->dev->data->dev_started)
                return 0;
-       flow->drxq.ibv_attr = parser->drop_q.ibv_attr;
        parser->drop_q.ibv_attr = NULL;
        flow->drxq.ibv_flow = ibv_create_flow(priv->flow_drop_queue->qp,
                                              flow->drxq.ibv_attr);
@@ -2601,20 +2611,27 @@ priv_fdir_filter_convert(struct priv *priv,
                ERROR("invalid queue number %d", fdir_filter->action.rx_queue);
                return EINVAL;
        }
-       /* Validate the behavior. */
-       if (fdir_filter->action.behavior != RTE_ETH_FDIR_ACCEPT) {
-               ERROR("invalid behavior %d", fdir_filter->action.behavior);
-               return ENOTSUP;
-       }
        attributes->attr.ingress = 1;
        attributes->items[0] = (struct rte_flow_item) {
                .type = RTE_FLOW_ITEM_TYPE_ETH,
                .spec = &attributes->l2,
        };
-       attributes->actions[0] = (struct rte_flow_action){
-               .type = RTE_FLOW_ACTION_TYPE_QUEUE,
-               .conf = &attributes->queue,
-       };
+       switch (fdir_filter->action.behavior) {
+       case RTE_ETH_FDIR_ACCEPT:
+               attributes->actions[0] = (struct rte_flow_action){
+                       .type = RTE_FLOW_ACTION_TYPE_QUEUE,
+                       .conf = &attributes->queue,
+               };
+               break;
+       case RTE_ETH_FDIR_REJECT:
+               attributes->actions[0] = (struct rte_flow_action){
+                       .type = RTE_FLOW_ACTION_TYPE_DROP,
+               };
+               break;
+       default:
+               ERROR("invalid behavior %d", fdir_filter->action.behavior);
+               return ENOTSUP;
+       }
        attributes->queue.index = fdir_filter->action.rx_queue;
        switch (fdir_filter->input.flow_type) {
        case RTE_ETH_FLOW_NONFRAG_IPV4_UDP:
@@ -2783,7 +2800,6 @@ priv_fdir_filter_add(struct priv *priv,
                                attributes.actions,
                                &error);
        if (flow) {
-               TAILQ_INSERT_TAIL(&priv->flows, flow, next);
                DEBUG("FDIR created %p", (void *)flow);
                return 0;
        }