1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2020 Intel Corporation 3 */ 4 5 /*! 6 * @file rte_pmd_dlb2.h 7 * 8 * @brief DLB PMD-specific functions 9 */ 10 11 #ifndef _RTE_PMD_DLB2_H_ 12 #define _RTE_PMD_DLB2_H_ 13 14 #include <stdint.h> 15 16 #include <rte_compat.h> 17 18 #ifdef __cplusplus 19 extern "C" { 20 #endif 21 22 /** 23 * Macro function to get QID depth of rte_event metadata. 24 * Currently lower 2 bits of 'rsvd' field are used to store QID depth. 25 */ 26 #define RTE_PMD_DLB2_GET_QID_DEPTH(x) ((x)->rsvd & 0x3) 27 28 /** 29 * Macro function to set QID depth of rte_event metadata. 30 * Currently lower 2 bits of 'rsvd' field are used to store QID depth. 31 */ 32 #define RTE_PMD_DLB2_SET_QID_DEPTH(x, v) ((x)->rsvd = ((x)->rsvd & ~0x3) | (v & 0x3)) 33 34 /** 35 * Macro function to get QE weight from rte_event metadata. 36 * Currently upper 2 bits of 'rsvd' field are used to store QE weight. 37 */ 38 #define RTE_PMD_DLB2_GET_QE_WEIGHT(x) (((x)->rsvd >> 2) & 0x3) 39 40 /** 41 * Macro function to set QE weight from rte_event metadata. 42 * Currently upper 2 bits of 'rsvd' field are used to store QE weight. 43 */ 44 #define RTE_PMD_DLB2_SET_QE_WEIGHT(x, v) ((x)->rsvd = ((x)->rsvd & 0x3) | ((v & 0x3) << 2)) 45 46 /** 47 * @warning 48 * @b EXPERIMENTAL: this API may change, or be removed, without prior notice 49 * 50 * Selects the token pop mode for a DLB2 port. 51 */ 52 enum dlb2_token_pop_mode { 53 /* Pop the CQ tokens immediately after dequeuing. */ 54 AUTO_POP, 55 /* Pop CQ tokens after (dequeue_depth - 1) events are released. 56 * Supported on load-balanced ports only. 57 */ 58 DELAYED_POP, 59 /* Pop the CQ tokens during next dequeue operation. */ 60 DEFERRED_POP, 61 62 /* NUM_TOKEN_POP_MODES must be last */ 63 NUM_TOKEN_POP_MODES 64 }; 65 66 /*! 67 * @warning 68 * @b EXPERIMENTAL: this API may change, or be removed, without prior notice 69 * 70 * Configure the token pop mode for a DLB2 port. By default, all ports use 71 * AUTO_POP. This function must be called before calling rte_event_port_setup() 72 * for the port, but after calling rte_event_dev_configure(). 73 * 74 * @param dev_id 75 * The identifier of the event device. 76 * @param port_id 77 * The identifier of the event port. 78 * @param mode 79 * The token pop mode. 80 * 81 * @return 82 * - 0: Success 83 * - EINVAL: Invalid dev_id, port_id, or mode 84 * - EINVAL: The DLB2 is not configured, is already running, or the port is 85 * already setup 86 */ 87 88 __rte_experimental 89 int 90 rte_pmd_dlb2_set_token_pop_mode(uint8_t dev_id, 91 uint8_t port_id, 92 enum dlb2_token_pop_mode mode); 93 94 #ifdef __cplusplus 95 } 96 #endif 97 98 #endif /* _RTE_PMD_DLB2_H_ */ 99