net/mlx5: add flow sync API
[dpdk.git] / drivers / net / mlx5 / rte_pmd_mlx5.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright 2020 Mellanox Technologies, Ltd
3  */
4
5 #ifndef RTE_PMD_PRIVATE_MLX5_H_
6 #define RTE_PMD_PRIVATE_MLX5_H_
7
8 /**
9  * @file
10  * MLX5 public header.
11  *
12  * This interface provides the ability to support private PMD
13  * dynamic flags.
14  */
15
16 #define RTE_PMD_MLX5_FINE_GRANULARITY_INLINE "mlx5_fine_granularity_inline"
17
18 /**
19  * Returns the dynamic flags name, that are supported.
20  *
21  * @param[out] names
22  *   Array that is used to return the supported dynamic flags names.
23  * @param[in] n
24  *   The number of elements in the names array.
25  *
26  * @return
27  *   The number of dynamic flags that were copied if not negative.
28  *   Otherwise:
29  *   - ENOMEM - not enough entries in the array
30  *   - EINVAL - invalid array entry
31  */
32 __rte_experimental
33 int rte_pmd_mlx5_get_dyn_flag_names(char *names[], unsigned int n);
34
35 #define MLX5_DOMAIN_BIT_NIC_RX  (1 << 0) /**< NIC RX domain bit mask. */
36 #define MLX5_DOMAIN_BIT_NIC_TX  (1 << 1) /**< NIC TX domain bit mask. */
37 #define MLX5_DOMAIN_BIT_FDB     (1 << 2) /**< FDB (TX + RX) domain bit mask. */
38
39 /**
40  * Synchronize the flows to make them take effort on hardware.
41  * It only supports DR flows now. For DV and Verbs flows, there is no need to
42  * call this function, and a success will return directly in case of Verbs.
43  *
44  * @param[in] port_id
45  *   The port identifier of the Ethernet device.
46  * @param[in] domains
47  *   Refer to "/usr/include/infiniband/mlx5dv.h".
48  *   Bitmask of domains in which the synchronization will be done.
49  *   MLX5_DOMAIN_BIT* macros are used to specify the domains.
50  *   An ADD or OR operation could be used to synchronize flows in more than
51  *   one domain per call.
52  *
53  * @return
54  *   - (0) if successful.
55  *   - Negative value if an error.
56  */
57 __rte_experimental
58 int rte_pmd_mlx5_sync_flow(uint16_t port_id, uint32_t domains);
59
60 #endif