Linux Audio

Check our new training course

Loading...
v6.13.7
  1/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
  2/* QLogic qed NIC Driver
  3 * Copyright (c) 2015-2017  QLogic Corporation
  4 * Copyright (c) 2019-2020 Marvell International Ltd.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  5 */
  6
  7#ifndef _QED_OOO_H
  8#define _QED_OOO_H
  9#include <linux/types.h>
 10#include <linux/list.h>
 11#include <linux/slab.h>
 12#include "qed.h"
 13
 14#define QED_MAX_NUM_ISLES	256
 15#define QED_MAX_NUM_OOO_HISTORY_ENTRIES	512
 16
 17#define QED_OOO_LEFT_BUF	0
 18#define QED_OOO_RIGHT_BUF	1
 19
 20struct qed_ooo_buffer {
 21	struct list_head list_entry;
 22	void *rx_buffer_virt_addr;
 23	dma_addr_t rx_buffer_phys_addr;
 24	u32 rx_buffer_size;
 25	u16 packet_length;
 26	u16 parse_flags;
 27	u16 vlan;
 28	u8 placement_offset;
 29};
 30
 31struct qed_ooo_isle {
 32	struct list_head list_entry;
 33	struct list_head buffers_list;
 34};
 35
 36struct qed_ooo_archipelago {
 37	struct list_head isles_list;
 38};
 39
 40struct qed_ooo_history {
 41	struct ooo_opaque *p_cqes;
 42	u32 head_idx;
 43	u32 num_of_cqes;
 44};
 45
 46struct qed_ooo_info {
 47	struct list_head free_buffers_list;
 48	struct list_head ready_buffers_list;
 49	struct list_head free_isles_list;
 50	struct qed_ooo_archipelago *p_archipelagos_mem;
 51	struct qed_ooo_isle *p_isles_mem;
 52	struct qed_ooo_history ooo_history;
 53	u32 cur_isles_number;
 54	u32 max_isles_number;
 55	u32 gen_isles_number;
 56	u16 max_num_archipelagos;
 57	u16 cid_base;
 58};
 59
 60#if IS_ENABLED(CONFIG_QED_OOO)
 61void qed_ooo_save_history_entry(struct qed_hwfn *p_hwfn,
 62				struct qed_ooo_info *p_ooo_info,
 63				struct ooo_opaque *p_cqe);
 64
 65int qed_ooo_alloc(struct qed_hwfn *p_hwfn);
 66
 67void qed_ooo_setup(struct qed_hwfn *p_hwfn);
 68
 69void qed_ooo_free(struct qed_hwfn *p_hwfn);
 70
 71void qed_ooo_release_connection_isles(struct qed_hwfn *p_hwfn,
 72				      struct qed_ooo_info *p_ooo_info,
 73				      u32 cid);
 74
 75void qed_ooo_release_all_isles(struct qed_hwfn *p_hwfn,
 76			       struct qed_ooo_info *p_ooo_info);
 77
 78void qed_ooo_put_free_buffer(struct qed_hwfn *p_hwfn,
 79			     struct qed_ooo_info *p_ooo_info,
 80			     struct qed_ooo_buffer *p_buffer);
 81
 82struct qed_ooo_buffer *
 83qed_ooo_get_free_buffer(struct qed_hwfn *p_hwfn,
 84			struct qed_ooo_info *p_ooo_info);
 85
 86void qed_ooo_put_ready_buffer(struct qed_hwfn *p_hwfn,
 87			      struct qed_ooo_info *p_ooo_info,
 88			      struct qed_ooo_buffer *p_buffer, u8 on_tail);
 89
 90struct qed_ooo_buffer *
 91qed_ooo_get_ready_buffer(struct qed_hwfn *p_hwfn,
 92			 struct qed_ooo_info *p_ooo_info);
 93
 94void qed_ooo_delete_isles(struct qed_hwfn *p_hwfn,
 95			  struct qed_ooo_info *p_ooo_info,
 96			  u32 cid, u8 drop_isle, u8 drop_size);
 97
 98void qed_ooo_add_new_isle(struct qed_hwfn *p_hwfn,
 99			  struct qed_ooo_info *p_ooo_info,
100			  u32 cid,
101			  u8 ooo_isle, struct qed_ooo_buffer *p_buffer);
102
103void qed_ooo_add_new_buffer(struct qed_hwfn *p_hwfn,
104			    struct qed_ooo_info *p_ooo_info,
105			    u32 cid,
106			    u8 ooo_isle,
107			    struct qed_ooo_buffer *p_buffer, u8 buffer_side);
108
109void qed_ooo_join_isles(struct qed_hwfn *p_hwfn,
110			struct qed_ooo_info *p_ooo_info, u32 cid,
111			u8 left_isle);
112#else /* IS_ENABLED(CONFIG_QED_ISCSI) */
113static inline void qed_ooo_save_history_entry(struct qed_hwfn *p_hwfn,
114					      struct qed_ooo_info *p_ooo_info,
115					      struct ooo_opaque *p_cqe) {}
116
117static inline int qed_ooo_alloc(struct qed_hwfn *p_hwfn)
118{
119	return -EINVAL;
120}
121
122static inline void qed_ooo_setup(struct qed_hwfn *p_hwfn) {}
123
124static inline void qed_ooo_free(struct qed_hwfn *p_hwfn) {}
125
126static inline void
127qed_ooo_release_connection_isles(struct qed_hwfn *p_hwfn,
128				 struct qed_ooo_info *p_ooo_info,
129				 u32 cid) {}
130
131static inline void qed_ooo_release_all_isles(struct qed_hwfn *p_hwfn,
132					     struct qed_ooo_info *p_ooo_info)
133					     {}
134
135static inline void qed_ooo_put_free_buffer(struct qed_hwfn *p_hwfn,
136					   struct qed_ooo_info *p_ooo_info,
137					   struct qed_ooo_buffer *p_buffer) {}
138
139static inline struct qed_ooo_buffer *
140qed_ooo_get_free_buffer(struct qed_hwfn *p_hwfn,
141			struct qed_ooo_info *p_ooo_info) { return NULL; }
142
143static inline void qed_ooo_put_ready_buffer(struct qed_hwfn *p_hwfn,
144					    struct qed_ooo_info *p_ooo_info,
145					    struct qed_ooo_buffer *p_buffer,
146					    u8 on_tail) {}
147
148static inline struct qed_ooo_buffer *
149qed_ooo_get_ready_buffer(struct qed_hwfn *p_hwfn,
150			 struct qed_ooo_info *p_ooo_info) { return NULL; }
151
152static inline void qed_ooo_delete_isles(struct qed_hwfn *p_hwfn,
153					struct qed_ooo_info *p_ooo_info,
154					u32 cid, u8 drop_isle, u8 drop_size) {}
155
156static inline void qed_ooo_add_new_isle(struct qed_hwfn *p_hwfn,
157					struct qed_ooo_info *p_ooo_info,
158					u32 cid, u8 ooo_isle,
159					struct qed_ooo_buffer *p_buffer) {}
160
161static inline void qed_ooo_add_new_buffer(struct qed_hwfn *p_hwfn,
162					  struct qed_ooo_info *p_ooo_info,
163					  u32 cid, u8 ooo_isle,
164					  struct qed_ooo_buffer *p_buffer,
165					  u8 buffer_side) {}
166
167static inline void qed_ooo_join_isles(struct qed_hwfn *p_hwfn,
168				      struct qed_ooo_info *p_ooo_info, u32 cid,
169				      u8 left_isle) {}
170#endif /* IS_ENABLED(CONFIG_QED_ISCSI) */
171
172#endif
v5.4
 
  1/* QLogic qed NIC Driver
  2 * Copyright (c) 2015-2017  QLogic Corporation
  3 *
  4 * This software is available to you under a choice of one of two
  5 * licenses.  You may choose to be licensed under the terms of the GNU
  6 * General Public License (GPL) Version 2, available from the file
  7 * COPYING in the main directory of this source tree, or the
  8 * OpenIB.org BSD license below:
  9 *
 10 *     Redistribution and use in source and binary forms, with or
 11 *     without modification, are permitted provided that the following
 12 *     conditions are met:
 13 *
 14 *      - Redistributions of source code must retain the above
 15 *        copyright notice, this list of conditions and the following
 16 *        disclaimer.
 17 *
 18 *      - Redistributions in binary form must reproduce the above
 19 *        copyright notice, this list of conditions and the following
 20 *        disclaimer in the documentation and /or other materials
 21 *        provided with the distribution.
 22 *
 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 30 * SOFTWARE.
 31 */
 32
 33#ifndef _QED_OOO_H
 34#define _QED_OOO_H
 35#include <linux/types.h>
 36#include <linux/list.h>
 37#include <linux/slab.h>
 38#include "qed.h"
 39
 40#define QED_MAX_NUM_ISLES	256
 41#define QED_MAX_NUM_OOO_HISTORY_ENTRIES	512
 42
 43#define QED_OOO_LEFT_BUF	0
 44#define QED_OOO_RIGHT_BUF	1
 45
 46struct qed_ooo_buffer {
 47	struct list_head list_entry;
 48	void *rx_buffer_virt_addr;
 49	dma_addr_t rx_buffer_phys_addr;
 50	u32 rx_buffer_size;
 51	u16 packet_length;
 52	u16 parse_flags;
 53	u16 vlan;
 54	u8 placement_offset;
 55};
 56
 57struct qed_ooo_isle {
 58	struct list_head list_entry;
 59	struct list_head buffers_list;
 60};
 61
 62struct qed_ooo_archipelago {
 63	struct list_head isles_list;
 64};
 65
 66struct qed_ooo_history {
 67	struct ooo_opaque *p_cqes;
 68	u32 head_idx;
 69	u32 num_of_cqes;
 70};
 71
 72struct qed_ooo_info {
 73	struct list_head free_buffers_list;
 74	struct list_head ready_buffers_list;
 75	struct list_head free_isles_list;
 76	struct qed_ooo_archipelago *p_archipelagos_mem;
 77	struct qed_ooo_isle *p_isles_mem;
 78	struct qed_ooo_history ooo_history;
 79	u32 cur_isles_number;
 80	u32 max_isles_number;
 81	u32 gen_isles_number;
 82	u16 max_num_archipelagos;
 83	u16 cid_base;
 84};
 85
 86#if IS_ENABLED(CONFIG_QED_OOO)
 87void qed_ooo_save_history_entry(struct qed_hwfn *p_hwfn,
 88				struct qed_ooo_info *p_ooo_info,
 89				struct ooo_opaque *p_cqe);
 90
 91int qed_ooo_alloc(struct qed_hwfn *p_hwfn);
 92
 93void qed_ooo_setup(struct qed_hwfn *p_hwfn);
 94
 95void qed_ooo_free(struct qed_hwfn *p_hwfn);
 96
 97void qed_ooo_release_connection_isles(struct qed_hwfn *p_hwfn,
 98				      struct qed_ooo_info *p_ooo_info,
 99				      u32 cid);
100
101void qed_ooo_release_all_isles(struct qed_hwfn *p_hwfn,
102			       struct qed_ooo_info *p_ooo_info);
103
104void qed_ooo_put_free_buffer(struct qed_hwfn *p_hwfn,
105			     struct qed_ooo_info *p_ooo_info,
106			     struct qed_ooo_buffer *p_buffer);
107
108struct qed_ooo_buffer *
109qed_ooo_get_free_buffer(struct qed_hwfn *p_hwfn,
110			struct qed_ooo_info *p_ooo_info);
111
112void qed_ooo_put_ready_buffer(struct qed_hwfn *p_hwfn,
113			      struct qed_ooo_info *p_ooo_info,
114			      struct qed_ooo_buffer *p_buffer, u8 on_tail);
115
116struct qed_ooo_buffer *
117qed_ooo_get_ready_buffer(struct qed_hwfn *p_hwfn,
118			 struct qed_ooo_info *p_ooo_info);
119
120void qed_ooo_delete_isles(struct qed_hwfn *p_hwfn,
121			  struct qed_ooo_info *p_ooo_info,
122			  u32 cid, u8 drop_isle, u8 drop_size);
123
124void qed_ooo_add_new_isle(struct qed_hwfn *p_hwfn,
125			  struct qed_ooo_info *p_ooo_info,
126			  u32 cid,
127			  u8 ooo_isle, struct qed_ooo_buffer *p_buffer);
128
129void qed_ooo_add_new_buffer(struct qed_hwfn *p_hwfn,
130			    struct qed_ooo_info *p_ooo_info,
131			    u32 cid,
132			    u8 ooo_isle,
133			    struct qed_ooo_buffer *p_buffer, u8 buffer_side);
134
135void qed_ooo_join_isles(struct qed_hwfn *p_hwfn,
136			struct qed_ooo_info *p_ooo_info, u32 cid,
137			u8 left_isle);
138#else /* IS_ENABLED(CONFIG_QED_ISCSI) */
139static inline void qed_ooo_save_history_entry(struct qed_hwfn *p_hwfn,
140					      struct qed_ooo_info *p_ooo_info,
141					      struct ooo_opaque *p_cqe) {}
142
143static inline int qed_ooo_alloc(struct qed_hwfn *p_hwfn)
144{
145	return -EINVAL;
146}
147
148static inline void qed_ooo_setup(struct qed_hwfn *p_hwfn) {}
149
150static inline void qed_ooo_free(struct qed_hwfn *p_hwfn) {}
151
152static inline void
153qed_ooo_release_connection_isles(struct qed_hwfn *p_hwfn,
154				 struct qed_ooo_info *p_ooo_info,
155				 u32 cid) {}
156
157static inline void qed_ooo_release_all_isles(struct qed_hwfn *p_hwfn,
158					     struct qed_ooo_info *p_ooo_info)
159					     {}
160
161static inline void qed_ooo_put_free_buffer(struct qed_hwfn *p_hwfn,
162					   struct qed_ooo_info *p_ooo_info,
163					   struct qed_ooo_buffer *p_buffer) {}
164
165static inline struct qed_ooo_buffer *
166qed_ooo_get_free_buffer(struct qed_hwfn *p_hwfn,
167			struct qed_ooo_info *p_ooo_info) { return NULL; }
168
169static inline void qed_ooo_put_ready_buffer(struct qed_hwfn *p_hwfn,
170					    struct qed_ooo_info *p_ooo_info,
171					    struct qed_ooo_buffer *p_buffer,
172					    u8 on_tail) {}
173
174static inline struct qed_ooo_buffer *
175qed_ooo_get_ready_buffer(struct qed_hwfn *p_hwfn,
176			 struct qed_ooo_info *p_ooo_info) { return NULL; }
177
178static inline void qed_ooo_delete_isles(struct qed_hwfn *p_hwfn,
179					struct qed_ooo_info *p_ooo_info,
180					u32 cid, u8 drop_isle, u8 drop_size) {}
181
182static inline void qed_ooo_add_new_isle(struct qed_hwfn *p_hwfn,
183					struct qed_ooo_info *p_ooo_info,
184					u32 cid, u8 ooo_isle,
185					struct qed_ooo_buffer *p_buffer) {}
186
187static inline void qed_ooo_add_new_buffer(struct qed_hwfn *p_hwfn,
188					  struct qed_ooo_info *p_ooo_info,
189					  u32 cid, u8 ooo_isle,
190					  struct qed_ooo_buffer *p_buffer,
191					  u8 buffer_side) {}
192
193static inline void qed_ooo_join_isles(struct qed_hwfn *p_hwfn,
194				      struct qed_ooo_info *p_ooo_info, u32 cid,
195				      u8 left_isle) {}
196#endif /* IS_ENABLED(CONFIG_QED_ISCSI) */
197
198#endif