1f7917c00SJeff Kirsher /*
2f7917c00SJeff Kirsher  * Copyright (c) 2003-2008 Chelsio, Inc. All rights reserved.
3f7917c00SJeff Kirsher  *
4f7917c00SJeff Kirsher  * This software is available to you under a choice of one of two
5f7917c00SJeff Kirsher  * licenses.  You may choose to be licensed under the terms of the GNU
6f7917c00SJeff Kirsher  * General Public License (GPL) Version 2, available from the file
7f7917c00SJeff Kirsher  * COPYING in the main directory of this source tree, or the
8f7917c00SJeff Kirsher  * OpenIB.org BSD license below:
9f7917c00SJeff Kirsher  *
10f7917c00SJeff Kirsher  *     Redistribution and use in source and binary forms, with or
11f7917c00SJeff Kirsher  *     without modification, are permitted provided that the following
12f7917c00SJeff Kirsher  *     conditions are met:
13f7917c00SJeff Kirsher  *
14f7917c00SJeff Kirsher  *      - Redistributions of source code must retain the above
15f7917c00SJeff Kirsher  *        copyright notice, this list of conditions and the following
16f7917c00SJeff Kirsher  *        disclaimer.
17f7917c00SJeff Kirsher  *
18f7917c00SJeff Kirsher  *      - Redistributions in binary form must reproduce the above
19f7917c00SJeff Kirsher  *        copyright notice, this list of conditions and the following
20f7917c00SJeff Kirsher  *        disclaimer in the documentation and/or other materials
21f7917c00SJeff Kirsher  *        provided with the distribution.
22f7917c00SJeff Kirsher  *
23f7917c00SJeff Kirsher  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24f7917c00SJeff Kirsher  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25f7917c00SJeff Kirsher  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26f7917c00SJeff Kirsher  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27f7917c00SJeff Kirsher  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28f7917c00SJeff Kirsher  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29f7917c00SJeff Kirsher  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30f7917c00SJeff Kirsher  * SOFTWARE.
31f7917c00SJeff Kirsher  */
32f7917c00SJeff Kirsher #ifndef _CXGB3_OFFLOAD_CTL_DEFS_H
33f7917c00SJeff Kirsher #define _CXGB3_OFFLOAD_CTL_DEFS_H
34f7917c00SJeff Kirsher 
35f7917c00SJeff Kirsher enum {
36f7917c00SJeff Kirsher 	GET_MAX_OUTSTANDING_WR 	= 0,
37f7917c00SJeff Kirsher 	GET_TX_MAX_CHUNK	= 1,
38f7917c00SJeff Kirsher 	GET_TID_RANGE		= 2,
39f7917c00SJeff Kirsher 	GET_STID_RANGE		= 3,
40f7917c00SJeff Kirsher 	GET_RTBL_RANGE		= 4,
41f7917c00SJeff Kirsher 	GET_L2T_CAPACITY	= 5,
42f7917c00SJeff Kirsher 	GET_MTUS		= 6,
43f7917c00SJeff Kirsher 	GET_WR_LEN		= 7,
44f7917c00SJeff Kirsher 	GET_IFF_FROM_MAC	= 8,
45f7917c00SJeff Kirsher 	GET_DDP_PARAMS		= 9,
46f7917c00SJeff Kirsher 	GET_PORTS		= 10,
47f7917c00SJeff Kirsher 
48f7917c00SJeff Kirsher 	ULP_ISCSI_GET_PARAMS	= 11,
49f7917c00SJeff Kirsher 	ULP_ISCSI_SET_PARAMS	= 12,
50f7917c00SJeff Kirsher 
51f7917c00SJeff Kirsher 	RDMA_GET_PARAMS		= 13,
52f7917c00SJeff Kirsher 	RDMA_CQ_OP		= 14,
53f7917c00SJeff Kirsher 	RDMA_CQ_SETUP		= 15,
54f7917c00SJeff Kirsher 	RDMA_CQ_DISABLE		= 16,
55f7917c00SJeff Kirsher 	RDMA_CTRL_QP_SETUP	= 17,
56f7917c00SJeff Kirsher 	RDMA_GET_MEM		= 18,
57f7917c00SJeff Kirsher 	RDMA_GET_MIB		= 19,
58f7917c00SJeff Kirsher 
59f7917c00SJeff Kirsher 	GET_RX_PAGE_INFO	= 50,
60f7917c00SJeff Kirsher 	GET_ISCSI_IPV4ADDR	= 51,
61f7917c00SJeff Kirsher 
62f7917c00SJeff Kirsher 	GET_EMBEDDED_INFO	= 70,
63f7917c00SJeff Kirsher };
64f7917c00SJeff Kirsher 
65f7917c00SJeff Kirsher /*
66f7917c00SJeff Kirsher  * Structure used to describe a TID range.  Valid TIDs are [base, base+num).
67f7917c00SJeff Kirsher  */
68f7917c00SJeff Kirsher struct tid_range {
69f7917c00SJeff Kirsher 	unsigned int base;	/* first TID */
70f7917c00SJeff Kirsher 	unsigned int num;	/* number of TIDs in range */
71f7917c00SJeff Kirsher };
72f7917c00SJeff Kirsher 
73f7917c00SJeff Kirsher /*
74f7917c00SJeff Kirsher  * Structure used to request the size and contents of the MTU table.
75f7917c00SJeff Kirsher  */
76f7917c00SJeff Kirsher struct mtutab {
77f7917c00SJeff Kirsher 	unsigned int size;	/* # of entries in the MTU table */
78f7917c00SJeff Kirsher 	const unsigned short *mtus;	/* the MTU table values */
79f7917c00SJeff Kirsher };
80f7917c00SJeff Kirsher 
81f7917c00SJeff Kirsher struct net_device;
82f7917c00SJeff Kirsher 
83f7917c00SJeff Kirsher /*
84f7917c00SJeff Kirsher  * Structure used to request the adapter net_device owning a given MAC address.
85f7917c00SJeff Kirsher  */
86f7917c00SJeff Kirsher struct iff_mac {
87f7917c00SJeff Kirsher 	struct net_device *dev;	/* the net_device */
88f7917c00SJeff Kirsher 	const unsigned char *mac_addr;	/* MAC address to lookup */
89f7917c00SJeff Kirsher 	u16 vlan_tag;
90f7917c00SJeff Kirsher };
91f7917c00SJeff Kirsher 
92f7917c00SJeff Kirsher /* Structure used to request a port's iSCSI IPv4 address */
93f7917c00SJeff Kirsher struct iscsi_ipv4addr {
94f7917c00SJeff Kirsher 	struct net_device *dev;	/* the net_device */
95f7917c00SJeff Kirsher 	__be32 ipv4addr;	/* the return iSCSI IPv4 address */
96f7917c00SJeff Kirsher };
97f7917c00SJeff Kirsher 
98f7917c00SJeff Kirsher struct pci_dev;
99f7917c00SJeff Kirsher 
100f7917c00SJeff Kirsher /*
101f7917c00SJeff Kirsher  * Structure used to request the TCP DDP parameters.
102f7917c00SJeff Kirsher  */
103f7917c00SJeff Kirsher struct ddp_params {
104f7917c00SJeff Kirsher 	unsigned int llimit;	/* TDDP region start address */
105f7917c00SJeff Kirsher 	unsigned int ulimit;	/* TDDP region end address */
106f7917c00SJeff Kirsher 	unsigned int tag_mask;	/* TDDP tag mask */
107f7917c00SJeff Kirsher 	struct pci_dev *pdev;
108f7917c00SJeff Kirsher };
109f7917c00SJeff Kirsher 
110f7917c00SJeff Kirsher struct adap_ports {
111f7917c00SJeff Kirsher 	unsigned int nports;	/* number of ports on this adapter */
112f7917c00SJeff Kirsher 	struct net_device *lldevs[2];
113f7917c00SJeff Kirsher };
114f7917c00SJeff Kirsher 
115f7917c00SJeff Kirsher /*
116f7917c00SJeff Kirsher  * Structure used to return information to the iscsi layer.
117f7917c00SJeff Kirsher  */
118f7917c00SJeff Kirsher struct ulp_iscsi_info {
119f7917c00SJeff Kirsher 	unsigned int offset;
120f7917c00SJeff Kirsher 	unsigned int llimit;
121f7917c00SJeff Kirsher 	unsigned int ulimit;
122f7917c00SJeff Kirsher 	unsigned int tagmask;
123f7917c00SJeff Kirsher 	u8 pgsz_factor[4];
124f7917c00SJeff Kirsher 	unsigned int max_rxsz;
125f7917c00SJeff Kirsher 	unsigned int max_txsz;
126f7917c00SJeff Kirsher 	struct pci_dev *pdev;
127f7917c00SJeff Kirsher };
128f7917c00SJeff Kirsher 
129f7917c00SJeff Kirsher /*
130f7917c00SJeff Kirsher  * Structure used to return information to the RDMA layer.
131f7917c00SJeff Kirsher  */
132f7917c00SJeff Kirsher struct rdma_info {
133f7917c00SJeff Kirsher 	unsigned int tpt_base;	/* TPT base address */
134f7917c00SJeff Kirsher 	unsigned int tpt_top;	/* TPT last entry address */
135f7917c00SJeff Kirsher 	unsigned int pbl_base;	/* PBL base address */
136f7917c00SJeff Kirsher 	unsigned int pbl_top;	/* PBL last entry address */
137f7917c00SJeff Kirsher 	unsigned int rqt_base;	/* RQT base address */
138f7917c00SJeff Kirsher 	unsigned int rqt_top;	/* RQT last entry address */
139f7917c00SJeff Kirsher 	unsigned int udbell_len;	/* user doorbell region length */
140f7917c00SJeff Kirsher 	unsigned long udbell_physbase;	/* user doorbell physical start addr */
141f7917c00SJeff Kirsher 	void __iomem *kdb_addr;	/* kernel doorbell register address */
142f7917c00SJeff Kirsher 	struct pci_dev *pdev;	/* associated PCI device */
143f7917c00SJeff Kirsher };
144f7917c00SJeff Kirsher 
145f7917c00SJeff Kirsher /*
146f7917c00SJeff Kirsher  * Structure used to request an operation on an RDMA completion queue.
147f7917c00SJeff Kirsher  */
148f7917c00SJeff Kirsher struct rdma_cq_op {
149f7917c00SJeff Kirsher 	unsigned int id;
150f7917c00SJeff Kirsher 	unsigned int op;
151f7917c00SJeff Kirsher 	unsigned int credits;
152f7917c00SJeff Kirsher };
153f7917c00SJeff Kirsher 
154f7917c00SJeff Kirsher /*
155f7917c00SJeff Kirsher  * Structure used to setup RDMA completion queues.
156f7917c00SJeff Kirsher  */
157f7917c00SJeff Kirsher struct rdma_cq_setup {
158f7917c00SJeff Kirsher 	unsigned int id;
159f7917c00SJeff Kirsher 	unsigned long long base_addr;
160f7917c00SJeff Kirsher 	unsigned int size;
161f7917c00SJeff Kirsher 	unsigned int credits;
162f7917c00SJeff Kirsher 	unsigned int credit_thres;
163f7917c00SJeff Kirsher 	unsigned int ovfl_mode;
164f7917c00SJeff Kirsher };
165f7917c00SJeff Kirsher 
166f7917c00SJeff Kirsher /*
167f7917c00SJeff Kirsher  * Structure used to setup the RDMA control egress context.
168f7917c00SJeff Kirsher  */
169f7917c00SJeff Kirsher struct rdma_ctrlqp_setup {
170f7917c00SJeff Kirsher 	unsigned long long base_addr;
171f7917c00SJeff Kirsher 	unsigned int size;
172f7917c00SJeff Kirsher };
173f7917c00SJeff Kirsher 
174f7917c00SJeff Kirsher /*
175f7917c00SJeff Kirsher  * Offload TX/RX page information.
176f7917c00SJeff Kirsher  */
177f7917c00SJeff Kirsher struct ofld_page_info {
178f7917c00SJeff Kirsher 	unsigned int page_size;  /* Page size, should be a power of 2 */
179f7917c00SJeff Kirsher 	unsigned int num;        /* Number of pages */
180f7917c00SJeff Kirsher };
181f7917c00SJeff Kirsher 
182f7917c00SJeff Kirsher /*
183f7917c00SJeff Kirsher  * Structure used to get firmware and protocol engine versions.
184f7917c00SJeff Kirsher  */
185f7917c00SJeff Kirsher struct ch_embedded_info {
186f7917c00SJeff Kirsher 	u32 fw_vers;
187f7917c00SJeff Kirsher 	u32 tp_vers;
188f7917c00SJeff Kirsher };
189f7917c00SJeff Kirsher #endif				/* _CXGB3_OFFLOAD_CTL_DEFS_H */
190