* Create a flow. * * @see rte_flow_create() * @see rte_flow_ops */
| 1137 | * @see rte_flow_ops |
| 1138 | */ |
| 1139 | static struct rte_flow * |
| 1140 | mlx4_flow_create(struct rte_eth_dev *dev, |
| 1141 | const struct rte_flow_attr *attr, |
| 1142 | const struct rte_flow_item pattern[], |
| 1143 | const struct rte_flow_action actions[], |
| 1144 | struct rte_flow_error *error) |
| 1145 | { |
| 1146 | struct mlx4_priv *priv = dev->data->dev_private; |
| 1147 | struct rte_flow *flow; |
| 1148 | int err; |
| 1149 | |
| 1150 | err = mlx4_flow_prepare(priv, attr, pattern, actions, error, &flow); |
| 1151 | if (err) |
| 1152 | return NULL; |
| 1153 | err = mlx4_flow_toggle(priv, flow, priv->started, error); |
| 1154 | if (!err) { |
| 1155 | struct rte_flow *curr = LIST_FIRST(&priv->flows); |
| 1156 | |
| 1157 | /* New rules are inserted after internal ones. */ |
| 1158 | if (!curr || !curr->internal) { |
| 1159 | LIST_INSERT_HEAD(&priv->flows, flow, next); |
| 1160 | } else { |
| 1161 | while (LIST_NEXT(curr, next) && |
| 1162 | LIST_NEXT(curr, next)->internal) |
| 1163 | curr = LIST_NEXT(curr, next); |
| 1164 | LIST_INSERT_AFTER(curr, flow, next); |
| 1165 | } |
| 1166 | return flow; |
| 1167 | } |
| 1168 | if (flow->rss) |
| 1169 | mlx4_rss_put(flow->rss); |
| 1170 | rte_flow_error_set(error, -err, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, |
| 1171 | error->message); |
| 1172 | rte_free(flow); |
| 1173 | return NULL; |
| 1174 | } |
| 1175 | |
| 1176 | /** |
| 1177 | * Configure isolated mode. |
no test coverage detected