1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright 2018-2024 NXP 3 */ 4 5 #ifndef _RTE_PMD_DPAA2_H 6 #define _RTE_PMD_DPAA2_H 7 8 /** 9 * @file rte_pmd_dpaa2.h 10 * 11 * NXP dpaa2 PMD specific functions. 12 */ 13 14 #include <rte_compat.h> 15 #include <rte_flow.h> 16 17 /** 18 * Create a flow rule to demultiplex ethernet traffic to separate network 19 * interfaces. 20 * 21 * @param dpdmux_id 22 * ID of the DPDMUX MC object. 23 * @param[in] pattern 24 * Pattern specification. 25 * @param[in] actions 26 * Associated actions. 27 * 28 * @return 29 * 0 in case of success, otherwise failure. 30 */ 31 int 32 rte_pmd_dpaa2_mux_flow_create(uint32_t dpdmux_id, 33 struct rte_flow_item pattern[], 34 struct rte_flow_action actions[]); 35 int 36 rte_pmd_dpaa2_mux_flow_destroy(uint32_t dpdmux_id, 37 uint16_t entry_index); 38 int 39 rte_pmd_dpaa2_mux_flow_l2(uint32_t dpdmux_id, 40 uint8_t mac_addr[6], uint16_t vlan_id, int dest_if); 41 42 /** 43 * @warning 44 * @b EXPERIMENTAL: this API may change, or be removed, without prior notice 45 * 46 * Dump demultiplex ethernet traffic counters 47 * 48 * @param f 49 * output stream 50 * @param dpdmux_id 51 * ID of the DPDMUX MC object. 52 * @param num_if 53 * number of interface in dpdmux object 54 * 55 */ 56 __rte_experimental 57 void 58 rte_pmd_dpaa2_mux_dump_counter(FILE *f, uint32_t dpdmux_id, int num_if); 59 60 /** 61 * @warning 62 * @b EXPERIMENTAL: this API may change, or be removed, without prior notice 63 * 64 * demultiplex interface max rx frame length configure 65 * 66 * @param dpdmux_id 67 * ID of the DPDMUX MC object. 68 * @param max_rx_frame_len 69 * maximum receive frame length (will be checked to be minimux of all dpnis) 70 * 71 */ 72 __rte_experimental 73 int 74 rte_pmd_dpaa2_mux_rx_frame_len(uint32_t dpdmux_id, uint16_t max_rx_frame_len); 75 76 /** 77 * Create a custom hash key on basis of offset of start of packet and size. 78 * for e.g. if we need GRE packets (non-vlan and without any extra headers) 79 * to be hashed on basis of inner IP header, we will provide offset as: 80 * 14 (eth) + 20 (IP) + 4 (GRE) + 12 (Inner Src offset) = 50 and size 81 * as 8 bytes. 82 * 83 * @param port_id 84 * The port identifier of the Ethernet device. 85 * @param offset 86 * Offset from the start of packet which needs to be included to 87 * calculate hash 88 * @param size 89 * Size of the hash input key 90 * 91 * @return 92 * - 0 if successful. 93 * - Negative in case of failure. 94 */ 95 int 96 rte_pmd_dpaa2_set_custom_hash(uint16_t port_id, 97 uint16_t offset, 98 uint8_t size); 99 100 /** 101 * @warning 102 * @b EXPERIMENTAL: this API may change, or be removed, without prior notice 103 * 104 * Do thread specific initialization 105 */ 106 __rte_experimental 107 void 108 rte_pmd_dpaa2_thread_init(void); 109 110 /** 111 * @warning 112 * @b EXPERIMENTAL: this API may change, or be removed, without prior notice 113 * 114 * Generate the DPAA2 WRIOP based hash value 115 * 116 * @param key 117 * Array of key data 118 * @param size 119 * Size of the hash input key in bytes 120 * 121 * @return 122 * - 0 if successful. 123 * - Negative in case of failure. 124 */ 125 126 __rte_experimental 127 uint32_t 128 rte_pmd_dpaa2_get_tlu_hash(uint8_t *key, int size); 129 130 __rte_experimental 131 int 132 rte_pmd_dpaa2_dev_is_dpaa2(uint32_t eth_id); 133 __rte_experimental 134 const char * 135 rte_pmd_dpaa2_ep_name(uint32_t eth_id); 136 137 #if defined(RTE_LIBRTE_IEEE1588) 138 __rte_experimental 139 int 140 rte_pmd_dpaa2_set_one_step_ts(uint16_t port_id, uint16_t offset, uint8_t ch_update); 141 142 __rte_experimental 143 int 144 rte_pmd_dpaa2_get_one_step_ts(uint16_t port_id, bool mc_query); 145 #endif 146 #endif /* _RTE_PMD_DPAA2_H */ 147