net/mlx5: add queue and RSS HW steering action
[dpdk.git] / drivers / net / mlx5 / linux / mlx5_flow_os.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright 2020 Mellanox Technologies, Ltd
3  */
4
5 #include "mlx5_flow_os.h"
6
7 #include <rte_thread.h>
8
9 /* Key of thread specific flow workspace data. */
10 static rte_thread_key key_workspace;
11
12 int
13 mlx5_flow_os_init_workspace_once(void)
14 {
15         if (rte_thread_key_create(&key_workspace, flow_release_workspace)) {
16                 DRV_LOG(ERR, "Can't create flow workspace data thread key.");
17                 rte_errno = ENOMEM;
18                 return -rte_errno;
19         }
20         return 0;
21 }
22
23 void *
24 mlx5_flow_os_get_specific_workspace(void)
25 {
26         return rte_thread_value_get(key_workspace);
27 }
28
29 int
30 mlx5_flow_os_set_specific_workspace(struct mlx5_flow_workspace *data)
31 {
32         return rte_thread_value_set(key_workspace, data);
33 }
34
35 void
36 mlx5_flow_os_release_workspace(void)
37 {
38         rte_thread_key_delete(key_workspace);
39 }