1/*
2 * Copyright (c) 2018-2019 Cavium, Inc.
3 * All rights reserved.
4 *
5 *  Redistribution and use in source and binary forms, with or without
6 *  modification, are permitted provided that the following conditions
7 *  are met:
8 *
9 *  1. Redistributions of source code must retain the above copyright
10 *     notice, this list of conditions and the following disclaimer.
11 *  2. Redistributions in binary form must reproduce the above copyright
12 *     notice, this list of conditions and the following disclaimer in the
13 *     documentation and/or other materials provided with the distribution.
14 *
15 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 *  POSSIBILITY OF SUCH DAMAGE.
26 */
27
28/*
29 * File : ecore_ooo.c
30 */
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD$");
33
34#include "bcm_osal.h"
35
36#include "ecore.h"
37#include "ecore_status.h"
38#include "ecore_ll2.h"
39#include "ecore_ooo.h"
40#include "ecore_iscsi.h"
41#include "ecore_cxt.h"
42/*
43 * Static OOO functions
44 */
45
46static struct ecore_ooo_archipelago *
47ecore_ooo_seek_archipelago(struct ecore_ooo_info *p_ooo_info, u32 cid)
48{
49	u32 idx = (cid & 0xffff) - p_ooo_info->cid_base;
50	struct ecore_ooo_archipelago *p_archipelago;
51
52	if (idx >= p_ooo_info->max_num_archipelagos)
53		return OSAL_NULL;
54
55	p_archipelago = &p_ooo_info->p_archipelagos_mem[idx];
56
57	if (OSAL_LIST_IS_EMPTY(&p_archipelago->isles_list))
58		return OSAL_NULL;
59
60	return p_archipelago;
61}
62
63static struct ecore_ooo_isle *ecore_ooo_seek_isle(struct ecore_hwfn *p_hwfn,
64						  struct ecore_ooo_info *p_ooo_info,
65						  u32 cid, u8 isle)
66{
67	struct ecore_ooo_archipelago *p_archipelago = OSAL_NULL;
68	struct ecore_ooo_isle *p_isle = OSAL_NULL;
69	u8 the_num_of_isle = 1;
70
71	p_archipelago = ecore_ooo_seek_archipelago(p_ooo_info, cid);
72	if (!p_archipelago) {
73		DP_NOTICE(p_hwfn, true,
74			 "Connection %d is not found in OOO list\n", cid);
75		return OSAL_NULL;
76	}
77
78	OSAL_LIST_FOR_EACH_ENTRY(p_isle,
79				 &p_archipelago->isles_list,
80				 list_entry, struct ecore_ooo_isle) {
81		if (the_num_of_isle == isle)
82			return p_isle;
83		the_num_of_isle++;
84	}
85
86	return OSAL_NULL;
87}
88
89void ecore_ooo_save_history_entry(struct ecore_ooo_info *p_ooo_info,
90				  struct ooo_opaque *p_cqe)
91{
92	struct ecore_ooo_history *p_history = &p_ooo_info->ooo_history;
93
94	if (p_history->head_idx == p_history->num_of_cqes)
95			p_history->head_idx = 0;
96	p_history->p_cqes[p_history->head_idx] = *p_cqe;
97	p_history->head_idx++;
98}
99
100//#ifdef CONFIG_ECORE_ISCSI
101#if defined(CONFIG_ECORE_ISCSI) || defined(CONFIG_ECORE_IWARP)
102enum _ecore_status_t ecore_ooo_alloc(struct ecore_hwfn *p_hwfn)
103{
104	u16 max_num_archipelagos = 0, cid_base;
105	struct ecore_ooo_info *p_ooo_info;
106	u16 max_num_isles = 0;
107	u32 i;
108
109	switch (p_hwfn->hw_info.personality) {
110	case ECORE_PCI_ISCSI:
111		max_num_archipelagos =
112			p_hwfn->pf_params.iscsi_pf_params.num_cons;
113		cid_base =(u16)ecore_cxt_get_proto_cid_start(p_hwfn,
114							     PROTOCOLID_ISCSI);
115		break;
116	case ECORE_PCI_ETH_RDMA:
117	case ECORE_PCI_ETH_IWARP:
118		max_num_archipelagos =
119			(u16)ecore_cxt_get_proto_cid_count(p_hwfn,
120							   PROTOCOLID_IWARP,
121							   OSAL_NULL);
122		cid_base = (u16)ecore_cxt_get_proto_cid_start(p_hwfn,
123							      PROTOCOLID_IWARP);
124		break;
125	default:
126		DP_NOTICE(p_hwfn, true,
127			  "Failed to allocate ecore_ooo_info: unknown personalization\n");
128		return ECORE_INVAL;
129	}
130
131	max_num_isles = ECORE_MAX_NUM_ISLES + max_num_archipelagos;
132
133	if (!max_num_archipelagos) {
134		DP_NOTICE(p_hwfn, true,
135			  "Failed to allocate ecore_ooo_info: unknown amount of connections\n");
136		return ECORE_INVAL;
137	}
138
139	p_ooo_info = OSAL_ZALLOC(p_hwfn->p_dev, GFP_KERNEL,
140				 sizeof(*p_ooo_info));
141	if (!p_ooo_info) {
142		DP_NOTICE(p_hwfn, true, "Failed to allocate ecore_ooo_info\n");
143		return ECORE_NOMEM;
144	}
145	p_ooo_info->cid_base = cid_base; /* We look only at the icid */
146	p_ooo_info->max_num_archipelagos = max_num_archipelagos;
147
148	OSAL_LIST_INIT(&p_ooo_info->free_buffers_list);
149	OSAL_LIST_INIT(&p_ooo_info->ready_buffers_list);
150	OSAL_LIST_INIT(&p_ooo_info->free_isles_list);
151
152	p_ooo_info->p_isles_mem =
153		OSAL_ZALLOC(p_hwfn->p_dev, GFP_KERNEL,
154			    sizeof(struct ecore_ooo_isle) *
155			    max_num_isles);
156	if (!p_ooo_info->p_isles_mem) {
157		DP_NOTICE(p_hwfn,true,
158			  "Failed to allocate ecore_ooo_info (isles)\n");
159		goto no_isles_mem;
160	}
161
162	for (i = 0; i < max_num_isles; i++) {
163		OSAL_LIST_INIT(&p_ooo_info->p_isles_mem[i].buffers_list);
164		OSAL_LIST_PUSH_TAIL(&p_ooo_info->p_isles_mem[i].list_entry,
165				    &p_ooo_info->free_isles_list);
166	}
167
168	p_ooo_info->p_archipelagos_mem =
169		OSAL_ZALLOC(p_hwfn->p_dev, GFP_KERNEL,
170			    sizeof(struct ecore_ooo_archipelago) *
171			    max_num_archipelagos);
172	if (!p_ooo_info->p_archipelagos_mem) {
173		DP_NOTICE(p_hwfn,true,
174			 "Failed to allocate ecore_ooo_info(archpelagos)\n");
175		goto no_archipelagos_mem;
176	}
177
178	for (i = 0; i < max_num_archipelagos; i++) {
179		OSAL_LIST_INIT(&p_ooo_info->p_archipelagos_mem[i].isles_list);
180	}
181
182	p_ooo_info->ooo_history.p_cqes =
183		OSAL_ZALLOC(p_hwfn->p_dev, GFP_KERNEL,
184			    sizeof(struct ooo_opaque) *
185			    ECORE_MAX_NUM_OOO_HISTORY_ENTRIES);
186	if (!p_ooo_info->ooo_history.p_cqes) {
187		DP_NOTICE(p_hwfn,true,
188			  "Failed to allocate ecore_ooo_info(history)\n");
189		goto no_history_mem;
190	}
191	p_ooo_info->ooo_history.num_of_cqes =
192		ECORE_MAX_NUM_OOO_HISTORY_ENTRIES;
193
194	p_hwfn->p_ooo_info = p_ooo_info;
195	return ECORE_SUCCESS;
196
197no_history_mem:
198	OSAL_FREE(p_hwfn->p_dev, p_ooo_info->p_archipelagos_mem);
199no_archipelagos_mem:
200	OSAL_FREE(p_hwfn->p_dev, p_ooo_info->p_isles_mem);
201no_isles_mem:
202	OSAL_FREE(p_hwfn->p_dev, p_ooo_info);
203	return ECORE_NOMEM;
204}
205#endif
206
207void ecore_ooo_release_connection_isles(struct ecore_ooo_info *p_ooo_info,
208					u32 cid)
209{
210	struct ecore_ooo_archipelago *p_archipelago;
211	struct ecore_ooo_buffer *p_buffer;
212	struct ecore_ooo_isle *p_isle;
213
214	p_archipelago = ecore_ooo_seek_archipelago(p_ooo_info, cid);
215	if (!p_archipelago)
216		return;
217
218	while (!OSAL_LIST_IS_EMPTY(&p_archipelago->isles_list)) {
219		p_isle = OSAL_LIST_FIRST_ENTRY(
220				&p_archipelago->isles_list,
221				struct ecore_ooo_isle, list_entry);
222
223#if defined(_NTDDK_)
224#pragma warning(suppress : 6011 28182)
225#endif
226		OSAL_LIST_REMOVE_ENTRY(&p_isle->list_entry,
227				       &p_archipelago->isles_list);
228
229		while (!OSAL_LIST_IS_EMPTY(&p_isle->buffers_list)) {
230			p_buffer =
231				OSAL_LIST_FIRST_ENTRY(
232				&p_isle->buffers_list ,
233				struct ecore_ooo_buffer, list_entry);
234
235			if (p_buffer == OSAL_NULL)
236				break;
237#if defined(_NTDDK_)
238#pragma warning(suppress : 6011 28182)
239#endif
240			OSAL_LIST_REMOVE_ENTRY(&p_buffer->list_entry,
241				      	       &p_isle->buffers_list);
242				OSAL_LIST_PUSH_TAIL(&p_buffer->list_entry,
243						&p_ooo_info->free_buffers_list);
244			}
245			OSAL_LIST_PUSH_TAIL(&p_isle->list_entry,
246					&p_ooo_info->free_isles_list);
247		}
248
249}
250
251void ecore_ooo_release_all_isles(struct ecore_ooo_info *p_ooo_info)
252{
253	struct ecore_ooo_archipelago *p_archipelago;
254	struct ecore_ooo_buffer *p_buffer;
255	struct ecore_ooo_isle *p_isle;
256	u32 i;
257
258	for (i = 0; i < p_ooo_info->max_num_archipelagos; i++) {
259		p_archipelago = &(p_ooo_info->p_archipelagos_mem[i]);
260
261#if defined(_NTDDK_)
262#pragma warning(suppress : 6011 28182)
263#endif
264		while (!OSAL_LIST_IS_EMPTY(&p_archipelago->isles_list)) {
265			p_isle = OSAL_LIST_FIRST_ENTRY(
266					&p_archipelago->isles_list,
267					struct ecore_ooo_isle, list_entry);
268
269#if defined(_NTDDK_)
270#pragma warning(suppress : 6011 28182)
271#endif
272			OSAL_LIST_REMOVE_ENTRY(&p_isle->list_entry,
273					       &p_archipelago->isles_list);
274
275			while (!OSAL_LIST_IS_EMPTY(&p_isle->buffers_list)) {
276				p_buffer =
277					OSAL_LIST_FIRST_ENTRY(
278					&p_isle->buffers_list ,
279					struct ecore_ooo_buffer, list_entry);
280
281				if (p_buffer == OSAL_NULL)
282					break;
283#if defined(_NTDDK_)
284#pragma warning(suppress : 6011 28182)
285#endif
286				OSAL_LIST_REMOVE_ENTRY(&p_buffer->list_entry,
287						      &p_isle->buffers_list);
288				OSAL_LIST_PUSH_TAIL(&p_buffer->list_entry,
289					&p_ooo_info->free_buffers_list);
290			}
291			OSAL_LIST_PUSH_TAIL(&p_isle->list_entry,
292				&p_ooo_info->free_isles_list);
293		}
294	}
295	if (!OSAL_LIST_IS_EMPTY(&p_ooo_info->ready_buffers_list)) {
296		OSAL_LIST_SPLICE_TAIL_INIT(&p_ooo_info->ready_buffers_list,
297					  &p_ooo_info->free_buffers_list);
298	}
299}
300
301//#ifdef CONFIG_ECORE_ISCSI
302#if defined(CONFIG_ECORE_ISCSI) || defined(CONFIG_ECORE_IWARP)
303void ecore_ooo_setup(struct ecore_hwfn *p_hwfn)
304{
305	ecore_ooo_release_all_isles(p_hwfn->p_ooo_info);
306	OSAL_MEM_ZERO(p_hwfn->p_ooo_info->ooo_history.p_cqes,
307		      p_hwfn->p_ooo_info->ooo_history.num_of_cqes *
308		      sizeof(struct ooo_opaque));
309	p_hwfn->p_ooo_info->ooo_history.head_idx = 0;
310}
311
312void ecore_ooo_free(struct ecore_hwfn *p_hwfn)
313{
314	struct ecore_ooo_info *p_ooo_info = p_hwfn->p_ooo_info;
315	struct ecore_ooo_buffer *p_buffer;
316
317	if (!p_ooo_info)
318		return;
319
320	ecore_ooo_release_all_isles(p_ooo_info);
321	while (!OSAL_LIST_IS_EMPTY(&p_ooo_info->free_buffers_list)) {
322		p_buffer = OSAL_LIST_FIRST_ENTRY(&p_ooo_info->
323						 free_buffers_list,
324						 struct ecore_ooo_buffer,
325						 list_entry);
326		if (p_buffer == OSAL_NULL)
327			break;
328#if defined(_NTDDK_)
329#pragma warning(suppress : 6011 28182)
330#endif
331		OSAL_LIST_REMOVE_ENTRY(&p_buffer->list_entry,
332				       &p_ooo_info->free_buffers_list);
333		OSAL_DMA_FREE_COHERENT(p_hwfn->p_dev,
334				       p_buffer->rx_buffer_virt_addr,
335				       p_buffer->rx_buffer_phys_addr,
336				       p_buffer->rx_buffer_size);
337		OSAL_FREE(p_hwfn->p_dev, p_buffer);
338	}
339
340	OSAL_FREE(p_hwfn->p_dev, p_ooo_info->p_isles_mem);
341	OSAL_FREE(p_hwfn->p_dev, p_ooo_info->p_archipelagos_mem);
342	OSAL_FREE(p_hwfn->p_dev, p_ooo_info->ooo_history.p_cqes);
343	OSAL_FREE(p_hwfn->p_dev, p_ooo_info);
344	p_hwfn->p_ooo_info = OSAL_NULL;
345}
346#endif
347
348void ecore_ooo_put_free_buffer(struct ecore_ooo_info *p_ooo_info,
349			       struct ecore_ooo_buffer *p_buffer)
350{
351	OSAL_LIST_PUSH_TAIL(&p_buffer->list_entry,
352			    &p_ooo_info->free_buffers_list);
353}
354
355struct ecore_ooo_buffer *
356ecore_ooo_get_free_buffer(struct ecore_ooo_info *p_ooo_info)
357{
358	struct ecore_ooo_buffer	*p_buffer = OSAL_NULL;
359
360	if (!OSAL_LIST_IS_EMPTY(&p_ooo_info->free_buffers_list)) {
361		p_buffer =
362			OSAL_LIST_FIRST_ENTRY(
363			&p_ooo_info->free_buffers_list,
364			struct ecore_ooo_buffer, list_entry);
365
366		OSAL_LIST_REMOVE_ENTRY(&p_buffer->list_entry,
367				      &p_ooo_info->free_buffers_list);
368	}
369
370	return p_buffer;
371}
372
373void ecore_ooo_put_ready_buffer(struct ecore_ooo_info *p_ooo_info,
374				struct ecore_ooo_buffer *p_buffer, u8 on_tail)
375{
376	if (on_tail) {
377		OSAL_LIST_PUSH_TAIL(&p_buffer->list_entry,
378				   &p_ooo_info->ready_buffers_list);
379	} else {
380		OSAL_LIST_PUSH_HEAD(&p_buffer->list_entry,
381				   &p_ooo_info->ready_buffers_list);
382	}
383}
384
385struct ecore_ooo_buffer *
386ecore_ooo_get_ready_buffer(struct ecore_ooo_info *p_ooo_info)
387{
388	struct ecore_ooo_buffer	*p_buffer = OSAL_NULL;
389
390	if (!OSAL_LIST_IS_EMPTY(&p_ooo_info->ready_buffers_list)) {
391		p_buffer =
392			OSAL_LIST_FIRST_ENTRY(
393			&p_ooo_info->ready_buffers_list,
394			struct ecore_ooo_buffer, list_entry);
395
396		OSAL_LIST_REMOVE_ENTRY(&p_buffer->list_entry,
397				      &p_ooo_info->ready_buffers_list);
398	}
399
400	return p_buffer;
401}
402
403void ecore_ooo_delete_isles(struct ecore_hwfn *p_hwfn,
404			   struct ecore_ooo_info *p_ooo_info,
405			   u32 cid,
406			   u8 drop_isle,
407			   u8 drop_size)
408{
409	struct ecore_ooo_archipelago *p_archipelago = OSAL_NULL;
410	struct ecore_ooo_isle *p_isle = OSAL_NULL;
411	u8 isle_idx;
412
413	p_archipelago = ecore_ooo_seek_archipelago(p_ooo_info, cid);
414	for (isle_idx = 0; isle_idx < drop_size; isle_idx++) {
415		p_isle = ecore_ooo_seek_isle(p_hwfn, p_ooo_info,
416					    cid, drop_isle);
417		if (!p_isle) {
418			DP_NOTICE(p_hwfn, true,
419				 "Isle %d is not found(cid %d)\n",
420				 drop_isle, cid);
421			return;
422		}
423		if (OSAL_LIST_IS_EMPTY(&p_isle->buffers_list)) {
424			DP_NOTICE(p_hwfn, true,
425				 "Isle %d is empty(cid %d)\n",
426				 drop_isle, cid);
427		} else {
428			OSAL_LIST_SPLICE_TAIL_INIT(&p_isle->buffers_list,
429					&p_ooo_info->free_buffers_list);
430		}
431#if defined(_NTDDK_)
432#pragma warning(suppress : 6011)
433#endif
434		OSAL_LIST_REMOVE_ENTRY(&p_isle->list_entry,
435				      &p_archipelago->isles_list);
436		p_ooo_info->cur_isles_number--;
437		OSAL_LIST_PUSH_HEAD(&p_isle->list_entry,
438				   &p_ooo_info->free_isles_list);
439	}
440}
441
442void ecore_ooo_add_new_isle(struct ecore_hwfn *p_hwfn,
443			   struct ecore_ooo_info *p_ooo_info,
444			   u32 cid, u8 ooo_isle,
445			   struct ecore_ooo_buffer *p_buffer)
446{
447	struct ecore_ooo_archipelago *p_archipelago = OSAL_NULL;
448	struct ecore_ooo_isle *p_prev_isle = OSAL_NULL;
449	struct ecore_ooo_isle *p_isle = OSAL_NULL;
450
451	if (ooo_isle > 1) {
452		p_prev_isle = ecore_ooo_seek_isle(p_hwfn, p_ooo_info, cid, ooo_isle - 1);
453		if (!p_prev_isle) {
454			DP_NOTICE(p_hwfn, true,
455				 "Isle %d is not found(cid %d)\n",
456				 ooo_isle - 1, cid);
457			return;
458		}
459	}
460	p_archipelago = ecore_ooo_seek_archipelago(p_ooo_info, cid);
461	if (!p_archipelago && (ooo_isle != 1)) {
462		DP_NOTICE(p_hwfn, true,
463			 "Connection %d is not found in OOO list\n", cid);
464		return;
465	}
466
467	if (!OSAL_LIST_IS_EMPTY(&p_ooo_info->free_isles_list)) {
468		p_isle =
469			OSAL_LIST_FIRST_ENTRY(
470			&p_ooo_info->free_isles_list,
471			struct ecore_ooo_isle, list_entry);
472
473		OSAL_LIST_REMOVE_ENTRY(&p_isle->list_entry,
474				      &p_ooo_info->free_isles_list);
475		if (!OSAL_LIST_IS_EMPTY(&p_isle->buffers_list)) {
476			DP_NOTICE(p_hwfn, true, "Free isle is not empty\n");
477			OSAL_LIST_INIT(&p_isle->buffers_list);
478		}
479	} else {
480		DP_NOTICE(p_hwfn, true, "No more free isles\n");
481		return;
482	}
483
484	if (!p_archipelago) {
485		u32 idx = (cid & 0xffff) - p_ooo_info->cid_base;
486
487		p_archipelago = &p_ooo_info->p_archipelagos_mem[idx];
488	}
489	OSAL_LIST_PUSH_HEAD(&p_buffer->list_entry, &p_isle->buffers_list);
490	p_ooo_info->cur_isles_number++;
491	p_ooo_info->gen_isles_number++;
492	if (p_ooo_info->cur_isles_number > p_ooo_info->max_isles_number)
493		p_ooo_info->max_isles_number = p_ooo_info->cur_isles_number;
494	if (!p_prev_isle) {
495		OSAL_LIST_PUSH_HEAD(&p_isle->list_entry, &p_archipelago->isles_list);
496	} else {
497		OSAL_LIST_INSERT_ENTRY_AFTER(&p_isle->list_entry,
498			                    &p_prev_isle->list_entry,
499					    &p_archipelago->isles_list);
500	}
501}
502
503void ecore_ooo_add_new_buffer(struct ecore_hwfn	*p_hwfn,
504			     struct ecore_ooo_info *p_ooo_info,
505			     u32 cid,
506			     u8 ooo_isle,
507			     struct ecore_ooo_buffer *p_buffer,
508		             u8 buffer_side)
509{
510	struct ecore_ooo_isle	* p_isle = OSAL_NULL;
511	p_isle = ecore_ooo_seek_isle(p_hwfn, p_ooo_info, cid, ooo_isle);
512	if (!p_isle) {
513		DP_NOTICE(p_hwfn, true,
514			 "Isle %d is not found(cid %d)\n",
515			 ooo_isle, cid);
516		return;
517	}
518	if (buffer_side == ECORE_OOO_LEFT_BUF) {
519		OSAL_LIST_PUSH_HEAD(&p_buffer->list_entry,
520				   &p_isle->buffers_list);
521	} else {
522		OSAL_LIST_PUSH_TAIL(&p_buffer->list_entry,
523				   &p_isle->buffers_list);
524	}
525}
526
527void ecore_ooo_join_isles(struct ecore_hwfn *p_hwfn,
528			  struct ecore_ooo_info *p_ooo_info,
529			  u32 cid, u8 left_isle)
530{
531	struct ecore_ooo_archipelago *p_archipelago = OSAL_NULL;
532	struct ecore_ooo_isle *p_right_isle = OSAL_NULL;
533	struct ecore_ooo_isle *p_left_isle = OSAL_NULL;
534
535	p_right_isle = ecore_ooo_seek_isle(p_hwfn, p_ooo_info, cid,
536					  left_isle + 1);
537	if (!p_right_isle) {
538		DP_NOTICE(p_hwfn, true,
539			 "Right isle %d is not found(cid %d)\n",
540			 left_isle + 1, cid);
541		return;
542	}
543	p_archipelago = ecore_ooo_seek_archipelago(p_ooo_info, cid);
544	OSAL_LIST_REMOVE_ENTRY(&p_right_isle->list_entry,
545			      &p_archipelago->isles_list);
546	p_ooo_info->cur_isles_number--;
547	if (left_isle) {
548		p_left_isle = ecore_ooo_seek_isle(p_hwfn, p_ooo_info, cid,
549						 left_isle);
550		if (!p_left_isle) {
551			DP_NOTICE(p_hwfn, true,
552				 "Left isle %d is not found(cid %d)\n",
553				 left_isle, cid);
554			return;
555		}
556		OSAL_LIST_SPLICE_TAIL_INIT(&p_right_isle->buffers_list,
557					  &p_left_isle->buffers_list);
558	} else {
559		OSAL_LIST_SPLICE_TAIL_INIT(&p_right_isle->buffers_list,
560					  &p_ooo_info->ready_buffers_list);
561	}
562	OSAL_LIST_PUSH_TAIL(&p_right_isle->list_entry,
563			   &p_ooo_info->free_isles_list);
564}
565
566void ecore_ooo_dump_rx_event(struct ecore_hwfn	*p_hwfn,
567			     struct ooo_opaque *iscsi_ooo,
568			     struct ecore_ooo_buffer *p_buffer)
569{
570	int i;
571	u32 dp_module = ECORE_MSG_OOO;
572	u32 ph_hi, ph_lo;
573	u8 *packet_buffer = 0;
574
575	if (p_hwfn->dp_level > ECORE_LEVEL_VERBOSE)
576		return;
577	if (!(p_hwfn->dp_module & dp_module))
578		return;
579
580	packet_buffer = (u8 *)p_buffer->rx_buffer_virt_addr +
581		p_buffer->placement_offset;
582	DP_VERBOSE(p_hwfn, dp_module,
583		   "******************************************************\n");
584	ph_hi = DMA_HI(p_buffer->rx_buffer_phys_addr);
585	ph_lo = DMA_LO(p_buffer->rx_buffer_phys_addr);
586	DP_VERBOSE(p_hwfn, dp_module,
587		   "0x%x-%x: CID 0x%x, OP 0x%x, ISLE 0x%x\n",
588		   ph_hi, ph_lo,
589		   iscsi_ooo->cid, iscsi_ooo->ooo_opcode, iscsi_ooo->ooo_isle);
590	for (i = 0; i < 64; i = i + 8) {
591		DP_VERBOSE(p_hwfn, dp_module,
592			   "0x%x-%x:  0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n",
593			   ph_hi, ph_lo,
594			   packet_buffer[i],
595			   packet_buffer[i + 1],
596			   packet_buffer[i + 2],
597			   packet_buffer[i + 3],
598			   packet_buffer[i + 4],
599			   packet_buffer[i + 5],
600			   packet_buffer[i + 6],
601			   packet_buffer[i + 7]);
602	}
603}
604