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.
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.
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]
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").
27 * You may not use this file except in compliance with the License.
29 * You can obtain a copy of the License at available
30 * at http://opensource.org/licenses/CDDL-1.0
32 * See the License for the specific language governing permissions and
33 * limitations under the License.
36 #ifndef __ECORE_LL2_H__
37 #define __ECORE_LL2_H__
40 #include "ecore_hsi_eth.h"
41 #include "ecore_chain.h"
42 #include "ecore_hsi_common.h"
43 #include "ecore_ll2_api.h"
44 #include "ecore_sp_api.h"
46 /* ECORE LL2: internal structures and functions*/
47 #define ECORE_MAX_NUM_OF_LL2_CONNECTIONS (4)
49 static OSAL_INLINE u8
ecore_ll2_handle_to_queue_id(struct ecore_hwfn
*p_hwfn
,
52 return p_hwfn
->hw_info
.resc_start
[ECORE_LL2_QUEUE
] + handle
;
55 struct ecore_ll2_rx_packet
57 osal_list_entry_t list_entry
;
58 struct core_rx_bd_with_buff_len
*rxq_bd
;
59 dma_addr_t rx_buf_addr
;
69 struct ecore_ll2_tx_packet
71 osal_list_entry_t list_entry
;
76 struct core_tx_bd
*txq_bd
;
80 /* Flexible Array of bds_set determined by max_bds_per_packet */
83 struct ecore_ll2_rx_queue
{
85 struct ecore_chain rxq_chain
;
86 struct ecore_chain rcq_chain
;
90 osal_list_t active_descq
;
91 osal_list_t free_descq
;
92 osal_list_t posting_descq
;
93 struct ecore_ll2_rx_packet
*descq_array
;
94 void OSAL_IOMEM
*set_prod_addr
;
97 struct ecore_ll2_tx_queue
{
99 struct ecore_chain txq_chain
;
103 osal_list_t active_descq
;
104 osal_list_t free_descq
;
105 osal_list_t sending_descq
;
106 struct ecore_ll2_tx_packet
*descq_array
;
107 struct ecore_ll2_tx_packet
*cur_send_packet
;
108 struct ecore_ll2_tx_packet cur_completing_packet
;
109 u16 cur_completing_bd_idx
;
110 void OSAL_IOMEM
*doorbell_addr
;
112 u16 cur_send_frag_num
;
113 u16 cur_completing_frag_num
;
114 bool b_completing_packet
;
117 struct ecore_ll2_info
{
119 enum ecore_ll2_conn_type conn_type
;
127 u8 rx_vlan_removal_en
;
129 u8 tx_max_bds_per_packet
;
130 enum core_tx_dest tx_dest
;
131 enum core_error_handle ai_err_packet_too_big
;
132 enum core_error_handle ai_err_no_buf
;
136 struct ecore_ll2_rx_queue rx_queue
;
137 struct ecore_ll2_tx_queue tx_queue
;
138 struct ecore_ll2_cbs cbs
;
142 * @brief ecore_ll2_alloc - Allocates LL2 connections set
146 * @return enum _ecore_status_t
148 enum _ecore_status_t
ecore_ll2_alloc(struct ecore_hwfn
*p_hwfn
);
151 * @brief ecore_ll2_setup - Inits LL2 connections set
156 void ecore_ll2_setup(struct ecore_hwfn
*p_hwfn
);
159 * @brief ecore_ll2_free - Releases LL2 connections set
164 void ecore_ll2_free(struct ecore_hwfn
*p_hwfn
);
168 * @brief ecore_ll2_get_fragment_of_tx_packet
171 * @param connection_handle LL2 connection's handle
173 * ecore_ll2_require_connection
175 * @param last_fragment)
177 * @return enum _ecore_status_t
180 ecore_ll2_get_fragment_of_tx_packet(struct ecore_hwfn
*p_hwfn
,
181 u8 connection_handle
,
183 bool *last_fragment
);
186 #endif /*__ECORE_LL2_H__*/