1b8b9d81bSVarun Prakash /*
2b8b9d81bSVarun Prakash * libcxgb_ppm.h: Chelsio common library for T3/T4/T5 iSCSI ddp operation
3b8b9d81bSVarun Prakash *
4b8b9d81bSVarun Prakash * Copyright (c) 2016 Chelsio Communications, Inc. All rights reserved.
5b8b9d81bSVarun Prakash *
6b8b9d81bSVarun Prakash * This software is available to you under a choice of one of two
7b8b9d81bSVarun Prakash * licenses. You may choose to be licensed under the terms of the GNU
8b8b9d81bSVarun Prakash * General Public License (GPL) Version 2, available from the file
9b8b9d81bSVarun Prakash * COPYING in the main directory of this source tree, or the
10b8b9d81bSVarun Prakash * OpenIB.org BSD license below:
11b8b9d81bSVarun Prakash *
12b8b9d81bSVarun Prakash * Redistribution and use in source and binary forms, with or
13b8b9d81bSVarun Prakash * without modification, are permitted provided that the following
14b8b9d81bSVarun Prakash * conditions are met:
15b8b9d81bSVarun Prakash *
16b8b9d81bSVarun Prakash * - Redistributions of source code must retain the above
17b8b9d81bSVarun Prakash * copyright notice, this list of conditions and the following
18b8b9d81bSVarun Prakash * disclaimer.
19b8b9d81bSVarun Prakash *
20b8b9d81bSVarun Prakash * - Redistributions in binary form must reproduce the above
21b8b9d81bSVarun Prakash * copyright notice, this list of conditions and the following
22b8b9d81bSVarun Prakash * disclaimer in the documentation and/or other materials
23b8b9d81bSVarun Prakash * provided with the distribution.
24b8b9d81bSVarun Prakash *
25b8b9d81bSVarun Prakash * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26b8b9d81bSVarun Prakash * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27b8b9d81bSVarun Prakash * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28b8b9d81bSVarun Prakash * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29b8b9d81bSVarun Prakash * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30b8b9d81bSVarun Prakash * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31b8b9d81bSVarun Prakash * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32b8b9d81bSVarun Prakash * SOFTWARE.
33b8b9d81bSVarun Prakash *
34b8b9d81bSVarun Prakash * Written by: Karen Xie (kxie@chelsio.com)
35b8b9d81bSVarun Prakash */
36b8b9d81bSVarun Prakash
37b8b9d81bSVarun Prakash #ifndef __LIBCXGB_PPM_H__
38b8b9d81bSVarun Prakash #define __LIBCXGB_PPM_H__
39b8b9d81bSVarun Prakash
40b8b9d81bSVarun Prakash #include <linux/kernel.h>
41b8b9d81bSVarun Prakash #include <linux/errno.h>
42b8b9d81bSVarun Prakash #include <linux/types.h>
43b8b9d81bSVarun Prakash #include <linux/debugfs.h>
44b8b9d81bSVarun Prakash #include <linux/list.h>
45b8b9d81bSVarun Prakash #include <linux/netdevice.h>
46b8b9d81bSVarun Prakash #include <linux/scatterlist.h>
47b8b9d81bSVarun Prakash #include <linux/skbuff.h>
48b8b9d81bSVarun Prakash #include <linux/vmalloc.h>
49b8b9d81bSVarun Prakash #include <linux/bitmap.h>
50b8b9d81bSVarun Prakash
51b8b9d81bSVarun Prakash struct cxgbi_pagepod_hdr {
52b8b9d81bSVarun Prakash u32 vld_tid;
53b8b9d81bSVarun Prakash u32 pgsz_tag_clr;
54b8b9d81bSVarun Prakash u32 max_offset;
55b8b9d81bSVarun Prakash u32 page_offset;
56b8b9d81bSVarun Prakash u64 rsvd;
57b8b9d81bSVarun Prakash };
58b8b9d81bSVarun Prakash
59b8b9d81bSVarun Prakash #define PPOD_PAGES_MAX 4
60b8b9d81bSVarun Prakash struct cxgbi_pagepod {
61b8b9d81bSVarun Prakash struct cxgbi_pagepod_hdr hdr;
625cadafb2SBart Van Assche __be64 addr[PPOD_PAGES_MAX + 1];
63b8b9d81bSVarun Prakash };
64b8b9d81bSVarun Prakash
65b8b9d81bSVarun Prakash /* ddp tag format
66b8b9d81bSVarun Prakash * for a 32-bit tag:
67b8b9d81bSVarun Prakash * bit #
68b8b9d81bSVarun Prakash * 31 ..... ..... 0
69b8b9d81bSVarun Prakash * X Y...Y Z...Z, where
70b8b9d81bSVarun Prakash * ^ ^^^^^ ^^^^
71b8b9d81bSVarun Prakash * | | |____ when ddp bit = 0: color bits
72b8b9d81bSVarun Prakash * | |
73b8b9d81bSVarun Prakash * | |____ when ddp bit = 0: idx into the ddp memory region
74b8b9d81bSVarun Prakash * |
75b8b9d81bSVarun Prakash * |____ ddp bit: 0 - ddp tag, 1 - non-ddp tag
76b8b9d81bSVarun Prakash *
77b8b9d81bSVarun Prakash * [page selector:2] [sw/free bits] [0] [idx] [color:6]
78b8b9d81bSVarun Prakash */
79b8b9d81bSVarun Prakash
80b8b9d81bSVarun Prakash #define DDP_PGIDX_MAX 4
81b8b9d81bSVarun Prakash #define DDP_PGSZ_BASE_SHIFT 12 /* base page 4K */
82b8b9d81bSVarun Prakash
83b8b9d81bSVarun Prakash struct cxgbi_task_tag_info {
84b8b9d81bSVarun Prakash unsigned char flags;
85b8b9d81bSVarun Prakash #define CXGBI_PPOD_INFO_FLAG_VALID 0x1
86b8b9d81bSVarun Prakash #define CXGBI_PPOD_INFO_FLAG_MAPPED 0x2
87b8b9d81bSVarun Prakash unsigned char cid;
88b8b9d81bSVarun Prakash unsigned short pg_shift;
89b8b9d81bSVarun Prakash unsigned int npods;
90b8b9d81bSVarun Prakash unsigned int idx;
91b8b9d81bSVarun Prakash unsigned int tag;
92b8b9d81bSVarun Prakash struct cxgbi_pagepod_hdr hdr;
93b8b9d81bSVarun Prakash int nents;
94b8b9d81bSVarun Prakash int nr_pages;
95b8b9d81bSVarun Prakash struct scatterlist *sgl;
96b8b9d81bSVarun Prakash };
97b8b9d81bSVarun Prakash
98b8b9d81bSVarun Prakash struct cxgbi_tag_format {
99b8b9d81bSVarun Prakash unsigned char pgsz_order[DDP_PGIDX_MAX];
100b8b9d81bSVarun Prakash unsigned char pgsz_idx_dflt;
101b8b9d81bSVarun Prakash unsigned char free_bits:4;
102b8b9d81bSVarun Prakash unsigned char color_bits:4;
103b8b9d81bSVarun Prakash unsigned char idx_bits;
104b8b9d81bSVarun Prakash unsigned char rsvd_bits;
105b8b9d81bSVarun Prakash unsigned int no_ddp_mask;
106b8b9d81bSVarun Prakash unsigned int idx_mask;
107b8b9d81bSVarun Prakash unsigned int color_mask;
108b8b9d81bSVarun Prakash unsigned int idx_clr_mask;
109b8b9d81bSVarun Prakash unsigned int rsvd_mask;
110b8b9d81bSVarun Prakash };
111b8b9d81bSVarun Prakash
112b8b9d81bSVarun Prakash struct cxgbi_ppod_data {
113b8b9d81bSVarun Prakash unsigned char pg_idx:2;
114b8b9d81bSVarun Prakash unsigned char color:6;
115b8b9d81bSVarun Prakash unsigned char chan_id;
116b8b9d81bSVarun Prakash unsigned short npods;
117b8b9d81bSVarun Prakash unsigned long caller_data;
118b8b9d81bSVarun Prakash };
119b8b9d81bSVarun Prakash
120b8b9d81bSVarun Prakash /* per cpu ppm pool */
121b8b9d81bSVarun Prakash struct cxgbi_ppm_pool {
122b8b9d81bSVarun Prakash unsigned int base; /* base index */
123b8b9d81bSVarun Prakash unsigned int next; /* next possible free index */
124b8b9d81bSVarun Prakash spinlock_t lock; /* ppm pool lock */
125*65dc2f1aSGustavo A. R. Silva unsigned long bmap[];
126b8b9d81bSVarun Prakash } ____cacheline_aligned_in_smp;
127b8b9d81bSVarun Prakash
128b8b9d81bSVarun Prakash struct cxgbi_ppm {
129b8b9d81bSVarun Prakash struct kref refcnt;
130b8b9d81bSVarun Prakash struct net_device *ndev; /* net_device, 1st port */
131b8b9d81bSVarun Prakash struct pci_dev *pdev;
132b8b9d81bSVarun Prakash void *lldev;
133b8b9d81bSVarun Prakash void **ppm_pp;
134b8b9d81bSVarun Prakash struct cxgbi_tag_format tformat;
135b8b9d81bSVarun Prakash unsigned int ppmax;
136b8b9d81bSVarun Prakash unsigned int llimit;
137b8b9d81bSVarun Prakash unsigned int base_idx;
138b8b9d81bSVarun Prakash
139b8b9d81bSVarun Prakash unsigned int pool_rsvd;
140b8b9d81bSVarun Prakash unsigned int pool_index_max;
141b8b9d81bSVarun Prakash struct cxgbi_ppm_pool __percpu *pool;
142b8b9d81bSVarun Prakash /* map lock */
143b8b9d81bSVarun Prakash spinlock_t map_lock; /* ppm map lock */
144b8b9d81bSVarun Prakash unsigned int bmap_index_max;
145b8b9d81bSVarun Prakash unsigned int next;
146a248384eSVarun Prakash unsigned int max_index_in_edram;
147b8b9d81bSVarun Prakash unsigned long *ppod_bmap;
148*65dc2f1aSGustavo A. R. Silva struct cxgbi_ppod_data ppod_data[];
149b8b9d81bSVarun Prakash };
150b8b9d81bSVarun Prakash
151b8b9d81bSVarun Prakash #define DDP_THRESHOLD 512
152b8b9d81bSVarun Prakash
153b8b9d81bSVarun Prakash #define PPOD_PAGES_SHIFT 2 /* 4 pages per pod */
154b8b9d81bSVarun Prakash
155b8b9d81bSVarun Prakash #define IPPOD_SIZE sizeof(struct cxgbi_pagepod) /* 64 */
156b8b9d81bSVarun Prakash #define PPOD_SIZE_SHIFT 6
157b8b9d81bSVarun Prakash
158b8b9d81bSVarun Prakash /* page pods are allocated in groups of this size (must be power of 2) */
159b8b9d81bSVarun Prakash #define PPOD_CLUSTER_SIZE 16U
160b8b9d81bSVarun Prakash
161b8b9d81bSVarun Prakash #define ULPMEM_DSGL_MAX_NPPODS 16 /* 1024/PPOD_SIZE */
162b8b9d81bSVarun Prakash #define ULPMEM_IDATA_MAX_NPPODS 3 /* (PPOD_SIZE * 3 + ulptx hdr) < 256B */
163b8b9d81bSVarun Prakash #define PCIE_MEMWIN_MAX_NPPODS 16 /* 1024/PPOD_SIZE */
164b8b9d81bSVarun Prakash
165b8b9d81bSVarun Prakash #define PPOD_COLOR_SHIFT 0
166b8b9d81bSVarun Prakash #define PPOD_COLOR(x) ((x) << PPOD_COLOR_SHIFT)
167b8b9d81bSVarun Prakash
168b8b9d81bSVarun Prakash #define PPOD_IDX_SHIFT 6
169b8b9d81bSVarun Prakash #define PPOD_IDX_MAX_SIZE 24
170b8b9d81bSVarun Prakash
171b8b9d81bSVarun Prakash #define PPOD_TID_SHIFT 0
172b8b9d81bSVarun Prakash #define PPOD_TID(x) ((x) << PPOD_TID_SHIFT)
173b8b9d81bSVarun Prakash
174b8b9d81bSVarun Prakash #define PPOD_TAG_SHIFT 6
175b8b9d81bSVarun Prakash #define PPOD_TAG(x) ((x) << PPOD_TAG_SHIFT)
176b8b9d81bSVarun Prakash
177b8b9d81bSVarun Prakash #define PPOD_VALID_SHIFT 24
178b8b9d81bSVarun Prakash #define PPOD_VALID(x) ((x) << PPOD_VALID_SHIFT)
179b8b9d81bSVarun Prakash #define PPOD_VALID_FLAG PPOD_VALID(1U)
180b8b9d81bSVarun Prakash
181b8b9d81bSVarun Prakash #define PPOD_PI_EXTRACT_CTL_SHIFT 31
182b8b9d81bSVarun Prakash #define PPOD_PI_EXTRACT_CTL(x) ((x) << PPOD_PI_EXTRACT_CTL_SHIFT)
183b8b9d81bSVarun Prakash #define PPOD_PI_EXTRACT_CTL_FLAG V_PPOD_PI_EXTRACT_CTL(1U)
184b8b9d81bSVarun Prakash
185b8b9d81bSVarun Prakash #define PPOD_PI_TYPE_SHIFT 29
186b8b9d81bSVarun Prakash #define PPOD_PI_TYPE_MASK 0x3
187b8b9d81bSVarun Prakash #define PPOD_PI_TYPE(x) ((x) << PPOD_PI_TYPE_SHIFT)
188b8b9d81bSVarun Prakash
189b8b9d81bSVarun Prakash #define PPOD_PI_CHECK_CTL_SHIFT 27
190b8b9d81bSVarun Prakash #define PPOD_PI_CHECK_CTL_MASK 0x3
191b8b9d81bSVarun Prakash #define PPOD_PI_CHECK_CTL(x) ((x) << PPOD_PI_CHECK_CTL_SHIFT)
192b8b9d81bSVarun Prakash
193b8b9d81bSVarun Prakash #define PPOD_PI_REPORT_CTL_SHIFT 25
194b8b9d81bSVarun Prakash #define PPOD_PI_REPORT_CTL_MASK 0x3
195b8b9d81bSVarun Prakash #define PPOD_PI_REPORT_CTL(x) ((x) << PPOD_PI_REPORT_CTL_SHIFT)
196b8b9d81bSVarun Prakash
cxgbi_ppm_is_ddp_tag(struct cxgbi_ppm * ppm,u32 tag)197b8b9d81bSVarun Prakash static inline int cxgbi_ppm_is_ddp_tag(struct cxgbi_ppm *ppm, u32 tag)
198b8b9d81bSVarun Prakash {
199b8b9d81bSVarun Prakash return !(tag & ppm->tformat.no_ddp_mask);
200b8b9d81bSVarun Prakash }
201b8b9d81bSVarun Prakash
cxgbi_ppm_sw_tag_is_usable(struct cxgbi_ppm * ppm,u32 tag)202b8b9d81bSVarun Prakash static inline int cxgbi_ppm_sw_tag_is_usable(struct cxgbi_ppm *ppm,
203b8b9d81bSVarun Prakash u32 tag)
204b8b9d81bSVarun Prakash {
205b8b9d81bSVarun Prakash /* the sw tag must be using <= 31 bits */
206b8b9d81bSVarun Prakash return !(tag & 0x80000000U);
207b8b9d81bSVarun Prakash }
208b8b9d81bSVarun Prakash
cxgbi_ppm_make_non_ddp_tag(struct cxgbi_ppm * ppm,u32 sw_tag,u32 * final_tag)209b8b9d81bSVarun Prakash static inline int cxgbi_ppm_make_non_ddp_tag(struct cxgbi_ppm *ppm,
210b8b9d81bSVarun Prakash u32 sw_tag,
211b8b9d81bSVarun Prakash u32 *final_tag)
212b8b9d81bSVarun Prakash {
213b8b9d81bSVarun Prakash struct cxgbi_tag_format *tformat = &ppm->tformat;
214b8b9d81bSVarun Prakash
215b8b9d81bSVarun Prakash if (!cxgbi_ppm_sw_tag_is_usable(ppm, sw_tag)) {
216b8b9d81bSVarun Prakash pr_info("sw_tag 0x%x NOT usable.\n", sw_tag);
217b8b9d81bSVarun Prakash return -EINVAL;
218b8b9d81bSVarun Prakash }
219b8b9d81bSVarun Prakash
220b8b9d81bSVarun Prakash if (!sw_tag) {
221b8b9d81bSVarun Prakash *final_tag = tformat->no_ddp_mask;
222b8b9d81bSVarun Prakash } else {
223b8b9d81bSVarun Prakash unsigned int shift = tformat->idx_bits + tformat->color_bits;
224b8b9d81bSVarun Prakash u32 lower = sw_tag & tformat->idx_clr_mask;
225b8b9d81bSVarun Prakash u32 upper = (sw_tag >> shift) << (shift + 1);
226b8b9d81bSVarun Prakash
227b8b9d81bSVarun Prakash *final_tag = upper | tformat->no_ddp_mask | lower;
228b8b9d81bSVarun Prakash }
229b8b9d81bSVarun Prakash return 0;
230b8b9d81bSVarun Prakash }
231b8b9d81bSVarun Prakash
cxgbi_ppm_decode_non_ddp_tag(struct cxgbi_ppm * ppm,u32 tag)232b8b9d81bSVarun Prakash static inline u32 cxgbi_ppm_decode_non_ddp_tag(struct cxgbi_ppm *ppm,
233b8b9d81bSVarun Prakash u32 tag)
234b8b9d81bSVarun Prakash {
235b8b9d81bSVarun Prakash struct cxgbi_tag_format *tformat = &ppm->tformat;
236b8b9d81bSVarun Prakash unsigned int shift = tformat->idx_bits + tformat->color_bits;
237b8b9d81bSVarun Prakash u32 lower = tag & tformat->idx_clr_mask;
238b8b9d81bSVarun Prakash u32 upper = (tag >> tformat->rsvd_bits) << shift;
239b8b9d81bSVarun Prakash
240b8b9d81bSVarun Prakash return upper | lower;
241b8b9d81bSVarun Prakash }
242b8b9d81bSVarun Prakash
cxgbi_ppm_ddp_tag_get_idx(struct cxgbi_ppm * ppm,u32 ddp_tag)243b8b9d81bSVarun Prakash static inline u32 cxgbi_ppm_ddp_tag_get_idx(struct cxgbi_ppm *ppm,
244b8b9d81bSVarun Prakash u32 ddp_tag)
245b8b9d81bSVarun Prakash {
246b8b9d81bSVarun Prakash u32 hw_idx = (ddp_tag >> PPOD_IDX_SHIFT) &
247b8b9d81bSVarun Prakash ppm->tformat.idx_mask;
248b8b9d81bSVarun Prakash
249b8b9d81bSVarun Prakash return hw_idx - ppm->base_idx;
250b8b9d81bSVarun Prakash }
251b8b9d81bSVarun Prakash
cxgbi_ppm_make_ddp_tag(unsigned int hw_idx,unsigned char color)252b8b9d81bSVarun Prakash static inline u32 cxgbi_ppm_make_ddp_tag(unsigned int hw_idx,
253b8b9d81bSVarun Prakash unsigned char color)
254b8b9d81bSVarun Prakash {
255b8b9d81bSVarun Prakash return (hw_idx << PPOD_IDX_SHIFT) | ((u32)color);
256b8b9d81bSVarun Prakash }
257b8b9d81bSVarun Prakash
258b8b9d81bSVarun Prakash static inline unsigned long
cxgbi_ppm_get_tag_caller_data(struct cxgbi_ppm * ppm,u32 ddp_tag)259b8b9d81bSVarun Prakash cxgbi_ppm_get_tag_caller_data(struct cxgbi_ppm *ppm,
260b8b9d81bSVarun Prakash u32 ddp_tag)
261b8b9d81bSVarun Prakash {
262b8b9d81bSVarun Prakash u32 idx = cxgbi_ppm_ddp_tag_get_idx(ppm, ddp_tag);
263b8b9d81bSVarun Prakash
264b8b9d81bSVarun Prakash return ppm->ppod_data[idx].caller_data;
265b8b9d81bSVarun Prakash }
266b8b9d81bSVarun Prakash
267b8b9d81bSVarun Prakash /* sw bits are the free bits */
cxgbi_ppm_ddp_tag_update_sw_bits(struct cxgbi_ppm * ppm,u32 val,u32 orig_tag,u32 * final_tag)268b8b9d81bSVarun Prakash static inline int cxgbi_ppm_ddp_tag_update_sw_bits(struct cxgbi_ppm *ppm,
269b8b9d81bSVarun Prakash u32 val, u32 orig_tag,
270b8b9d81bSVarun Prakash u32 *final_tag)
271b8b9d81bSVarun Prakash {
272b8b9d81bSVarun Prakash struct cxgbi_tag_format *tformat = &ppm->tformat;
273b8b9d81bSVarun Prakash u32 v = val >> tformat->free_bits;
274b8b9d81bSVarun Prakash
275b8b9d81bSVarun Prakash if (v) {
276b8b9d81bSVarun Prakash pr_info("sw_bits 0x%x too large, avail bits %u.\n",
277b8b9d81bSVarun Prakash val, tformat->free_bits);
278b8b9d81bSVarun Prakash return -EINVAL;
279b8b9d81bSVarun Prakash }
280b8b9d81bSVarun Prakash if (!cxgbi_ppm_is_ddp_tag(ppm, orig_tag))
281b8b9d81bSVarun Prakash return -EINVAL;
282b8b9d81bSVarun Prakash
283b8b9d81bSVarun Prakash *final_tag = (val << tformat->rsvd_bits) |
284b8b9d81bSVarun Prakash (orig_tag & ppm->tformat.rsvd_mask);
285b8b9d81bSVarun Prakash return 0;
286b8b9d81bSVarun Prakash }
287b8b9d81bSVarun Prakash
cxgbi_ppm_ppod_clear(struct cxgbi_pagepod * ppod)288b8b9d81bSVarun Prakash static inline void cxgbi_ppm_ppod_clear(struct cxgbi_pagepod *ppod)
289b8b9d81bSVarun Prakash {
290b8b9d81bSVarun Prakash ppod->hdr.vld_tid = 0U;
291b8b9d81bSVarun Prakash }
292b8b9d81bSVarun Prakash
cxgbi_tagmask_check(unsigned int tagmask,struct cxgbi_tag_format * tformat)293b8b9d81bSVarun Prakash static inline void cxgbi_tagmask_check(unsigned int tagmask,
294b8b9d81bSVarun Prakash struct cxgbi_tag_format *tformat)
295b8b9d81bSVarun Prakash {
296b8b9d81bSVarun Prakash unsigned int bits = fls(tagmask);
297b8b9d81bSVarun Prakash
298b8b9d81bSVarun Prakash /* reserve top most 2 bits for page selector */
299b8b9d81bSVarun Prakash tformat->free_bits = 32 - 2 - bits;
300b8b9d81bSVarun Prakash tformat->rsvd_bits = bits;
301b8b9d81bSVarun Prakash tformat->color_bits = PPOD_IDX_SHIFT;
302b8b9d81bSVarun Prakash tformat->idx_bits = bits - 1 - PPOD_IDX_SHIFT;
303b8b9d81bSVarun Prakash tformat->no_ddp_mask = 1 << (bits - 1);
304b8b9d81bSVarun Prakash tformat->idx_mask = (1 << tformat->idx_bits) - 1;
305b8b9d81bSVarun Prakash tformat->color_mask = (1 << PPOD_IDX_SHIFT) - 1;
306b8b9d81bSVarun Prakash tformat->idx_clr_mask = (1 << (bits - 1)) - 1;
307b8b9d81bSVarun Prakash tformat->rsvd_mask = (1 << bits) - 1;
308b8b9d81bSVarun Prakash
309b8b9d81bSVarun Prakash pr_info("ippm: tagmask 0x%x, rsvd %u=%u+%u+1, mask 0x%x,0x%x, "
310b8b9d81bSVarun Prakash "pg %u,%u,%u,%u.\n",
311b8b9d81bSVarun Prakash tagmask, tformat->rsvd_bits, tformat->idx_bits,
312b8b9d81bSVarun Prakash tformat->color_bits, tformat->no_ddp_mask, tformat->rsvd_mask,
313b8b9d81bSVarun Prakash tformat->pgsz_order[0], tformat->pgsz_order[1],
314b8b9d81bSVarun Prakash tformat->pgsz_order[2], tformat->pgsz_order[3]);
315b8b9d81bSVarun Prakash }
316b8b9d81bSVarun Prakash
317b8b9d81bSVarun Prakash int cxgbi_ppm_find_page_index(struct cxgbi_ppm *ppm, unsigned long pgsz);
318b8b9d81bSVarun Prakash void cxgbi_ppm_make_ppod_hdr(struct cxgbi_ppm *ppm, u32 tag,
319b8b9d81bSVarun Prakash unsigned int tid, unsigned int offset,
320b8b9d81bSVarun Prakash unsigned int length,
321b8b9d81bSVarun Prakash struct cxgbi_pagepod_hdr *hdr);
322b8b9d81bSVarun Prakash void cxgbi_ppm_ppod_release(struct cxgbi_ppm *, u32 idx);
323b8b9d81bSVarun Prakash int cxgbi_ppm_ppods_reserve(struct cxgbi_ppm *, unsigned short nr_pages,
324b8b9d81bSVarun Prakash u32 per_tag_pg_idx, u32 *ppod_idx, u32 *ddp_tag,
325b8b9d81bSVarun Prakash unsigned long caller_data);
326b8b9d81bSVarun Prakash int cxgbi_ppm_init(void **ppm_pp, struct net_device *, struct pci_dev *,
327b8b9d81bSVarun Prakash void *lldev, struct cxgbi_tag_format *,
328a248384eSVarun Prakash unsigned int iscsi_size, unsigned int llimit,
329a248384eSVarun Prakash unsigned int start, unsigned int reserve_factor,
330a248384eSVarun Prakash unsigned int edram_start, unsigned int edram_size);
331b8b9d81bSVarun Prakash int cxgbi_ppm_release(struct cxgbi_ppm *ppm);
332b8b9d81bSVarun Prakash void cxgbi_tagmask_check(unsigned int tagmask, struct cxgbi_tag_format *);
333b8b9d81bSVarun Prakash unsigned int cxgbi_tagmask_set(unsigned int ppmax);
334b8b9d81bSVarun Prakash
335b8b9d81bSVarun Prakash #endif /*__LIBCXGB_PPM_H__*/
336