1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, v.1, (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://opensource.org/licenses/CDDL-1.0. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22 /* 23 * Copyright 2014-2017 Cavium, Inc. 24 * The contents of this file are subject to the terms of the Common Development 25 * and Distribution License, v.1, (the "License"). 26 27 * You may not use this file except in compliance with the License. 28 29 * You can obtain a copy of the License at available 30 * at http://opensource.org/licenses/CDDL-1.0 31 32 * See the License for the specific language governing permissions and 33 * limitations under the License. 34 */ 35 36 #ifndef __ECORE_OOO_H__ 37 #define __ECORE_OOO_H__ 38 39 #include "ecore.h" 40 41 #define ECORE_MAX_NUM_ISLES 256 42 #define ECORE_MAX_NUM_OOO_HISTORY_ENTRIES 512 43 44 #define ECORE_OOO_LEFT_BUF 0 45 #define ECORE_OOO_RIGHT_BUF 1 46 47 struct ecore_ooo_buffer { 48 osal_list_entry_t list_entry; 49 void *rx_buffer_virt_addr; 50 dma_addr_t rx_buffer_phys_addr; 51 u32 rx_buffer_size; 52 u16 packet_length; 53 u16 parse_flags; 54 u16 vlan; 55 u8 placement_offset; 56 }; 57 58 struct ecore_ooo_isle { 59 osal_list_entry_t list_entry; 60 osal_list_t buffers_list; 61 }; 62 63 struct ecore_ooo_archipelago { 64 osal_list_t isles_list; 65 }; 66 67 struct ecore_ooo_history { 68 struct ooo_opaque *p_cqes; 69 u32 head_idx; 70 u32 num_of_cqes; 71 }; 72 73 struct ecore_ooo_info { 74 osal_list_t free_buffers_list; 75 osal_list_t ready_buffers_list; 76 osal_list_t free_isles_list; 77 struct ecore_ooo_archipelago *p_archipelagos_mem; 78 struct ecore_ooo_isle *p_isles_mem; 79 struct ecore_ooo_history ooo_history; 80 u32 cur_isles_number; 81 u32 max_isles_number; 82 u32 gen_isles_number; 83 u16 max_num_archipelagos; 84 u16 cid_base; 85 }; 86 87 enum _ecore_status_t ecore_ooo_alloc(struct ecore_hwfn *p_hwfn); 88 89 void ecore_ooo_setup(struct ecore_hwfn *p_hwfn); 90 91 void ecore_ooo_free(struct ecore_hwfn *p_hwfn); 92 93 void ecore_ooo_save_history_entry(struct ecore_hwfn *p_hwfn, 94 struct ecore_ooo_info *p_ooo_info, 95 struct ooo_opaque *p_cqe); 96 97 void ecore_ooo_release_connection_isles(struct ecore_hwfn *p_hwfn, 98 struct ecore_ooo_info *p_ooo_info, 99 u32 cid); 100 101 void ecore_ooo_release_all_isles(struct ecore_hwfn *p_hwfn, 102 struct ecore_ooo_info *p_ooo_info); 103 104 void ecore_ooo_put_free_buffer(struct ecore_hwfn *p_hwfn, 105 struct ecore_ooo_info *p_ooo_info, 106 struct ecore_ooo_buffer *p_buffer); 107 108 struct ecore_ooo_buffer * 109 ecore_ooo_get_free_buffer(struct ecore_hwfn *p_hwfn, 110 struct ecore_ooo_info *p_ooo_info); 111 112 void ecore_ooo_put_ready_buffer(struct ecore_hwfn *p_hwfn, 113 struct ecore_ooo_info *p_ooo_info, 114 struct ecore_ooo_buffer *p_buffer, 115 u8 on_tail); 116 117 struct ecore_ooo_buffer * 118 ecore_ooo_get_ready_buffer(struct ecore_hwfn *p_hwfn, 119 struct ecore_ooo_info *p_ooo_info); 120 121 void ecore_ooo_delete_isles(struct ecore_hwfn *p_hwfn, 122 struct ecore_ooo_info *p_ooo_info, 123 u32 cid, 124 u8 drop_isle, 125 u8 drop_size); 126 127 void ecore_ooo_add_new_isle(struct ecore_hwfn *p_hwfn, 128 struct ecore_ooo_info *p_ooo_info, 129 u32 cid, 130 u8 ooo_isle, 131 struct ecore_ooo_buffer *p_buffer); 132 133 void ecore_ooo_add_new_buffer(struct ecore_hwfn *p_hwfn, 134 struct ecore_ooo_info *p_ooo_info, 135 u32 cid, 136 u8 ooo_isle, 137 struct ecore_ooo_buffer *p_buffer, 138 u8 buffer_side); 139 140 void ecore_ooo_join_isles(struct ecore_hwfn *p_hwfn, 141 struct ecore_ooo_info *p_ooo_info, 142 u32 cid, 143 u8 left_isle); 144 145 void ecore_ooo_dump_rx_event(struct ecore_hwfn *p_hwfn, 146 struct ooo_opaque *iscsi_ooo, 147 struct ecore_ooo_buffer *p_buffer); 148 149 #endif /*__ECORE_OOO_H__*/ 150 151