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#ifdef __cplusplus 17extern "C" { 18#endif 19 20#define RTE_PMD_MLX5_FINE_GRANULARITY_INLINE "mlx5_fine_granularity_inline" 21 22/** 23 * Returns the dynamic flags name, that are supported. 24 * 25 * @param[out] names 26 * Array that is used to return the supported dynamic flags names. 27 * @param[in] n 28 * The number of elements in the names array. 29 * 30 * @return 31 * The number of dynamic flags that were copied if not negative. 32 * Otherwise: 33 * - ENOMEM - not enough entries in the array 34 * - EINVAL - invalid array entry 35 */ 36__rte_experimental 37int rte_pmd_mlx5_get_dyn_flag_names(char *names[], unsigned int n); 38 39#define MLX5_DOMAIN_BIT_NIC_RX (1 << 0) /**< NIC RX domain bit mask. */ 40#define MLX5_DOMAIN_BIT_NIC_TX (1 << 1) /**< NIC TX domain bit mask. */ 41#define MLX5_DOMAIN_BIT_FDB (1 << 2) /**< FDB (TX + RX) domain bit mask. */ 42 43/** 44 * Synchronize the flows to make them take effort on hardware. 45 * It only supports DR flows now. For DV and Verbs flows, there is no need to 46 * call this function, and a success will return directly in case of Verbs. 47 * 48 * @param[in] port_id 49 * The port identifier of the Ethernet device. 50 * @param[in] domains 51 * Refer to "/usr/include/infiniband/mlx5dv.h". 52 * Bitmask of domains in which the synchronization will be done. 53 * MLX5_DOMAIN_BIT* macros are used to specify the domains. 54 * An ADD or OR operation could be used to synchronize flows in more than 55 * one domain per call. 56 * 57 * @return 58 * - (0) if successful. 59 * - Negative value if an error. 60 */ 61__rte_experimental 62int rte_pmd_mlx5_sync_flow(uint16_t port_id, uint32_t domains); 63 64/** 65 * External Rx queue rte_flow index minimal value. 66 */ 67#define MLX5_EXTERNAL_RX_QUEUE_ID_MIN (UINT16_MAX - 1000 + 1) 68 69/** 70 * Update mapping between rte_flow queue index (16 bits) and HW queue index (32 71 * bits) for RxQs which is created outside the PMD. 72 * 73 * @param[in] port_id 74 * The port identifier of the Ethernet device. 75 * @param[in] dpdk_idx 76 * Queue index in rte_flow. 77 * @param[in] hw_idx 78 * Queue index in hardware. 79 * 80 * @return 81 * 0 on success, a negative errno value otherwise and rte_errno is set. 82 * Possible values for rte_errno: 83 * - EEXIST - a mapping with the same rte_flow index already exists. 84 * - EINVAL - invalid rte_flow index, out of range. 85 * - ENODEV - there is no Ethernet device for this port id. 86 * - ENOTSUP - the port doesn't support external RxQ. 87 */ 88__rte_experimental 89int rte_pmd_mlx5_external_rx_queue_id_map(uint16_t port_id, uint16_t dpdk_idx, 90 uint32_t hw_idx); 91 92/** 93 * Remove mapping between rte_flow queue index (16 bits) and HW queue index (32 94 * bits) for RxQs which is created outside the PMD. 95 * 96 * @param[in] port_id 97 * The port identifier of the Ethernet device. 98 * @param[in] dpdk_idx 99 * Queue index in rte_flow. 100 * 101 * @return 102 * 0 on success, a negative errno value otherwise and rte_errno is set. 103 * Possible values for rte_errno: 104 * - EINVAL - invalid index, out of range, still referenced or doesn't exist. 105 * - ENODEV - there is no Ethernet device for this port id. 106 * - ENOTSUP - the port doesn't support external RxQ. 107 */ 108__rte_experimental 109int rte_pmd_mlx5_external_rx_queue_id_unmap(uint16_t port_id, 110 uint16_t dpdk_idx); 111 112/** 113 * The rate of the host port shaper will be updated directly at the next 114 * available descriptor threshold event to the rate that comes with this flag set; 115 * set rate 0 to disable this rate update. 116 * Unset this flag to update the rate of the host port shaper directly in 117 * the API call; use rate 0 to disable the current shaper. 118 */ 119#define MLX5_HOST_SHAPER_FLAG_AVAIL_THRESH_TRIGGERED 0 120 121/** 122 * Configure a HW shaper to limit Tx rate for a host port. 123 * The configuration will affect all the ethdev ports belonging to 124 * the same rte_device. 125 * 126 * @param[in] port_id 127 * The port identifier of the Ethernet device. 128 * @param[in] rate 129 * Unit is 100Mbps, setting the rate to 0 disables the shaper. 130 * @param[in] flags 131 * Host shaper flags. 132 * @return 133 * 0 : operation success. 134 * Otherwise: 135 * - ENOENT - no ibdev interface. 136 * - EBUSY - the register access unit is busy. 137 * - EIO - the register access command meets IO error. 138 */ 139__rte_experimental 140int rte_pmd_mlx5_host_shaper_config(int port_id, uint8_t rate, uint32_t flags); 141 142#ifdef __cplusplus 143} 144#endif 145 146#endif /* RTE_PMD_PRIVATE_MLX5_H_ */ 147