ecore_ooo.h revision 337517
1321369Sdim/* 2234285Sdim * Copyright (c) 2017-2018 Cavium, Inc. 3353358Sdim * All rights reserved. 4353358Sdim * 5353358Sdim * Redistribution and use in source and binary forms, with or without 6234285Sdim * modification, are permitted provided that the following conditions 7234285Sdim * are met: 8234285Sdim * 9234285Sdim * 1. Redistributions of source code must retain the above copyright 10234285Sdim * notice, this list of conditions and the following disclaimer. 11234285Sdim * 2. Redistributions in binary form must reproduce the above copyright 12234285Sdim * notice, this list of conditions and the following disclaimer in the 13234285Sdim * documentation and/or other materials provided with the distribution. 14234285Sdim * 15234285Sdim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16234285Sdim * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17234285Sdim * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18234285Sdim * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19234285Sdim * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20234285Sdim * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21234285Sdim * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22234285Sdim * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23234285Sdim * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24234285Sdim * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25234285Sdim * POSSIBILITY OF SUCH DAMAGE. 26234285Sdim * 27234285Sdim * $FreeBSD: stable/11/sys/dev/qlnx/qlnxe/ecore_ooo.h 337517 2018-08-09 01:17:35Z davidcs $ 28234285Sdim * 29234285Sdim */ 30234285Sdim 31234285Sdim#ifndef __ECORE_OOO_H__ 32234285Sdim#define __ECORE_OOO_H__ 33234285Sdim 34234285Sdim#include "ecore.h" 35234285Sdim 36234285Sdim#define ECORE_MAX_NUM_ISLES 256 37249423Sdim#define ECORE_MAX_NUM_OOO_HISTORY_ENTRIES 512 38249423Sdim 39234285Sdim#define ECORE_OOO_LEFT_BUF 0 40234285Sdim#define ECORE_OOO_RIGHT_BUF 1 41234285Sdim 42234285Sdimstruct ecore_ooo_buffer { 43321369Sdim osal_list_entry_t list_entry; 44321369Sdim void *rx_buffer_virt_addr; 45321369Sdim dma_addr_t rx_buffer_phys_addr; 46261991Sdim u32 rx_buffer_size; 47321369Sdim u16 packet_length; 48321369Sdim u16 parse_flags; 49314564Sdim u16 vlan; 50234285Sdim u8 placement_offset; 51234285Sdim}; 52321369Sdim 53288943Sdimstruct ecore_ooo_isle { 54234285Sdim osal_list_entry_t list_entry; 55321369Sdim osal_list_t buffers_list; 56288943Sdim}; 57234285Sdim 58234285Sdimstruct ecore_ooo_archipelago { 59234285Sdim osal_list_t isles_list; 60321369Sdim}; 61234285Sdim 62234285Sdimstruct ecore_ooo_history { 63234285Sdim struct ooo_opaque *p_cqes; 64234285Sdim u32 head_idx; 65234285Sdim u32 num_of_cqes; 66341825Sdim}; 67276479Sdim 68234285Sdimstruct ecore_ooo_info { 69234285Sdim osal_list_t free_buffers_list; 70341825Sdim osal_list_t ready_buffers_list; 71234285Sdim osal_list_t free_isles_list; 72276479Sdim struct ecore_ooo_archipelago *p_archipelagos_mem; 73234285Sdim struct ecore_ooo_isle *p_isles_mem; 74234285Sdim struct ecore_ooo_history ooo_history; 75341825Sdim u32 cur_isles_number; 76341825Sdim u32 max_isles_number; 77341825Sdim u32 gen_isles_number; 78341825Sdim u16 max_num_archipelagos; 79341825Sdim u16 cid_base; 80234285Sdim}; 81341825Sdim 82234285Sdim#if defined(CONFIG_ECORE_ISCSI) || defined(CONFIG_ECORE_IWARP) 83234285Sdimenum _ecore_status_t ecore_ooo_alloc(struct ecore_hwfn *p_hwfn); 84234285Sdim 85341825Sdimvoid ecore_ooo_setup(struct ecore_hwfn *p_hwfn); 86314564Sdim 87314564Sdimvoid ecore_ooo_free(struct ecore_hwfn *p_hwfn); 88249423Sdim#else 89314564Sdimstatic inline enum _ecore_status_t 90314564Sdimecore_ooo_alloc(struct ecore_hwfn OSAL_UNUSED *p_hwfn) 91234285Sdim{ 92234285Sdim return ECORE_INVAL; 93234285Sdim} 94234285Sdim 95234285Sdimstatic inline void 96234285Sdimecore_ooo_setup(struct ecore_hwfn OSAL_UNUSED *p_hwfn) {} 97321369Sdim 98234285Sdimstatic inline void 99234285Sdimecore_ooo_free(struct ecore_hwfn OSAL_UNUSED *p_hwfn) {} 100234285Sdim#endif 101234285Sdim 102234285Sdim 103234285Sdimvoid ecore_ooo_save_history_entry(struct ecore_ooo_info *p_ooo_info, 104234285Sdim struct ooo_opaque *p_cqe); 105234285Sdim 106321369Sdimvoid ecore_ooo_release_connection_isles(struct ecore_ooo_info *p_ooo_info, 107321369Sdim u32 cid); 108276479Sdim 109276479Sdimvoid ecore_ooo_release_all_isles(struct ecore_ooo_info *p_ooo_info); 110234285Sdim 111234285Sdimvoid ecore_ooo_put_free_buffer(struct ecore_ooo_info *p_ooo_info, 112341825Sdim struct ecore_ooo_buffer *p_buffer); 113234285Sdim 114276479Sdimstruct ecore_ooo_buffer * 115276479Sdimecore_ooo_get_free_buffer(struct ecore_ooo_info *p_ooo_info); 116234285Sdim 117234285Sdimvoid ecore_ooo_put_ready_buffer(struct ecore_ooo_info *p_ooo_info, 118234285Sdim struct ecore_ooo_buffer *p_buffer, u8 on_tail); 119234285Sdim 120288943Sdimstruct ecore_ooo_buffer * 121234285Sdimecore_ooo_get_ready_buffer(struct ecore_ooo_info *p_ooo_info); 122234285Sdim 123234285Sdimvoid ecore_ooo_delete_isles(struct ecore_hwfn *p_hwfn, 124234285Sdim struct ecore_ooo_info *p_ooo_info, 125234285Sdim u32 cid, 126234285Sdim u8 drop_isle, 127276479Sdim u8 drop_size); 128261991Sdim 129234285Sdimvoid ecore_ooo_add_new_isle(struct ecore_hwfn *p_hwfn, 130341825Sdim struct ecore_ooo_info *p_ooo_info, 131341825Sdim u32 cid, 132341825Sdim u8 ooo_isle, 133341825Sdim struct ecore_ooo_buffer *p_buffer); 134341825Sdim 135321369Sdimvoid ecore_ooo_add_new_buffer(struct ecore_hwfn *p_hwfn, 136321369Sdim struct ecore_ooo_info *p_ooo_info, 137321369Sdim u32 cid, 138321369Sdim u8 ooo_isle, 139321369Sdim struct ecore_ooo_buffer *p_buffer, 140321369Sdim u8 buffer_side); 141321369Sdim 142321369Sdimvoid ecore_ooo_join_isles(struct ecore_hwfn *p_hwfn, 143321369Sdim struct ecore_ooo_info *p_ooo_info, 144321369Sdim u32 cid, 145321369Sdim u8 left_isle); 146321369Sdim 147341825Sdimvoid ecore_ooo_dump_rx_event(struct ecore_hwfn *p_hwfn, 148234285Sdim struct ooo_opaque *iscsi_ooo, 149234285Sdim struct ecore_ooo_buffer *p_buffer); 150234285Sdim 151341825Sdim#endif /*__ECORE_OOO_H__*/ 152261991Sdim 153261991Sdim