* Get new thread specific flow workspace. * * If current workspace inuse, create new one and set as current. * * @return pointer to thread specific flow workspace data, NULL on error. */
| 8252 | * @return pointer to thread specific flow workspace data, NULL on error. |
| 8253 | */ |
| 8254 | struct mlx5_flow_workspace* |
| 8255 | mlx5_flow_push_thread_workspace(void) |
| 8256 | { |
| 8257 | struct mlx5_flow_workspace *curr; |
| 8258 | struct mlx5_flow_workspace *data; |
| 8259 | |
| 8260 | curr = mlx5_flow_os_get_specific_workspace(); |
| 8261 | if (!curr) { |
| 8262 | data = flow_alloc_thread_workspace(); |
| 8263 | if (!data) |
| 8264 | return NULL; |
| 8265 | mlx5_flow_os_workspace_gc_add(data); |
| 8266 | } else if (!curr->inuse) { |
| 8267 | data = curr; |
| 8268 | } else if (curr->next) { |
| 8269 | data = curr->next; |
| 8270 | } else { |
| 8271 | data = flow_alloc_thread_workspace(); |
| 8272 | if (!data) |
| 8273 | return NULL; |
| 8274 | curr->next = data; |
| 8275 | data->prev = curr; |
| 8276 | } |
| 8277 | data->inuse = 1; |
| 8278 | data->flow_idx = 0; |
| 8279 | /* Set as current workspace */ |
| 8280 | if (mlx5_flow_os_set_specific_workspace(data)) |
| 8281 | DRV_LOG(ERR, "Failed to set flow workspace to thread."); |
| 8282 | return data; |
| 8283 | } |
| 8284 | |
| 8285 | /** |
| 8286 | * Close current thread specific flow workspace. |
no test coverage detected