1/*
2 * Copyright (C) 2003-2006 Chelsio Communications.  All rights reserved.
3 *
4 * This program is distributed in the hope that it will be useful, but WITHOUT
5 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6 * FITNESS FOR A PARTICULAR PURPOSE.  See the LICENSE file included in this
7 * release for licensing terms and conditions.
8 */
9
10#ifndef _CXGB3_OFFLOAD_CTL_DEFS_H
11#define _CXGB3_OFFLOAD_CTL_DEFS_H
12
13enum {
14	GET_MAX_OUTSTANDING_WR,
15	GET_TX_MAX_CHUNK,
16	GET_TID_RANGE,
17	GET_STID_RANGE,
18	GET_RTBL_RANGE,
19	GET_L2T_CAPACITY,
20	GET_MTUS,
21	GET_WR_LEN,
22	GET_IFF_FROM_MAC,
23	GET_DDP_PARAMS,
24	GET_PORTS,
25
26	ULP_ISCSI_GET_PARAMS,
27	ULP_ISCSI_SET_PARAMS,
28
29	RDMA_GET_PARAMS,
30	RDMA_CQ_OP,
31	RDMA_CQ_SETUP,
32	RDMA_CQ_DISABLE,
33	RDMA_CTRL_QP_SETUP,
34	RDMA_GET_MEM,
35
36	FAILOVER           = 30,
37	FAILOVER_DONE      = 31,
38	FAILOVER_CLEAR     = 32,
39
40	GET_CPUIDX_OF_QSET = 40,
41
42	GET_RX_PAGE_INFO   = 50,
43};
44
45/*
46 * Structure used to describe a TID range.  Valid TIDs are [base, base+num).
47 */
48struct tid_range {
49	unsigned int base;   /* first TID */
50	unsigned int num;    /* number of TIDs in range */
51};
52
53/*
54 * Structure used to request the size and contents of the MTU table.
55 */
56struct mtutab {
57	unsigned int size;          /* # of entries in the MTU table */
58	const unsigned short *mtus; /* the MTU table values */
59};
60
61/*
62 * Structure used to request the ifnet that owns a given MAC address.
63 */
64struct iff_mac {
65	if_t dev;
66	const unsigned char *mac_addr;
67	u16 vlan_tag;
68};
69
70struct pci_dev;
71
72/*
73 * Structure used to request the TCP DDP parameters.
74 */
75struct ddp_params {
76	unsigned int llimit;     /* TDDP region start address */
77	unsigned int ulimit;     /* TDDP region end address */
78	unsigned int tag_mask;   /* TDDP tag mask */
79	struct pci_dev *pdev;
80};
81
82struct adap_ports {
83	unsigned int nports;     /* number of ports on this adapter */
84	if_t devs[MAX_NPORTS];
85};
86
87/*
88 * Structure used to return information to the iscsi layer.
89 */
90struct ulp_iscsi_info {
91	unsigned int	offset;
92	unsigned int	llimit;
93	unsigned int	ulimit;
94	unsigned int	tagmask;
95	unsigned int	pgsz3;
96	unsigned int	pgsz2;
97	unsigned int	pgsz1;
98	unsigned int	pgsz0;
99	unsigned int	max_rxsz;
100	unsigned int	max_txsz;
101	struct pci_dev	*pdev;
102};
103
104/*
105 * Offload TX/RX page information.
106 */
107struct ofld_page_info {
108	unsigned int page_size;  /* Page size, should be a power of 2 */
109	unsigned int num;        /* Number of pages */
110};
111
112/*
113 * Structure used to return information to the RDMA layer.
114 */
115struct rdma_info {
116	unsigned int tpt_base;   /* TPT base address */
117	unsigned int tpt_top;	 /* TPT last entry address */
118	unsigned int pbl_base;   /* PBL base address */
119	unsigned int pbl_top;	 /* PBL last entry address */
120	unsigned int rqt_base;   /* RQT base address */
121	unsigned int rqt_top;	 /* RQT last entry address */
122	unsigned int udbell_len; /* user doorbell region length */
123	unsigned long udbell_physbase;  /* user doorbell physical start addr */
124	void *kdb_addr;  /* kernel doorbell register address */
125	device_t pdev;   /* associated PCI device */
126};
127
128/*
129 * Structure used to request an operation on an RDMA completion queue.
130 */
131struct rdma_cq_op {
132	unsigned int id;
133	unsigned int op;
134	unsigned int credits;
135};
136
137/*
138 * Structure used to setup RDMA completion queues.
139 */
140struct rdma_cq_setup {
141	unsigned int id;
142	unsigned long long base_addr;
143	unsigned int size;
144	unsigned int credits;
145	unsigned int credit_thres;
146	unsigned int ovfl_mode;
147};
148
149/*
150 * Structure used to setup the RDMA control egress context.
151 */
152struct rdma_ctrlqp_setup {
153	unsigned long long base_addr;
154	unsigned int size;
155};
156#endif /* _CXGB3_OFFLOAD_CTL_DEFS_H */
157