18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * libcxgb_ppm.h: Chelsio common library for T3/T4/T5 iSCSI ddp operation 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Copyright (c) 2016 Chelsio Communications, Inc. All rights reserved. 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * This software is available to you under a choice of one of two 78c2ecf20Sopenharmony_ci * licenses. You may choose to be licensed under the terms of the GNU 88c2ecf20Sopenharmony_ci * General Public License (GPL) Version 2, available from the file 98c2ecf20Sopenharmony_ci * COPYING in the main directory of this source tree, or the 108c2ecf20Sopenharmony_ci * OpenIB.org BSD license below: 118c2ecf20Sopenharmony_ci * 128c2ecf20Sopenharmony_ci * Redistribution and use in source and binary forms, with or 138c2ecf20Sopenharmony_ci * without modification, are permitted provided that the following 148c2ecf20Sopenharmony_ci * conditions are met: 158c2ecf20Sopenharmony_ci * 168c2ecf20Sopenharmony_ci * - Redistributions of source code must retain the above 178c2ecf20Sopenharmony_ci * copyright notice, this list of conditions and the following 188c2ecf20Sopenharmony_ci * disclaimer. 198c2ecf20Sopenharmony_ci * 208c2ecf20Sopenharmony_ci * - Redistributions in binary form must reproduce the above 218c2ecf20Sopenharmony_ci * copyright notice, this list of conditions and the following 228c2ecf20Sopenharmony_ci * disclaimer in the documentation and/or other materials 238c2ecf20Sopenharmony_ci * provided with the distribution. 248c2ecf20Sopenharmony_ci * 258c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 268c2ecf20Sopenharmony_ci * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 278c2ecf20Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 288c2ecf20Sopenharmony_ci * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 298c2ecf20Sopenharmony_ci * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 308c2ecf20Sopenharmony_ci * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 318c2ecf20Sopenharmony_ci * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 328c2ecf20Sopenharmony_ci * SOFTWARE. 338c2ecf20Sopenharmony_ci * 348c2ecf20Sopenharmony_ci * Written by: Karen Xie (kxie@chelsio.com) 358c2ecf20Sopenharmony_ci */ 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci#ifndef __LIBCXGB_PPM_H__ 388c2ecf20Sopenharmony_ci#define __LIBCXGB_PPM_H__ 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci#include <linux/kernel.h> 418c2ecf20Sopenharmony_ci#include <linux/errno.h> 428c2ecf20Sopenharmony_ci#include <linux/types.h> 438c2ecf20Sopenharmony_ci#include <linux/debugfs.h> 448c2ecf20Sopenharmony_ci#include <linux/list.h> 458c2ecf20Sopenharmony_ci#include <linux/netdevice.h> 468c2ecf20Sopenharmony_ci#include <linux/scatterlist.h> 478c2ecf20Sopenharmony_ci#include <linux/skbuff.h> 488c2ecf20Sopenharmony_ci#include <linux/vmalloc.h> 498c2ecf20Sopenharmony_ci#include <linux/bitmap.h> 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_cistruct cxgbi_pagepod_hdr { 528c2ecf20Sopenharmony_ci u32 vld_tid; 538c2ecf20Sopenharmony_ci u32 pgsz_tag_clr; 548c2ecf20Sopenharmony_ci u32 max_offset; 558c2ecf20Sopenharmony_ci u32 page_offset; 568c2ecf20Sopenharmony_ci u64 rsvd; 578c2ecf20Sopenharmony_ci}; 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ci#define PPOD_PAGES_MAX 4 608c2ecf20Sopenharmony_cistruct cxgbi_pagepod { 618c2ecf20Sopenharmony_ci struct cxgbi_pagepod_hdr hdr; 628c2ecf20Sopenharmony_ci __be64 addr[PPOD_PAGES_MAX + 1]; 638c2ecf20Sopenharmony_ci}; 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_ci/* ddp tag format 668c2ecf20Sopenharmony_ci * for a 32-bit tag: 678c2ecf20Sopenharmony_ci * bit # 688c2ecf20Sopenharmony_ci * 31 ..... ..... 0 698c2ecf20Sopenharmony_ci * X Y...Y Z...Z, where 708c2ecf20Sopenharmony_ci * ^ ^^^^^ ^^^^ 718c2ecf20Sopenharmony_ci * | | |____ when ddp bit = 0: color bits 728c2ecf20Sopenharmony_ci * | | 738c2ecf20Sopenharmony_ci * | |____ when ddp bit = 0: idx into the ddp memory region 748c2ecf20Sopenharmony_ci * | 758c2ecf20Sopenharmony_ci * |____ ddp bit: 0 - ddp tag, 1 - non-ddp tag 768c2ecf20Sopenharmony_ci * 778c2ecf20Sopenharmony_ci * [page selector:2] [sw/free bits] [0] [idx] [color:6] 788c2ecf20Sopenharmony_ci */ 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_ci#define DDP_PGIDX_MAX 4 818c2ecf20Sopenharmony_ci#define DDP_PGSZ_BASE_SHIFT 12 /* base page 4K */ 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_cistruct cxgbi_task_tag_info { 848c2ecf20Sopenharmony_ci unsigned char flags; 858c2ecf20Sopenharmony_ci#define CXGBI_PPOD_INFO_FLAG_VALID 0x1 868c2ecf20Sopenharmony_ci#define CXGBI_PPOD_INFO_FLAG_MAPPED 0x2 878c2ecf20Sopenharmony_ci unsigned char cid; 888c2ecf20Sopenharmony_ci unsigned short pg_shift; 898c2ecf20Sopenharmony_ci unsigned int npods; 908c2ecf20Sopenharmony_ci unsigned int idx; 918c2ecf20Sopenharmony_ci unsigned int tag; 928c2ecf20Sopenharmony_ci struct cxgbi_pagepod_hdr hdr; 938c2ecf20Sopenharmony_ci int nents; 948c2ecf20Sopenharmony_ci int nr_pages; 958c2ecf20Sopenharmony_ci struct scatterlist *sgl; 968c2ecf20Sopenharmony_ci}; 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_cistruct cxgbi_tag_format { 998c2ecf20Sopenharmony_ci unsigned char pgsz_order[DDP_PGIDX_MAX]; 1008c2ecf20Sopenharmony_ci unsigned char pgsz_idx_dflt; 1018c2ecf20Sopenharmony_ci unsigned char free_bits:4; 1028c2ecf20Sopenharmony_ci unsigned char color_bits:4; 1038c2ecf20Sopenharmony_ci unsigned char idx_bits; 1048c2ecf20Sopenharmony_ci unsigned char rsvd_bits; 1058c2ecf20Sopenharmony_ci unsigned int no_ddp_mask; 1068c2ecf20Sopenharmony_ci unsigned int idx_mask; 1078c2ecf20Sopenharmony_ci unsigned int color_mask; 1088c2ecf20Sopenharmony_ci unsigned int idx_clr_mask; 1098c2ecf20Sopenharmony_ci unsigned int rsvd_mask; 1108c2ecf20Sopenharmony_ci}; 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_cistruct cxgbi_ppod_data { 1138c2ecf20Sopenharmony_ci unsigned char pg_idx:2; 1148c2ecf20Sopenharmony_ci unsigned char color:6; 1158c2ecf20Sopenharmony_ci unsigned char chan_id; 1168c2ecf20Sopenharmony_ci unsigned short npods; 1178c2ecf20Sopenharmony_ci unsigned long caller_data; 1188c2ecf20Sopenharmony_ci}; 1198c2ecf20Sopenharmony_ci 1208c2ecf20Sopenharmony_ci/* per cpu ppm pool */ 1218c2ecf20Sopenharmony_cistruct cxgbi_ppm_pool { 1228c2ecf20Sopenharmony_ci unsigned int base; /* base index */ 1238c2ecf20Sopenharmony_ci unsigned int next; /* next possible free index */ 1248c2ecf20Sopenharmony_ci spinlock_t lock; /* ppm pool lock */ 1258c2ecf20Sopenharmony_ci unsigned long bmap[]; 1268c2ecf20Sopenharmony_ci} ____cacheline_aligned_in_smp; 1278c2ecf20Sopenharmony_ci 1288c2ecf20Sopenharmony_cistruct cxgbi_ppm { 1298c2ecf20Sopenharmony_ci struct kref refcnt; 1308c2ecf20Sopenharmony_ci struct net_device *ndev; /* net_device, 1st port */ 1318c2ecf20Sopenharmony_ci struct pci_dev *pdev; 1328c2ecf20Sopenharmony_ci void *lldev; 1338c2ecf20Sopenharmony_ci void **ppm_pp; 1348c2ecf20Sopenharmony_ci struct cxgbi_tag_format tformat; 1358c2ecf20Sopenharmony_ci unsigned int ppmax; 1368c2ecf20Sopenharmony_ci unsigned int llimit; 1378c2ecf20Sopenharmony_ci unsigned int base_idx; 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_ci unsigned int pool_rsvd; 1408c2ecf20Sopenharmony_ci unsigned int pool_index_max; 1418c2ecf20Sopenharmony_ci struct cxgbi_ppm_pool __percpu *pool; 1428c2ecf20Sopenharmony_ci /* map lock */ 1438c2ecf20Sopenharmony_ci spinlock_t map_lock; /* ppm map lock */ 1448c2ecf20Sopenharmony_ci unsigned int bmap_index_max; 1458c2ecf20Sopenharmony_ci unsigned int next; 1468c2ecf20Sopenharmony_ci unsigned int max_index_in_edram; 1478c2ecf20Sopenharmony_ci unsigned long *ppod_bmap; 1488c2ecf20Sopenharmony_ci struct cxgbi_ppod_data ppod_data[]; 1498c2ecf20Sopenharmony_ci}; 1508c2ecf20Sopenharmony_ci 1518c2ecf20Sopenharmony_ci#define DDP_THRESHOLD 512 1528c2ecf20Sopenharmony_ci 1538c2ecf20Sopenharmony_ci#define PPOD_PAGES_SHIFT 2 /* 4 pages per pod */ 1548c2ecf20Sopenharmony_ci 1558c2ecf20Sopenharmony_ci#define IPPOD_SIZE sizeof(struct cxgbi_pagepod) /* 64 */ 1568c2ecf20Sopenharmony_ci#define PPOD_SIZE_SHIFT 6 1578c2ecf20Sopenharmony_ci 1588c2ecf20Sopenharmony_ci/* page pods are allocated in groups of this size (must be power of 2) */ 1598c2ecf20Sopenharmony_ci#define PPOD_CLUSTER_SIZE 16U 1608c2ecf20Sopenharmony_ci 1618c2ecf20Sopenharmony_ci#define ULPMEM_DSGL_MAX_NPPODS 16 /* 1024/PPOD_SIZE */ 1628c2ecf20Sopenharmony_ci#define ULPMEM_IDATA_MAX_NPPODS 3 /* (PPOD_SIZE * 3 + ulptx hdr) < 256B */ 1638c2ecf20Sopenharmony_ci#define PCIE_MEMWIN_MAX_NPPODS 16 /* 1024/PPOD_SIZE */ 1648c2ecf20Sopenharmony_ci 1658c2ecf20Sopenharmony_ci#define PPOD_COLOR_SHIFT 0 1668c2ecf20Sopenharmony_ci#define PPOD_COLOR(x) ((x) << PPOD_COLOR_SHIFT) 1678c2ecf20Sopenharmony_ci 1688c2ecf20Sopenharmony_ci#define PPOD_IDX_SHIFT 6 1698c2ecf20Sopenharmony_ci#define PPOD_IDX_MAX_SIZE 24 1708c2ecf20Sopenharmony_ci 1718c2ecf20Sopenharmony_ci#define PPOD_TID_SHIFT 0 1728c2ecf20Sopenharmony_ci#define PPOD_TID(x) ((x) << PPOD_TID_SHIFT) 1738c2ecf20Sopenharmony_ci 1748c2ecf20Sopenharmony_ci#define PPOD_TAG_SHIFT 6 1758c2ecf20Sopenharmony_ci#define PPOD_TAG(x) ((x) << PPOD_TAG_SHIFT) 1768c2ecf20Sopenharmony_ci 1778c2ecf20Sopenharmony_ci#define PPOD_VALID_SHIFT 24 1788c2ecf20Sopenharmony_ci#define PPOD_VALID(x) ((x) << PPOD_VALID_SHIFT) 1798c2ecf20Sopenharmony_ci#define PPOD_VALID_FLAG PPOD_VALID(1U) 1808c2ecf20Sopenharmony_ci 1818c2ecf20Sopenharmony_ci#define PPOD_PI_EXTRACT_CTL_SHIFT 31 1828c2ecf20Sopenharmony_ci#define PPOD_PI_EXTRACT_CTL(x) ((x) << PPOD_PI_EXTRACT_CTL_SHIFT) 1838c2ecf20Sopenharmony_ci#define PPOD_PI_EXTRACT_CTL_FLAG V_PPOD_PI_EXTRACT_CTL(1U) 1848c2ecf20Sopenharmony_ci 1858c2ecf20Sopenharmony_ci#define PPOD_PI_TYPE_SHIFT 29 1868c2ecf20Sopenharmony_ci#define PPOD_PI_TYPE_MASK 0x3 1878c2ecf20Sopenharmony_ci#define PPOD_PI_TYPE(x) ((x) << PPOD_PI_TYPE_SHIFT) 1888c2ecf20Sopenharmony_ci 1898c2ecf20Sopenharmony_ci#define PPOD_PI_CHECK_CTL_SHIFT 27 1908c2ecf20Sopenharmony_ci#define PPOD_PI_CHECK_CTL_MASK 0x3 1918c2ecf20Sopenharmony_ci#define PPOD_PI_CHECK_CTL(x) ((x) << PPOD_PI_CHECK_CTL_SHIFT) 1928c2ecf20Sopenharmony_ci 1938c2ecf20Sopenharmony_ci#define PPOD_PI_REPORT_CTL_SHIFT 25 1948c2ecf20Sopenharmony_ci#define PPOD_PI_REPORT_CTL_MASK 0x3 1958c2ecf20Sopenharmony_ci#define PPOD_PI_REPORT_CTL(x) ((x) << PPOD_PI_REPORT_CTL_SHIFT) 1968c2ecf20Sopenharmony_ci 1978c2ecf20Sopenharmony_cistatic inline int cxgbi_ppm_is_ddp_tag(struct cxgbi_ppm *ppm, u32 tag) 1988c2ecf20Sopenharmony_ci{ 1998c2ecf20Sopenharmony_ci return !(tag & ppm->tformat.no_ddp_mask); 2008c2ecf20Sopenharmony_ci} 2018c2ecf20Sopenharmony_ci 2028c2ecf20Sopenharmony_cistatic inline int cxgbi_ppm_sw_tag_is_usable(struct cxgbi_ppm *ppm, 2038c2ecf20Sopenharmony_ci u32 tag) 2048c2ecf20Sopenharmony_ci{ 2058c2ecf20Sopenharmony_ci /* the sw tag must be using <= 31 bits */ 2068c2ecf20Sopenharmony_ci return !(tag & 0x80000000U); 2078c2ecf20Sopenharmony_ci} 2088c2ecf20Sopenharmony_ci 2098c2ecf20Sopenharmony_cistatic inline int cxgbi_ppm_make_non_ddp_tag(struct cxgbi_ppm *ppm, 2108c2ecf20Sopenharmony_ci u32 sw_tag, 2118c2ecf20Sopenharmony_ci u32 *final_tag) 2128c2ecf20Sopenharmony_ci{ 2138c2ecf20Sopenharmony_ci struct cxgbi_tag_format *tformat = &ppm->tformat; 2148c2ecf20Sopenharmony_ci 2158c2ecf20Sopenharmony_ci if (!cxgbi_ppm_sw_tag_is_usable(ppm, sw_tag)) { 2168c2ecf20Sopenharmony_ci pr_info("sw_tag 0x%x NOT usable.\n", sw_tag); 2178c2ecf20Sopenharmony_ci return -EINVAL; 2188c2ecf20Sopenharmony_ci } 2198c2ecf20Sopenharmony_ci 2208c2ecf20Sopenharmony_ci if (!sw_tag) { 2218c2ecf20Sopenharmony_ci *final_tag = tformat->no_ddp_mask; 2228c2ecf20Sopenharmony_ci } else { 2238c2ecf20Sopenharmony_ci unsigned int shift = tformat->idx_bits + tformat->color_bits; 2248c2ecf20Sopenharmony_ci u32 lower = sw_tag & tformat->idx_clr_mask; 2258c2ecf20Sopenharmony_ci u32 upper = (sw_tag >> shift) << (shift + 1); 2268c2ecf20Sopenharmony_ci 2278c2ecf20Sopenharmony_ci *final_tag = upper | tformat->no_ddp_mask | lower; 2288c2ecf20Sopenharmony_ci } 2298c2ecf20Sopenharmony_ci return 0; 2308c2ecf20Sopenharmony_ci} 2318c2ecf20Sopenharmony_ci 2328c2ecf20Sopenharmony_cistatic inline u32 cxgbi_ppm_decode_non_ddp_tag(struct cxgbi_ppm *ppm, 2338c2ecf20Sopenharmony_ci u32 tag) 2348c2ecf20Sopenharmony_ci{ 2358c2ecf20Sopenharmony_ci struct cxgbi_tag_format *tformat = &ppm->tformat; 2368c2ecf20Sopenharmony_ci unsigned int shift = tformat->idx_bits + tformat->color_bits; 2378c2ecf20Sopenharmony_ci u32 lower = tag & tformat->idx_clr_mask; 2388c2ecf20Sopenharmony_ci u32 upper = (tag >> tformat->rsvd_bits) << shift; 2398c2ecf20Sopenharmony_ci 2408c2ecf20Sopenharmony_ci return upper | lower; 2418c2ecf20Sopenharmony_ci} 2428c2ecf20Sopenharmony_ci 2438c2ecf20Sopenharmony_cistatic inline u32 cxgbi_ppm_ddp_tag_get_idx(struct cxgbi_ppm *ppm, 2448c2ecf20Sopenharmony_ci u32 ddp_tag) 2458c2ecf20Sopenharmony_ci{ 2468c2ecf20Sopenharmony_ci u32 hw_idx = (ddp_tag >> PPOD_IDX_SHIFT) & 2478c2ecf20Sopenharmony_ci ppm->tformat.idx_mask; 2488c2ecf20Sopenharmony_ci 2498c2ecf20Sopenharmony_ci return hw_idx - ppm->base_idx; 2508c2ecf20Sopenharmony_ci} 2518c2ecf20Sopenharmony_ci 2528c2ecf20Sopenharmony_cistatic inline u32 cxgbi_ppm_make_ddp_tag(unsigned int hw_idx, 2538c2ecf20Sopenharmony_ci unsigned char color) 2548c2ecf20Sopenharmony_ci{ 2558c2ecf20Sopenharmony_ci return (hw_idx << PPOD_IDX_SHIFT) | ((u32)color); 2568c2ecf20Sopenharmony_ci} 2578c2ecf20Sopenharmony_ci 2588c2ecf20Sopenharmony_cistatic inline unsigned long 2598c2ecf20Sopenharmony_cicxgbi_ppm_get_tag_caller_data(struct cxgbi_ppm *ppm, 2608c2ecf20Sopenharmony_ci u32 ddp_tag) 2618c2ecf20Sopenharmony_ci{ 2628c2ecf20Sopenharmony_ci u32 idx = cxgbi_ppm_ddp_tag_get_idx(ppm, ddp_tag); 2638c2ecf20Sopenharmony_ci 2648c2ecf20Sopenharmony_ci return ppm->ppod_data[idx].caller_data; 2658c2ecf20Sopenharmony_ci} 2668c2ecf20Sopenharmony_ci 2678c2ecf20Sopenharmony_ci/* sw bits are the free bits */ 2688c2ecf20Sopenharmony_cistatic inline int cxgbi_ppm_ddp_tag_update_sw_bits(struct cxgbi_ppm *ppm, 2698c2ecf20Sopenharmony_ci u32 val, u32 orig_tag, 2708c2ecf20Sopenharmony_ci u32 *final_tag) 2718c2ecf20Sopenharmony_ci{ 2728c2ecf20Sopenharmony_ci struct cxgbi_tag_format *tformat = &ppm->tformat; 2738c2ecf20Sopenharmony_ci u32 v = val >> tformat->free_bits; 2748c2ecf20Sopenharmony_ci 2758c2ecf20Sopenharmony_ci if (v) { 2768c2ecf20Sopenharmony_ci pr_info("sw_bits 0x%x too large, avail bits %u.\n", 2778c2ecf20Sopenharmony_ci val, tformat->free_bits); 2788c2ecf20Sopenharmony_ci return -EINVAL; 2798c2ecf20Sopenharmony_ci } 2808c2ecf20Sopenharmony_ci if (!cxgbi_ppm_is_ddp_tag(ppm, orig_tag)) 2818c2ecf20Sopenharmony_ci return -EINVAL; 2828c2ecf20Sopenharmony_ci 2838c2ecf20Sopenharmony_ci *final_tag = (val << tformat->rsvd_bits) | 2848c2ecf20Sopenharmony_ci (orig_tag & ppm->tformat.rsvd_mask); 2858c2ecf20Sopenharmony_ci return 0; 2868c2ecf20Sopenharmony_ci} 2878c2ecf20Sopenharmony_ci 2888c2ecf20Sopenharmony_cistatic inline void cxgbi_ppm_ppod_clear(struct cxgbi_pagepod *ppod) 2898c2ecf20Sopenharmony_ci{ 2908c2ecf20Sopenharmony_ci ppod->hdr.vld_tid = 0U; 2918c2ecf20Sopenharmony_ci} 2928c2ecf20Sopenharmony_ci 2938c2ecf20Sopenharmony_cistatic inline void cxgbi_tagmask_check(unsigned int tagmask, 2948c2ecf20Sopenharmony_ci struct cxgbi_tag_format *tformat) 2958c2ecf20Sopenharmony_ci{ 2968c2ecf20Sopenharmony_ci unsigned int bits = fls(tagmask); 2978c2ecf20Sopenharmony_ci 2988c2ecf20Sopenharmony_ci /* reserve top most 2 bits for page selector */ 2998c2ecf20Sopenharmony_ci tformat->free_bits = 32 - 2 - bits; 3008c2ecf20Sopenharmony_ci tformat->rsvd_bits = bits; 3018c2ecf20Sopenharmony_ci tformat->color_bits = PPOD_IDX_SHIFT; 3028c2ecf20Sopenharmony_ci tformat->idx_bits = bits - 1 - PPOD_IDX_SHIFT; 3038c2ecf20Sopenharmony_ci tformat->no_ddp_mask = 1 << (bits - 1); 3048c2ecf20Sopenharmony_ci tformat->idx_mask = (1 << tformat->idx_bits) - 1; 3058c2ecf20Sopenharmony_ci tformat->color_mask = (1 << PPOD_IDX_SHIFT) - 1; 3068c2ecf20Sopenharmony_ci tformat->idx_clr_mask = (1 << (bits - 1)) - 1; 3078c2ecf20Sopenharmony_ci tformat->rsvd_mask = (1 << bits) - 1; 3088c2ecf20Sopenharmony_ci 3098c2ecf20Sopenharmony_ci pr_info("ippm: tagmask 0x%x, rsvd %u=%u+%u+1, mask 0x%x,0x%x, " 3108c2ecf20Sopenharmony_ci "pg %u,%u,%u,%u.\n", 3118c2ecf20Sopenharmony_ci tagmask, tformat->rsvd_bits, tformat->idx_bits, 3128c2ecf20Sopenharmony_ci tformat->color_bits, tformat->no_ddp_mask, tformat->rsvd_mask, 3138c2ecf20Sopenharmony_ci tformat->pgsz_order[0], tformat->pgsz_order[1], 3148c2ecf20Sopenharmony_ci tformat->pgsz_order[2], tformat->pgsz_order[3]); 3158c2ecf20Sopenharmony_ci} 3168c2ecf20Sopenharmony_ci 3178c2ecf20Sopenharmony_ciint cxgbi_ppm_find_page_index(struct cxgbi_ppm *ppm, unsigned long pgsz); 3188c2ecf20Sopenharmony_civoid cxgbi_ppm_make_ppod_hdr(struct cxgbi_ppm *ppm, u32 tag, 3198c2ecf20Sopenharmony_ci unsigned int tid, unsigned int offset, 3208c2ecf20Sopenharmony_ci unsigned int length, 3218c2ecf20Sopenharmony_ci struct cxgbi_pagepod_hdr *hdr); 3228c2ecf20Sopenharmony_civoid cxgbi_ppm_ppod_release(struct cxgbi_ppm *, u32 idx); 3238c2ecf20Sopenharmony_ciint cxgbi_ppm_ppods_reserve(struct cxgbi_ppm *, unsigned short nr_pages, 3248c2ecf20Sopenharmony_ci u32 per_tag_pg_idx, u32 *ppod_idx, u32 *ddp_tag, 3258c2ecf20Sopenharmony_ci unsigned long caller_data); 3268c2ecf20Sopenharmony_ciint cxgbi_ppm_init(void **ppm_pp, struct net_device *, struct pci_dev *, 3278c2ecf20Sopenharmony_ci void *lldev, struct cxgbi_tag_format *, 3288c2ecf20Sopenharmony_ci unsigned int iscsi_size, unsigned int llimit, 3298c2ecf20Sopenharmony_ci unsigned int start, unsigned int reserve_factor, 3308c2ecf20Sopenharmony_ci unsigned int edram_start, unsigned int edram_size); 3318c2ecf20Sopenharmony_ciint cxgbi_ppm_release(struct cxgbi_ppm *ppm); 3328c2ecf20Sopenharmony_civoid cxgbi_tagmask_check(unsigned int tagmask, struct cxgbi_tag_format *); 3338c2ecf20Sopenharmony_ciunsigned int cxgbi_tagmask_set(unsigned int ppmax); 3348c2ecf20Sopenharmony_ci 3358c2ecf20Sopenharmony_ci#endif /*__LIBCXGB_PPM_H__*/ 336